Commit Graph

54 Commits (61962fe70abd22a665446cc09fcef163bf0e3862)

Author SHA1 Message Date
Sven Eberhardt ebda8193ef Replace NULL by nullptr in C++ sources
We don't support pre-C++0x any more, so nullptr should be fine everywhere (except in the plain C source files)
2016-11-02 19:58:02 -04:00
Günther Brammer b00b8554ab Merge branch script 2016-04-28 03:25:44 +02:00
Günther Brammer 2cdf553953 Change effect list getting function parameter type to C4PropList*
This makes it possible to move the effect functions to C4Script.cpp.
2016-04-24 19:40:29 +02:00
Günther Brammer c89e73608b Unite getting the effects list from a C4Object pointer into a function
This way, that function can be re-implemented in standalone c4script.
2016-04-24 19:40:28 +02:00
Günther Brammer fb76308812 Make C4ValueConv::Type a constexpr variable instead of an inline function 2016-04-24 19:40:26 +02:00
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Günther Brammer 6a6c0d8b0b Optionally warn about too many parameters in -> calls, too
While at it, only consult the right function for direct calls, not any
other function with the same name.
2016-02-02 02:57:49 +01:00
Günther Brammer 5be63d1e96 Use macros to reduce duplication in script engine definitions
While at it, make AddFunc take a C4PropList* instead of a C4AulScript*.
2016-01-25 00:00:58 +01:00
Günther Brammer 5287121d86 Use void instead of C4Void for engine functions that always return nil
This allows the removal of quite a few return C4Void();.

Also stop pretending that Nillable<void> is the same class as Nillable<T>.
Its only function was as an implementation detail for C4Void, which doesn't
need any implementation details anymore.
2016-01-25 00:00:58 +01:00
Günther Brammer f78d7712a5 Replace C4AulDefFuncHelper with template functions
This avoids duplication of code in C4AulObjectFunc and C4AulEngineFunc
at the cost of boilerplate code working around the lack of partial
function template spezializations.

Instead of ThisImpl and ExecImpl, we could have multiple C4AulEngineFunc
spezializations deriving from a common template, but that would require
even longer and duplicated boilerplate.
2016-01-25 00:00:58 +01:00
Günther Brammer 22113fd6fc Convert C4AulDefFunc* templates to variadic templates 2016-01-25 00:00:58 +01:00
Günther Brammer 6b514893f9 Replace C4ValueConv::ToC4V with C4Value constructors
Also don't rely on int32_t != long and drop now unnecessary MSVC workaround.
2016-01-25 00:00:57 +01:00
Günther Brammer 234101ddbc Remove C4Script.h from C4Aul.h 2016-01-24 12:27:23 +01:00
Günther Brammer c3c402061b Move struct C4ScriptConstDef to C4AulDefFunc.h 2016-01-24 12:27:23 +01:00
Günther Brammer 507b63a55a Functions store their containing proplist instead of the C4AulScript
The C4AulScript containing the source of the function was already mostly
used to get the relevant proplist or available from context. This will
allow more than one proplist plus the global one per scripthost to contain
functions.
2016-01-24 12:27:23 +01:00
Günther Brammer 9833c1ef2d Remove never used NeedDefinitionContext
Every function that accepts a definition also accepts an object instead, so
NeedNonGlobalContext is the exception to use.
2016-01-24 02:09:13 +01:00
Nicolas Hake 4fddda20f9 C4Script: Accept array parameter for Min, Max
Min/Max with array parameter will return the smallest/largest value of
all elements of the array. If any array element is not an integer, nor
convertible to integer, the function will fail.
2016-01-23 13:49:10 +01:00
Nicolas Hake 617a0828fb Aul: Throw exceptions by value, not by pointer
Throwing values instead of pointers simplifies memory management at the
catch site.
2015-12-08 13:17:40 +01:00
Günther Brammer b7a022852e Revert "Move C4Aul code into separate subdirectory"
The distinction between the "aul" and "non-aul" parts of
the script engine are mostly historical accident, and the
current organization of the source code does not use
sub-subdirectories. I'd like to keep it that way.

