Skip to content

Commit

Permalink
Move command ids to config.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
thelink2012 committed Jan 2, 2019
1 parent 95cd711 commit 5c82a34
Show file tree
Hide file tree
Showing 7 changed files with 5,406 additions and 5,363 deletions.
1,157 changes: 0 additions & 1,157 deletions config/gta3/commands.xml

Large diffs are not rendered by default.

1,163 changes: 1,163 additions & 0 deletions config/gta3/config.xml

Large diffs are not rendered by default.

2,643 changes: 0 additions & 2,643 deletions config/gtasa/commands.xml

Large diffs are not rendered by default.

2,650 changes: 2,650 additions & 0 deletions config/gtasa/config.xml

Large diffs are not rendered by default.

1,451 changes: 0 additions & 1,451 deletions config/gtavc/commands.xml

Large diffs are not rendered by default.

1,457 changes: 1,457 additions & 0 deletions config/gtavc/config.xml

Large diffs are not rendered by default.

248 changes: 136 additions & 112 deletions schema.rnc
Original file line number Diff line number Diff line change
Expand Up @@ -9,132 +9,156 @@ namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"
grammar {
start =
## A GTA3script configuration file consists of commands, alternators
## and constants in any given order.
## and constants.
##
## Those can be given in any order, but the order on which they appear
## matter (e.g. one may replace definitions from another).
element GTA3Script {
attribute Version { string "2.0" }
& Import*
& Commands*
& Alternators*
& Constants*
}

Commands = element Commands {
element Command {
## The name of the command in the translation environment.
##
## If a command definition of same name already exists, it is
## completly replaced with this definition.
attribute Name { string },

element Params {
element Param {
## The type of the parameter
## (as specified in gta3script-specs).
attribute Type {
string "INT"
| string "FLOAT"
| string "VAR_INT"
| string "VAR_FLOAT"
| string "VAR_TEXT_LABEL"
| string "VAR_TEXT_LABEL16"
| string "LVAR_INT"
| string "LVAR_FLOAT"
| string "LVAR_TEXT_LABEL"
| string "LVAR_TEXT_LABEL16"
| string "VAR_INT_OPT"
| string "VAR_FLOAT_OPT"
| string "VAR_TEXT_LABEL_OPT"
| string "VAR_TEXT_LABEL16_OPT"
| string "LVAR_INT_OPT"
| string "LVAR_FLOAT_OPT"
| string "LVAR_TEXT_LABEL_OPT"
| string "LVAR_TEXT_LABEL16_OPT"
| string "INPUT_INT"
| string "INPUT_FLOAT"
| string "INPUT_OPT"
| string "OUTPUT_INT"
| string "OUTPUT_FLOAT"
| string "OUTPUT_TEXT_LABEL"
| string "OUTPUT_TEXT_LABEL16"
| string "LABEL"
| string "TEXT_LABEL"
| string "TEXT_LABEL16"
| string "TEXT_LABEL32"
},

## The enumeration associated with this parameter.
attribute Enum { string }?,

## The entity type associated with this parameter.
attribute Entity { string }?

# TODO Variadic
}*
}?
}*
## Associates a command to an identifier.
& element CommandId {
## Name of the command to associate an id to.
##
## If an command of same name has been already associated with an
## id, its association is replaced with the one that follows.
attribute Name { string },

## The id of the command.
##
## Multiple command names may be associated with a single id.
##
## If this id is not specified, the `Handled` attribute must
## be false.
attribute ID { xsd:unsignedShort | hex16 }?,

## Whether this command is supported by the execution environment.
[a:defaultValue = "true"]
attribute Handled { xsd:boolean }?
}*
}

Alternators = element Alternators {
element Alternator {
## The name of the alternator.
##
## If an alternator of same name already exists, it is kept and
## the alternative commands that follow are added to it.
attribute Name { string },

element Alternative {
## The name of alternative command.
attribute Name { string }
Import =
## Immediately imports a configuration file.
##
## The imported file is completly processed before continuing the
## processing of this file.
##
## The maximum depth of imports is equal 1, that means only the
## main configuration file (`config.xml`) can import other files.
element Import {
## Imports the configurations from the specified game config.
## If not specified, imports from the current config directory.
attribute From { string }?,

## Imports the specified filename.
attribute Name { string }
}

Commands =
element Commands {
element Command {
## The name of the command in the translation environment.
##
## If a command definition of same name already exists, it is
## completly replaced with this definition.
attribute Name { string },

element Params {
element Param {
## The type of the parameter
## (as specified in gta3script-specs).
attribute Type {
string "INT"
| string "FLOAT"
| string "VAR_INT"
| string "VAR_FLOAT"
| string "VAR_TEXT_LABEL"
| string "VAR_TEXT_LABEL16"
| string "LVAR_INT"
| string "LVAR_FLOAT"
| string "LVAR_TEXT_LABEL"
| string "LVAR_TEXT_LABEL16"
| string "VAR_INT_OPT"
| string "VAR_FLOAT_OPT"
| string "VAR_TEXT_LABEL_OPT"
| string "VAR_TEXT_LABEL16_OPT"
| string "LVAR_INT_OPT"
| string "LVAR_FLOAT_OPT"
| string "LVAR_TEXT_LABEL_OPT"
| string "LVAR_TEXT_LABEL16_OPT"
| string "INPUT_INT"
| string "INPUT_FLOAT"
| string "INPUT_OPT"
| string "OUTPUT_INT"
| string "OUTPUT_FLOAT"
| string "OUTPUT_TEXT_LABEL"
| string "OUTPUT_TEXT_LABEL16"
| string "LABEL"
| string "TEXT_LABEL"
| string "TEXT_LABEL16"
| string "TEXT_LABEL32"
},

## The enumeration associated with this parameter.
attribute Enum { string }?,

## The entity type associated with this parameter.
attribute Entity { string }?

# TODO Variadic
}*
}?
}*
## Associates a command to an identifier.
& element CommandId {
## Name of the command to associate an id to.
##
## If an command of same name has been already associated with an
## id, its association is replaced with the one that follows.
attribute Name { string },

## The id of the command.
##
## Multiple command names may be associated with a single id.
##
## If this id is not specified, the `Handled` attribute must
## be false.
attribute ID { xsd:unsignedShort | hex16 }?,

## Whether this command is supported by the execution environment.
[a:defaultValue = "true"]
attribute Handled { xsd:boolean }?
}*
}

}*
}

Constants = element Constants {
element Enum {
## The name of the enumeration.
##
## If no name is given, the constants are added to the global
## string constants enumeration.
##
## If an enumeration of same name already exists, that enumeration
## is preserved and the string constants that follow are added to it.
attribute Name { string }?,

element Constant {
## The name of this string constant.
Alternators =
element Alternators {
element Alternator {
## The name of the alternator.
##
## If a string constant of same name already exists in this enumeration,
## it is replaced by this value.
## If an alternator of same name already exists, it is kept and
## the alternative commands that follow are added to it.
attribute Name { string },

## The value of this string constant.
element Alternative {
## The name of alternative command.
attribute Name { string }
}*

}*
}

Constants =
element Constants {
element Enum {
## The name of the enumeration.
##
## If no value is given, the value of this constant is equal
## the successor of the value in the previous constant.
attribute Value { xsd:int | hex32 }?
## If no name is given, the constants are added to the global
## string constants enumeration.
##
## If an enumeration of same name already exists, that enumeration
## is preserved and the string constants that follow are added to it.
attribute Name { string }?,

element Constant {
## The name of this string constant.
##
## If a string constant of same name already exists in this enumeration,
## it is replaced by this value.
attribute Name { string },

## The value of this string constant.
##
## If no value is given, the value of this constant is equal
## the successor of the value in the previous constant.
attribute Value { xsd:int | hex32 }?
}*
}*
}*
}
}

hex16 = xsd:string { pattern = "0x[0-9a-fA-F]{1,4}" }
hex32 = xsd:string { pattern = "0x[0-9a-fA-F]{1,8}" }
Expand Down

0 comments on commit 5c82a34

Please sign in to comment.