diff --git a/melange-parser/alignment.dylan b/melange-parser/alignment.dylan index 4509f45..5f5233e 100644 --- a/melange-parser/alignment.dylan +++ b/melange-parser/alignment.dylan @@ -133,8 +133,8 @@ define function do-coalesce-members (decl :: ) composite := make(, name: name, dylan-name: name); result := pair(composite, result); end if; - decl-type.composite-field := composite; - decl-type.start-bit := composite.bit-size; +//unused decl-type.composite-field := composite; +//unused decl-type.start-bit := composite.bit-size; composite.fields := add!(composite.fields, member); let size = composite.bit-size + decl-type.bits-in-field; if (size > composite.type.unix-type-size) diff --git a/melange-parser/c-decl-state.dylan b/melange-parser/c-decl-state.dylan index 2a459ca..380fa25 100644 --- a/melange-parser/c-decl-state.dylan +++ b/melange-parser/c-decl-state.dylan @@ -74,7 +74,7 @@ copyright: see below define abstract class () slot objects :: ; slot structs ::
; - slot tokenizer :: , required-init-keyword: #"tokenizer"; + constant slot tokenizer :: , required-init-keyword: #"tokenizer"; slot pointers ::
; slot vectors ::
; slot verbose :: ; @@ -91,11 +91,11 @@ define class () // ".h" file. slot declarations :: = make(); slot current-file :: = ""; - slot recursive-files-stack :: = make(); + constant slot recursive-files-stack :: = make(); // maps a filename into a sequence of files which it recursively includes - slot recursive-include-table ::
= make(); + constant slot recursive-include-table ::
= make(); // maps a filename into a sequence of declarations from that file - slot recursive-declaration-table ::
= make(); + constant slot recursive-declaration-table ::
= make(); end class; define method initialize (value :: , #key) diff --git a/melange-parser/c-decl-write-c-ffi.dylan b/melange-parser/c-decl-write-c-ffi.dylan index b5bd09d..33f0cae 100644 --- a/melange-parser/c-decl-write-c-ffi.dylan +++ b/melange-parser/c-decl-write-c-ffi.dylan @@ -12,6 +12,25 @@ define method write-declaration (decl :: , back-end :: , back-end :: ) + => () + register-written-name(back-end.written-names, decl.dylan-name, decl); + let stream = back-end.stream; + if ( instance?(decl.type, ) | instance?(decl.type, ) ) + format(stream, "define c-address %s :: %s\n", decl.dylan-name, decl.type.dylan-name); + else + format(stream, "define c-variable %s :: %s\n", decl.dylan-name, decl.mapped-name); + end; + if ( decl.read-only ) + format(stream, " setter: #f,\n"); + end; + if ( decl.external-linkage == #t ) + format(stream, " import: #t,\n"); + end; + format(stream, " c-name: \"%s\"\n", decl.simple-name); + format(stream, "end;\n\n"); +end; + define method write-declaration (decl :: , back-end :: ) => (); register-written-name(back-end.written-names, decl.dylan-name, decl); diff --git a/melange-parser/c-decl-write.dylan b/melange-parser/c-decl-write.dylan index c59c3da..77c1f8f 100644 --- a/melange-parser/c-decl-write.dylan +++ b/melange-parser/c-decl-write.dylan @@ -78,7 +78,7 @@ define generic write-declaration //------------------------------------------------------------------------ define class () - slot written-name-table ::
/* => */ + constant slot written-name-table ::
/* => */ = make(
); end class ; diff --git a/melange-parser/c-decl.dylan b/melange-parser/c-decl.dylan index 2219a9c..9316d50 100644 --- a/melange-parser/c-decl.dylan +++ b/melange-parser/c-decl.dylan @@ -93,7 +93,7 @@ copyright: see below // // operations include equated and read-only // -// operations include getter and setter +// operations include getter and setter, read-only, external-linkage // // operations include excluded? // @@ -101,7 +101,7 @@ copyright: see below // // operations include direction, original-type, // argument-direction-setter -// +// // // operations include constant-value // @@ -126,8 +126,8 @@ define abstract class () init-value: #f, init-keyword: #"dylan-name"; slot map-type :: false-or(), init-value: #f; slot declared? :: , init-value: #f; - constant slot abstract-type? :: , - init-value: #f, init-keyword: abstract-type?:; +//unused constant slot abstract-type? :: , +// init-value: #f, init-keyword: abstract-type?:; end class ; define abstract class () @@ -167,7 +167,7 @@ define generic dylan-name-setter // define generic compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); // Find-dylan-name provlides low level support for "apply-options". It checks @@ -177,7 +177,7 @@ define generic compute-dylan-name // define generic find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , read-only :: , sealing :: ) + containers :: , read-only :: , sealing :: , external :: ) => (result :: ); // Sets the dylan name for this object or type. (External interface.) @@ -220,7 +220,7 @@ define generic pointer-to // define generic apply-options (decl :: , map-function :: , prefix :: , - read-only :: , sealing :: ) + read-only :: , sealing :: , external :: ) => (); //------------------------------------------------------------------------ @@ -246,11 +246,11 @@ end method remap; // define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , read-only :: , sealing :: ) + containers :: , read-only :: , sealing :: , external :: ) => (result :: ); decl.d-name | (decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - read-only, sealing)); + read-only, sealing, external)); end method find-dylan-name; define method dylan-name (decl :: ) => (result :: ); @@ -289,9 +289,9 @@ end method compute-closure; define method apply-options (decl :: , map-function :: , prefix :: , - read-only :: , sealing :: ) + read-only :: , sealing :: , external :: ) => (); - find-dylan-name(decl, map-function, prefix, #(), read-only, sealing); + find-dylan-name(decl, map-function, prefix, #(), read-only, sealing, external ); end method apply-options; // Exclude-decl -- exported. @@ -333,7 +333,7 @@ end method equate; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"type", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -403,7 +403,7 @@ define generic make-struct-type define generic apply-container-options (decl :: , map-function :: , prefix :: , read-only :: , - sealing :: ) + sealing :: , external :: ) => (); define method compute-closure @@ -544,18 +544,18 @@ end method exclude-slots; define method find-dylan-name (decl :: , mapper :: , prefix :: , containers :: , read-only :: , - sealing :: ) + sealing :: , external :: ) => (result :: ); unless (decl.d-name) decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - read-only, sealing); + read-only, sealing, external); // Take care of the contained objects as well. Some of these may // already have been handled by "container" declarations. let sub-containers = list(decl.simple-name); if (decl.members) for (sub-decl in decl.members) find-dylan-name(sub-decl, mapper, prefix, sub-containers, - read-only, sealing); + read-only, sealing, external); end for; end if; end; @@ -565,13 +565,13 @@ end method find-dylan-name; define method apply-container-options (decl :: , map-function :: , prefix :: , read-only :: , - sealing :: ) + sealing :: , external :: ) => (); let sub-containers = list(decl.simple-name); if (decl.members) for (elem in decl.members) find-dylan-name(elem, map-function, prefix, sub-containers, read-only, - sealing); + sealing, external); end for; end if; end method apply-container-options; @@ -579,13 +579,13 @@ end method apply-container-options; //------------------------------------------------------------------------ define class (, ) - slot referent :: , required-init-keyword: #"referent"; - slot accessors-written?, init-value: #f; + constant slot referent :: , required-init-keyword: #"referent"; +//unused slot accessors-written?, init-value: #f; end class; define class (, ) - slot pointer-equiv :: , required-init-keyword: #"equiv"; - slot length :: false-or(), + constant slot pointer-equiv :: , required-init-keyword: #"equiv"; + constant slot length :: false-or(), required-init-keyword: #"length"; end class ; @@ -653,10 +653,10 @@ end method canonical-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); if (decl.simple-name = decl.referent.simple-name) - find-dylan-name(decl.referent, mapper, prefix, #(), rd-only, sealing); + find-dylan-name(decl.referent, mapper, prefix, #(), rd-only, sealing, external ); else mapper(#"type", prefix, decl.simple-name, containers); end if; @@ -675,7 +675,7 @@ end method compute-closure; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"type", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -735,8 +735,8 @@ end method vector-of; //------------------------------------------------------------------------ define class () - slot result :: , required-init-keyword: #"result"; - slot parameters :: , required-init-keyword: #"params"; + constant slot result :: , required-init-keyword: #"result"; + constant slot parameters :: , required-init-keyword: #"params"; slot local-name-mapper :: false-or() = #f; slot callback-maker-name :: false-or() = #f; slot callout-function-name :: false-or() = #f; @@ -758,25 +758,25 @@ end method canonical-name; define method find-dylan-name (decl :: , mapper :: , prefix :: , containers :: , read-only :: , - sealing :: ) + sealing :: , external :: ) => (result :: ); find-dylan-name(decl.result, mapper, prefix, #(), read-only, - sealing); + sealing, external); for (elem in decl.parameters) if (~instance?(elem, )) - find-dylan-name(elem, mapper, prefix, #(), read-only, sealing); + find-dylan-name(elem, mapper, prefix, #(), read-only, sealing, external); end if; end for; decl.d-name | (decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - read-only, sealing)); + read-only, sealing, external)); end method find-dylan-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , containers :: , rd-only :: , - sealing :: ) + sealing :: , external :: ) => (result :: ); mapper(#"type", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -811,7 +811,7 @@ end method mapped-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"type", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -844,20 +844,20 @@ end method true-type; define class () end class; define class () - slot type-size-slot :: , required-init-keyword: #"size"; + constant slot type-size-slot :: , required-init-keyword: #"size"; end class; define class () // Accessor-name specifies the "dereference" function to call in order to // retrieve the correct number of bytes. - slot accessor-name :: , required-init-keyword: #"accessor"; +//unused slot accessor-name :: , required-init-keyword: #"accessor"; end class; define class () end class; define class () end class; define class () - slot accessor-name :: , required-init-keyword: #"accessor"; +//unused slot accessor-name :: , required-init-keyword: #"accessor"; end class; define constant unknown-type = make(, @@ -867,7 +867,7 @@ define constant unsigned-type = make(, define constant signed-type = make(, name: "unknown-type"); define constant void-type = make(, - dylan-name: "", + dylan-name: "", abstract-type?: #t, name: "void-type", size: 0); @@ -964,10 +964,10 @@ end method compute-closure; // "do-coalesce-members" function). define class () - slot bits-in-field :: , required-init-keyword: #"bits"; - slot base-type :: , required-init-keyword: #"base"; - slot composite-field :: false-or() = #f; - slot start-bit :: = 0; // only meaningful if composite ~= #f + constant slot bits-in-field :: , required-init-keyword: #"bits"; +//unused slot base-type :: , required-init-keyword: #"base"; +//unused slot composite-field :: false-or() = #f; +//unused slot start-bit :: = 0; // only meaningful if composite ~= #f end class ; define class () @@ -997,6 +997,7 @@ end class; define class () slot getter :: false-or(), init-value: #f; slot setter :: false-or(), init-value: #f; + slot external-linkage :: type-union(, ), init-value: #(); end class; define class () slot excluded? :: , init-value: #f, init-keyword: #"excluded?"; @@ -1004,7 +1005,7 @@ end class; define class () end class; define class () slot direction :: , init-value: #"default"; - slot original-type :: false-or(), + constant slot original-type :: false-or(), init-value: #f; end class; define class () end class; @@ -1041,19 +1042,19 @@ end method equate; define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , read-only :: , sealing :: ) + containers :: , read-only :: , sealing :: , external :: ) => (result :: ); - find-dylan-name(decl.type, mapper, prefix, #(), read-only, sealing); + find-dylan-name(decl.type, mapper, prefix, #(), read-only, sealing, external); decl.d-name | (decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - read-only, sealing)); + read-only, sealing, external)); end method find-dylan-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); - find-dylan-name(decl.type, mapper, prefix, containers, rd-only, sealing); + find-dylan-name(decl.type, mapper, prefix, containers, rd-only, sealing, external); mapper(#"function", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -1089,39 +1090,40 @@ end method type-name; define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , read-only :: , sealing :: ) + containers :: , read-only :: , sealing :: , external :: ) => (result :: ); if (decl.sealed-string = "") decl.sealed-string := sealing end if; decl.d-name | (decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - read-only, sealing)); + read-only, sealing, external)); end method find-dylan-name; define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); if (decl.sealed-string = "") decl.sealed-string := sealing end if; if (decl.read-only == #()) decl.read-only := rd-only end if; - find-dylan-name(decl.type, mapper, prefix, #(), rd-only, sealing); + find-dylan-name(decl.type, mapper, prefix, #(), rd-only, sealing, external); decl.d-name | (decl.d-name := compute-dylan-name(decl, mapper, prefix, containers, - rd-only, sealing)); + rd-only, sealing, external)); end method find-dylan-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"variable", prefix, decl.simple-name, containers); end method compute-dylan-name; define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: , + containers :: , rd-only :: , sealing :: , external :: , #next next-method) => (result :: ); next-method(); + if (decl.external-linkage == #()) decl.external-linkage := external end if; decl.getter := decl.getter | decl.d-name; decl.setter := decl.setter | concatenate(decl.d-name, "-setter"); decl.d-name; @@ -1139,19 +1141,19 @@ end method compute-closure; define method find-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: , + containers :: , rd-only :: , sealing :: , external :: , #next next-method) => (result :: ); if (decl.original-type) find-dylan-name(decl.original-type, mapper, prefix, #(), rd-only, - sealing); + sealing, external); end if; next-method(); end method find-dylan-name; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"variable", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -1242,7 +1244,7 @@ end class; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); // (Do not emit container prefixes for enum constants. C semantics @@ -1273,7 +1275,7 @@ define generic add-cpp-declaration define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); mapper(#"constant", prefix, decl.simple-name, containers); end method compute-dylan-name; @@ -1304,7 +1306,7 @@ end method compute-closure; define method compute-dylan-name (decl :: , mapper :: , prefix :: , - containers :: , rd-only :: , sealing :: ) + containers :: , rd-only :: , sealing :: , external :: ) => (result :: ); // If we are aliasing another declaration, we should use the same category. // We should only use #"constant" if we are renaming a constant or have an diff --git a/melange-parser/c-exports.dylan b/melange-parser/c-exports.dylan index c92029c..5bc47be 100644 --- a/melange-parser/c-exports.dylan +++ b/melange-parser/c-exports.dylan @@ -112,7 +112,6 @@ define module c-lexer exclude: { format, format-to-string, split, position }; use format; - use table-extensions; use self-organizing-list; use string-conversions; use regular-expressions; @@ -223,7 +222,7 @@ define module c-declarations argument-direction-setter, constant-value-setter, getter-setter, setter-setter, read-only-setter, sealed-string-setter, excluded?-setter, exclude-slots, equate, remap, rename, superclasses-setter, pointer-equiv, - dylan-name, exclude-decl, + dylan-name, exclude-decl, external-linkage-setter, // "Import declarations phase" declaration-closure, // also calls compute-closure diff --git a/melange-parser/c-lexer-cpp.dylan b/melange-parser/c-lexer-cpp.dylan index 5497067..dc9109b 100644 --- a/melange-parser/c-lexer-cpp.dylan +++ b/melange-parser/c-lexer-cpp.dylan @@ -49,7 +49,7 @@ copyright: see below // themselves have entries in the table. Macro expansion will, therefore, // recursively expand each "expanded" token, recursing as deeply as necessary. // -define constant default-cpp-table = make(); +//unused define constant default-cpp-table = make(); // include-path -- exported constant. // @@ -425,6 +425,8 @@ define method angle-include-next( state, filename ) state.include-tokenizer := make(, contents: "", parent: state); end if; + else + parse-error(state,"Filename not found %s",name); end if; else parse-error(state,"Filename is not absolute %s",name); diff --git a/melange-parser/c-lexer.dylan b/melange-parser/c-lexer.dylan index 61ef4b4..6a97d1e 100644 --- a/melange-parser/c-lexer.dylan +++ b/melange-parser/c-lexer.dylan @@ -102,7 +102,7 @@ define /* exported */ primary class () slot file-name :: = ""; slot contents :: = make(); slot position :: = 0; - slot unget-stack :: , init-function: curry(make, ); + constant slot unget-stack :: , init-function: curry(make, ); /* exported */ slot cpp-table ::
; slot cpp-stack :: = #(); /* exported */ slot cpp-decls :: false-or() = #f; @@ -142,8 +142,8 @@ end class ; // define /* exported */ abstract primary class () constant /* exported */ slot token-id :: = -1; - slot string-value :: , required-init-keyword: #"string"; - /* exported */ slot generator, required-init-keyword: #"generator"; + constant slot string-value :: , required-init-keyword: #"string"; + constant /* exported */ slot generator, required-init-keyword: #"generator"; slot position, init-value: #f, init-keyword: #"position"; end; @@ -161,7 +161,7 @@ define /* exported */ abstract class () end class; // will be a subclass of this. // define /* exported */ class () - slot value :: , required-init-keyword: #"value"; + constant slot value :: , required-init-keyword: #"value"; end class; define /* exported */ abstract class () end class; diff --git a/melange-parser/parse-conditions.dylan b/melange-parser/parse-conditions.dylan index 981c8d1..426cfec 100644 --- a/melange-parser/parse-conditions.dylan +++ b/melange-parser/parse-conditions.dylan @@ -50,7 +50,7 @@ push(*default-parse-context*, #f); // other such classes if they are needed. define abstract class () - slot parse-condition-source-location :: , + constant slot parse-condition-source-location :: , required-init-keyword: source-location:; end; @@ -67,8 +67,8 @@ define class (, end; define class () - slot parse-progress-level :: = $parse-progress-level-all, - init-keyword: level:; + constant slot parse-progress-level :: = $parse-progress-level-all, + required-init-keyword: level:; end; diff --git a/melange-parser/source-location.dylan b/melange-parser/source-location.dylan index 7e6487b..daf30cf 100644 --- a/melange-parser/source-location.dylan +++ b/melange-parser/source-location.dylan @@ -109,9 +109,9 @@ define class () constant slot source-line :: , required-init-keyword: line:; - constant slot source-line-position :: false-or(), - init-keyword: line-position:, - init-value: #f; +// constant slot source-line-position :: false-or(), +// init-keyword: line-position:, +// init-value: #f; end; define sealed domain make (singleton()); diff --git a/melange/exports.dylan b/melange/exports.dylan index f3e1b45..93632a8 100644 --- a/melange/exports.dylan +++ b/melange/exports.dylan @@ -120,7 +120,7 @@ define module int-lexer , , , , , , , , , , , - , ; + , , ; end module int-lexer; define module int-parse @@ -139,7 +139,7 @@ define module int-parse mappings, equates, read-only, seal-string, , , , , , , , , name, options, , - undefined; + undefined, external-linkage; end module int-parse; define module name-mappers diff --git a/melange/int-lexer.dylan b/melange/int-lexer.dylan index 7530f46..c3c8157 100644 --- a/melange/int-lexer.dylan +++ b/melange/int-lexer.dylan @@ -89,11 +89,11 @@ copyright: see below // The public view of tokenizers is described above. // define primary class () - slot file-name :: false-or(), + constant slot file-name :: false-or(), init-value: #f, init-keyword: #"source-file"; - slot contents :: , required-init-keyword: #"source-string"; + constant slot contents :: , required-init-keyword: #"source-string"; slot position :: , init-keyword: #"start", init-value: 0; - slot unget-stack :: , init-function: curry(make, ); + constant slot unget-stack :: , init-function: curry(make, ); end class ; // Exported operations -- described in module header @@ -133,8 +133,8 @@ define generic unget-token define abstract primary class () constant slot token-id :: = -1; - slot string-value :: , required-init-keyword: #"string"; - slot generator, required-init-keyword: #"generator"; + constant slot string-value :: , required-init-keyword: #"string"; + constant slot generator, required-init-keyword: #"generator"; slot position, init-value: #f, init-keyword: #"position"; end; @@ -218,14 +218,15 @@ define token :: = 49; define token :: = 50; define token :: = 51; define token :: = 52; +define token :: = 53; // A whole bunch of punctuation -define token :: = 53; -define token :: = 54; -define token :: = 55; -define token :: = 56; -define token :: = 57; +define token :: = 54; +define token :: = 55; +define token :: = 56; +define token :: = 57; +define token :: = 58; define sealed generic string-value (token :: ) => (result :: ); define sealed generic value (token :: ) => (result :: ); @@ -432,6 +433,7 @@ define constant reserved-words "function-type", , "callback-maker:", , "callout-function:", , + "external:", , "#t", , "#f", , ",", , @@ -779,6 +781,8 @@ define sealed domain make(singleton()); define sealed domain make(singleton()); // -- subclass of define sealed domain make(singleton()); +// -- subclass of +define sealed domain make(singleton()); // -- subclass of define sealed domain make(singleton()); // -- subclass of diff --git a/melange/int-parse.input b/melange/int-parse.input index 1f42a2b..2430074 100644 --- a/melange/int-parse.input +++ b/melange/int-parse.input @@ -48,10 +48,6 @@ copyright: see below // Simple parser support //---------------------------------------------------------------------- -// Designates an "optional" string. -// -define constant = false-or(); - // Undefined values are useful for values that may need to be defaulted. This // is superior to simply filling in the default value at the start, since it // allows us to merge several s before doing the defaulting. @@ -69,9 +65,9 @@ define class () // each element of imports is either #"all" or an import list slot global-import-mode :: one-of(#"all", #"all-recursive", #"none", #"undecided") = #"undecided"; - slot global-imports :: = make(); - slot file-import-modes = make() /* of #"all", #"none" */; - slot file-imports = make() /* of */; + constant slot global-imports :: = make(); + constant slot file-import-modes = make() /* of #"all", #"none" */; + constant slot file-imports = make() /* of */; slot prefix :: type-union(, ), init-value: undefined; constant slot exclude = make(); constant slot excluded-files = make(); @@ -79,6 +75,7 @@ define class () slot mappings :: , init-value: #(); slot equates :: , init-value: #(); slot read-only :: type-union(, ), init-value: undefined; + slot external-linkage :: type-union(, ), init-value: undefined; slot seal-string :: type-union(, ), init-value: undefined; end class ; @@ -91,10 +88,10 @@ end class ; // order. // define class () - slot tokenizer :: , required-init-keyword: #"tokenizer"; + constant slot tokenizer :: , required-init-keyword: #"tokenizer"; slot include-files :: false-or() = #f; - slot macro-defines :: , init-function: curry(make, ); - slot macro-undefines :: , init-function: curry(make, ); + constant slot macro-defines :: , init-function: curry(make, ); + constant slot macro-undefines :: , init-function: curry(make, ); slot container-options :: ; slot clauses :: , init-value: #(); end class ; @@ -178,6 +175,8 @@ define method process-container-options result.equates, item.second); #"read-only" => result.read-only := item.second; + #"external" => + result.external-linkage := item.second; #"seal" => result.seal-string := item.second; otherwise => @@ -195,12 +194,11 @@ end method process-container-options; // some of the options in a more convenient format. // define class () - slot name :: , required-init-keyword: #"name"; - slot options :: , required-init-keyword: #"options"; + constant slot name :: , required-init-keyword: #"name"; + constant slot options :: , required-init-keyword: #"options"; end class; define class () end class; -define class () end class; define class () end class; define class () end class; define class () end class; @@ -211,6 +209,7 @@ end class ; define class () end class; define class () end class; +define class () end class; define constant = false-or(); @@ -281,6 +280,7 @@ define constant = false-or(); :token :token :token +:token ;; A whole bunch of punctuation @@ -542,6 +542,10 @@ container-option ( BOOLEAN) list(#"read-only", %2.value); % +container-option ( BOOLEAN) + list(#"external", %2.value); +% + interface-clause ( function-option-list) @0.clauses := add!(@0.clauses, @@ -756,6 +760,10 @@ variable-option ( BOOLEAN) pair(#"read-only", %2.value); % +variable-option ( BOOLEAN) + pair(#"external", %2.value); +% + variable-option ( ) pair(#"map", %2.string-value); % diff --git a/melange/interface.dylan b/melange/interface.dylan index aae12da..29f5642 100644 --- a/melange/interface.dylan +++ b/melange/interface.dylan @@ -241,15 +241,17 @@ end method process-imports; define method merge-container-options (first :: , #rest rest) => (mapper :: , prefix :: , read-only :: , - sealing :: ); + sealing :: , external-linkage :: ); let mapper = first.name-mapper; let pre = first.prefix; let rd-only = first.read-only; + let ext-linkage = first.external-linkage; let sealing = first.seal-string; for (next in rest) if (mapper == undefined) mapper := next.name-mapper end if; if (pre == undefined) pre := next.prefix end if; if (rd-only == undefined) rd-only := next.read-only end if; + if (ext-linkage == undefined) ext-linkage := next.external-linkage end if; if (sealing == undefined) sealing := next.seal-string end if; end for; if (mapper == undefined) @@ -257,8 +259,9 @@ define method merge-container-options end if; if (pre == undefined) pre := "" end if; if (rd-only == undefined) rd-only := #f end if; + if (ext-linkage == undefined) ext-linkage := #f end if; if (sealing == undefined) sealing := "sealed" end if; - values(curry(map-name, mapper), pre, rd-only, sealing); + values(curry(map-name, mapper), pre, rd-only, sealing, ext-linkage); end method merge-container-options; //---------------------------------------------------------------------- @@ -308,6 +311,7 @@ define method process-clause #"setter" => if (body) decl.setter := body else decl.read-only := #t end; #"getter" => decl.getter := body; #"read-only" => decl.read-only := body; + #"external" => decl.external-linkage := body; #"seal" => decl.sealed-string := body; #"equate" => equate(decl, body); #"map" => remap(decl, body);