Fix the handling of floating-point tokens in the preprocessor
[nasm.git] / nasmlib.c
blobee947c23373e58231e04f13a3184753d5076fc34
1 /* nasmlib.c library routines for the Netwide Assembler
3 * The Netwide Assembler is copyright (C) 1996 Simon Tatham and
4 * Julian Hall. All rights reserved. The software is
5 * redistributable under the licence given in the file "Licence"
6 * distributed in the NASM archive.
7 */
9 #include "compiler.h"
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <ctype.h>
15 #include <inttypes.h>
17 #include "nasm.h"
18 #include "nasmlib.h"
19 #include "insns.h"
21 int globalbits = 0; /* defined in nasm.h, works better here for ASM+DISASM */
22 efunc nasm_malloc_error; /* Exported for the benefit of vsnprintf.c */
24 #ifdef LOGALLOC
25 static FILE *logfp;
26 #endif
28 void nasm_set_malloc_error(efunc error)
30 nasm_malloc_error = error;
31 #ifdef LOGALLOC
32 logfp = fopen("malloc.log", "w");
33 setvbuf(logfp, NULL, _IOLBF, BUFSIZ);
34 fprintf(logfp, "null pointer is %p\n", NULL);
35 #endif
38 #ifdef LOGALLOC
39 void *nasm_malloc_log(char *file, int line, size_t size)
40 #else
41 void *nasm_malloc(size_t size)
42 #endif
44 void *p = malloc(size);
45 if (!p)
46 nasm_malloc_error(ERR_FATAL | ERR_NOFILE, "out of memory");
47 #ifdef LOGALLOC
48 else
49 fprintf(logfp, "%s %d malloc(%ld) returns %p\n",
50 file, line, (long)size, p);
51 #endif
52 return p;
55 #ifdef LOGALLOC
56 void *nasm_zalloc_log(char *file, int line, size_t size)
57 #else
58 void *nasm_zalloc(size_t size)
59 #endif
61 void *p = calloc(size, 1);
62 if (!p)
63 nasm_malloc_error(ERR_FATAL | ERR_NOFILE, "out of memory");
64 #ifdef LOGALLOC
65 else
66 fprintf(logfp, "%s %d calloc(%ld, 1) returns %p\n",
67 file, line, (long)size, p);
68 #endif
69 return p;
72 #ifdef LOGALLOC
73 void *nasm_realloc_log(char *file, int line, void *q, size_t size)
74 #else
75 void *nasm_realloc(void *q, size_t size)
76 #endif
78 void *p = q ? realloc(q, size) : malloc(size);
79 if (!p)
80 nasm_malloc_error(ERR_FATAL | ERR_NOFILE, "out of memory");
81 #ifdef LOGALLOC
82 else if (q)
83 fprintf(logfp, "%s %d realloc(%p,%ld) returns %p\n",
84 file, line, q, (long)size, p);
85 else
86 fprintf(logfp, "%s %d malloc(%ld) returns %p\n",
87 file, line, (long)size, p);
88 #endif
89 return p;
92 #ifdef LOGALLOC
93 void nasm_free_log(char *file, int line, void *q)
94 #else
95 void nasm_free(void *q)
96 #endif
98 if (q) {
99 free(q);
100 #ifdef LOGALLOC
101 fprintf(logfp, "%s %d free(%p)\n", file, line, q);
102 #endif
106 #ifdef LOGALLOC
107 char *nasm_strdup_log(char *file, int line, const char *s)
108 #else
109 char *nasm_strdup(const char *s)
110 #endif
112 char *p;
113 int size = strlen(s) + 1;
115 p = malloc(size);
116 if (!p)
117 nasm_malloc_error(ERR_FATAL | ERR_NOFILE, "out of memory");
118 #ifdef LOGALLOC
119 else
120 fprintf(logfp, "%s %d strdup(%ld) returns %p\n",
121 file, line, (long)size, p);
122 #endif
123 strcpy(p, s);
124 return p;
127 #ifdef LOGALLOC
128 char *nasm_strndup_log(char *file, int line, char *s, size_t len)
129 #else
130 char *nasm_strndup(char *s, size_t len)
131 #endif
133 char *p;
134 int size = len + 1;
136 p = malloc(size);
137 if (!p)
138 nasm_malloc_error(ERR_FATAL | ERR_NOFILE, "out of memory");
139 #ifdef LOGALLOC
140 else
141 fprintf(logfp, "%s %d strndup(%ld) returns %p\n",
142 file, line, (long)size, p);
143 #endif
144 strncpy(p, s, len);
145 p[len] = '\0';
146 return p;
149 #ifndef nasm_stricmp
150 int nasm_stricmp(const char *s1, const char *s2)
152 while (*s1 && tolower(*s1) == tolower(*s2))
153 s1++, s2++;
154 if (!*s1 && !*s2)
155 return 0;
156 else if (tolower(*s1) < tolower(*s2))
157 return -1;
158 else
159 return 1;
161 #endif
163 #ifndef nasm_strnicmp
164 int nasm_strnicmp(const char *s1, const char *s2, int n)
166 while (n > 0 && *s1 && tolower(*s1) == tolower(*s2))
167 s1++, s2++, n--;
168 if ((!*s1 && !*s2) || n == 0)
169 return 0;
170 else if (tolower(*s1) < tolower(*s2))
171 return -1;
172 else
173 return 1;
175 #endif
177 #ifndef nasm_strsep
178 char *nasm_strsep(char **stringp, const char *delim)
180 char *s = *stringp;
181 char *e;
183 if (!s)
184 return NULL;
186 e = strpbrk(s, delim);
187 if (e)
188 *e++ = '\0';
190 *stringp = e;
191 return s;
193 #endif
196 #define lib_isnumchar(c) (isalnum(c) || (c) == '$' || (c) == '_')
197 #define numvalue(c) ((c)>='a' ? (c)-'a'+10 : (c)>='A' ? (c)-'A'+10 : (c)-'0')
199 static int radix_letter(char c)
201 switch (c) {
202 case 'b': case 'B':
203 case 'y': case 'Y':
204 return 2; /* Binary */
205 case 'o': case 'O':
206 case 'q': case 'Q':
207 return 8; /* Octal */
208 case 'h': case 'H':
209 case 'x': case 'X':
210 return 16; /* Hexadecimal */
211 case 'd': case 'D':
212 case 't': case 'T':
213 return 10; /* Decimal */
214 default:
215 return 0; /* Not a known radix letter */
219 int64_t readnum(char *str, bool *error)
221 char *r = str, *q;
222 int32_t pradix, sradix, radix;
223 int plen, slen;
224 uint64_t result, checklimit;
225 int digit, last;
226 bool warn = false;
227 int sign = 1;
229 *error = false;
231 while (isspace(*r))
232 r++; /* find start of number */
235 * If the number came from make_tok_num (as a result of an %assign), it
236 * might have a '-' built into it (rather than in a preceeding token).
238 if (*r == '-') {
239 r++;
240 sign = -1;
243 q = r;
245 while (lib_isnumchar(*q))
246 q++; /* find end of number */
249 * Handle radix formats:
251 * 0<radix-letter><string>
252 * $<string> (hexadecimal)
253 * <string><radix-letter>
255 pradix = sradix = 0;
256 plen = slen = 0;
258 if (*r == '0' && (pradix = radix_letter(r[1])) != 0)
259 plen = 2;
260 else if (*r == '$')
261 pradix = 16, plen = 1;
263 if ((sradix = radix_letter(q[-1])) != 0)
264 slen = 1;
266 if (pradix > sradix) {
267 radix = pradix;
268 r += plen;
269 } else if (sradix > pradix) {
270 radix = sradix;
271 q -= slen;
272 } else {
273 /* Either decimal, or invalid -- if invalid, we'll trip up
274 further down. */
275 radix = 10;
279 * If this number has been found for us by something other than
280 * the ordinary scanners, then it might be malformed by having
281 * nothing between the prefix and the suffix. Check this case
282 * now.
284 if (r >= q) {
285 *error = true;
286 return 0;
290 * `checklimit' must be 2**(32|64) / radix. We can't do that in
291 * 32/64-bit arithmetic, which we're (probably) using, so we
292 * cheat: since we know that all radices we use are even, we
293 * can divide 2**(31|63) by radix/2 instead.
295 if (globalbits == 64)
296 checklimit = 0x8000000000000000ULL / (radix >> 1);
297 else
298 checklimit = 0x80000000UL / (radix >> 1);
301 * Calculate the highest allowable value for the last digit of a
302 * 32-bit constant... in radix 10, it is 6, otherwise it is 0
304 last = (radix == 10 ? 6 : 0);
306 result = 0;
307 while (*r && r < q) {
308 if (*r != '_') {
309 if (*r < '0' || (*r > '9' && *r < 'A')
310 || (digit = numvalue(*r)) >= radix) {
311 *error = true;
312 return 0;
314 if (result > checklimit ||
315 (result == checklimit && digit >= last)) {
316 warn = true;
319 result = radix * result + digit;
321 r++;
324 if (warn)
325 nasm_malloc_error(ERR_WARNING | ERR_PASS1 | ERR_WARN_NOV,
326 "numeric constant %s does not fit in 32 bits",
327 str);
329 return result * sign;
332 int64_t readstrnum(char *str, int length, bool *warn)
334 int64_t charconst = 0;
335 int i;
337 *warn = false;
339 str += length;
340 if (globalbits == 64) {
341 for (i = 0; i < length; i++) {
342 if (charconst & 0xFF00000000000000ULL)
343 *warn = true;
344 charconst = (charconst << 8) + (uint8_t)*--str;
346 } else {
347 for (i = 0; i < length; i++) {
348 if (charconst & 0xFF000000UL)
349 *warn = true;
350 charconst = (charconst << 8) + (uint8_t)*--str;
353 return charconst;
356 static int32_t next_seg;
358 void seg_init(void)
360 next_seg = 0;
363 int32_t seg_alloc(void)
365 return (next_seg += 2) - 2;
368 void fwriteint16_t(int data, FILE * fp)
370 fputc((int)(data & 255), fp);
371 fputc((int)((data >> 8) & 255), fp);
374 void fwriteint32_t(int32_t data, FILE * fp)
376 fputc((int)(data & 255), fp);
377 fputc((int)((data >> 8) & 255), fp);
378 fputc((int)((data >> 16) & 255), fp);
379 fputc((int)((data >> 24) & 255), fp);
382 void fwriteint64_t(int64_t data, FILE * fp)
384 fputc((int)(data & 255), fp);
385 fputc((int)((data >> 8) & 255), fp);
386 fputc((int)((data >> 16) & 255), fp);
387 fputc((int)((data >> 24) & 255), fp);
388 fputc((int)((data >> 32) & 255), fp);
389 fputc((int)((data >> 40) & 255), fp);
390 fputc((int)((data >> 48) & 255), fp);
391 fputc((int)((data >> 56) & 255), fp);
394 void standard_extension(char *inname, char *outname, char *extension,
395 efunc error)
397 char *p, *q;
399 if (*outname) /* file name already exists, */
400 return; /* so do nothing */
401 q = inname;
402 p = outname;
403 while (*q)
404 *p++ = *q++; /* copy, and find end of string */
405 *p = '\0'; /* terminate it */
406 while (p > outname && *--p != '.') ; /* find final period (or whatever) */
407 if (*p != '.')
408 while (*p)
409 p++; /* go back to end if none found */
410 if (!strcmp(p, extension)) { /* is the extension already there? */
411 if (*extension)
412 error(ERR_WARNING | ERR_NOFILE,
413 "file name already ends in `%s': "
414 "output will be in `nasm.out'", extension);
415 else
416 error(ERR_WARNING | ERR_NOFILE,
417 "file name already has no extension: "
418 "output will be in `nasm.out'");
419 strcpy(outname, "nasm.out");
420 } else
421 strcpy(p, extension);
424 #define LEAFSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_LEAF))
425 #define BRANCHSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_BRANCH))
427 #define LAYERSIZ(r) ( (r)->layers==0 ? RAA_BLKSIZE : RAA_LAYERSIZE )
429 static struct RAA *real_raa_init(int layers)
431 struct RAA *r;
432 int i;
434 if (layers == 0) {
435 r = nasm_zalloc(LEAFSIZ);
436 r->stepsize = 1L;
437 } else {
438 r = nasm_malloc(BRANCHSIZ);
439 r->layers = layers;
440 for (i = 0; i < RAA_LAYERSIZE; i++)
441 r->u.b.data[i] = NULL;
442 r->stepsize = RAA_BLKSIZE;
443 while (--layers)
444 r->stepsize *= RAA_LAYERSIZE;
446 return r;
449 struct RAA *raa_init(void)
451 return real_raa_init(0);
454 void raa_free(struct RAA *r)
456 if (r->layers == 0)
457 nasm_free(r);
458 else {
459 struct RAA **p;
460 for (p = r->u.b.data; p - r->u.b.data < RAA_LAYERSIZE; p++)
461 if (*p)
462 raa_free(*p);
466 int32_t raa_read(struct RAA *r, int32_t posn)
468 if (posn >= r->stepsize * LAYERSIZ(r))
469 return 0; /* Return 0 for undefined entries */
470 while (r->layers > 0) {
471 ldiv_t l;
472 l = ldiv(posn, r->stepsize);
473 r = r->u.b.data[l.quot];
474 posn = l.rem;
475 if (!r)
476 return 0; /* Return 0 for undefined entries */
478 return r->u.l.data[posn];
481 struct RAA *raa_write(struct RAA *r, int32_t posn, int32_t value)
483 struct RAA *result;
485 if (posn < 0)
486 nasm_malloc_error(ERR_PANIC, "negative position in raa_write");
488 while (r->stepsize * LAYERSIZ(r) <= posn) {
490 * Must add a layer.
492 struct RAA *s;
493 int i;
495 s = nasm_malloc(BRANCHSIZ);
496 for (i = 0; i < RAA_LAYERSIZE; i++)
497 s->u.b.data[i] = NULL;
498 s->layers = r->layers + 1;
499 s->stepsize = LAYERSIZ(r) * r->stepsize;
500 s->u.b.data[0] = r;
501 r = s;
504 result = r;
506 while (r->layers > 0) {
507 ldiv_t l;
508 struct RAA **s;
509 l = ldiv(posn, r->stepsize);
510 s = &r->u.b.data[l.quot];
511 if (!*s)
512 *s = real_raa_init(r->layers - 1);
513 r = *s;
514 posn = l.rem;
517 r->u.l.data[posn] = value;
519 return result;
522 /* Aggregate SAA components smaller than this */
523 #define SAA_BLKLEN 65536
525 struct SAA *saa_init(size_t elem_len)
527 struct SAA *s;
528 char *data;
530 s = nasm_zalloc(sizeof(struct SAA));
532 if (elem_len >= SAA_BLKLEN)
533 s->blk_len = elem_len;
534 else
535 s->blk_len = SAA_BLKLEN - (SAA_BLKLEN % elem_len);
537 s->elem_len = elem_len;
538 s->length = s->blk_len;
539 data = nasm_malloc(s->blk_len);
540 s->nblkptrs = s->nblks = 1;
541 s->blk_ptrs = nasm_malloc(sizeof(char *));
542 s->blk_ptrs[0] = data;
543 s->wblk = s->rblk = &s->blk_ptrs[0];
545 return s;
548 void saa_free(struct SAA *s)
550 char **p;
551 size_t n;
553 for (p = s->blk_ptrs, n = s->nblks; n; p++, n--)
554 nasm_free(*p);
556 nasm_free(s->blk_ptrs);
557 nasm_free(s);
560 /* Add one allocation block to an SAA */
561 static void saa_extend(struct SAA *s)
563 size_t blkn = s->nblks++;
565 if (blkn >= s->nblkptrs) {
566 size_t rindex = s->rblk - s->blk_ptrs;
567 size_t windex = s->wblk - s->blk_ptrs;
569 s->nblkptrs <<= 1;
570 s->blk_ptrs = nasm_realloc(s->blk_ptrs, s->nblkptrs*sizeof(char *));
572 s->rblk = s->blk_ptrs + rindex;
573 s->wblk = s->blk_ptrs + windex;
576 s->blk_ptrs[blkn] = nasm_malloc(s->blk_len);
577 s->length += s->blk_len;
580 void *saa_wstruct(struct SAA *s)
582 void *p;
584 if (s->wpos % s->elem_len)
585 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
586 "misaligned wpos in saa_wstruct");
588 if (s->wpos + s->elem_len > s->blk_len) {
589 if (s->wpos != s->blk_len)
590 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
591 "unfilled block in saa_wstruct");
593 if (s->wptr + s->elem_len > s->length)
594 saa_extend(s);
595 s->wblk++;
596 s->wpos = 0;
599 p = *s->wblk + s->wpos;
600 s->wpos += s->elem_len;
601 s->wptr += s->elem_len;
603 if (s->wptr > s->datalen)
604 s->datalen = s->wptr;
606 return p;
609 void saa_wbytes(struct SAA *s, const void *data, size_t len)
611 const char *d = data;
613 while (len) {
614 size_t l = s->blk_len - s->wpos;
615 if (l > len)
616 l = len;
617 if (l) {
618 if (d) {
619 memcpy(*s->wblk + s->wpos, d, l);
620 d += l;
621 } else
622 memset(*s->wblk + s->wpos, 0, l);
623 s->wpos += l;
624 s->wptr += l;
625 len -= l;
627 if (s->datalen < s->wptr)
628 s->datalen = s->wptr;
630 if (len) {
631 if (s->wptr >= s->length)
632 saa_extend(s);
633 s->wblk++;
634 s->wpos = 0;
639 void saa_rewind(struct SAA *s)
641 s->rblk = s->blk_ptrs;
642 s->rpos = s->rptr = 0;
645 void *saa_rstruct(struct SAA *s)
647 void *p;
649 if (s->rptr + s->elem_len > s->datalen)
650 return NULL;
652 if (s->rpos % s->elem_len)
653 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
654 "misaligned rpos in saa_rstruct");
656 if (s->rpos + s->elem_len > s->blk_len) {
657 s->rblk++;
658 s->rpos = 0;
661 p = *s->rblk + s->rpos;
662 s->rpos += s->elem_len;
663 s->rptr += s->elem_len;
665 return p;
668 const void *saa_rbytes(struct SAA *s, size_t *lenp)
670 const void *p;
671 size_t len;
673 if (s->rptr >= s->datalen) {
674 *lenp = 0;
675 return NULL;
678 if (s->rpos >= s->blk_len) {
679 s->rblk++;
680 s->rpos = 0;
683 len = *lenp;
684 if (len > s->datalen - s->rptr)
685 len = s->datalen - s->rptr;
686 if (len > s->blk_len - s->rpos)
687 len = s->blk_len - s->rpos;
689 *lenp = len;
690 p = *s->rblk + s->rpos;
692 s->rpos += len;
693 s->rptr += len;
695 return p;
698 void saa_rnbytes(struct SAA *s, void *data, size_t len)
700 char *d = data;
702 if (s->rptr + len > s->datalen) {
703 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_rnbytes");
704 return;
707 while (len) {
708 size_t l;
709 const void *p;
711 l = len;
712 p = saa_rbytes(s, &l);
714 memcpy(d, p, l);
715 d += l;
716 len -= l;
720 /* Same as saa_rnbytes, except position the counter first */
721 void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
723 size_t ix;
725 if (posn+len > s->datalen) {
726 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fread");
727 return;
730 ix = posn / s->blk_len;
731 s->rptr = posn;
732 s->rpos = posn % s->blk_len;
733 s->rblk = &s->blk_ptrs[ix];
735 saa_rnbytes(s, data, len);
738 /* Same as saa_wbytes, except position the counter first */
739 void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
741 size_t ix;
743 if (posn > s->datalen) {
744 /* Seek beyond the end of the existing array not supported */
745 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite");
746 return;
749 ix = posn / s->blk_len;
750 s->wptr = posn;
751 s->wpos = posn % s->blk_len;
752 s->wblk = &s->blk_ptrs[ix];
754 if (!s->wpos) {
755 s->wpos = s->blk_len;
756 s->wblk--;
759 saa_wbytes(s, data, len);
762 void saa_fpwrite(struct SAA *s, FILE * fp)
764 const char *data;
765 size_t len;
767 saa_rewind(s);
768 while (len = s->datalen, (data = saa_rbytes(s, &len)) != NULL)
769 fwrite(data, 1, len, fp);
773 * Common list of prefix names
775 static const char *prefix_names[] = {
776 "a16", "a32", "lock", "o16", "o32", "rep", "repe", "repne",
777 "repnz", "repz", "times"
780 const char *prefix_name(int token)
782 unsigned int prefix = token-PREFIX_ENUM_START;
783 if (prefix > sizeof prefix_names / sizeof(const char *))
784 return NULL;
786 return prefix_names[prefix];
790 * Binary search.
792 int bsi(char *string, const char **array, int size)
794 int i = -1, j = size; /* always, i < index < j */
795 while (j - i >= 2) {
796 int k = (i + j) / 2;
797 int l = strcmp(string, array[k]);
798 if (l < 0) /* it's in the first half */
799 j = k;
800 else if (l > 0) /* it's in the second half */
801 i = k;
802 else /* we've got it :) */
803 return k;
805 return -1; /* we haven't got it :( */
808 int bsii(char *string, const char **array, int size)
810 int i = -1, j = size; /* always, i < index < j */
811 while (j - i >= 2) {
812 int k = (i + j) / 2;
813 int l = nasm_stricmp(string, array[k]);
814 if (l < 0) /* it's in the first half */
815 j = k;
816 else if (l > 0) /* it's in the second half */
817 i = k;
818 else /* we've got it :) */
819 return k;
821 return -1; /* we haven't got it :( */
824 static char *file_name = NULL;
825 static int32_t line_number = 0;
827 char *src_set_fname(char *newname)
829 char *oldname = file_name;
830 file_name = newname;
831 return oldname;
834 int32_t src_set_linnum(int32_t newline)
836 int32_t oldline = line_number;
837 line_number = newline;
838 return oldline;
841 int32_t src_get_linnum(void)
843 return line_number;
846 int src_get(int32_t *xline, char **xname)
848 if (!file_name || !*xname || strcmp(*xname, file_name)) {
849 nasm_free(*xname);
850 *xname = file_name ? nasm_strdup(file_name) : NULL;
851 *xline = line_number;
852 return -2;
854 if (*xline != line_number) {
855 int32_t tmp = line_number - *xline;
856 *xline = line_number;
857 return tmp;
859 return 0;
862 void nasm_quote(char **str)
864 int ln = strlen(*str);
865 char q = (*str)[0];
866 char *p;
867 if (ln > 1 && (*str)[ln - 1] == q && (q == '"' || q == '\''))
868 return;
869 q = '"';
870 if (strchr(*str, q))
871 q = '\'';
872 p = nasm_malloc(ln + 3);
873 strcpy(p + 1, *str);
874 nasm_free(*str);
875 p[ln + 1] = p[0] = q;
876 p[ln + 2] = 0;
877 *str = p;
880 char *nasm_strcat(char *one, char *two)
882 char *rslt;
883 int l1 = strlen(one);
884 rslt = nasm_malloc(l1 + strlen(two) + 1);
885 strcpy(rslt, one);
886 strcpy(rslt + l1, two);
887 return rslt;
890 void null_debug_init(struct ofmt *of, void *id, FILE * fp, efunc error)
892 (void)of;
893 (void)id;
894 (void)fp;
895 (void)error;
897 void null_debug_linenum(const char *filename, int32_t linenumber, int32_t segto)
899 (void)filename;
900 (void)linenumber;
901 (void)segto;
903 void null_debug_deflabel(char *name, int32_t segment, int32_t offset,
904 int is_global, char *special)
906 (void)name;
907 (void)segment;
908 (void)offset;
909 (void)is_global;
910 (void)special;
912 void null_debug_routine(const char *directive, const char *params)
914 (void)directive;
915 (void)params;
917 void null_debug_typevalue(int32_t type)
919 (void)type;
921 void null_debug_output(int type, void *param)
923 (void)type;
924 (void)param;
926 void null_debug_cleanup(void)
930 struct dfmt null_debug_form = {
931 "Null debug format",
932 "null",
933 null_debug_init,
934 null_debug_linenum,
935 null_debug_deflabel,
936 null_debug_routine,
937 null_debug_typevalue,
938 null_debug_output,
939 null_debug_cleanup
942 struct dfmt *null_debug_arr[2] = { &null_debug_form, NULL };