allow extrn symbols to be defined by the unit itself (part II)
[xorcyst.git] / script.h
blob7eac52ee28dfbd44e09b95d558997426d344563e
1 /*
2 * $Id: script.h,v 1.2 2007/07/22 13:35:20 khansen Exp $
3 * $Log: script.h,v $
4 * Revision 1.2 2007/07/22 13:35:20 khansen
5 * convert tabs to whitespaces
7 * Revision 1.1 2004/06/30 07:56:42 kenth
8 * Initial revision
12 /**
13 * (C) 2004 Kent Hansen
15 * The XORcyst is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * The XORcyst is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with The XORcyst; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #ifndef XLNK_SCRIPT_H
31 #define XLNK_SCRIPT_H
33 /**
34 * The possible kinds of command.
36 enum tag_xlnk_command_type {
37 XLNK_RAM_COMMAND=0,
38 XLNK_OUTPUT_COMMAND,
39 XLNK_COPY_COMMAND,
40 XLNK_BANK_COMMAND,
41 XLNK_LINK_COMMAND,
42 XLNK_OPTIONS_COMMAND,
43 XLNK_PAD_COMMAND,
44 XLNK_BAD_COMMAND
47 typedef enum tag_xlnk_command_type xlnk_command_type;
49 /**
50 * A list of command arguments
52 struct tag_xlnk_command_arg
54 char *key;
55 char *value;
56 struct tag_xlnk_command_arg *next;
59 typedef struct tag_xlnk_command_arg xlnk_command_arg;
61 /**
62 * A command
64 struct tag_xlnk_script_command {
65 xlnk_command_type type;
66 xlnk_command_arg *first_arg;
67 int line;
68 struct tag_xlnk_script_command *next;
71 typedef struct tag_xlnk_script_command xlnk_script_command;
73 /**
74 * A script
76 struct tag_xlnk_script {
77 const char *name;
78 xlnk_script_command *first_command;
81 typedef struct tag_xlnk_script xlnk_script;
83 /** Signature for procedure to process a script command */
84 typedef void (*xlnk_script_commandproc)(xlnk_script *, xlnk_script_command *, void *);
86 /**
87 * Structure that represents a mapping from script command type to processor function.
89 struct tag_xlnk_script_commandprocmap {
90 xlnk_command_type type;
91 xlnk_script_commandproc proc;
94 typedef struct tag_xlnk_script_commandprocmap xlnk_script_commandprocmap;
96 /* Function prototypes */
98 int xlnk_script_parse(const char *, xlnk_script *);
99 void xlnk_script_finalize(xlnk_script *);
100 int xlnk_script_length(xlnk_script *);
101 xlnk_script_command *xlnk_script_get_command(xlnk_script *, int);
102 void xlnk_script_walk(xlnk_script *, xlnk_script_commandprocmap *, void *);
103 const char *xlnk_script_get_command_arg(xlnk_script_command *, const char *);
104 const char *xlnk_script_command_type_to_string(xlnk_command_type);
105 int xlnk_script_count_command_type(xlnk_script *, xlnk_command_type);
107 #endif /* !XLNK_SCRIPT_H */