// Copyright (c) 2024 Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)

////////////////////////////////
//~ rjf: Tables

@table(name                 basic_string          basic_byte_size)
// NOTE(rjf): basic_byte_size == 0xFF? => address sized
TG_KindTable:
{
  {Null                      ""                    0    }
  {Void                      "void"                0    }
  {Handle                    "HANDLE"              0xFF }
  {Char8                     "char8"               1    }
  {Char16                    "char16"              2    }
  {Char32                    "char32"              4    }
  {UChar8                    "uchar8"              1    }
  {UChar16                   "uchar16"             2    }
  {UChar32                   "uchar32"             4    }
  {U8                        "U8"                  1    }
  {U16                       "U16"                 2    }
  {U32                       "U32"                 4    }
  {U64                       "U64"                 8    }
  {U128                      "U128"                16   }
  {U256                      "U256"                32   }
  {U512                      "U512"                64   }
  {S8                        "S8"                  1    }
  {S16                       "S16"                 2    }
  {S32                       "S32"                 4    }
  {S64                       "S64"                 8    }
  {S128                      "S128"                16   }
  {S256                      "S256"                32   }
  {S512                      "S512"                64   }
  {Bool                      "bool"                1    }
  {F16                       "F16"                 2    }
  {F32                       "F32"                 4    }
  {F32PP                     "F32PP"               4    }
  {F48                       "F48"                 6    }
  {F64                       "F64"                 8    }
  {F80                       "F80"                 10   }
  {F128                      "F128"                16   }
  {ComplexF32                "ComplexF32"          8    }
  {ComplexF64                "ComplexF64"          16   }
  {ComplexF80                "ComplexF80"          20   }
  {ComplexF128               "ComplexF128"         32   }
  {Modifier                  ""                    0    }
  {Ptr                       ""                    0    }
  {LRef                      ""                    0    }
  {RRef                      ""                    0    }
  {Array                     ""                    0    }
  {Function                  ""                    0    }
  {Method                    ""                    0    }
  {MemberPtr                 ""                    0    }
  {Struct                    "struct"              0    }
  {Class                     "class"               0    }
  {Union                     "union"               0    }
  {Enum                      "enum"                0    }
  {Alias                     "typedef"             0    }
  {IncompleteStruct          "struct"              0    }
  {IncompleteUnion           "union"               0    }
  {IncompleteClass           "class"               0    }
  {IncompleteEnum            "enum"                0    }
  {Bitfield                  ""                    0    }
  {Variadic                  ""                    0    }
}

////////////////////////////////
//~ rjf: Generators

@enum TG_Kind:
{
  @expand(TG_KindTable a) `$(a.name)`,
  COUNT,
  `FirstBasic      = TG_Kind_Void`,
  `LastBasic       = TG_Kind_ComplexF128`,
  `FirstInteger    = TG_Kind_Char8`,
  `LastInteger     = TG_Kind_S512`,
  `FirstSigned1    = TG_Kind_Char8`,
  `LastSigned1     = TG_Kind_Char32`,
  `FirstSigned2    = TG_Kind_S8`,
  `LastSigned2     = TG_Kind_S512`,
  `FirstIncomplete = TG_Kind_IncompleteStruct`,
  `LastIncomplete  = TG_Kind_IncompleteEnum`,
}

@data(U8) tg_kind_basic_byte_size_table:
{
  @expand(TG_KindTable a) `$(a.basic_byte_size)`;
}

@data(String8) tg_kind_basic_string_table:
{
  @expand(TG_KindTable a) `str8_lit_comp("$(a.basic_string)")`;
}
