preparation of separating GIB into its own module. Command-related
functions will stay in util, but the buffer handling code and interpreter
will be moved out of cmd.c.
With any luck it should actually work this time. Added the getimpulse
command so that GIB scripts can check if an impulse command is pending
before sending their own. Fixed all the memory leaks I could find.
QuakeC and GIB seem to be clean except for maybe one or two sneaky leaks
I can't track down.
This allows Cmd_Return_f to decide which buffer it should return a value
to. End result: you can put blocks of code with a return statement inside
an embedded command statement. I hope nobody minded me using my
quakeforge.net account to code a bit :P
to start. More will follow. Switched to doubles from floats and allowed
numbers with exponents to be parsed properly. Also changed the number of
significant digits printed to 10. Changed fov so it is now capped at 1,
not 10. The float value of fov is now used instead of int, so more
precision can be attained at small values.
Cmd_TokenizeString since I realized the code was just pulling it apart and
putting it back together. Added Cmd_Argsu to access the unprocessed
command. Added support for else following if in such a way that
if/else if/else structures work. Added support for unary operators in
EXP and added the ! (not) operator. The ifnot command will be kept
for variety.
to GIB. Fixed a bug in dstring_replace that was causing too much data to
be copied when the incoming string was larger than what was being replaced.
Very minor reorganization in cmd.c (1 function moved around I think).
cmd.c should probably get broken up into separate files soon.
add dstring_replace. this replaces a string of lenth rlen at position
pos with data of lenth len, growing, shrinking and shuffling data as
appropriate. At this rate, the dstring `class' will get buffer gap
editing capabilities :)
cmd.c:
Cmd_TokenizeString builds cmd_active_buffer->line again.
Cmd_Process bails out instantly if cmd_active_buffer is a legacy buffer
and uses dstring_replace to modify the parameters in
cmd_active_buffer->line. This last change results in drastic
simplification (and accuracy) of the commandline reconstruction code,
both in Cmd_TokenizeString and Cmd_Process.
handled, meaning that execution can be paused at any time without a hitch.
Warning: This is a major change to the architecture (or lack thereof) of
GIB. Please test for bugs! Also, there are a few ugly bits of code that
need to be cleaned up, but that work for now.
index into variables in either substitution (i.e. $bob[25]) or assignment
(i.e. bob[25] = 'q') When using assignment into an index of a var, the
current character is removed and replace with the new value. That means
that if the new value is longer than one character, the string will grow.
A feature that may be done in the future is indexing between two values
to get a substring, ie bob[25..30] = newstr.
This means things like echo ~{somefunc arg1 arg2} will get parsed properly
without having to enclose it in quotes. Exported the Cmd_Return function
so that anything can return values to GIB (such as quakec).
structure to help tidy the command buffer struct up a bit, fixed a few
bugs and probably created 100 more. A lot of things were changed to
allow embedded commands:
- Old buffers on the stack are left alone for Cbuf_ExecuteStack to
clean up. This is so return values can be extracted from them.
- The imperative flag has been added. An imperative buffer and all buffers
following it can not be paused with the wait command.
- The returning flag and retval dstring have been added. If a buffer
returned something, the flag will be set.
- The return command was added so there was something to use in the
substitution. Return nukes all loop buffers since they don't really count
as independent functions, sets the return value on the top buffer, and
clears it.
- Who knows what else.
now recycled, not freed. Fixed some bugs in exp.c. Ready to add embeded
functions (read: function calls with return values) and for loops.
Probably some other misc. fixes, I tend to go on debugging streaks.