Commit f4e03bfd authored by Diederik van Arkel's avatar Diederik van Arkel

mac platform changes

parent a215cb0d
......@@ -15,7 +15,7 @@ standardStaticLibraries :: !LinkMethod -> List String
standardObjectFiles :: !Bool !Bool -> List String
getLibs :: ![String] !*Files -> (!(![String],![String]),!*Files)
ClearCompilerCache :: !.a -> (!Int,!.a)
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
ClearCompilerCaches :: !Int !.a -> (!Int,!.a)
QuitCleanCompiler :: !*(IOSt .l) -> *(IOSt .l)
......@@ -121,6 +121,7 @@ Execute :: // Executes the given application
, !Bool // success status
)
Launch :: !{#Char} !.a -> (!Int, !.a)
//Execute` :: !String *env -> (*env, !Bool)
// RWS ...
......
......@@ -18,10 +18,13 @@ from linkargs import ReadLinkErrors,WriteLinkOpts,LinkInfo`,LPathname
import xcoff_linker
import ostoolbox
from files import LaunchApplication`
from files import LaunchApplication
import memory,appleevents
KAEQueueReply :== 2
//import StdDebug,dodebug
import dodebug
trace_n _ f :== f
fopena :== fopen
......@@ -176,7 +179,8 @@ Compile cocl` write_module_times errwin typewin compileOrCheckSyntax path paths
= accFiles (ReadTypesInfo (listTypes<>NoTypes) out_file_name) ps
((errors,errors_and_messages_not_empty,errors_and_messages),ps)
= accFiles (ReadErrorsAndWarnings errors_file_name) ps
(abcpath,ps) = accFiles (MakeABCSystemPathname path) ps
// (abcpath,ps) = accFiles (MakeABCSystemPathname path) ps
abcpath = MakeABCSystemPathname path
ps = case errors_and_messages_not_empty of
True -> trace_n "errwin" errwin (StrictListToList errors_and_messages) ps
False -> trace_n "ok" ps
......@@ -362,7 +366,8 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
# ps = wf [cgen] ps
= (ps, "", False)
# (objpath,ps) = accFiles (MakeObjSystemPathname tp path) ps
// # (objpath,ps) = accFiles (MakeObjSystemPathname tp path) ps
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
command = cgen /*"cg"*/ +++ MakeCodeGenOptionsString genAsmOrCode /*False*/timeprofile cgo
+++ " " +++ (quoted_string path_without_suffix)
......@@ -393,7 +398,8 @@ StartCodeGenerator cgen` wf genAsmOrCode path slot timeprofile cgo=:{tp} ao star
# ps = wf [cgen] ps
= (False, "", ps)
# (objpath,ps) = accFiles (MakeObjSystemPathname tp path) ps
// # (objpath,ps) = accFiles (MakeObjSystemPathname tp path) ps
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
// errorsfilename = errors_file_path startupdir slot
command = /*cgen*/ "cg"
......@@ -556,11 +562,16 @@ DynLink linker prj_path startupdir ps
Execute :: !(WindowFun *env) !Pathname !ApplicationOptions *env -> (*env, !Bool)
Execute winfun path _ ps
# (error_n,_) = LaunchApplication` path 0xC8000000 OSNewToolbox
# (error_n,ps) = Launch path ps
| error_n >= 0
= (ps,True)
= (winfun ["Could not launch the application, MacOS error: "+++toString error_n] ps,False)
Launch :: !{#Char} !.a -> (!Int, !.a)
Launch execpath env
# (error_n,_) = LaunchApplication execpath 0xC8000000 OSNewToolbox
= (error_n, env)
//--- OTHER STUFF
QuitCleanCompiler :: !*(IOSt .l) -> *(IOSt .l)
......@@ -573,10 +584,12 @@ QuitCleanCompiler io
= io;
// necessary for Mac version?!
ClearCompilerCache :: !.a -> (!Int,!.a)
ClearCompilerCache ps
# signature = CleanCompilerSignature // XOXOXOX
# name = CleanCompilerName // XOXOXOX
ClearCompilerCache :: !String !String !.a -> (!Int,!.a)
ClearCompilerCache cocl startupdir ps
# (cocl_ok,cocl,name,signature) = mangleCompiler cocl startupdir // platform dependant mangling...
| not cocl_ok = (-1,ps)
// # signature = CleanCompilerSignature // XOXOXOX
// # name = CleanCompilerName // XOXOXOX
# (os_error_code,_,_) = send_command_to_clean_compiler_ca signature name "clear_cache" Wait
= (os_error_code,ps)
......@@ -612,10 +625,10 @@ send_command_to_clean_compiler signature name command wait_for_reply
| error_n<>(-2)
= (os_error_code,error_n,output_string);
# (launch_error_n,_)
= LaunchApplication` name 0xCA000000 OSNewToolbox;
= LaunchApplication name 0xCA000000 OSNewToolbox; // Hangs under OS X?
| launch_error_n>=0
= send_command_to_clean_compiler0 signature command wait_for_reply;
= (os_error_code,-1,output_string);
= (os_error_code,-2,output_string);
//--
......@@ -638,34 +651,39 @@ clean_compiler_signature slot
= {s.[0],s.[1],s.[2],toChar (slot+48)}
//--
import events
KAEApplicationDied :== 0x6F626974; // 'obit'
send_command_to_clean_compiler0 :: !String !String !Bool-> (!Int,!Int,!String);
send_command_to_clean_compiler0 signature command wait
| error_code1<>0
= (error_code1,-1,"");
= (error_code1,-1,"NewPtr failed");
// # error_code2 = AECreateDesc TypeApplSignature "MPSX" descriptor; // Tool Server
# error_code2
= AECreateDesc TypeApplSignature signature descriptor;
| error_code2<>0
= (free_memory error_code2,-1,"");
= (free_memory error_code2,-1,"AECreateDesc failed");
# error_code3
= AECreateAppleEvent KAEMiscStandards KAEDoScript descriptor KAutoGenerateReturnID KAnyTransactionID apple_event;
| error_code3<>0
= (free_descriptor_and_memory error_code3,-1,"");
= (free_descriptor_and_memory error_code3,-1,"AECreateAppleEvent failed");
# error_code4
= AEPutParamPtr apple_event KeyDirectObject TypeChar command;
| error_code4<>0
= (free_apple_event_and_desciptor_and_memory error_code4,-1,"");
= (free_apple_event_and_desciptor_and_memory error_code4,-1,"AEPutParamPtr failed");
# error_code5
= case wait of
True -> AESend apple_event result_apple_event KAEWaitReply KAENormalPriority KNoTimeOut 0 0;
// True -> loop OSNewToolbox;
_ -> AESend apple_event 0 KAEQueueReply KAENormalPriority KNoTimeOut 0 0;
| error_code5==(-609)
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"");
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"AESend failed");
| error_code5==(-903)
= (free_apple_event_and_desciptor_and_memory error_code5,-2,"need to add HighLevel event aware to SIZE resource of IDE...");
| error_code5==(-1712)
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed; Application died");
| error_code5<>0
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"");
= (free_apple_event_and_desciptor_and_memory error_code5,-1,"AESend failed");
| not wait
= (free_apple_event_and_desciptor_and_memory error_code5,0,"");
# (error_code6,_,v1,_)
......@@ -680,6 +698,14 @@ send_command_to_clean_compiler0 signature command wait
= if (error_code7<>0) "" (result_string % (0,s2-1))
= (os_error_code,error_n,output_string)
where
loop tb
# err = trace_n` "TICK!" AESend apple_event result_apple_event KAEWaitReply KAENormalPriority (60) 0 0;
| err==(-1712)
# (avail,what,message,when,wherex,wherey,modifiers,tb) = EventAvail NetworkMask tb
| avail && what == HighLevelEvent && message == KCoreEventClass && wherex == KAEApplicationDied
= -1712
= loop tb
= err
result_string = createArray 5120 '0';
(memory,error_code1,_)
......@@ -847,7 +873,8 @@ CompileHandleExitCode exitcode cocl startupdir slot errwin typewin path listType
= accFiles (ReadTypesInfo (listTypes<>NoTypes) out_file_name) ps
((errors,errors_and_messages_not_empty,errors_and_messages),ps)
= accFiles (ReadErrorsAndWarnings errors_file_name) ps
(abcpath,ps) = accFiles (MakeABCSystemPathname path) ps
// (abcpath,ps) = accFiles (MakeABCSystemPathname path) ps
abcpath = MakeABCSystemPathname path
ps = case errors_and_messages_not_empty of
True -> trace_n "errwin" errwin (StrictListToList errors_and_messages) ps
False -> trace_n "ok" ps
......
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