mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Parse directories to be packages
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
package atomics
|
||||
|
||||
// TODO(bill): Use assembly instead here to implement atomics
|
||||
// Inline vs external file?
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package bits
|
||||
|
||||
U8_MIN :: u8(0);
|
||||
U16_MIN :: u16(0);
|
||||
U32_MIN :: u32(0);
|
||||
@@ -1,3 +1,5 @@
|
||||
package c
|
||||
|
||||
CHAR_BIT :: 8;
|
||||
|
||||
c_bool :: bool;
|
||||
@@ -1,5 +1,6 @@
|
||||
// Multiple precision decimal numbers
|
||||
// NOTE: This is only for floating point printing and nothing else
|
||||
package decimal
|
||||
|
||||
Decimal :: struct {
|
||||
digits: [384]byte, // big-endian digits
|
||||
@@ -1,9 +1,11 @@
|
||||
import "core:os.odin"
|
||||
import "core:mem.odin"
|
||||
import "core:utf8.odin"
|
||||
import "core:types.odin"
|
||||
import "core:strconv.odin"
|
||||
import "core:raw.odin"
|
||||
package fmt
|
||||
|
||||
import "core:os"
|
||||
import "core:mem"
|
||||
import "core:unicode/utf8"
|
||||
import "core:types"
|
||||
import "core:strconv"
|
||||
import "core:raw"
|
||||
|
||||
|
||||
_BUFFER_SIZE :: 1<<12;
|
||||
@@ -1,4 +1,6 @@
|
||||
import "core:mem.odin"
|
||||
package hash
|
||||
|
||||
import "core:mem"
|
||||
|
||||
adler32 :: proc(data: []byte) -> u32 {
|
||||
ADLER_CONST :: 65521;
|
||||
@@ -1,3 +1,5 @@
|
||||
package math
|
||||
|
||||
TAU :: 6.28318530717958647692528676655900576;
|
||||
PI :: 3.14159265358979323846264338327950288;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
package rand
|
||||
|
||||
Rand :: struct {
|
||||
state: u64,
|
||||
inc: u64,
|
||||
@@ -1,5 +1,6 @@
|
||||
import "core:raw.odin"
|
||||
import "core:mem.odin"
|
||||
package mem
|
||||
|
||||
import "core:raw"
|
||||
|
||||
foreign __llvm_core {
|
||||
@(link_name = "llvm.bswap.i16") swap16 :: proc(b: u16) -> u16 ---;
|
||||
@@ -85,11 +86,11 @@ AllocationHeader :: struct {size: int};
|
||||
|
||||
allocation_header_fill :: proc(header: ^AllocationHeader, data: rawptr, size: int) {
|
||||
header.size = size;
|
||||
ptr := cast(^uint)(mem.ptr_offset(header, 1));
|
||||
n := mem.ptr_sub(cast(^uint)data, ptr);
|
||||
ptr := cast(^uint)(ptr_offset(header, 1));
|
||||
n := ptr_sub(cast(^uint)data, ptr);
|
||||
|
||||
for i in 0..n {
|
||||
mem.ptr_offset(ptr, i)^ = ~uint(0);
|
||||
ptr_offset(ptr, i)^ = ~uint(0);
|
||||
}
|
||||
}
|
||||
allocation_header :: proc(data: rawptr) -> ^AllocationHeader {
|
||||
@@ -1,7 +1,8 @@
|
||||
package opengl
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
foreign import lib "system:opengl32.lib"
|
||||
import win32 "core:sys/windows.odin"
|
||||
import "core:sys/wgl.odin"
|
||||
import win32 "core:sys/win32"
|
||||
} else when ODIN_OS == "linux" {
|
||||
foreign import lib "system:gl"
|
||||
}
|
||||
@@ -48,7 +49,7 @@ get_gl_proc_address :: proc(name: string) -> rawptr {
|
||||
}
|
||||
// NOTE(bill): null terminated
|
||||
assert((&name[0] + len(name))^ == 0);
|
||||
res := wgl.get_gl_proc_address(cstring(&name[0]));
|
||||
res := win32.get_gl_proc_address(cstring(&name[0]));
|
||||
if res == nil {
|
||||
res = win32.get_proc_address(_libgl, cstring(&name[0]));
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
package opengl
|
||||
|
||||
FALSE :: 0;
|
||||
TRUE :: 1;
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
when ODIN_OS == "windows" do export "core:os/windows.odin";
|
||||
when ODIN_OS == "osx" do export "core:os/osx.odin";
|
||||
when ODIN_OS == "linux" do export "core:os/linux.odin";
|
||||
when ODIN_OS == "essence" do export "core:os/essence.odin";
|
||||
package os
|
||||
|
||||
import "mem.odin";
|
||||
import "core:mem"
|
||||
|
||||
write_string :: proc(fd: Handle, str: string) -> (int, Errno) {
|
||||
return write(fd, cast([]byte)str);
|
||||
@@ -1,3 +1,5 @@
|
||||
package os
|
||||
|
||||
foreign import api "system:api"
|
||||
|
||||
Handle :: distinct int;
|
||||
@@ -17,8 +19,8 @@ ERROR_PATH_NOT_WITHIN_MOUNTED_VOLUME : Errno : -14;
|
||||
ERROR_PATH_NOT_FOUND : Errno : -15;
|
||||
ERROR_FILE_EXISTS : Errno : -19;
|
||||
ERROR_FILE_NOT_FOUND : Errno : -20;
|
||||
ERROR_DRIVE_ERROR_FILE_DAMAGED : Errno : -21;
|
||||
ERROR_ACCESS_NOT_WITHIN_FILE_BOUNDS : Errno : -22;
|
||||
ERROR_DRIVE_ERROR_FILE_DAMAGED : Errno : -21;
|
||||
ERROR_ACCESS_NOT_WITHIN_FILE_BOUNDS : Errno : -22;
|
||||
ERROR_ACCESS_DENIED : Errno : -23;
|
||||
ERROR_FILE_IN_EXCLUSIVE_USE : Errno : -24;
|
||||
ERROR_FILE_CANNOT_GET_EXCLUSIVE_USE : Errno : -25;
|
||||
@@ -1,8 +1,10 @@
|
||||
package os
|
||||
|
||||
foreign import dl "system:dl"
|
||||
foreign import libc "system:c"
|
||||
|
||||
import "core:strings.odin"
|
||||
import "core:mem.odin"
|
||||
import "core:strings"
|
||||
import "core:mem"
|
||||
|
||||
Handle :: distinct i32;
|
||||
File_Time :: distinct u64;
|
||||
@@ -1,8 +1,10 @@
|
||||
package os
|
||||
|
||||
foreign import dl "system:dl"
|
||||
foreign import libc "system:c"
|
||||
|
||||
import "core:strings.odin"
|
||||
import "core:mem.odin"
|
||||
import "core:strings"
|
||||
import "core:mem"
|
||||
|
||||
Handle :: distinct i32;
|
||||
File_Time :: distinct u64;
|
||||
@@ -1,5 +1,7 @@
|
||||
import win32 "core:sys/windows.odin"
|
||||
import "core:mem.odin"
|
||||
package os
|
||||
|
||||
import "core:sys/win32"
|
||||
import "core:mem"
|
||||
|
||||
Handle :: distinct uintptr;
|
||||
File_Time :: distinct u64;
|
||||
@@ -1,3 +1,5 @@
|
||||
package raw
|
||||
|
||||
Any :: struct {
|
||||
data: rawptr,
|
||||
typeid: typeid,
|
||||
@@ -1,10 +1,10 @@
|
||||
#shared_global_scope
|
||||
package runtime
|
||||
|
||||
import "core:os.odin"
|
||||
// import "core:fmt.odin" // TODO(bill): Remove the need for `fmt` here
|
||||
import "core:utf8.odin"
|
||||
import "core:raw.odin"
|
||||
import "core:mem.odin"
|
||||
import "core:os"
|
||||
// import "core:fmt" // TODO(bill): Remove the need for `fmt` here
|
||||
import "core:unicode/utf8"
|
||||
import "core:raw"
|
||||
import "core:mem"
|
||||
|
||||
// Naming Conventions:
|
||||
// In general, Ada_Case for types and snake_case for values
|
||||
@@ -1,4 +1,4 @@
|
||||
#shared_global_scope
|
||||
package runtime
|
||||
|
||||
/*
|
||||
@(link_name="__multi3")
|
||||
@@ -1,3 +1,5 @@
|
||||
package sort
|
||||
|
||||
bubble_sort_proc :: proc(array: $A/[]$T, f: proc(T, T) -> int) {
|
||||
assert(f != nil);
|
||||
count := len(array);
|
||||
@@ -1,4 +1,6 @@
|
||||
using import "core:decimal.odin"
|
||||
package strconv
|
||||
|
||||
using import "core:decimal"
|
||||
|
||||
Int_Flag :: enum {
|
||||
Prefix = 1<<0,
|
||||
@@ -1,5 +1,7 @@
|
||||
import "core:mem.odin"
|
||||
import "core:raw.odin"
|
||||
package strings
|
||||
|
||||
import "core:mem"
|
||||
import "core:raw"
|
||||
|
||||
new_string :: proc(s: string) -> string {
|
||||
c := make([]byte, len(s)+1);
|
||||
@@ -1,6 +1,7 @@
|
||||
package win32
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
foreign import "system:opengl32.lib"
|
||||
using import "core:sys/windows.odin"
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,5 @@
|
||||
package thread
|
||||
|
||||
#assert(ODIN_OS == "windows");
|
||||
|
||||
when ODIN_OS == "windows" {
|
||||
@@ -77,4 +79,4 @@ destroy :: proc(thread: ^Thread) {
|
||||
|
||||
terminate :: proc(using thread : ^Thread, exit_code : u32) {
|
||||
win32.terminate_thread(win32_thread, exit_code);
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
package types
|
||||
|
||||
are_types_identical :: proc(a, b: ^Type_Info) -> bool {
|
||||
if a == b do return true;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import "utf8.odin"
|
||||
package utf8
|
||||
|
||||
import "core:unicode/utf8"
|
||||
|
||||
REPLACEMENT_CHAR :: '\uFFFD';
|
||||
MAX_RUNE :: '\U0010FFFF';
|
||||
@@ -1,3 +1,5 @@
|
||||
package utf8
|
||||
|
||||
RUNE_ERROR :: '\ufffd';
|
||||
RUNE_SELF :: 0x80;
|
||||
RUNE_BOM :: 0xfeff;
|
||||
Reference in New Issue
Block a user