Commit Graph

1136 Commits

Author SHA1 Message Date
Jeroen van Rijn
d2d187eaaa Work around untyped nil 2025-06-08 22:53:52 +02:00
Tohei Ichikawa
7662e7d843 Removed obsolete tz param from gettimeofday 2025-06-08 16:07:11 -04:00
Tohei Ichikawa
876f1c02b7 Added missing parameter to gettimeofday 2025-06-08 12:47:50 -04:00
Jeroen van Rijn
f1ce9f98d8 Re-add htonl and htons for those porting from C. 2025-06-06 13:13:34 +02:00
Jeroen van Rijn
4b36306674 Deprecate old @(deprecated) things. 2025-06-06 10:42:34 +02:00
Jeroen van Rijn
ae5c92ac38 Enable odin check examples/all for JS. 2025-06-04 11:08:25 +02:00
Ben Ryan
cd417b0d1f Add windows bindings to support overlapped IO 2025-06-04 11:34:31 +10:00
gingerBill
cd1f66e85c Merge pull request #5246 from RichardFevrier/master
Posix: Signal: add SIGWINCH support
2025-06-02 11:50:49 +01:00
Richard Février
f27f9bcd33 Posix: Signal: add SIGWINCH support 2025-05-31 10:01:59 +02:00
Alexander Lunsford
edba218a7c Simplified function call to loadCstringDirect 2025-05-30 20:02:08 -05:00
Alexander Lunsford
9d223e178b Fix odin.js loadCstring to use pointer address correctly. 2025-05-30 19:50:34 -05:00
Zach Clark
78d83288a0 Add missing SEL _cmd argument to objc class_addMethod IMPs
When trying to grab the window pointer off the notification in a
windowDidBecomeKey implementation, I kept getting segfaults calling
notification->object(). The second argument of these needs to be a SEL.

https://developer.apple.com/documentation/objectivec/class_addmethod(_:_:_:_:)?language=objc#Discussion

