Allow message about referenced but undefined to be suppressed

This commit is contained in:
Marty Kraimer
1997-06-05 18:28:50 +00:00
parent e11c120f6b
commit db49a2babb
6 changed files with 66 additions and 4 deletions

View File

@@ -105,6 +105,7 @@ epicsShareAPI macCreateHandle(
handle->dirty = FALSE;
handle->level = 0;
handle->debug = 0;
handle->suppressWarning = 0;
ellInit( &handle->list );
/* if supplied, load macro definitions */
@@ -120,6 +121,13 @@ epicsShareAPI macCreateHandle(
return 0;
}
void epicsShareAPI macSuppressWarning(
MAC_HANDLE *handle, /* opaque handle */
int falseTrue /*0 means issue, 1 means suppress*/
)
{
handle->suppressWarning = falseTrue;
}
/*
* Expand a string that may contain macro references and return the
@@ -686,9 +694,11 @@ static void trans( MAC_HANDLE *handle, MAC_ENTRY *entry, long level,
/* look up resultant name; if not there, set error flag and
copy reference */
if ( ( entry2 = lookup( handle, name2, FALSE ) ) == NULL ) {
entry->error = TRUE;
macErrMessage2( -1, "%s: %s referenced but undefined",
if(!handle->suppressWarning) {
entry->error = TRUE;
macErrMessage2( -1, "%s: %s referenced but undefined",
entry->name, name2 );
}
sprintf( v, "$(%s)", name2 ); v += strlen( v );
}
@@ -745,6 +755,9 @@ char *Strdup( char *string )
}
/* $Log$
* Revision 1.5 1997/05/01 19:57:32 jhill
* updated dll keywords
*
* Revision 1.4 1997/04/30 19:10:04 mrk
* Fix long memory free list problem
*

View File

@@ -79,6 +79,7 @@ typedef struct {
long level; /* scoping level */
long debug; /* debugging level */
ELLLIST list; /* macro name / value list */
int suppressWarning;/*suppress warning messages*/
} MAC_HANDLE;
/*
@@ -110,6 +111,13 @@ epicsShareAPI macCreateHandle(
/* argument implies no macros */
);
epicsShareFunc void
epicsShareAPI macSuppressWarning(
MAC_HANDLE *handle, /* opaque handle */
int falseTrue /*0 means ussue, 1 means suppress*/
);
epicsShareFunc long /* #chars copied, <0 if any macros are */
/* undefined */
epicsShareAPI macExpandString(
@@ -123,6 +131,7 @@ epicsShareAPI macExpandString(
/* to destination string */
);
epicsShareFunc long /* length of value */
epicsShareAPI macPutValue(
MAC_HANDLE *handle, /* opaque handle */
@@ -193,6 +202,9 @@ epicsShareAPI macInstallMacros(
);
/* $Log$
* Revision 1.3 1997/05/01 19:57:34 jhill
* updated dll keywords
*
* Revision 1.2 1996/09/16 21:07:10 jhill
* fixed warnings
*

View File

@@ -105,6 +105,7 @@ epicsShareAPI macCreateHandle(
handle->dirty = FALSE;
handle->level = 0;
handle->debug = 0;
handle->suppressWarning = 0;
ellInit( &handle->list );
/* if supplied, load macro definitions */
@@ -120,6 +121,13 @@ epicsShareAPI macCreateHandle(
return 0;
}
void epicsShareAPI macSuppressWarning(
MAC_HANDLE *handle, /* opaque handle */
int falseTrue /*0 means issue, 1 means suppress*/
)
{
handle->suppressWarning = falseTrue;
}
/*
* Expand a string that may contain macro references and return the
@@ -686,9 +694,11 @@ static void trans( MAC_HANDLE *handle, MAC_ENTRY *entry, long level,
/* look up resultant name; if not there, set error flag and
copy reference */
if ( ( entry2 = lookup( handle, name2, FALSE ) ) == NULL ) {
entry->error = TRUE;
macErrMessage2( -1, "%s: %s referenced but undefined",
if(!handle->suppressWarning) {
entry->error = TRUE;
macErrMessage2( -1, "%s: %s referenced but undefined",
entry->name, name2 );
}
sprintf( v, "$(%s)", name2 ); v += strlen( v );
}
@@ -745,6 +755,9 @@ char *Strdup( char *string )
}
/* $Log$
* Revision 1.5 1997/05/01 19:57:32 jhill
* updated dll keywords
*
* Revision 1.4 1997/04/30 19:10:04 mrk
* Fix long memory free list problem
*

View File

@@ -79,6 +79,7 @@ typedef struct {
long level; /* scoping level */
long debug; /* debugging level */
ELLLIST list; /* macro name / value list */
int suppressWarning;/*suppress warning messages*/
} MAC_HANDLE;
/*
@@ -110,6 +111,13 @@ epicsShareAPI macCreateHandle(
/* argument implies no macros */
);
epicsShareFunc void
epicsShareAPI macSuppressWarning(
MAC_HANDLE *handle, /* opaque handle */
int falseTrue /*0 means ussue, 1 means suppress*/
);
epicsShareFunc long /* #chars copied, <0 if any macros are */
/* undefined */
epicsShareAPI macExpandString(
@@ -123,6 +131,7 @@ epicsShareAPI macExpandString(
/* to destination string */
);
epicsShareFunc long /* length of value */
epicsShareAPI macPutValue(
MAC_HANDLE *handle, /* opaque handle */
@@ -193,6 +202,9 @@ epicsShareAPI macInstallMacros(
);
/* $Log$
* Revision 1.3 1997/05/01 19:57:34 jhill
* updated dll keywords
*
* Revision 1.2 1996/09/16 21:07:10 jhill
* fixed warnings
*

View File

@@ -67,6 +67,7 @@ utility routines, described later, use core routines to provide a more
convenient interface for some purposes.
a) long macCreateHandle( MAC_HANDLE **handle, char *pairs[] );
void macSuppressWarning(MAC_HANDLE *handle,int falseTrue);
Creates a new macro substitution context and returns an opaque handle
to that context. An application can, if it desires, have several
@@ -81,6 +82,11 @@ a) long macCreateHandle( MAC_HANDLE **handle, char *pairs[] );
context structure. The memory for this context is allocated by this
routine.
macSuppressWarning can be called to suppress the marning message
when macExpandString cant expand a macro. A non zero value will
suppress the messages.
b) long macGetXxxx( MAC_HANDLE *handle, <Xxxx-specific> );
long macPutXxxx( MAC_HANDLE *handle, <Xxxx-specific> );

View File

@@ -67,6 +67,7 @@ utility routines, described later, use core routines to provide a more
convenient interface for some purposes.
a) long macCreateHandle( MAC_HANDLE **handle, char *pairs[] );
void macSuppressWarning(MAC_HANDLE *handle,int falseTrue);
Creates a new macro substitution context and returns an opaque handle
to that context. An application can, if it desires, have several
@@ -81,6 +82,11 @@ a) long macCreateHandle( MAC_HANDLE **handle, char *pairs[] );
context structure. The memory for this context is allocated by this
routine.
macSuppressWarning can be called to suppress the marning message
when macExpandString cant expand a macro. A non zero value will
suppress the messages.
b) long macGetXxxx( MAC_HANDLE *handle, <Xxxx-specific> );
long macPutXxxx( MAC_HANDLE *handle, <Xxxx-specific> );