-
Notifications
You must be signed in to change notification settings - Fork 9
fix(#117): Implement win32$φ atom #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The win32$φ atom now properly detects the Windows platform by returning the result of \`process.platform === 'win32'\`, replacing the previous unimplemented stub that threw an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek this is incorrect logic for the atom. Here you can find how this atom must be implemented: https://github.com/objectionary/eo/blob/master/eo-runtime/src/main/java/EOorg/EOeolang/EOsm/EOwin32%24EO%CF%86.java
- Refactor win32.js dispatcher to route function calls
- Create 17 separate modules in win32/ folder:
- 6 fully implemented: GetCurrentProcessId, ReadFile, WriteFile,
GetEnvironmentVariable, GetSystemTime, inet_addr
- 11 stubs for socket/WSA operations
- Add EO test suite (win32-test.eo) with 5 test cases matching Java reference
All 180 runtime tests pass. Implementation matches Java version.
Fix ESLint arrow-parens rule violation in win32/inet_addr.js
|
@maxonfjvipon This will help me complete all tasks faster. |
|
@skulidropek if you don't have windows pc, we have windows CI on GHA, you just need to write a test and make it test runnable only if current platform is windows |
maxonfjvipon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek in general PR is good, but it's quite big and complex, so it'll be not easy to review to carefully. Please try to make a smaller PRs in the future.
Also it would be better to introduce some syntetic js tests for a several syscalls, check this: https://github.com/objectionary/eo/blob/master/eo-runtime/src/test/java/EOorg/EOeolang/EOsm/EOwin32Test.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek let's move this function out of win32$φ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek let's make a single 'interface' for each function so you can just do func(rho, args) for all functions
| 'GetEnvironmentVariable requires 1 argument (variable name)' | ||
| ) | ||
| } | ||
| const varName = getArg(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek we're trying not to use complex variable names, read this: https://www.yegor256.com/2015/01/12/compound-name-is-code-smell.html
Go though all variable and function arguments and fix this
| second: now.getSeconds(), | ||
| milliseconds: now.getMilliseconds(), | ||
| } | ||
| return data.toObject(JSON.stringify(result)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek that's not gonna work because you'll get JSON which will be converted to string, please learn more carefully how this object is supposed to work
| } | ||
| const filePath = getArg(0) | ||
| try { | ||
| const content = fs.readFileSync(String(filePath), 'utf8') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek this implementation has very high level of abstraction because fs.readFileSync is platform independ and you don't use file descriptor which is the first argument. Please learn implementation of EOorg.EOeolang.EOsm.Win32.ReadFileFuncCall.java more carefully
| ) | ||
| } | ||
| const ipString = getArg(0) | ||
| // Validate IP address format (simplified IPv4 validation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek we're trying not to used comment inside function body. Instead, move all the necessary documentation to the function js-doc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek this comment is unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek we're trying not to use empty lines in function body, read this: https://www.yegor256.com/2014/11/03/empty-line-code-smell.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek let's move this object out of win32$φ function
| @@ -0,0 +1,45 @@ | |||
| # SPDX-FileCopyrightText: Copyright (c) 2016-2025 Objectionary.com | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@skulidropek not a good place for such tests. Please check eo2js/test/it/runtime-tests.test.js. Here you can find excluded sys/win32-tests. Remove them for the exclude list and make sure they pass
3d43c78 to
2242976
Compare
#117
The win32$φ atom now properly detects the Windows platform by returning the result of `process.platform === 'win32'`, replacing the previous unimplemented stub that threw an error.