The base (or foundation) header for MALOC.
More...
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <setjmp.h>
Go to the source code of this file.
|
#define | CLOCKS_PER_SEC 60 |
| Fix to broken <time.h> on old SunOS.
|
|
#define | __FAVOR_BSD |
| Linux: uses sigsetjmp as the setjmp function.
|
|
#define | _BSD_SIGNALS |
| IRIX: uses sigsetjmp as the setjmp function.
|
|
#define | VCC |
| Setup so this include file (and subsequent) will work for both C and C++.
|
|
#define | extern |
| Setup so this include file (and subsequent) will work for both C and C++.
|
|
#define | VPRIVATE static |
| Mimic C++ "Private" type modifier.
|
|
#define | VPUBLIC /*empty*/ |
| Mimic C++ "Public" type modifier
|
|
#define | VWARN1(file, lineno) |
| Slick assertion macro.
|
|
#define | VASSERT1(file, lineno) |
| Slick assertion macro.
|
|
#define | VASSERT2(file, lineno) |
| Slick assertion macro.
|
|
#define | VASSERT3(file, lineno, ex) |
| Slick assertion macro.
|
|
#define | VWARN(ex) |
| Slick assertion macro.
|
|
#define | VASSERT(ex) |
| Slick assertion macro.
|
|
#define | VJMPERR0(x) |
| A userful error handling macro.
|
|
#define | VJMPERR1(x) |
| A userful error handling macro.
|
|
#define | VJMPERR2(x) |
| A userful error handling macro.
|
|
#define | VJMPERR3(x) |
| A userful error handling macro.
|
|
#define | VJMPERR4(x) |
| A userful error handling macro.
|
|
#define | VJMPERR5(x) |
| A userful error handling macro.
|
|
#define | VJMPERR6(x) |
| A userful error handling macro.
|
|
#define | VJMPERR7(x) |
| A userful error handling macro.
|
|
#define | VJMPERR8(x) |
| A userful error handling macro.
|
|
#define | VJMPERR9(x) |
| A userful error handling macro.
|
|
#define | VPI 3.14159265358979323846 |
| Global constant.
|
|
#define | VLARGE 1.0e+9 |
| Global constant. 1e9 just fits into 32-bit signed int.
|
|
#define | VSMALL 1.0e-9 |
| Global constant.
|
|
#define | VVLARGE 1.0e+15 |
| Global constant.
|
|
#define | VVSMALL 1.0e-15 |
| Global constant.
|
|
#define | VPRTKEY 10000 |
| Global constant.
|
|
#define | VPTRSIZE 4 |
| Global constant.
|
|
#define | VMAX_ARGNUM 50 |
| Global constant.
|
|
#define | VMAX_ARGLEN 1024 |
| Global constant.
|
|
#define | VMAX_BUFSIZE 8192 |
| Global constant.
|
|
#define | VMAX_OBJECTS 1073741824 /* (1<<31) = 2^31 */ |
| Global constant.
|
|
#define | VBLOCK_POWER 14 |
| Global constant.
|
|
#define | VNULL NULL |
| Global constant.
|
|
#define | VINULL -1 |
| Global constant.
|
|
#define | VTRUE 1 |
| Global constant.
|
|
#define | VFALSE 0 |
| Global constant.
|
|
#define | VSTDMODE 0600 |
| Global constant.
|
|
#define | VNULL_STRING "\0" |
| Global constant.
|
|
#define | VBLANK_STRING " " |
| Global constant.
|
|
#define | VNEWLINE_STRING "\n" |
| Global constant.
|
|
#define | VNULL_SYMBOL '\0' |
| Global constant.
|
|
#define | VBLANK_SYMBOL ' ' |
| Global constant.
|
|
#define | VNEWLINE_SYMBOL '\n' |
| Global constant.
|
|
#define | VRDIN_SYMBOL '<' |
| Global constant.
|
|
#define | VRDOUT_SYMBOL '>' |
| Global constant.
|
|
#define | VPIPE_SYMBOL '|' |
| Global constant.
|
|
#define | VDELIM_SET " ><|&" |
| Global constant.
|
|
#define | VABS(x) |
| Mathematical macro.
|
|
#define | VMIN2(x, y) |
| Mathematical macro.
|
|
#define | VMAX2(x, y) |
| Mathematical macro.
|
|
#define | VSIGN(x, y) |
| Mathematical macro.
|
|
#define | VODD(x) |
| Mathematical macro.
|
|
#define | VEVEN(x) |
| Mathematical macro.
|
|
#define | VZERO(x) |
| Mathematical macro.
|
|
#define | VPOS(x) |
| Mathematical macro.
|
|
#define | VNEG(x) |
| Mathematical macro.
|
|
#define | VEVENP(x) |
| Mathematical macro.
|
|
#define | VEVENN(x) |
| Mathematical macro.
|
|
#define | VSQRT(x) |
| Mathematical macro.
|
|
#define | VSQR(x) |
| Mathematical macro.
|
|
#define | VSIN(x) |
| Mathematical macro.
|
|
#define | VCOS(x) |
| Mathematical macro.
|
|
#define | VTAN(x) |
| Mathematical macro.
|
|
#define | VASIN(x) |
| Mathematical macro.
|
|
#define | VACOS(x) |
| Mathematical macro.
|
|
#define | VATAN(x) |
| Mathematical macro.
|
|
#define | VSINH(x) |
| Mathematical macro.
|
|
#define | VCOSH(x) |
| Mathematical macro.
|
|
#define | VTANH(x) |
| Mathematical macro.
|
|
#define | VEXP(x) |
| Mathematical macro.
|
|
#define | VLOG(x) |
| Mathematical macro.
|
|
#define | VPOW(x, y) |
| Mathematical macro.
|
|
#define | VRINT(x) |
| Mathematical macro.
|
|
#define | VRAND (rand()) |
| Mathematical macro.
|
|
#define | VRANDMAX (RAND_MAX) |
| Mathematical macro.
|
|
#define | VINLINE_MALOC |
| Inlining via macros for speed.
|
|
The base (or foundation) header for MALOC.
- Author
- Michael Holst
- Note
- This header sets things up correctly for using ISO/ANSI-C. The following macros affect the behavior of the header:
Inlining for speed: (Normal C functions if VINLINE_XXX not defined.)
------------------
-DVINLINE_VNM : Enables macro replacement of time-critical funcs in VNM.
- Version
- Id
- maloc_base.h,v 1.33 2010/08/12 05:40:16 fetk Exp
- Attention
*
* MALOC = < Minimal Abstraction Layer for Object-oriented C >
* Copyright (C) 1994-- Michael Holst
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
◆ __FAVOR_BSD
Linux: uses sigsetjmp as the setjmp function.
- Note
* Problems using setjmp/longjmp for use in the MC-shell.
*
* Problem: Some implementations of ISO-C "setjmp/longjmp" do not return
* the interrupt mask to its pre-jump state after returning.
* The behavior this produces is for example you can capture a
* single CTRL-C, but that is it; the mask for CTRL-C is wiped
* after the first interrupt is handled.
*
* Solution: Use the "sigsetjmp/siglongjmp" extensions provided by most
* UNIX variants. You just have to set an appropriate macro
* before including <setjmp.h> to get sigsetjmp rather than
* setjmp behavior.
*
* Notes: You can run into trouble (e.g. some versions of Linux) if
* you set some of these special signal macros before some of
* the other ISO-C headers. Therefore, we only set the macros
* just before including <setjmp.h> as the final ISO-C header.
*
◆ _BSD_SIGNALS
IRIX: uses sigsetjmp as the setjmp function.
- Note
* Problems using setjmp/longjmp for use in the MC-shell.
*
* Problem: Some implementations of ISO-C "setjmp/longjmp" do not return
* the interrupt mask to its pre-jump state after returning.
* The behavior this produces is for example you can capture a
* single CTRL-C, but that is it; the mask for CTRL-C is wiped
* after the first interrupt is handled.
*
* Solution: Use the "sigsetjmp/siglongjmp" extensions provided by most
* UNIX variants. You just have to set an appropriate macro
* before including <setjmp.h> to get sigsetjmp rather than
* setjmp behavior.
*
* Notes: You can run into trouble (e.g. some versions of Linux) if
* you set some of these special signal macros before some of
* the other ISO-C headers. Therefore, we only set the macros
* just before including <setjmp.h> as the final ISO-C header.
*
◆ CLOCKS_PER_SEC
#define CLOCKS_PER_SEC 60 |
Fix to broken <time.h> on old SunOS.
◆ extern
Setup so this include file (and subsequent) will work for both C and C++.
◆ VABS
Value:
Mathematical macro.
◆ VACOS
Value:
Mathematical macro.
◆ VASIN
Value:
Mathematical macro.
◆ VASSERT
Value:((void) ((ex) ? 0 :
VASSERT3(__FILE__, __LINE__, ex)))
#define VASSERT3(file, lineno, ex)
Slick assertion macro.
Definition maloc_base.h:174
Slick assertion macro.
◆ VASSERT1
#define VASSERT1 |
( |
| file, |
|
|
| lineno ) |
Value:(fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), exit(1), 0)
Slick assertion macro.
◆ VASSERT2
#define VASSERT2 |
( |
| file, |
|
|
| lineno ) |
Value:(fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), abort(), 0)
Slick assertion macro.
◆ VASSERT3
#define VASSERT3 |
( |
| file, |
|
|
| lineno, |
|
|
| ex ) |
Value:(fprintf(stderr,"VASSERT: ASSERTION FAILURE! filename %s, line %u, (%s)\n", (file), (lineno), (#ex)), abort(), 0)
Slick assertion macro.
◆ VATAN
Value:
Mathematical macro.
◆ VBLANK_STRING
#define VBLANK_STRING " " |
◆ VBLANK_SYMBOL
#define VBLANK_SYMBOL ' ' |
◆ VBLOCK_POWER
◆ VCC
Setup so this include file (and subsequent) will work for both C and C++.
◆ VCOS
Value:
Mathematical macro.
◆ VCOSH
Value:
Mathematical macro.
◆ VDELIM_SET
#define VDELIM_SET " ><|&" |
◆ VEVEN
Value:
Mathematical macro.
◆ VEVENN
Value:
#define VEVEN(x)
Mathematical macro.
Definition maloc_base.h:287
#define VNEG(x)
Mathematical macro.
Definition maloc_base.h:293
Mathematical macro.
◆ VEVENP
Value:
#define VPOS(x)
Mathematical macro.
Definition maloc_base.h:291
Mathematical macro.
◆ VEXP
Value:
Mathematical macro.
◆ VFALSE
◆ VINLINE_MALOC
Inlining via macros for speed.
◆ VINULL
◆ VJMPERR0
Value:
A userful error handling macro.
◆ VJMPERR1
Value:
A userful error handling macro.
◆ VJMPERR2
Value:
A userful error handling macro.
◆ VJMPERR3
Value:
A userful error handling macro.
◆ VJMPERR4
Value:
A userful error handling macro.
◆ VJMPERR5
Value:
A userful error handling macro.
◆ VJMPERR6
Value:
A userful error handling macro.
◆ VJMPERR7
Value:
A userful error handling macro.
◆ VJMPERR8
Value:
A userful error handling macro.
◆ VJMPERR9
Value:
A userful error handling macro.
◆ VLARGE
Global constant. 1e9 just fits into 32-bit signed int.
◆ VLOG
Value:
Mathematical macro.
◆ VMAX2
Value:
Mathematical macro.
◆ VMAX_ARGLEN
◆ VMAX_ARGNUM
◆ VMAX_BUFSIZE
#define VMAX_BUFSIZE 8192 |
◆ VMAX_OBJECTS
#define VMAX_OBJECTS 1073741824 /* (1<<31) = 2^31 */ |
◆ VMIN2
Value:
Mathematical macro.
◆ VNEG
Value:
Mathematical macro.
◆ VNEWLINE_STRING
#define VNEWLINE_STRING "\n" |
◆ VNEWLINE_SYMBOL
#define VNEWLINE_SYMBOL '\n' |
◆ VNULL
◆ VNULL_STRING
#define VNULL_STRING "\0" |
◆ VNULL_SYMBOL
#define VNULL_SYMBOL '\0' |
◆ VODD
Value:
Mathematical macro.
◆ VPI
#define VPI 3.14159265358979323846 |
◆ VPIPE_SYMBOL
◆ VPOS
Value:
Mathematical macro.
◆ VPOW
Value:
Mathematical macro.
◆ VPRIVATE
Mimic C++ "Private" type modifier.
◆ VPRTKEY
◆ VPTRSIZE
◆ VPUBLIC
#define VPUBLIC /*empty*/ |
Mimic C++ "Public" type modifier
◆ VRAND
◆ VRANDMAX
#define VRANDMAX (RAND_MAX) |
◆ VRDIN_SYMBOL
◆ VRDOUT_SYMBOL
#define VRDOUT_SYMBOL '>' |
◆ VRINT
Value:
Mathematical macro.
◆ VSIGN
Value:
#define VABS(x)
Mathematical macro.
Definition maloc_base.h:276
Mathematical macro.
◆ VSIN
Value:
Mathematical macro.
◆ VSINH
Value:
Mathematical macro.
◆ VSMALL
◆ VSQR
Value:
Mathematical macro.
◆ VSQRT
Value:
Mathematical macro.
◆ VSTDMODE
◆ VTAN
Value:
Mathematical macro.
◆ VTANH
Value:
Mathematical macro.
◆ VTRUE
◆ VVLARGE
◆ VVSMALL
◆ VWARN
Value:((void) ((ex) ? 0 :
VWARN1(__FILE__, __LINE__)))
#define VWARN1(file, lineno)
Slick assertion macro.
Definition maloc_base.h:168
Slick assertion macro.
◆ VWARN1
#define VWARN1 |
( |
| file, |
|
|
| lineno ) |
Value:(fprintf(stderr,"VWARN: ASSERTION FAILURE! filename %s, line %u\n", (file), (lineno)), 0)
Slick assertion macro.
◆ VZERO
Value:
Mathematical macro.