![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dbDefs.h"
#include "errlog.h"
#include "macLib.h"
Go to the source code of this file.
Functions | |
long epicsStdCall | macParseDefns (MAC_HANDLE *handle, const char *defns, char **pairs[]) |
Parse macro definitions into an array of {name, value} pairs. More... | |
long epicsStdCall | macInstallMacros (MAC_HANDLE *handle, char *pairs[]) |
Install set of {name, value} pairs as definitions. More... | |
long epicsStdCall macInstallMacros | ( | MAC_HANDLE * | handle, |
char * | pairs[] | ||
) |
Install set of {name, value} pairs as definitions.
This takes an array of pairs as defined above and installs them as definitions by calling macPutValue(). The pairs array is terminated by a NULL pointer.
handle | opaque handle |
pairs | pointer to NULL-terminated array of {name,value} pair strings; a NULL value implies undefined; a NULL argument implies no macros |
Definition at line 253 of file macUtil.c.
long epicsStdCall macParseDefns | ( | MAC_HANDLE * | handle, |
const char * | defns, | ||
char ** | pairs[] | ||
) |
Parse macro definitions into an array of {name, value} pairs.
This takes a set of macro definitions in "a=xxx,b=yyy" format and converts them into an array of pointers to character strings which are, in order, "first name", "first value", "second name", "second value" etc. The array is terminated with two NULL pointers and all storage is allocated contiguously so that it can be freed with a single call to free().
This routine is independent of any handle and provides a generally useful service which may be used elsewhere. Any macro references in values are not expanded at this point since the referenced macros may be defined or redefined before the macro actually has to be translated.
Shell-style escapes and quotes are supported, as are things like "A=B,B=$(C$(A)),CA=CA,CB=CB" (sets B to "CB"). White space is significant within values but ignored elsewhere (i.e. surrounding "=" and "," characters).
The function returns the number of definitions encountered, or -1 if the supplied string is invalid.
handle | opaque handle; may be NULL if debug messages are not required. |
defns | macro definitions in "a=xxx,b=yyy" format |
pairs | address of variable to receive pointer to NULL-terminated array of {name, value} pair strings; all storage is allocated contiguously |
Definition at line 32 of file macUtil.c.