This reverts commit 69ba06b8d0.
2014-05-12 02:24:19 +02:00
Nicolas Hake 69ba06b8d0 Move C4Aul code into separate subdirectory 2014-05-11 16:17:48 +02:00
Günther Brammer 22016e075f Replace some usages of C4ID with C4Def*
In particular those that made the c4script shell depend on C4Id.cpp.
2014-04-19 19:02:22 +02:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Nicolas Hake 003f897cbe C4AulFunc: Improve const correctness 2013-11-02 13:40:33 +01:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Günther Brammer 8cf2b6adf1 Script: Call can execute functions directly
Call(this["foo"],...) is now the same as Call("foo",...).
2012-08-19 17:34:53 +02:00
Günther Brammer c6fe23729b Replace function list from C4AulScript with proplist enumeration
This finally makes the function list in C4AulScript unnecessary.
2012-05-28 00:50:13 +02:00
Günther Brammer 9d30869e87 Remove unused C4ScriptFnDef::FunctionC4V
Also move C4AulDefFunc and C4ScriptFnDef to the same header the template
helper classes are in. Like them, these classes are a mostly invisible
implementation detail of the engine script functions.
2012-05-20 02:39:57 +02:00
Günther Brammer abbfe41632 Use FunctionC4V2 registration style for the various Format()-like functions
The majority of their arguments is essentially a list, so treating
the arguments as an array fits.
2012-05-19 18:34:17 +02:00
Günther Brammer 0ca1c16205 Remove helper macro, types and functions for FunctionC4V2 style functions
The remaining users are variable-argument-count functions not needing them.
2012-05-18 20:02:25 +02:00
Günther Brammer 6815515a00 Consolidate C4AulFunc::Exec into just one virtual function
Deriving classes only need to implement one variant. The second Exec is a
trivial wrapper that doesn't have to be virtual.
2012-05-27 23:35:23 +02:00
Günther Brammer 09d08298bf Replace C4AulContext* this of C4Script engine functions with C4PropList*
This mainly removes some indirection and a superfluous struct.
2012-05-15 03:03:47 +02:00
Günther Brammer 0e6f972de4 Remove unused C4Object* parameter from C4AulExecError 2012-05-15 03:11:23 +02:00
Günther Brammer 8a4181a3be Replace C4AulObjectContext* with a simple C4Object* parameter 2012-04-28 22:04:36 +02:00
Günther Brammer 1a29f8625d Reorder engine source file organization a bit
This mostly consists of flattening the hierarchy, splitting the
graphics stuff out of platform, and a few smaller cleanups.
2012-04-27 19:04:43 +02:00
Günther Brammer 67d8ac47e9 Keep functions across script reloads
For functions that are not appended/included, this is done by reusing them.
Functions that are not in the new script version are left with their code
raising and error. Appended/included functions are handled by a reference count.
2012-02-02 01:16:14 +01:00
Günther Brammer 65801a5188 Remove C4AulFunc::LinkedTo
The parser doesn't need it to find the functions it has to parse anymore.

And the global proplist can be cleared before removing the functions,
instead of having engine functions deregister themselves and script
functions being deregistered when their linked function is removed.
2012-02-13 22:20:10 +01:00
Günther Brammer 0403bed306 Put functions into their proplists 2011-10-15 01:38:59 +02:00
Günther Brammer a684ab4aba Script: Infrastructure for functions as a value type 2011-09-25 01:20:18 +02:00
Günther Brammer c63b66e909 Script: Add def and effect parameter types 2011-09-24 18:37:28 +02:00
Günther Brammer 32e7eb2904 Only use C4V_C4Object as typecheck target, tag the values with C4V_Proplist
This simplifies a few places which had to check for both tags before.
2011-09-26 20:22:31 +02:00
Günther Brammer 0cd46a2ebc Wrap C4AulFunc::Name in C4AulFunc::GetName() 2011-10-14 00:40:55 +02:00
Günther Brammer 39ba48ee54 Rename C4Value::ConvertTo(NoNil) to C4Value::Check(Par)Conversion
The NoNil variant thus has the shorter name, because most code should
use it. Conversion checks mostly secure code that uses the value and would
crash with a nullpointer. The exception are function parameters, which all
also accept nil and 0 and check for nullpointers in the function itself.
2011-08-21 01:47:38 +02:00
Günther Brammer 9bc61db360 copyright notices update 2011 2011-09-01 16:58:52 +02:00
Günther Brammer f97cde74c3 Split C4V_Any into C4V_Nil for the data type and C4V_Any for the typecheck 2011-05-09 14:37:28 +02:00
Günther Brammer b5dea20dae Remove some dead code 2011-03-27 18:15:10 +02:00
Günther Brammer c009851ce2 Script: Remove unused category parameter from GetDefinition
While at it, also remove it from the internal function and a bunch of dead
code from C4IDList.
2011-03-07 21:26:56 +01:00
Günther Brammer 111df0392c Split C4Script.cpp into game functions and C4Script support functions 2011-03-04 13:49:41 +01:00
Günther Brammer 8749395a18 Use Nillable<void>() instead of C4VNull as the always-nil return value 2011-03-03 00:57:38 +01:00
Günther Brammer bdbe3beabf Optimize the template engine script function wrappers slightly 2011-03-02 23:42:34 +01:00