s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g m |
go to modules |
g o |
go to overview |
g r |
go to reference |
h |
toggle this help ( esc also exits) |
Defines language utilities like the type introspection system.
TAU | Constant doc comments first line. |
TAU64 | Constant doc comments first line. |
_type_table | The entry point for type introspection; an array of Type_Info .
|
add_build_file() | foreign
|
add_build_string() | foreign
|
set_build_file_path() | foreign
|
update_build_options() | foreign
|
array_add() | appends item to array , occupying the new highest index slot. Indices are zero-based.
|
array_add_if_unique() | FIXME: add description. Procedure description doc comments first line. |
array_unordered_remove() | FIXME: add description. Procedure description doc comments first line. |
array_reserve() | FIXME: add description. Procedure description doc comments first line. |
Optimization_Level | Flags to signal degree of effort (and time) the compiler should spend optimizing. |
Type_Info_Tag | Enumeration of the type categories supported by Jai. |
_Any | Data structure backing the Any type.
|
Build_Options | Flags to the compiler for controlling build-time behavior. |
Type_Info | Metadata for the types that appear in your program. |
Type_Info_Integer | Type info data structure for integer numbers. |
Type_Info_Float | Type info data structure for floating point numbers. |
Type_Info_Pointer | Type info data structure for pointers. |
Type_Info_Procedure | Type info data structure for procedures. |
Type_Info_Struct | Type info data structure for structs. |
Type_Info_Struct_Member | Type info data structure for members of structs. |
TAU : float : 6.283147;
Constant doc comments first line.
Second.line
TAU64 : float64 : 6.283185307179586;
Constant doc comments first line.
_type_table : [] ^Type_Info;
The entry point for type introspection; an array of Type_Info
.
/** from: https://youtu.be/JoNkttD_MUs?t=399 */
print_all_types :: () {
printf("The type table has %d entries:\n", _type_table.count);
for _type_table {
printf("%3d: ", it_index);
print_type(it, true);
printf("\n");
}
}
print_type :: (info : ^Type_Info, is_toplevel : bool) {
if !info then {
printf("Input type must not be null.\n");
return;
}
using Type_Info_Tag.members;
if info.type == INTEGER {
info_integer := cast(info, ^Type_Info_Integer);
if info_integer.signed then {
printf("s%d", info_integer.size_in_bits);
} else {
printf("u%d", info_integer.size_in_bits);
}
return;
}
if info.type == FLOAT {
info_float := cast(info, ^Type_Info_Float);
printf("float%d", info_float.size_in_bits);
return;
}
if info.type == BOOL {
printf("bool");
return;
}
if info.type == STRING {
printf("string");
return;
}
if info.type == POINTER {
info_pointer := cast(info, ^Type_Info_Pointer);
printf("^");
print_type(info_pointer.pointer_to, false);
return;
}
if info.type == PROCEDURE {
info_procedure := cast(info, ^Type_Info_Procedure);
printf("(");
for info_procedure.argument_types {
print_type(it, false);
if it_index != info_procedure.argument_types.count-1 then printf(", ");
}
printf(") -> ");
print_type(info_procedure.pointer_to, false);
return;
}
if info.type == VOID {
printf("void");
return;
}
if info.type == STRUCT {
info_struct := cast(info, ^Type_Info_Struct);
if info_struct.name && !is_toplevel then {
printf("%s", info_struct.name);
} else {
if info_struct.name then printf("%s :: ", info_struct.name);
printf("struct { ");
for info_struct.members {
printf("%s: ", it.name);
print_type(it.type, false);
printf(" offset %d", it.offset_in_bytes);
printf("; ");
}
}
return;
}
if info.type == ARRAY {
info_array := cast(info, ^Type_Info_Array);
if info_array.array_type == Type_Info_Array.DYNAMIC {
printf("[..] ");
} else if info_array.array_type == Type_Info_Array.FIXED {
printf("[%d] ", info_array.array_count);
} else {
printf("[] ");
}
if info_array.soa_packing != -1 then printf("SOA ");
print_type(info_array.element_type, false);
return;
}
if info.type == NULL {
printf("null");
return;
}
if info.type == ANY {
printf("Any");
return;
}
if info.type == ENUM {
info_enum := cast(info, ^Type_Info_Enum);
printf("enum"); // incomplete
return;
}
printf("??? (%d)", info.type);
}
_type_table
is an array of Type_Info. print_all_types
iterates over _type_table
and prints information about each type. add_build_file :: (filename: string) #foreign;
filename:string | name of file to be added to compilation project |
add_build_string :: (data: string) #foreign;
data:string | FIXME: add description |
set_build_file_path :: (filename: string) #foreign;
filename:string | FIXME: add description |
update_build_options :: () #foreign;
array_add :: (array: ^[..] $T, item: T);
appends item
to array
, occupying the new highest index slot. Indices are zero-based.
array:^[..] $T | array of any type |
item:T | item to add (must be of same type) |
array_add_if_unique :: (array: ^[..] $T, item: T) -> bool, s64;
FIXME: add description. Procedure description doc comments first line.
Additional procedure description documentation comments.
array:^[..] $T | FIXME: add description |
item:T | FIXME: add description |
array_unordered_remove :: (array: ^[..] $T, item: T) -> s64;
FIXME: add description. Procedure description doc comments first line.
Additional procedure description documentation comments.
Code sample:
for array
if it == null return it_index;
array:^[..] $T | FIXME: add description |
item:T | FIXME: add description |
array_reserve :: (array: ^[..] $T, count: s64) -> s64;
FIXME: add description. Procedure description doc comments first line.
Additional procedure description documentation comments.
Code sample:
for array
if it == null return it_index;
array:^[..] $T | FIXME: add description |
count:s64 | number of slots to pre-allocate for items of type T
|
jailang
2019 pixeldroid
https://github.com/pixeldroid/jailang |
programming pages theme v0.5.21 (https://github.com/pixeldroid/programming-pages) |
s |
focus search bar ( enter to select, ▲ / ▼ to change selection) |
g e |
go to examples |
g m |
go to modules |
g o |
go to overview |
g r |
go to reference |
h |
toggle this help ( esc also exits) |