Commit Graph

120 Commits

Author SHA1 Message Date
Bill Currie 9885aa5916 fix some signed char index warnings 2002-04-07 03:41:10 +00:00
Brian Koropoff 93c9f96416 Added embedded commands with ~{} and the return command, created a token
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.
2002-03-29 07:43:02 +00:00
Brian Koropoff 676bf39d9d Beautified GIB, improved looping and backtraces slightly. Old buffers are
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.
2002-03-27 06:24:19 +00:00
Brian Koropoff 807e7de22e Fixed a bug with comments that don't have a newline after them. 2002-03-24 06:55:52 +00:00
Brian Koropoff 7c4cecd700 Fixed a stupid bug in Cmd_Exec_f that was causing map commands inside
executed files to crash the server.
2002-03-23 23:13:15 +00:00
Brian Koropoff 73f32465c5 Fixed a double free in exp.c, and made math error reports slightly more
useful.
2002-03-22 07:11:05 +00:00
Brian Koropoff e1b61d2116 Changed how looping works, fixed echo to work with taniwha's Cmd_Args
changes, added the != operator for math evaluation, added break command
to break out of loops early, added ifnot command, and who knows what else.
2002-03-22 00:22:03 +00:00
Bill Currie 619a77b2f7 fix a couple of brainos that broke quotes entirely 2002-03-21 21:45:00 +00:00
Bill Currie c1deee9955 rework cmd_buffer_t->line and cmd_buffer_t->args building so quotes are
preseved
2002-03-21 21:17:31 +00:00
Bill Currie 6f1b68aeb4 sys.h:
define SYS_CHECKMEM macro to ease memory allocation failure detection
cmd.c:
	loads of whitespace
