update docs
[xorcyst.git] / script.h
blob7716cf2a6b3b77f1e6353e0c6293ef2f673d3adc
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 SCRIPT_H
31 #define SCRIPT_H
33 /**
34 * The possible kinds of command.
36 enum tag_command_type {
37 RAM_COMMAND=0,
38 OUTPUT_COMMAND,
39 COPY_COMMAND,
40 BANK_COMMAND,
41 LINK_COMMAND,
42 OPTIONS_COMMAND,
43 PAD_COMMAND,
44 BAD_COMMAND
47 typedef enum tag_command_type command_type;
49 /**
50 * A list of command arguments
52 struct tag_command_arg
54 char *key;
55 char *value;
56 struct tag_command_arg *next;
59 typedef struct tag_command_arg command_arg;
61 /**
62 * A command
64 struct tag_script_command {
65 command_type type;
66 command_arg *first_arg;
67 int line;
68 struct tag_script_command *next;
71 typedef struct tag_script_command script_command;
73 /**
74 * A script
76 struct tag_script {
77 char *name;
78 script_command *first_command;
81 typedef struct tag_script script;
83 /** Signature for procedure to process a script command */
84 typedef void (*script_commandproc)(script *, script_command *, void *);
86 /**
87 * Structure that represents a mapping from script command type to processor function.
89 struct tag_script_commandprocmap {
90 command_type type;
91 script_commandproc proc;
94 typedef struct tag_script_commandprocmap script_commandprocmap;
96 /* Function prototypes */
98 int script_parse(char *, script *);
99 void script_finalize(script *);
100 int script_length(script *);
101 script_command *script_get_command(script *, int);
102 void script_walk(script *, script_commandprocmap *, void *);
103 char *script_get_command_arg(script_command *, char *);
104 char *script_command_type_to_string(command_type);
105 int script_count_command_type(script *, command_type);
107 #endif /* !SCRIPT_H */