1 |
/* Definitions for macrotab.c and callers, part of bison, |
/* Muscle table manager for Bison, |
2 |
Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
Copyright (C) 2001, 2002 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of Bison, the GNU Compiler Compiler. |
This file is part of Bison, the GNU Compiler Compiler. |
21 |
#ifndef MUSCLE_TAB_H_ |
#ifndef MUSCLE_TAB_H_ |
22 |
# define MUSCLE_TAB_H_ |
# define MUSCLE_TAB_H_ |
23 |
|
|
|
# define MTABSIZE 101 |
|
|
|
|
24 |
typedef struct muscle_entry_s |
typedef struct muscle_entry_s |
25 |
{ |
{ |
26 |
const char *key; |
const char *key; |
27 |
const char *value; |
char *value; |
28 |
} muscle_entry_t; |
} muscle_entry_t; |
29 |
|
|
30 |
void muscle_init PARAMS ((void)); |
void muscle_init PARAMS ((void)); |
31 |
void muscle_insert PARAMS ((const char *key, const char *value)); |
void muscle_insert PARAMS ((const char *key, char *value)); |
32 |
const char *muscle_find PARAMS ((const char *key)); |
char *muscle_find PARAMS ((const char *key)); |
33 |
void muscle_free PARAMS ((void)); |
void muscle_free PARAMS ((void)); |
34 |
|
|
35 |
|
|
57 |
muscle_insert (Key, obstack_finish (&muscle_obstack)); \ |
muscle_insert (Key, obstack_finish (&muscle_obstack)); \ |
58 |
} |
} |
59 |
|
|
60 |
#define MUSCLE_INSERT_PREFIX(Key, Value) \ |
#define MUSCLE_GROW_STRING_PAIR(Key, Value1, Value2) \ |
61 |
{ \ |
{ \ |
62 |
obstack_fgrow2 (&muscle_obstack, "%s%s", \ |
obstack_sgrow (&muscle_obstack, Value1); \ |
63 |
spec_name_prefix ? spec_name_prefix : "yy", Value); \ |
obstack_1grow (&muscle_obstack, 0); \ |
64 |
obstack_1grow (&muscle_obstack, 0); \ |
muscle_insert (Key, obstack_finish (&muscle_obstack)); \ |
|
muscle_insert (Key, obstack_finish (&muscle_obstack)); \ |
|
65 |
} |
} |
66 |
|
|
67 |
|
/* Insert (KEY, VALUE). If KEY already existed, overwrite the |
68 |
|
previous value. Uses MUSCLE_OBSTACK. De-allocates the previously |
69 |
|
associated value. VALUE and SEPARATOR are copied. */ |
70 |
|
|
71 |
|
void muscle_grow PARAMS ((const char *key, |
72 |
|
const char *value, const char *separator)); |
73 |
|
|
74 |
|
/* MUSCLE is an M4 list of pairs. Create or extend it with the pair |
75 |
|
(A1, A2). Note that because the muscle values are output *double* |
76 |
|
quoted, one needs to strip the first level of quotes to reach the |
77 |
|
list itself. */ |
78 |
|
|
79 |
|
void muscle_pair_list_grow PARAMS ((const char *muscle, |
80 |
|
const char *a1, const char *a2)); |
81 |
|
|
82 |
void muscles_m4_output PARAMS ((FILE *out)); |
void muscles_m4_output PARAMS ((FILE *out)); |
83 |
|
|