Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-and-itasks
clm
Commits
6c0d3a0b
Commit
6c0d3a0b
authored
Oct 27, 2003
by
John van Groningen
Browse files
move system dependent parts to macintosh, unix and windows folders
parent
044a6a18
Changes
1
Hide whitespace changes
Inline
Side-by-side
htoclean/htoclean source code/htoclean.icl
View file @
6c0d3a0b
module
htoclean
;
import
StdEnv
;
import
fclc
;
/* for windows */
import
code
from
"program_args.o"
;
n_args
::
Int
;
n_args
=
code {
ccall
n_args
"-I"
}
program_arg
::
!
Int
->
{#
Char
};
program_arg
i
=
code {
ccall
program_arg
"I-S"
}
DirectorySeparator
:==
'\\'
;
/* */
/* old unix code ?
n_args:==GetArgC;
program_arg i:==GetArgvN i;
GetArgC :: Int;
GetArgC = code {
ccall get_argc ":I"
}
GetArgvN :: !Int -> String;
GetArgvN n = code {
ccall get_argv_n "I:S"
}
DirectorySeparator :== '/';
*/
/* for macintosh
DirectorySeparator :== ':';
import mac_file_selector_carbon;
*/
/* for unix
import ArgEnv;
args=:getCommandLine;
n_args:==size args;
program_arg i:==args.[i];
DirectorySeparator :== '/';
*/
import
fclc
,
htoclean_file
;
split_path_name_in_file_and_directory_name
::
!{#
Char
}
->
(!{#
Char
},{#
Char
});
split_path_name_in_file_and_directory_name
path_name
...
...
@@ -76,34 +23,10 @@ write_errors [HError string line:l] stdio
#
stdio
=
stdio
<<<
string
<<<
'\n'
;
=
write_errors
l
stdio
;
wait_for_keypress
w
/* for windows and mac */
#
(
stdio
,
w
)
=
stdio
w
;
stdio
=
stdio
<<<
"Press any key to exit"
;
(
ok
,
c
,
stdio
)
=
freadc
stdio
;
(
ok
,
w
)
=
fclose
stdio
w
;
=
w
;
force_file_io
file
w
:==
snd
(
fclose
file
w
);
//force_file_io :: !.File !*World -> World; force_file_io file w = w; //Solaris and Linux
Start
w
/* not for macintosh */
#
n_arguments
=
n_args
;
|
n_arguments
<>
2
#
stderr
=
fwrites
"Usage: htoclean h_file_name
\n
"
stderr
;
stderr
=
fwrites
"Generates a .icl and .dcl file for a c header file
\n
"
stderr
;
w
=
force_file_io
stderr
w
;
=
wait_for_keypress
w
;
#
path_name
=
program_arg
1
;
/* */
/* for macintosh
# (stdio_,w) = stdio w;
stdio_ = stdio_ <<< "Select the C header file\n";
w = force_file_io stdio_ w;
(ok,path_name,w) = SelectInputFile w;
*/
#
(
ok
,
path_name
,
w
)
=
get_path_name
w
;
|
not
ok
=
w
;
#
(
directory_name
,
file_name
)
=
split_path_name_in_file_and_directory_name
path_name
;
h_file_name
=
if
(
file_name
%
(
size
file_name
-2
,
size
file_name
-1
)==
".h"
)
(
file_name
%
(
0
,
size
file_name
-3
))
file_name
;
(
errors
,
w
)
=
accFiles
(
compile_header
directory_name
h_file_name
)
w
;
...
...
@@ -111,6 +34,6 @@ Start w
[]
->
w
;
_
#
(
stdio
,
w
)
=
stdio
w
;
stdio
=
write_errors
errors
stdio
;
w
=
force_file_io
stdio
w
;
(_,
w
)
=
fclose
stdio
w
;
->
wait_for_keypress
w
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment