Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-ide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-ide
Commits
8cbbff84
Commit
8cbbff84
authored
Jan 10, 2019
by
John van Groningen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'newlines-errors' into 'master'
Add newlines to errors See merge request
!2
parents
1493f119
955aa4ed
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
149 deletions
+149
-149
MacOSX/PmCleanSystem.icl
MacOSX/PmCleanSystem.icl
+67
-67
Unix/PmCleanSystem.icl
Unix/PmCleanSystem.icl
+81
-81
cpm/CpmLogic.icl
cpm/CpmLogic.icl
+1
-1
No files found.
MacOSX/PmCleanSystem.icl
View file @
8cbbff84
...
...
@@ -65,7 +65,7 @@ standardObjectFiles stack_traces profiling _ use_64_bit_processor
getLibs
::
![
String
]
!*
Files
->
(!(![
String
],![
String
]),!*
Files
)
getLibs
[]
files
=
(([],[]),
files
)
getLibs
libs
files
=
abort
"getLibs"
getLibs
libs
files
=
abort
"getLibs
\n
"
InitCompilingInfo
::
*
CompilingInfo
InitCompilingInfo
=
NoCompiler
...
...
@@ -92,20 +92,20 @@ Compile
#
compiler_pid
=
fork
|
compiler_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
compiler_pid
==
0
|
execv
(
cocl
+++
"
\0
"
)
argv
<
0
=
abort
(
"execv failed: could not run '"
+++
cocl
+++
"'"
)
=
abort
"execution continued after execv"
=
abort
(
"execv failed: could not run '"
+++
cocl
+++
"'
\n
"
)
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
compiler_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
compiler_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"compiler exited abnormally"
=
abort
"compiler exited abnormally
\n
"
#
exitcode
=
if
(
result
==
0
)
0
1
...
...
@@ -142,12 +142,12 @@ CompilePersistent cocl write_module_times errwin typewin compileOrCheckSyntax md
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
#
result_string
=
createArray
6
'\0'
#
r
=
read
results_fd
result_string
6
;
|
r
<=
1
=
abort
(
"read failed "
+++
toString
r
)
=
abort
(
"read failed "
+++
toString
r
+++
"
\n
"
)
#
exitcode
=
parse_result_number
0
result_string
...
...
@@ -161,7 +161,7 @@ parse_result_number i result_string
=
parse_result_number2
(
i
+1
)
(
toInt
c
-48
)
result_string
|
c
==
'-'
=
0
-
parse_result_number
(
i
+1
)
result_string
=
abort
"parse_result_number failed"
=
abort
"parse_result_number failed
\n
"
where
parse_result_number2
i
n
result_string
|
i
<
size
result_string
...
...
@@ -170,8 +170,8 @@ parse_result_number i result_string
=
parse_result_number2
(
i
+1
)
(
n
*
10
+(
toInt
c
-48
))
result_string
|
c
==
'\n'
=
n
=
abort
"parse_result_number2 failed"
=
abort
"parse_result_number2 failed"
=
abort
"parse_result_number2 failed
\n
"
=
abort
"parse_result_number2 failed
\n
"
CompileStartCommand
::
!
String
!
Bool
!(
WindowFun
*
env
)
!
CompileOrCheckSyntax
!
Pathname
...
...
@@ -200,7 +200,7 @@ CompileStartCommand cocl write_module_times errwin compileOrCheckSyntax path
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
=
(
True
,
compiler_process_ids
,
ps
)
exit_clean_compiler
{
compiler_pid
,
commands_fd
,
results_fd
,
commands_file_name
,
results_file_name
}
env
...
...
@@ -208,24 +208,24 @@ exit_clean_compiler {compiler_pid,commands_fd,results_fd,commands_file_name,resu
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
compiler_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
compiler_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"compiler exited abnormally"
=
abort
"compiler exited abnormally
\n
"
#
r
=
close
commands_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
r
=
close
results_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
|
unlink
(
commands_file_name
+++
"
\0
"
)<>
0
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
|
unlink
(
results_file_name
+++
"
\0
"
)<>
0
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
=
env
ExitCleanCompiler
::
!*(!*
CompilingInfo
,*
env
)
->
*(!*
CompilingInfo
,*
env
)
...
...
@@ -258,34 +258,34 @@ CodeGen cgen used_compiler_process_ids wf genAsmOrCode abc_path obj_path timepro
errors_file_name
=
errors_file_path
temp_dir
0
#
stderr_fd
=
creat
(
errors_file_name
+++
"
\0
"
)
0777
;
|
stderr_fd
==
(
-1
)
=
abort
"creat failed"
=
abort
"creat failed
\n
"
#
(
argv
,
args_memory
)
=
make_argv
[
cgen
:
add_options_string_to_args
0
options
(
cg_arguments
++[
path_without_suffix
])]
#
code_generator_pid
=
fork
|
code_generator_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
code_generator_pid
==
0
#
r
=
dup2
stderr_fd
2
|
r
==
(
-1
)
=
abort
"dup2 failed"
=
abort
"dup2 failed
\n
"
|
execv
(
cgen
+++
"
\0
"
)
argv
<
0
=
abort
(
"execv failed: Could not run '"
+++
cgen
+++
"'"
)
=
abort
"execution continued after execv"
=
abort
(
"execv failed: Could not run '"
+++
cgen
+++
"'
\n
"
)
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
code_generator_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
code_generator_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"code generator exited abnormally"
=
abort
"code generator exited abnormally
\n
"
#
r
=
close
stderr_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
exit_code
=
if
(
result
==
0
)
0
1
...
...
@@ -344,22 +344,22 @@ start_code_generator cgen wf abc_path slot timeprofile cgo tp startupdir ps
errors_file_name
=
errors_file_path
temp_dir
slot
#
stderr_fd
=
creat
(
errors_file_name
+++
"
\0
"
)
0777
;
|
stderr_fd
==
(
-1
)
=
abort
"creat failed"
=
abort
"creat failed
\n
"
#
(
argv
,
args_memory
)
=
make_argv
[
cgen
:
add_options_string_to_args
0
options
(
cg_arguments
++[
path_without_suffix
])]
#
code_generator_pid
=
fork
|
code_generator_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
code_generator_pid
==
0
#
r
=
dup2
stderr_fd
2
|
r
==
(
-1
)
=
abort
"dup2 failed"
=
abort
"dup2 failed
\n
"
|
execv
(
cgen
+++
"
\0
"
)
argv
<
0
=
abort
(
"execv failed: Could not run '"
+++
cgen
+++
"'"
)
=
abort
"execution continued after execv"
=
abort
(
"execv failed: Could not run '"
+++
cgen
+++
"'
\n
"
)
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
scg
=
{
scg_abc_path
=
abc_path
,
scg_path_without_suffix
=
path_without_suffix
,
scg_std_error_fd
=
stderr_fd
,
scg_errors_file_name
=
errors_file_name
}
=
(
True
,
code_generator_pid
,
scg
,
ps
)
...
...
@@ -368,12 +368,12 @@ wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!Int,!*GeneralS
wait_for_finished_code_generator
process_ids
ps
#
(
w_pid
,
status
)
=
wait_pid
-1
0
|
w_pid
<
0
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
process_n
=
find_process_id_index
0
w_pid
process_ids
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"code generator exited abnormally"
=
abort
"code generator exited abnormally
\n
"
=
(
process_n
,
result
,
ps
)
where
find_process_id_index
i
w_pid
pids
...
...
@@ -386,7 +386,7 @@ finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !Int !(WindowFun *
finish_code_generator
process_handle
{
scg_abc_path
,
scg_path_without_suffix
,
scg_std_error_fd
,
scg_errors_file_name
}
exit_code
wf
ps
#
r
=
close
scg_std_error_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
((_,
errors_not_empty
,
error_text
),
ps
)
=
accFiles
(
readErrorsAndWarnings
scg_errors_file_name
)
ps
ps
=
if
errors_not_empty
(
wf
(
StrictListToList
error_text
)
ps
)
...
...
@@ -447,20 +447,20 @@ Link linker winfun path
#
(
argv
,
args_memory
)
=
make_argv
[
linker
:
linker_args
]
#
ld_pid
=
fork
|
ld_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
ld_pid
==
0
|
execv
(
linker
+++
"
\0
"
)
argv
<
0
=
abort
(
"execv failed: Could not run '"
+++
linker
+++
"'"
)
=
abort
"execution continued after execv"
=
abort
(
"execv failed: Could not run '"
+++
linker
+++
"'
\n
"
)
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
ld_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
ld_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"linker exited abnormally"
=
abort
"linker exited abnormally
\n
"
#
link_ok
=
result
>=
0
//Read link errors
#
((
err
,
link_errors
),
ps
)
=
if
is_gcc
((
Nothing
,[]),
ps
)
(
accFiles
(
ReadLinkErrors
linkerrspath
)
ps
)
...
...
@@ -484,7 +484,7 @@ CompilePollCompleted compiler_process_ids ps
fda
=
fill_fda
compiler_process_ids
0
fda
r
=
poll
fda
n_processes
-1
|
r
<
0
=
abort
"poll failed"
=
abort
"poll failed
\n
"
|
r
==
0
=
(
NoFinishedCompiler
,
ps
)
#
compiler_id
=
find_fd_index
0
fda
...
...
@@ -493,7 +493,7 @@ CompilePollCompleted compiler_process_ids ps
#
result_string
=
createArray
6
'\0'
#
r
=
read
results_fd
result_string
6
;
|
r
<=
1
=
abort
(
"read failed "
+++
toString
r
)
=
abort
(
"read failed "
+++
toString
r
+++
"
\n
"
)
#
exit_code
=
parse_result_number
0
result_string
=
(
FinishedCompiler
compiler_id
exit_code
,
ps
)
...
...
@@ -514,7 +514,7 @@ where
=
find_fd_index
(
i
+1
)
fda
|
r_events
==
POLLIN
=
i
=
abort
(
"polling file descriptors failed with event"
+++
toString
r_events
)
=
abort
(
"polling file descriptors failed with event"
+++
toString
r_events
+++
"
\n
"
)
O_RDONLY
:==
0
;
O_WRONLY
:==
1
;
...
...
@@ -525,30 +525,30 @@ start_compiler compiler_file_name initial_args
#
commands_file_name
=
"/tmp/comXXXXXX"
+++
"
\0
"
// +++ because modified by mkstemp
#
fd
=
mkstemp
commands_file_name
|
fd
==
-1
=
abort
"mkstemp failed"
=
abort
"mkstemp failed
\n
"
#
r
=
close
fd
|
r
==
-1
=
abort
"close failed"
=
abort
"close failed
\n
"
#
r
=
unlink
commands_file_name
|
r
==
-1
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
#
r
=
mkfifo
commands_file_name
(
S_IRUSR
bitor
S_IWUSR
)
|
r
==
-1
=
abort
"mkfifo failed"
=
abort
"mkfifo failed
\n
"
#
results_file_name
=
"/tmp/resXXXXXX"
+++
"
\0
"
// +++ because modified by mkstemp
#
fd
=
mkstemp
results_file_name
|
fd
==
-1
=
abort
"mkstemp failed"
=
abort
"mkstemp failed
\n
"
#
r
=
close
fd
|
r
==
-1
=
abort
"close failed"
=
abort
"close failed
\n
"
#
r
=
unlink
results_file_name
|
r
==
-1
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
#
r
=
mkfifo
results_file_name
(
S_IRUSR
bitor
S_IWUSR
)
|
r
==
-1
=
abort
"mkfifo failed"
=
abort
"mkfifo failed
\n
"
#
cocl_arguments
=
add_options_string_to_args
0
initial_args
[
"--pipe"
,
commands_file_name
,
results_file_name
]
...
...
@@ -556,20 +556,20 @@ start_compiler compiler_file_name initial_args
#
compiler_pid
=
fork
|
compiler_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
compiler_pid
==
0
|
execv
(
compiler_file_name
+++
"
\0
"
)
argv
<
0
=
abort
(
"execv failed: Could not run '"
+++
compiler_file_name
+++
"'"
)
=
abort
"execution continued after execv"
=
abort
(
"execv failed: Could not run '"
+++
compiler_file_name
+++
"'
\n
"
)
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
commands_fd
=
open
(
commands_file_name
+++
"
\0
"
)
O_WRONLY
0
|
commands_fd
==
-1
=
abort
"open failed"
=
abort
"open failed
\n
"
#
results_fd
=
open
(
results_file_name
+++
"
\0
"
)
O_RDONLY
0
|
results_fd
==
-1
=
abort
"open failed"
=
abort
"open failed
\n
"
=
{
commands_file_name
=
commands_file_name
,
results_file_name
=
results_file_name
,
compiler_pid
=
compiler_pid
,
commands_fd
=
commands_fd
,
results_fd
=
results_fd
}
...
...
@@ -838,7 +838,7 @@ make_argv argv_list
args_string
=
create_args_string
args_size
argv_list
args_memory
=
malloc
args_size
|
args_memory
==
0
=
abort
"malloc failed"
=
abort
"malloc failed
\n
"
#
args_memory
=
memcpy_string_to_pointer
args_memory
args_string
args_size
argv
=
create_argv
argv_list
args_memory
=
(
argv
,
args_memory
)
...
...
@@ -962,19 +962,19 @@ write_options_file options_file_name flags heap_size stack_size initial_heap_siz
=
(
close_ok
,
files
)
ClearCompilerCache
::
.
a
ClearCompilerCache
=
abort
"ClearCompilerCache"
ClearCompilerCache
=
abort
"ClearCompilerCache
\n
"
ClearCompilerCaches
::
.
a
ClearCompilerCaches
=
abort
"ClearCompilerCaches"
ClearCompilerCaches
=
abort
"ClearCompilerCaches
\n
"
SendRepeatResult
::
.
a
SendRepeatResult
=
abort
"SendRepeatResult"
SendRepeatResult
=
abort
"SendRepeatResult
\n
"
StartCodeGenerator
::
.
a
StartCodeGenerator
=
abort
"StartCodeGenerator"
StartCodeGenerator
=
abort
"StartCodeGenerator
\n
"
Execute`
::
.
a
Execute`
=
abort
"Execute`"
Execute`
=
abort
"Execute`
\n
"
wait_pid
::
!
Int
!
Int
->
(!
Int
,!
Int
)
wait_pid
pid
options
...
...
Unix/PmCleanSystem.icl
View file @
8cbbff84
...
...
@@ -65,7 +65,7 @@ standardObjectFiles stack_traces profiling _ use_64_bit_processor
getLibs
::
![
String
]
!*
Files
->
(!(![
String
],![
String
]),!*
Files
)
getLibs
[]
files
=
(([],[]),
files
)
getLibs
libs
files
=
abort
"getLibs"
getLibs
libs
files
=
abort
"getLibs
\n
"
InitCompilingInfo
::
*
CompilingInfo
InitCompilingInfo
=
NoCompiler
...
...
@@ -92,20 +92,20 @@ Compile
#
compiler_pid
=
fork
|
compiler_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
compiler_pid
==
0
|
execv
(
cocl
+++
"
\0
"
)
argv
<
0
=
abort
"execv failed"
=
abort
"execution continued after execv"
=
abort
"execv failed
\n
"
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
compiler_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
compiler_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"compiler exited abnormally"
=
abort
"compiler exited abnormally
\n
"
#
exitcode
=
if
(
result
==
0
)
0
1
...
...
@@ -142,12 +142,12 @@ CompilePersistent cocl write_module_times errwin typewin compileOrCheckSyntax md
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
#
result_string
=
createArray
6
'\0'
#
r
=
read
results_fd
result_string
6
;
|
r
<=
1
=
abort
(
"read failed "
+++
toString
r
)
=
abort
(
"read failed "
+++
toString
r
+++
"
\n
"
)
#
exitcode
=
parse_result_number
0
result_string
...
...
@@ -161,7 +161,7 @@ parse_result_number i result_string
=
parse_result_number2
(
i
+1
)
(
toInt
c
-48
)
result_string
|
c
==
'-'
=
0
-
parse_result_number
(
i
+1
)
result_string
=
abort
"parse_result_number failed"
=
abort
"parse_result_number failed
\n
"
where
parse_result_number2
i
n
result_string
|
i
<
size
result_string
...
...
@@ -170,8 +170,8 @@ parse_result_number i result_string
=
parse_result_number2
(
i
+1
)
(
n
*
10
+(
toInt
c
-48
))
result_string
|
c
==
'\n'
=
n
=
abort
"parse_result_number2 failed"
=
abort
"parse_result_number2 failed"
=
abort
"parse_result_number2 failed
\n
"
=
abort
"parse_result_number2 failed
\n
"
CompileStartCommand
::
!
String
!
Bool
!(
WindowFun
*
env
)
!
CompileOrCheckSyntax
!
Pathname
...
...
@@ -200,7 +200,7 @@ CompileStartCommand cocl write_module_times errwin compileOrCheckSyntax path
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
=
(
True
,
compiler_process_ids
,
ps
)
exit_clean_compiler
{
compiler_pid
,
commands_fd
,
results_fd
,
commands_file_name
,
results_file_name
}
env
...
...
@@ -208,24 +208,24 @@ exit_clean_compiler {compiler_pid,commands_fd,results_fd,commands_file_name,resu
n_chars
=
size
args_string
#
r
=
write
commands_fd
args_string
n_chars
|
r
<>
n_chars
=
abort
"write_failed"
=
abort
"write_failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
compiler_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
compiler_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"compiler exited abnormally"
=
abort
"compiler exited abnormally
\n
"
#
r
=
close
commands_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
r
=
close
results_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
|
unlink
(
commands_file_name
+++
"
\0
"
)<>
0
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
|
unlink
(
results_file_name
+++
"
\0
"
)<>
0
=
abort
"unlink failed"
=
abort
"unlink failed
\n
"
=
env
ExitCleanCompiler
::
!*(!*
CompilingInfo
,*
env
)
->
*(!*
CompilingInfo
,*
env
)
...
...
@@ -258,34 +258,34 @@ CodeGen cgen used_compiler_process_ids wf genAsmOrCode abc_path obj_path timepro
errors_file_name
=
errors_file_path
temp_dir
0
#
stderr_fd
=
creat
(
errors_file_name
+++
"
\0
"
)
0777
;
|
stderr_fd
==
(
-1
)
=
abort
"creat failed"
=
abort
"creat failed
\n
"
#
(
argv
,
args_memory
)
=
make_argv
[
cgen
:
add_options_string_to_args
0
options
(
cg_arguments
++[
path_without_suffix
])]
#
code_generator_pid
=
fork
|
code_generator_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
code_generator_pid
==
0
#
r
=
dup2
stderr_fd
2
|
r
==
(
-1
)
=
abort
"dup2 failed"
=
abort
"dup2 failed
\n
"
|
execv
(
cgen
+++
"
\0
"
)
argv
<
0
=
abort
"execv failed"
=
abort
"execution continued after execv"
=
abort
"execv failed
\n
"
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
code_generator_pid
0
|
w_pid
<>
-1
&&
w_pid
<>
code_generator_pid
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"code generator exited abnormally"
=
abort
"code generator exited abnormally
\n
"
#
r
=
close
stderr_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
exit_code
=
if
(
result
==
0
)
0
1
...
...
@@ -316,22 +316,22 @@ start_code_generator cgen wf path slot timeprofile cgo tp startupdir ps
errors_file_name
=
errors_file_path
temp_dir
slot
#
stderr_fd
=
creat
(
errors_file_name
+++
"
\0
"
)
0777
;
|
stderr_fd
==
(
-1
)
=
abort
"creat failed"
=
abort
"creat failed
\n
"
#
(
argv
,
args_memory
)
=
make_argv
[
cgen
:
add_options_string_to_args
0
options
(
cg_arguments
++[
path_without_suffix
])]
#
code_generator_pid
=
fork
|
code_generator_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
code_generator_pid
==
0
#
r
=
dup2
stderr_fd
2
|
r
==
(
-1
)
=
abort
"dup2 failed"
=
abort
"dup2 failed
\n
"
|
execv
(
cgen
+++
"
\0
"
)
argv
<
0
=
abort
"execv failed"
=
abort
"execution continued after execv"
=
abort
"execv failed
\n
"
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
scg
=
{
scg_abc_path
=
path
,
scg_path_without_suffix
=
path_without_suffix
,
scg_std_error_fd
=
stderr_fd
,
scg_errors_file_name
=
errors_file_name
}
=
(
True
,
code_generator_pid
,
scg
,
ps
)
...
...
@@ -340,12 +340,12 @@ wait_for_finished_code_generator :: !{#Int} !*GeneralSt -> (!Int,!Int,!*GeneralS
wait_for_finished_code_generator
process_ids
ps
#
(
w_pid
,
status
)
=
wait_pid
-1
0
|
w_pid
<
0
=
abort
"waitpid failed"
=
abort
"waitpid failed
\n
"
#
process_n
=
find_process_id_index
0
w_pid
process_ids
#
result
=
(
status
bitand
0xff00
)
>>
8
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"code generator exited abnormally"
=
abort
"code generator exited abnormally
\n
"
=
(
process_n
,
result
,
ps
)
where
find_process_id_index
i
w_pid
pids
...
...
@@ -358,7 +358,7 @@ finish_code_generator :: !Int/*HANDLE*/ !StartedCodeGenerator !Int !(WindowFun *
finish_code_generator
process_handle
{
scg_abc_path
,
scg_path_without_suffix
,
scg_std_error_fd
,
scg_errors_file_name
}
exit_code
wf
ps
#
r
=
close
scg_std_error_fd
|
r
==(
-1
)
=
abort
"close failed"
=
abort
"close failed
\n
"
#
((_,
errors_not_empty
,
error_text
),
ps
)
=
accFiles
(
readErrorsAndWarnings
scg_errors_file_name
)
ps
ps
=
if
errors_not_empty
(
wf
(
StrictListToList
error_text
)
ps
)
...
...
@@ -398,30 +398,30 @@ Link linker winfun path
#
temp_file_name
=
"/tmp/linkerXXXXXX"
+++
"
\0
"
// +++ because modified by mkstemp
#
fd
=
mkstemp
temp_file_name
|
fd
==
-1
=
abort
"mkstemp failed"
=
abort
"mkstemp failed
\n
"
#
r
=
close
fd
|
r
==
-1
=
abort
"close failed"
=
abort
"close failed
\n
"
//Call optimized linker
#
linker_args
=
[
temp_file_name
:
object_paths
]
#
(
argv
,
args_memory
)
=
make_argv
[
linker
:
linker_args
]
#
linker_pid
=
fork
|
linker_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
linker_pid
==
0
|
execv
(
linker
+++
"
\0
"
)
argv
<
0
=
abort
"execv failed"
=
abort
"execution continued after execv"
=
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"
=
abort
"waitpid failed
\n
"
#
exit_code
=
(
status
>>
8
)
bitand
0xff
#
wtermsig
=
status
bitand
0x7f
|
wtermsig
<>
0
=
abort
"linker exited abnormally"
=
abort
"linker exited abnormally
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
link_ok
=
exit_code
==
0
|
not
link_ok
...
...
@@ -437,20 +437,20 @@ Link linker winfun path
#
ld_pid
=
fork
|
ld_pid
<
0
=
abort
"fork failed"
=
abort
"fork failed
\n
"
|
ld_pid
==
0
|
execv
(
ld
+++
"
\0
"
)
argv
<
0
=
abort
"execv failed"
=
abort
"execution continued after execv"
=
abort
"execv failed
\n
"
=
abort
"execution continued after execv
\n
"
|
free
args_memory
<
0
=
abort
"free failed"
=
abort
"free failed
\n
"
#
(
w_pid
,
status
)
=
wait_pid
ld_pid
0