Skip to content

Introduce DaedalusVm::top_is_reference#113

Merged
lmichaelis merged 1 commit into
GothicKit:mainfrom
Try:top_is_reference
Nov 9, 2025
Merged

Introduce DaedalusVm::top_is_reference#113
lmichaelis merged 1 commit into
GothicKit:mainfrom
Try:top_is_reference

Conversation

@Try
Copy link
Copy Markdown
Contributor

@Try Try commented Nov 8, 2025

This PR adds a function to inspect top record of the stack without removing it.

Need to add this one, in order to support _@ in ikarus.
Sometimes argument for _@ can be a reference, such as:

int MAXCHAR;
...
CALL_INTPARAM(_@(MAXCHAR));

in this case opengothic will map them into the "Ikarus memory".

and sometimes _@ may take an instance, that decays into an integer, such as:

func int LIST_END(var int LIST) {
    var ZCLIST L;
    if (!(LIST)) {
        _LIST_ERRPTR("End");
        return 0;
    };
    L = _^(LIST);
    WHILE(L.NEXT);
    L = _^(L.NEXT);
    END;
    return _@(10426);
}

In that case 10426 is ID of the symbol LIST_END.L, and instance associated with it need to be returned by pointer.

@lmichaelis lmichaelis self-assigned this Nov 9, 2025
@lmichaelis lmichaelis added the enhancement New feature or request label Nov 9, 2025
@lmichaelis
Copy link
Copy Markdown
Member

Looks good!

@lmichaelis lmichaelis merged commit 02c7d6f into GothicKit:main Nov 9, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants