-
Notifications
You must be signed in to change notification settings - Fork 46
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
Support checkbuiltin
function
#239
Comments
Doesn't isfunction do that? Update: looks like only does progs functions unlike command "prvm_printfunction" Update2: Nevermind, it does builtins ... Sample code + output ...
Output: buf_sort isfunction? result is 1 |
You're right! I'd completely forgotten about that one. Thanks @Baker7 |
Actually, it's a little different. Similar to For example, using a builtin |
You can't have a QuakeC function with the same name as a builtin and use them both -- I don't think. So if you have a builtin myfunc and a QuakeC function myfunc, how are you going to distinguish which one to call if they both have the same name? So give the QuakeC implementation a different name? But then you don't need to do anything because existing isfunction can handle that (?) Optionally you could do something like: void (float a, float b) myfunc; void CSQC_Init () myfunc (a, b); /My raw thoughts |
The fallback wouldn't have the same name, just the same task. Even if the builtin hasn't been implemented, you still need a definition (declaration?) of the builtin in order to compile. |
When you compile there are statements like buf_sort = #292 // or whatever the number is At run-time, if builtin 292 doesn't exist, it kicks an error when it runs the statement calling builtin 292. This is why checkextension works because the code ALWAYS supports functions that do not exist, but lets your QuakeC decide whether to call them (and you checkextension or -- in your case issfunction --- to never call them if they aren't supported). |
If I defined |
|
Note: I was confused about checkbuiltin vs. isfunction in my first post -- and I got caught up in that and never quite got out of that tunnel completely. This checkbuiltin function would be great and I read the fte implementation. The extension system is "ok" but having a more fine-tuned checkbuiltin would make certain things easier, especially engine version upgrades where some new builtins were added. |
The
checkbuiltin
function allows for testing whether or not a builtin function is available, allowing the QuakeC code to support multiple engines, e.g.,The text was updated successfully, but these errors were encountered: