Commit 7c919e8f authored by Diederik van Arkel's avatar Diederik van Arkel

processor dependencies

parent 942229b4
......@@ -12,7 +12,7 @@ import PmTypes
//ifWindows w o :== o
standardStaticLibraries :: !LinkMethod -> List String
standardObjectFiles :: !Bool !Bool -> List String
standardObjectFiles :: !Bool !Bool !Processor -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
......@@ -123,7 +123,7 @@ Execute :: // Executes the given application
)
Launch :: !{#Char} !.a -> (!Int, !.a)
//Execute` :: !String *env -> (*env, !Bool)
Execute` :: !String !*env -> (!Bool,!Int,!*env)
// RWS ...
......
......@@ -20,11 +20,12 @@ import xcoff_linker
import ostoolbox
from files import LaunchApplicationFSSpec, FSMakeFSSpec
import memory,appleevents
import Platform
KAEQueueReply :== 2
//import StdDebug,dodebug
//import dodebug
import dodebug
trace_n _ f :== f
fopena :== fopen
......@@ -54,16 +55,27 @@ standardStaticLibraries :: !LinkMethod -> List String
standardStaticLibraries method
= case method of
LM_Static -> ("library0" :! "library1" :! "library2" :! Nil)
// LM_Eager -> ("library0" :! "library1" :! "library2" :! Nil)//("kernel_library" :! "StaticClientChannel_library" :! Nil)
LM_Dynamic -> ("library0" :! "library1" :! "library2" :! Nil)//("kernel_library" :! "ClientChannel_library" :! Nil)
// LM_Eager -> ("library0" :! "library1" :! "library2" :! Nil)
LM_Dynamic -> ("library0" :! "library1" :! "library2" :! Nil)
standardObjectFiles :: !Bool !Bool -> List String
standardObjectFiles stack_traces profiling
standardObjectFiles :: !Bool !Bool !Processor -> List String
standardObjectFiles stack_traces profiling processor
| stack_traces
= ("_startupTrace.o" :! "_system.o" :! "_library.o" :! Nil)
= ( MakeObjPathname processor "_startupTrace" :! rest)
| profiling
= ("_startupProfile.o" :! "_system.o" :! "_library.o" :! Nil)
= ("_startup.o" :! "_system.o" :! "_library.o" :! Nil)
= ( MakeObjPathname processor "_startupProfile" :! rest)
= ( MakeObjPathname processor "_startup" :! rest)
where
rest
| ProcessorSuffix processor == ".o" // PowerPC Mach-O
= MakeObjPathname processor "_startup2"
:! MakeObjPathname processor "_startup3"
:! MakeObjPathname processor "_system"
:! MakeObjPathname processor "_library"
:! Nil
= MakeObjPathname processor "_system"
:! MakeObjPathname processor "_library"
:! Nil
//-- interface to static libraries...
......@@ -187,7 +199,7 @@ Compile cocl` write_module_times errwin typewin compileOrCheckSyntax path paths
ps = case type_text_not_empty of
True -> typewin (StrictListToList type_text) ps
False -> ps
= (ps,abcpath,if (error_n==1) CompilerOK errors)
= /*trace_n` ("Compile",command)*/ (ps,abcpath,if (error_n==1) CompilerOK errors)
where
(cocl_ok,cocl,name,signature) = mangleCompiler cocl` startupdir // platform dependant mangling...
......@@ -384,10 +396,20 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
, False
)
| size output_string <> 0
= ( wf ( [output_string]) ps
= ( wf ( [ output_string
, "Code generator called as: '" +++ command +++ "'"
]) ps
, objpath
, error_n == 0
)
| error_n <> 0
= ( wf ( [ "Code generator: "+++toString error_n
]) ps
, objpath
, False
)
= (ps,objpath,error_n==0)
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !ApplicationOptions !Pathname !*(PSt .l)
......@@ -419,7 +441,7 @@ StartCodeGenerator cgen` wf genAsmOrCode path slot timeprofile cgo=:{tp} ao star
= (error_n==0,objpath,ps)
MakeCodeGenOptionsString genAsmOrCode timeprofile {ci,cs}
= checkindex+++checkstack+++genasm+++timeProfileSwitch
= checkindex+++checkstack+++genasm //+++timeProfileSwitch
where
checkindex | ci = " -ci"; = ""
checkstack | cs = " -os"; = ""
......@@ -472,10 +494,11 @@ Link linker` winfun path
, stack_size = ss
, gen_dll = gen_dll
, dll_names = dll_names
, dynamics_path = ""
}
# linkerpath = RemoveFilename linker
# linkoptspath = MakeFullPathname linkerpath "linkopts"
# linkerrspath = MakeFullPathname linkerpath "linkerrs"
# linkoptspath = MakeFullPathname TooltempDir "linkopts"
# linkerrspath = MakeFullPathname TooltempDir "linkerrs"
# (err,ps) = accFiles (WriteLinkOpts linkoptspath linkopts) ps
| isJust err
= (winfun (fromJust err) ps,False)
......@@ -483,10 +506,24 @@ Link linker` winfun path
# objectFileNames = StrictListToList (RemoveDup object_file_names)
# libraryFileNames = StrictListToList (RemoveDup library_file_names)
// #! ps = trace_n "Object Files:" ps
// #! ps = trace_l objectFileNames ps
// #! ps = trace_n "Library Files:" ps
// #! ps = trace_l libraryFileNames ps
| isEmpty objectFileNames
= (winfun ["Linker error: No objects to link."] ps,False)
| isMachOObject (hd objectFileNames)
# (r1,r2) = send_command_to_application False "EXEC"
( "/usr/bin/cc "
+++ concat_object_file_names objectFileNames
+++ " -framework Carbon"
+++ " -o '"
+++ to_unix_path path
+++ "'"
);
| r1==r1
# application_existed = False;
# (resources_ok,ps) = accFiles (create_application_resource path True application_existed (fs,fn) hs heap_size_multiple ss flags
0 initial_heap_size minheap) ps
= (ps,True)
= (winfun ["Linker error: "+++toString r1] ps,False)
# ((link_ok,link_errors),ps)
= accFiles (link_xcoff_files objectFileNames libraryFileNames path
(fs,fn) hs heap_size_multiple ss flags em initial_heap_size minheap False add_carb_resource) ps
......@@ -495,6 +532,52 @@ Link linker` winfun path
| errlines<>0
= (winfun errtext ps,link_ok)
= (ps,link_ok)
isMachOObject object = equal_suffix ".o" object
concat_object_file_names [file_name:file_names]
= " '"+++to_unix_path file_name+++"'"+++concat_object_file_names file_names;
concat_object_file_names []
= "";
import linker_resources;
import code from
// "call_system_framework.o";
"call_system_framework.","pointer_glue."
to_unix_path p
# inpath = p +++ "\0"
# bsize = 256
# buffer = createArray bsize '\0'
# (res,_) = hfs2posix inpath buffer bsize OSNewToolbox
| res <> 0
# posix = toString (takeWhile ((<>) '\0') [c \\ c <-: buffer])
= trace_n` ("Path",posix) posix
/*
to_unix_path p = "/Volumes/"+++ to_unix_path 0 p;
where
to_unix_path i p
| i==size p
= p
| p.[i]==':'
= to_unix_path (inc i) (p % (0,i-1)+++"/"+++p % (i+1,size p-1));
= to_unix_path (inc i) p;
*/
fork_execv_waitpid :: !String -> Int;
fork_execv_waitpid s = code (s=CD0)(r=D0){
call .fork_execv_waitpid
};
send_command_to_application :: !Bool !String !String -> (!Int,!Int);
send_command_to_application _ _ s
# r=fork_execv_waitpid (s+++"\0");
| r == 0
= (0,0);
= (0,r);
// | r==(-1)
// = (-1,-1);
// = (0,0);
/*
Link_ppc winfun path u_system_file_name paths defs
applicationOptions=:{ss,fs,fn,hs,em,heap_size_multiple,initial_heap_size,profiling,profiling601,memoryProfilingMinimumHeapSize}
......@@ -575,6 +658,11 @@ Launch execpath env
// # (error_n,_) = LaunchApplication execpath 0xC8000000 OSNewToolbox
= (error_n, env)
Execute` :: !String !*env -> (!Bool,!Int,!*env)
Execute` execpath env
# (ec,env) = Launch execpath env
= (ec==0,ec,env)
//--- OTHER STUFF
QuitCleanCompiler :: !*(IOSt .l) -> *(IOSt .l)
......@@ -593,6 +681,7 @@ ClearCompilerCache cocl startupdir ps
| not cocl_ok = (-1,ps)
// # signature = CleanCompilerSignature // XOXOXOX
// # name = CleanCompilerName // XOXOXOX
// # (os_error_code,_,_) = send_command_to_clean_compiler_ca signature name "cocl -clear_cache" Wait
# (os_error_code,_,_) = send_command_to_clean_compiler_ca signature name "clear_cache" Wait
= (os_error_code,ps)
......@@ -705,9 +794,11 @@ send_command_to_clean_compiler0 signature command wait tb
# os_error_code
= trace_n "fraeaaeadam" free_result_apple_event_and_apple_event_and_desciptor_and_memory error_code6 error_code7
# error_n
= if (error_code6<0) 0 v1
// = if (error_code6<0) 0 v1
= if (error_code6<>0) 0 v1
# output_string
= if (error_code7<>0) "" (result_string % (0,s2-1))
# tb = trace_n` ("CALL",error_code6,v1,error_code7,s2) tb
= (os_error_code,error_n,output_string,tb)
where
loop tb
......@@ -1030,3 +1121,76 @@ where
| c == line.[pos] = pos;
= FindChar c line linelen (inc pos);
//////
import code from "cpathutil.xo"
import code from library "winmod_library"
/*
Start
# p1 = to_unix_path "Macintosh HD:Users:diederik:Desktop:MacCleanTools:Mac:PmCleanSystem.icl"
p2 = to_unix_path "Macintosh HD:Users:diederik:Desktop:CleanImage.1:Libraries:StdEnv 2.0.2:Clean System Files:_startup2.o"
p3 = to_unix_path "Macintosh HD:Users:diederik:Desktop:MacCleanTools:Mac:PmCleanSystem.icl"
p4 = to_unix_path "Macintosh HD:Users:diederik:Desktop:CleanImage.1:Libraries:StdEnv 2.0.2:Clean System Files:_startup2.o"
p5 = to_unix_path "Macintosh HD:Users:diederik:Desktop:MacCleanTools:Mac:PmCleanSystem.icl"
= (p1,p2,p3,p4,p5)
*/
hfs2posix :: !String !String !Int !*OSToolbox -> (!Int,!*OSToolbox)
hfs2posix _ _ _ _ = code {
ccall hfs2posix "ssI:I:I"
}
//Boolean hfs2posix(char *hfsPath,char *buffer,int size)
/*
e=FSMakeFSSpec (0/*vRefNum*/,0/*dirID*/,
#if 1
/* "\pClean:Clean 13:Clean Compiler", */
// "\pClean:Clean 2.0:Clean2.0InterfaceLib:CleanCocl copy",
// "\pClean:Clean 2.0:CleanCoclTest 00",
// "\pCleanCoclTest 00",
// "\pLaunchApplication",
"\pLaunchCleanCompiler",
#else
"\pClean:Clean 13:Clean13:build:Clean13.app:Contents:MacOS:Clean13",
#endif
&fs_spec);
if (e!=noErr){
printf ("%d\n",e);
return 1;
}
e=FSpMakeFSRef (&fs_spec,&fs_ref);
if (e!=noErr){
printf ("%d\n",e);
return 1;
}
{
CFURLRef CFURL_ref;
CFStringRef string_ref;
Boolean r;
int string_size;
CFURL_ref=CFURLCreateFromFSRef (NULL,&fs_ref);
#if 0
CFURL_ref=CFURLCreateCopyDeletingLastPathComponent (NULL,CFURL_ref);
CFURL_ref=CFURLCreateCopyDeletingLastPathComponent (NULL,CFURL_ref);
CFURL_ref=CFURLCreateCopyDeletingLastPathComponent (NULL,CFURL_ref);
#endif
CFURL_ref=CFURLCreateCopyDeletingLastPathComponent (NULL,CFURL_ref);
string_ref=CFStringCreateWithCString (NULL,"CleanCocl",kCFStringEncodingASCII);
CFURL_ref=CFURLCreateCopyAppendingPathComponent (NULL,CFURL_ref,string_ref,0);
string_size=512;
r=CFURLGetFileSystemRepresentation (CFURL_ref,1,buffer,string_size);
if (string_size<=512)
buffer[string_size]='\0';
/*
printf ("%d %s\n",string_size,buffer);
*/
r=CFURLGetFSRef (CFURL_ref,&fs_ref);
}
*/
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment