SpecificationC11
Sourceimportc.d
Documentationhttps://dlang.org/phobos/dmd_importc.html
cAdjustParamType(Typet, Scope*sc);Typet | parameter type to adjust |
Scope*sc | context |
arrayFuncConv(Expressione, Scope*sc);Expressione | ImportC expression to possibly convert |
Scope*sc | context |
fieldLookup(Expressione, Scope*sc, Identifierid, boolarrow);e. Expressione evaluates to an instance of a struct. Look upident as a field of that struct.Expressione | evaluates to an instance of a struct |
Scope*sc | context |
Identifierid | identifier of a field in that struct |
boolarrow | -> was used |
e.ident if not thenErrorExp and message is printedcarraySemantic(ArrayExpae, Scope*sc);ArrayExpae | ArrayExp to run semantics on |
Scope*sc | context |
addDefaultCInitializer(VarDeclarationdsym);cFuncEquivalence(TypeFunctiontf1, TypeFunctiontf2);TypeFunctiontf1 | type of first function |
TypeFunctiontf2 | type of second function |
cTypeEquivalence(Typet1, Typet2);Typet1 | first type |
Typet2 | second type |
handleTagSymbols(ref Scopesc, Dsymbols, Dsymbols2, ScopeDsymbolsds);struct S { a; };int S;struct Ss;But there are relatively few such tag symbols, so that would be a waste of memory and complexity. An additional problem is we'd like the D side to find the tag symbols with ordinary lookup, not lookup in both tables, if the tag symbol is not conflicting with an ordinary symbol. The solution is to put the tag symbols that conflict into an associative array, indexed by the address of the ordinary symbol that conflicts with it. C has no modules, so this associative array is tagSymTab[] in ModuleDeclaration. A side effect of our approach is that D code cannot access a tag symbol that is hidden by an ordinary symbol. This is more of a theoretical problem, as nobody has mentioned it when importing C headers. If someone wants to do it, too bad so sad. Change the C code. This function fixes up the symbol table when faced with adding a new symbol
s when there is an existing symbols2 with the same name. C also allows forward and prototype declarations of tag symbols, this function merges those.Scopesc | context |
Dsymbols | symbol to add to symbol table |
Dsymbols2 | existing declaration |
ScopeDsymbolsds | symbol table |
handleSymbolRedeclarations(ref Scopesc, Dsymbols, Dsymbols2, ScopeDsymbolsds);Scopesc | context |
Dsymbols | symbol to add to symbol table |
Dsymbols2 | existing declaration |
ScopeDsymbolsds | symbol table |
cEnumSemantic(Scope*sc, EnumDeclarationed);ed