Common Lisp Package: BINGE-COMPILER

README:

FUNCTION

Public

POPULATE-NAMESPACE (NAMESPACE DECLARATIONS-LIST)

Populate NAMESPACE it with declarations from DECLARATIONS-LIST.

WRITE-DECLARATIONS (OUTPUT-STREAM DECLARATIONS-LIST)

Write a list of declarations to OUTPUT-STREAM.

WRITE-PACKAGE (OUTPUT-STREAM DECLARATIONS)

Write the package declaration to OUTPUT-STREAM. The package declaration is taken from DECLARATIONS. The package name is taken from BACKEND. If that slot is not set the whole declaration is skipped.

Undocumented

COMPLETE-DECLARATIONS (DECLARATION-LIST NAMESPACE)

GET-ALL-C-CONSTANTS (NAMESPACE)

GET-ALL-C-FUNCTIONS (NAMESPACE)

GET-ALL-C-STRUCTS (NAMESPACE)

GET-ALL-C-TYPEDEFS (NAMESPACE)

GET-ALL-C-VARIABLES (NAMESPACE)

Private

ADD-NEW-DECLARATION (DECL NAMESPACE)

Add DECL declaration in NAMESPACE namespace only if it's not already in.

ADD-PRESENCE-INTO-FSLIST (OBJ HASH)

This will add only a placeholder in the hashtable of a FAST-SEARCHABLE-LIST, but not in its list. This is handy to pretend the object is already in the list when actualy it isn't.

Undocumented

CONVERT-COMPOUND-TO-C-SYNTAX (TYPE DECLARATION)

HASH-TABLE-VALUES-LIST (HASH-TABLE)

MEMBER-OF-FSLIST (OBJ HASH)

PUSH-INTO-FSLIST (OBJ HASH)

GENERIC-FUNCTION

Public

ADD-DECLARATION (DECLARATION NAMESPACE)

Add DECLARATION in NAMESPACE, replacing original declaration if already present.

FIND-C-CONSTANT (NAMESPACE NAME)

Find constant declaration named NAME in NAMESPACE.

SETFFIND-C-CONSTANT (DECLARATION NAMESPACE NAME)

Insert constant DECLARATION named NAME in NAMESPACE.

FIND-C-ENUM (NAMESPACE NAME)

Find enum declaration named NAME in NAMESPACE.

SETFFIND-C-ENUM (DECLARATION NAMESPACE NAME)

Insert enum DECLARATION named NAME in NAMESPACE.

FIND-C-FUNCTION (NAMESPACE NAME)

Find function declaration named NAME in NAMESPACE.

SETFFIND-C-FUNCTION (DECLARATION NAMESPACE NAME)

Insert function DECLARATION named NAME in NAMESPACE.

FIND-C-STRUCT (NAMESPACE NAME)

Find struct declaration named NAME in NAMESPACE.

SETFFIND-C-STRUCT (DECLARATION NAMESPACE NAME)

Insert struct DECLARATION named NAME in NAMESPACE.

FIND-C-TYPEDEF (NAMESPACE NAME)

Find typedef declaration named NAME in NAMESPACE.

SETFFIND-C-TYPEDEF (DECLARATION NAMESPACE NAME)

Insert typedef DECLARATION with NAME in NAMESPACE.

FIND-C-UNION (NAMESPACE NAME)

Find union declaration named NAME in NAMESPACE.

SETFFIND-C-UNION (DECLARATION NAMESPACE NAME)

Insert union DECLARATION named NAME in NAMESPACE.

FIND-C-VARIABLE (NAMESPACE NAME)

Find variable declaration named NAME in NAMESPACE.

SETFFIND-C-VARIABLE (DECLARATION NAMESPACE NAME)

Insert variable DECLARATION named NAME in NAMESPACE.

Private

C-EXPRESSION (C-OBJECT NAME)

Convert C-OBJECT type to C syntax and attach name.

CHECK-REFERENCE (DECL NAMESPACE)

Make sure that the type referred by DECL exists. This is a nop if DECL is not a reference to a type. If the referenced type doesn't exist it's created and added to namespace.

COLLECT-DECLARATIONS (DECLARATION DECLARATIONS-LIST NAMESPACE)

Add to DECLARATIONS-LIST any missing declarations to fully define DECLARATION itself. All the additional declarations are taken from NAMESPACE. DECLARATIONS-LIST is sorted with most basic declarations last and independed delcarations first in the list.

CONVERT-TO-C-SYNTAX (C-OBJECT)

Convert C-OBJECT to C syntax. More or less the opposite of what the BINGE parser does.

FIND-DECLARATION (DECL NAMESPACE)

Find DECL declaration in NAMESPACE and return it, otherwise return nil.

SETFFIND-DECLARATION (VALUE DECL NAMESPACE)

Insert DECL declaration in NAMESPACE.

MAKE-SURE-REFERRED-TYPES-EXIST (OBJ NAMESPACE)

Make sure all the types referenced by C object OBJ exist. If necessary populate namespace with dummies of the missing types.

SUBSTITUTE-DECLARATIONS-WITH-REFERENCES (OBJECT NAMESPACE)

Extract type definitions, if any, from C OBJECT, populating NAMESPACE with new declarations, and susbstitute when necessary with references to types. Return the possibly modified object.

TRANSFORM-TO-REFERENCE (OBJECT NAMESPACE)

If possible transform C OBJECT into a reference and populate NAMESPACE with its declaration.

UNALIAS-REFERENCE (OBJECT NAMESPACE)

Return the primitive type or a reference to the first user-required typedef or compound object at the basis of object. Look it up in NAMESPACE.

Undocumented

COMP-ERROR-DECLARATION (CONDITION)

SETFCOMP-ERROR-DECLARATION (NEW-VALUE CONDITION)

COMP-ERROR-ITEM (CONDITION)

SLOT-ACCESSOR

Private

Undocumented

C-FUNCTIONS (OBJECT)

C-STRUCTS (OBJECT)

C-TYPEDEFS (OBJECT)

C-VARIABLES (OBJECT)

GET-LIST (OBJECT)

VARIABLE

Public

*BACKEND*

Should hold the current backend to be used by the compiler.

*COMPRESS-TYPES*

Whether or not the compiler should try to compress the type hierarchy to avoid writing unnecessary type declarations in the generated FFI. This variable can have one of the following values: - NIL, don't compress - :TYPEDEFS, remove all the typedefs not required by user - :ALL, remove all the types that are not strictly required or requested by user.

CLASS

Public

C-NAMESPACE

Objects of this class represent all the declarations taken from parsing a C source/header file. Structs, unions and enums share the same hashtable as in C they share the same namespace.

Private

Undocumented

FAST-SEARCHABLE-LIST

CONDITION

Public

Undocumented

COMPILATION-UNSUPPORTED-ERROR

Private

Undocumented

COMPILATION-ERROR