1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-20 21:08:08 +01:00

removed useless files

This commit is contained in:
kojima
2001-03-11 18:25:47 +00:00
parent f8e94406df
commit e3decb34cb
8 changed files with 1 additions and 1232 deletions

266
src/DI.h
View File

@@ -1,266 +0,0 @@
/*
* DI.h - support for invariants (assertions) using the gdb debugger.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: DI.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _DI_h_
#define _DI_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* DI_LEVEL sets the level of invariant analogously to NDEBUG in assert.h
*
* DI_LEVEL == 2: invariants are always evaluated.
* DI_LEVEL == 1: evaluate invariants iff they have a true GUARD.
* DI_LEVEL == 0: invariants are never evaluated.
*/
#ifndef DI_LEVEL /* define DEFAULT for DI_LEVEL */
#define DI_LEVEL 1
#endif
/*
* DI_DEFAULT_GUARD - the default guard expression; an invariant is checked
* iff the guard is true. By default its always true.
*/
#ifndef DI_DEFAULT_GUARD
#define DI_DEFAULT_GUARD 1
#endif
/*
* DI_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef DI_DEFAULT_PARAMS
#define DI_DEFAULT_PARAMS /* nothing */
#endif
/*
* DI_DEFAULT_HANDLER - called when an error is detected by DI;
*/
#ifndef DI_DEFAULT_HANDLER /* define default handler */
#define DI_DEFAULT_HANDLER(e,f,l,p) \
@@echo e has failed at f:l with p\n@@ \
@@where@@ /* stack backtrace */
#endif /* DI_DEFAULT_HANDLER */
/*
* DI_MAKE_VALID_BREAKPOINT(e) - called whenever we generate a DI breakpoint;
* the aim is to make sure a breakpoint can be set at the current location
* and that any expressions will be evaluated by gdb correctly.
* This is the portable default; an architecture specific version
* is generated by the configure script into nana-config.h
*/
#ifndef DI_MAKE_VALID_BREAKPOINT
static volatile int _di_target;
#define DI_MAKE_VALID_BREAKPOINT(e) _di_target = 0
#endif
/*
* _DIGHPS - implements the DI macros, it comes in two variants:
*
* ifdefined(_NANA_FILTER_) then we are generating debugger commands
* else generating C text.
*/
#if DI_LEVEL == 2 /* always check the assertion */
#ifdef _NANA_FILTER_
#define _DIGHPS(e,g,h,p,s) \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum (!(e))@@ \
@@command $bpnum@@ \
@@silent@@ \
h(s,f,l,p) \
@@end@@
#else
#define _DIGHPS(e,g,h,p,s) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 1 /* check it iff g is true */
#ifdef _NANA_FILTER_
#define _DIGHPS(e,g,h,p,s) \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum (g) && (!(e))@@ \
@@command $bpnum@@ \
@@silent@@ \
h(s,f,l,p) \
@@end@@
#else
#define _DIGHPS(e,g,h,p,s) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 0 /* no assertions so just remove them */
#define _DIGHPS(e,g,h,p,s) /* nothing */
#endif /* DI_LEVEL */
/*
* DSG(e,g), DS(e) - are used to set variables in the debugger from
* within C programs. These convenience variables can then be
* used in invariants later on to refer to the previous state
* of the program.
*
* DS($x = x); ....; DI($x + 10 == x);
*/
#if DI_LEVEL == 2
#ifdef _NANA_FILTER_
#define DSG(e,g) \
@@break @__FILE__:__LINE__@@ \
@@command@@ \
@@silent@@ \
@@set e@@ \
@@cont@@ \
@@end@@
#else
#define DSG(e,g) DI_MAKE_VALID_BREAKPOINT(e)
#endif
#elif DI_LEVEL == 1
#ifdef _NANA_FILTER_
#define DSG(e,g) \
@@break @__FILE__:__LINE__ if g@@ \
@@command@@ \
@@silent@@ \
@@set e@@ \
@@cont@@ \
@@end@@
#else
#define DSG(e,g) DI_MAKE_VALID_BREAKPOINT(e)
#endif /* _NANA_FILTER_ */
#elif DI_LEVEL == 0
#define DSG(e,g) /* nothing */
#else
error DI_LEVEL should be 0 or 1 or 2
#endif
#define DS(e) DSG(e,DI_DEFAULT_GUARD)
/*
* And all the user macros; these are used to put in the default arguments.
* The name is used to determine the arguments; e.g. DIGH takes an expression
* to check; a guard and a handler as parameters. The letters in the names
* are in ascending order (i.e. DIGH(...) not DIHG(...)).
*
* DI[G][H][P] - it must be true (e) with an optional guard, handler and
* parameter for the handler.
* DN[G][H][P] - as for DI... except that (e) must never ever be true.
*/
#define DI(e) \
_DIGHPS(e,DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIG(e,g) \
_DIGHPS(e,g,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIH(e,h) \
_DIGHPS(e,DI_DEFAULT_GUARD,h,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIP(e,p) \
_DIGHPS(e,DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,p,"DI("#e")")
#define DIGH(e,g,h) \
_DIGHPS(e,g,h,DI_DEFAULT_PARAMS,"DI("#e")")
#define DIGP(e,g,p) \
_DIGHPS(e,g,DI_DEFAULT_HANDLER,p,"DI("#e")")
#define DIHP(e,h,p) \
_DIGHPS(e,DI_DEFAULT_GUARD,h,p,"DI("#e")")
#define DIGHP(e,g,h,p) \
_DIGHPS(e,g,h,p,"DI("#e")")
#define DN(e) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNG(e,g) \
_DIGHPS((!(e)),g,DI_DEFAULT_HANDLER,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNH(e,h) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,h,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNP(e,p) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,DI_DEFAULT_HANDLER,p,"DN("#e")")
#define DNGH(e,g,h) \
_DIGHPS((!(e)),g,h,DI_DEFAULT_PARAMS,"DN("#e")")
#define DNGP(e,g,p) \
_DIGHPS((!(e)),g,DI_DEFAULT_HANDLER,p,"DN("#e")")
#define DNHP(e,h,p) \
_DIGHPS((!(e)),DI_DEFAULT_GUARD,h,p,"DN("#e")")
#define DNGHP(e,g,h,p) \
_DIGHPS((!(e)),g,h,p,"DN("#e")")
#else /* defined(WITHOUT_NANA) */
#define DI(e) /* empty */
#define DIG(e,g) /* empty */
#define DIH(e,h) /* empty */
#define DIP(e,p) /* empty */
#define DIGH(e,g,h) /* empty */
#define DIGP(e,g,p) /* empty */
#define DIHP(e,h,p) /* empty */
#define DIGHP(e,g,h,p) /* empty */
#define DN(e) /* empty */
#define DNG(e,g) /* empty */
#define DNH(e,h) /* empty */
#define DNP(e,p) /* empty */
#define DNGH(e,g,h) /* empty */
#define DNGP(e,g,p) /* empty */
#define DNHP(e,h,p) /* empty */
#define DNGHP(e,g,h,p) /* empty */
#define DS(e) /* empty */
#define DSG(e,g) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _DI_h_ */

227
src/DL.h
View File

@@ -1,227 +0,0 @@
/*
* DL.h - support for logging (printf...) style debugging using gdb.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: DL.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _DL_h_
#define _DL_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* DL_MAKE_VALID_BREAKPOINT() - used to make sure that we can put a
* breakpoint at this location. We default to a portable C expression
* which simply does an assignment. The configure script may override
* this (on an architecture basis) and replace it with something
* like asm("nop");
*/
#ifndef DL_MAKE_VALID_BREAKPOINT
static volatile int _dl_target;
#define DL_MAKE_VALID_BREAKPOINT() _dl_target = 0
#endif
/*
* DL_LEVEL sets the level of logging analogously to NDEBUG in assert.h
*
* DL_LEVEL == 2: always print.
* DL_LEVEL == 1: print iff the guard is true.
* DL_LEVEL == 0: never print.
*/
#ifndef DL_LEVEL /* define DEFAULT for DL_LEVEL */
#define DL_LEVEL 1
#endif
/*
* DL_DEFAULT_HANDLER - the default print handler; by default we just
* the debugger printf.
*
* @@call (void) printf(f)@@
*/
#ifndef DL_DEFAULT_HANDLER /* define default handler */
#define DL_DEFAULT_HANDLER(g,h,p,f...) @@printf f@@
#endif /* DL_DEFAULT_HANDLER */
/*
* DL_DEFAULT_GUARD - the default guard expression; a message is printed
* iff the guard is true. By default its always true.
*/
#ifndef DL_DEFAULT_GUARD
#define DL_DEFAULT_GUARD (1)
#endif
/*
* DL_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef DL_DEFAULT_PARAMS
#define DL_DEFAULT_PARAMS stderr
#endif
/*
* DL_SHOW_TIME - if its defined then each message gets a timestamp in front.
*/
#ifdef DL_SHOW_TIME
unsigned long _L_gettime(void); /* returns the current time */
#define _DL_SHOWTIME(h,p) @@call (void) h (p, "%-8ld ", _L_gettime())@@
#else
#define _DL_SHOWTIME(h,p) /* nothing */
#endif /* DL_SHOWTIME */
/*
* DLGHP(g,h,p,f...) - print a log message.
*
* g - the guard; print the message iff this is true
* h - the handler function that does the actual printing
* p - a parameter for the handler function; e.g. a file descriptor.
* f - the format and the data...
*/
#if DL_LEVEL == 2 /* always log the message */
#ifdef _NANA_FILTER_
#define DLGHP(g,h,p,f...) \
do { \
@@break @__FILE__:__LINE__@@ \
@@command $bpnum@@ \
@@silent@@ \
_DL_SHOWTIME(h,p); \
DL_DEFAULT_HANDLER(g,h,p,##f); \
@@cont@@ \
@@end@@ \
} while(0)
#else
#define DLGHP(g,h,p,f...) DL_MAKE_VALID_BREAKPOINT()
#endif
#elif DL_LEVEL == 1 /* log it iff the guard is true */
#ifdef _NANA_FILTER_
#define DLGHP(g,h,p,f...) \
do { \
if(g) { \
@@break @__FILE__:__LINE__@@ \
@@condition $bpnum g@@ \
@@command $bpnum@@ \
@@silent@@ \
_DL_SHOWTIME(h,p); \
DL_DEFAULT_HANDLER(g,h,p,##f); \
@@cont@@ \
@@end@@ \
} \
} while(0)
#else
#define DLGHP(g,h,p,f...) DL_MAKE_VALID_BREAKPOINT()
#endif
#elif DL_LEVEL == 0 /* no logging so ignore them */
#define DLGHP(g,h,p,f...) /* nothing */
#endif /* DL_LEVEL */
/*
* And the user routines.
*/
#define DL(f...) \
DLGHP(DL_DEFAULT_GUARD,DL_DEFAULT_HANDLER,DL_DEFAULT_PARAMS,##f)
#define DLG(g,f...) \
DLGHP(g,DL_DEFAULT_HANDLER,DL_DEFAULT_PARAMS,##f)
#define DLH(h,f...) \
DLGHP(DL_DEFAULT_GUARD,h,DL_DEFAULT_PARAMS,##f)
#define DLP(p,f...) \
DLGHP(DL_DEFAULT_GUARD,DL_DEFAULT_HANDLER,p,##f)
#define DLGP(g,p,f...) \
DLGHP(g,DL_DEFAULT_HANDLER,p,##f)
#define DLHP(h,p,f...) \
DLGHP(DL_DEFAULT_GUARD,h,p,##f)
/*
* V* - since the DL* macros take a variable numbers of arguments we
* have problems compiling calls to L with C preprocessors other
* than GNU cccp. The V* macros are called using a bracketed arglist, e.g.
* VDL((s,x,y))
*
* if we are compiling with GNU C then they simply call the normal
* varargs macros. if we are not using GNU C then they map to empty.
*/
#define VDL(a) DL a
#define VDLG(a) DLG a
#define VDLH(a) DLH a
#define VDLP(a) DLP a
#define VDLGP(a) DLGP a
#define VDLHP(a) DLHP a
#define VDLGHP(a) DLGHP a
#else /* defined(WITHOUT_NANA) */
#define VDL(a) /* empty */
#define VDLG(a) /* empty */
#define VDLH(a) /* empty */
#define VDLP(a) /* empty */
#define VDLGP(a) /* empty */
#define VDLHP(a) /* empty */
#define VDLGHP(a) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _DL_h_ */

View File

@@ -1,90 +0,0 @@
/*
* GDB.h - basic support macros for putting gdb commands in C.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: GDB.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _GDB_h_
#define _GDB_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* GDB(c) - just puts the command into the output of nana
* c should be a single line of text
*/
#ifdef _NANA_FILTER_
#define GDB(command) @@command@@
#else
#define GDB(command) /* nothing */
#endif
/*
* GDBCALL(c) - calls a gdb command whenever control reaches the
* current line.
*/
#ifdef _NANA_FILTER_
#define GDBCALL(comd) \
@@break @__FILE__:__LINE__@@ \
@@command@@ \
@@silent@@ \
@@comd@@ \
@@cont@@ \
@@end@@
#else
#define GDBCALL(c) DI_MAKE_VALID_BREAKPOINT(1)
#endif
#else /* defined(WITHOUT_NANA) */
#define GDB(e) /* empty */
#define GDBCALL(e) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _GDB_h_ */

234
src/I.h
View File

@@ -1,234 +0,0 @@
/*
* I.h - support for invariants (assertions) using C code.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: I.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _I_h_
#define _I_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* I_LEVEL sets the level of invariant analogously to NDEBUG in assert.h
*
* I_LEVEL == 2: invariants are always evaluated.
* I_LEVEL == 1: evaluate invariants iff they have a true GUARD.
* I_LEVEL == 0: invariants are never evaluated.
*/
#ifndef I_LEVEL /* define DEFAULT for I_LEVEL */
#define I_LEVEL 1
#endif
/*
* I_DEFAULT_GUARD - the default guard expression; an invariant is checked
* iff the guard is true. By default its always true.
*/
#ifndef I_DEFAULT_GUARD
#define I_DEFAULT_GUARD (1)
#endif
/*
* I_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef I_DEFAULT_PARAMS
#define I_DEFAULT_PARAMS /* nothing */
#endif
/*
* I_DEFAULT_HANDLER(expr,file,line,param) - called when an error is detected.
*/
#ifndef I_DEFAULT_HANDLER /* define default handler */
void _I_default_handler(char *expr, char *file, int line);
#define I_DEFAULT_HANDLER(expr,file,line,param) \
_I_default_handler(expr,__FILE__,__LINE__)
#endif /* I_DEFAULT_HANDLER */
/*
* _IGHPS(e,g,h,p,s) - implements the general case for invariant handling.
*
* e - expression to check
* g - guard, check only if this is true (subject to I_DEFAULT_LEVEL)
* h - handler, called when a failure is detected
* p - parameter to pass off to the handler
* s - string representation of the expression (e.g. "I(x>=i)")
*
* _ISD(e) - generates a data declaration for use in postconditions
* _ISG(e,g) - generates a guarded assignment to a data declaration
* for use in postconditions
*
* N.B. The two types are necessary since we cannot guard a C declaration
* with an if statement.
*/
#if I_LEVEL == 2 /* always check the assertion */
#define _IGHPS(e,g,h,p,s) \
do { \
if(!(e)) { \
h (s, __FILE__, __LINE__, p); \
} \
} while(0)
#define _ID(e) e
#define _ISG(e,g) e
#elif I_LEVEL == 1 /* check it iff g is true */
#define _IGHPS(e,g,h,p,s) \
do { \
if(g) { \
if(!(e)) { \
h (s, __FILE__, __LINE__, p); \
} \
} \
} while(0)
#define _ID(e) e
#define _ISG(e,g) \
do { \
if(g) { \
e; \
} \
} while(0)
#elif I_LEVEL == 0 /* no assertions so just remove them */
#define _IGHPS(e,g,h,p,s) /* nothing */
#define _ID(e) /* nothing */
#define _ISG(e,g) /* nothing */
#endif /* I_LEVEL */
/*
* And all the user macros; these are used to put in the default arguments.
* The name is used to determine the arguments; e.g. IGH takes an expression
* to check; a guard and a handler as parameters. The letters in the names
* are in ascending order (i.e. IGH(...) not IHG(...)).
*
* I[G][H][P] - it must be true (e) with an optional guard, handler and
* parameter for the handler.
* N[G][H][P] - as for I... except that (e) must never ever be true.
*/
#define I(e) \
_IGHPS(e,I_DEFAULT_GUARD,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"I("#e")")
#define IG(e,g) \
_IGHPS(e,g,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"I("#e")")
#define IH(e,h) \
_IGHPS(e,I_DEFAULT_GUARD,h,I_DEFAULT_PARAMS,"I("#e")")
#define IP(e,p) \
_IGHPS(e,I_DEFAULT_GUARD,I_DEFAULT_HANDLER,p,"I("#e")")
#define IGH(e,g,h) \
_IGHPS(e,g,h,I_DEFAULT_PARAMS,"I("#e")")
#define IGP(e,g,p) \
_IGHPS(e,g,I_DEFAULT_HANDLER,p,"I("#e")")
#define IHP(e,h,p) \
_IGHPS(e,I_DEFAULT_GUARD,h,p,"I("#e")")
#define IGHP(e,g,h,p) \
_IGHPS(e,g,h,p,"I("#e")")
#define N(e) \
_IGHPS((!(e)),I_DEFAULT_GUARD,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"N("#e")")
#define NG(e,g) \
_IGHPS((!(e)),g,I_DEFAULT_HANDLER,I_DEFAULT_PARAMS,"N("#e")")
#define NH(e,h) \
_IGHPS((!(e)),I_DEFAULT_GUARD,h,I_DEFAULT_PARAMS,"N("#e")")
#define NP(e,p) \
_IGHPS((!(e)),I_DEFAULT_GUARD,I_DEFAULT_HANDLER,p,"N("#e")")
#define NGH(e,g,h) \
_IGHPS((!(e)),g,h,I_DEFAULT_PARAMS,"N("#e")")
#define NGP(e,g,p) \
_IGHPS((!(e)),g,I_DEFAULT_HANDLER,p,"N("#e")")
#define NHP(e,h,p) \
_IGHPS((!(e)),I_DEFAULT_GUARD,h,p,"N("#e")")
#define NGHP(e,g,h,p) \
_IGHPS((!(e)),g,h,p,"N("#e")")
/*
* ID(e) - declares a variable to be used to store values for a postcondition.
* This can include an initialiser.
* Note this declaration is not disabled by I_DEFAULT_GUARD
* IS(e) - an assignment to a variable. This statement is enabled by
* I_DEFAULT_GUARD
* ISG(e,g) - the guarded version of IS
*/
#define ID(e) _ID(e)
#define IS(e) _ISG(e,I_DEFAULT_GUARD)
#define ISG(e,g) _ISG(e,g)
#else /* defined(WITHOUT_NANA) */
#define I(e) /* empty */
#define IG(e,g) /* empty */
#define IH(e,h) /* empty */
#define IP(e,p) /* empty */
#define IGH(e,g,h) /* empty */
#define IGP(e,g,p) /* empty */
#define IHP(e,h,p) /* empty */
#define IGHP(e,g,h,p) /* empty */
#define N(e) /* empty */
#define NG(e,g) /* empty */
#define NH(e,h) /* empty */
#define NP(e,p) /* empty */
#define NGH(e,g,h) /* empty */
#define NGP(e,g,p) /* empty */
#define NHP(e,h,p) /* empty */
#define NGHP(e,g,h,p) /* empty */
#define ID(e) /* empty */
#define IS(e) /* empty */
#define ISG(e,g) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _I_h_ */

207
src/L.h
View File

@@ -1,207 +0,0 @@
/*
* L.h - support for logging (printf...) style debugging.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: L.h,v 1.2 1998/01/17 10:57:03 pjm Exp
*/
#ifndef _L_h_
#define _L_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
/*
* nana-config.h - the system wide configuration file; we put the ifndef
* around it to avoid the file 5 million times during a compile.
*/
#ifndef _nana_config_h_
#include <nana-config.h>
#endif
/*
* L_LEVEL sets the level of logging analogously to NDEBUG in assert.h
*
* L_LEVEL == 2: always print.
* L_LEVEL == 1: print iff the guard is true.
* L_LEVEL == 0: never print.
*/
#ifndef L_LEVEL /* define DEFAULT for L_LEVEL */
#define L_LEVEL 1
#endif
/*
* L_DEFAULT_HANDLER - the default print handler; by default we just
* use fprintf.
*/
#ifndef L_DEFAULT_HANDLER /* define default handler */
#define L_DEFAULT_HANDLER fprintf
#endif /* L_DEFAULT_HANDLER */
/*
* L_DEFAULT_GUARD - the default guard expression; a message is printed
* iff the guard is true. By default its always true.
*/
#ifndef L_DEFAULT_GUARD
#define L_DEFAULT_GUARD (1)
#endif
/*
* L_DEFAULT_PARAMS - the default value to be passed as the second argument
* to the handler macro when an invariant fails.
*/
#ifndef L_DEFAULT_PARAMS
#define L_DEFAULT_PARAMS stderr
#endif
/*
* L_SHOW_TIME_FORMAT - the format string for printing the time.
*/
#ifndef L_SHOW_TIME_FORMAT
#define L_SHOW_TIME_FORMAT "%.6f:\t"
#endif
/*
* L_SHOW_TIME_NOW - the function to measure the time.
*/
#ifndef L_SHOW_TIME_NOW
#include <now.h>
#define L_SHOW_TIME_NOW now()
#endif
/*
* L_SHOW_TIME - if it is defined then we will put time stamps at the
* beginning of each message using L_SHOW_TIME_FORMAT and L_SHOW_TIME_NOW.
*/
#ifdef L_SHOW_TIME
#define _L_SHOWTIME(h,p) h (p, L_SHOW_TIME_FORMAT, L_SHOW_TIME_NOW)
#else
#define _L_SHOWTIME(h,p) /* nothing */
#endif /* L_SHOWTIME */
/*
* LGHP(g,h,p, f...) - print a log message.
*
* g - the guard; print the message iff this is true
* h - the handler function that does the actual printing
* p - a parameter for the handler function; e.g. a file descriptor.
* f - printf style format string; we put this at the end since we
* we need to be able have 1 or more arguments (e.g. L("x") and
* L("%d",10); we use GNU cccp preprocessor varargs extension
* to handle multiple arguments.
*/
#ifndef __GNUC__
error you need gcc for this stuff to work properly
#endif
#if L_LEVEL == 2 /* always log the message */
#define LGHP(g,h,p,f...) \
do { \
_L_SHOWTIME(h,p); \
h (p, ##f); \
} while(0)
#elif L_LEVEL == 1 /* log it iff the guard is true */
#define LGHP(g,h,p,f...) \
do { \
if(g) { \
_L_SHOWTIME(h,p); \
h (p, ##f); \
} \
} while(0)
#elif L_LEVEL == 0 /* no logging so ignore them */
#define LGHP(g,h,p,f...) /* nothing */
#endif /* L_LEVEL */
/*
* User routines.
*/
#define L(f...) \
LGHP(L_DEFAULT_GUARD,L_DEFAULT_HANDLER,L_DEFAULT_PARAMS,##f)
#define LG(g,f...) \
LGHP(g,L_DEFAULT_HANDLER,L_DEFAULT_PARAMS,##f)
#define LH(h,f...) \
LGHP(L_DEFAULT_GUARD,h,L_DEFAULT_PARAMS,##f)
#define LP(p,f...) \
LGHP(L_DEFAULT_GUARD,L_DEFAULT_HANDLER,p,##f)
#define LGP(g,p,f...) \
LGHP(g,L_DEFAULT_HANDLER,p,##f)
#define LHP(h,p,f...) \
LGHP(L_DEFAULT_GUARD,h,p,##f)
/*
* V* - since the L* macros take a variable numbers of arguments we
* have problems compiling calls to L with C preprocessors other
* than GNU cccp. The V* macros are called using a bracketed
* argument list, e.g. VL((f,x,s));
*
* if we are compiling with GNU C then they simpily call the normal
* varargs macro. if we are not using GNU CC then they map to empty.
*/
#define VL(a) L a
#define VLG(a) LG a
#define VLH(a) LH a
#define VLP(a) LP a
#define VLGP(a) LGP a
#define VLHP(a) LHP a
#define VLGHP(a) LGHP a
#else /* defined(WITHOUT_NANA) */
#define VL(a) /* empty */
#define VLG(a) /* empty */
#define VLH(a) /* empty */
#define VLP(a) /* empty */
#define VLGP(a) /* empty */
#define VLHP(a) /* empty */
#define VLGHP(a) /* empty */
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _L_h_ */

View File

@@ -4,8 +4,7 @@ BUILT_SOURCES = wconfig.h
bin_PROGRAMS = wmaker bin_PROGRAMS = wmaker
EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h\ EXTRA_DIST = wmnotify.c wmnotdef.h wmnotify.h
DI.h DL.h I.h L.h Q.h GDB.h nana.h
wmaker_SOURCES = \ wmaker_SOURCES = \

160
src/Q.h
View File

@@ -1,160 +0,0 @@
/*
* Q.h - support for ForAll, ThereExists, Count and Sum (i.e. quantifiers).
*
* Portability: this file uses the GNU C Statement Expression extension and
* so requires GCC/C++ with extensions enabled (this is checked by the
* header file).
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: Q.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _Q_h_
#define _Q_h_ 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WITHOUT_NANA
#ifndef __GNUC__ /* not compiling with GCC/G++ extensions */
error
This file requires the GNU C/C++ "statement expression" extension;
so use GCC/G++ with extensions enabled. If you have not got GCC then
misery follows though we may be able to do something about it
in the future.
#endif
/*
* A(i,c,n,a) - true iff a is true for all values generated by for(i;c;n)
*
* Note: local variables can be introduced in this statement even in C.
*/
#define A(i,c,n,a) /* ForAll */ \
({ \
int _A_result = 1; \
i; \
while(c) { \
if(!(a)) { \
_A_result = 0; \
break; \
} \
n; \
} \
_A_result; \
})
/*
* E(i,c,n,a) - true iff exists any true a for values generated by for(i;c;n)
*/
#define E(i,c,n,a) /* Exists */ \
({ \
int _E_result = 0; \
i; \
while(c) { \
if(a) { \
_E_result = 1; \
break; \
} \
n; \
} \
_E_result; \
})
/*
* C(i,c,n,a) - count the number of times a is true over the values
* generated by for(i;c;n)
*/
#define C(i,c,n,a) /* Count */ \
({ \
long _C_result = 0; \
i; \
while(c) { \
if(a) { \
_C_result++; \
} \
n; \
} \
_C_result; \
})
/*
* E1(i,c,n,a) - exists a single value generated by for(i;c;n)
* suchthat i is true.
*/
#define E1(i,c,n,a) (C(i,c,n,a) == 1) /* There Exists 1 */
/*
* S(i,c,n,v) - sum of v over the values generated by for(i;c;n)
*/
#define S(i,c,n,v) \
({ \
i; \
typeof(v) _S_result = 0; \
while(c) { \
_S_result += (v); \
n; \
} \
_S_result; \
})
/*
* P(i,c,n,v) - product of v over the values generated by for(i;c;n)
*/
#define P(i,c,n,v) \
({ \
i; \
typeof(v) _P_result = 1; \
while(c) { \
_P_result *= (v); \
n; \
} \
_P_result; \
})
#else /* defined(WITHOUT_NANA) */
/*
* we don't produce any empty stubs for Q.h when compiling without nana
* since calls to A(...), etc should only occur in stubbed out code such
* as I(...).
*/
#endif /* !defined(WITHOUT_NANA) */
#ifdef __cplusplus
}
#endif
#endif /* _Q_h_ */

View File

@@ -1,46 +0,0 @@
/*
* nana.h - the include that includes everything else.
*
* Copyright (c) 1997 Phil Maker
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Id: nana.h,v 1.1.1.1 1997/11/23 11:45:50 pjm Exp
*/
#ifndef _nana_h_
#define _nana_h_ 1
#include <I.h>
#include <DI.h>
#include <L.h>
#include <DL.h>
#include <Q.h>
#include <GDB.h>
#endif /* _nana_h_ */