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.
1) when /not/ building static plugins, the plugin info name is, once again,
PluginInfo, but is still type_name_PluginInfo for static plugins. This
allows plugins to be symlinked (highly desirable for the debian packages,
and likely others). This also requires plugins to /not/ be loaded with
RTLD_GLOBAL.
2) because of 1, snd_alsa_0_9 has to explicitly load libasound itself. This
just happens to fix my segfault on shutdown in RedHat 6.2.
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.
__va_list_tag va_list[1];) which causes grief when attempting to reuse
va_list variables (eg, in vsnprintf retry loops). This is the reason for
MisterP's crashes as the pointers in va_list no longer point to valid data.
acinclude.m4:
shamelessly steal the va_list, va_copy and __va_copy macros from
cdda2wav but modified so AC_DEFINE includes the description (so
acconfig.h can remain gone)
configure.ac:
use AC_TYPE_VA_LIST, AC_FUNC_VA_COPY and AC_FUNC_VA__COPY
dstring.c:
stash the incoming va_list args in a temp var before calling vsnprintf
then restore them each time before retrying, but only if va_list is an
array (hopefully this is ok for when va_list is a structure)
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.
Made variable substitution recursive, so ${${foo}} will be the value of
the variable whose name is contained in foo. Added setl command to
manipulate local variables. The only other place they can be used is in
variable substitution.
buffers to be linked into execution stacks and changed aliases and script
files to be run in a new stack frame. Cbuf_Execute executes the stack from
the top down, so wait commands are handled properly.
within braces, and put support for comments back in (oops). To use math
evaluation, put a math expression inside $(). If you have spaces in your
expression, you'll need to enclose the entire thing in quotes so it doesn't
get split up into multiple tokens.
won't be processed except for escape characters, so that escaped braces
can be used within. If an uneven number of curly braces are within a
token, it will be misparsed, so escaped braces are important if you
don't want them to be considered in the parsing of the token. Ideally,
braces within quotes within braces should not need to be escaped, but this
would require a redesign of the parser to be recursive. Maybe I will do
this later.
without considering that realloc could result in dstr->str being
changed. Also made variable substitution of non-existant variables be
replaced with a null string rather than being left alone, to prevent
errors in scripts from causing weirdness as strings get passed through
the parser several times.
normal quotes and made it so executed files are always inserted into the
console buffer so that class config files in TF can use the new parser
features, even though the exec command is run in the legacy buffer
and it will get replaced with the ith argument to the alias, 0 being the
name of the alias itself. %% will get replaced by %, out of range
numbers will simply be removed, and non-numbers will be ignored.
Changed Cmd_TokenizeString to accept a flag that controls the application
of filters (tags, variables, escape characters) to the tokens and modified
a few places in the source that called it. Added a secondary command
buffer that is parsed without filters for legacy command support.
Currently, it is only used for commands stuffed into the console from the
server. It is hacky, and I hope to eventually generalize the console
interface to support any number of buffers and audit the rest of the code
to recognize it. For now, the legacy buffer at least keeps escape
character parsing from destroying info strings.
generally cleaned the parser up. If a line begins with |, it will be
stripped off by the tokenizer and no tags or escape characters will be
processed. Commands stuffed into the console from the server are prepended
with | to ensure backward compatibility. This can also be used anywhere
backward compatibility is needed, such as where info strings are stuffed
into the console, or as an alternative to using escape characters in the
entire string.
console command parser. It will eventually include html-like tags for
modifying text (gold numbers, brown characters, etc) and escaped characters.
The major differences so far are that dynamic strings are now used instead
of static buffers, and single quotes can be used to enclose tokens as
well as double quotes.
little odd:
Received signal 11, exiting...
IN_Shutdown
IN_LL_Shutdown
VID_Shutdown
Segmentation fault (core dumped)
but the core file does accurately show the error
like normal, f_skins reports the average percent fullbright for all loaded
skins, and f_skins skinname reports the fullbright percent for a signle
skin. cl_freply controls the time in seconds before another query can be
made. Set it to 0 to disable them. More queries will be added later.
The table for accessing special characters from the console has been
tweaked a bit. Expect it to get tweaked more in the future.
This required changes to the api (info_t instead of char *) but should be
a net gain in speed (not a lot, admittedly: it was pretty fast to begin
with, but this paves the way for some other changes I have in mind).
give mst_t a buffer to hold unterminated message strings
kill MSG_ReadStaticString and MSG_ReadStringLine
msg.c:
kill MSG_ReadStaticString and MSG_ReadStringLine
MSG_ReadString: implement the buffer for unterminated message strings
and update readcount on badread
cl_main.c:
go back to MSG_ReadString and fix up the resulting const char * issues
cl_parse.c:
rewrite the cl_mofake code all because of an uninitialized variable :)
sv_main.c:
use MSG_ReadString instead of MSG_ReadStringLine because
Cmd_TokenizeString really doesn't care about a terminating \n
directly into the packet data.
- change a bunch of char *'s to const char *'s for the above. Only
thing that had trouble was the cl_nofake handler, which I changed to
use a local buffer.
- add MSG_ReadStaticString which acts like the old MSG_ReadString,
specifically that it uses a static buffer and tollerates
unterminated strings.
- add a Q_strnlen function, and make strnlen use it if strnlen is
undefined.
- Add a net_svc.h and net_svc.c which will preparse svc messages into
structs, for easier handling. Currently only soundlist and
modellist are done.
segfault if your first call was with "". Probably could cause
crashes too
- add a string.c file to libQFutil, with a Q_strcasestr function,
which strcasestr is defined to if it's not already defined. (we'd
get that with glibc if we defined __USE_GNU, but we don't)
- make client_t and SV_ExtractFromUserinfo both use NAME_MAX for
their name arrays, instead of 32 for one and 80 for the other
- rewrite almost all of SV_ExtractFromUserinfo's name handling.
- \r, \n, and \t are all converted to spaces
- leading/trailing spaces are stripped
- consecutive spaces are reduced to a single space
- empty names are considered bad
- user-* nicks are considered bad (unless forced to them)
- a name containing console or admin is considered bad
- a name that already exists is considered bad
- if they have a bad name it gets forced to user-%d, where %d is
their userid
- netname in the progs is now updated properly
- name changes are always reported unless it's the initial setting,
rather than only if they're full connected and not a spectator
- finally, if the name change fails (info string exceeded), give
them the boot. (before this was only done for duplicate names)
That's about it :)
of pre-registered (Sys_RegisterShutdown) function before actually exiting
the program. This should take care of the pain when an ncurses server
crashes.
(Sys_DPrintf is new) is now used exclusively for all lib printing. Con_Init
sets the sys printf recirection to Con_Print (which has been revamped
appropriatly) and the server sets it to SV_Print (which was SV_Printf and
the new SV_Printf calls /it/). This should fix the rcon print redirection
issues.
- also added a cache_profile command, which sorts allocations into
power-of-2 sizes, then prints out how many are of that size, the
average amount they use, and the percent of total memory is used.
Also prints out totally allocated size, number of allocations, and
average per allocation.