Fix assert; exporting rules

This commit is contained in:
Ginger Bill
2016-09-22 23:18:29 +01:00
parent 2e506b7e6e
commit ee0aa7b9de
5 changed files with 45 additions and 49 deletions

View File

@@ -5,14 +5,13 @@
// #import "punity.odin" as pn
main :: proc() {
// struct_padding()
// bounds_checking()
// type_introspection()
// any_type()
// crazy_introspection()
// namespaces_and_files()
namespaces_and_files()
// miscellany()
// ht.run()
@@ -125,11 +124,11 @@ bounds_checking :: proc() {
// x[-1] = 0; // Compile Time
// x[4] = 0; // Compile Time
/*{
{
a, b := -1, 4;
x[a] = 0; // Runtime Time
x[b] = 0; // Runtime Time
}*/
// x[a] = 0; // Runtime Time
// x[b] = 0; // Runtime Time
}
// Works for arrays, strings, slices, and related procedures & operations
@@ -190,11 +189,9 @@ type_introspection :: proc() {
fmt.println()
fmt.print("Type of v1 is:\n\t", t1)
// fmt.fprint_type(os.stdout, t1)
fmt.println()
fmt.print("Type of v2 is:\n\t")
fmt.fprint_type(os.stdout, t2)
fmt.print("Type of v2 is:\n\t", t2)
fmt.println("\n")
fmt.println("t1 == t2:", t1 == t2)
@@ -205,9 +202,9 @@ type_introspection :: proc() {
any_type :: proc() {
a: any
x := 123
y := 6.28
z := "Yo-Yo Ma"
x: int = 123
y: f64 = 6.28
z: string = "Yo-Yo Ma"
// All types can be implicit cast to `any`
a = x
a = y
@@ -267,7 +264,7 @@ crazy_introspection :: proc() {
name := (fruit_ti as ^Type_Info.Named).name // Unsafe casts
info := type_info_base(fruit_ti) as ^Type_Info.Enum // Unsafe casts
fmt.printf("% :: enum % {", name, info.base);
fmt.printf("% :: enum % {\n", name, info.base);
for i := 0; i < info.values.count; i++ {
fmt.printf("\t%\t= %,\n", info.names[i], info.values[i])
}
@@ -293,6 +290,10 @@ crazy_introspection :: proc() {
// #import "test.odin"
namespaces_and_files :: proc() {
// test.thing()
// test.format.println()
// test.println()
/*
// Non-exporting import
#import "file.odin"

View File

@@ -1,4 +1,3 @@
#import "fmt.odin" as fmt
#foreign_system_library "Ws2_32"

View File

@@ -1,38 +1,36 @@
#import "fmt.odin"
/*#import "fmt.odin"
thing :: proc() {
fmt.println("Hello!")
fmt.println("Hello1!")
}*/
#import "fmt.odin" as format
thing :: proc() {
format.println("Hello2!")
}
/*
#import "fmt.odin" as fmt
/*#import "fmt.odin" as .
thing :: proc() {
fmt.println("Hello!")
println("Hello3!")
}
*/
/*#import "fmt.odin" as _
thing :: proc() {
// println("Hello4!")
}
*/
/*
#import "fmt.odin" as .
thing :: proc() {
println("Hello!")
}
*/
/*
#import "fmt.odin" as _
thing :: proc() {
// println("Hello!")
}
*/
/*
#load "fmt.odin"
thing :: proc() {
println("Hello!")
}
*/
println("Hello5!")
}*/