NASM 2.00rc1
[nasm/avx512.git] / nasmlib.c
blob1d5421cb496c94205fd4c1394f905211836cf65c
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, len;
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 */
248 len = q-r;
249 if (!len) {
250 /* Not numeric */
251 *error = true;
252 return 0;
256 * Handle radix formats:
258 * 0<radix-letter><string>
259 * $<string> (hexadecimal)
260 * <string><radix-letter>
262 pradix = sradix = 0;
263 plen = slen = 0;
265 if (len > 2 && *r == '0' && (pradix = radix_letter(r[1])) != 0)
266 plen = 2;
267 else if (len > 1 && *r == '$')
268 pradix = 16, plen = 1;
270 if (len > 1 && (sradix = radix_letter(q[-1])) != 0)
271 slen = 1;
273 if (pradix > sradix) {
274 radix = pradix;
275 r += plen;
276 } else if (sradix > pradix) {
277 radix = sradix;
278 q -= slen;
279 } else {
280 /* Either decimal, or invalid -- if invalid, we'll trip up
281 further down. */
282 radix = 10;
286 * `checklimit' must be 2**(32|64) / radix. We can't do that in
287 * 32/64-bit arithmetic, which we're (probably) using, so we
288 * cheat: since we know that all radices we use are even, we
289 * can divide 2**(31|63) by radix/2 instead.
291 if (globalbits == 64)
292 checklimit = 0x8000000000000000ULL / (radix >> 1);
293 else
294 checklimit = 0x80000000UL / (radix >> 1);
297 * Calculate the highest allowable value for the last digit of a
298 * 32-bit constant... in radix 10, it is 6, otherwise it is 0
300 last = (radix == 10 ? 6 : 0);
302 result = 0;
303 while (*r && r < q) {
304 if (*r != '_') {
305 if (*r < '0' || (*r > '9' && *r < 'A')
306 || (digit = numvalue(*r)) >= radix) {
307 *error = true;
308 return 0;
310 if (result > checklimit ||
311 (result == checklimit && digit >= last)) {
312 warn = true;
315 result = radix * result + digit;
317 r++;
320 if (warn)
321 nasm_malloc_error(ERR_WARNING | ERR_PASS1 | ERR_WARN_NOV,
322 "numeric constant %s does not fit in 32 bits",
323 str);
325 return result * sign;
328 int64_t readstrnum(char *str, int length, bool *warn)
330 int64_t charconst = 0;
331 int i;
333 *warn = false;
335 str += length;
336 if (globalbits == 64) {
337 for (i = 0; i < length; i++) {
338 if (charconst & 0xFF00000000000000ULL)
339 *warn = true;
340 charconst = (charconst << 8) + (uint8_t)*--str;
342 } else {
343 for (i = 0; i < length; i++) {
344 if (charconst & 0xFF000000UL)
345 *warn = true;
346 charconst = (charconst << 8) + (uint8_t)*--str;
349 return charconst;
352 static int32_t next_seg;
354 void seg_init(void)
356 next_seg = 0;
359 int32_t seg_alloc(void)
361 return (next_seg += 2) - 2;
364 #if X86_MEMORY
366 void fwriteint16_t(uint16_t data, FILE * fp)
368 fwrite(&data, 1, 2, fp);
371 void fwriteint32_t(uint32_t data, FILE * fp)
373 fwrite(&data, 1, 4, fp);
376 void fwriteint64_t(uint64_t data, FILE * fp)
378 fwrite(&data, 1, 8, fp);
381 void fwriteaddr(uint64_t data, int size, FILE * fp)
383 fwrite(&data, 1, size, fp);
386 #else /* !X86_MEMORY */
388 void fwriteint16_t(uint16_t data, FILE * fp)
390 char buffer[2], *p = buffer;
391 WRITESHORT(p, data);
392 fwrite(buffer, 1, 2, fp);
395 void fwriteint32_t(uint32_t data, FILE * fp)
397 char buffer[4], *p = buffer;
398 WRITELONG(p, data);
399 fwrite(buffer, 1, 4, fp);
402 void fwriteint64_t(uint64_t data, FILE * fp)
404 char buffer[8], *p = buffer;
405 WRITEDLONG(p, data);
406 fwrite(buffer, 1, 8, fp);
409 void fwriteaddr(uint64_t data, int size, FILE * fp)
411 char buffer[8], *p = buffer;
412 WRITEADDR(p, data, size);
413 fwrite(buffer, 1, size, fp);
416 #endif
418 void standard_extension(char *inname, char *outname, char *extension,
419 efunc error)
421 char *p, *q;
423 if (*outname) /* file name already exists, */
424 return; /* so do nothing */
425 q = inname;
426 p = outname;
427 while (*q)
428 *p++ = *q++; /* copy, and find end of string */
429 *p = '\0'; /* terminate it */
430 while (p > outname && *--p != '.') ; /* find final period (or whatever) */
431 if (*p != '.')
432 while (*p)
433 p++; /* go back to end if none found */
434 if (!strcmp(p, extension)) { /* is the extension already there? */
435 if (*extension)
436 error(ERR_WARNING | ERR_NOFILE,
437 "file name already ends in `%s': "
438 "output will be in `nasm.out'", extension);
439 else
440 error(ERR_WARNING | ERR_NOFILE,
441 "file name already has no extension: "
442 "output will be in `nasm.out'");
443 strcpy(outname, "nasm.out");
444 } else
445 strcpy(p, extension);
448 #define LEAFSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_LEAF))
449 #define BRANCHSIZ (sizeof(RAA)-sizeof(RAA_UNION)+sizeof(RAA_BRANCH))
451 #define LAYERSIZ(r) ( (r)->layers==0 ? RAA_BLKSIZE : RAA_LAYERSIZE )
453 static struct RAA *real_raa_init(int layers)
455 struct RAA *r;
456 int i;
458 if (layers == 0) {
459 r = nasm_zalloc(LEAFSIZ);
460 r->stepsize = 1L;
461 } else {
462 r = nasm_malloc(BRANCHSIZ);
463 r->layers = layers;
464 for (i = 0; i < RAA_LAYERSIZE; i++)
465 r->u.b.data[i] = NULL;
466 r->stepsize = RAA_BLKSIZE;
467 while (--layers)
468 r->stepsize *= RAA_LAYERSIZE;
470 return r;
473 struct RAA *raa_init(void)
475 return real_raa_init(0);
478 void raa_free(struct RAA *r)
480 if (r->layers == 0)
481 nasm_free(r);
482 else {
483 struct RAA **p;
484 for (p = r->u.b.data; p - r->u.b.data < RAA_LAYERSIZE; p++)
485 if (*p)
486 raa_free(*p);
490 int64_t raa_read(struct RAA *r, int32_t posn)
492 if (posn >= r->stepsize * LAYERSIZ(r))
493 return 0; /* Return 0 for undefined entries */
494 while (r->layers > 0) {
495 ldiv_t l;
496 l = ldiv(posn, r->stepsize);
497 r = r->u.b.data[l.quot];
498 posn = l.rem;
499 if (!r)
500 return 0; /* Return 0 for undefined entries */
502 return r->u.l.data[posn];
505 struct RAA *raa_write(struct RAA *r, int32_t posn, int64_t value)
507 struct RAA *result;
509 if (posn < 0)
510 nasm_malloc_error(ERR_PANIC, "negative position in raa_write");
512 while (r->stepsize * LAYERSIZ(r) <= posn) {
514 * Must add a layer.
516 struct RAA *s;
517 int i;
519 s = nasm_malloc(BRANCHSIZ);
520 for (i = 0; i < RAA_LAYERSIZE; i++)
521 s->u.b.data[i] = NULL;
522 s->layers = r->layers + 1;
523 s->stepsize = LAYERSIZ(r) * r->stepsize;
524 s->u.b.data[0] = r;
525 r = s;
528 result = r;
530 while (r->layers > 0) {
531 ldiv_t l;
532 struct RAA **s;
533 l = ldiv(posn, r->stepsize);
534 s = &r->u.b.data[l.quot];
535 if (!*s)
536 *s = real_raa_init(r->layers - 1);
537 r = *s;
538 posn = l.rem;
541 r->u.l.data[posn] = value;
543 return result;
546 /* Aggregate SAA components smaller than this */
547 #define SAA_BLKLEN 65536
549 struct SAA *saa_init(size_t elem_len)
551 struct SAA *s;
552 char *data;
554 s = nasm_zalloc(sizeof(struct SAA));
556 if (elem_len >= SAA_BLKLEN)
557 s->blk_len = elem_len;
558 else
559 s->blk_len = SAA_BLKLEN - (SAA_BLKLEN % elem_len);
561 s->elem_len = elem_len;
562 s->length = s->blk_len;
563 data = nasm_malloc(s->blk_len);
564 s->nblkptrs = s->nblks = 1;
565 s->blk_ptrs = nasm_malloc(sizeof(char *));
566 s->blk_ptrs[0] = data;
567 s->wblk = s->rblk = &s->blk_ptrs[0];
569 return s;
572 void saa_free(struct SAA *s)
574 char **p;
575 size_t n;
577 for (p = s->blk_ptrs, n = s->nblks; n; p++, n--)
578 nasm_free(*p);
580 nasm_free(s->blk_ptrs);
581 nasm_free(s);
584 /* Add one allocation block to an SAA */
585 static void saa_extend(struct SAA *s)
587 size_t blkn = s->nblks++;
589 if (blkn >= s->nblkptrs) {
590 size_t rindex = s->rblk - s->blk_ptrs;
591 size_t windex = s->wblk - s->blk_ptrs;
593 s->nblkptrs <<= 1;
594 s->blk_ptrs = nasm_realloc(s->blk_ptrs, s->nblkptrs*sizeof(char *));
596 s->rblk = s->blk_ptrs + rindex;
597 s->wblk = s->blk_ptrs + windex;
600 s->blk_ptrs[blkn] = nasm_malloc(s->blk_len);
601 s->length += s->blk_len;
604 void *saa_wstruct(struct SAA *s)
606 void *p;
608 if (s->wpos % s->elem_len)
609 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
610 "misaligned wpos in saa_wstruct");
612 if (s->wpos + s->elem_len > s->blk_len) {
613 if (s->wpos != s->blk_len)
614 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
615 "unfilled block in saa_wstruct");
617 if (s->wptr + s->elem_len > s->length)
618 saa_extend(s);
619 s->wblk++;
620 s->wpos = 0;
623 p = *s->wblk + s->wpos;
624 s->wpos += s->elem_len;
625 s->wptr += s->elem_len;
627 if (s->wptr > s->datalen)
628 s->datalen = s->wptr;
630 return p;
633 void saa_wbytes(struct SAA *s, const void *data, size_t len)
635 const char *d = data;
637 while (len) {
638 size_t l = s->blk_len - s->wpos;
639 if (l > len)
640 l = len;
641 if (l) {
642 if (d) {
643 memcpy(*s->wblk + s->wpos, d, l);
644 d += l;
645 } else
646 memset(*s->wblk + s->wpos, 0, l);
647 s->wpos += l;
648 s->wptr += l;
649 len -= l;
651 if (s->datalen < s->wptr)
652 s->datalen = s->wptr;
654 if (len) {
655 if (s->wptr >= s->length)
656 saa_extend(s);
657 s->wblk++;
658 s->wpos = 0;
663 void saa_rewind(struct SAA *s)
665 s->rblk = s->blk_ptrs;
666 s->rpos = s->rptr = 0;
669 void *saa_rstruct(struct SAA *s)
671 void *p;
673 if (s->rptr + s->elem_len > s->datalen)
674 return NULL;
676 if (s->rpos % s->elem_len)
677 nasm_malloc_error(ERR_PANIC|ERR_NOFILE,
678 "misaligned rpos in saa_rstruct");
680 if (s->rpos + s->elem_len > s->blk_len) {
681 s->rblk++;
682 s->rpos = 0;
685 p = *s->rblk + s->rpos;
686 s->rpos += s->elem_len;
687 s->rptr += s->elem_len;
689 return p;
692 const void *saa_rbytes(struct SAA *s, size_t *lenp)
694 const void *p;
695 size_t len;
697 if (s->rptr >= s->datalen) {
698 *lenp = 0;
699 return NULL;
702 if (s->rpos >= s->blk_len) {
703 s->rblk++;
704 s->rpos = 0;
707 len = *lenp;
708 if (len > s->datalen - s->rptr)
709 len = s->datalen - s->rptr;
710 if (len > s->blk_len - s->rpos)
711 len = s->blk_len - s->rpos;
713 *lenp = len;
714 p = *s->rblk + s->rpos;
716 s->rpos += len;
717 s->rptr += len;
719 return p;
722 void saa_rnbytes(struct SAA *s, void *data, size_t len)
724 char *d = data;
726 if (s->rptr + len > s->datalen) {
727 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_rnbytes");
728 return;
731 while (len) {
732 size_t l;
733 const void *p;
735 l = len;
736 p = saa_rbytes(s, &l);
738 memcpy(d, p, l);
739 d += l;
740 len -= l;
744 /* Same as saa_rnbytes, except position the counter first */
745 void saa_fread(struct SAA *s, size_t posn, void *data, size_t len)
747 size_t ix;
749 if (posn+len > s->datalen) {
750 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fread");
751 return;
754 ix = posn / s->blk_len;
755 s->rptr = posn;
756 s->rpos = posn % s->blk_len;
757 s->rblk = &s->blk_ptrs[ix];
759 saa_rnbytes(s, data, len);
762 /* Same as saa_wbytes, except position the counter first */
763 void saa_fwrite(struct SAA *s, size_t posn, const void *data, size_t len)
765 size_t ix;
767 if (posn > s->datalen) {
768 /* Seek beyond the end of the existing array not supported */
769 nasm_malloc_error(ERR_PANIC|ERR_NOFILE, "overrun in saa_fwrite");
770 return;
773 ix = posn / s->blk_len;
774 s->wptr = posn;
775 s->wpos = posn % s->blk_len;
776 s->wblk = &s->blk_ptrs[ix];
778 if (!s->wpos) {
779 s->wpos = s->blk_len;
780 s->wblk--;
783 saa_wbytes(s, data, len);
786 void saa_fpwrite(struct SAA *s, FILE * fp)
788 const char *data;
789 size_t len;
791 saa_rewind(s);
792 while (len = s->datalen, (data = saa_rbytes(s, &len)) != NULL)
793 fwrite(data, 1, len, fp);
797 * Common list of prefix names
799 static const char *prefix_names[] = {
800 "a16", "a32", "lock", "o16", "o32", "rep", "repe", "repne",
801 "repnz", "repz", "times"
804 const char *prefix_name(int token)
806 unsigned int prefix = token-PREFIX_ENUM_START;
807 if (prefix > elements(prefix_names))
808 return NULL;
810 return prefix_names[prefix];
814 * Binary search.
816 int bsi(const char *string, const char **array, int size)
818 int i = -1, j = size; /* always, i < index < j */
819 while (j - i >= 2) {
820 int k = (i + j) / 2;
821 int l = strcmp(string, array[k]);
822 if (l < 0) /* it's in the first half */
823 j = k;
824 else if (l > 0) /* it's in the second half */
825 i = k;
826 else /* we've got it :) */
827 return k;
829 return -1; /* we haven't got it :( */
832 int bsii(const char *string, const char **array, int size)
834 int i = -1, j = size; /* always, i < index < j */
835 while (j - i >= 2) {
836 int k = (i + j) / 2;
837 int l = nasm_stricmp(string, array[k]);
838 if (l < 0) /* it's in the first half */
839 j = k;
840 else if (l > 0) /* it's in the second half */
841 i = k;
842 else /* we've got it :) */
843 return k;
845 return -1; /* we haven't got it :( */
848 static char *file_name = NULL;
849 static int32_t line_number = 0;
851 char *src_set_fname(char *newname)
853 char *oldname = file_name;
854 file_name = newname;
855 return oldname;
858 int32_t src_set_linnum(int32_t newline)
860 int32_t oldline = line_number;
861 line_number = newline;
862 return oldline;
865 int32_t src_get_linnum(void)
867 return line_number;
870 int src_get(int32_t *xline, char **xname)
872 if (!file_name || !*xname || strcmp(*xname, file_name)) {
873 nasm_free(*xname);
874 *xname = file_name ? nasm_strdup(file_name) : NULL;
875 *xline = line_number;
876 return -2;
878 if (*xline != line_number) {
879 int32_t tmp = line_number - *xline;
880 *xline = line_number;
881 return tmp;
883 return 0;
886 void nasm_quote(char **str)
888 int ln = strlen(*str);
889 char q = (*str)[0];
890 char *p;
891 if (ln > 1 && (*str)[ln - 1] == q && (q == '"' || q == '\''))
892 return;
893 q = '"';
894 if (strchr(*str, q))
895 q = '\'';
896 p = nasm_malloc(ln + 3);
897 strcpy(p + 1, *str);
898 nasm_free(*str);
899 p[ln + 1] = p[0] = q;
900 p[ln + 2] = 0;
901 *str = p;
904 char *nasm_strcat(char *one, char *two)
906 char *rslt;
907 int l1 = strlen(one);
908 rslt = nasm_malloc(l1 + strlen(two) + 1);
909 strcpy(rslt, one);
910 strcpy(rslt + l1, two);
911 return rslt;
914 void null_debug_init(struct ofmt *of, void *id, FILE * fp, efunc error)
916 (void)of;
917 (void)id;
918 (void)fp;
919 (void)error;
921 void null_debug_linenum(const char *filename, int32_t linenumber, int32_t segto)
923 (void)filename;
924 (void)linenumber;
925 (void)segto;
927 void null_debug_deflabel(char *name, int32_t segment, int64_t offset,
928 int is_global, char *special)
930 (void)name;
931 (void)segment;
932 (void)offset;
933 (void)is_global;
934 (void)special;
936 void null_debug_routine(const char *directive, const char *params)
938 (void)directive;
939 (void)params;
941 void null_debug_typevalue(int32_t type)
943 (void)type;
945 void null_debug_output(int type, void *param)
947 (void)type;
948 (void)param;
950 void null_debug_cleanup(void)
954 struct dfmt null_debug_form = {
955 "Null debug format",
956 "null",
957 null_debug_init,
958 null_debug_linenum,
959 null_debug_deflabel,
960 null_debug_routine,
961 null_debug_typevalue,
962 null_debug_output,
963 null_debug_cleanup
966 struct dfmt *null_debug_arr[2] = { &null_debug_form, NULL };