rename vm internal structs to make room for compilation-unit-internal structs/classes

This commit is contained in:
Ricardo Luís Vaz Silva 2025-03-04 08:59:03 -03:00
commit dd92a972f5
7 changed files with 78 additions and 77 deletions

View file

@ -109,7 +109,7 @@ public:
EScopeFlags ScopeFlags = (EScopeFlags)0;
bool SizeKnown = true;
bool TypeInternal = false;
bool VMInternalStruct = false;
PType * LocalType = nullptr;

View file

@ -427,12 +427,12 @@ struct_def(X) ::= EXTEND STRUCT(T) IDENTIFIER(A) LBRACE opt_struct_body(B) RBRAC
}
%type struct_flags{ClassFlagsBlock}
struct_flags(X) ::= . { X.Flags = 0; X.Version = {0, 0}; }
struct_flags(X) ::= struct_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; }
struct_flags(X) ::= struct_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; }
struct_flags(X) ::= struct_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; }
struct_flags(X) ::= struct_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; }
struct_flags(X) ::= struct_flags(A) INTERNAL. { X.Flags = A.Flags | ZCC_Internal; }
struct_flags(X) ::= . { X.Flags = 0; X.Version = {0, 0}; }
struct_flags(X) ::= struct_flags(A) UI. { X.Flags = A.Flags | ZCC_UIFlag; X.Version = A.Version; }
struct_flags(X) ::= struct_flags(A) PLAY. { X.Flags = A.Flags | ZCC_Play; X.Version = A.Version; }
struct_flags(X) ::= struct_flags(A) CLEARSCOPE. { X.Flags = A.Flags | ZCC_ClearScope; X.Version = A.Version; }
struct_flags(X) ::= struct_flags(A) NATIVE. { X.Flags = A.Flags | ZCC_Native; X.Version = A.Version; }
struct_flags(X) ::= struct_flags(A) UNSAFE LPAREN INTERNAL RPAREN. { X.Flags = A.Flags | ZCC_VMInternalStruct; X.Version = A.Version; }
struct_flags(X) ::= struct_flags(A) VERSION LPAREN STRCONST(C) RPAREN. { X.Flags = A.Flags | ZCC_Version; X.Version = C.String->GetChars(); }
opt_struct_body(X) ::= . { X = NULL; }

View file

