1 /* 2 * This file is part of DGD, https://github.com/dworkin/dgd 3 * Copyright (C) 1993-2010 Dworkin B.V. 4 * Copyright (C) 2010 DGD Authors (see the commit log for details) 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as 8 * published by the Free Software Foundation, either version 3 of the 9 * License, or (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 Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 # include "hash.h" 21 22 typedef struct _macro_ { 23 hte chain; /* hash table entry chain */ 24 char *replace; /* replace text */ 25 int narg; /* number of arguments */ 26 } macro; 27 28 # define MA_NARG 0x1f 29 # define MA_NOEXPAND 0x20 30 # define MA_STRING 0x40 31 # define MA_TAG 0x80 32 33 # define MAX_NARG 31 34 35 # define MAX_REPL_SIZE (4 * MAX_LINE_SIZE) 36 37 extern void mc_init (void); 38 extern void mc_clear (void); 39 extern void mc_define (char*, char*, int); 40 extern void mc_undef (char*); 41 extern macro *mc_lookup (char*); 42