Commit Graph

13168 Commits

Author SHA1 Message Date
Jeroen van Rijn
c33d2ff96b Missing paren. 2024-11-03 14:10:29 +01:00
Jeroen van Rijn
9199c6df34 mem.is_aligned is in bytes, not log2 bytes
Fix formula and clarify comment
2024-11-03 14:07:31 +01:00
Laytan
7cfaf0b181 Merge pull request #4415 from p2jason/master
Remove the event queue from odin.js and directly invoke callbacks so they are executed in context where prevent default is possible
2024-11-01 19:48:36 +01:00
Laytan Laats
8b5492dd4d fix tabs 2024-11-01 18:10:20 +01:00
Laytan Laats
92bc3a5b4d add time/timezone to docs 2024-11-01 18:01:49 +01:00
Laytan Laats
80393cb708 add CoreFoundation and Security to docs 2024-11-01 16:47:48 +01:00
Laytan Laats
7fd32a74c5 add kqueue to docs 2024-11-01 16:42:06 +01:00
Laytan Laats
f798f0b446 testing: separate the posix import into target files
This is needed for the docs generator to generate all the docs for the
posix package, if it is imported like it was on Windows it would
generate docs for the Windows version of the package which has much less
symbols exposed.
2024-11-01 16:27:45 +01:00
gingerBill
c3971fe5fa Merge pull request #4441 from Barinzaya/raymath-vectortransform-translation-fix
Fix raymath not applying matrix translations
2024-11-01 13:09:31 +00:00
Jeroen van Rijn
73193e99f7 Merge pull request #4442 from peachey2k2/master
Add "-build-mode:dynamic" to the "odin help build" output
2024-11-01 14:03:55 +01:00
peachey2k2
04b000370b Add "-build-mode:dynamic" to the "odin help build" output 2024-11-01 15:51:18 +03:00
Barinzaya
30cf3ed02f Fixed raymath not applying matrix translations.
Translation matrices use the w components of the matrix to apply the
transform, and thus only work when the w component is 1. In the
original raymath implementation, the multiplication is done manually
and adds the translation components directly to the result, as if w is
1, but in the Odin binding this is done with a matrix multiplication.
However, the w component is set to 0 instead of 1, resulting in the
translation not being applied.
2024-10-31 13:37:43 -04:00
p2jason
94acfaf21e Removed event hook callback from add_*_event_listener functions 2024-10-31 13:15:39 +00:00
p2jason
e825326d73 Removed event queue from add_*_event_listener JS functions and added event hook callback 2024-10-31 13:02:46 +00:00
Laytan
d4d546a63a Merge pull request #4438 from laytan/fixing-threads
fix thread_unix for Darwin after pthread corrections in posix package
2024-10-30 16:10:34 +01:00
Laytan Laats
cc3c9bd871 fix thread_unix for Darwin after pthread corrections in posix package
afed3ce removed the sys/unix package and moved over to sys/posix, it has
new bindings for the pthread APIs but should have been equivalent (not).

8fb7182 used `CANCEL_ENABLE :: 0`, `CANCEL_DISABLE :: 1`, `CANCEL_DEFERRED :: 0`, `CANCEL_ASYNCHRONOUS :: 1` for Darwin, while the
correct values are `1`, `0`, `2` and `0` respectively (same mistake was made for
FreeBSD in that commit).

What this meant is that the
`pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS)` was not actually
successful, but because the error wasn't checked it was assumed it was.
It also meant `pthread_setcancelstate(PTHREAD_CANCEL_ENABLE)` would
actually be setting `PTHREAD_CANCEL_DISABLE`.

The code in this PR restores the behaviour by now actually deliberately
setting `PTHREAD_CANCEL_DISABLE` and not setting
`PTHREAD_CANCEL_ASYNCHRONOUS` which was the previous behaviour that does
actually seem to work for some reason.

