make sure string is 0-terminated
[xorcyst.git] / astproc.h
blobde4c913e4456344bb62b5cc4292c9f2073dba363
1 /*
2 * $Id: astproc.h,v 1.5 2007/08/12 18:59:10 khansen Exp $
3 * $Log: astproc.h,v $
4 * Revision 1.5 2007/08/12 18:59:10 khansen
5 * ability to generate pure 6502 binary
7 * Revision 1.4 2007/08/12 02:42:46 khansen
8 * prettify, const
10 * Revision 1.3 2007/07/22 13:35:20 khansen
11 * convert tabs to whitespaces
13 * Revision 1.2 2004/12/06 04:54:00 kenth
14 * xorcyst 1.1.0
16 * Revision 1.1 2004/06/30 07:56:12 kenth
17 * Initial revision
21 /**
22 * (C) 2004 Kent Hansen
24 * The XORcyst is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2 of the License, or
27 * (at your option) any later version.
29 * The XORcyst is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with The XORcyst; if not, write to the Free Software
36 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
39 #ifndef ASTPROC_H
40 #define ASTPROC_H
42 #include "astnode.h"
44 /**
45 * Signature for procedure to process an AST node.
46 * @param node The node to process
47 * @param arg General-purpose argument
48 * @param next Next node to process
49 * @return 0 if node children should not be processed, 1 otherwise
51 typedef int (*astnodeproc)(astnode *, void *, astnode **);
53 /**
54 * Structure that represents a mapping from node type to processor function.
55 * All AST traversal functions rely on tables of such mappings.
57 struct tag_astnodeprocmap {
58 astnode_type type; /* The AST node type (*_NODE, see header file) */
59 astnodeproc proc; /* The function that will process nodes of type */
62 typedef struct tag_astnodeprocmap astnodeprocmap;
64 /* Function prototypes */
65 void astproc_first_pass(astnode *);
66 void astproc_second_pass(astnode *);
67 void astproc_third_pass(astnode *);
68 void astproc_fourth_pass(astnode *);
69 void astproc_fifth_pass(astnode *);
70 void astproc_walk(astnode *, void *, const astnodeprocmap *);
71 int astproc_err_count();
73 #endif /* !ASTPROC_H */