+2023-02-07 Tom Tromey <tom@tromey.com>
+
+ * syms.c (bfd_decode_symclass, bfd_is_undefined_symclass)
+ (bfd_symbol_info): Reorder documentation comment.
+ * doc/doc.str (synopsis_seen): New variable.
+ (SYNOPSIS): Set synopsis_seen. Emit @deftypefn.
+ (DESCRIPTION): Use synopsis_seen.
+ * doc/chew.c (catstrif): New function.
+ (main): Add catstrif intrinsic.
+ (compile): Recognize "variable" command.
+
2023-02-07 Tom Tromey <tom@tromey.com>
* doc/proto.str (external, internal, ifinternal, ENUMEQ, ENUMDOC):
You define new words thus:
: <newword> <oldwords> ;
+ Variables are defined using:
+ variable NAME
+
*/
/* Primitives provided by the program:
outputdots - strip out lines without leading dots
maybecatstr - do catstr if internal_mode == internal_wanted, discard
value in any case
+ catstrif - do catstr if top of integer stack is nonzero
translatecomments - turn {* and *} into comment delimiters
kill_bogus_lines - get rid of extra newlines
indent
pc++;
}
+static void
+catstrif (void)
+{
+ int cond = isp[0];
+ isp--;
+ icheck_range ();
+ if (cond)
+ catstr (tos - 1, tos);
+ delete_string (tos);
+ tos--;
+ check_range ();
+ pc++;
+}
+
char *
nextword (char *string, char **word)
{
free (word);
string = nextword (string, &word);
}
+ else if (strcmp (word, "variable") == 0)
+ {
+ free (word);
+ string = nextword (string, &word);
+ if (!string)
+ continue;
+ intptr_t *loc = xmalloc (sizeof (intptr_t));
+ *loc = 0;
+ add_intrinsic_variable (word, loc);
+ string = nextword (string, &word);
+ }
else
{
fprintf (stderr, "syntax error at %s\n", string - 1);
add_intrinsic ("swap", swap);
add_intrinsic ("outputdots", outputdots);
add_intrinsic ("maybecatstr", maybecatstr);
+ add_intrinsic ("catstrif", catstrif);
add_intrinsic ("translatecomments", translatecomments);
add_intrinsic ("kill_bogus_lines", kill_bogus_lines);
add_intrinsic ("indent", indent);
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+- True if SYNOPSIS was seen.
+variable synopsis_seen
+
: DOCDD
skip_past_newline
get_stuff_in_command kill_bogus_lines catstr
: SYNOPSIS
skip_past_newline
- "@strong{Synopsis}\n" catstr
- "@example\n" catstr
+ 1 synopsis_seen !
+ "@deftypefn {Function} " catstr
get_stuff_in_command
kill_bogus_lines
indent
catstr
- "@end example\n" catstr
-
;
: func
: DESCRIPTION
- "@strong{Description}@*\n" catstr subhead ;
+ subhead
+ "@end deftypefn\n" synopsis_seen @ catstrif
+ 0 synopsis_seen !
+ ;
: RETURNS
"@strong{Returns}@*\n" catstr subhead ;
FUNCTION
bfd_decode_symclass
+SYNOPSIS
+ int bfd_decode_symclass (asymbol *symbol);
+
DESCRIPTION
Return a character corresponding to the symbol
class of @var{symbol}, or '?' for an unknown class.
-
-SYNOPSIS
- int bfd_decode_symclass (asymbol *symbol);
*/
int
bfd_decode_symclass (asymbol *symbol)
FUNCTION
bfd_is_undefined_symclass
+SYNOPSIS
+ bool bfd_is_undefined_symclass (int symclass);
+
DESCRIPTION
Returns non-zero if the class symbol returned by
bfd_decode_symclass represents an undefined symbol.
Returns zero otherwise.
-
-SYNOPSIS
- bool bfd_is_undefined_symclass (int symclass);
*/
bool
FUNCTION
bfd_symbol_info
+SYNOPSIS
+ void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
+
DESCRIPTION
Fill in the basic info about symbol that nm needs.
Additional info may be added by the back-ends after
calling this function.
-
-SYNOPSIS
- void bfd_symbol_info (asymbol *symbol, symbol_info *ret);
*/
void