(I also fixed an issue in fmt where `x` would use uppercase if it was a
pointer.)
2024-10-30 15:51:56 +01:00
gingerBill
8a00d85cea Merge branch 'master' of https://github.com/odin-lang/Odin 2024-10-30 14:12:57 +00:00
gingerBill
2392300ffb Add warning for unsigned >= 0 like conditions in a for loop 2024-10-30 14:12:49 +00:00
gingerBill
f469bbb004 Merge pull request #4425 from bobsayshilol/misc-fixes
Misc fixes
2024-10-30 12:24:23 +00:00
gingerBill
ee76acd665 Merge pull request #4427 from laytan/posix-additions
Finish sys/posix with Linux and partial Windows support & clean up other packages as a result
2024-10-30 11:43:47 +00:00
gingerBill
8312528a87 Merge pull request #4436 from karl-zylinski/utf8string-last-rune-bug
Fix for using `utf8string.at` with last rune index returning wrong rune
2024-10-30 11:42:47 +00:00
Karl Zylinski
36b958c120 Fix for using utf8string.at with last rune index returning wrong rune. 2024-10-30 11:10:36 +01:00
Jeroen van Rijn
d8187d1cf2 Merge pull request #4432 from Kelimion/fix-4431
match_exact_value: return when type is compound
2024-10-29 14:05:07 +01:00
Jeroen van Rijn
b46b34228e match_exact_value: return when type is compound
fixes #4431
2024-10-29 13:59:11 +01:00
Laytan
47be77ead5 Merge pull request #4430 from Wyr0X/patch-1
fix cbor.to_json always returning array of tuples for objects
2024-10-29 11:46:51 +01:00
Jeroen van Rijn
28a3a68dc9 Fix image.which_bytes
Invert test in `which_bytes` to fix Softimage PIC detection. Fixes #4429.
2024-10-29 09:55:27 +01:00
Alexis Caraballo
31d5bc48a7 fix cbor.to_json always returning array of tuples for objects
to_json uses a small proc to check if all keys of an object are strings.
It was always returning false for any input.
2024-10-29 01:50:38 -03:00
Laytan
5f99d6b427 Merge pull request #4423 from laytan/rand-choice-bit-set
math/rand: add `choice_bit_set`
2024-10-28 20:23:45 +01:00
Laytan
cb2768625a math/rand: choice_bit_set return not_empty -> ok 2024-10-28 20:07:38 +01:00
Laytan
3e024347ee Merge pull request #4426 from SrMordred/patch-1
Update process_windows.odin
2024-10-28 20:06:24 +01:00
Laytan
7e12e37df9 fix test 2024-10-28 19:58:39 +01:00
Laytan
b7140875cf port pthread_mutex_t and pthread_cond_t from sys/unix cause miniaudio wants it 2024-10-28 19:42:27 +01:00
Laytan
0b4a4212bb clean up dynlib and path/filepath with sys/posix 2024-10-28 19:21:16 +01:00
Laytan
afed3ce6b5 remove pthread from sys/unix and use sys/posix where used 2024-10-28 19:20:43 +01:00
Laytan
e064f8c6be fix #load_directory including nested directories 2024-10-28 18:59:39 +01:00
Laytan Laats
1cebc025b0 sys/posix: impl rest of linux, impl some of Windows 2024-10-28 18:59:06 +01:00
Jeroen van Rijn
d4e87f7a62 Merge pull request #4421 from IllusionMan1212/fix-escaping-rune-greater-than-U-FFFF
core/io: correctly escape runes greater than 0xFFFF
2024-10-28 14:05:43 +01:00
Patric Dexheimer
b6599a52b5 Update process_windows.odin
Mistype
2024-10-27 23:27:18 -03:00
bobsayshilol
b59647084b Plug a memory leak
The call to |array_make()| always allocates and since this variable was
unused it lead to a leak. Simply plug it by removing it.
2024-10-27 22:02:34 +00:00
bobsayshilol
bb308b3ff4 Add missing guards around push/pop pragmas
This matches all the other places where we silence Windows warnings.
2024-10-27 22:02:34 +00:00
bobsayshilol
c1496ab6c0 Fix passing nullptr to args marked as non-null
libstdc++'s |memcpy| and |memset| both state that their inputs should
never be a nullptr since this matches the C spec. Some compilers act on
these hints, so we shouldn't unconditionally call these as it would
signal to the compiler that they can't be nullptrs.

As an example, the following code will always call |do_something()|
when compiled with optimisations since GCC version 4.9:
```
    void clear(void *ptr, int size) {
        memset(ptr, 0, size);
    }
    void example(void *ptr, int size) {
        clear(ptr, size);
        if (ptr != nullptr) do_something();
    }
```
2024-10-27 22:02:34 +00:00
bobsayshilol
4f800a7fda Avoid undefined arithmetic shifting
The result of a left shift on a positive signed integer (Rune) must fit
into an unsigned integer otherwise it's undefined behaviour, as is left
shifting a negative integer by any amount. This code can only be hit if
|x >= 0xf0| and hence a left shift of 31 will always be undefined
unless the input is 0 or 1.

To avoid hitting this we can instead extend the lowest bit to be the
mask if we assume that ints are 2's complement, which we already do
elsewhere. This generates identical code in testing on Compiler
Explorer and the Odin test suite passes locally with this change.

Note that the original code would change to be defined behaviour in
C++20, however we are currently build with |-std=c++14| in the build
scripts.
2024-10-27 22:02:34 +00:00
bobsayshilol
e67692b066 Avoid member access through nullptr in debug
If |result_count| is 0 then |results| will be a nullptr and hence the
access |results->Tuple| is undefined behaviour. There's already an
early return in the 0 branch so move that to be the first thing so that
we can guarantee that it's not a nullptr.

Note that technically we take the address of the result so it's not
actually dereferencing it, however UBSan doesn't care about that.
2024-10-27 22:02:34 +00:00
bobsayshilol
771d308d64 Fix invalid union access
UBSan spotted that |src->Basic.kind| had a value outside the range of
|BasicKind| due to it actually being a |Type_Pointer|. Since these are
stored in a union there could be cases where the value of |kind| just
so happens to be |Basic_string|, in which case the branch would have
been taken when it shouldn't have been.

To fix this simply check that it's a |Type_Basic| before treating it as
a |Basic|.
2024-10-27 21:24:36 +00:00
gingerBill
1f187adff4 Merge pull request #4416 from Yawning/fix/4413
src/big_int.cpp: Use square-multiply for exponentiation
2024-10-27 12:13:40 +00:00
gingerBill
35d818bb4e Fix possible leak in recursive filepath.glob 2024-10-27 12:10:10 +00:00
gingerBill
f32e27d2e4 Fix bug caused due to incorrect type checking looking for context not defined in a context 2024-10-27 11:10:55 +00:00
Laytan Laats
69d375705e fix the typeid type kind of a typeid being set to Typeid_Invalid 2024-10-27 01:11:44 +02:00
Laytan Laats
44eef21997 wgpu: add missing JS impl for RenderPassEncoderSetBlendConstant 2024-10-26 22:41:52 +02:00
Laytan Laats
bd38b4839c sys/wasm/js: add set_element_style 2024-10-26 22:41:14 +02:00