@ -751,11 +751,11 @@ void ZCCCompiler::CreateStructTypes()
s->strct->Type->mVersion = s->strct->Version;
}
if (s->strct->Flags & ZCC_Internal)
if (s->strct->Flags & ZCC_VMInternalStruct)
{
if(fileSystem.GetFileContainer(Lump) == 0)
{
s->strct->Type->TypeInternal = true;
s->strct->Type->VMInternalStruct = true;
}
else
{
@ -2191,7 +2191,7 @@ PType *ZCCCompiler::ResolveUserType(PType *outertype, ZCC_BasicType *type, ZCC_I
}
//only allow references to internal types inside internal types
if (ptype->TypeInternal && !outertype->TypeInternal)
if (ptype->VMInternalStruct && !outertype->VMInternalStruct)
{
Error(type, "Type %s not accessible", FName(type->UserType->Id).GetChars());
return TypeError;

View file

@ -41,30 +41,31 @@ struct ZCCToken
// Variable / Function / Class modifiers
enum
{
ZCC_Native = 1 << 0,
ZCC_Static = 1 << 1,
ZCC_Private = 1 << 2,
ZCC_Protected = 1 << 3,
ZCC_Latent = 1 << 4,
ZCC_Final = 1 << 5,
ZCC_Meta = 1 << 6,
ZCC_Action = 1 << 7,
ZCC_Deprecated = 1 << 8,
ZCC_ReadOnly = 1 << 9,
ZCC_FuncConst = 1 << 10,
ZCC_Abstract = 1 << 11,
ZCC_Extension = 1 << 12,
ZCC_Virtual = 1 << 13,
ZCC_Override = 1 << 14,
ZCC_Transient = 1 << 15,
ZCC_VarArg = 1 << 16,
ZCC_UIFlag = 1 << 17, // there's also token called ZCC_UI
ZCC_Play = 1 << 18,
ZCC_ClearScope = 1 << 19,
ZCC_VirtualScope = 1 << 20,
ZCC_Version = 1 << 21,
ZCC_Internal = 1 << 22,
ZCC_Sealed = 1 << 23,
ZCC_Native = 1 << 0,
ZCC_Static = 1 << 1,
ZCC_Private = 1 << 2,
ZCC_Protected = 1 << 3,
ZCC_Latent = 1 << 4,
ZCC_Final = 1 << 5,
ZCC_Meta = 1 << 6,
ZCC_Action = 1 << 7,
ZCC_Deprecated = 1 << 8,
ZCC_ReadOnly = 1 << 9,
ZCC_FuncConst = 1 << 10,
ZCC_Abstract = 1 << 11,
ZCC_Extension = 1 << 12,
ZCC_Virtual = 1 << 13,
ZCC_Override = 1 << 14,
ZCC_Transient = 1 << 15,
ZCC_VarArg = 1 << 16,
ZCC_UIFlag = 1 << 17, // there's also token called ZCC_UI
ZCC_Play = 1 << 18,
ZCC_ClearScope = 1 << 19,
ZCC_VirtualScope = 1 << 20,
ZCC_Version = 1 << 21,
ZCC_Internal = 1 << 22,
ZCC_Sealed = 1 << 23,
ZCC_VMInternalStruct = 1 << 24,
};
// Function parameter modifiers

View file

@ -189,7 +189,7 @@ struct Vector3
}
*/
struct _ native internal // These are the global variables, the struct is only here to avoid extending the parser for this.
struct _ native unsafe(internal) // These are the global variables, the struct is only here to avoid extending the parser for this.
{
native readonly Array<class> AllClasses;
native internal readonly Map<Name , Service> AllServices;
@ -903,7 +903,7 @@ enum EmptyTokenType
// Although String is a builtin type, this is a convenient way to attach methods to it.
// All of these methods are available on strings
struct StringStruct native internal
struct StringStruct native unsafe(internal)
{
native static vararg String Format(String fmt, ...);
native vararg void AppendFormat(String fmt, ...);
@ -952,7 +952,7 @@ struct Translation version("2.4")
}
// Convenient way to attach functions to Quat
struct QuatStruct native internal
struct QuatStruct native unsafe(internal)
{
native static Quat SLerp(Quat from, Quat to, double t);
native static Quat NLerp(Quat from, Quat to, double t);

View file

@ -1,7 +1,7 @@
// The VM uses 7 integral data types, so for dynamic array support we need one specific set of functions for each of these types.
// Do not use these structs directly, they are incomplete and only needed to create prototypes for the needed functions.
struct DynArray_I8 native internal
struct DynArray_I8 native unsafe(internal)
{
native readonly int Size;
@ -21,7 +21,7 @@ struct DynArray_I8 native internal
native void Clear ();
}
struct DynArray_I16 native internal
struct DynArray_I16 native unsafe(internal)
{
native readonly int Size;
@ -41,7 +41,7 @@ struct DynArray_I16 native internal
native void Clear ();
}
struct DynArray_I32 native internal
struct DynArray_I32 native unsafe(internal)
{
native readonly int Size;
@ -62,7 +62,7 @@ struct DynArray_I32 native internal
native void Clear ();
}
struct DynArray_F32 native internal
struct DynArray_F32 native unsafe(internal)
{
native readonly int Size;
@ -82,7 +82,7 @@ struct DynArray_F32 native internal
native void Clear ();
}
struct DynArray_F64 native internal
struct DynArray_F64 native unsafe(internal)
{
native readonly int Size;
@ -102,7 +102,7 @@ struct DynArray_F64 native internal
native void Clear ();
}
struct DynArray_Ptr native internal
struct DynArray_Ptr native unsafe(internal)
{
native readonly int Size;
@ -122,7 +122,7 @@ struct DynArray_Ptr native internal
native void Clear ();
}
struct DynArray_Obj native internal
struct DynArray_Obj native unsafe(internal)
{
native readonly int Size;
@ -142,7 +142,7 @@ struct DynArray_Obj native internal
native void Clear ();
}
struct DynArray_String native internal
struct DynArray_String native unsafe(internal)
{
native readonly int Size;

View file

@ -1,5 +1,5 @@
struct Map_I32_I8 native internal
struct Map_I32_I8 native unsafe(internal)
{
native void Copy(Map_I32_I8 other);
native void Move(Map_I32_I8 other);
@ -18,7 +18,7 @@ struct Map_I32_I8 native internal
native void Remove(int key);
}
struct MapIterator_I32_I8 native internal
struct MapIterator_I32_I8 native unsafe(internal)
{
native bool Init(Map_I32_I8 other);
native bool ReInit();
@ -31,7 +31,7 @@ struct MapIterator_I32_I8 native internal
native void SetValue(int value);
}
struct Map_I32_I16 native internal
struct Map_I32_I16 native unsafe(internal)
{
native void Copy(Map_I32_I16 other);
native void Move(Map_I32_I16 other);
@ -50,7 +50,7 @@ struct Map_I32_I16 native internal
native void Remove(int key);
}
struct MapIterator_I32_I16 native internal
struct MapIterator_I32_I16 native unsafe(internal)
{
native bool Init(Map_I32_I16 other);
native bool ReInit();
@ -63,7 +63,7 @@ struct MapIterator_I32_I16 native internal
native void SetValue(int value);
}
struct Map_I32_I32 native internal
struct Map_I32_I32 native unsafe(internal)
{
native void Copy(Map_I32_I32 other);
native void Move(Map_I32_I32 other);
@ -82,7 +82,7 @@ struct Map_I32_I32 native internal
native void Remove(int key);
}
struct MapIterator_I32_I32 native internal
struct MapIterator_I32_I32 native unsafe(internal)
{
native bool Init(Map_I32_I32 other);
native bool ReInit();
@ -95,7 +95,7 @@ struct MapIterator_I32_I32 native internal
native void SetValue(int value);
}
struct Map_I32_F32 native internal
struct Map_I32_F32 native unsafe(internal)
{
native void Copy(Map_I32_F32 other);
native void Move(Map_I32_F32 other);
@ -114,7 +114,7 @@ struct Map_I32_F32 native internal
native void Remove(int key);
}
struct MapIterator_I32_F32 native internal
struct MapIterator_I32_F32 native unsafe(internal)
{
native bool Init(Map_I32_F32 other);
native bool ReInit();
@ -127,7 +127,7 @@ struct MapIterator_I32_F32 native internal
native void SetValue(double value);
}
struct Map_I32_F64 native internal
struct Map_I32_F64 native unsafe(internal)
{
native void Copy(Map_I32_F64 other);
native void Move(Map_I32_F64 other);
@ -146,7 +146,7 @@ struct Map_I32_F64 native internal
native void Remove(int key);
}
struct MapIterator_I32_F64 native internal
struct MapIterator_I32_F64 native unsafe(internal)
{
native bool Init(Map_I32_F64 other);
native bool ReInit();
@ -159,7 +159,7 @@ struct MapIterator_I32_F64 native internal
native void SetValue(double value);
}
struct Map_I32_Obj native internal
struct Map_I32_Obj native unsafe(internal)
{
native void Copy(Map_I32_Obj other);
native void Move(Map_I32_Obj other);
@ -178,7 +178,7 @@ struct Map_I32_Obj native internal
native void Remove(int key);
}
struct MapIterator_I32_Obj native internal
struct MapIterator_I32_Obj native unsafe(internal)
{
native bool Init(Map_I32_Obj other);
native bool ReInit();
@ -191,7 +191,7 @@ struct MapIterator_I32_Obj native internal
native void SetValue(Object value);
}
struct Map_I32_Ptr native internal
struct Map_I32_Ptr native unsafe(internal)
{
native void Copy(Map_I32_Ptr other);
native void Move(Map_I32_Ptr other);
@ -210,7 +210,7 @@ struct Map_I32_Ptr native internal
native void Remove(int key);
}
struct MapIterator_I32_Ptr native internal
struct MapIterator_I32_Ptr native unsafe(internal)
{
native bool Init(Map_I32_Ptr other);
native bool Next();
@ -220,7 +220,7 @@ struct MapIterator_I32_Ptr native internal
native void SetValue(voidptr value);
}
struct Map_I32_Str native internal
struct Map_I32_Str native unsafe(internal)
{
native void Copy(Map_I32_Str other);
native void Move(Map_I32_Str other);
@ -239,7 +239,7 @@ struct Map_I32_Str native internal
native void Remove(int key);
}
struct MapIterator_I32_Str native internal
struct MapIterator_I32_Str native unsafe(internal)
{
native bool Init(Map_I32_Str other);
native bool ReInit();
@ -254,7 +254,7 @@ struct MapIterator_I32_Str native internal
// ---------------
struct Map_Str_I8 native internal
struct Map_Str_I8 native unsafe(internal)
{
native void Copy(Map_Str_I8 other);
native void Move(Map_Str_I8 other);
@ -273,7 +273,7 @@ struct Map_Str_I8 native internal
native void Remove(String key);
}
struct MapIterator_Str_I8 native internal
struct MapIterator_Str_I8 native unsafe(internal)
{
native bool Init(Map_Str_I8 other);
native bool ReInit();
@ -286,7 +286,7 @@ struct MapIterator_Str_I8 native internal
native void SetValue(int value);
}
struct Map_Str_I16 native internal
struct Map_Str_I16 native unsafe(internal)
{
native void Copy(Map_Str_I16 other);
native void Move(Map_Str_I16 other);
@ -305,7 +305,7 @@ struct Map_Str_I16 native internal
native void Remove(String key);
}
struct MapIterator_Str_I16 native internal
struct MapIterator_Str_I16 native unsafe(internal)
{
native bool Init(Map_Str_I16 other);
native bool ReInit();
@ -318,7 +318,7 @@ struct MapIterator_Str_I16 native internal
native void SetValue(int value);
}
struct Map_Str_I32 native internal
struct Map_Str_I32 native unsafe(internal)
{
native void Copy(Map_Str_I32 other);
native void Move(Map_Str_I32 other);
@ -337,7 +337,7 @@ struct Map_Str_I32 native internal
native void Remove(String key);
}
struct MapIterator_Str_I32 native internal
struct MapIterator_Str_I32 native unsafe(internal)
{
native bool Init(Map_Str_I32 other);
native bool ReInit();
@ -350,7 +350,7 @@ struct MapIterator_Str_I32 native internal
native void SetValue(int value);
}
struct Map_Str_F32 native internal
struct Map_Str_F32 native unsafe(internal)
{
native void Copy(Map_Str_F32 other);
native void Move(Map_Str_F32 other);
@ -369,7 +369,7 @@ struct Map_Str_F32 native internal
native void Remove(String key);
}
struct MapIterator_Str_F32 native internal
struct MapIterator_Str_F32 native unsafe(internal)
{
native bool Init(Map_Str_F32 other);
native bool ReInit();
@ -382,7 +382,7 @@ struct MapIterator_Str_F32 native internal
native void SetValue(double value);
}
struct Map_Str_F64 native internal
struct Map_Str_F64 native unsafe(internal)
{
native void Copy(Map_Str_F64 other);
native void Move(Map_Str_F64 other);
@ -401,7 +401,7 @@ struct Map_Str_F64 native internal
native void Remove(String key);
}
struct MapIterator_Str_F64 native internal
struct MapIterator_Str_F64 native unsafe(internal)
{
native bool Init(Map_Str_F64 other);
native bool ReInit();
@ -414,7 +414,7 @@ struct MapIterator_Str_F64 native internal
native void SetValue(double value);
}
struct Map_Str_Obj native internal
struct Map_Str_Obj native unsafe(internal)
{
native void Copy(Map_Str_Obj other);
native void Move(Map_Str_Obj other);
@ -433,7 +433,7 @@ struct Map_Str_Obj native internal
native void Remove(String key);
}
struct MapIterator_Str_Obj native internal
struct MapIterator_Str_Obj native unsafe(internal)
{
native bool Init(Map_Str_Obj other);
native bool ReInit();
@ -446,7 +446,7 @@ struct MapIterator_Str_Obj native internal
native void SetValue(Object value);
}
struct Map_Str_Ptr native internal
struct Map_Str_Ptr native unsafe(internal)
{
native void Copy(Map_Str_Ptr other);
native void Move(Map_Str_Ptr other);
@ -465,7 +465,7 @@ struct Map_Str_Ptr native internal
native void Remove(String key);
}
struct MapIterator_Str_Ptr native internal
struct MapIterator_Str_Ptr native unsafe(internal)
{
native bool Init(Map_Str_Ptr other);
native bool ReInit();
@ -478,7 +478,7 @@ struct MapIterator_Str_Ptr native internal
native void SetValue(voidptr value);
}
struct Map_Str_Str native internal
struct Map_Str_Str native unsafe(internal)
{
native void Copy(Map_Str_Str other);
native void Move(Map_Str_Str other);
@ -497,7 +497,7 @@ struct Map_Str_Str native internal
native void Remove(String key);
}
struct MapIterator_Str_Str native internal
struct MapIterator_Str_Str native unsafe(internal)
{
native bool Init(Map_Str_Str other);
native bool ReInit();