]> granicus.if.org Git - postgresql/blob - src/include/c.h
Change my-function-name-- to my_function_name, and optimizer renames.
[postgresql] / src / include / c.h
1 /*-------------------------------------------------------------------------
2  *
3  * c.h
4  *        Fundamental C definitions.  This is included by every .c file in
5  *        postgres.
6  *
7  *
8  * Copyright (c) 1994, Regents of the University of California
9  *
10  * $Id: c.h,v 1.51 1999/02/13 23:20:44 momjian Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 /*
15  *       TABLE OF CONTENTS
16  *
17  *              When adding stuff to this file, please try and put stuff
18  *              into the relevant section, or add new sections as appropriate.
19  *
20  *        section       description
21  *        -------       ------------------------------------------------
22  *              1)              bool, true, false, TRUE, FALSE
23  *              2)              __STDC__, non-ansi C definitions:
24  *                              Pointer typedef, NULL
25  *                              cpp magic macros
26  *                              type prefixes: const, signed, volatile, inline
27  *              3)              standard system types
28  *              4)              datum type
29  *              5)              IsValid macros for system types
30  *              6)              offsetof, lengthof, endof
31  *              7)              exception handling definitions, Assert, Trap, etc macros
32  *              8)              Min, Max, Abs, StrNCpy macros
33  *              9)              externs
34  *              10)              Berkeley-specific defs
35  *              11)             system-specific hacks
36  *
37  *       NOTES
38  *
39  *              This file is MACHINE AND COMPILER dependent!!!  (For now.)
40  *
41  * ----------------------------------------------------------------
42  */
43 #ifndef C_H
44 #define C_H
45
46 /* We have to include stdlib.h here because it defines many of these macros
47    on some platforms, and we only want our definitions used if stdlib.h doesn't
48    have its own.  The same goes for stddef and stdarg if present.
49 */
50 #include <stdlib.h>
51 #ifdef STDC_HEADERS
52 #include <stddef.h>
53 #include <stdarg.h>
54 #endif
55
56 #ifdef __CYGWIN32__
57 #include <errno.h>
58 #endif
59
60 /* ----------------------------------------------------------------
61  *                              Section 1:      bool, true, false, TRUE, FALSE
62  * ----------------------------------------------------------------
63  */
64 /*
65  * bool 
66  *              Boolean value, either true or false.
67  *
68  */
69 #define false   ((char) 0)
70 #define true    ((char) 1)
71 #ifndef __cplusplus
72 #ifndef bool
73 typedef char bool;
74 #endif   /* ndef bool */
75 #endif   /* not C++ */
76 typedef bool *BoolPtr;
77
78 #ifndef TRUE
79 #define TRUE    1
80 #endif   /* TRUE */
81
82 #ifndef FALSE
83 #define FALSE   0
84 #endif   /* FALSE */
85
86 /* ----------------------------------------------------------------
87  *                              Section 2: __STDC__, non-ansi C definitions:
88  *
89  *                              cpp magic macros
90  *                              Pointer typedef, NULL
91  *                              type prefixes: const, signed, volatile, inline
92  * ----------------------------------------------------------------
93  */
94
95 #ifdef  __STDC__                                /* ANSI C */
96
97 /*
98  * Pointer 
99  *              Variable holding address of any memory resident object.
100  */
101
102 /*
103  *              XXX Pointer arithmetic is done with this, so it can't be void *
104  *              under "true" ANSI compilers.
105  */
106 typedef char *Pointer;
107
108 #ifndef NULL
109 /*
110  * NULL 
111  *              Null pointer.
112  */
113 #define NULL    ((void *) 0)
114 #endif   /* !defined(NULL) */
115
116 #define HAVE_ANSI_CPP                   /* all ANSI C compilers must have this! */
117 #if defined(NEED_STD_HDRS)
118 #undef NEED_STD_HDRS                    /* all ANSI systems must have
119                                                                  * stddef/stdlib */
120 #endif   /* NEED_STD_HDRS */
121
122 #else   /* !defined(__STDC__) *//* NOT ANSI C */
123
124 /*
125  * Pointer 
126  *              Variable containing address of any memory resident object.
127  */
128 typedef char *Pointer;
129
130 #ifndef NULL
131 /*
132  * NULL 
133  *              Null pointer.
134  */
135 #define NULL    0
136 #endif   /* !defined(NULL) */
137
138 /*
139  * const 
140  *              Type modifier.  Identifies read only variables.
141  *
142  * Example:
143  *              extern const Version    RomVersion;
144  */
145 #ifndef WIN32
146 #define const                                   /* const */
147 #endif
148
149 /*
150  * signed 
151  *              Type modifier.  Identifies signed integral types.
152  */
153 #define signed                                  /* signed */
154
155 /*
156  * volatile 
157  *              Type modifier.  Identifies variables which may change in ways not
158  *              noticeable by the compiler, e.g. via asynchronous interrupts.
159  *
160  * Example:
161  *              extern volatile unsigned int    NumberOfInterrupts;
162  */
163 #define volatile                                /* volatile */
164
165 #endif   /* !defined(__STDC__) */               /* NOT ANSI C */
166
167 /*
168  * CppAsString 
169  *              Convert the argument to a string, using the C preprocessor.
170  * CppConcat 
171  *              Concatenate two arguments together, using the C preprocessor.
172  */
173 #if defined(HAVE_ANSI_CPP)
174
175 #define CppAsString(identifier) #identifier
176 #define CppConcat(x, y)                 x##y
177
178 #else                                                   /* !HAVE_ANSI_CPP */
179
180 #define CppAsString(identifier) "identifier"
181
182 /*
183  * CppIdentity -- On Reiser based cpp's this is used to concatenate
184  *              two tokens.  That is
185  *                              CppIdentity(A)B ==> AB
186  *              We renamed it to _private_CppIdentity because it should not
187  *              be referenced outside this file.  On other cpp's it
188  *              produces  A  B.
189  */
190 #define _priv_CppIdentity(x)x
191 #define CppConcat(x, y)                 _priv_CppIdentity(x)y
192
193 #endif   /* !HAVE_ANSI_CPP */
194
195 #ifndef __GNUC__                                /* GNU cc */
196 #endif
197
198 #ifndef __GNUC__                                /* GNU cc */
199 #define inline
200 /*
201  * dummyret is used to set return values in macros that use ?: to make
202  * assignments.  gcc wants these to be void, other compilers like char
203  */
204 #define dummyret        char
205 #else
206 #define dummyret        void
207 #endif
208
209 #if defined(NEED_STD_HDRS)
210 /*
211  * You're doomed.  We've removed almost all of our own C library
212  * extern declarations because they conflict on the different
213  * systems.  You'll have to write your own stdlib.h.
214  */
215 #include "stdlib.h"
216 #else                                                   /* NEED_STD_HDRS */
217 #include <stddef.h>
218 #include <stdlib.h>
219 #endif   /* NEED_STD_HDRS */
220
221 /* ----------------------------------------------------------------
222  *                              Section 3:      standard system types
223  * ----------------------------------------------------------------
224  */
225
226 /*
227  * intN 
228  *              Signed integer, EXACTLY N BITS IN SIZE,
229  *              used for numerical computations and the
230  *              frontend/backend protocol.
231  */
232 typedef signed char int8;               /* == 8 bits */
233 typedef signed short int16;             /* == 16 bits */
234 typedef signed int int32;               /* == 32 bits */
235
236 /*
237  * uintN 
238  *              Unsigned integer, EXACTLY N BITS IN SIZE,
239  *              used for numerical computations and the
240  *              frontend/backend protocol.
241  */
242 typedef unsigned char uint8;    /* == 8 bits */
243 typedef unsigned short uint16;  /* == 16 bits */
244 typedef unsigned int uint32;    /* == 32 bits */
245
246 /*
247  * floatN 
248  *              Floating point number, AT LEAST N BITS IN SIZE,
249  *              used for numerical computations.
250  *
251  *              Since sizeof(floatN) may be > sizeof(char *), always pass
252  *              floatN by reference.
253  */
254 typedef float float32data;
255 typedef double float64data;
256 typedef float *float32;
257 typedef double *float64;
258
259 /*
260  * boolN 
261  *              Boolean value, AT LEAST N BITS IN SIZE.
262  */
263 typedef uint8 bool8;                    /* >= 8 bits */
264 typedef uint16 bool16;                  /* >= 16 bits */
265 typedef uint32 bool32;                  /* >= 32 bits */
266
267 /*
268  * bitsN 
269  *              Unit of bitwise operation, AT LEAST N BITS IN SIZE.
270  */
271 typedef uint8 bits8;                    /* >= 8 bits */
272 typedef uint16 bits16;                  /* >= 16 bits */
273 typedef uint32 bits32;                  /* >= 32 bits */
274
275 /*
276  * wordN 
277  *              Unit of storage, AT LEAST N BITS IN SIZE,
278  *              used to fetch/store data.
279  */
280 typedef uint8 word8;                    /* >= 8 bits */
281 typedef uint16 word16;                  /* >= 16 bits */
282 typedef uint32 word32;                  /* >= 32 bits */
283
284 /*
285  * Size 
286  *              Size of any memory resident object, as returned by sizeof.
287  */
288 typedef size_t Size;
289
290 /*
291  * Index 
292  *              Index into any memory resident array.
293  *
294  * Note:
295  *              Indices are non negative.
296  */
297 typedef unsigned int Index;
298
299 #define MAXDIM 6
300 typedef struct
301 {
302         int                     indx[MAXDIM];
303 } IntArray;
304
305 /*
306  * Offset 
307  *              Offset into any memory resident array.
308  *
309  * Note:
310  *              This differs from an Index in that an Index is always
311  *              non negative, whereas Offset may be negative.
312  */
313 typedef signed int Offset;
314
315 /* ----------------------------------------------------------------
316  *                              Section 4:      datum type + support macros
317  * ----------------------------------------------------------------
318  */
319 /*
320  * datum.h 
321  *              POSTGRES abstract data type datum representation definitions.
322  *
323  * Note:
324  *
325  * Port Notes:
326  *      Postgres makes the following assumption about machines:
327  *
328  *      sizeof(Datum) == sizeof(long) >= sizeof(void *) >= 4
329  *
330  *      Postgres also assumes that
331  *
332  *      sizeof(char) == 1
333  *
334  *      and that
335  *
336  *      sizeof(short) == 2
337  *
338  *      If your machine meets these requirements, Datums should also be checked
339  *      to see if the positioning is correct.
340  *
341  *              This file is MACHINE AND COMPILER dependent!!!
342  */
343
344 typedef unsigned long Datum;    /* XXX sizeof(long) >= sizeof(void *) */
345 typedef Datum *DatumPtr;
346
347 #define GET_1_BYTE(datum)       (((Datum) (datum)) & 0x000000ff)
348 #define GET_2_BYTES(datum)      (((Datum) (datum)) & 0x0000ffff)
349 #define GET_4_BYTES(datum)      (((Datum) (datum)) & 0xffffffff)
350 #define SET_1_BYTE(value)       (((Datum) (value)) & 0x000000ff)
351 #define SET_2_BYTES(value)      (((Datum) (value)) & 0x0000ffff)
352 #define SET_4_BYTES(value)      (((Datum) (value)) & 0xffffffff)
353
354 /*
355  * DatumGetChar 
356  *              Returns character value of a datum.
357  */
358
359 #define DatumGetChar(X) ((char) GET_1_BYTE(X))
360
361 /*
362  * CharGetDatum 
363  *              Returns datum representation for a character.
364  */
365
366 #define CharGetDatum(X) ((Datum) SET_1_BYTE(X))
367
368 /*
369  * Int8GetDatum 
370  *              Returns datum representation for an 8-bit integer.
371  */
372
373 #define Int8GetDatum(X) ((Datum) SET_1_BYTE(X))
374
375 /*
376  * DatumGetUInt8 
377  *              Returns 8-bit unsigned integer value of a datum.
378  */
379
380 #define DatumGetUInt8(X) ((uint8) GET_1_BYTE(X))
381
382 /*
383  * UInt8GetDatum 
384  *              Returns datum representation for an 8-bit unsigned integer.
385  */
386
387 #define UInt8GetDatum(X) ((Datum) SET_1_BYTE(X))
388
389 /*
390  * DatumGetInt16 
391  *              Returns 16-bit integer value of a datum.
392  */
393
394 #define DatumGetInt16(X) ((int16) GET_2_BYTES(X))
395
396 /*
397  * Int16GetDatum 
398  *              Returns datum representation for a 16-bit integer.
399  */
400
401 #define Int16GetDatum(X) ((Datum) SET_2_BYTES(X))
402
403 /*
404  * DatumGetUInt16 
405  *              Returns 16-bit unsigned integer value of a datum.
406  */
407
408 #define DatumGetUInt16(X) ((uint16) GET_2_BYTES(X))
409
410 /*
411  * UInt16GetDatum 
412  *              Returns datum representation for a 16-bit unsigned integer.
413  */
414
415 #define UInt16GetDatum(X) ((Datum) SET_2_BYTES(X))
416
417 /*
418  * DatumGetInt32 
419  *              Returns 32-bit integer value of a datum.
420  */
421
422 #define DatumGetInt32(X) ((int32) GET_4_BYTES(X))
423
424 /*
425  * Int32GetDatum 
426  *              Returns datum representation for a 32-bit integer.
427  */
428
429 #define Int32GetDatum(X) ((Datum) SET_4_BYTES(X))
430
431 /*
432  * DatumGetUInt32 
433  *              Returns 32-bit unsigned integer value of a datum.
434  */
435
436 #define DatumGetUInt32(X) ((uint32) GET_4_BYTES(X))
437
438 /*
439  * UInt32GetDatum 
440  *              Returns datum representation for a 32-bit unsigned integer.
441  */
442
443 #define UInt32GetDatum(X) ((Datum) SET_4_BYTES(X))
444
445 /*
446  * DatumGetObjectId 
447  *              Returns object identifier value of a datum.
448  */
449
450 #define DatumGetObjectId(X) ((Oid) GET_4_BYTES(X))
451
452 /*
453  * ObjectIdGetDatum 
454  *              Returns datum representation for an object identifier.
455  */
456
457 #define ObjectIdGetDatum(X) ((Datum) SET_4_BYTES(X))
458
459 /*
460  * DatumGetPointer 
461  *              Returns pointer value of a datum.
462  */
463
464 #define DatumGetPointer(X) ((Pointer) X)
465
466 /*
467  * PointerGetDatum 
468  *              Returns datum representation for a pointer.
469  */
470
471 #define PointerGetDatum(X) ((Datum) X)
472
473 /*
474  * DatumGetName 
475  *              Returns name value of a datum.
476  */
477
478 #define DatumGetName(X) ((Name) DatumGetPointer((Datum) X))
479
480 /*
481  * NameGetDatum 
482  *              Returns datum representation for a name.
483  */
484
485 #define NameGetDatum(X) PointerGetDatum((Pointer) X)
486
487
488 /*
489  * DatumGetFloat32 
490  *              Returns 32-bit floating point value of a datum.
491  *              This is really a pointer, of course.
492  */
493
494 #define DatumGetFloat32(X) ((float32) DatumGetPointer((Datum) X))
495
496 /*
497  * Float32GetDatum 
498  *              Returns datum representation for a 32-bit floating point number.
499  *              This is really a pointer, of course.
500  */
501
502 #define Float32GetDatum(X) PointerGetDatum((Pointer) X)
503
504 /*
505  * DatumGetFloat64 
506  *              Returns 64-bit floating point value of a datum.
507  *              This is really a pointer, of course.
508  */
509
510 #define DatumGetFloat64(X) ((float64) DatumGetPointer(X))
511
512 /*
513  * Float64GetDatum 
514  *              Returns datum representation for a 64-bit floating point number.
515  *              This is really a pointer, of course.
516  */
517
518 #define Float64GetDatum(X) PointerGetDatum((Pointer) X)
519
520 /* ----------------------------------------------------------------
521  *                              Section 5:      IsValid macros for system types
522  * ----------------------------------------------------------------
523  */
524 /*
525  * BoolIsValid 
526  *              True iff bool is valid.
527  */
528 #define BoolIsValid(boolean)    ((boolean) == false || (boolean) == true)
529
530 /*
531  * PointerIsValid 
532  *              True iff pointer is valid.
533  */
534 #define PointerIsValid(pointer) (bool)((void*)(pointer) != NULL)
535
536 /*
537  * PointerIsInBounds 
538  *              True iff pointer is within given bounds.
539  *
540  * Note:
541  *              Assumes the bounded interval to be [min,max),
542  *              i.e. closed on the left and open on the right.
543  */
544 #define PointerIsInBounds(pointer, min, max) \
545                 ((min) <= (pointer) && (pointer) < (max))
546
547 /*
548  * PointerIsAligned 
549  *              True iff pointer is properly aligned to point to the given type.
550  */
551 #define PointerIsAligned(pointer, type) \
552                 (((long)(pointer) % (sizeof (type))) == 0)
553
554 /* ----------------------------------------------------------------
555  *                              Section 6:      offsetof, lengthof, endof
556  * ----------------------------------------------------------------
557  */
558 /*
559  * offsetof 
560  *              Offset of a structure/union field within that structure/union.
561  *
562  *              XXX This is supposed to be part of stddef.h, but isn't on
563  *              some systems (like SunOS 4).
564  */
565 #ifndef offsetof
566 #define offsetof(type, field)   ((long) &((type *)0)->field)
567 #endif   /* offsetof */
568
569 /*
570  * lengthof 
571  *              Number of elements in an array.
572  */
573 #define lengthof(array) (sizeof (array) / sizeof ((array)[0]))
574
575 /*
576  * endof 
577  *              Address of the element one past the last in an array.
578  */
579 #define endof(array)    (&array[lengthof(array)])
580
581 /* ----------------------------------------------------------------
582  *                              Section 7:      exception handling definitions
583  *                                                      Assert, Trap, etc macros
584  * ----------------------------------------------------------------
585  */
586 /*
587  * Exception Handling definitions
588  */
589
590 typedef char *ExcMessage;
591 typedef struct Exception
592 {
593         ExcMessage      message;
594 } Exception;
595
596 /*
597  * USE_ASSERT_CHECKING, if defined, turns on all the assertions.
598  * - plai  9/5/90
599  *
600  * It should _NOT_ be defined in releases or in benchmark copies
601  */
602
603 /*
604  * Trap 
605  *              Generates an exception if the given condition is true.
606  *
607  */
608 #define Trap(condition, exception) \
609                 { if ((assert_enabled) && (condition)) \
610                                 ExceptionalCondition(CppAsString(condition), &(exception), \
611                                                 (char*)NULL, __FILE__, __LINE__); }
612
613 /*
614  *      TrapMacro is the same as Trap but it's intended for use in macros:
615  *
616  *              #define foo(x) (AssertM(x != 0) && bar(x))
617  *
618  *      Isn't CPP fun?
619  */
620 #define TrapMacro(condition, exception) \
621         ((bool) ((! assert_enabled) || (! condition) || \
622                          (ExceptionalCondition(CppAsString(condition), \
623                                                                   &(exception), \
624                                                                   (char*) NULL, __FILE__, __LINE__))))
625
626 #ifndef USE_ASSERT_CHECKING
627 #define Assert(condition)
628 #define AssertMacro(condition)  (void)true
629 #define AssertArg(condition)
630 #define AssertState(condition)
631 #define assert_enabled 0
632 #else
633 #define Assert(condition) \
634                 Trap(!(condition), FailedAssertion)
635
636 #define AssertMacro(condition) \
637                 (void)TrapMacro(!(condition), FailedAssertion)
638
639 #define AssertArg(condition) \
640                 Trap(!(condition), BadArg)
641
642 #define AssertState(condition) \
643                 Trap(!(condition), BadState)
644
645 extern int      assert_enabled;
646
647 #endif   /* USE_ASSERT_CHECKING */
648
649 /*
650  * LogTrap 
651  *              Generates an exception with a message if the given condition is true.
652  *
653  */
654 #define LogTrap(condition, exception, printArgs) \
655                 { if ((assert_enabled) && (condition)) \
656                                 ExceptionalCondition(CppAsString(condition), &(exception), \
657                                                 form printArgs, __FILE__, __LINE__); }
658
659 /*
660  *      LogTrapMacro is the same as LogTrap but it's intended for use in macros:
661  *
662  *              #define foo(x) (LogAssertMacro(x != 0, "yow!") && bar(x))
663  */
664 #define LogTrapMacro(condition, exception, printArgs) \
665         ((bool) ((! assert_enabled) || (! condition) || \
666                          (ExceptionalCondition(CppAsString(condition), \
667                                                                    &(exception), \
668                                                                    form printArgs, __FILE__, __LINE__))))
669
670 #ifndef USE_ASSERT_CHECKING
671 #define LogAssert(condition, printArgs)
672 #define LogAssertMacro(condition, printArgs) true
673 #define LogAssertArg(condition, printArgs)
674 #define LogAssertState(condition, printArgs)
675 #else
676 #define LogAssert(condition, printArgs) \
677                 LogTrap(!(condition), FailedAssertion, printArgs)
678
679 #define LogAssertMacro(condition, printArgs) \
680                 LogTrapMacro(!(condition), FailedAssertion, printArgs)
681
682 #define LogAssertArg(condition, printArgs) \
683                 LogTrap(!(condition), BadArg, printArgs)
684
685 #define LogAssertState(condition, printArgs) \
686                 LogTrap(!(condition), BadState, printArgs)
687
688 extern int      assertEnable(int val);
689
690 #ifdef ASSERT_CHECKING_TEST
691 extern int      assertTest(int val);
692
693 #endif
694 #endif   /* USE_ASSERT_CHECKING */
695
696 /* ----------------------------------------------------------------
697  *                              Section 8:      Min, Max, Abs macros
698  * ----------------------------------------------------------------
699  */
700 /*
701  * Max 
702  *              Return the maximum of two numbers.
703  */
704 #define Max(x, y)               ((x) > (y) ? (x) : (y))
705
706 /*
707  * Min 
708  *              Return the minimum of two numbers.
709  */
710 #define Min(x, y)               ((x) < (y) ? (x) : (y))
711
712 /*
713  * Abs 
714  *              Return the absolute value of the argument.
715  */
716 #define Abs(x)                  ((x) >= 0 ? (x) : -(x))
717
718 /*
719  * StrNCpy 
720  *              Does string copy, and forces terminating NULL
721  */
722 /* we do this so if the macro is used in an if action, it will work */
723 #define StrNCpy(dst,src,len)    \
724 ( \
725         ((len) > 0) ? \
726         ( \
727                 strncpy((dst),(src),(len)-1), \
728                 *((dst)+(len)-1)='\0' \
729         ) \
730         : \
731                 (dummyret)NULL,(void)(dst) \
732 )
733
734 /* Get a bit mask of the bits set in non-int32 aligned addresses */
735 #define INT_ALIGN_MASK (sizeof(int32) - 1)
736
737 /*
738  *      This function gets call too often, so we inline it if we can.
739  *      Are we aligned for int32?
740  *      We have to cast the pointer to int so we can do the AND
741  *      We got the 64 number by testing this against the stock memset() on
742  *      BSD/OS 3.0. Larger values were slower.
743  */
744 #define MemSet(start, val, len) do \
745                                                                 { \
746                                                                         if (((long)(start) & INT_ALIGN_MASK) == 0 && \
747                                                                                 ((len) & INT_ALIGN_MASK) == 0 && \
748                                                                                 (val) == 0 && \
749                                                                                 (len) <= 64) \
750                                                                         { \
751                                                                                 int32 *_i = (int32 *)(start); \
752                                                                                 int32 *_stop = (int32 *)((char *)(start) + (len)); \
753                                                                                 \
754                                                                                 while (_i < _stop) \
755                                                                                         *_i++ = 0; \
756                                                                         } \
757                                                                         else \
758                                                                                 memset((start), (val), (len)); \
759                                                                 } while (0)
760
761 /* ----------------------------------------------------------------
762  *                              Section 9: externs
763  * ----------------------------------------------------------------
764  */
765
766 extern Exception FailedAssertion;
767 extern Exception BadArg;
768 extern Exception BadState;
769
770 /* in utils/error/assert.c */
771 extern int ExceptionalCondition(char *conditionName,
772                                          Exception *exceptionP, char *details,
773                                          char *fileName, int lineNumber);
774
775
776 /* ----------------
777  *              form is used by assert and the exception handling stuff
778  * ----------------
779  */
780 extern char *form(const char *fmt,...);
781
782
783
784 /* ----------------------------------------------------------------
785  *                              Section 10: berkeley-specific configuration
786  *
787  * this section contains settings which are only relevant to the UC Berkeley
788  * sites.  Other sites can ignore this
789  * ----------------------------------------------------------------
790  */
791
792 /* ----------------
793  *              storage managers
794  *
795  *              These are experimental and are not supported in the code that
796  *              we distribute to other sites.
797  * ----------------
798  */
799 #ifdef NOT_USED
800 #define STABLE_MEMORY_STORAGE
801 #endif
802
803
804
805 /* ----------------------------------------------------------------
806  *                              Section 11: system-specific hacks
807  *
808  *              This should be limited to things that absolutely have to be
809  *              included in every source file.  The changes should be factored
810  *              into a separate file so that changes to one port don't require
811  *              changes to c.h (and everyone recompiling their whole system).
812  * ----------------------------------------------------------------
813  */
814
815 #ifdef FIXADE
816 #if defined(hpux)
817 #include "port/hpux/fixade.h"   /* for unaligned access fixup */
818 #endif   /* hpux */
819 #endif
820
821 #if defined(sun) && defined(sparc) && !defined(__SVR4)
822 #define memmove(d, s, l)                bcopy(s, d, l)
823 #include <unistd.h>
824 #include <varargs.h>
825 #endif
826
827 /* These are for things that are one way on Unix and another on NT */
828 #define NULL_DEV                "/dev/null"
829 #define COPY_CMD                "cp"
830 #define SEP_CHAR                '/'
831
832 /* Provide prototypes for routines not present in a particular machine's
833  * standard C library.  It'd be better to put these in config.h, but
834  * in config.h we haven't yet included anything that defines size_t...
835  */
836
837 #ifndef HAVE_SNPRINTF
838 extern int snprintf(char *str, size_t count, const char *fmt, ...);
839 #endif
840
841 #ifndef HAVE_VSNPRINTF
842 extern int vsnprintf(char *str, size_t count, const char *fmt, va_list args);
843 #endif
844
845 /* ----------------
846  *              end of c.h
847  * ----------------
848  */
849 #endif   /* C_H */