Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion creator-assembler
7 changes: 3 additions & 4 deletions docs/schema/architecture.json
Original file line number Diff line number Diff line change
Expand Up @@ -1186,8 +1186,7 @@
"global_clear",
"global_disable",
"global_enable",
"handlers",
"is_global_enabled"
"handlers"
],
"properties": {
"check": {
Expand Down Expand Up @@ -1235,8 +1234,8 @@
"type": ["string", "null"]
},
"is_global_enabled": {
"description": "JS code to check whether interrupts are globally is enabled. Must return a boolean",
"type": "string"
"description": "JS code to check whether interrupts are globally is enabled. Must return a boolean. If not specified, always returns `true`",
"type": ["string", "null"]
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ type ArchitectureInterrupts = {
global_disable: string;
check: string;
is_enabled?: string;
is_global_enabled: string;
is_global_enabled?: string;
clear?: string;
global_clear: string;
create: string;
Expand Down
23 changes: 14 additions & 9 deletions src/core/executor/InterruptManager.mts
Original file line number Diff line number Diff line change
Expand Up @@ -180,14 +180,19 @@ class ArchitectureInterruptHandler extends InterruptHandler {

public globalClear = this.#makeInjectedFunction(this.#config.global_clear);

public isGlobalEnabled = this.#makeInjectedFunction(
this.#config.is_global_enabled,
);

public isEnabled = this.#makeInjectedFunction(
"type",
this.#config.is_enabled ?? this.#config.is_global_enabled,
);
public isGlobalEnabled =
// eslint-disable-next-line eqeqeq
this.#config.is_global_enabled == null // covers for undefined
? (..._args: unknown[]) => {
return true;
}
: this.#makeInjectedFunction(this.#config.is_global_enabled);

public isEnabled =
// eslint-disable-next-line eqeqeq
this.#config.is_enabled == null // covers for undefined
? this.isGlobalEnabled
: this.#makeInjectedFunction("type", this.#config.is_enabled);

public check = this.#makeInjectedFunction(this.#config.check);

Expand Down Expand Up @@ -290,7 +295,7 @@ export class InterruptManager {
/** Checks if a type of interrupt is globally enabled */
public isGlobalEnabled(): boolean {
this.handler.isGlobalEnabled(this.status);
return this.status.globalEnabled ;
return this.status.globalEnabled;
}

/** Clears a specific interrupt type */
Expand Down
Loading