diff options
| author | Richard M. Stallman | 2002-12-04 11:32:37 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-12-04 11:32:37 +0000 |
| commit | b1b57aa840be57f5ea3730b6f77e7326c829257a (patch) | |
| tree | 1823ac64c1fe841a0e895cb8ad8c1ea15aeea351 /src | |
| parent | 708c440496b641b0c476a07911a9f06ebc12e29d (diff) | |
| download | emacs-b1b57aa840be57f5ea3730b6f77e7326c829257a.tar.gz emacs-b1b57aa840be57f5ea3730b6f77e7326c829257a.zip | |
Whitespace changes.
Diffstat (limited to 'src')
| -rw-r--r-- | src/alloca.c | 140 |
1 files changed, 70 insertions, 70 deletions
diff --git a/src/alloca.c b/src/alloca.c index 5147d333cdf..3cea2744149 100644 --- a/src/alloca.c +++ b/src/alloca.c | |||
| @@ -22,19 +22,19 @@ | |||
| 22 | your main control loop, etc. to force garbage collection. */ | 22 | your main control loop, etc. to force garbage collection. */ |
| 23 | 23 | ||
| 24 | #ifdef HAVE_CONFIG_H | 24 | #ifdef HAVE_CONFIG_H |
| 25 | #include <config.h> | 25 | # include <config.h> |
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifdef HAVE_STRING_H | 28 | #ifdef HAVE_STRING_H |
| 29 | #include <string.h> | 29 | # include <string.h> |
| 30 | #endif | 30 | #endif |
| 31 | #ifdef HAVE_STDLIB_H | 31 | #ifdef HAVE_STDLIB_H |
| 32 | #include <stdlib.h> | 32 | # include <stdlib.h> |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #ifdef emacs | 35 | #ifdef emacs |
| 36 | #include "lisp.h" | 36 | # include "lisp.h" |
| 37 | #include "blockinput.h" | 37 | # include "blockinput.h" |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | /* If compiling with GCC 2, this file's not needed. */ | 40 | /* If compiling with GCC 2, this file's not needed. */ |
| @@ -42,44 +42,43 @@ | |||
| 42 | 42 | ||
| 43 | /* If someone has defined alloca as a macro, | 43 | /* If someone has defined alloca as a macro, |
| 44 | there must be some other way alloca is supposed to work. */ | 44 | there must be some other way alloca is supposed to work. */ |
| 45 | #ifndef alloca | 45 | # ifndef alloca |
| 46 | 46 | ||
| 47 | #ifdef emacs | 47 | # ifdef emacs |
| 48 | #ifdef static | 48 | # ifdef static |
| 49 | /* actually, only want this if static is defined as "" | 49 | /* actually, only want this if static is defined as "" |
| 50 | -- this is for usg, in which emacs must undefine static | 50 | -- this is for usg, in which emacs must undefine static |
| 51 | in order to make unexec workable | 51 | in order to make unexec workable |
| 52 | */ | 52 | */ |
| 53 | #ifndef STACK_DIRECTION | 53 | # ifndef STACK_DIRECTION |
| 54 | #error "Must know STACK_DIRECTION at compile-time" | 54 | # error "Must know STACK_DIRECTION at compile-time" |
| 55 | #endif /* STACK_DIRECTION undefined */ | 55 | # endif /* STACK_DIRECTION undefined */ |
| 56 | #endif /* static */ | 56 | # endif /* static */ |
| 57 | #endif /* emacs */ | 57 | # endif /* emacs */ |
| 58 | 58 | ||
| 59 | /* If your stack is a linked list of frames, you have to | 59 | /* If your stack is a linked list of frames, you have to |
| 60 | provide an "address metric" ADDRESS_FUNCTION macro. */ | 60 | provide an "address metric" ADDRESS_FUNCTION macro. */ |
| 61 | 61 | ||
| 62 | #if defined (CRAY) && defined (CRAY_STACKSEG_END) | 62 | # if defined (CRAY) && defined (CRAY_STACKSEG_END) |
| 63 | long i00afunc (); | 63 | long i00afunc (); |
| 64 | #define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) | 64 | # define ADDRESS_FUNCTION(arg) (char *) i00afunc (&(arg)) |
| 65 | #else | 65 | # else |
| 66 | #define ADDRESS_FUNCTION(arg) &(arg) | 66 | # define ADDRESS_FUNCTION(arg) &(arg) |
| 67 | #endif | 67 | # endif |
| 68 | 68 | ||
| 69 | #ifdef POINTER_TYPE | 69 | # ifdef POINTER_TYPE |
| 70 | typedef POINTER_TYPE *pointer; | 70 | typedef POINTER_TYPE *pointer; |
| 71 | #else | 71 | # else /* not POINTER_TYPE */ |
| 72 | #if __STDC__ | 72 | # if __STDC__ |
| 73 | typedef void *pointer; | 73 | typedef void *pointer; |
| 74 | #else | 74 | # else /* not __STDC__ */ |
| 75 | typedef char *pointer; | 75 | typedef char *pointer; |
| 76 | #endif /*__STDC__*/ | 76 | # endif /* not __STDC__ */ |
| 77 | #endif /*POINTER_TYPE*/ | 77 | # endif /* not POINTER_TYPE */ |
| 78 | 78 | ||
| 79 | 79 | # ifndef NULL | |
| 80 | #ifndef NULL | 80 | # define NULL 0 |
| 81 | #define NULL 0 | 81 | # endif |
| 82 | #endif | ||
| 83 | 82 | ||
| 84 | /* Different portions of Emacs need to call different versions of | 83 | /* Different portions of Emacs need to call different versions of |
| 85 | malloc. The Emacs executable needs alloca to call xmalloc, because | 84 | malloc. The Emacs executable needs alloca to call xmalloc, because |
| @@ -91,12 +90,13 @@ typedef char *pointer; | |||
| 91 | 90 | ||
| 92 | Callers below should use malloc. */ | 91 | Callers below should use malloc. */ |
| 93 | 92 | ||
| 94 | #ifdef emacs | 93 | # ifndef emacs |
| 95 | #define malloc xmalloc | 94 | # undef malloc |
| 96 | #ifdef EMACS_FREE | 95 | # define malloc xmalloc |
| 97 | #define free EMACS_FREE | 96 | # ifdef EMACS_FREE |
| 98 | #endif | 97 | # define free EMACS_FREE |
| 99 | #endif | 98 | # endif |
| 99 | # endif | ||
| 100 | extern pointer malloc (); | 100 | extern pointer malloc (); |
| 101 | 101 | ||
| 102 | /* Define STACK_DIRECTION if you know the direction of stack | 102 | /* Define STACK_DIRECTION if you know the direction of stack |
| @@ -107,18 +107,18 @@ extern pointer malloc (); | |||
| 107 | STACK_DIRECTION < 0 => grows toward lower addresses | 107 | STACK_DIRECTION < 0 => grows toward lower addresses |
| 108 | STACK_DIRECTION = 0 => direction of growth unknown */ | 108 | STACK_DIRECTION = 0 => direction of growth unknown */ |
| 109 | 109 | ||
| 110 | #ifndef STACK_DIRECTION | 110 | # ifndef STACK_DIRECTION |
| 111 | #define STACK_DIRECTION 0 /* Direction unknown. */ | 111 | # define STACK_DIRECTION 0 /* Direction unknown. */ |
| 112 | #endif | 112 | # endif |
| 113 | 113 | ||
| 114 | #if STACK_DIRECTION != 0 | 114 | # if STACK_DIRECTION != 0 |
| 115 | 115 | ||
| 116 | #define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ | 116 | # define STACK_DIR STACK_DIRECTION /* Known at compile-time. */ |
| 117 | 117 | ||
| 118 | #else /* STACK_DIRECTION == 0; need run-time code. */ | 118 | # else /* STACK_DIRECTION == 0; need run-time code. */ |
| 119 | 119 | ||
| 120 | static int stack_dir; /* 1 or -1 once known. */ | 120 | static int stack_dir; /* 1 or -1 once known. */ |
| 121 | #define STACK_DIR stack_dir | 121 | # define STACK_DIR stack_dir |
| 122 | 122 | ||
| 123 | static void | 123 | static void |
| 124 | find_stack_direction () | 124 | find_stack_direction () |
| @@ -142,7 +142,7 @@ find_stack_direction () | |||
| 142 | } | 142 | } |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | #endif /* STACK_DIRECTION == 0 */ | 145 | # endif /* STACK_DIRECTION == 0 */ |
| 146 | 146 | ||
| 147 | /* An "alloca header" is used to: | 147 | /* An "alloca header" is used to: |
| 148 | (a) chain together all alloca'ed blocks; | 148 | (a) chain together all alloca'ed blocks; |
| @@ -151,9 +151,9 @@ find_stack_direction () | |||
| 151 | It is very important that sizeof(header) agree with malloc | 151 | It is very important that sizeof(header) agree with malloc |
| 152 | alignment chunk size. The following default should work okay. */ | 152 | alignment chunk size. The following default should work okay. */ |
| 153 | 153 | ||
| 154 | #ifndef ALIGN_SIZE | 154 | # ifndef ALIGN_SIZE |
| 155 | #define ALIGN_SIZE sizeof(double) | 155 | # define ALIGN_SIZE sizeof(double) |
| 156 | #endif | 156 | # endif |
| 157 | 157 | ||
| 158 | typedef union hdr | 158 | typedef union hdr |
| 159 | { | 159 | { |
| @@ -181,10 +181,10 @@ alloca (size) | |||
| 181 | auto char probe; /* Probes stack depth: */ | 181 | auto char probe; /* Probes stack depth: */ |
| 182 | register char *depth = ADDRESS_FUNCTION (probe); | 182 | register char *depth = ADDRESS_FUNCTION (probe); |
| 183 | 183 | ||
| 184 | #if STACK_DIRECTION == 0 | 184 | # if STACK_DIRECTION == 0 |
| 185 | if (STACK_DIR == 0) /* Unknown growth direction. */ | 185 | if (STACK_DIR == 0) /* Unknown growth direction. */ |
| 186 | find_stack_direction (); | 186 | find_stack_direction (); |
| 187 | #endif | 187 | # endif |
| 188 | 188 | ||
| 189 | /* Reclaim garbage, defined as all alloca'd storage that | 189 | /* Reclaim garbage, defined as all alloca'd storage that |
| 190 | was allocated from deeper in the stack than currently. */ | 190 | was allocated from deeper in the stack than currently. */ |
| @@ -192,9 +192,9 @@ alloca (size) | |||
| 192 | { | 192 | { |
| 193 | register header *hp; /* Traverses linked list. */ | 193 | register header *hp; /* Traverses linked list. */ |
| 194 | 194 | ||
| 195 | #ifdef emacs | 195 | # ifdef emacs |
| 196 | BLOCK_INPUT; | 196 | BLOCK_INPUT; |
| 197 | #endif | 197 | # endif |
| 198 | 198 | ||
| 199 | for (hp = last_alloca_header; hp != NULL;) | 199 | for (hp = last_alloca_header; hp != NULL;) |
| 200 | if ((STACK_DIR > 0 && hp->h.deep > depth) | 200 | if ((STACK_DIR > 0 && hp->h.deep > depth) |
| @@ -211,9 +211,9 @@ alloca (size) | |||
| 211 | 211 | ||
| 212 | last_alloca_header = hp; /* -> last valid storage. */ | 212 | last_alloca_header = hp; /* -> last valid storage. */ |
| 213 | 213 | ||
| 214 | #ifdef emacs | 214 | # ifdef emacs |
| 215 | UNBLOCK_INPUT; | 215 | UNBLOCK_INPUT; |
| 216 | #endif | 216 | # endif |
| 217 | } | 217 | } |
| 218 | 218 | ||
| 219 | if (size == 0) | 219 | if (size == 0) |
| @@ -239,15 +239,15 @@ alloca (size) | |||
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | #if defined (CRAY) && defined (CRAY_STACKSEG_END) | 242 | # if defined (CRAY) && defined (CRAY_STACKSEG_END) |
| 243 | 243 | ||
| 244 | #ifdef DEBUG_I00AFUNC | 244 | # ifdef DEBUG_I00AFUNC |
| 245 | #include <stdio.h> | 245 | # include <stdio.h> |
| 246 | #endif | 246 | # endif |
| 247 | 247 | ||
| 248 | #ifndef CRAY_STACK | 248 | # ifndef CRAY_STACK |
| 249 | #define CRAY_STACK | 249 | # define CRAY_STACK |
| 250 | #ifndef CRAY2 | 250 | # ifndef CRAY2 |
| 251 | /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ | 251 | /* Stack structures for CRAY-1, CRAY X-MP, and CRAY Y-MP */ |
| 252 | struct stack_control_header | 252 | struct stack_control_header |
| 253 | { | 253 | { |
| @@ -299,7 +299,7 @@ struct stack_segment_linkage | |||
| 299 | long sss7; | 299 | long sss7; |
| 300 | }; | 300 | }; |
| 301 | 301 | ||
| 302 | #else /* CRAY2 */ | 302 | # else /* CRAY2 */ |
| 303 | /* The following structure defines the vector of words | 303 | /* The following structure defines the vector of words |
| 304 | returned by the STKSTAT library routine. */ | 304 | returned by the STKSTAT library routine. */ |
| 305 | struct stk_stat | 305 | struct stk_stat |
| @@ -352,10 +352,10 @@ struct stk_trailer | |||
| 352 | long unknown14; | 352 | long unknown14; |
| 353 | }; | 353 | }; |
| 354 | 354 | ||
| 355 | #endif /* CRAY2 */ | 355 | # endif /* CRAY2 */ |
| 356 | #endif /* not CRAY_STACK */ | 356 | # endif /* not CRAY_STACK */ |
| 357 | 357 | ||
| 358 | #ifdef CRAY2 | 358 | # ifdef CRAY2 |
| 359 | /* Determine a "stack measure" for an arbitrary ADDRESS. | 359 | /* Determine a "stack measure" for an arbitrary ADDRESS. |
| 360 | I doubt that "lint" will like this much. */ | 360 | I doubt that "lint" will like this much. */ |
| 361 | 361 | ||
| @@ -426,7 +426,7 @@ i00afunc (long *address) | |||
| 426 | return (result); | 426 | return (result); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | #else /* not CRAY2 */ | 429 | # else /* not CRAY2 */ |
| 430 | /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. | 430 | /* Stack address function for a CRAY-1, CRAY X-MP, or CRAY Y-MP. |
| 431 | Determine the number of the cell within the stack, | 431 | Determine the number of the cell within the stack, |
| 432 | given the address of the cell. The purpose of this | 432 | given the address of the cell. The purpose of this |
| @@ -471,9 +471,9 @@ i00afunc (long address) | |||
| 471 | 471 | ||
| 472 | while (!(this_segment <= address && address <= stkl)) | 472 | while (!(this_segment <= address && address <= stkl)) |
| 473 | { | 473 | { |
| 474 | #ifdef DEBUG_I00AFUNC | 474 | # ifdef DEBUG_I00AFUNC |
| 475 | fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); | 475 | fprintf (stderr, "%011o %011o %011o\n", this_segment, address, stkl); |
| 476 | #endif | 476 | # endif |
| 477 | if (pseg == 0) | 477 | if (pseg == 0) |
| 478 | break; | 478 | break; |
| 479 | stkl = stkl - pseg; | 479 | stkl = stkl - pseg; |
| @@ -492,9 +492,9 @@ i00afunc (long address) | |||
| 492 | 492 | ||
| 493 | while (pseg != 0) | 493 | while (pseg != 0) |
| 494 | { | 494 | { |
| 495 | #ifdef DEBUG_I00AFUNC | 495 | # ifdef DEBUG_I00AFUNC |
| 496 | fprintf (stderr, "%011o %011o\n", pseg, size); | 496 | fprintf (stderr, "%011o %011o\n", pseg, size); |
| 497 | #endif | 497 | # endif |
| 498 | stkl = stkl - pseg; | 498 | stkl = stkl - pseg; |
| 499 | ssptr = (struct stack_segment_linkage *) stkl; | 499 | ssptr = (struct stack_segment_linkage *) stkl; |
| 500 | size = ssptr->sssize; | 500 | size = ssptr->sssize; |
| @@ -504,8 +504,8 @@ i00afunc (long address) | |||
| 504 | return (result); | 504 | return (result); |
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | #endif /* not CRAY2 */ | 507 | # endif /* not CRAY2 */ |
| 508 | #endif /* CRAY */ | 508 | # endif /* CRAY */ |
| 509 | 509 | ||
| 510 | #endif /* no alloca */ | 510 | # endif /* no alloca */ |
| 511 | #endif /* not GCC version 2 */ | 511 | #endif /* not GCC version 2 */ |