|
cmEngine
0.1.1
A library for interpreting CMake code.
|
The public API contains the functions used by the users of the library. They are meant to be stable and to hide the internal operating specifics of the library. More...
Data Structures | |
| struct | cmFunction |
| struct | cmCacheVariableDesc |
| struct | cmHost |
| struct | cmHostFile |
| struct | cmStat |
Macros | |
| #define | CM_ENOMEM 1 |
| #define | CM_EINVAL 2 |
| #define | CM_EFAULT 3 |
| #define | CM_ENOSYS 4 |
| #define | CM_EIO 5 |
| #define | CM_ENOENT 6 |
| #define | CM_EPERM 7 |
| #define | CM_PARENT_SCOPE 1 |
| #define | CM_IFMT 0170000 |
| #define | CM_IFREG 0100000 |
| #define | CM_IFDIR 0040000 |
Functions | |
| CM_PUBLIC const char * | cmGetArgumentContent (const struct cmArgument *argument) |
| CM_PUBLIC size_t | cmGetArgumentSize (const struct cmArgument *argument) |
| CM_PUBLIC enum cmArgumentType | cmGetArgumentType (const struct cmArgument *argument) |
| const char * | cmCacheTypeToString (enum cmCacheType type) |
| int | cmStringToCacheType (const char *str, enum cmCacheType *type) |
| enum cmCacheType | cmGetCacheVariableType (const struct cmCacheVariable *var) |
| const char * | cmGetCacheVariableDoc (const struct cmCacheVariable *var) |
| size_t | cmGetCacheVariableDocSize (const struct cmCacheVariable *var) |
| const char * | cmGetCacheVariableName (const struct cmCacheVariable *var) |
| size_t | cmGetCacheVariableNameSize (const struct cmCacheVariable *var) |
| const char * | cmGetCacheVariableValue (const struct cmCacheVariable *var) |
| size_t | cmGetCacheVariableValueSize (const struct cmCacheVariable *var) |
| CM_PUBLIC enum cmDiagnosticID | cmGetDiagnosticID (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC enum cmDiagnosticSeverity | cmGetDiagnosticSeverity (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC const char * | cmGetDiagnosticFilename (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC size_t | cmGetDiagnosticLine (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC size_t | cmGetDiagnosticColumn (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC const char * | cmGetDiagnosticMessage (const struct cmDiagnostic *diagnostic) |
| CM_PUBLIC struct cmEngine * | cmInit (struct cmHost *host) |
| CM_PUBLIC void | cmDone (struct cmEngine *engine) |
| CM_PUBLIC int | cmParseOptions (struct cmEngine *engine, int argc, char **argv) CM_WARN_UNUSED_RESULT |
| CM_PUBLIC int | cmParseOptionString (struct cmEngine *engine, const char *option_string) CM_WARN_UNUSED_RESULT |
| CM_PUBLIC int | cmDefineFunction (struct cmEngine *engine, const char *name, struct cmFunction *function) |
| CM_PUBLIC int | cmDefineVariable (struct cmEngine *engine, const char *name, const char *value) |
| CM_PUBLIC int | cmOpen (struct cmEngine *engine, const char *path) |
| CM_PUBLIC int | cmRun (struct cmEngine *engine, enum cmRunMode run_mode) |
| CM_PUBLIC int | cmIsActive (const struct cmEngine *engine) |
| CM_PUBLIC void | cmIssueMessage (struct cmFunctionContext *function_context, const struct cmMessage *message) |
| CM_PUBLIC const char * | cmGetFunctionFilename (const struct cmFunctionContext *function_context) |
| CM_PUBLIC size_t | cmGetFunctionLine (const struct cmFunctionContext *function_context) |
| CM_PUBLIC size_t | cmGetFunctionColumn (const struct cmFunctionContext *function_context) |
| CM_PUBLIC struct cmHost * | cmGetFunctionHost (struct cmFunctionContext *function_context) |
| CM_PUBLIC void | cmIssueFatalError (struct cmFunctionContext *function_context, const char *fmt,...) cmIssue_ATTRIBUTES |
| CM_PUBLIC void | cmIssueError (struct cmFunctionContext *function_context, const char *fmt,...) cmIssue_ATTRIBUTES |
| CM_PUBLIC void | cmIssueWarning (struct cmFunctionContext *function_context, const char *fmt,...) cmIssue_ATTRIBUTES |
| CM_PUBLIC const struct cmArgument * | cmPopFunctionArgument (struct cmFunctionContext *function_context) |
| CM_PUBLIC const struct cmArgument * | cmPeekFunctionArgument (struct cmFunctionContext *function_context) |
| CM_PUBLIC void | cmNextFunctionArgument (struct cmFunctionContext *function_context) |
| CM_PUBLIC int | cmFunctionHasParentScope (const struct cmFunctionContext *function_context) |
| CM_PUBLIC int | cmDefineVariableFromFunction (struct cmFunctionContext *function_context, const char *name, const char *value, int flags) |
| CM_PUBLIC int | cmUndefineVariableFromFunction (struct cmFunctionContext *function_context, const char *name, int flags) |
| CM_PUBLIC int | cmDefineCacheVariableFromFunction (struct cmFunctionContext *function_context, const struct cmCacheVariableDesc *desc) |
| CM_PUBLIC void | cmInitHost (struct cmHost *host) |
| CM_PUBLIC void * | cmMallocFromHost (struct cmHost *host, size_t size) |
| CM_PUBLIC void * | cmReallocFromHost (struct cmHost *host, void *addr, size_t size) |
| CM_PUBLIC void | cmFreeFromHost (struct cmHost *host, void *addr) |
| CM_PUBLIC int | cmOpenForReadingFromHost (struct cmHost *host, struct cmHostFile *host_file, const char *filename) |
| CM_PUBLIC const char * | cmGetEnvFromHost (struct cmHost *host, const char *key, size_t key_size) |
| CM_PUBLIC int | cmStatFromHost (struct cmHost *host, const char *path, struct cmStat *stat) |
| CM_PUBLIC const char * | cmGetMessageContent (const struct cmMessage *message) |
| CM_PUBLIC enum cmMessageType | cmGetMessageType (const struct cmMessage *message) |
| CM_PUBLIC size_t | cmGetMessageSize (const struct cmMessage *message) |
| CM_PUBLIC const char * | cmGetMessageFilename (const struct cmMessage *message) |
| CM_PUBLIC size_t | cmGetMessageLine (const struct cmMessage *message) |
| CM_PUBLIC size_t | cmGetMessageColumn (const struct cmMessage *message) |
The public API contains the functions used by the users of the library. They are meant to be stable and to hide the internal operating specifics of the library.
| #define CM_EFAULT 3 |
A faulty address was passed to or returned from a function.
| #define CM_EINVAL 2 |
An invalid argument error. This is returned sometimes when invalid user input is received. It is not always indicative of an internal error.
| #define CM_EIO 5 |
An input or output operation failed.
| #define CM_ENOENT 6 |
No such file or directory.
| #define CM_ENOMEM 1 |
This is an error code that indicates that the library ran out of memory.
| #define CM_ENOSYS 4 |
Function not implemented.
| #define CM_EPERM 7 |
Insufficient privileges for the desired operation.
| #define CM_IFDIR 0040000 |
The bits within cmStat::mode that is set if the entry is a directory.
| #define CM_IFMT 0170000 |
This is a mask for cmStat::mode that isolates the value of the file type.
| #define CM_IFREG 0100000 |
The bits within cmStat::mode that are set if the entry is a regular file.
| #define CM_PARENT_SCOPE 1 |
Used as a flag to indicate a variable in the parent scope.
| enum cmArgumentType |
Enumerates the several types of arguments.
| enum cmCacheType |
Enumerates the several possible types of a cache variable.
| enum cmMessageType |
Enumerates the several types of messages.
| enum cmRunMode |
| const char* cmCacheTypeToString | ( | enum cmCacheType | type | ) |
Converts a cache type into a string.
| type | The type to convert to a string. |
| CM_PUBLIC int cmDefineCacheVariableFromFunction | ( | struct cmFunctionContext * | function_context, |
| const struct cmCacheVariableDesc * | desc | ||
| ) |
Defines a cache variable from a function call.
| function_context | The function context to define the cache variable from. |
| desc | A description of the cache variable to define. |
| CM_PUBLIC int cmDefineFunction | ( | struct cmEngine * | engine, |
| const char * | name, | ||
| struct cmFunction * | function | ||
| ) |
Defines a new function.
| engine | The engine to define the function in. |
| name | The name to give the function. |
| function | The function to define. |
| CM_PUBLIC int cmDefineVariable | ( | struct cmEngine * | engine, |
| const char * | name, | ||
| const char * | value | ||
| ) |
Defines a new variable.
| engine | The engine to define a variable in. |
| name | The name to give the variable. |
| value | The value to give the variable. |
| CM_PUBLIC int cmDefineVariableFromFunction | ( | struct cmFunctionContext * | function_context, |
| const char * | name, | ||
| const char * | value, | ||
| int | flags | ||
| ) |
Defines a variable from a function call.
| function_context | The function call context. |
| name | The name to give the variable. |
| value | The value to give the variable. |
| flags | If CM_PARENT_SCOPE is set here, it defines the variable in the parent scope. |
| CM_PUBLIC void cmDone | ( | struct cmEngine * | engine | ) |
Releases memory allocated by the library.
| engine | The engine structure returned by cmInit. |
| CM_PUBLIC void cmFreeFromHost | ( | struct cmHost * | host, |
| void * | addr | ||
| ) |
Releases memory allocated from the host.
| host | The host that the memory was allocated from. |
| addr | The address of the memory that was allocated. |
| CM_PUBLIC int cmFunctionHasParentScope | ( | const struct cmFunctionContext * | function_context | ) |
Indicates whether or not the function call has a parent scope.
| function_context | The context of the function call. |
| CM_PUBLIC const char* cmGetArgumentContent | ( | const struct cmArgument * | argument | ) |
Accesses the argument content.
| argument | The argument to get the content of. |
| CM_PUBLIC size_t cmGetArgumentSize | ( | const struct cmArgument * | argument | ) |
Accesses the size, in terms of characters, of the argument.
| argument | The argument to get the size of. |
| CM_PUBLIC enum cmArgumentType cmGetArgumentType | ( | const struct cmArgument * | argument | ) |
Accesses the argument type.
| argument | The argument to get the type of. |
| const char* cmGetCacheVariableDoc | ( | const struct cmCacheVariable * | var | ) |
Accesses the documentation string associated with the variable.
| var | The variable to get the documentation for. |
| size_t cmGetCacheVariableDocSize | ( | const struct cmCacheVariable * | var | ) |
Accesses the number of characters in the documentation string.
| var | The variable to get the documentation size of. |
| const char* cmGetCacheVariableName | ( | const struct cmCacheVariable * | var | ) |
Accesses the name of a cache variable.
| var | The variable to get the name of. |
| size_t cmGetCacheVariableNameSize | ( | const struct cmCacheVariable * | var | ) |
Accesses the size of a cache variable name.
| var | The variable to get the name of. |
| enum cmCacheType cmGetCacheVariableType | ( | const struct cmCacheVariable * | var | ) |
Accesses the type of a cache variable.
| var | The variable to get the type of. |
| const char* cmGetCacheVariableValue | ( | const struct cmCacheVariable * | var | ) |
Accesses the value of a cache variable.
| var | The variable to get the value of. |
| size_t cmGetCacheVariableValueSize | ( | const struct cmCacheVariable * | var | ) |
Accesses the size of a cache variable value.
| var | The variable to get the value of. |
| CM_PUBLIC size_t cmGetDiagnosticColumn | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the column number of the diagnostic.
| diagnostic | The diagnostic to get the column number of. |
| CM_PUBLIC const char* cmGetDiagnosticFilename | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the filename of a diagnostic.
| diagnostic | The diagnostic to get the filename of. |
| CM_PUBLIC enum cmDiagnosticID cmGetDiagnosticID | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the ID of a diagnostic.
| diagnostic | The diagnostic to get the ID of. |
| CM_PUBLIC size_t cmGetDiagnosticLine | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the line number of the diagnostic.
| diagnostic | The diagnostic to get the line number of. |
| CM_PUBLIC const char* cmGetDiagnosticMessage | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the diagnostic message.
| diagnostic | The diagnostic to get the message for. |
| CM_PUBLIC enum cmDiagnosticSeverity cmGetDiagnosticSeverity | ( | const struct cmDiagnostic * | diagnostic | ) |
Accesses the severity of a diagnostic.
| diagnostic | The diagnostic to get the severity for. |
| CM_PUBLIC const char* cmGetEnvFromHost | ( | struct cmHost * | host, |
| const char * | key, | ||
| size_t | key_size | ||
| ) |
Gets an environment variable from the host.
| host | The host to get the environment variable from. |
| key | The name of the environment variable to get. |
| key_size | The number of characters in the environment variable key. |
| CM_PUBLIC size_t cmGetFunctionColumn | ( | const struct cmFunctionContext * | function_context | ) |
Accesses the column within the file that the function was called from.
| function_context | The function to get the column number from. |
| CM_PUBLIC const char* cmGetFunctionFilename | ( | const struct cmFunctionContext * | function_context | ) |
Accesses the filename that the function was called from.
| function_context | The function context to get the filename from. |
| CM_PUBLIC struct cmHost* cmGetFunctionHost | ( | struct cmFunctionContext * | function_context | ) |
Accesses the host of the function context.
| function_context | The function context to get the host from. |
| CM_PUBLIC size_t cmGetFunctionLine | ( | const struct cmFunctionContext * | function_context | ) |
Accesses the line within the file that the function was called from.
| function_context | The function to get the line number from. |
| CM_PUBLIC size_t cmGetMessageColumn | ( | const struct cmMessage * | message | ) |
Accesses the column that the message came from.
| message | The message to get the column number from. |
| CM_PUBLIC const char* cmGetMessageContent | ( | const struct cmMessage * | message | ) |
Accesses the content of a message.
| message | The message to get the content of. |
| CM_PUBLIC const char* cmGetMessageFilename | ( | const struct cmMessage * | message | ) |
Accesses the filename of the script that issued the message.
| message | The message to get the filename of. |
| CM_PUBLIC size_t cmGetMessageLine | ( | const struct cmMessage * | message | ) |
Accesses the line that the message came from.
| message | The message to get the line number from. |
| CM_PUBLIC size_t cmGetMessageSize | ( | const struct cmMessage * | message | ) |
Accesses the size of a message. The size of the message is considered how many characters are in the content (not including the null terminating character.)
| message | The message to get the size of. |
| CM_PUBLIC enum cmMessageType cmGetMessageType | ( | const struct cmMessage * | message | ) |
Accesses the type of a message.
| message | The message to get the type of. |
Initializes the library for use. This function should be called before any of the other library functions.
| host | A pointer to the host interface. This parameter may be null, in which case the default interface to the host system is used. |
| CM_PUBLIC void cmInitHost | ( | struct cmHost * | host | ) |
Initializes members of the host structure to their default values.
| host | The host to initialize. |
| CM_PUBLIC int cmIsActive | ( | const struct cmEngine * | engine | ) |
Indicates whether or not the engine is actively running any scripts. This function can be used along with CM_RUN_ONCE to implement a custom loop that exits when all scripts are completed.
| engine | The engine instance returned by cmInit. |
| CM_PUBLIC void cmIssueError | ( | struct cmFunctionContext * | function_context, |
| const char * | fmt, | ||
| ... | |||
| ) |
Issues an error on behalf of a function.
| function_context | The context of the function call. |
| fmt | The message format string, which should describe the error. |
| CM_PUBLIC void cmIssueFatalError | ( | struct cmFunctionContext * | function_context, |
| const char * | fmt, | ||
| ... | |||
| ) |
Issues a fatal error on behalf of a function.
| function_context | The context of the function call. |
| fmt | The message format string, which should describe the error. |
| CM_PUBLIC void cmIssueMessage | ( | struct cmFunctionContext * | function_context, |
| const struct cmMessage * | message | ||
| ) |
Issues a message to the host.
| function_context | The function context containing the host interface. |
| message | The message to issue. |
| CM_PUBLIC void cmIssueWarning | ( | struct cmFunctionContext * | function_context, |
| const char * | fmt, | ||
| ... | |||
| ) |
Issues an warning on behalf of a function.
| function_context | The context of the function call. |
| fmt | The message format string, which should describe the warning. |
| CM_PUBLIC void* cmMallocFromHost | ( | struct cmHost * | host, |
| size_t | size | ||
| ) |
Allocates memory from the host.
| host | The host to allocate memory from. |
| size | The number of bytes to allocate. |
| CM_PUBLIC void cmNextFunctionArgument | ( | struct cmFunctionContext * | function_context | ) |
Goes to the next argument in the function call. This is useful in combination with cmPeekFunctionArgument.
| function_context | The context of the function call. |
| CM_PUBLIC int cmOpen | ( | struct cmEngine * | engine, |
| const char * | path | ||
| ) |
Opens a file to be interpreted.
| engine | The engine structure returned by cmInit. |
| path | The path of the script to open. |
| CM_PUBLIC int cmOpenForReadingFromHost | ( | struct cmHost * | host, |
| struct cmHostFile * | host_file, | ||
| const char * | filename | ||
| ) |
Opens a file from the host system for reading.
| host | The host to open the file from. |
| host_file | The host file structure to initialize. |
| filename | The name of the file to open. |
| CM_PUBLIC int cmParseOptions | ( | struct cmEngine * | engine, |
| int | argc, | ||
| char ** | argv | ||
| ) |
Parses command line options.
| engine | The engine to parse the options with. |
| argc | The number of arguments in the argument array. |
| argv | The argument array. Ensure that the first argument in this parameter isn't the name of the program. Arguments not starting with - or – are considered to be script paths. |
| CM_PUBLIC int cmParseOptionString | ( | struct cmEngine * | engine, |
| const char * | option_string | ||
| ) |
Parses an option string. The option string is split by whitespace and then passed on to cmParseOptions.
| engine | The engine to receive the options. |
| option_string | The option string to parse. |
| CM_PUBLIC const struct cmArgument* cmPeekFunctionArgument | ( | struct cmFunctionContext * | function_context | ) |
Accesses the current argument in the argument queue without removing it from the on the next call.
| function_context | The context of the function call. |
| CM_PUBLIC const struct cmArgument* cmPopFunctionArgument | ( | struct cmFunctionContext * | function_context | ) |
Pops an argument from the function context.
| function_context | The function context to get the argument from. |
| CM_PUBLIC void* cmReallocFromHost | ( | struct cmHost * | host, |
| void * | addr, | ||
| size_t | size | ||
| ) |
Resizes memory allocated from the host.
| host | The host that the memory was allocated from. |
| addr | The address of the memory to resize. |
| size | The number of bytes to resize the memory to. |
Runs scripts that have been previously opened with the cmOpen function.
| engine | The engine structure returned by cmInit. |
| run_mode | The mode to run the scripts in. |
Gets file status and metadata of a specified file.
| host | The host implementing the stat function. |
| path | The path to get the status and metadata of. |
| stat | The status structure to be filled by this function. |
| int cmStringToCacheType | ( | const char * | str, |
| enum cmCacheType * | type | ||
| ) |
Converts a string to a cache type. The match is case sensitive.
| str | The null terminated string indicating the type. |
| type | A pointer to a type variable to assign the result. |
| CM_PUBLIC int cmUndefineVariableFromFunction | ( | struct cmFunctionContext * | function_context, |
| const char * | name, | ||
| int | flags | ||
| ) |
Undefines a variable from a function call.
| function_context | The context of the function call. |
| name | The name of the variable to remove. |
| flags | If this parameter contains CM_PARENT_SCOPE, then the variable is retained in its current scope and remove from the parent scope instead. |
1.8.12