mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-23 13:23:47 +00:00
Estimated hours taken: 20 Add support for `pragma import', which is a simplified form of `pragma c_code'. With `pragma import', the user specifies only the C function name, rather than a C code fragment, and the Mercury compiler handles the argument-passing automatically. TODO - add documentation to doc/reference_manual.texi. WISHLIST - change `pragma import' and `pragma export' to take an additional parameter indicating the language (e.g. C, Prolog, Ada, Fortran, etc.) and/or calling convention compiler/prog_data.m: Add `pragma import' to the parse tree data structure. compiler/prog_io_pragma.m: Add code to parse `pragma import' declarations. compiler/mercury_to_mercury.m: Add code to pretty-print `pragma import' declarations. compiler/module_qual.m: Add code to module-qualify `pragma import' declarations. compiler/make_hlds.m: Add code to process `pragma import' declarations, by converting them to clauses with HLDS `c_code' instructions. compiler/export.m: Declare `export__exclude_argument_type' in the interface, for use by the code for handling `pragma import' in make_hlds.m. Change the documentation to say that this procedure is used for both exported and imported procedures. compiler/notes/compiler_design.html: Document how the compiler handles `pragma import' declarations. tests/hard_coded/Mmakefile: tests/hard_coded/pragma_import.m: tests/hard_coded/pragma_import.exp: Add some test cases for `pragma import'.
13 lines
146 B
Plaintext
13 lines
146 B
Plaintext
X = 101
|
|
Y = 201.000000000000
|
|
S = Foo
|
|
X1 = 1
|
|
X2 = 102
|
|
XX1 = 1
|
|
XX2 = 102
|
|
Y1 = 301
|
|
Y2 = 302
|
|
baz failed, as expected
|
|
Z = 401
|
|
quux failed, as expected
|