From 215682d0dff627aa316a95d3cef0683a33dc948c Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Thu, 10 Jan 2019 15:17:08 +0100 Subject: [PATCH] Fix codestyle throughout Unix/PmCleanSystem.icl --- Unix/PmCleanSystem.icl | 278 ++++++++++++++++++++--------------------- 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/Unix/PmCleanSystem.icl b/Unix/PmCleanSystem.icl index 7ecb045..fe71c1a 100644 --- a/Unix/PmCleanSystem.icl +++ b/Unix/PmCleanSystem.icl @@ -150,7 +150,7 @@ CompilePersistent cocl write_module_times errwin typewin compileOrCheckSyntax md = abort ("read failed "+++toString r +++ "\n") # exitcode = parse_result_number 0 result_string - + # dummy_slot = 0 # (path,mess,env) = CompileHandleExitCode exitcode cocl startupdir dummy_slot errwin typewin mdn listTypes env = (compiling_info,(env,path,mess)) @@ -162,7 +162,7 @@ parse_result_number i result_string | c=='-' = 0 - parse_result_number (i+1) result_string = abort "parse_result_number failed\n" - where +where parse_result_number2 i n result_string | i 0) (wf ["Error: Code generator failed for '"+++abc_path+++"' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)] ps) ps @@ -347,7 +347,7 @@ wait_for_finished_code_generator process_ids ps | wtermsig<>0 = abort "code generator exited abnormally\n" = (process_n,result,ps) - where +where find_process_id_index i w_pid pids | i 0) (wf ["Error: Code generator failed for '" +++ scg_abc_path +++ "' with exit code: "+++toString exit_code,(quoted_string scg_path_without_suffix)] ps) ps) @@ -400,114 +400,114 @@ Link linker winfun path where //First call the optimizing linker to generate an intermediate optimized object file which is then passed to gcc linkOptimizingGCC linker object_paths options1 options2 ps - # temp_file_name = "/tmp/linkerXXXXXX" +++ "\0" // +++ because modified by mkstemp - # fd = mkstemp temp_file_name - | fd== -1 - = abort "mkstemp failed\n" - # r = close fd - | r== -1 - = abort "close failed\n" - //Call optimized linker - # linker_args = add_options_string_to_args 0 options1 [temp_file_name:object_paths] - # (argv,args_memory) = make_argv [linker:linker_args] - - # linker_pid = fork - | linker_pid<0 - = abort "fork failed\n" - | linker_pid==0 - | execv (linker+++"\0") argv<0 - = abort "execv failed\n" - = abort "execution continued after execv\n" - # (w_pid,status) = wait_pid linker_pid 0 - | w_pid <> -1 && w_pid<>linker_pid - = abort "waitpid failed\n" - # exit_code = (status >> 8) bitand 0xff - # wtermsig = status bitand 0x7f - | wtermsig<>0 - = abort "linker exited abnormally\n" - | free args_memory<0 - = abort "free failed\n" - - # link_ok = exit_code==0 - | not link_ok - | unlink (temp_file_name+++"\0")<>0 - = (ps,link_ok) - = (ps,link_ok) - //Call gcc - = linkGCC [temp_file_name] options2 ps + # temp_file_name = "/tmp/linkerXXXXXX" +++ "\0" // +++ because modified by mkstemp + # fd = mkstemp temp_file_name + | fd== -1 + = abort "mkstemp failed\n" + # r = close fd + | r== -1 + = abort "close failed\n" + //Call optimized linker + # linker_args = add_options_string_to_args 0 options1 [temp_file_name:object_paths] + # (argv,args_memory) = make_argv [linker:linker_args] + + # linker_pid = fork + | linker_pid<0 + = abort "fork failed\n" + | linker_pid==0 + | execv (linker+++"\0") argv<0 + = abort "execv failed\n" + = abort "execution continued after execv\n" + # (w_pid,status) = wait_pid linker_pid 0 + | w_pid <> -1 && w_pid<>linker_pid + = abort "waitpid failed\n" + # exit_code = (status >> 8) bitand 0xff + # wtermsig = status bitand 0x7f + | wtermsig<>0 + = abort "linker exited abnormally\n" + | free args_memory<0 + = abort "free failed\n" + + # link_ok = exit_code==0 + | not link_ok + | unlink (temp_file_name+++"\0")<>0 + = (ps,link_ok) + = (ps,link_ok) + //Call gcc + = linkGCC [temp_file_name] options2 ps //Just link with gcc linkGCC object_paths gccOptions ps - # gcc_options = add_options_string_to_args 0 gccOptions (StrictListToList (Append library_file_names "-lm")) - # ld_args = ["-o", path : object_paths ] ++ gcc_options - ld_args = IF_MACOSX ld_args (IF_INT_64_OR_32 ["-no-pie":ld_args] ld_args) - ld_args = if gen_symbol_table ld_args ["-s":ld_args] - # ld = "/usr/bin/gcc" - # (argv,args_memory) = make_argv [ld:ld_args] - # ld_pid = fork - | ld_pid<0 - = abort "fork failed\n" - | ld_pid==0 - | execv (ld+++"\0") argv<0 - = abort "execv failed\n" - = abort "execution continued after execv\n" - | free args_memory<0 - = abort "free failed\n" - # (w_pid,status) = wait_pid ld_pid 0 - | w_pid <> -1 && w_pid<>ld_pid - = abort "waitpid failed\n" - # wtermsig = status bitand 0x7f - # exit_code = (status >> 8) bitand 0xff; - | wtermsig<>0 - = abort "ld exited abnormally\n" - # link_ok = exit_code==0 - = (ps,link_ok) + # gcc_options = add_options_string_to_args 0 gccOptions (StrictListToList (Append library_file_names "-lm")) + # ld_args = ["-o", path : object_paths ] ++ gcc_options + ld_args = IF_MACOSX ld_args (IF_INT_64_OR_32 ["-no-pie":ld_args] ld_args) + ld_args = if gen_symbol_table ld_args ["-s":ld_args] + # ld = "/usr/bin/gcc" + # (argv,args_memory) = make_argv [ld:ld_args] + # ld_pid = fork + | ld_pid<0 + = abort "fork failed\n" + | ld_pid==0 + | execv (ld+++"\0") argv<0 + = abort "execv failed\n" + = abort "execution continued after execv\n" + | free args_memory<0 + = abort "free failed\n" + # (w_pid,status) = wait_pid ld_pid 0 + | w_pid <> -1 && w_pid<>ld_pid + = abort "waitpid failed\n" + # wtermsig = status bitand 0x7f + # exit_code = (status >> 8) bitand 0xff; + | wtermsig<>0 + = abort "ld exited abnormally\n" + # link_ok = exit_code==0 + = (ps,link_ok) //Call other/additional linker linkOther linker object_paths ps - # linkopts = - { exe_path = path - , res_path = resource_path - , open_console = o <> NoConsole - , static_link = static - , gen_relocs = gen_relocs - , gen_symbol_table = gen_symbol_table - , gen_linkmap = gen_linkmap - , link_resources = link_resources - , object_paths = ListToStrictList object_paths - , dynamic_libs = RemoveDup library_file_names - , static_libs = RemoveDup static_libraries - , stack_size = ss - , gen_dll = gen_dll - , dll_names = dll_syms - , dynamics_path = startupdir +++. DirSeparatorString +++. dynlstr - , lib_name_obj_path = MakeFullPathname tooltempdir "lib_name.o" - } - # linkoptspath = MakeFullPathname tooltempdir "linkopts" - # linkerrspath = MakeFullPathname tooltempdir "linkerrs" - # (err,ps) = accFiles (WriteLinkOpts linkoptspath linkopts) ps - | isJust err - = (winfun (fromJust err) ps,False) - # linker_args = ["-I",linkoptspath,"-O",linkerrspath] - # (argv,args_memory) = make_argv [linker:linker_args] - # linker_pid = fork - | linker_pid<0 - = abort "fork failed\n" - | linker_pid==0 - | execv (linker+++"\0") argv<0 - = abort "execv failed\n" - = abort "execution continued after execv\n" - # (w_pid,status) = wait_pid linker_pid 0 - | w_pid <> -1 && w_pid<>linker_pid - = abort "waitpid failed\n" - # exit_code = (status >> 8) bitand 0xff - # wtermsig = status bitand 0x7f - | wtermsig<>0 - = abort "linker exited abnormally\n" - | free args_memory<0 - = abort "free failed\n" - # link_ok = exit_code==0 - = (ps,link_ok) + # linkopts = + { exe_path = path + , res_path = resource_path + , open_console = o <> NoConsole + , static_link = static + , gen_relocs = gen_relocs + , gen_symbol_table = gen_symbol_table + , gen_linkmap = gen_linkmap + , link_resources = link_resources + , object_paths = ListToStrictList object_paths + , dynamic_libs = RemoveDup library_file_names + , static_libs = RemoveDup static_libraries + , stack_size = ss + , gen_dll = gen_dll + , dll_names = dll_syms + , dynamics_path = startupdir +++. DirSeparatorString +++. dynlstr + , lib_name_obj_path = MakeFullPathname tooltempdir "lib_name.o" + } + # linkoptspath = MakeFullPathname tooltempdir "linkopts" + # linkerrspath = MakeFullPathname tooltempdir "linkerrs" + # (err,ps) = accFiles (WriteLinkOpts linkoptspath linkopts) ps + | isJust err + = (winfun (fromJust err) ps,False) + # linker_args = ["-I",linkoptspath,"-O",linkerrspath] + # (argv,args_memory) = make_argv [linker:linker_args] + # linker_pid = fork + | linker_pid<0 + = abort "fork failed\n" + | linker_pid==0 + | execv (linker+++"\0") argv<0 + = abort "execv failed\n" + = abort "execution continued after execv\n" + # (w_pid,status) = wait_pid linker_pid 0 + | w_pid <> -1 && w_pid<>linker_pid + = abort "waitpid failed\n" + # exit_code = (status >> 8) bitand 0xff + # wtermsig = status bitand 0x7f + | wtermsig<>0 + = abort "linker exited abnormally\n" + | free args_memory<0 + = abort "free failed\n" + # link_ok = exit_code==0 + = (ps,link_ok) DelayEventLoop :: !.ps -> .ps DelayEventLoop ps @@ -527,13 +527,13 @@ CompilePollCompleted compiler_process_ids ps = (NoFinishedCompiler,ps) # compiler_id = find_fd_index 0 fda # results_fd = (compiler_process_ids !! compiler_id).results_fd - + # result_string = createArray 6 '\0' # r = read results_fd result_string 6; | r<=1 = abort ("read failed "+++toString r+++ "\n") # exit_code = parse_result_number 0 result_string - + = (FinishedCompiler compiler_id exit_code,ps) where fill_fda :: !CompilerProcessIds !Int !*{#Int} -> *{#Int} @@ -756,7 +756,7 @@ add_options_string_to_args i s args = args # end_i = skip_to_space_or_tab (i+1) s = [s % (first_i,end_i-1) : add_options_string_to_args end_i s args] - where +where skip_spaces_and_tabs i s | i= l = (i,s) # s = update s i h.[j] @@ -889,26 +889,26 @@ where create_args_string args_size argv_list # s = createArray args_size '\0' = copy_args argv_list 0 s - where - copy_args [a:as] i s - # s = copy_chars 0 a i s - = copy_args as (i+((size a+4) bitand -4)) s + where + copy_args [a:as] i s + # s = copy_chars 0 a i s + = copy_args as (i+((size a+4) bitand -4)) s copy_args [] i s = s - + copy_chars :: !Int !{#Char} !Int !*{#Char} -> *{#Char} copy_chars ai a si s | ai *{#Int} + = fill_argv 0 argv_list argv args_memory + where + fill_argv :: !Int ![{#Char}] !*{#Int} !Int -> *{#Int} fill_argv arg_n [a:as] argv args_memory # argv = {argv & [arg_n]=args_memory} args_memory = args_memory + ((size a+4) bitand -4) @@ -920,23 +920,23 @@ ApplicationOptionsToFlags :: !ApplicationOptions -> Int ApplicationOptionsToFlags {sgc,pss,marking_collection,set,o,memoryProfiling,write_stderr_to_file,disable_rts_flags} = showgc+printstacksize+showexectime+cons+marking_collection_mask+memory_profiling_mask+write_stderr_to_file_mask+disable_rts_flags_mask where - showgc + showgc | sgc = 2 = 0 - printstacksize + printstacksize | pss = 4 = 0 - showexectime - | set = 8 + showexectime + | set = 8 = 0 write_stderr_to_file_mask - | write_stderr_to_file = 128 + | write_stderr_to_file = 128 + = 0 + marking_collection_mask + | marking_collection = 64 = 0 - marking_collection_mask - | marking_collection = 64 - = 0 memory_profiling_mask - | memoryProfiling = 32 + | memoryProfiling = 32 = 0 cons = case o of @@ -954,7 +954,7 @@ where write_options_file :: !{#.Char} !.Int !.Int !.Int !.Int !.Int !.Int !Bool !*Files -> *(!Bool,!*Files) write_options_file options_file_name flags heap_size stack_size initial_heap_size heap_size_multiple min_write_heap_size use_64_bit_processor files - # (opened,file,files) + # (opened,file,files) = fopen options_file_name FWriteData files | not opened = (False,files) @@ -991,7 +991,7 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000068 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000004 FWI 0x00000000 FWI 0x00000000 FWI - 0x00000000 FWI + 0x00000000 FWI 0x00000011 FWI 0x00000003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000068 FWI 0x00000000 FWI 0x0000002c FWI 0x00000000 FWI 0x00000000 FWI @@ -1006,25 +1006,25 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x0000032c FWI 0x00000000 FWI 0x00000044 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000001 FWI 0x00000000 FWI 0x00000000 FWI - 0x00000000 FWI + 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00010003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI - 0x00000000 FWI + 0x00000000 FWI 0x00000000 FWI 0x00020003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI - 0x00000000 FWI + 0x00000000 FWI 0x00030003 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000001 FWI 0x00020011 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x0000000b FWI 0x00020011 FWI 0x00000008 FWI 0x00000000 FWI 0x00000000 FWI - 0x00000000 FWI + 0x00000000 FWI 0x00000019 FWI 0x00020011 FWI 0x00000010 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI - 0x0000001f FWI + 0x0000001f FWI 0x00020011 FWI 0x00000018 FWI 0x00000000 FWI 0x00000000 FWI 0x00000000 FWI 0x00000032 FWI 0x00020011 FWI 0x00000020 FWI @@ -1074,7 +1074,7 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz 0x657a6973 FWI 0x616c6600 FWI 0x68007367 FWI 0x5f706165 FWI 0x657a6973 FWI 0x6c756d5f FWI 0x6c706974 FWI 0x6e690065 FWI 0x61697469 FWI 0x65685f6c FWI 0x735f7061 FWI 0x00657a69) - # (close_ok,files) + # (close_ok,files) = fclose file files = (close_ok,files) -- GitLab