I imagine existing code is getting by by setting the window information
in the delegate's context userdata, which works fine when you only have
one window as you can avoid needing to call notification->object(),
until you want one delegate assigned to two windows, hard to work around.
2025-05-27 17:04:19 -07:00
Vincent Billet
d98253564b MAKEFOURCC: changed BYTE to byte 2025-05-26 22:31:21 +02:00
Laytan Laats
eac58fc640 sys/info: populate cpu.physical_cores and cpu.logical_cores on Darwin 2025-05-26 20:41:18 +02:00
Vincent Billet
9b7bb9290e HRESULT_FROM_WIN32 correction 2025-05-26 08:52:46 +02:00
Vincent Billet
bb274ab512 Merge branch 'odin-lang:master' into badaxis/Windows-Audio&Winmm 2025-05-26 08:16:45 +02:00
Jeroen van Rijn
655fab7227 Add core/hyperthread count for Windows and Linux (#5216)
Add core/hyperthread count to `core:sys/info` for Windows and Linux.
TODO: Linux RISCV, Linux ARM, Darwin, and the BSDs.
2025-05-25 19:43:10 +02:00
Vincent Billet
1ed05c2498 Retracted some winmm changes 2025-05-22 12:15:16 +02:00
Vincent Billet
240d45201d Reverted CoCreateInstance formatting 2025-05-22 09:14:33 +02:00
Vincent Billet
b03cdd22d5 COM & Audio useful bindings 2025-05-21 09:48:41 +02:00
Krzesimir Nowak
3519cecb7c Formatting fixes 2025-05-18 15:25:17 +02:00
Krzesimir Nowak
306d3a16c4 sys/linux: Improve documentation for Dirent and related procedures 2025-05-17 20:05:51 +02:00
Jeroen van Rijn
d6210ae76f Fix -vet complaints in core:sys/darwin/Foundation 2025-05-17 16:36:10 +02:00
gingerBill
5454e120fe Add NSMenuItem.odin 2025-05-17 13:27:54 +01:00
gingerBill
d77124feae Add Objective-C helper for creating subclasses 2025-05-17 11:36:24 +01:00
Jeroen van Rijn
be24feb862 Move things to constants.odin 2025-05-12 17:13:59 +02:00
Jeroen van Rijn
dec3d6959d Update linux.Map_Flags_Bits
Fixes #5151

- Removes `SHARED_VALIDATE` from the enum and turns it into `Map_Shared_Validate :: Map_Flags{.SHARED, .PRIVATE}` so it has the proper value of 0x03.
- Adds `DROPPABLE`.
- Adds constants `MAP_HUGE_SHIFT` and `MAP_HUGE_MASK`.
- Adds the huge page precomputed constants from `mman.h`, defined as the log2 of the size shifted left by `MAP_HUGE_SHIFT`:
	Map_Huge_16KB
	Map_Huge_64KB
	Map_Huge_512KB
	Map_Huge_1MB
	Map_Huge_2MB
	Map_Huge_8MB
	Map_Huge_16MB
	Map_Huge_32MB
	Map_Huge_256MB
	Map_Huge_512MB
	Map_Huge_1GB
	Map_Huge_2GB
	Map_Huge_16GB
2025-05-12 16:45:51 +02:00
Laytan Laats
cacb9f9f54 os2: better copy_directory, and add native copy_file and copy_directory variants on MacOS 2025-05-08 19:32:30 +02:00
gingerBill
edbe7aa06e Merge pull request #5091 from Badaxis/badaxis/windows-scancodes
Adding windows keyboard scan codes
2025-05-08 16:33:14 +01:00
Jeroen van Rijn
8032db3484 Fix CreateDibSection binding 2025-05-05 23:23:39 +02:00
omark96
1b8a65c327 win/sys: Add GetWindowThreadProcessId 2025-05-03 23:44:55 +02:00
Vincent Billet
d24bac8a36 Adding windows keyboard scan codes 2025-04-29 18:00:41 +02:00
Harold Brenes
040d8b1d48 Fix 2 selectors in NSDictionary 2025-04-17 15:22:10 -04:00
jason
4998d4ebd0 Fix linux.dirent_name
Was not searching the first possible byte for 0.
2025-04-13 12:05:39 -04:00
Jeroen van Rijn
a6977ac733 Remove stray import. 2025-04-05 19:25:39 +02:00
Jeroen van Rijn
4b203d0c78 Fix segfault in core:sys/info on WSL2 2025-04-05 19:23:58 +02:00
Laytan Laats
ff7d55a8e1 net: rework errors to be cross-platform 2025-04-05 17:35:19 +02:00
Harold Brenes
c5980ba6c4 Add linux build tag to core/sys/linux/sys.odin 2025-04-02 16:39:25 -04:00
Jonathan Tron
1b5e83bfb6 Prevent odin.js from printing empty line in the console for the ending "\n" 2025-03-26 21:58:58 +01:00
gingerBill
6fd752f647 Merge pull request #4959 from wisonye/master
Fixed: Freebsd syscall 'getpeername' is missing.
2025-03-24 10:10:15 +00:00
Yawning Angel
982ab11aa1 core/crypto/sha2: Use hardware SHA224/256 when available (AMD64) 2025-03-23 19:14:33 +09:00
Wison Ye
61acb15529 #4959, fixed the broken CI build. 2025-03-23 13:32:11 +13:00
Wison Ye
2af691f587 Fixed: Freebsd syscall 'getpeername' is missing. 2025-03-23 13:22:19 +13:00
Wison Ye
17a01dcebf Merge remote-tracking branch 'upstream/master' 2025-03-22 17:52:43 +13:00
Wison Ye
01e81fe597 Fixed #4892: 'EPoll_Event.events' should be bit set. 2025-03-22 17:51:08 +13:00
Laytan Laats
cf0f73e0cf fix typo for freebsd arm64 MINSIGSTKSZ
Fixes #4878
2025-03-21 23:52:52 +01:00
Laytan Laats
73fd564634 fix tabs 2025-03-21 23:02:00 +01:00
Jonathan Tron
2bccd07426 Prevent registering the same event listener twice on the same element with the exact same data in wasm. 2025-03-21 09:38:23 +01:00
Jonathan Tron
dbe53d053a Fix add/remove event listeners in core:sys/wasm
There were multiple issues here:

1. listeners stored in the same key overwriting the previous one
2. missing `use_capture` parameter in `remove_event_listener`/`remove_window_event_listener`

The key used to store the listener function in `listenerMap` was a
javascript `Object`, when used as a key it was thus serialized to
the string `"[object Object]"`, meaning all listeners where effectively
set to the same key when calling `add_event_listener`/`add_window_event_listener`.
Later on when calling `remove_event_listener`/`remove_window_event_listener`,
it then tried to remove the incorrect one or none at all if there was a
mix of the same event name registered on an element or the window.

To fix I implemented a function `listener_key` in the javascript code
which will generate a different key based on the event's:
- `id`: dom element's id or 'window' (when event listener added to the
  window)
- `name`: the event name (eg: `click`), each event handler should be
  removed for the event name it was register on.
- `data`: we can register events with different data, each one generate
  a new listener which has to be removed.
- `callback`: same as `data`, if you register two similar handler but
  with two different callback, each one should be removed.
- `useCapture`: this one is a bit tricky, but when you register an event
  handler in javascript, if you don't pass `useCapture`, it defaults to `false`.
  When you remove an handler, you have to pass the exact same
  `useCapture` option you registered it with. In this case, we allowed
  to register an event with different `useCapture`, but didn't allow to
  pass the `useCapture` when removing it. We always called `removeEventListener`
  without the `useCapture` parameter which removed the handler properly
  only when it was registered with `useCapture=false`.

I also switched the `WasmMemoryInterface.listenerMap` from `{}`
(javascript object) to a `new Map()`, which is available everywhere
nowadays.
2025-03-20 16:43:49 +01:00
gingerBill
408b3af550 Merge pull request #4933 from laytan/js-open-binding
core/sys/wasm/js: add `open` binding to `window.open`
2025-03-13 09:22:20 +00:00