diff options
author | johnvg | 2004-04-19 15:39:43 +0000 |
---|---|---|
committer | johnvg | 2004-04-19 15:39:43 +0000 |
commit | 43d76d15823b8d7aa8811964c0784c01ddeb8bf6 (patch) | |
tree | f149142b0ca65e21ad6c886f16be3d9c705c40b6 /backendC | |
parent | remove TC; types (diff) |
port to gcc on Mac OS X
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@1487 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'backendC')
-rw-r--r-- | backendC/CleanCompilerSources/mac_io.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/backendC/CleanCompilerSources/mac_io.c b/backendC/CleanCompilerSources/mac_io.c index 4a2df07..f153e0e 100644 --- a/backendC/CleanCompilerSources/mac_io.c +++ b/backendC/CleanCompilerSources/mac_io.c @@ -7,7 +7,7 @@ #define for_l(v,l,n) for(v=(l);v!=NULL;v=v->n) -#if defined (applec) || defined (__MWERKS__) || defined (__MRC__) +#if defined (applec) || defined (__MWERKS__) || defined (__MRC__) || defined (GNU_C) # define mpwc #endif @@ -39,11 +39,14 @@ #endif #include <Files.h> #include <Memory.h> -#ifdef mpwc +#ifndef mpwc # include <strings.h> #endif #include <Devices.h> #include <Events.h> +#ifdef KARBON +# include <Script.h> +#endif #ifndef mpwc # include <unix.h> #endif @@ -801,6 +804,44 @@ extern char *clean_abc_path; /* imported from clm.c */ } #endif +#if defined (GNU_C) +static FILE *fopen_with_file_name_conversion (char *file_name,char *mode) +{ + FSSpec fs_spec; + FSRef fs_ref; + CFURLRef CFURL_ref; + char buffer[512+1]; + int string_size; + Boolean r; + OSErr e; + + buffer[0]=strlen (file_name); + strcpy (&buffer[1],file_name); + + e=FSMakeFSSpec (0/*vRefNum*/,0/*dirID*/,buffer,&fs_spec); + if (e!=noErr) + return NULL; + + e=FSpMakeFSRef (&fs_spec,&fs_ref); + if (e!=noErr) + return NULL; + + CFURL_ref=CFURLCreateFromFSRef (NULL,&fs_ref); + + string_size=512; + r=CFURLGetFileSystemRepresentation (CFURL_ref,1,buffer,string_size); + + if (!r) + return NULL; + + file_name=buffer; + + return fopen (file_name,mode); +} + +# define fopen fopen_with_file_name_conversion +#endif + #if WRITE_DCL_MODIFICATION_TIME File FOpenWithFileTime (char *file_name,FileKind kind, char *mode,FileTime *file_time_p) { @@ -816,6 +857,10 @@ File FOpenWithFileTime (char *file_name,FileKind kind, char *mode,FileTime *file } #endif +#if 0 +extern File rules_file; +#endif + File FOpen (char *file_name,FileKind kind, char *mode) { char path[MAXPATHLEN]; @@ -824,6 +869,11 @@ File FOpen (char *file_name,FileKind kind, char *mode) #ifdef mpwc if (mode[0]=='r'){ findfilepath (file_name,kind,path); + +# if 0 + FPrintF (rules_file,"%s\n",path); +# endif + return (File) fopen (path, mode); } else { char *p; @@ -1289,5 +1339,4 @@ int System (char *file_name) return error; } #endif -} /* System */ - +} |