Skip to content

Commit d8d0949

Browse files
Add WASAPI and Win32 extensions for audio and system interactions
- Implement WASAPI extension for direct audio control using ctypes, including: - Device enumeration for default render and capture endpoints - Functions to get and set master volume and mute state - Handle management for audio devices and volumes - Introduce Win32 extension for common Windows API interactions, featuring: - Generic WIN_CALL operator for invoking functions from Win32 DLLs - Convenience functions for message boxes, sleep, and error handling - File operations including create, read, write, and close handle - Memory management functions for virtual allocation and freeing Update the way the interpreter searches for extension pointer files (.asmx)
1 parent 7386677 commit d8d0949

File tree

7 files changed

+1711
-8
lines changed

7 files changed

+1711
-8
lines changed

SPECIFICATION.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,9 @@
245245
246246
- Extensions: the interpreter may also accept zero or more *extension* arguments that load Python extension modules before parsing and execution. Extensions may add new operators, new runtime types, and runtime hooks (including custom REPL implementations), but MUST NOT replace or modify existing built-in operators or types.
247247
- A Python extension is a `.py` file that defines `ASM_LANG_EXTENSION_API_VERSION = 1` (optional; defaults to 1) and a callable `asm_lang_register(ext)` entrypoint.
248-
- A pointer file is a `.asmx` text file containing one extension path per line. Lines are trimmed; blank lines are ignored; lines beginning with `#` are comments. Relative paths are resolved relative to the `.asmx` file's directory.
248+
- A pointer file is a `.asmx` text file containing one extension path per line. Lines are trimmed; blank lines are ignored; lines beginning with `#` are comments. Relative paths are resolved relative to the `.asmx` file's directory; when a referenced path is not found there the interpreter will also try the current working directory and, as a final fallback, the interpreter's own `ext/` subdirectory.
249249
- If a `.asmx` file is supplied as an argument, all of the linked extensions are loaded.
250-
- If no explicit extension arguments are provided, the interpreter will automatically look for a pointer file named `.asmx` in the current working directory and, when a program path is being executed (not when `-source` is used), in the program's directory; if found, the extensions listed in that pointer file are loaded as if supplied on the command line.
250+
- If no explicit extension arguments are provided, the interpreter will automatically look for a pointer file named `.asmx` in the current working directory. When a program path is being executed (not when `-source` is used), the interpreter also checks the program's directory for a `.asmx` pointer file and will additionally accept a pointer file that shares the program's basename but ends with `.asmx` (for example `program.asmln` alongside `program.asmx`). If any pointer file is found the extensions listed in that pointer file are loaded as if supplied on the command line.
251251
- Extensions are loaded before parsing so that extension-defined type names are recognized in typed assignments and function signatures.
252252
- If the only supplied positional inputs are extensions (and no program is supplied), the interpreter runs the REPL with the loaded extensions.
253253
- Hook surfaces exposed by the reference implementation include:

asm-lang.exe

1.96 KB
Binary file not shown.

asm-lang.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,13 @@ def run_cli(argv: Optional[List[str]] = None) -> int:
158158
program_asmx = os.path.join(program_dir, ".asmx")
159159
if os.path.exists(program_asmx):
160160
ext_paths.append(program_asmx)
161+
else:
162+
# Also accept a pointer file that shares the program's
163+
# basename but uses the .asmx extension instead of the
164+
# program extension (e.g. program.asmln -> program.asmx).
165+
program_alt_asmx = os.path.splitext(os.path.abspath(program))[0] + ".asmx"
166+
if os.path.exists(program_alt_asmx):
167+
ext_paths.append(program_alt_asmx)
161168

162169
try:
163170
services = load_runtime_services(ext_paths) if ext_paths else load_runtime_services([])

0 commit comments

Comments
 (0)