introduce OUTerrorf() and IFerrorf()

a varargs variant of the older variants OUTerror() and IFerror()
This commit is contained in:
rlar 2014-04-04 19:46:41 +02:00
parent 0182f2f7ca
commit f26c1b71f9
4 changed files with 37 additions and 2 deletions

View File

@ -1285,6 +1285,31 @@ OUTerror(int flags, char *format, IFuid *names)
fflush(cp_err);
}
void
OUTerrorf(int flags, const char *format, ...)
{
struct mesg *m;
va_list args;
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL))
return;
for (m = msgs; m->flag; m++)
if (flags & m->flag)
fprintf(cp_err, "%s: ", m->string);
va_start (args, format);
vfprintf(cp_err, format, args);
fputc('\n', cp_err);
fflush(cp_err);
va_end(args);
}
static int
InterpFileAdd(runDesc *run, IFvalue *refValue, IFvalue *valuePtr)
{

View File

@ -63,6 +63,7 @@ int OUTendDomain(runDesc *plotPtr);
int OUTattributes(runDesc *plotPtr, IFuid varName, int param, IFvalue *value);
int OUTstopnow(void);
void OUTerror(int flags, char *format, IFuid *names);
void OUTerrorf(int, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3)));
#endif

View File

@ -437,7 +437,13 @@ struct IFfrontEnd {
/* should we stop now? */
double (*IFseconds) (void);
/* what time is it? */
int (*IFerror) (int, char *, IFuid *);
void (*IFerror) (int, char *, IFuid *);
/* output an error or warning message */
#ifdef __GNUC__
void (*IFerrorf) (int, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3)));
#else
void (*IFerrorf) (int, const char *fmt, ...);
#endif
/* output an error or warning message */
int (*OUTpBeginPlot) (CKTcircuit *, JOB *,
IFuid,

View File

@ -204,7 +204,9 @@ extern int OUTwBeginPlot(CKTcircuit *,JOB *,IFuid,IFuid,int,int,IFuid *,int,runD
extern int OUTwReference(runDesc *,IFvalue *,void **);
extern int OUTwData(runDesc *,int,IFvalue *,void *), OUTwEnd(runDesc *), OUTendPlot(runDesc *);
extern int OUTbeginDomain(runDesc *,IFuid,int,IFvalue *);
extern int OUTendDomain(runDesc *), OUTstopnow(void), OUTerror(int,char *,IFuid *);
extern int OUTendDomain(runDesc *), OUTstopnow(void);
extern void OUTerror(int,char *,IFuid *);
extern void OUTerrorf(int, const char *fmt, ...) __attribute__ ((format (__printf__, 2, 3)));
extern int OUTattributes(runDesc *,IFuid,int,IFvalue *);
extern void initw(void);
@ -215,6 +217,7 @@ IFfrontEnd nutmeginfo = {
OUTstopnow,
seconds,
OUTerror,
OUTerrorf,
OUTpBeginPlot,
OUTpData,
OUTwBeginPlot,