Commit be1c09e7 authored by sof's avatar sof

[project @ 1999-07-27 10:50:17 by sof]

Improve the UI a little for modules contain 'foreign export' declarations -
no longer demand that module name == (basename filename)
parent a4b5a942
......@@ -40,10 +40,10 @@ codeOutput mod_name c_code h_code flat_abstractC ncg_uniqs
doOutput opt_ProduceS ncg_output_w >>
dumpIfSet opt_D_dump_foreign "Foreign export header file" stub_h_output_d >>
outputHStub opt_ProduceExportHStubs stub_h_output_w >>
outputForeignStubs True{-.h output-} opt_ProduceExportHStubs stub_h_output_w >>
dumpIfSet opt_D_dump_foreign "Foreign export stubs" stub_c_output_d >>
outputCStub mod_name opt_ProduceExportCStubs stub_c_output_w >>
outputForeignStubs False{-not .h-} opt_ProduceExportCStubs stub_c_output_w >>
dumpIfSet opt_D_dump_realC "Real C" c_output_d >>
doOutput opt_ProduceC c_output_w
......@@ -81,21 +81,15 @@ codeOutput mod_name c_code h_code flat_abstractC ncg_uniqs
-- don't use doOutput for dumping the f. export stubs
-- since it is more than likely that the stubs file will
-- turn out to be empty, in which case no file should be created.
outputCStub mod_name switch ""
= return ()
outputCStub mod_name switch doc_str
= case switch of
Nothing -> return ()
Just fname -> writeFile fname ("#include \"Rts.h\"\n#include \"RtsAPI.h\"\n"++rest)
where
rest = "#include "++show (moduleString mod_name ++ "_stub.h") ++ '\n':doc_str
outputHStub switch ""
= return ()
outputHStub switch doc_str
= case switch of
Nothing -> return ()
Just fname -> writeFile fname ("#include \"Rts.h\"\n"++doc_str)
outputForeignStubs is_header switch "" = return ()
outputForeignStubs is_header switch doc_str =
case switch of
Nothing -> return ()
Just fname -> writeFile fname (include_prefix ++ doc_str)
where
include_prefix
| is_header = "#include \"Rts.h\"\n"
| otherwise = "#include \"RtsAPI.h\"\n"
doOutput switch io_action
= case switch of
......
......@@ -1462,7 +1462,7 @@ Now the Haskell compiler, C compiler, and assembler
}
if (-f $hsc_out_c_stub) {
&run_something("cp $hsc_out_c_stub $ofile_c_stub_target", 'Copy foreign export C stubs');
&run_something("rm -f $ofile_c_stub_target && echo '#include \"${ofile_h_stub_target}\"' > $ofile_c_stub_target && cat $hsc_out_c_stub >> $ofile_c_stub_target", 'Copy foreign export C stubs');
local ($hsc_out_s_stub);
local ($hsc_out_o_stub);
($ofile_s_stub_target = $ofile_c_stub_target) =~ s/\.(.*)$/\.s/;
......
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