Files changed (16)
+--[[Useful style utility functions. This file will contain commonly useful strings and functions that generate useful data.]]
- GetHeaderInit: Nullary function that returns a string to be written to the beginning of a header, just after the include guards.
This module has a function called GetStyle, which is given a style name. It will return a table of functions that can be evaluated to do different code generation tasks. This table contains:
--- basename is the filename sans extension. It opens a TabbedFile from it, using the options in options.
+-- basename is the filename sans extension. It opens a TabbedFile from it, using the options in options. It returns two values: a TabbedFile, and the actual filename used.
-- specIncl is an include-guard string from the spec. It returns a string that includes the two strings, which is appropriate for use as an include-guard.
+-- Writes any style-specific scoping stuff that begins the declaration section. This is useful for things like 'extern "C"' and so forth.
+-- Writes any style-specific scoping stuff that ends the declaration section. This is useful for things like 'extern "C"' and so forth.
+-- Writes the variable declaration for a single extension variable. These are the variables that are exposed so that the user can test to see if an extension loaded.
+-- Writes any style-specific scoping stuff that starts the enumerator block. This is for *all* enumerators. This is useful for wrapping all enumerators in an enum declaration.
+-- Writes an enumerator that was written previously. Should be written as a comment, as it could conflict. extName is the name of the extension where it was originally written.
+-- Writes a function declaration. This can include multiple statements, such as a typedef, an extern function pointer declaration, and a #define or whatever.
+-- Writes the declarations for any functions used to help the user get versioning info. Will only be called if the spec has versions.
If you want to extend this to new styles, then add a module for your style, import it, and register it's module table with the registry. Your module should export a function `Create` which takes no parameters and returns a table as defined above.
+The table is indexed by version number (as a string). In each version is an array of extension names.
+This list must be manually updated, as there is no equivalent in the spec files. Just add to the list. When a new version comes out with new core extensions, add a new list and add the local variable name to the master table as shown below.