cmEngine  0.1.1
A library for interpreting CMake code.
Data Structures | Macros | Enumerations | Functions
Public

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
 

Enumerations

enum  cmArgumentType {
  CM_UNQUOTED_ARGUMENT,
  CM_QUOTED_ARGUMENT,
  CM_BRACKET_ARGUMENT
}
 
enum  cmCacheType {
  CM_FILEPATH_TYPE,
  CM_PATH_TYPE,
  CM_STRING_TYPE,
  CM_BOOL_TYPE,
  CM_INTERNAL_TYPE,
  CM_STATIC_TYPE
}
 
enum  cmRunMode {
  CM_RUN_DEFAULT,
  CM_RUN_ONCE
}
 
enum  cmMessageType {
  CM_MESSAGE_DEFAULT,
  CM_MESSAGE_STATUS,
  CM_MESSAGE_WARNING,
  CM_MESSAGE_AUTHOR_WARNING,
  CM_MESSAGE_SEND_ERROR,
  CM_MESSAGE_FATAL_ERROR,
  CM_MESSAGE_DEPRECATION
}
 

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 cmEnginecmInit (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 cmHostcmGetFunctionHost (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 cmArgumentcmPopFunctionArgument (struct cmFunctionContext *function_context)
 
CM_PUBLIC const struct cmArgumentcmPeekFunctionArgument (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)
 

Detailed Description

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.

Macro Definition Documentation

§ CM_EFAULT

#define CM_EFAULT   3

A faulty address was passed to or returned from a function.

§ CM_EINVAL

#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.

§ CM_EIO

#define CM_EIO   5

An input or output operation failed.

§ CM_ENOENT

#define CM_ENOENT   6

No such file or directory.

§ CM_ENOMEM

#define CM_ENOMEM   1

This is an error code that indicates that the library ran out of memory.

§ CM_ENOSYS

#define CM_ENOSYS   4

Function not implemented.

§ CM_EPERM

#define CM_EPERM   7

Insufficient privileges for the desired operation.

§ CM_IFDIR

#define CM_IFDIR   0040000

The bits within cmStat::mode that is set if the entry is a directory.

§ CM_IFMT

#define CM_IFMT   0170000

This is a mask for cmStat::mode that isolates the value of the file type.

§ CM_IFREG

#define CM_IFREG   0100000

The bits within cmStat::mode that are set if the entry is a regular file.

§ CM_PARENT_SCOPE

#define CM_PARENT_SCOPE   1

Used as a flag to indicate a variable in the parent scope.

Enumeration Type Documentation

§ cmArgumentType

Enumerates the several types of arguments.

Enumerator
CM_UNQUOTED_ARGUMENT 

The argument contains no brackets or quotes surrounding it.

CM_QUOTED_ARGUMENT 

The argument has double quotes around it. That means when it's expanded, it expands to only one argument.

CM_BRACKET_ARGUMENT 

The argument has [==[ and ]==] around it. That means variable references and generator expressions are not evaluated in this argument.

§ cmCacheType

Enumerates the several possible types of a cache variable.

Enumerator
CM_FILEPATH_TYPE 

A file path.

CM_PATH_TYPE 

A directory path.

CM_STRING_TYPE 

A simple string value.

CM_BOOL_TYPE 

A true or false value.

CM_INTERNAL_TYPE 

Used internally for persistent variables.

CM_STATIC_TYPE 

A value computed internally.

§ cmMessageType

Enumerates the several types of messages.

Enumerator
CM_MESSAGE_DEFAULT 

The default message simply prints the content to the user.

CM_MESSAGE_STATUS 

A status message.

CM_MESSAGE_WARNING 

A warning.

CM_MESSAGE_AUTHOR_WARNING 

An developer warning.

CM_MESSAGE_SEND_ERROR 

An error that continues execution of the script but disables project generation.

CM_MESSAGE_FATAL_ERROR 

An error that disables execution and project generation.

CM_MESSAGE_DEPRECATION 

A deprecation warning.

§ cmRunMode

enum cmRunMode

Enumerates the several possible run modes to use when iterating through the list of opened scripts.

Enumerator
CM_RUN_DEFAULT 

Run until all scripts have completed.

CM_RUN_ONCE 

Run one command in each active script.

Function Documentation

§ cmCacheTypeToString()

const char* cmCacheTypeToString ( enum cmCacheType  type)

Converts a cache type into a string.

Parameters
typeThe type to convert to a string.
Returns
A null-terminated string version of the type.

§ cmDefineCacheVariableFromFunction()

CM_PUBLIC int cmDefineCacheVariableFromFunction ( struct cmFunctionContext function_context,
const struct cmCacheVariableDesc desc 
)

Defines a cache variable from a function call.

Parameters
function_contextThe function context to define the cache variable from.
descA description of the cache variable to define.
Returns
Zero on success, a non-zero error code on failure.

§ cmDefineFunction()

CM_PUBLIC int cmDefineFunction ( struct cmEngine engine,
const char *  name,
struct cmFunction function 
)

Defines a new function.

Parameters
engineThe engine to define the function in.
nameThe name to give the function.
functionThe function to define.
Returns
Zero on success, non-zero on failure.
Examples:
echoCommand.c.

§ cmDefineVariable()

CM_PUBLIC int cmDefineVariable ( struct cmEngine engine,
const char *  name,
const char *  value 
)

Defines a new variable.

Parameters
engineThe engine to define a variable in.
nameThe name to give the variable.
valueThe value to give the variable.
Returns
Zero on success, non-zero on failure.

§ cmDefineVariableFromFunction()

CM_PUBLIC int cmDefineVariableFromFunction ( struct cmFunctionContext function_context,
const char *  name,
const char *  value,
int  flags 
)

Defines a variable from a function call.

Parameters
function_contextThe function call context.
nameThe name to give the variable.
valueThe value to give the variable.
flagsIf CM_PARENT_SCOPE is set here, it defines the variable in the parent scope.
Returns
Zero on success, a non-zero error code on failure.

§ cmDone()

CM_PUBLIC void cmDone ( struct cmEngine engine)

Releases memory allocated by the library.

Parameters
engineThe engine structure returned by cmInit.
Examples:
echoCommand.c.

§ cmFreeFromHost()

CM_PUBLIC void cmFreeFromHost ( struct cmHost host,
void *  addr 
)

Releases memory allocated from the host.

Parameters
hostThe host that the memory was allocated from.
addrThe address of the memory that was allocated.

§ cmFunctionHasParentScope()

CM_PUBLIC int cmFunctionHasParentScope ( const struct cmFunctionContext function_context)

Indicates whether or not the function call has a parent scope.

Parameters
function_contextThe context of the function call.
Returns
Non-zero if the function call has a parent scope, zero if it does not.

§ cmGetArgumentContent()

CM_PUBLIC const char* cmGetArgumentContent ( const struct cmArgument argument)

Accesses the argument content.

Parameters
argumentThe argument to get the content of.
Returns
A pointer to the content string. This string is null terminated.
Examples:
echoCommand.c.

§ cmGetArgumentSize()

CM_PUBLIC size_t cmGetArgumentSize ( const struct cmArgument argument)

Accesses the size, in terms of characters, of the argument.

Parameters
argumentThe argument to get the size of.
Returns
The argument size, in terms of characters.
Examples:
echoCommand.c.

§ cmGetArgumentType()

CM_PUBLIC enum cmArgumentType cmGetArgumentType ( const struct cmArgument argument)

Accesses the argument type.

Parameters
argumentThe argument to get the type of.
Returns
The argument type.

§ cmGetCacheVariableDoc()

const char* cmGetCacheVariableDoc ( const struct cmCacheVariable var)

Accesses the documentation string associated with the variable.

Parameters
varThe variable to get the documentation for.
Returns
A pointer to the documentation string. The string is null terminated.

§ cmGetCacheVariableDocSize()

size_t cmGetCacheVariableDocSize ( const struct cmCacheVariable var)

Accesses the number of characters in the documentation string.

Parameters
varThe variable to get the documentation size of.
Returns
The number of characters in the documentation string.

§ cmGetCacheVariableName()

const char* cmGetCacheVariableName ( const struct cmCacheVariable var)

Accesses the name of a cache variable.

Parameters
varThe variable to get the name of.
Returns
The name of the cache variable. This function does not return a null pointer.

§ cmGetCacheVariableNameSize()

size_t cmGetCacheVariableNameSize ( const struct cmCacheVariable var)

Accesses the size of a cache variable name.

Parameters
varThe variable to get the name of.
Returns
The number of characters in the variable name.

§ cmGetCacheVariableType()

enum cmCacheType cmGetCacheVariableType ( const struct cmCacheVariable var)

Accesses the type of a cache variable.

Parameters
varThe variable to get the type of.
Returns
The type of the specified variable.

§ cmGetCacheVariableValue()

const char* cmGetCacheVariableValue ( const struct cmCacheVariable var)

Accesses the value of a cache variable.

Parameters
varThe variable to get the value of.
Returns
The value of the cache variable. This function does not return a null pointer.

§ cmGetCacheVariableValueSize()

size_t cmGetCacheVariableValueSize ( const struct cmCacheVariable var)

Accesses the size of a cache variable value.

Parameters
varThe variable to get the value of.
Returns
The number of characters in the variable value.

§ cmGetDiagnosticColumn()

CM_PUBLIC size_t cmGetDiagnosticColumn ( const struct cmDiagnostic diagnostic)

Accesses the column number of the diagnostic.

Parameters
diagnosticThe diagnostic to get the column number of.
Returns
The column number of the diagnostic. Column numbers start at a value of one. A value of zero means that the diagnostic does not have line/column info.

§ cmGetDiagnosticFilename()

CM_PUBLIC const char* cmGetDiagnosticFilename ( const struct cmDiagnostic diagnostic)

Accesses the filename of a diagnostic.

Parameters
diagnosticThe diagnostic to get the filename of.
Returns
The file name of the diagnostic. This return value is never NULL, but may be an empty string.

§ cmGetDiagnosticID()

CM_PUBLIC enum cmDiagnosticID cmGetDiagnosticID ( const struct cmDiagnostic diagnostic)

Accesses the ID of a diagnostic.

Parameters
diagnosticThe diagnostic to get the ID of.
Returns
The ID for the specified diagnostic.

§ cmGetDiagnosticLine()

CM_PUBLIC size_t cmGetDiagnosticLine ( const struct cmDiagnostic diagnostic)

Accesses the line number of the diagnostic.

Parameters
diagnosticThe diagnostic to get the line number of.
Returns
The line number of the diagnostic. Line numbers start at a value of one. A value of zero means that the diagnostic does not have line/column info.

§ cmGetDiagnosticMessage()

CM_PUBLIC const char* cmGetDiagnosticMessage ( const struct cmDiagnostic diagnostic)

Accesses the diagnostic message.

Parameters
diagnosticThe diagnostic to get the message for.
Returns
A pointer to a string describing the diagnostic. This string pointer is never null.

§ cmGetDiagnosticSeverity()

CM_PUBLIC enum cmDiagnosticSeverity cmGetDiagnosticSeverity ( const struct cmDiagnostic diagnostic)

Accesses the severity of a diagnostic.

Parameters
diagnosticThe diagnostic to get the severity for.
Returns
The severity of the specified diagnostic.

§ cmGetEnvFromHost()

CM_PUBLIC const char* cmGetEnvFromHost ( struct cmHost host,
const char *  key,
size_t  key_size 
)

Gets an environment variable from the host.

Parameters
hostThe host to get the environment variable from.
keyThe name of the environment variable to get.
key_sizeThe number of characters in the environment variable key.
Returns
A null-terminated string containing the value of the specified variable. If null is returned by this function, it is treated as an empty string.

§ cmGetFunctionColumn()

CM_PUBLIC size_t cmGetFunctionColumn ( const struct cmFunctionContext function_context)

Accesses the column within the file that the function was called from.

Parameters
function_contextThe function to get the column number from.
Returns
The column number (starting at one) that the function call came from.

§ cmGetFunctionFilename()

CM_PUBLIC const char* cmGetFunctionFilename ( const struct cmFunctionContext function_context)

Accesses the filename that the function was called from.

Parameters
function_contextThe function context to get the filename from.
Returns
A pointer to the name of the file that called the function. This function never returns a null pointer.

§ cmGetFunctionHost()

CM_PUBLIC struct cmHost* cmGetFunctionHost ( struct cmFunctionContext function_context)

Accesses the host of the function context.

Parameters
function_contextThe function context to get the host from.
Returns
A pointer to the function context host. This can be used to allocate memory, open files, and more.

§ cmGetFunctionLine()

CM_PUBLIC size_t cmGetFunctionLine ( const struct cmFunctionContext function_context)

Accesses the line within the file that the function was called from.

Parameters
function_contextThe function to get the line number from.
Returns
The line number (starting at one) that the function call came from.

§ cmGetMessageColumn()

CM_PUBLIC size_t cmGetMessageColumn ( const struct cmMessage message)

Accesses the column that the message came from.

Parameters
messageThe message to get the column number from.
Returns
The column number that the message came from.

§ cmGetMessageContent()

CM_PUBLIC const char* cmGetMessageContent ( const struct cmMessage message)

Accesses the content of a message.

Parameters
messageThe message to get the content of.
Returns
A pointer to the message content. The string returned by this function is null-terminated. This function never returns a null pointer.

§ cmGetMessageFilename()

CM_PUBLIC const char* cmGetMessageFilename ( const struct cmMessage message)

Accesses the filename of the script that issued the message.

Parameters
messageThe message to get the filename of.
Returns
The name of the file that invoked the message. This function never returns a null pointer.

§ cmGetMessageLine()

CM_PUBLIC size_t cmGetMessageLine ( const struct cmMessage message)

Accesses the line that the message came from.

Parameters
messageThe message to get the line number from.
Returns
The line number that the message came from.

§ cmGetMessageSize()

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.)

Parameters
messageThe message to get the size of.
Returns
The size of the specified message.

§ cmGetMessageType()

CM_PUBLIC enum cmMessageType cmGetMessageType ( const struct cmMessage message)

Accesses the type of a message.

Parameters
messageThe message to get the type of.
Returns
The type of the specified message.

§ cmInit()

CM_PUBLIC struct cmEngine* cmInit ( struct cmHost host)

Initializes the library for use. This function should be called before any of the other library functions.

Parameters
hostA pointer to the host interface. This parameter may be null, in which case the default interface to the host system is used.
Returns
A pointer to a engine structure on success, a null pointer on failure.
Examples:
echoCommand.c.

§ cmInitHost()

CM_PUBLIC void cmInitHost ( struct cmHost host)

Initializes members of the host structure to their default values.

Parameters
hostThe host to initialize.

§ cmIsActive()

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.

Parameters
engineThe engine instance returned by cmInit.
Returns
Non-zero if the engine is still running scripts, zero if it is not.

§ cmIssueError()

CM_PUBLIC void cmIssueError ( struct cmFunctionContext function_context,
const char *  fmt,
  ... 
)

Issues an error on behalf of a function.

Parameters
function_contextThe context of the function call.
fmtThe message format string, which should describe the error.

§ cmIssueFatalError()

CM_PUBLIC void cmIssueFatalError ( struct cmFunctionContext function_context,
const char *  fmt,
  ... 
)

Issues a fatal error on behalf of a function.

Parameters
function_contextThe context of the function call.
fmtThe message format string, which should describe the error.

§ cmIssueMessage()

CM_PUBLIC void cmIssueMessage ( struct cmFunctionContext function_context,
const struct cmMessage message 
)

Issues a message to the host.

Parameters
function_contextThe function context containing the host interface.
messageThe message to issue.

§ cmIssueWarning()

CM_PUBLIC void cmIssueWarning ( struct cmFunctionContext function_context,
const char *  fmt,
  ... 
)

Issues an warning on behalf of a function.

Parameters
function_contextThe context of the function call.
fmtThe message format string, which should describe the warning.

§ cmMallocFromHost()

CM_PUBLIC void* cmMallocFromHost ( struct cmHost host,
size_t  size 
)

Allocates memory from the host.

Parameters
hostThe host to allocate memory from.
sizeThe number of bytes to allocate.
Returns
A pointer to the memory that was allocated.

§ cmNextFunctionArgument()

CM_PUBLIC void cmNextFunctionArgument ( struct cmFunctionContext function_context)

Goes to the next argument in the function call. This is useful in combination with cmPeekFunctionArgument.

Parameters
function_contextThe context of the function call.

§ cmOpen()

CM_PUBLIC int cmOpen ( struct cmEngine engine,
const char *  path 
)

Opens a file to be interpreted.

Parameters
engineThe engine structure returned by cmInit.
pathThe path of the script to open.
Returns
Zero on success, a negative one on failure.
Examples:
echoCommand.c.

§ cmOpenForReadingFromHost()

CM_PUBLIC int cmOpenForReadingFromHost ( struct cmHost host,
struct cmHostFile host_file,
const char *  filename 
)

Opens a file from the host system for reading.

Parameters
hostThe host to open the file from.
host_fileThe host file structure to initialize.
filenameThe name of the file to open.
Returns
Zero on success, the value of errno at the point of failure if the file could not be opened.

§ cmParseOptions()

CM_PUBLIC int cmParseOptions ( struct cmEngine engine,
int  argc,
char **  argv 
)

Parses command line options.

Parameters
engineThe engine to parse the options with.
argcThe number of arguments in the argument array.
argvThe 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.
Returns
Zero on success, non-zero on failure.

§ cmParseOptionString()

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.

Parameters
engineThe engine to receive the options.
option_stringThe option string to parse.
Returns
Zero on success, an error code on failure.

§ cmPeekFunctionArgument()

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.

Parameters
function_contextThe context of the function call.
Returns
A pointer to the current argument in the argument queue.

§ cmPopFunctionArgument()

CM_PUBLIC const struct cmArgument* cmPopFunctionArgument ( struct cmFunctionContext function_context)

Pops an argument from the function context.

Parameters
function_contextThe function context to get the argument from.
Returns
A pointer to the function argument. After the last argument is popped from function call, a null pointer will be returned instead.
Examples:
echoCommand.c.

§ cmReallocFromHost()

CM_PUBLIC void* cmReallocFromHost ( struct cmHost host,
void *  addr,
size_t  size 
)

Resizes memory allocated from the host.

Parameters
hostThe host that the memory was allocated from.
addrThe address of the memory to resize.
sizeThe number of bytes to resize the memory to.
Returns
A pointer to the new address.

§ cmRun()

CM_PUBLIC int cmRun ( struct cmEngine engine,
enum cmRunMode  run_mode 
)

Runs scripts that have been previously opened with the cmOpen function.

Parameters
engineThe engine structure returned by cmInit.
run_modeThe mode to run the scripts in.
Returns
Zero on success, a negative one on failure.
Examples:
echoCommand.c.

§ cmStatFromHost()

CM_PUBLIC int cmStatFromHost ( struct cmHost host,
const char *  path,
struct cmStat stat 
)

Gets file status and metadata of a specified file.

Parameters
hostThe host implementing the stat function.
pathThe path to get the status and metadata of.
statThe status structure to be filled by this function.
Returns
Zero on success, a non-zero error code on failure.

§ cmStringToCacheType()

int cmStringToCacheType ( const char *  str,
enum cmCacheType type 
)

Converts a string to a cache type. The match is case sensitive.

Parameters
strThe null terminated string indicating the type.
typeA pointer to a type variable to assign the result.
Returns
Zero on success, non-zero on error. This function only returns non-zero if the string passed to it was a null pointer or if the type is not recognized.

§ cmUndefineVariableFromFunction()

CM_PUBLIC int cmUndefineVariableFromFunction ( struct cmFunctionContext function_context,
const char *  name,
int  flags 
)

Undefines a variable from a function call.

Parameters
function_contextThe context of the function call.
nameThe name of the variable to remove.
flagsIf this parameter contains CM_PARENT_SCOPE, then the variable is retained in its current scope and remove from the parent scope instead.
Returns
Zero on success, a non-zero error code on failure.