1 /* commands.h - declarations for commands.c */ 2 #ifndef COMMANDS_H 3 #define COMMANDS_H 4 /* Copyright 2010-2021 Free Software Foundation, Inc. 5 6 This program is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 18 19 typedef struct command_struct { 20 char *cmdname; 21 unsigned long flags; /* Up to 32 flags */ 22 int data; /* Number of arguments for brace or line commands. */ 23 } COMMAND; 24 25 extern COMMAND builtin_command_data[]; 26 extern COMMAND *user_defined_command_data; 27 28 /* Command ID's with this bit set represent a user-defined command. */ 29 #define USER_COMMAND_BIT 0x8000 30 31 enum command_id lookup_command (char *cmdname); 32 33 #define command_data(id) \ 34 (!((id) & USER_COMMAND_BIT) \ 35 ? builtin_command_data[(id)] \ 36 : user_defined_command_data[(id) & ~USER_COMMAND_BIT]) 37 38 #define command_flags(e) (!(e) ? 0 : (command_data((e)->cmd).flags)) 39 #define command_name(cmd) (command_data(cmd).cmdname) 40 41 int close_paragraph_command (enum command_id cmd_id); 42 int close_preformatted_command (enum command_id cmd_id); 43 int item_line_command (enum command_id cmd_id); 44 enum command_id add_texinfo_command (char *name); 45 void remove_texinfo_command (enum command_id cmd); 46 void wipe_user_commands (void); 47 48 /* Available command flags. */ 49 50 #define CF_line 0x0001 51 #define CF_deprecated 0x0002 52 #define CF_root 0x0004 53 #define CF_sectioning 0x0008 54 #define CF_brace 0x0010 55 #define CF_letter_no_arg 0x0020 56 #define CF_accent 0x0040 57 #define CF_style 0x0080 58 /* CF_code_style is set for brace commands only. */ 59 #define CF_code_style 0x0100 60 #define CF_INFOENCLOSE 0x0200 61 #define CF_in_heading 0x0400 62 #define CF_ref 0x0800 63 #define CF_ALIAS 0x1000 64 #define CF_block 0x2000 65 #define CF_raw 0x4000 66 #define CF_format_raw 0x8000 67 #define CF_global 0x00010000 68 #define CF_def 0x00020000 69 #define CF_def_alias 0x00040000 70 #define CF_menu 0x00080000 71 #define CF_align 0x00100000 72 #define CF_other 0x00200000 73 #define CF_preformatted 0x00400000 74 #define CF_preformatted_code 0x00800000 75 #define CF_item_container 0x01000000 76 #define CF_item_line 0x02000000 77 #define CF_nobrace 0x04000000 78 #define CF_blockitem 0x08000000 79 #define CF_inline 0x10000000 80 #define CF_MACRO 0x20000000 81 #define CF_index_entry_command 0x40000000 82 #define CF_global_unique 0x80000000 83 84 /* NOTE: We've run out of spaces for flags, but some of these may not 85 be used, or may not be necessary. 86 CF_code_style, CF_deprecated are hardly used. 87 88 Candidates for flags: 89 CF_close_paragraph 90 91 Could combine CF_MACRO, CF_ALIAS, and CF_INFOENCLOSE into 2 bits. 92 */ 93 94 /* Types of line command (has CF_line flag). Values for COMMAND.data. */ 95 #define LINE_special -1 96 #define LINE_lineraw -2 97 #define LINE_skipline -3 98 #define LINE_text -6 99 #define LINE_line -7 100 101 /* Types of other command (has CF_other flag). */ 102 #define OTHER_skipspace -1 103 #define OTHER_noarg -2 104 105 /* Types of block command (CF_block). */ 106 #define BLOCK_conditional -1 107 #define BLOCK_raw -2 108 #define BLOCK_multitable -3 109 #define BLOCK_region -4 110 #define BLOCK_variadic -5 111 112 /* Types of brace command (CF_brace). */ 113 #define BRACE_context -1 /* Can enclose paragraph breaks. */ 114 #define BRACE_accent -2 115 #define BRACE_style -3 116 #define BRACE_other -4 117 118 #endif 119