Builtin functions - #232
Open
mascarenhas wants to merge 15 commits into
Open
mascarenhas wants to merge 15 commits into
mascarenhas wants to merge 15 commits into
Conversation
Member
Author
|
By the way, let's not get hung up on the specific interfaces and implementations for the builtin functions included in this PR, the lack of option types (and optional parameters) and proper error handling in Titan right now restricts what we can do. These builtin functions can improve later as the type system improves. |
Codecov Report
Continue to review full report at Codecov.
|
… for vararg primitives
…m instead of titan.h
Member
Author
|
Rebased this onto the current master. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the capability of having builtin functions in the Titan runtime that are callable directly from Titan code, and defines a few builtins available to all Titan modules (such as
print).The idea is to use builtin functions for standard library functions that need to access Titan's Lua state, and for functions that do not need to access the Lua state but where it is incovenient or impossible to define the function by a combination of Titan code plus FFI calls.
These builtin functions have the Titan calling convention, apart from the addition of variadic arguments, encoded as an
intparameter that takes the size of the variadic argument list, and a standard C variadic parameter.The C name of a builtin function is always
titan_<name>for the builtins that are not part of any module, such asprintandtostring, andtitan_<mangled_fqtn>for builtins declared in as part of a module, wheremangled_fqtnis the fully-qualified name of the function with all dashes and dots replaced by underscores.