Commit Graph

220 Commits (8db7c031ffda3a0d46f4d5df66e0cd0141c96862)

Author SHA1 Message Date
Giel van Schijndel 30cbbefcbd Mark the #include from src/ in chat_lexer.l with a FIXME
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5533 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-13 19:22:11 +00:00
Giel van Schijndel 5526f2c61a * Move type OBJECT_POSITION (and macro POSITION_OBJ to declare it) from structuredef.h to the new file positiondef.h
* Update build systems: autotools, raw win32 makefiles, Code::Blocks project and MSVC project
 * Rename _droid and _base_object forward declaration types to DROID and BASE_OBJECT respectively
 * Add two forward declarations for BASE_OBJECT and DROID to scriptfuncs.h so that it can declare pointers to these types
 * src/messagedef.h depends on lib/ivis_common/ivisdef.h and src/positiondef.h so #include those
 * Don't #include stuff from src/ in lib/script/chat_processing.h
 * Remove all unnecessary #inlucdes from src/ from lib/script/chat_lexer.l

NOTE: Build systems not mentioned above might need updating.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5531 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-13 18:15:03 +00:00
Dennis Schridde 022315eef0 Hardcode top_srcdir to make building from non-topdir possible, dont depend on the touch command, fix LDFLAGS to not depend on the removed TARGET variable
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5476 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-10 20:10:16 +00:00
Dennis Schridde 302a557478 Rename "raw" Makefiles to "win32" Makefiles
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5402 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-06 14:29:04 +00:00
Dennis Schridde ec5aeaf3c7 Make "SCRIPT" release function just indirectly point to scriptFreeCode, so the function types are strictly compatible.
Clean scriptFreeCode's formating and remove unnecessary checks for ptr!=NULL before freeing.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5400 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-06 14:02:46 +00:00
Giel van Schijndel a7ab3d9982 Merge lexer rules for the script_lexer that match different forms of the same token (e.g. upper/lower case variants)
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5353 4a71c877-e1ca-e34f-864e-861f7616d084
2008-07-02 11:29:19 +00:00
Dennis Schridde 45f23a4926 Merge commit 'HEAD@{3}'
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5347 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-28 22:32:44 +00:00
Dennis Schridde 050ec39c11 Use the (also new in this commit) relative variants of the directories almost everywhere.
Exception is when generating the .wz files, where we need the path to the build directory and building a reverse relative path to $(srcdir) will be messy.
Also silence submake.mk a great deal.
Bug #11883 should be fixed now for the most part.


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5325 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 23:41:52 +00:00
Dennis Schridde fd2bfb0e0f Prepare for another fix for parts of bug #11883: Issues with the improved raw Makefiles
- Rename Makefile.raw to lowercase


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5321 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 22:48:45 +00:00
Dennis Schridde 73b35ab8d6 Rename top_srcdir/top_builddir to abs_top_srcdir/abs_top_builddir, to make this more obvious.
Their use is currently flawed, since it will not work in directories with spaces in them... (


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5319 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-24 20:19:54 +00:00
Dennis Schridde 9bd8b24921 Boost raw Makefiles
- Use PACKAGE, PACKAGE_VERSION, remove VERSION
- Allow out-of-source-dir builds (mkdir build && cd build && make -f ../Makefile.raw)
- Move config.mk from $(top_srcdir)/makerules/config.mk to $(top_builddir)/config.mk
   When keeping current behaviour (srcdir=builddir), this means: Move it from makerules into the main directory


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5308 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-23 13:54:47 +00:00
Per Inge Mathisen 0d706d02fd Forward port workaround for eventRemoveContext crash from 2.1. This will leak some memory.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5260 4a71c877-e1ca-e34f-864e-861f7616d084
2008-06-16 20:38:26 +00:00
Per Inge Mathisen 8419a7008b Use calloc instead of malloc+memset, and make sure we clear the right memory.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5181 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 15:40:56 +00:00
Giel van Schijndel 855ec725d4 Use sstrcpy|sstrcat instead of strlcpy|strlcat for manipulation of statically sized strings
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5176 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-25 13:46:49 +00:00
Per Inge Mathisen 8243c4b2fb Fix the infamous eventRemoveContext crash.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5167 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-24 13:58:26 +00:00
Roman C d89f43106d Make sure we print out script call stack when division by zero occurs.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5152 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-23 14:29:11 +00:00
Giel van Schijndel 2102ab0475 Fix warnings: remove unused variables
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5144 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-20 19:57:26 +00:00
Roman C ebaecc07f6 Fix memory leaks in script_paryer.y the correct way.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5142 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-19 13:53:04 +00:00
Giel van Schijndel d53aa02117 * Use the lexer_input framework instead of a custom YY_INPUT implementation for audp_lexer.l
* Get rid of lexer function parseGetErrorData and use audp_get_lineno() and audp_get_text() instead
 * Add a WZ_DECL_FORMAT declaration to audp_error to enable GCC's printf format checking
 * In audp_error allocate the buffer on the stack using alloca() instead of an auto 1kB text buffer


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5094 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-12 20:29:13 +00:00
Giel van Schijndel 1c4bafaa2b Let the chat_lexer do some more of the work by returning only a single _T_YES token for "yes", "yea", "yeah" and "yep"
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5063 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-12 12:48:31 +00:00
Per Inge Mathisen 07c9062105 Cosmetic update of static globals
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5061 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-12 12:39:16 +00:00
Giel van Schijndel 9640d3b0a6 * Make sure to set psPrev to NULL at the start of the deletion loop
* Also don't dereference it when it's NULL


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5060 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-12 12:33:38 +00:00
Giel van Schijndel 58176b97bc * Fix GPL headers for some files which where wrongly marked as being Copyright Eidos Interactive in r1014
* Update file-level comment for chat_lexer.l for the change in r899 (i.e. the flex option `-i` doesn't need to be specified anymore)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5059 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-12 12:16:46 +00:00
Roman C 03073c8038 Memory leak fix for event.c. Patch by Buginator.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5035 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 10:34:48 +00:00
Roman C f7c684f964 Make it possible for AI to recognize some new words and phrases needed for new commands.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5034 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-11 10:24:09 +00:00
Roman C 3d2dc99003 Scripting:
-allow creation of unit templates on the fly
-allow direct access to major weapon stats from within scripts

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5014 4a71c877-e1ca-e34f-864e-861f7616d084
2008-05-10 13:20:23 +00:00
Giel van Schijndel 4e60f65e8f Don't #include "script_parser.tab.h" in lib/script/stack.c as we don't depend on the parser's token definitions there
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4856 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-29 15:18:42 +00:00
Giel van Schijndel ab2bafd7a4 Merge r4271 from deprecated 2.1 branch into trunk:
* Make log output use LOG_SCRIPT instead of LOG_NEVER and LOG_WARNING
 * Some random cleanups


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4788 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-26 15:21:23 +00:00
Giel van Schijndel 61c8bbc4b9 * Don't "Guarantee nul-termination" after snprintf as snprintf does that itself already (per the C99 spec)
* Use strlcpy for copying strings instead of snprintf "%s"
 * Don't cast the return value from vsnprintf to (void)
 * When we use va_start make sure to use va_end as well...
 * Fix indentation


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4785 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-26 14:21:41 +00:00
Giel van Schijndel 1252538097 * Make pIdent for VAR_SYMBOL and FUNC_SYMBOL const so that we're const correct with the function tables in scripttabs.c
* Replace "nstr = malloc(strlen(str) + 1); strcpy(nstr, str);" by using "nstr = strdup(str);" instead
 * Remove a non-sensical self-assignment ("pIdent = pIdent;")
 * In scriptAddVariable:
  * "Overallocate" for the new VAR_SYMBOL so that we can store the identifier in that single chunk of memory
   * This allows deallocating the entire structure with a single free() call (which prevents problems with the constness change to VAR_SYMBOL mentioned above)
  * Don't take ownership of the memory pointed to by psVarIdent->pIdent, just copy its contents instead
  * Make FREE_VARIDENTDECL a function instead: freeVARIDENTDECL
   * In this function also free psDcl->pIdent


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4696 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-20 15:18:28 +00:00
Giel van Schijndel 10eac267e3 Remove unused global variable psLocalVarsTemp
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4694 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-20 15:04:24 +00:00
Giel van Schijndel 457c7005f3 * Remove global variable psLocalVars which was __always__ NULL
* Remove unused function scriptClearLocalVariables() (which was effectively a NOP due to psLocalVars being NULL)


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4691 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-20 14:56:49 +00:00
Giel van Schijndel f494f40dde Remove global var psFunctions which is __always__ NULL
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4690 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-20 14:18:06 +00:00
Roman C 4c5d34f22b Scripting engine:
Allow global variable declarations to be mixed with trigger and event/function declaration. This allows us to #include script files which variable/event declaration.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4667 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-17 15:59:43 +00:00
Roman C 2734594eef Don't abuse interpCheckEquiv() since most type checking is done during compilation.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4659 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-16 19:14:58 +00:00
Roman C 89fc6d5edd Allow a script to have more than strings at a time.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4614 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-14 20:12:27 +00:00
Roman C 49903f9593 Get rid of unnecessary warnings when compiling release build using MSVC.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4462 4a71c877-e1ca-e34f-864e-861f7616d084
2008-04-01 15:56:39 +00:00
Per Inge Mathisen be566a7d6d Add -Wcast-align and -Wmissing-declarations to autoconf debug builds, and fix warnings.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4403 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-28 23:28:44 +00:00
Dennis Schridde e28cf1ce77 Using the kludge for GNU Flex < 2.5.30 was slightly incorrect. Correct way is present in 2.5.9 already.
Additionaly use the kludge found on http://flex.sourceforge.net/manual/faq_002dmemory_002dleak.html


git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4384 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-28 11:05:19 +00:00
Dennis Schridde f888cc5b69 Revert 4344-4347, 4355, 4357, 4358, 4362: They caused too much slowdown in the scripting engine
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4379 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-27 18:38:25 +00:00
Dennis Schridde 89d1ea6a3d Old versions of GNU Flex (i.e. 2.5.4) dont provide yylex_destroy
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4376 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-27 17:09:16 +00:00
Dennis Schridde e6e09ee72a Differ between deep (i.e. incl strings) and non-deep (just the pointer) copies
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4362 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 21:43:39 +00:00
Dennis Schridde ffc7a71601 Make MSVC happy
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4359 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 16:42:16 +00:00
Dennis Schridde 496e781146 Dont allocate the string again during direct copy
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4358 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 15:37:16 +00:00
Dennis Schridde 9bffb40f82 stackPop can utilise stackReduce
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4357 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 15:01:15 +00:00
Dennis Schridde 3eecd4fd7b Move interp*2string to script*2string
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4356 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 14:57:35 +00:00
Dennis Schridde 10670360cd Cleaned stackPush and stackShutdown, stackRemoveTop can remove more than 1 item now.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4355 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 13:52:31 +00:00
Dennis Schridde 44d2b96472 Removed unused (commented out) chunk of stack manipulation
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4354 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 13:27:19 +00:00
Dennis Schridde ee286efa0f Fix lexer memleaks
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4348 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 11:28:25 +00:00
Dennis Schridde 9019233d1a Properly copy string->string
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4347 4a71c877-e1ca-e34f-864e-861f7616d084
2008-03-26 10:26:15 +00:00