binutils-gdb/bfd/doc/proto.str

175 lines
4.1 KiB
Plaintext
Raw Normal View History

- Source extraction program for chew.
- Copyright (C) 1990-2024 Free Software Foundation, Inc.
- This file is part of BFD, the Binary File Descriptor library.
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
1999-05-03 15:29:11 +08:00
- chew.c keywords defined here put output into bfd-in2.h and libbfd.h or
- libcoff.h, from comments in the source. See also doc.str.
- Output lines generally come from comment lines starting with a dot,
- or from keywords like SYNOPSIS. Output switches to bfd-in2.h at the
- end of each comment. Use INTERNAL* to output to libbfd.h.
-
- EXTERNAL: output to bfd-in2.h, nothing to docs
- INTERNAL: output to libbfd.h, nothing to docs
- CODE_FRAGMENT: output to header and docs
- FUNCTION: output to bfd-in2.h and docs
- INTERNAL_FUNCTION: output to libbfd.h and docs
- DEFINITION: alias for FUNCTION, but generally doesn't have SYNOPSIS,
- used for structs and other random code
- INTERNAL_DEFINITION: as above, but output to libbfd.h and docs
- ENUM* outputs to bfd-in2.h, libbfd.h and docs.
1999-05-03 15:29:11 +08:00
: SYNOPSIS
skip_past_newline
get_stuff_in_command
translatecomments
strip_trailing_newlines
remchar
" ATTRIBUTE_HIDDEN" internalmode @ catstrif
";\n\n" catstr
1999-05-03 15:29:11 +08:00
indent
maybecatstr
;
- Ignore stuff that is for the docs. Output lines starting with dots.
1999-05-03 15:29:11 +08:00
: ignore
skip_past_newline
get_stuff_in_command
outputdots
maybecatstr
;
: CODE_FRAGMENT
ignore ;
- Output goes to bfd-in2.h
: EXTERNAL
0 internalmode ! ignore ;
1999-05-03 15:29:11 +08:00
- Output goes to libbfd.h/libcoff.h
: INTERNAL
1 internalmode ! ignore ;
1999-05-03 15:29:11 +08:00
- input stack { a b } output b if internal, a if external
: ifinternal
"" swap 1 internalmode ! maybecatstr
1999-05-03 15:29:11 +08:00
swap
"" swap 0 internalmode ! maybecatstr
1999-05-03 15:29:11 +08:00
catstr
;
- Put note in output string, regardless of internal mode.
: COMMENT
skip_past_newline
get_stuff_in_command
translatecomments
catstr
;
- SENUM enum-type-name
- ENUM enum-name
- ENUMX addl-enum-name
- ENUMDOC doc for preceding enums
- ENDSENUM max-enum-name
: make_enum_header
dup
"enum " swap catstr
bfd-in2.h BFD_RELOC_* comments I noticed the regenerated BFD_RELOC_MICROBLAZE_32_NONE comment didn't match that committed to bfd-in2.h, and was just going to regen bfd-in2.h but then decided to do something about the silly formatting of these comments in bfd-in2.h. eg. the BFD_RELOC_MICROBLAZE_32_NONE comment: -/* This is a 32 bit reloc that stores the 32 bit pc relative -value in two words (with an imm instruction).No relocation is -done here - only used for relaxing */ + /* This is a 32 bit reloc that stores the 32 bit pc relative value in + two words (with an imm instruction). No relocation is done here - + only used for relaxing. */ BFD_RELOC_MICROBLAZE_32_NONE, You'll notice how the second and third line of the original comment aren't indented properly relative to the first line, and the whole comment needs to be indented to match the code. I've also edited reloc.c ENUMDOC paragraphs. Some of these had excess indentation, presumably in an attempt to properly indent bfd-in2.h comments but that fails due to chew.c removing leading whitespace early by skip_white_and_stars. COMMENT was used in reloc.c to add extra blank lines in bfd-in2.h. I've removed them too as I don't think they add anything to readability of that file. (Perhaps more usefully, they also add blank lines to libbfd.h separating relocs for one target from others, but this isn't done consistently.) * doc/chew.c (drop, idrop): Move earlier. (strip_trailing_newlines): Check index before accessing array, not after. (wrap_comment): New function. (main): Add "wrap_comment" intrinsic. * doc/proto.str (ENUMDOC): Use wrap_comment. (make_enum_header, ENDSENUM): Put start and end braces on separate lines. * reloc.c: Remove uses of COMMENT and edit ENUMDOC paragraphs. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
2023-10-21 15:24:59 +08:00
"\n{\n" catstr
1999-05-03 15:29:11 +08:00
swap " _dummy_first_" swap catstr catstr
",\n" catstr
;
: make_string_table_header
dup
"#ifdef _BFD_MAKE_TABLE_" swap catstr swap
"\n\nstatic const char *const " swap catstr catstr
"_names[] = { \"@@uninitialized@@\",\n" catstr
;
: SENUM
skip_past_newline
copy_past_newline
remchar
dup
make_enum_header
swap
make_string_table_header
ifinternal
catstr
get_stuff_in_command catstr
translatecomments ;
: ENDSENUM
skip_past_newline
copy_past_newline strip_trailing_newlines
dup
bfd-in2.h BFD_RELOC_* comments I noticed the regenerated BFD_RELOC_MICROBLAZE_32_NONE comment didn't match that committed to bfd-in2.h, and was just going to regen bfd-in2.h but then decided to do something about the silly formatting of these comments in bfd-in2.h. eg. the BFD_RELOC_MICROBLAZE_32_NONE comment: -/* This is a 32 bit reloc that stores the 32 bit pc relative -value in two words (with an imm instruction).No relocation is -done here - only used for relaxing */ + /* This is a 32 bit reloc that stores the 32 bit pc relative value in + two words (with an imm instruction). No relocation is done here - + only used for relaxing. */ BFD_RELOC_MICROBLAZE_32_NONE, You'll notice how the second and third line of the original comment aren't indented properly relative to the first line, and the whole comment needs to be indented to match the code. I've also edited reloc.c ENUMDOC paragraphs. Some of these had excess indentation, presumably in an attempt to properly indent bfd-in2.h comments but that fails due to chew.c removing leading whitespace early by skip_white_and_stars. COMMENT was used in reloc.c to add extra blank lines in bfd-in2.h. I've removed them too as I don't think they add anything to readability of that file. (Perhaps more usefully, they also add blank lines to libbfd.h separating relocs for one target from others, but this isn't done consistently.) * doc/chew.c (drop, idrop): Move earlier. (strip_trailing_newlines): Check index before accessing array, not after. (wrap_comment): New function. (main): Add "wrap_comment" intrinsic. * doc/proto.str (ENUMDOC): Use wrap_comment. (make_enum_header, ENDSENUM): Put start and end braces on separate lines. * reloc.c: Remove uses of COMMENT and edit ENUMDOC paragraphs. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
2023-10-21 15:24:59 +08:00
" " swap catstr "\n};\n" catstr swap
1999-05-03 15:29:11 +08:00
" \"@@overflow: " swap catstr "@@\",\n};\n#endif\n\n" catstr
ifinternal
catstr
;
: make_enumerator
" " swap catstr
",\n" catstr
;
: make_enumerator_string
" \"" swap catstr
"\",\n" catstr
;
: ENUM
skip_past_newline
copy_past_newline
remchar
dup
make_enumerator
swap
make_enumerator_string
ifinternal
;
: ENUMX ENUM catstr ;
: ENUMEQ
skip_past_newline
"#define "
copy_past_newline remchar
catstr
" "
catstr
copy_past_newline
catstr
"" swap 0 internalmode ! maybecatstr
1999-05-03 15:29:11 +08:00
;
: ENUMEQX ENUMEQ catstr ;
: ENUMDOC
skip_past_newline
get_stuff_in_command
strip_trailing_newlines
bfd-in2.h BFD_RELOC_* comments I noticed the regenerated BFD_RELOC_MICROBLAZE_32_NONE comment didn't match that committed to bfd-in2.h, and was just going to regen bfd-in2.h but then decided to do something about the silly formatting of these comments in bfd-in2.h. eg. the BFD_RELOC_MICROBLAZE_32_NONE comment: -/* This is a 32 bit reloc that stores the 32 bit pc relative -value in two words (with an imm instruction).No relocation is -done here - only used for relaxing */ + /* This is a 32 bit reloc that stores the 32 bit pc relative value in + two words (with an imm instruction). No relocation is done here - + only used for relaxing. */ BFD_RELOC_MICROBLAZE_32_NONE, You'll notice how the second and third line of the original comment aren't indented properly relative to the first line, and the whole comment needs to be indented to match the code. I've also edited reloc.c ENUMDOC paragraphs. Some of these had excess indentation, presumably in an attempt to properly indent bfd-in2.h comments but that fails due to chew.c removing leading whitespace early by skip_white_and_stars. COMMENT was used in reloc.c to add extra blank lines in bfd-in2.h. I've removed them too as I don't think they add anything to readability of that file. (Perhaps more usefully, they also add blank lines to libbfd.h separating relocs for one target from others, but this isn't done consistently.) * doc/chew.c (drop, idrop): Move earlier. (strip_trailing_newlines): Check index before accessing array, not after. (wrap_comment): New function. (main): Add "wrap_comment" intrinsic. * doc/proto.str (ENUMDOC): Use wrap_comment. (make_enum_header, ENDSENUM): Put start and end braces on separate lines. * reloc.c: Remove uses of COMMENT and edit ENUMDOC paragraphs. * libbfd.h: Regenerate. * bfd-in2.h: Regenerate.
2023-10-21 15:24:59 +08:00
" " wrap_comment
"\n" swap catstr "\n" catstr
1999-05-03 15:29:11 +08:00
- discard it if we're doing internal mode
"" swap 0 internalmode ! maybecatstr
1999-05-03 15:29:11 +08:00
swap
catstr catstr
;
: SECTION ignore ;
: SUBSECTION ignore ;
: SUBSUBSECTION ignore ;
: INODE ignore ;
: DESCRIPTION ignore ;
: DOCDD ignore ;
: ENDDD EXTERNAL ;
: FUNCTION EXTERNAL ;
: INTERNAL_FUNCTION INTERNAL ;
: DEFINITION EXTERNAL ;
: INTERNAL_DEFINITION INTERNAL ;