vscode-quakec icon indicating copy to clipboard operation
vscode-quakec copied to clipboard

[DRAFT] Support for MODELGEN Commands

Open joshuaskelly opened this issue 5 years ago • 0 comments

Summary

Provide robust support for MODELGEN commands (called commands in this document for brevity). Specifically the $frame command, which defines names in the scope.

1. Specifications

A command is:

  1. A line of QuakeC source that begins with the character $
  2. Typically a single line, but can be multiline.
  3. May be followed by 0-n arguments.
  4. Is considered an error if not recognized.

1.1. $frame Command

  1. Is a single line command.
  2. Takes 0-n name arguments.
  3. Creates a frame macro for each given name.

1.2. Frame Macros

  1. May only be an rvalue.
  2. Is of float type.
  3. May be defined multiple times.

2. Proposal

TODO: Complete proposal

3. Examples

3.1 Basic Definition

$frame macro1 macro2

Defines two constants $macro1 and $macro2

3.2 Basic RValue Usages

$frame macro1 macro2

void() f = {
    local float x = $macro1;
    local float y = $macro1 + 1;
};

Valid usages as an rvalue.

3.3 Duplicate Frame Macro Names

$frame macro1 macro2 macro2

Should warn about duplicate name $macro2.

3.4 Using Frame Macro Incorrectly as a Definition

$frame macro1 macro2
$macro1 = 2

Should treat $macro1 as an unknown modelgen command and discard it.

3.5 Using Frame Macro Incorrectly as a Statement

$frame macro1 macro2

void() f = {
    $macro1 = 2;
}

Should give an error, complaining that $macro1 is a const value and cannot be assigned.

4. References

joshuaskelly avatar Sep 06 '20 20:09 joshuaskelly