Commit Graph

24 Commits

Author SHA1 Message Date
Bill Currie db8cf68ef3 [gamecode] Pass registered data pointer to builtins
This is the bulk of the work for recording the resource pointer with
with builtin data. I don't know how much of a difference it makes for
most things, but it's probably pretty big for qwaq-curses due to the
very high number of calls to the curses builtins.

Closes #26
2022-02-14 12:28:38 +09:00
Bill Currie c10b09d41b [ruamoko] Make RUA_Sprintf more generally useful
It now takes the function name to print in error message (passed on to
PR_Sprintf) and the argument number of the format string. The variable
arguments (in ...) are assumed to be immediately after the format
argument.
2022-02-05 20:24:17 +09:00
Bill Currie b425f449b6 [ruamoko] Separate the two str_mid builtins
pr_argc cannot be used in Ruamoko progs because nothing sets it. This
fixes the parse errors and resulting segfault when trying to parse the
Vulkan pipeline config.
2022-02-04 11:38:36 +09:00
Bill Currie b8c2b7f856 [ruamoko] Make a common sprintf wrapper function
This takes care of converting from progs varargs to what PR_Sprintf
expects. I got tired of modifying the wrappers when I found a third one.
2022-02-01 09:27:03 +09:00
Bill Currie 9c51c3d2e1 [gamecode] Add a data pointer passed to builtin functions
This is part of the work for #26 (Record resource pointer with builtin
function data). Currently, the data pointer gets as far as the
per-instance VM function table (I don't feel like tackling the job of
converting all the builtin functions tonight). All the builtin modules
that register a resources data block pass that block on to
PR_RegisterBuiltins.
2022-01-24 00:20:05 +09:00
Bill Currie a6b932025c [gamecode] Provide builtins with information about their parameters
This will make it possible for the engine to set up their parameter
pointers when running Ruamoko progs. At this stage, it doesn't matter
*too* much, except for varargs functions, because no builtin yet takes
anything larger than a float quaternion, but it will be critical when
double or long vec3 and vec4 values are passed.
2022-01-23 22:27:27 +09:00
Bill Currie 2df64384c1 [gamecode] Clean up string_t and pointer_t
They are both gone, and pr_pointer_t is now pr_ptr_t (pointer may be a
little clearer than ptr, but ptr is consistent with things like intptr,
and keeps the type name short).
2022-01-18 12:11:14 +09:00
Bill Currie 37b6d11c01 [ruamoko] Add binding for str_upper
I can't believe I didn't do that when I did str_lower.
2021-01-05 18:24:18 +09:00
Bill Currie 54f2e417dc [ruamoko] Fix daft str_str abi
Returning a string was a bad idea as it makes str_str difficult to use
with str_mid. (actually, iirc, it was the only reason I moved all
strings into progs memory... hmm).
2020-04-08 21:54:41 +09:00
Bill Currie b7b8df0801 [ruamoko] Add str_lower builtin
This returns a string with all chars lower-cased.
2020-04-08 21:53:53 +09:00
Bill Currie 6b9d4a747d [ruamoko] Add a builtin to quote strings
All unprintable chars are converted to either standard escape sequences
or \xHH.
2020-04-01 21:28:25 +09:00
Bill Currie 58ebbb147d [ruamoko] Add some new string builtins
Wrappers for hold, valid and mutable. I have no idea why I didn't think
of wrapping string validation years ago.
2020-03-26 16:39:21 +09:00
Bill Currie 0ad9f559ea [ruamoko] Move some string functions
sprintf, vsprintf and strlen now in rua_strings, and strlen now returns
int like it should.
2020-03-25 00:04:20 +09:00
Bill Currie 694ad2e840 [ruamoko] Add str_char builtin
This returns the character (as an int) at the index. Equivalent to
string[index], but qc code doesn't have char-level access and not having
it means that strings can internally change to wchar without too much
fuss (maybe).
2020-03-10 18:16:55 +09:00
Bill Currie 2db5d04e3f Reduce the ephemeral nature of str_mid
When the substring is the tail of the supplied string, return a
"pointer" to within the supplied string rather than a new "return"
string. This means that tail-end substrings of string constants are
themselves constants.
2020-02-19 21:41:46 +09:00
Bill Currie e27d7cbd2d Handle alloca "correctly".
Use AC_FUNC_ALLOCA and the #ifdef mess suggested by the autoconf docs
(hidden in qfalloca.h).
2013-01-22 21:02:50 +09:00
Bill Currie bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie f75b0a611b Some compile fixes for OpenBSD 2011-08-25 22:35:20 +09:00
Bill Currie 81a57bb3fa patch from phrosty for vc2005 support. includes fixes for a bunch of gcc-isms that crept in over the years. 2007-03-22 23:20:57 +00:00
Bill Currie 3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie 6e0c70cac7 reduce the amount of memory needed to read menu.plist 2005-06-15 01:41:10 +00:00
Bill Currie 2a36c74120 add dynamic (freeable but unchangeable) strings
This is an imperfect revision of history.
2004-11-11 09:40:00 +00:00
Bill Currie e7ffad8772 more rua cleanups: now just one init function to call (it calls the rest) 2004-01-16 07:03:58 +00:00
Bill Currie 01392c78bb move the bulk of what whas libQFcsqc to libQFruamoko. 2004-01-16 05:46:19 +00:00
Renamed from libs/gamecode/builtins/bi_string.c (Browse further)