2002-03-21 19:47:31 +00:00
Brian Koropoff 388ff7b597 Some bug fixes and memory leak fixes. Local variables break randomly,
probably due to my misuse of hash tables.  Anyone have any ideas?
2002-03-20 22:57:26 +00:00
Brian Koropoff d5fad096c0 Added local variables and replaced %-substitution with local variables.
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.
2002-03-20 04:24:31 +00:00
Brian Koropoff 1683633042 Changed to an execution stack system for aliases and config files, and
added error backtraces.
2002-03-18 23:39:03 +00:00
Brian Koropoff 46cc4ac9dd Fixed some bugs and generalized the command buffer interface. Allowed for
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.
2002-03-18 04:12:09 +00:00
Brian Koropoff f4180e7ad8 Added math evaluation, the ability for commands to span multiple lines
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.
2002-03-17 06:57:03 +00:00
Brian Koropoff aa00b7742c Changed the token finder to be recursive, added if and while commands, and
allow tokens within braces to continue across newlines.
2002-03-17 03:31:03 +00:00
Brian Koropoff e9ca911e34 Added the ability to use curly braces to enclose tokens. Tokens in braces
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.
2002-03-16 21:17:01 +00:00
Brian Koropoff 2a3e1869ac Bug fixes! Fixed escape character detection, use of str = dstr->str
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.
2002-03-16 06:31:59 +00:00
Brian Koropoff 0a90ddc51f Fixed an error in extract line that caused escaped quotes to be parsed as
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
2002-03-15 01:45:15 +00:00
Brian Koropoff e0e9084ad7 Merged in the new command parser. No major bugs or incompatibilities could
be found.
2002-03-05 21:51:12 +00:00
Brian Koropoff 066c2c8a02 The final checkin before merging. Hopefully no showstopping bugs remain. 2002-03-05 21:26:37 +00:00
Brian Koropoff 669ca72e4f Added a bonus feature: %i evaluation in aliases. Just put %i in an alias
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.
2002-03-04 02:37:40 +00:00
Brian Koropoff 7241d69036 Fixes to echo, correct use of cmd_source and src_command, and change nq to
use cmd_legacybuffer for stufftext.
2002-03-04 01:11:05 +00:00
Brian Koropoff 8d124f9c2b Implemented variable substitution and did various cleanups to the parser.
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.
2002-03-03 23:28:57 +00:00
Brian Koropoff f78ec56975 Added escape characters, the <i> tag to ignore tags enclosed within it, and
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.
2002-03-03 08:29:28 +00:00
Brian Koropoff 4a7f3b3189 This commit fixes up cmd_args to rebuild a string from the processed
tokens and adds support for comments.
2002-03-03 06:00:44 +00:00
Bill Currie 119731e90e fix a buffer overflow snax found 2002-03-03 04:42:32 +00:00
Brian Koropoff 6936615fdf HTML-like tags are more or less done. Next up is variable substitution
and escape characters.
2002-03-03 04:26:37 +00:00
Brian Koropoff 557846b220 This is the first commit to the newcmd branch, which is a mostly-rewritten
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.
2002-03-03 03:36:27 +00:00
Bill Currie 630aa80dc4 various cleanups including TODOs and FIXMEs and rewrite va to use a dynamic
buffer.
2002-01-12 04:34:53 +00:00
Bill Currie b8df7c0e9e alpha compile fixes (bah, bloody size_t:P) 2001-12-06 20:18:24 +00:00
Adam Olsen 7c6765df60 buf[sizeof(buf)] = 0; is bad. buf[sizeof(buf) - 1] = 0; is good. 2001-12-05 09:24:19 +00:00
Bill Currie e782153743 must make sure \0 doesn't get into the command buffer :P 2001-12-04 03:43:47 +00:00
Bill Currie 8be15a16e6 heh, turned out that didn't hurt overkill as much as I thought, but this
gives it a tiny boost (and will help more in the more alias heavy mods).
2001-12-04 03:13:02 +00:00
Bill Currie 3c06cd5620 another jump prediction optimisation 2001-12-03 23:40:22 +00:00
Bill Currie 650d682d2c fix some nasty security holes causes by oversized connection strings. slows
down overkill slightly :/
2001-12-03 21:06:57 +00:00
Chris Ison 5e05df417d fix \n order in alias expansion 2001-11-20 20:07:15 +00:00
Bill Currie 288ec4251c various fractional speedups 2001-11-15 19:37:29 +00:00
Bill Currie 39401592d4 use malloc/free instead of Hunk_TempAlloc in Cmd_Exec_File so it can be called before Memory_Init 2001-11-14 20:16:57 +00:00
Bill Currie 42b5a5d150 reformat the output of "alias" so that capturing it is useful for config
scripts
2001-11-13 23:51:21 +00:00
Bill Currie e71a788509 shink the cmd and alias hash table sback down (that got in by mistake) and
disable the cmd_hash_stats command (not needed for general use)
2001-11-12 03:47:30 +00:00
Bill Currie e4fd746f71 this adds some stats to hash tables and a command to get at them for commands
and aliases
2001-11-10 01:13:29 +00:00
Brian Koropoff 008b59b777 The beginnings of an f_* reply system have been added. f_version works
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.
2001-11-05 07:23:51 +00:00
Brian Koropoff 05f35f9cd4 This adds the ability to access special characters in console commands by proceeding certain characters with $. See libs/util/cmd.c for the conversion table. Preceeding a character by # will shift it up or down by 128, which basically is useful for accessing the brown letters and numbers. All special characters were removed from Team_ParseSay, and variable substitution now takes the form of ${var} to prevent conflicts with special character substitution. Special character access is controlled by cmd_highchars, which defaults to off. 2001-10-27 04:34:53 +00:00
Adam Olsen 3bba5398ba - audit malloc usage. now everything checks the return value :) 2001-10-24 22:50:06 +00:00
Bill Currie 4a0194b95c correct the default of cmd_warncmd 2001-10-15 22:41:42 +00:00
Bill Currie 1929797cc9 get nq-server so it runs. part of this involved renaming cl_warncmd to
cmd_warncmd
2001-10-03 21:25:43 +00:00
Bill Currie b1f4a778f9 the rcsid commit from hell }:> 2001-09-28 06:26:31 +00:00
Bill Currie 49a85718f8 total nukage of Con_*Printf calls from libs (except for video). Sys_*Printf
(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.
2001-09-21 04:22:46 +00:00
Ragnvald Maartmann-Moe IV edcf092b05 Whitespace, dammit. Oh, and removal of several orphaned comments. Comments in front of functions suck. 2001-08-22 22:03:16 +00:00
Bill Currie 9ecce9becd remove a magic number 2001-08-15 15:32:24 +00:00
Bill Currie 5dc827ccf8 comment brein damage 2001-08-15 07:50:21 +00:00
Adam Olsen 0219bcb4c8 Make the help command work with commands too. (moved to cmd.c while I
was at it)
2001-07-30 01:01:39 +00:00
Bill Currie 46176e1094 azerty kb patch from Filip Van Raemdonck <mechanix@digibel.org>. includes some
misc fixes, too
2001-07-19 21:46:34 +00:00
Bill Currie 1c9e1b176f fear the mighty const correct patch 2001-07-15 07:04:17 +00:00
Bill Currie ecff96258f cmd.[ch]:
api change: Cmd_Args () now takes a parameter inidcating which arg to
	start at for grabbing the un-parsed command line
qw/source/sv_ccmds.c:
	implement kk's tell command and user name matching (though # is used for
	the wildcard and it's still case sensitive)
everything else:
	adjust for the new Cmd_Args protype
2001-07-10 18:25:54 +00:00
Bill Currie 124dff1bd6 rework alias creation/deletion. Aliases are now sorted (like cvars and
commands), and the alias name length limit has been removed.
2001-07-06 17:45:32 +00:00
Bill Currie 443196e66b very nice command line tab completeion from Shawn Walker
<eviltypeguy@qeradiant.com>
2001-06-28 04:05:14 +00:00
Bill Currie e339e82c01 hash.h is now const correct as is a lot of qfcc 2001-06-04 04:52:14 +00:00
Bill Currie 323015b11a include/QF header cleanup. including config.h (or any file from include) is
a nono because headers in include/QF get installed, but include don't and thus
would break quakeforge-dev.
2001-05-31 05:33:13 +00:00
Joseph Carter 05adfd0e53 quakefs.h -> vfs.h
quakeio.h -> vfile.h

More diff reduction between trunk and my VFS code.  Also took the time to
put some headers in order and fix a few #include's pointed out by moving
things around a bit.
2001-05-30 04:34:06 +00:00
Joseph Carter 186d577818 s/QFile/VFile/g - makes my diffs much smaller and more manageable for the
VFS work.
2001-05-30 03:21:19 +00:00
Bill Currie 306d6db39b if ... if -> if ... else if 2001-05-17 20:05:36 +00:00
Bill Currie 4162243287 eliminate Cmd_ForwardToServer from cmd.c. Cmd_ForwardToServer still needs to
be removed from cmd.h, but that can wait a bit.
2001-03-31 00:35:08 +00:00
Bill Currie cb5c262ffc qtypes.h:
remove includes of qdefs.h and compat.h
pr_comp.h:
	merge pr_comp.h from quake and qfcc, removing the copy in qfcc
cmdlib.[ch]:
	nuke the endian code.
qendian.c:
	initialise the LittleLong etc pointers at compile time rather than run
	time
com.c (both nq and qw):
	nuke the LittleLong etc init code
everything else:
	fix up after the qtypes.h cleanup
2001-03-28 17:17:56 +00:00
Bill Currie f78b973978 move the api headers into include/QF and clean up (most of) the resulting mess.
target specific files that I don't build won't compile yet. just put QF/
infront of the offending headers.

Also move ver_check into libqfutils
2001-03-27 20:33:07 +00:00
Bill Currie f40b361fb3 hash.[ch]:
slight api change: the getkey and free functions now take a user data
	parameter (which is an aditional parameter to Hash_New.
cmd.c, cvar.c, quakefs.c:
	clean up the resulting errors.
pr_edict.c:
	use hash tables for lookups of function, global and field definitions.
	should speed things up a bit, ESPECIALLY when type checking is enabled.
2001-03-05 05:11:26 +00:00
Bill Currie 9aa50a847c clean up the mess caused by attempting to merge cmd.[ch]. When taken further,
this might give us nice controlability of when cvars can be changed.
2001-02-22 04:46:59 +00:00
Ragnvald Maartmann-Moe IV c6da49206e More typos, spelling corrections, and case fixes fed to the nearest handy fiend. 2001-02-22 00:15:03 +00:00
Bill Currie 95f6db7775 start merging stuff into libs/util and fix the concequences in nq. nq doesn't
build yet though (keys.c, *screen.c and *view.c) due to console fun.
2001-02-21 19:35:06 +00:00