Source layout and global namespace
A Live GPC file can contain these top-level forms:
defineenumdata(...)typed
constarrays, strings, images, and adaptive-trigger dataremapandunmapglobal
intvariables and runtime arraysoptional
initsection or sectionsone or more
mainsectionscombo/fcombodeclarationsuser-created
functiondeclarations
Zen Studio Live accepts multiple init and main sections. The compiler merges all init sections into the one-time initialization phase and all main sections into the repeating main phase. Keeping one of each is normally clearer, but split sections in generated or assembled source are valid.
Name spaces
GPC does not place every declared name in one namespace:
Data symbols
Runtime variables and arrays, definitions, enum members, and const-data names
Functions
User-created function names
Combos
combo and fcombo names
Function-local
The parameters declared by that function
Names must be unique within the namespace that owns them. A variable cannot reuse a definition, enum-member, or const-data name, but function names, combo names, and function parameters are resolved separately from that data-symbol namespace.
Language keywords and built-in constants are reserved. Declaring main, if, or a constant such as PS5_CROSS as your own name is a hard error.
Built-in function names are not reserved in the data-symbol namespace — int set_val; and define set_val = 5; both compile. What the compiler does reject is naming a user-created function after a built-in; that is reported as GPC4001.
Reusing a built-in function name for a variable or definition is legal, but strongly discouraged. Every compiler message about that name becomes ambiguous to read, and anyone maintaining the script later has to work out which set_val is meant.
Names are case-sensitive and follow this shape:
Prefer descriptive uppercase names for compile-time constants and lowercase snake case for runtime variables/functions. Even where separate namespaces technically allow the same spelling, distinct names make searches and compiler messages easier to understand.
Last updated

