1 /* macro.c - macro support for gas and gasp
2 Copyright (C) 1994, 1995 Free Software Foundation, Inc.
4 Written by Steve and Judy Chamberlain of Cygnus Support,
7 This file is part of GAS, the GNU Assembler.
9 GAS is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
14 GAS is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with GAS; see the file COPYING. If not, write to the Free
21 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
35 #include "libiberty.h"
40 /* The routines in this file handle macro definition and expansion.
41 They are called by both gasp and gas. */
43 /* Structures used to store macros.
45 Each macro knows its name and included text. It gets built with a
46 list of formal arguments, and also keeps a hash table which points
47 into the list to speed up formal search. Each formal knows its
48 name and its default value. Each time the macro is expanded, the
49 formals get the actual values attatched to them. */
51 /* describe the formal arguments to a macro */
53 typedef struct formal_struct
55 struct formal_struct
*next
; /* next formal in list */
56 sb name
; /* name of the formal */
57 sb def
; /* the default value */
58 sb actual
; /* the actual argument (changed on each expansion) */
59 int index
; /* the index of the formal 0..formal_count-1 */
63 /* Other values found in the index field of a formal_entry. */
64 #define QUAL_INDEX (-1)
65 #define NARG_INDEX (-2)
66 #define LOCAL_INDEX (-3)
68 /* describe the macro. */
70 typedef struct macro_struct
72 sb sub
; /* substitution text. */
73 int formal_count
; /* number of formal args. */
74 formal_entry
*formals
; /* pointer to list of formal_structs */
75 struct hash_control
*formal_hash
; /* hash table of formals. */
79 /* Internal functions. */
81 static int get_token
PARAMS ((int, sb
*, sb
*));
82 static int getstring
PARAMS ((int, sb
*, sb
*));
83 static int get_any_string
PARAMS ((int, sb
*, sb
*, int, int));
84 static int do_formals
PARAMS ((macro_entry
*, int, sb
*));
85 static int get_apost_token
PARAMS ((int, sb
*, sb
*, int));
87 PARAMS ((int, sb
*, sb
*, struct hash_control
*, int, sb
*, int));
88 static const char *macro_expand_body
89 PARAMS ((sb
*, sb
*, formal_entry
*, struct hash_control
*, int, int));
90 static const char *macro_expand
PARAMS ((int, sb
*, macro_entry
*, sb
*, int));
92 #define ISWHITE(x) ((x) == ' ' || (x) == '\t')
95 ((x) == ' ' || (x) == '\t' || (x) == ',' || (x) == '"' || (x) == ';' \
96 || (x) == '<' || (x) == '>' || (x) == ')' || (x) == '(')
99 ((x) == 'b' || (x) == 'B' \
100 || (x) == 'q' || (x) == 'Q' \
101 || (x) == 'h' || (x) == 'H' \
102 || (x) == 'd' || (x) == 'D')
104 /* The macro hash table. */
106 static struct hash_control
*macro_hash
;
108 /* Whether any macros have been defined. */
112 /* Whether we are in GASP alternate mode. */
114 static int macro_alternate
;
116 /* Whether we are in MRI mode. */
118 static int macro_mri
;
120 /* Whether we should strip '@' characters. */
122 static int macro_strip_at
;
124 /* Function to use to parse an expression. */
126 static int (*macro_expr
) PARAMS ((const char *, int, sb
*, int *));
128 /* Number of macro expansions that have been done. */
130 static int macro_number
;
132 /* Initialize macro processing. */
135 macro_init (alternate
, mri
, strip_at
, expr
)
139 int (*expr
) PARAMS ((const char *, int, sb
*, int *));
141 macro_hash
= hash_new ();
143 macro_alternate
= alternate
;
145 macro_strip_at
= strip_at
;
149 /* Read input lines till we get to a TO string.
150 Increase nesting depth if we get a FROM string.
151 Put the results into sb at PTR.
152 Add a new input line to an sb using GET_LINE.
153 Return 1 on success, 0 on unexpected EOF. */
156 buffer_and_nest (from
, to
, ptr
, get_line
)
160 int (*get_line
) PARAMS ((sb
*));
162 int from_len
= strlen (from
);
163 int to_len
= strlen (to
);
165 int line_start
= ptr
->len
;
167 int more
= get_line (ptr
);
171 /* Try and find the first pseudo op on the line */
174 if (! macro_alternate
&& ! macro_mri
)
176 /* With normal syntax we can suck what we want till we get
177 to the dot. With the alternate, labels have to start in
178 the first column, since we cant tell what's a label and
181 /* Skip leading whitespace */
182 while (i
< ptr
->len
&& ISWHITE (ptr
->ptr
[i
]))
185 /* Skip over a label */
187 && (isalnum ((unsigned char) ptr
->ptr
[i
])
188 || ptr
->ptr
[i
] == '_'
189 || ptr
->ptr
[i
] == '$'))
194 && ptr
->ptr
[i
] == ':')
198 /* Skip trailing whitespace */
199 while (i
< ptr
->len
&& ISWHITE (ptr
->ptr
[i
]))
202 if (i
< ptr
->len
&& (ptr
->ptr
[i
] == '.'
206 if (ptr
->ptr
[i
] == '.')
208 if (strncasecmp (ptr
->ptr
+ i
, from
, from_len
) == 0)
210 if (strncasecmp (ptr
->ptr
+ i
, to
, to_len
) == 0)
215 /* Reset the string to not include the ending rune */
216 ptr
->len
= line_start
;
222 /* Add a CR to the end and keep running */
223 sb_add_char (ptr
, '\n');
224 line_start
= ptr
->len
;
225 more
= get_line (ptr
);
228 /* Return 1 on success, 0 on unexpected EOF. */
232 /* Pick up a token. */
235 get_token (idx
, in
, name
)
241 && (isalpha ((unsigned char) in
->ptr
[idx
])
242 || in
->ptr
[idx
] == '_'
243 || in
->ptr
[idx
] == '$'))
245 sb_add_char (name
, in
->ptr
[idx
++]);
247 && (isalnum ((unsigned char) in
->ptr
[idx
])
248 || in
->ptr
[idx
] == '_'
249 || in
->ptr
[idx
] == '$'))
251 sb_add_char (name
, in
->ptr
[idx
++]);
254 /* Ignore trailing & */
255 if (macro_alternate
&& idx
< in
->len
&& in
->ptr
[idx
] == '&')
260 /* Pick up a string. */
263 getstring (idx
, in
, acc
)
268 idx
= sb_skip_white (idx
, in
);
271 && (in
->ptr
[idx
] == '"'
272 || in
->ptr
[idx
] == '<'
273 || (in
->ptr
[idx
] == '\'' && macro_alternate
)))
275 if (in
->ptr
[idx
] == '<')
277 if (macro_alternate
|| macro_mri
)
281 while ((in
->ptr
[idx
] != '>' || nest
)
284 if (in
->ptr
[idx
] == '!')
287 sb_add_char (acc
, in
->ptr
[idx
++]);
291 if (in
->ptr
[idx
] == '>')
293 if (in
->ptr
[idx
] == '<')
295 sb_add_char (acc
, in
->ptr
[idx
++]);
305 ("character code in string must be absolute expression",
307 sb_add_char (acc
, code
);
310 if (in
->ptr
[idx
] != '>')
311 ERROR ((stderr
, "Missing > for character code.\n"));
316 else if (in
->ptr
[idx
] == '"' || in
->ptr
[idx
] == '\'')
318 char tchar
= in
->ptr
[idx
];
320 while (idx
< in
->len
)
322 if (macro_alternate
&& in
->ptr
[idx
] == '!')
325 sb_add_char (acc
, in
->ptr
[idx
++]);
329 if (in
->ptr
[idx
] == tchar
)
332 if (idx
>= in
->len
|| in
->ptr
[idx
] != tchar
)
335 sb_add_char (acc
, in
->ptr
[idx
]);
345 /* Fetch string from the input stream,
347 'Bxyx<whitespace> -> return 'Bxyza
348 %<char> -> return string of decimal value of x
349 "<string>" -> return string
350 xyx<whitespace> -> return xyz
354 get_any_string (idx
, in
, out
, expand
, pretend_quoted
)
362 idx
= sb_skip_white (idx
, in
);
366 if (in
->len
> 2 && in
->ptr
[idx
+1] == '\'' && ISBASE (in
->ptr
[idx
]))
368 while (!ISSEP (in
->ptr
[idx
]))
369 sb_add_char (out
, in
->ptr
[idx
++]);
371 else if (in
->ptr
[idx
] == '%'
377 /* Turns the next expression into a string */
378 idx
= (*macro_expr
) ("% operator needs absolute expression",
382 sprintf(buf
, "%d", val
);
383 sb_add_string (out
, buf
);
385 else if (in
->ptr
[idx
] == '"'
386 || in
->ptr
[idx
] == '<'
387 || (macro_alternate
&& in
->ptr
[idx
] == '\''))
393 /* Keep the quotes */
394 sb_add_char (out
, '\"');
396 idx
= getstring (idx
, in
, out
);
397 sb_add_char (out
, '\"');
401 idx
= getstring (idx
, in
, out
);
407 && (in
->ptr
[idx
] == '"'
408 || in
->ptr
[idx
] == '\''
410 || (in
->ptr
[idx
] != ' '
411 && in
->ptr
[idx
] != '\t'
412 && in
->ptr
[idx
] != ','
413 && in
->ptr
[idx
] != '<')))
415 if (in
->ptr
[idx
] == '"'
416 || in
->ptr
[idx
] == '\'')
418 char tchar
= in
->ptr
[idx
];
419 sb_add_char (out
, in
->ptr
[idx
++]);
421 && in
->ptr
[idx
] != tchar
)
422 sb_add_char (out
, in
->ptr
[idx
++]);
426 sb_add_char (out
, in
->ptr
[idx
++]);
434 /* Pick up the formal parameters of a macro definition. */
437 do_formals (macro
, idx
, in
)
442 formal_entry
**p
= ¯o
->formals
;
444 macro
->formal_count
= 0;
445 macro
->formal_hash
= hash_new ();
446 while (idx
< in
->len
)
448 formal_entry
*formal
;
450 formal
= (formal_entry
*) xmalloc (sizeof (formal_entry
));
452 sb_new (&formal
->name
);
453 sb_new (&formal
->def
);
454 sb_new (&formal
->actual
);
456 idx
= sb_skip_white (idx
, in
);
457 idx
= get_token (idx
, in
, &formal
->name
);
458 if (formal
->name
.len
== 0)
460 idx
= sb_skip_white (idx
, in
);
461 if (formal
->name
.len
)
463 /* This is a formal */
464 if (idx
< in
->len
&& in
->ptr
[idx
] == '=')
467 idx
= get_any_string (idx
+ 1, in
, &formal
->def
, 1, 0);
471 /* Add to macro's hash table */
472 hash_jam (macro
->formal_hash
, sb_terminate (&formal
->name
), formal
);
474 formal
->index
= macro
->formal_count
;
475 idx
= sb_skip_comma (idx
, in
);
476 macro
->formal_count
++;
484 formal_entry
*formal
;
487 /* Add a special NARG formal, which macro_expand will set to the
488 number of arguments. */
489 formal
= (formal_entry
*) xmalloc (sizeof (formal_entry
));
491 sb_new (&formal
->name
);
492 sb_new (&formal
->def
);
493 sb_new (&formal
->actual
);
495 /* The same MRI assemblers which treat '@' characters also use
496 the name $NARG. At least until we find an exception. */
502 sb_add_string (&formal
->name
, name
);
504 /* Add to macro's hash table */
505 hash_jam (macro
->formal_hash
, name
, formal
);
507 formal
->index
= NARG_INDEX
;
515 /* Define a new macro. Returns NULL on success, otherwise returns an
519 define_macro (idx
, in
, label
, get_line
)
523 int (*get_line
) PARAMS ((sb
*));
528 macro
= (macro_entry
*) xmalloc (sizeof (macro_entry
));
529 sb_new (¯o
->sub
);
532 macro
->formal_count
= 0;
535 idx
= sb_skip_white (idx
, in
);
536 if (! buffer_and_nest ("MACRO", "ENDM", ¯o
->sub
, get_line
))
537 return "unexpected end of file in macro definition";
538 if (label
!= NULL
&& label
->len
!= 0)
540 sb_add_sb (&name
, label
);
541 if (in
->ptr
[idx
] == '(')
543 /* It's the label: MACRO (formals,...) sort */
544 idx
= do_formals (macro
, idx
+ 1, in
);
545 if (in
->ptr
[idx
] != ')')
546 return "missing ) after formals";
550 /* It's the label: MACRO formals,... sort */
551 idx
= do_formals (macro
, idx
, in
);
556 idx
= get_token (idx
, in
, &name
);
557 idx
= sb_skip_comma (idx
, in
);
558 idx
= do_formals (macro
, idx
, in
);
561 /* and stick it in the macro hash table */
562 for (idx
= 0; idx
< name
.len
; idx
++)
563 if (isupper (name
.ptr
[idx
]))
564 name
.ptr
[idx
] = tolower (name
.ptr
[idx
]);
565 hash_jam (macro_hash
, sb_terminate (&name
), (PTR
) macro
);
572 /* Scan a token, and then skip KIND. */
575 get_apost_token (idx
, in
, name
, kind
)
581 idx
= get_token (idx
, in
, name
);
583 && in
->ptr
[idx
] == kind
584 && (! macro_mri
|| macro_strip_at
)
585 && (! macro_strip_at
|| kind
== '@'))
590 /* Substitute the actual value for a formal parameter. */
593 sub_actual (start
, in
, t
, formal_hash
, kind
, out
, copyifnotthere
)
597 struct hash_control
*formal_hash
;
605 src
= get_apost_token (start
, in
, t
, kind
);
606 /* See if it's in the macro's hash table, unless this is
607 macro_strip_at and kind is '@' and the token did not end in '@'. */
610 && (src
== start
|| in
->ptr
[src
- 1] != '@'))
613 ptr
= (formal_entry
*) hash_find (formal_hash
, sb_terminate (t
));
618 sb_add_sb (out
, &ptr
->actual
);
622 sb_add_sb (out
, &ptr
->def
);
625 else if (copyifnotthere
)
631 sb_add_char (out
, '\\');
637 /* Expand the body of a macro. */
640 macro_expand_body (in
, out
, formals
, formal_hash
, comment_char
, locals
)
643 formal_entry
*formals
;
644 struct hash_control
*formal_hash
;
651 formal_entry
*loclist
= NULL
;
655 while (src
< in
->len
)
657 if (in
->ptr
[src
] == '&')
660 if (macro_mri
&& src
+ 1 < in
->len
&& in
->ptr
[src
+ 1] == '&')
662 src
= sub_actual (src
+ 2, in
, &t
, formal_hash
, '\'', out
, 1);
666 src
= sub_actual (src
+ 1, in
, &t
, formal_hash
, '&', out
, 0);
669 else if (in
->ptr
[src
] == '\\')
672 if (in
->ptr
[src
] == comment_char
&& comment_char
!= '\0')
674 /* This is a comment, just drop the rest of the line */
676 && in
->ptr
[src
] != '\n')
679 else if (in
->ptr
[src
] == '(')
681 /* Sub in till the next ')' literally */
683 while (src
< in
->len
&& in
->ptr
[src
] != ')')
685 sb_add_char (out
, in
->ptr
[src
++]);
687 if (in
->ptr
[src
] == ')')
690 return "missplaced )";
692 else if (in
->ptr
[src
] == '@')
694 /* Sub in the macro invocation number */
698 sprintf (buffer
, "%05d", macro_number
);
699 sb_add_string (out
, buffer
);
701 else if (in
->ptr
[src
] == '&')
703 /* This is a preprocessor variable name, we don't do them
705 sb_add_char (out
, '\\');
706 sb_add_char (out
, '&');
710 && isalnum ((unsigned char) in
->ptr
[src
]))
715 if (isdigit ((unsigned char) in
->ptr
[src
]))
716 ind
= in
->ptr
[src
] - '0';
717 else if (isupper ((unsigned char) in
->ptr
[src
]))
718 ind
= in
->ptr
[src
] - 'A' + 10;
720 ind
= in
->ptr
[src
] - 'a' + 10;
722 for (f
= formals
; f
!= NULL
; f
= f
->next
)
724 if (f
->index
== ind
- 1)
726 if (f
->actual
.len
!= 0)
727 sb_add_sb (out
, &f
->actual
);
729 sb_add_sb (out
, &f
->def
);
737 src
= sub_actual (src
, in
, &t
, formal_hash
, '\'', out
, 0);
740 else if ((macro_alternate
|| macro_mri
)
741 && (isalpha ((unsigned char) in
->ptr
[src
])
742 || in
->ptr
[src
] == '_'
743 || in
->ptr
[src
] == '$')
746 || (src
> 0 && in
->ptr
[src
- 1] == '@')))
749 || src
+ 5 >= in
->len
750 || strncasecmp (in
->ptr
+ src
, "LOCAL", 5) != 0
751 || ! ISWHITE (in
->ptr
[src
+ 5]))
754 src
= sub_actual (src
, in
, &t
, formal_hash
,
755 (macro_strip_at
&& inquote
) ? '@' : '\'',
762 src
= sb_skip_white (src
+ 5, in
);
763 while (in
->ptr
[src
] != '\n' && in
->ptr
[src
] != comment_char
)
769 f
= (formal_entry
*) xmalloc (sizeof (formal_entry
));
773 f
->index
= LOCAL_INDEX
;
777 src
= get_token (src
, in
, &f
->name
);
779 sprintf (buf
, "LL%04x", loccnt
);
780 sb_add_string (&f
->actual
, buf
);
782 err
= hash_jam (formal_hash
, sb_terminate (&f
->name
), f
);
786 src
= sb_skip_comma (src
, in
);
790 else if (comment_char
!= '\0'
791 && in
->ptr
[src
] == comment_char
793 && in
->ptr
[src
+ 1] == comment_char
796 /* Two comment chars in a row cause the rest of the line to
798 while (src
< in
->len
&& in
->ptr
[src
] != '\n')
801 else if (in
->ptr
[src
] == '"'
802 || (macro_mri
&& in
->ptr
[src
] == '\''))
805 sb_add_char (out
, in
->ptr
[src
++]);
807 else if (in
->ptr
[src
] == '@' && macro_strip_at
)
811 && in
->ptr
[src
] == '@')
813 sb_add_char (out
, '@');
818 && in
->ptr
[src
] == '='
820 && in
->ptr
[src
+ 1] == '=')
825 src
= get_token (src
+ 2, in
, &t
);
826 ptr
= (formal_entry
*) hash_find (formal_hash
, sb_terminate (&t
));
828 return "macro formal argument does not exist";
833 sb_add_string (out
, "-1");
837 sb_add_char (out
, '0');
843 sb_add_char (out
, in
->ptr
[src
++]);
849 while (loclist
!= NULL
)
854 hash_delete (formal_hash
, sb_terminate (&loclist
->name
));
855 sb_kill (&loclist
->name
);
856 sb_kill (&loclist
->def
);
857 sb_kill (&loclist
->actual
);
865 /* Assign values to the formal parameters of a macro, and expand the
869 macro_expand (idx
, in
, m
, out
, comment_char
)
879 int is_positional
= 0;
886 /* Reset any old value the actuals may have */
887 for (f
= m
->formals
; f
; f
= f
->next
)
888 sb_reset (&f
->actual
);
890 while (f
!= NULL
&& f
->index
< 0)
895 /* The macro may be called with an optional qualifier, which may
896 be referred to in the macro body as \0. */
897 if (idx
< in
->len
&& in
->ptr
[idx
] == '.')
901 n
= (formal_entry
*) xmalloc (sizeof (formal_entry
));
905 n
->index
= QUAL_INDEX
;
907 n
->next
= m
->formals
;
910 idx
= get_any_string (idx
+ 1, in
, &n
->actual
, 1, 0);
914 /* Peel off the actuals and store them away in the hash tables' actuals */
915 idx
= sb_skip_white (idx
, in
);
916 while (idx
< in
->len
&& in
->ptr
[idx
] != comment_char
)
920 /* Look and see if it's a positional or keyword arg */
922 while (scan
< in
->len
923 && !ISSEP (in
->ptr
[scan
])
924 && (!macro_alternate
&& in
->ptr
[scan
] != '='))
926 if (scan
< in
->len
&& !macro_alternate
&& in
->ptr
[scan
] == '=')
930 return "can't mix positional and keyword arguments";
932 /* This is a keyword arg, fetch the formal name and
933 then the actual stuff */
935 idx
= get_token (idx
, in
, &t
);
936 if (in
->ptr
[idx
] != '=')
937 return "confusion in formal parameters";
939 /* Lookup the formal in the macro's list */
940 ptr
= (formal_entry
*) hash_find (m
->formal_hash
, sb_terminate (&t
));
942 return "macro formal argument does not exist";
945 /* Insert this value into the right place */
946 sb_reset (&ptr
->actual
);
947 idx
= get_any_string (idx
+ 1, in
, &ptr
->actual
, 0, 0);
948 if (ptr
->actual
.len
> 0)
954 /* This is a positional arg */
957 return "can't mix positional and keyword arguments";
965 return "too many positional arguments";
967 f
= (formal_entry
*) xmalloc (sizeof (formal_entry
));
974 for (pf
= &m
->formals
; *pf
!= NULL
; pf
= &(*pf
)->next
)
975 if ((*pf
)->index
>= c
)
976 c
= (*pf
)->index
+ 1;
983 sb_reset (&f
->actual
);
984 idx
= get_any_string (idx
, in
, &f
->actual
, 1, 0);
985 if (f
->actual
.len
> 0)
991 while (f
!= NULL
&& f
->index
< 0);
995 idx
= sb_skip_comma (idx
, in
);
998 if (in
->ptr
[idx
] == ',')
1000 if (ISWHITE (in
->ptr
[idx
]))
1010 sb_add_string (&t
, macro_strip_at
? "$NARG" : "NARG");
1011 ptr
= (formal_entry
*) hash_find (m
->formal_hash
, sb_terminate (&t
));
1012 sb_reset (&ptr
->actual
);
1013 sprintf (buffer
, "%d", narg
);
1014 sb_add_string (&ptr
->actual
, buffer
);
1017 err
= macro_expand_body (&m
->sub
, out
, m
->formals
, m
->formal_hash
,
1022 /* Discard any unnamed formal arguments. */
1030 if ((*pf
)->name
.len
!= 0)
1034 sb_kill (&(*pf
)->name
);
1035 sb_kill (&(*pf
)->def
);
1036 sb_kill (&(*pf
)->actual
);
1050 /* Check for a macro. If one is found, put the expansion into
1051 *EXPAND. COMMENT_CHAR is the comment character--this is used by
1052 gasp. Return 1 if a macro is found, 0 otherwise. */
1055 check_macro (line
, expand
, comment_char
, error
)
1066 if (! isalpha ((unsigned char) *line
)
1069 && (! macro_mri
|| *line
!= '.'))
1073 while (isalnum ((unsigned char) *s
)
1078 copy
= (char *) xmalloc (s
- line
+ 1);
1079 memcpy (copy
, line
, s
- line
);
1080 copy
[s
- line
] = '\0';
1081 for (cs
= copy
; *cs
!= '\0'; cs
++)
1083 *cs
= tolower (*cs
);
1085 macro
= (macro_entry
*) hash_find (macro_hash
, copy
);
1090 /* Wrap the line up in an sb. */
1092 while (*s
!= '\0' && *s
!= '\n' && *s
!= '\r')
1093 sb_add_char (&line_sb
, *s
++);
1096 *error
= macro_expand (0, &line_sb
, macro
, expand
, comment_char
);
1103 /* Delete a macro. */
1109 hash_delete (macro_hash
, name
);
1112 /* Handle the MRI IRP and IRPC pseudo-ops. These are handled as a
1113 combined macro definition and execution. This returns NULL on
1114 success, or an error message otherwise. */
1117 expand_irp (irpc
, idx
, in
, out
, get_line
, comment_char
)
1122 int (*get_line
) PARAMS ((sb
*));
1128 struct hash_control
*h
;
1136 idx
= sb_skip_white (idx
, in
);
1139 if (! buffer_and_nest (mn
, "ENDR", &sub
, get_line
))
1140 return "unexpected end of file in irp or irpc";
1146 idx
= get_token (idx
, in
, &f
.name
);
1147 if (f
.name
.len
== 0)
1148 return "missing model parameter";
1151 err
= hash_jam (h
, sb_terminate (&f
.name
), &f
);
1160 idx
= sb_skip_comma (idx
, in
);
1161 if (idx
>= in
->len
|| in
->ptr
[idx
] == comment_char
)
1163 /* Expand once with a null string. */
1164 err
= macro_expand_body (&sub
, out
, &f
, h
, comment_char
, 0);
1170 if (irpc
&& in
->ptr
[idx
] == '"')
1172 while (idx
< in
->len
&& in
->ptr
[idx
] != comment_char
)
1175 idx
= get_any_string (idx
, in
, &f
.actual
, 1, 0);
1178 if (in
->ptr
[idx
] == '"')
1182 nxt
= sb_skip_white (idx
+ 1, in
);
1183 if (nxt
>= in
->len
|| in
->ptr
[nxt
] == comment_char
)
1189 sb_reset (&f
.actual
);
1190 sb_add_char (&f
.actual
, in
->ptr
[idx
]);
1193 err
= macro_expand_body (&sub
, out
, &f
, h
, comment_char
, 0);
1197 idx
= sb_skip_comma (idx
, in
);
1199 idx
= sb_skip_white (idx
, in
);
This page took 0.078238 seconds and 4 git commands to generate.