Commit Graph

116 Commits

Author SHA1 Message Date
gingerBill
af3184adc9 Change is_utf16 field to encoding and use an enum 2025-08-05 15:12:54 +01:00
gingerBill
ae02d3d02d Begin supporting string16 across the core library 2025-08-02 11:55:16 +01:00
gingerBill
9b8223dd69 Remove use of .no_copy 2025-07-30 23:19:14 +01:00
gingerBill
3dcc22fa6d Change hashing rules for float-like types to make 0 == -0 2025-04-16 10:52:35 +01:00
Jeroen van Rijn
bb38775fb1 Remove Type_Info_Tuple 2025-04-13 21:51:57 +02:00
Jeroen van Rijn
41d4ddbc5e Add reflect.length + reflect.capacity support for #simd[N]T 2025-04-11 22:44:02 +02:00
Jeroen van Rijn
f4ce84dfb4 Add fix to reflect.typeid_elem 2025-04-11 22:24:19 +02:00
gingerBill
e38a08013e Remove #relative types from the compiler 2024-11-14 16:17:24 +00:00
Laytan Laats
9c374b4d02 reflect: add enum_value_has_name proc
Easy way to check if the current value has a defined name/member in the
enum type.
2024-11-11 18:56:59 +01:00
Jeroen van Rijn
8ad4427a25 Add a few more reflect.bit_field_* helpers. 2024-08-30 22:40:14 +02:00
Jeroen van Rijn
db3bcd2cea Add reflect.bit_fields_zipped 2024-08-30 22:04:10 +02:00
unknown
ae5ef0ce9c fix core:reflect/iterator.odin 2024-08-24 16:01:49 -04:00
Laytan Laats
dec97cbddb fix type_info_union_is_pure_maybe only working with regular pointers
Fixes #3996
2024-08-11 21:07:21 +02:00
Jeroen van Rijn
17ebaffce8 Update comment. 2024-08-05 22:12:22 +02:00
Jeroen van Rijn
4902288a5a Add reflect.struct_field_count that returns the number of fields in a struct type
Example:
```odin
package struct_count_example

import "core:fmt"
import "core:reflect"
import "core:dynlib"

Foo :: struct{
	one: int,
	two: f32,
}

Bar :: struct {
	three: int,
	four:  bool,
	five:  f64,
}

Game_Api :: struct {
	init:      proc(api: ^Game_Api),
	update:    proc(api: ^Game_Api),

	using foo: Foo,
	bar:       Bar,

	// Private stuff
	reload_count: int,
	__handle:     rawptr,
}
API_PRIVATE_COUNT :: 2

game_api: Game_Api

main :: proc() {
	fmt.printfln("Game_Api, .Top:       %v", reflect.struct_field_count(Game_Api))              // 6
	fmt.printfln("Game_Api, .Using:     %v", reflect.struct_field_count(Game_Api, .Using))      // 8
	fmt.printfln("Game_Api, .Recursive: %v", reflect.struct_field_count(Game_Api, .Recursive))  // 11

	symbols_loaded, _  := dynlib.initialize_symbols(&game_api, "game.dll")
	symbols_expected   := reflect.struct_field_count(Game_Api) - API_PRIVATE_COUNT

	if symbols_loaded == -1 {
		fmt.eprintln("Couldn't load game.dll")
		return
	} else if symbols_loaded != symbols_expected {
		fmt.eprintfln("Expected %v symbols, got %v", symbols_expected, symbols_loaded)
		return
	}
}
```
2024-08-05 22:04:16 +02:00
Laytan Laats
3e618bed40 fix reflect.any_base and reflect.any_core with any's containing nil 2024-07-22 00:51:38 +02:00
gingerBill
1c3240b6b5 Add #force_no_inline 2024-07-14 23:09:58 +01:00
gingerBill
399c3ab067 Reduce the size of runtime.Type_Info 2024-07-14 21:37:35 +01:00
gingerBill
45b2a6a19e Fix reflect.as_pointer 2024-07-04 13:37:47 +01:00
gingerBill
e296d6fb90 Fix loads of indentation issues with mixing spaces and tabs 2024-06-29 19:50:51 +01:00
gingerBill
c752d0b541 Fix printing of big endian integers in a bit_field 2024-04-27 09:16:18 +01:00
gingerBill
d5e6d722d3 Merge pull request #3045 from laytan/cbor
encoding/cbor
2024-04-15 14:28:52 +01:00
gingerBill
a750fc0ba6 Add #row_major matrix[R, C]T
As well as `#column_major matrix[R, C]T` as an alias for just `matrix[R, C]T`.
This is because some libraries require a row_major internal layout but still want to be used with row or major oriented vectors.
2024-03-19 21:05:23 +00:00
Laytan Laats
317931a3c5 encoding/cbor: deterministically store bit sets as big endian 2024-03-04 17:26:19 +01:00
gingerBill
a4b8c1ea17 Begin work adding bit_field 2024-02-22 15:55:54 +00:00
gingerBill
8472338bfa Add reflect.enum_name_from_value and reflect.enum_name_from_value_any 2024-02-21 12:43:09 +00:00
gingerBill
3e7e779abf Replace core:* to base:* where appropriate 2024-01-28 22:18:51 +00:00
gingerBill
ddcaa0de53 Remove core:mem dependency from core:reflect 2024-01-28 20:52:01 +00:00
gingerBill
30636f5114 Change return values from Struct_Tag to string 2024-01-28 15:48:19 +00:00
gingerBill
2cc22d118d Require parentheses for #align(N) 2023-08-15 14:55:02 +01:00
gingerBill
c91898a888 Remove #relative slices; Replace with #relative multi-pointers 2023-08-05 16:05:39 +01:00
gingerBill
3dec55f009 Replace x in &y Use &v in y syntax through core & vendor for switch/for statements 2023-06-26 15:42:57 +01:00
gingerBill
296674e18b Rename ODIN_DISALLOW_RTTI to ODIN_NO_RTTI; Remove dead command line flags 2023-06-12 14:53:05 +01:00
jakubtomsu
65bf7f6653 Remove typo 2023-04-23 20:00:25 +02:00
gingerBill
0b064765c9 Add reflect.struct_field_value 2023-03-17 11:47:39 +00:00
gingerBill
6179d4feb1 Rename to Type_Info_Parameters 2023-02-08 11:23:21 +00:00
gingerBill
4cb16db4e9 Remove @(require_results) from one procedure 2023-01-30 12:51:56 +00:00
gingerBill
8d43cc840a Add @(require_results) to package reflect 2023-01-29 11:28:05 +00:00
gingerBill
64047cbf05 Fix #2304 2023-01-16 11:02:42 +00:00
André (counter)
b3be2cdf9d Aliasing some procs to avoid code repetition
Aliasing some procedures within package reflect so they reference procedures from package runtime.
This avoids redundancy and potential deviation.
Not 100% sure about the ODIN_DISALLOW_RTTI part but I think it should be congruent as well.
2022-12-09 18:14:47 +01:00
gingerBill
7b4a87d37c Correct iterate_map 2022-11-10 12:33:49 +00:00
gingerBill
f6fc3ebe37 Add reflect/iterator.odin 2022-11-10 12:27:12 +00:00
gingerBill
6dd4d1a924 Correct reflection usage of maps 2022-11-08 11:50:55 +00:00
gingerBill
45f0c812af Correct reflect.map_entry_info_slice 2022-11-08 11:21:45 +00:00
gingerBill
c96e0afbf1 Begin work on implementing the new map internals 2022-11-07 23:02:21 +00:00
gingerBill
0c9ddd51a4 Keep -vet happy 2022-09-08 16:55:40 +01:00
gingerBill
f77709e67e Add intrinsics.type_convert_variants_to_pointers and reflect.get_union_as_ptr_variants 2022-09-08 16:52:51 +01:00
gingerBill
12c8db927b Remove direct core:mem dependency in core:reflect 2022-08-26 16:46:19 +01:00
gingerBill
b50b6b9f33 Add reflect.get_union_variant 2022-08-26 16:19:16 +01:00
Jeroen van Rijn
e40b3ad338 Remove unused n from PQ; add reflect.is_bit_set 2022-08-18 18:00:25 +02:00