From db49a2babb00b94e4cf9d77d6bbd89800615269f Mon Sep 17 00:00:00 2001 From: Marty Kraimer Date: Thu, 5 Jun 1997 18:28:50 +0000 Subject: [PATCH] Allow message about referenced but undefined to be suppressed --- src/libCom/macCore.c | 17 +++++++++++++++-- src/libCom/macLib.h | 12 ++++++++++++ src/libCom/macLib/macCore.c | 17 +++++++++++++++-- src/libCom/macLib/macLib.h | 12 ++++++++++++ src/libCom/macLib/macLibREADME | 6 ++++++ src/libCom/macLibREADME | 6 ++++++ 6 files changed, 66 insertions(+), 4 deletions(-) diff --git a/src/libCom/macCore.c b/src/libCom/macCore.c index 56add9f2d..e22aec180 100644 --- a/src/libCom/macCore.c +++ b/src/libCom/macCore.c @@ -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 * diff --git a/src/libCom/macLib.h b/src/libCom/macLib.h index e02b153d2..e1d6878e3 100644 --- a/src/libCom/macLib.h +++ b/src/libCom/macLib.h @@ -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 * diff --git a/src/libCom/macLib/macCore.c b/src/libCom/macLib/macCore.c index 56add9f2d..e22aec180 100644 --- a/src/libCom/macLib/macCore.c +++ b/src/libCom/macLib/macCore.c @@ -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 * diff --git a/src/libCom/macLib/macLib.h b/src/libCom/macLib/macLib.h index e02b153d2..e1d6878e3 100644 --- a/src/libCom/macLib/macLib.h +++ b/src/libCom/macLib/macLib.h @@ -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 * diff --git a/src/libCom/macLib/macLibREADME b/src/libCom/macLib/macLibREADME index 0979aef4c..ac0598539 100644 --- a/src/libCom/macLib/macLibREADME +++ b/src/libCom/macLib/macLibREADME @@ -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, ); long macPutXxxx( MAC_HANDLE *handle, ); diff --git a/src/libCom/macLibREADME b/src/libCom/macLibREADME index 0979aef4c..ac0598539 100644 --- a/src/libCom/macLibREADME +++ b/src/libCom/macLibREADME @@ -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, ); long macPutXxxx( MAC_HANDLE *handle, );