- Optimization: common parameters to built in functions are no longer looked up as a string at each call, instead their integer ids are global constants

- Optimization: some other minor tweaks.
 - Nicer --help message

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@783 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2007-12-24 02:04:45 +00:00
parent b79f52db84
commit 547a48b98d
23 changed files with 232 additions and 134 deletions
+26 -1
View File
@@ -98,7 +98,28 @@ struct Instruction {
// ----------------------------------------------------------------------------- : Variables
typedef unsigned int Variable;
// for faster lookup from code
enum Variable
{ SCRIPT_VAR_input
, SCRIPT_VAR_in
, SCRIPT_VAR_match
, SCRIPT_VAR_replace
, SCRIPT_VAR_order
, SCRIPT_VAR_filter
, SCRIPT_VAR_choice
, SCRIPT_VAR_format
, SCRIPT_VAR_tag
, SCRIPT_VAR_contents
, SCRIPT_VAR_set
, SCRIPT_VAR_game
, SCRIPT_VAR_stylesheet
, SCRIPT_VAR_card_style
, SCRIPT_VAR_card
, SCRIPT_VAR_styling
, SCRIPT_VAR_value
, SCRIPT_VAR_CUSTOM_FIRST // other variables start from here
, SCRIPT_VAR_CUSTOM_LOTS = 0xFFFFFF // ensure that sizeof(Variable) is large enough
};
/// Return a unique name for a variable to allow for faster loopups
Variable string_to_variable(const String& s);
@@ -108,6 +129,10 @@ Variable string_to_variable(const String& s);
*/
String variable_to_string(Variable v);
/// initialze the script variables
void init_script_variables();
// ----------------------------------------------------------------------------- : Script
/// A script that can be executed