Merge branch 'master' into javascript

* master:
  Fix some typos
  [PHP] The generated __isset() method now returns true for read-only properties.
  Eliminate needless casting away const from string constants
  Fix typos
  Fix missing ")" in code example
  Fix comment typos
  Fix m4 quoting of checks for yodl2man and yodl2html versions
  Fixed errors from previous commit.
  Removed all unnecessary asserts
  Remove unused variable
  Another go html fix
  Fix intgosize arg documentation
  Optimize metamethods inheritance resolving
  Updating documentation
  Whitespace cleanup of Example Makefiles
  .gitignore: ignore Lib/swigwarn.swg
  Fixing unused variable warnings
  Finish implementation with proxy functions
  Remove duplicate declarations of strtoimax and strtoumax in inttypes.i
  Ignored enum fixes.
  Further shift operator regression fixes
  Fix use of shift operators in expressions regression since 3.0.0
  Fix seg fault with extra ) brackets and >>
  More efficient end of template bracket (>>) handling
  beautify scanner.c
  Tidy up scanner.c
  DOH readme correction
  Fix typo in -lua -help output
  Remove extra </div>
  Update documentation for deprecation and removal of Close()
  Fix segfault when there are too many closing round brackets in parsed code
  Refix operator<< definition giving a syntax error
  Fix regression in 3.0.0 where legal code following an operator<< definition might give a syntax error.
  Remove unnecessary block from PHP version of SWIG_exception macro
  [PHP] Fix wrapping director constructors with default parameters with a ZTS-enabled build of PHP.
  Fix potential bugs found by Coverity analysis
  Eliminate unused parameter from SWIG_Php_GetModule()
  Fix comment typo
  Fix compiler warnings in generated Lua code
  [PHP] Pass the ZTS context we already have to avoid needing to call TSRMLS_FETCH, which is relatively expensive.
  [PHP] Pass ZTS context through to t_output_helper() so it works with a ZTS-enabled build of PHP.  Reported by Pierre Labastie in github PR#155.
  Lua test-suite can now be run out of source
  Fix out of source test-suite runs for Octave
  Add runtime test for commit 7a96fba836
  Add C++11 constexpr runtime test
This commit is contained in:
William S Fulton 2014-05-01 19:01:20 +01:00
commit f51be1ca5c
150 changed files with 935 additions and 410 deletions

View file

@ -1418,7 +1418,7 @@ static void mark_nodes_as_extend(Node *n) {
String *nexcept;
} dtype;
struct {
char *type;
const char *type;
String *filename;
int line;
} loc;
@ -2002,8 +2002,8 @@ include_directive: includetype options string BEGINFILE {
}
;
includetype : INCLUDE { $$.type = (char *) "include"; }
| IMPORT { $$.type = (char *) "import"; ++import_mode;}
includetype : INCLUDE { $$.type = "include"; }
| IMPORT { $$.type = "import"; ++import_mode;}
;
/* ------------------------------------------------------------
@ -4292,7 +4292,7 @@ cpp_namespace_decl : NAMESPACE idcolon LBRACE {
| NAMESPACE LBRACE {
Hash *h;
$1 = Swig_symbol_current();
h = Swig_symbol_clookup((char *)" ",0);
h = Swig_symbol_clookup(" ",0);
if (h && (Strcmp(nodeType(h),"namespace") == 0)) {
Swig_symbol_setscope(Getattr(h,"symtab"));
} else {
@ -5271,7 +5271,7 @@ notso_direct_declarator : idcolon {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5370,7 +5370,7 @@ direct_declarator : idcolon {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5540,7 +5540,7 @@ direct_abstract_declarator : direct_abstract_declarator LBRACKET RBRACKET {
SwigType *t;
$$ = $1;
t = NewStringEmpty();
SwigType_add_array(t,(char*)"");
SwigType_add_array(t,"");
if ($$.type) {
SwigType_push(t,$$.type);
Delete($$.type);
@ -5563,7 +5563,7 @@ direct_abstract_declarator : direct_abstract_declarator LBRACKET RBRACKET {
$$.id = 0;
$$.parms = 0;
$$.have_parms = 0;
SwigType_add_array($$.type,(char*)"");
SwigType_add_array($$.type,"");
}
| LBRACKET expr RBRACKET {
$$.type = NewStringEmpty();

View file

@ -51,7 +51,7 @@ Sequence Operations
-------------------
Getitem(list,index) Get an item
Setitem(list,index,val) Set an item
Delitem(list,index,val) Delete an item
Delitem(list,index) Delete an item
Insert(list,index,val) Insert an item
Append(list,val) Append to end
Push(list,val) Insert at beginning
@ -65,7 +65,7 @@ Putc(ch,obj) Put a character
Ungetc(ch,obj) Put character back on input stream
Seek(obj,offset,whence) Seek
Tell(obj) Return file pointer
Close(obj) Close
Delete(obj) Decrease the reference count, close file if zero
String Operations
-----------------

View file

@ -20,7 +20,7 @@
// #define ALLEGROCL_TYPE_DEBUG
// #define ALLEGROCL_CLASS_DEBUG
static const char *usage = (char *) "\
static const char *usage = "\
Allegro CL Options (available with -allegrocl)\n\
-identifier-converter <type or funcname> - \n\
Specifies the type of conversion to do on C identifiers to convert\n\

View file

@ -714,7 +714,7 @@ Allocate():
/* Check if base classes allow smart pointers, but might be hidden */
if (!Getattr(n, "allocate:smartpointer")) {
Node *sp = Swig_symbol_clookup((char *) "operator ->", 0);
Node *sp = Swig_symbol_clookup("operator ->", 0);
if (sp) {
/* Look for parent */
Node *p = parentNode(sp);
@ -833,7 +833,7 @@ Allocate():
or reference. We're going to chase it to see if another operator->()
can be found */
if ((SwigType_check_decl(type, "")) || (SwigType_check_decl(type, "r."))) {
Node *nn = Swig_symbol_clookup((char *) "operator ->", Getattr(sc, "symtab"));
Node *nn = Swig_symbol_clookup("operator ->", Getattr(sc, "symtab"));
if (nn) {
Delete(base);
Delete(type);

View file

@ -18,7 +18,7 @@
//#define CFFI_DEBUG
//#define CFFI_WRAP_DEBUG
static const char *usage = (char *) "\
static const char *usage = "\
CFFI Options (available with -cffi)\n\
-generate-typedef - Use defctype to generate shortcuts according to the\n\
typedefs in the input.\n\

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
\
CHICKEN Options (available with -chicken)\n\
-closprefix <prefix> - Prepend <prefix> to all clos identifiers\n\
@ -29,7 +29,7 @@ CHICKEN Options (available with -chicken)\n\
\n";
static char *module = 0;
static char *chicken_path = (char *) "chicken";
static const char *chicken_path = "chicken";
static int num_methods = 0;
static File *f_begin = 0;
@ -620,7 +620,7 @@ int CHICKEN::functionWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
if (!any_specialized_arg) {
method_def = NewString("");
@ -775,7 +775,7 @@ int CHICKEN::variableWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
Node *class_node = classLookup(t);
String *clos_code = Getattr(n, "tmap:varin:closcode");
@ -942,7 +942,7 @@ int CHICKEN::constantWrapper(Node *n) {
if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
if (GetFlag(n, "feature:constasvar")) {
Printv(clos_methods, "(define ", clos_name, " (", chickenPrimitiveName(scmname), "))\n", NIL);
Printv(scm_const_defs, "(set! ", scmname, " (", scmname, "))\n", NIL);
@ -1372,7 +1372,7 @@ void CHICKEN::dispatchFunction(Node *n) {
} else if (in_class)
clos_name = NewString(member_name);
else
clos_name = chickenNameMapping(scmname, (char *) "");
clos_name = chickenNameMapping(scmname, "");
Iterator f;
List *prev = 0;

View file

@ -13,7 +13,7 @@
#include "swigmod.h"
static const char *usage = (char *) "\
static const char *usage = "\
CLISP Options (available with -clisp)\n\
-extern-all - Create clisp definitions for all the functions and\n\
global variables otherwise only definitions for\n\

View file

@ -3175,8 +3175,8 @@ public:
if (anonymous_enum) {
replacementname = NewString("int");
} else {
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition)
replacementname = SwigType_base(classnametype);
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition) or an ignored enum
replacementname = NewStringf("SWIGTYPE%s", SwigType_manglestr(classnametype));
Replace(replacementname, "enum ", "", DOH_REPLACE_ANY);
Setattr(swig_types_hash, replacementname, classnametype);
}
@ -4303,7 +4303,7 @@ extern "C" Language *swig_csharp(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *CSHARP::usage = (char *) "\
const char *CSHARP::usage = "\
C# Options (available with -csharp)\n\
-dllimport <dl> - Override DllImport attribute name to <dl>\n\
-namespace <nm> - Generate wrappers into C# namespace <nm>\n\

View file

@ -4649,7 +4649,7 @@ extern "C" Language *swig_d(void) {
/* -----------------------------------------------------------------------------
* Usage information displayed at the command line.
* ----------------------------------------------------------------------------- */
const char *D::usage = (char *) "\
const char *D::usage = "\
D Options (available with -d)\n\
-d2 - Generate code for D2/Phobos (default: D1/Tango)\n\
-package <pkg> - Write generated D modules into package <pkg>\n\

View file

@ -4514,10 +4514,12 @@ private:
} else if (Strcmp(t, "enum ") == 0) {
ret = NewString("int");
} else {
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition)
ret = SwigType_base(t);
Replace(ret, "enum ", "", DOH_REPLACE_ANY);
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition) or an ignored enum
String *tt = Copy(t);
Replace(tt, "enum ", "", DOH_REPLACE_ANY);
ret = exportedName(tt);
Setattr(undefined_enum_types, t, ret);
Delete(tt);
}
} else if (SwigType_isfunctionpointer(type) || SwigType_isfunction(type)) {
ret = NewString("_swig_fnptr");
@ -5017,7 +5019,7 @@ extern "C" Language *swig_go(void) {
* ----------------------------------------------------------------------------- */
// Usage message.
const char * const GO::usage = (char *) "\
const char * const GO::usage = "\
Go Options (available with -go)\n\
-gccgo - Generate code for gccgo rather than 6g/8g\n\
-go-pkgpath <p> - Like gccgo -fgo-pkgpath option\n\

View file

@ -16,7 +16,7 @@
#include <ctype.h>
// Note string broken in half for compilers that can't handle long strings
static const char *usage = (char *) "\
static const char *usage = "\
Guile Options (available with -guile)\n\
-emitsetters - Emit procedures-with-setters for variables\n\
and structure slots.\n\
@ -1018,7 +1018,7 @@ public:
if (in_class)
goops_name = NewString(memberfunction_name);
else
goops_name = goopsNameMapping(proc_name, (char *) "");
goops_name = goopsNameMapping(proc_name, "");
String *primitive_name = NewString("");
if (primRenamer)
Printv(primitive_name, "primitive:", proc_name, NIL);
@ -1204,7 +1204,7 @@ public:
// export wrapper into goops file
if (!in_class) { // only if the variable is not part of a class
String *class_name = SwigType_typedef_resolve_all(SwigType_base(t));
String *goops_name = goopsNameMapping(proc_name, (char *) "");
String *goops_name = goopsNameMapping(proc_name, "");
String *primitive_name = NewString("");
if (primRenamer)
Printv(primitive_name, "primitive:", NIL);

View file

@ -3090,8 +3090,8 @@ public:
if (anonymous_enum) {
replacementname = NewString("int");
} else {
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition)
replacementname = SwigType_base(classnametype);
// An unknown enum - one that has not been parsed (neither a C enum forward reference nor a definition) or an ignored enum
replacementname = NewStringf("SWIGTYPE%s", SwigType_manglestr(classnametype));
Replace(replacementname, "enum ", "", DOH_REPLACE_ANY);
Setattr(swig_types_hash, replacementname, classnametype);
}
@ -4643,7 +4643,7 @@ extern "C" Language *swig_java(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *JAVA::usage = (char *) "\
const char *JAVA::usage = "\
Java Options (available with -java)\n\
-nopgcpp - Suppress premature garbage collection prevention parameter\n\
-noproxy - Generate the low-level functional interface instead\n\

View file

@ -86,11 +86,11 @@ extern "C"
you can add new ones here
(though for now I have not bothered)
NEW LANGUAGE NOTE:END ************************************************/
static const char *usage = (char *) "\
static const char *usage = "\
Lua Options (available with -lua)\n\
-elua - Generates LTR compatible wrappers for smaller devices running elua\n\
-eluac - LTR compatible wrappers in \"crass compress\" mode for elua\n\
-elua-emulate - Emulates behaviour of eLua. Usefull only for testing.\n\
-elua-emulate - Emulates behaviour of eLua. Useful only for testing.\n\
Incompatible with -elua/-eluac options.\n\
-nomoduleglobal - Do not register the module name as a global variable \n\
but return the module table from calls to require.\n\
@ -205,7 +205,7 @@ public:
}
/* NEW LANGUAGE NOTE:***********************************************
This is called to initalise the system & read any command line args
This is called to initialise the system & read any command line args
most of this is boilerplate code, except the command line args
which depends upon what args your code supports
NEW LANGUAGE NOTE:END *********************************************** */
@ -380,7 +380,7 @@ public:
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Dump(f_initbeforefunc, f_begin);
/* for the Lua code it needs to be properly excaped to be added into the C/C++ code */
/* for the Lua code it needs to be properly escaped to be added into the C/C++ code */
escapeCode(s_luacode);
Printf(f_begin, "const char* SWIG_LUACODE=\n \"%s\";\n\n", s_luacode);
Wrapper_pretty_print(f_init, f_begin);
@ -436,9 +436,9 @@ public:
/* NEW LANGUAGE NOTE:***********************************************
This is it!
you get this one right, and most of your work is done
but its going to take soem file to get it working right
but its going to take some file to get it working right
quite a bit of this is generally boilerplate code
(or stuff I dont understand)
(or stuff I don't understand)
that which matters will have extra added comments
NEW LANGUAGE NOTE:END *********************************************** */
/* ---------------------------------------------------------------------
@ -534,7 +534,7 @@ public:
}
/* NEW LANGUAGE NOTE:***********************************************
the wrapper object holds all the wrappering code
the wrapper object holds all the wrapper code
we need to add a couple of local variables
NEW LANGUAGE NOTE:END *********************************************** */
Wrapper *f = NewWrapper();
@ -554,7 +554,7 @@ public:
/* NEW LANGUAGE NOTE:***********************************************
the format of a lua fn is:
static int wrap_XXX(lua_State* L){...}
this line adds this into the wrappering code
this line adds this into the wrapper code
NEW LANGUAGE NOTE:END *********************************************** */
Printv(f->def, "static int ", wname, "(lua_State* L) {", NIL);
@ -657,7 +657,7 @@ public:
continue;
} else {
/* NEW LANGUAGE NOTE:***********************************************
// why is this code not called when I dont have a typemap?
// why is this code not called when I don't have a typemap?
// instead of giving a warning, no code is generated
NEW LANGUAGE NOTE:END *********************************************** */
Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, "Unable to use type %s as a function argument.\n", SwigType_str(pt, 0));
@ -792,7 +792,7 @@ public:
Replaceall(f->code, "$result", Swig_cresult_name());
/* Dump the function out */
/* in Lua we will not emit the destructor as a wrappered function,
/* in Lua we will not emit the destructor as a wrapper function,
Lua will automatically call the destructor when the object is free'd
However: you cannot just skip this function as it will not emit
any custom destructor (using %extend), as you need to call emit_action()
@ -835,7 +835,7 @@ public:
/* NEW LANGUAGE NOTE:***********************************************
This is an extra function used for overloading of functions
it checks the args & then calls the relevant fn
nost of the real work in again typemaps:
most of the real work in again typemaps:
look for %typecheck(SWIG_TYPECHECK_*) in the .swg file
NEW LANGUAGE NOTE:END *********************************************** */
int dispatchFunction(Node *n) {
@ -1958,6 +1958,10 @@ public:
SetFlag(carrays_hash, "lua:closed");
// Do arrays describe class instance part or class static part
const int is_instance = GetFlag(carrays_hash, "lua:class_instance");
String *attr_tab = Getattr(carrays_hash, "attributes");
Printf(attr_tab, " {0,0,0}\n};\n");
Printv(output, attr_tab, NIL);
@ -1968,7 +1972,17 @@ public:
Printv(const_tab, tab4, "{LNILKEY, LNILVAL}\n", "};\n", NIL);
else
Printf(const_tab, " {0,0,0,0,0,0}\n};\n");
Printv(output, const_tab, NIL);
// For the sake of compiling with -Wall -Werror we print constants
// only when necessary
int need_constants = 0;
if ( (elua_ltr || eluac_ltr) && (old_metatable_bindings) )
need_constants = 1;
else if (!is_instance) // static part need constants tab
need_constants = 1;
if (need_constants)
Printv(output, const_tab, NIL);
if (elua_ltr) {
// Put forward declaration of metatable array
@ -2009,7 +2023,18 @@ public:
Printv(output, set_tab, NIL);
}
if (!eluac_ltr) {
// Heuristic whether we need to print metatable or not.
// For the sake of compiling with -Wall -Werror we don't print
// metatable for static part.
int need_metatable = 0;
if (eluac_ltr)
need_metatable = 0;
else if(!is_instance)
need_metatable = 0;
else
need_metatable = 1;
if (need_metatable) {
String *metatable_tab = Getattr(carrays_hash, "metatable");
assert(metatable_tab);
if (elua_ltr) {

View file

@ -160,9 +160,9 @@ static String *SwigLib = 0; // Library directory
static String *SwigLibWinUnix = 0; // Extra library directory on Windows
static int freeze = 0;
static String *lang_config = 0;
static char *hpp_extension = (char *) "h";
static char *cpp_extension = (char *) "cxx";
static char *depends_extension = (char *) "d";
static const char *hpp_extension = "h";
static const char *cpp_extension = "cxx";
static const char *depends_extension = "d";
static String *outdir = 0;
static String *xmlout = 0;
static int outcurrentdir = 0;
@ -324,7 +324,7 @@ const String *SWIG_output_directory() {
}
void SWIG_config_cppext(const char *ext) {
cpp_extension = (char *) ext;
cpp_extension = ext;
}
List *SWIG_output_files() {
@ -465,7 +465,7 @@ void SWIG_getoptions(int argc, char *argv[]) {
Swig_mark_arg(i);
} else if (strncmp(argv[i], "-D", 2) == 0) {
String *d = NewString(argv[i] + 2);
Replace(d, (char *) "=", (char *) " ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Replace(d, "=", " ", DOH_REPLACE_ANY | DOH_REPLACE_FIRST);
Preprocessor_define((DOH *) d, 0);
Delete(d);
// Create a symbol

View file

@ -3956,7 +3956,7 @@ extern "C" Language *swig_modula3(void) {
* Static member variables
* ----------------------------------------------------------------------------- */
const char *MODULA3::usage = (char *) "\
const char *MODULA3::usage = "\
Modula 3 Options (available with -modula3)\n\
-generateconst <file> - Generate code for computing numeric values of constants\n\
-generaterename <file> - Generate suggestions for %rename\n\

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Mzscheme Options (available with -mzscheme)\n\
-declaremodule - Create extension that declares a module\n\
-dynamic-load <library>,[library,...] - Do not link with these libraries, dynamic load\n\
@ -36,7 +36,7 @@ static bool declaremodule = false;
static bool noinit = false;
static String *load_libraries = NULL;
static String *module = 0;
static char *mzscheme_path = (char *) "mzscheme";
static const char *mzscheme_path = "mzscheme";
static String *init_func_def = 0;
static File *f_begin = 0;

View file

@ -15,7 +15,7 @@
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Ocaml Options (available with -ocaml)\n\
-oldvarnames - Old intermediary method names for variable wrappers\n\
-prefix <name> - Set a prefix <name> to be prepended to all names\n\
@ -29,7 +29,7 @@ static int const_enum = 0;
static int static_member_function = 0;
static int generate_sizeof = 0;
static String *prefix = 0;
static char *ocaml_path = (char *) "ocaml";
static const char *ocaml_path = "ocaml";
static bool old_variable_names = false;
static String *classname = 0;
static String *module = 0;

View file

@ -17,7 +17,7 @@
static String *global_name = 0;
static String *op_prefix = 0;
static const char *usage = (char *) "\
static const char *usage = "\
Octave Options (available with -octave)\n\
-globals <name> - Set <name> used to access C global variables [default: 'cvar']\n\
Use '.' to load C global variables into module namespace\n\

View file

@ -17,7 +17,7 @@ static int treduce = SWIG_cparse_template_reduce(0);
#include <ctype.h>
static const char *usage = (char *) "\
static const char *usage = "\
Perl5 Options (available with -perl5)\n\
-compat - Compatibility mode\n\
-const - Wrap constants as constants and not variables (implies -proxy)\n\

View file

@ -42,7 +42,7 @@
#include <ctype.h>
#include <errno.h>
static const char *usage = (char *) "\
static const char *usage = "\
PHP Options (available with -php)\n\
-cppext <ext> - Change C++ file extension to <ext> (default is cpp)\n\
-noproxy - Don't generate proxy classes.\n\
@ -414,10 +414,9 @@ public:
* which has to be dynamically generated as it depends on the module name.
*/
Append(s_header, "#ifdef __GNUC__\n");
Append(s_header, "static void SWIG_FAIL() __attribute__ ((__noreturn__));\n");
Append(s_header, "static void SWIG_FAIL(TSRMLS_D) __attribute__ ((__noreturn__));\n");
Append(s_header, "#endif\n\n");
Append(s_header, "static void SWIG_FAIL() {\n");
Append(s_header, " TSRMLS_FETCH();\n");
Append(s_header, "static void SWIG_FAIL(TSRMLS_D) {\n");
Append(s_header, " zend_error(SWIG_ErrorCode(), \"%s\", SWIG_ErrorMsg());\n");
// zend_error() should never return with the parameters we pass, but if it
// does, we really don't want to let SWIG_FAIL() return. This also avoids
@ -433,8 +432,7 @@ public:
Printf(s_header, "static void %s_destroy_globals(zend_%s_globals * globals) { (void)globals; }\n", module, module);
Printf(s_header, "\n");
Printf(s_header, "static void SWIG_ResetError() {\n");
Printf(s_header, " TSRMLS_FETCH();\n");
Printf(s_header, "static void SWIG_ResetError(TSRMLS_D) {\n");
Printf(s_header, " SWIG_ErrorMsg() = default_error_msg;\n");
Printf(s_header, " SWIG_ErrorCode() = default_error_code;\n");
Printf(s_header, "}\n");
@ -445,7 +443,7 @@ public:
Append(s_header, " swig_object_wrapper *value;\n");
Append(s_header, " int type;\n");
Append(s_header, "\n");
Append(s_header, " SWIG_ResetError();\n");
Append(s_header, " SWIG_ResetError(TSRMLS_C);\n");
Append(s_header, " if(ZEND_NUM_ARGS() != 2 || zend_get_parameters_array_ex(2, args) != SUCCESS) {\n");
Append(s_header, " WRONG_PARAM_COUNT;\n");
Append(s_header, " }\n");
@ -460,7 +458,7 @@ public:
Append(s_header, " swig_object_wrapper *value;\n");
Append(s_header, " int type;\n");
Append(s_header, "\n");
Append(s_header, " SWIG_ResetError();\n");
Append(s_header, " SWIG_ResetError(TSRMLS_C);\n");
Append(s_header, " if(ZEND_NUM_ARGS() != 1 || zend_get_parameters_array_ex(1, args) != SUCCESS) {\n");
Append(s_header, " WRONG_PARAM_COUNT;\n");
Append(s_header, " }\n");
@ -736,7 +734,7 @@ public:
Printf(f->code, "SWIG_ErrorCode() = E_ERROR;\n");
Printf(f->code, "SWIG_ErrorMsg() = \"No matching function for overloaded '%s'\";\n", symname);
Printv(f->code, "SWIG_FAIL();\n", NIL);
Printv(f->code, "SWIG_FAIL(TSRMLS_C);\n", NIL);
Printv(f->code, "}\n", NIL);
Wrapper_print(f, s_wrappers);
@ -854,7 +852,7 @@ public:
// NOTE: possible we ignore this_ptr as a param for native constructor
Printf(f->code, "SWIG_ResetError();\n");
Printf(f->code, "SWIG_ResetError(TSRMLS_C);\n");
if (numopt > 0) { // membervariable wrappers do not have optional args
Wrapper_add_local(f, "arg_count", "int arg_count");
@ -1019,7 +1017,7 @@ public:
/* Error handling code */
Printf(f->code, "fail:\n");
Printv(f->code, cleanup, NIL);
Append(f->code, "SWIG_FAIL();\n");
Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
Printf(f->code, "}\n");
@ -2056,7 +2054,6 @@ done:
// Write property SET handlers
ki = First(shadow_set_vars);
if (ki.key) {
// This class has setters.
Printf(s_phpclasses, "\n\tfunction __set($var,$value) {\n");
@ -2079,17 +2076,6 @@ done:
Printf(s_phpclasses, "\t\t$this->%s[$var] = $value;\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
/* Create __isset for PHP 5.1 and later; PHP 5.0 will just ignore it. */
Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
Printf(s_phpclasses, "\t\tif (function_exists('%s_'.$var.'_set')) return true;\n", shadow_classname);
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
if (baseclass) {
Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
} else {
Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
} else {
Printf(s_phpclasses, "\n\tfunction __set($var,$value) {\n");
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_alter_newobject($this->%s,$value);\n", module, SWIG_PTR);
@ -2099,18 +2085,10 @@ done:
Printf(s_phpclasses, "\t\t$this->%s[$var] = $value;\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
if (baseclass) {
Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
} else {
Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
}
// Write property GET handlers
ki = First(shadow_get_vars);
if (ki.key) {
// This class has getters.
Printf(s_phpclasses, "\n\tfunction __get($var) {\n");
@ -2146,6 +2124,19 @@ done:
Printf(s_phpclasses, "\t\treturn $this->%s[$var];\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
/* Create __isset for PHP 5.1 and later; PHP 5.0 will just ignore it. */
/* __isset() should return true for read-only properties, so check for
* *_get() not *_set(). */
Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
Printf(s_phpclasses, "\t\tif (function_exists('%s_'.$var.'_get')) return true;\n", shadow_classname);
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
if (baseclass) {
Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
} else {
Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
} else {
Printf(s_phpclasses, "\n\tfunction __get($var) {\n");
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return swig_%s_get_newobject($this->%s);\n", module, SWIG_PTR);
@ -2155,6 +2146,14 @@ done:
Printf(s_phpclasses, "\t\treturn $this->%s[$var];\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
Printf(s_phpclasses, "\n\tfunction __isset($var) {\n");
Printf(s_phpclasses, "\t\tif ($var === 'thisown') return true;\n");
if (baseclass) {
Printf(s_phpclasses, "\t\treturn %s%s::__isset($var);\n", prefix, baseclass);
} else {
Printf(s_phpclasses, "\t\treturn array_key_exists($var, $this->%s);\n", SWIG_DATA);
}
Printf(s_phpclasses, "\t}\n");
}
if (!class_has_ctor) {
@ -2274,8 +2273,8 @@ done:
if (i) {
Insert(args, 0, ", ");
}
Printf(director_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", Swig_cresult_name(), ctype, sname, args);
Printf(director_prot_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0%s TSRMLS_CC);\n}\n", Swig_cresult_name(), ctype, sname, args);
Printf(director_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0 TSRMLS_CC%s);\n}\n", Swig_cresult_name(), ctype, sname, args);
Printf(director_prot_ctor_code, "} else {\n %s = (%s *)new SwigDirector_%s(arg0 TSRMLS_CC%s);\n}\n", Swig_cresult_name(), ctype, sname, args);
Delete(args);
wrapperType = directorconstructor;
@ -2336,7 +2335,7 @@ done:
Append(f->code, "return;\n");
Append(f->code, "fail:\n");
Append(f->code, "SWIG_FAIL();\n");
Append(f->code, "SWIG_FAIL(TSRMLS_C);\n");
Printf(f->code, "}\n");
Wrapper_print(f, s_wrappers);
@ -2387,17 +2386,23 @@ done:
parms = p;
if (!Getattr(n, "defaultargs")) {
// There should always be a "self" parameter first.
assert(ParmList_len(parms) > 0);
/* constructor */
{
Wrapper *w = NewWrapper();
String *call;
String *basetype = Getattr(parent, "classtype");
// We put TSRMLS_DC after the self parameter in order to cope with
// any default parameters.
String *target = Swig_method_decl(0, decl, classname, parms, 0, 0);
if (((const char *)Char(target))[Len(target) - 2] == '(') {
Insert(target, Len(target) - 1, "TSRMLS_D");
} else {
Insert(target, Len(target) - 1, " TSRMLS_DC");
}
const char * p = Char(target);
const char * comma = strchr(p, ',');
size_t ins = comma ? comma - p : Len(target) - 1;
Insert(target, ins, " TSRMLS_DC");
call = Swig_csuperclass_call(0, basetype, superparms);
Printf(w->def, "%s::%s: %s, Swig::Director(self TSRMLS_CC) {", classname, target, call);
Append(w->def, "}");
@ -2409,12 +2414,14 @@ done:
/* constructor header */
{
// We put TSRMLS_DC after the self parameter in order to cope with
// any default parameters.
String *target = Swig_method_decl(0, decl, classname, parms, 0, 1);
if (((const char *)Char(target))[Len(target) - 2] == '(') {
Insert(target, Len(target) - 1, "TSRMLS_D");
} else {
Insert(target, Len(target) - 1, " TSRMLS_DC");
}
const char * p = Char(target);
const char * comma = strchr(p, ',');
size_t ins = comma ? comma - p : Len(target) - 1;
Insert(target, ins, " TSRMLS_DC");
Printf(f_directors_h, " %s;\n", target);
Delete(target);
}
@ -2700,7 +2707,7 @@ done:
}
Append(w->code, "fail:\n");
Append(w->code, "SWIG_FAIL();\n");
Append(w->code, "SWIG_FAIL(TSRMLS_C);\n");
Append(w->code, "}\n");
// We expose protected methods via an extra public inline method which makes a straight call to the wrapped class' method

View file

@ -33,7 +33,7 @@
#include <ctype.h> // for isalnum()
static const char *usage = (char *) "\
static const char *usage = "\
Pike Options (available with -pike)\n\
[no additional options]\n\
\n";

View file

@ -107,7 +107,7 @@ enum autodoc_t {
};
static const char *usage1 = (char *) "\
static const char *usage1 = "\
Python Options (available with -python)\n\
-aliasobj0 - Alias obj0 when using fastunpack, needed for some old typemaps \n\
-buildnone - Use Py_BuildValue(" ") to obtain Py_None (default in Windows)\n\
@ -127,7 +127,7 @@ Python Options (available with -python)\n\
-keyword - Use keyword arguments\n\
-modern - Use modern python features only, without compatibility code\n\
-modernargs - Use \"modern\" args mechanism to pack/unpack the function arguments\n";
static const char *usage2 = (char *) "\
static const char *usage2 = "\
-newrepr - Use more informative version of __repr__ in proxy classes (default) \n\
-newvwm - New value wrapper mode, use only when everything else fails \n\
-noaliasobj0 - Don't generate an obj0 alias when using fastunpack (default) \n\
@ -144,7 +144,7 @@ static const char *usage2 = (char *) "\
-noh - Don't generate the output header file\n\
-nomodern - Don't use modern python features which are not backwards compatible \n\
-nomodernargs - Use classic ParseTuple/CallFunction methods to pack/unpack the function arguments (default) \n";
static const char *usage3 = (char *) "\
static const char *usage3 = "\
-noolddefs - Don't emit the old method definitions even when using fastproxy (default) \n\
-nooutputtuple - Use a PyList for appending output values (default) \n\
-noproxy - Don't generate proxy classes \n\

View file

@ -14,7 +14,6 @@
#include "swigmod.h"
static const double DEFAULT_NUMBER = .0000123456712312312323;
static const int MAX_OVERLOAD_ARGS = 5;
static String* replaceInitialDash(const String *name)
{
@ -206,7 +205,7 @@ static void writeListByLine(List *l, File *out, bool quote = 0) {
}
static const char *usage = (char *)"\
static const char *usage = "\
R Options (available with -r)\n\
-copystruct - Emit R code to copy C structs (on by default)\n\
-cppcast - Enable C++ casting operators (default) \n\
@ -2161,7 +2160,7 @@ int R::functionWrapper(Node *n) {
/* If we are dealing with a method in an C++ class, then
add the name of the R function and its definition.
XXX need to figure out how to store the Wrapper if possible in the hash/list.
Would like to be able to do this so that we can potentialy insert
Would like to be able to do this so that we can potentially insert
*/
if(processing_member_access_function || processing_class_member_function) {
addAccessor(member_name, sfun, iname);

View file

@ -130,7 +130,7 @@ enum autodoc_t {
AUTODOC_NONE
};
static const char *usage = (char *) "\
static const char *usage = "\
Ruby Options (available with -ruby)\n\
-autorename - Enable renaming of classes and methods to follow Ruby coding standards\n\
-cppcast - Enable C++ casting operators (default)\n\
@ -1111,7 +1111,7 @@ public:
/* typedef void *VALUE */
SwigType *value = NewSwigType(T_VOID);
SwigType_add_pointer(value);
SwigType_typedef(value, (char *) "VALUE");
SwigType_typedef(value, "VALUE");
Delete(value);
/* Set module name */

View file

@ -15,7 +15,7 @@
#include "cparse.h"
static int treduce = SWIG_cparse_template_reduce(0);
static const char *usage = (char *) "\
static const char *usage = "\
Tcl 8 Options (available with -tcl)\n\
-itcl - Enable ITcl support\n\
-nosafe - Leave out SafeInit module function.\n\

View file

@ -15,7 +15,7 @@
#include "swigmod.h"
static const char *usage = (char *) "\
static const char *usage = "\
UFFI Options (available with -uffi)\n\
-identifier-converter <type or funcname> - \n\
Specifies the type of conversion to do on C identifiers\n\

View file

@ -467,7 +467,7 @@ static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms,
return func;
if (!self)
self = (char *) "(this)->";
self = "(this)->";
Append(func, self);
if (SwigType_istemplate(name) && (strncmp(Char(name), "operator ", 9) == 0)) {

View file

@ -45,8 +45,8 @@ typedef struct Locator {
} Locator;
static int follow_locators = 0;
void Scanner_push_brackets(Scanner*);
void Scanner_clear_brackets(Scanner*);
static void brackets_push(Scanner *);
static void brackets_clear(Scanner *);
/* -----------------------------------------------------------------------------
* NewScanner()
@ -70,7 +70,7 @@ Scanner *NewScanner(void) {
s->error_line = 0;
s->freeze_line = 0;
s->brackets = NewList();
Scanner_push_brackets(s);
brackets_push(s);
return s;
}
@ -80,7 +80,7 @@ Scanner *NewScanner(void) {
* Delete a scanner object.
* ----------------------------------------------------------------------------- */
void DelScanner(Scanner * s) {
void DelScanner(Scanner *s) {
assert(s);
Delete(s->scanobjs);
Delete(s->brackets);
@ -98,12 +98,12 @@ void DelScanner(Scanner * s) {
* Clear the contents of a scanner object.
* ----------------------------------------------------------------------------- */
void Scanner_clear(Scanner * s) {
void Scanner_clear(Scanner *s) {
assert(s);
Delete(s->str);
Clear(s->text);
Clear(s->scanobjs);
Scanner_clear_brackets(s);
brackets_clear(s);
Delete(s->error);
s->str = 0;
s->error = 0;
@ -126,7 +126,7 @@ void Scanner_clear(Scanner * s) {
* immediately before returning to the old text.
* ----------------------------------------------------------------------------- */
void Scanner_push(Scanner * s, String *txt) {
void Scanner_push(Scanner *s, String *txt) {
assert(s && txt);
Push(s->scanobjs, txt);
if (s->str) {
@ -145,7 +145,7 @@ void Scanner_push(Scanner * s, String *txt) {
* call to Scanner_token().
* ----------------------------------------------------------------------------- */
void Scanner_pushtoken(Scanner * s, int nt, const_String_or_char_ptr val) {
void Scanner_pushtoken(Scanner *s, int nt, const_String_or_char_ptr val) {
assert(s);
assert((nt >= 0) && (nt < SWIG_MAXTOKENS));
s->nexttoken = nt;
@ -161,7 +161,7 @@ void Scanner_pushtoken(Scanner * s, int nt, const_String_or_char_ptr val) {
* Set the file and line number location of the scanner.
* ----------------------------------------------------------------------------- */
void Scanner_set_location(Scanner * s, String *file, int line) {
void Scanner_set_location(Scanner *s, String *file, int line) {
Setline(s->str, line);
Setfile(s->str, file);
s->line = line;
@ -173,7 +173,7 @@ void Scanner_set_location(Scanner * s, String *file, int line) {
* Get the current file.
* ----------------------------------------------------------------------------- */
String *Scanner_file(Scanner * s) {
String *Scanner_file(Scanner *s) {
return Getfile(s->str);
}
@ -182,7 +182,7 @@ String *Scanner_file(Scanner * s) {
*
* Get the current line number
* ----------------------------------------------------------------------------- */
int Scanner_line(Scanner * s) {
int Scanner_line(Scanner *s) {
return s->line;
}
@ -191,7 +191,7 @@ int Scanner_line(Scanner * s) {
*
* Get the line number on which the current token starts
* ----------------------------------------------------------------------------- */
int Scanner_start_line(Scanner * s) {
int Scanner_start_line(Scanner *s) {
return s->start_line;
}
@ -201,7 +201,7 @@ int Scanner_start_line(Scanner * s) {
* Change the set of additional characters that can be used to start an identifier.
* ----------------------------------------------------------------------------- */
void Scanner_idstart(Scanner * s, const char *id) {
void Scanner_idstart(Scanner *s, const char *id) {
free(s->idstart);
s->idstart = Swig_copy_string(id);
}
@ -211,7 +211,7 @@ void Scanner_idstart(Scanner * s, const char *id) {
*
* Returns the next character from the scanner or 0 if end of the string.
* ----------------------------------------------------------------------------- */
static char nextchar(Scanner * s) {
static char nextchar(Scanner *s) {
int nc;
if (!s->str)
return 0;
@ -253,8 +253,7 @@ String *Scanner_errmsg(Scanner *s) {
return s->error;
}
int
Scanner_errline(Scanner *s) {
int Scanner_errline(Scanner *s) {
return s->error_line;
}
@ -269,71 +268,99 @@ static void freeze_line(Scanner *s, int val) {
}
/* -----------------------------------------------------------------------------
* Scanner_brackets()
* brackets_count()
*
* Returns the number of brackets at the current depth.
* A syntax error with unbalanced ) brackets will result in a NULL pointer return.
* ----------------------------------------------------------------------------- */
int*
Scanner_brackets(Scanner *s) {
return (int*)(**((void***)Getitem(s->brackets, 0))); /* TODO: Use VoidObj*->ptr instead of void** */
static int *brackets_count(Scanner *s) {
int *count;
if (Len(s->brackets) > 0)
count = (int *)Data(Getitem(s->brackets, 0));
else
count = 0;
return count;
}
/* -----------------------------------------------------------------------------
* Scanner_clear_brackets()
* brackets_clear()
*
* Resets the current depth and clears all brackets.
* Usually called at the end of statements;
* ----------------------------------------------------------------------------- */
void
Scanner_clear_brackets(Scanner *s) {
static void brackets_clear(Scanner *s) {
Clear(s->brackets);
Scanner_push_brackets(s); /* base bracket count should always be created */
brackets_push(s); /* base bracket count should always be created */
}
/* -----------------------------------------------------------------------------
* Scanner_inc_brackets()
* brackets_increment()
*
* Increases the number of brackets at the current depth.
* Usually called when '<' was found.
* Usually called when a single '<' is found.
* ----------------------------------------------------------------------------- */
void
Scanner_inc_brackets(Scanner *s) {
(*Scanner_brackets(s))++;
static void brackets_increment(Scanner *s) {
int *count = brackets_count(s);
if (count)
(*count)++;
}
/* -----------------------------------------------------------------------------
* Scanner_dec_brackets()
* brackets_decrement()
*
* Decreases the number of brackets at the current depth.
* Usually called when '>' was found.
* Usually called when a single '>' is found.
* ----------------------------------------------------------------------------- */
void
Scanner_dec_brackets(Scanner *s) {
(*Scanner_brackets(s))--;
static void brackets_decrement(Scanner *s) {
int *count = brackets_count(s);
if (count)
(*count)--;
}
/* -----------------------------------------------------------------------------
* Scanner_push_brackets()
* brackets_reset()
*
* Sets the number of '<' brackets back to zero. Called at the point where
* it is no longer possible to have a matching closing >> pair for a template.
* ----------------------------------------------------------------------------- */
static void brackets_reset(Scanner *s) {
int *count = brackets_count(s);
if (count)
*count = 0;
}
/* -----------------------------------------------------------------------------
* brackets_push()
*
* Increases the depth of brackets.
* Usually called when '(' was found.
* Usually called when '(' is found.
* ----------------------------------------------------------------------------- */
void
Scanner_push_brackets(Scanner *s) {
static void brackets_push(Scanner *s) {
int *newInt = malloc(sizeof(int));
*newInt = 0;
Push(s->brackets, NewVoid(newInt, free));
}
/* -----------------------------------------------------------------------------
* Scanner_pop_brackets()
* brackets_pop()
*
* Decreases the depth of brackets.
* Usually called when ')' was found.
* Usually called when ')' is found.
* ----------------------------------------------------------------------------- */
void
Scanner_pop_brackets(Scanner *s) {
Delitem(s->brackets, 0);
static void brackets_pop(Scanner *s) {
if (Len(s->brackets) > 0) /* protect against unbalanced ')' brackets */
Delitem(s->brackets, 0);
}
/* -----------------------------------------------------------------------------
* brackets_allow_shift()
*
* Return 1 to allow shift (>>), or 0 if (>>) should be split into (> >).
* This is for C++11 template syntax for closing templates.
* ----------------------------------------------------------------------------- */
static int brackets_allow_shift(Scanner *s) {
int *count = brackets_count(s);
return !count || (*count <= 0);
}
/* -----------------------------------------------------------------------------
@ -341,7 +368,7 @@ Scanner_pop_brackets(Scanner *s) {
*
* Retract n characters
* ----------------------------------------------------------------------------- */
static void retract(Scanner * s, int n) {
static void retract(Scanner *s, int n) {
int i, l;
char *str;
@ -482,7 +509,7 @@ static void get_escape(Scanner *s) {
* Return the raw value of the next token.
* ----------------------------------------------------------------------------- */
static int look(Scanner * s) {
static int look(Scanner *s) {
int state = 0;
int c = 0;
String *str_delimiter = 0;
@ -526,15 +553,15 @@ static int look(Scanner * s) {
/* Look for single character symbols */
else if (c == '(') {
Scanner_push_brackets(s);
brackets_push(s);
return SWIG_TOKEN_LPAREN;
}
else if (c == ')') {
Scanner_pop_brackets(s);
brackets_pop(s);
return SWIG_TOKEN_RPAREN;
}
else if (c == ';') {
Scanner_clear_brackets(s);
brackets_clear(s);
return SWIG_TOKEN_SEMI;
}
else if (c == ',')
@ -543,8 +570,10 @@ static int look(Scanner * s) {
state = 220;
else if (c == '}')
return SWIG_TOKEN_RBRACE;
else if (c == '{')
else if (c == '{') {
brackets_reset(s);
return SWIG_TOKEN_LBRACE;
}
else if (c == '=')
state = 33;
else if (c == '+')
@ -848,28 +877,32 @@ static int look(Scanner * s) {
break;
case 60: /* shift operators */
Scanner_inc_brackets(s);
if ((c = nextchar(s)) == 0)
if ((c = nextchar(s)) == 0) {
brackets_increment(s);
return SWIG_TOKEN_LESSTHAN;
}
if (c == '<')
state = 240;
else if (c == '=')
return SWIG_TOKEN_LTEQUAL;
else {
retract(s, 1);
brackets_increment(s);
return SWIG_TOKEN_LESSTHAN;
}
break;
case 61:
Scanner_dec_brackets(s);
if ((c = nextchar(s)) == 0)
if ((c = nextchar(s)) == 0) {
brackets_decrement(s);
return SWIG_TOKEN_GREATERTHAN;
if (c == '>' && ((*Scanner_brackets(s))<0)) /* go to double >> only, if no template < has been used */
}
if (c == '>' && brackets_allow_shift(s))
state = 250;
else if (c == '=')
return SWIG_TOKEN_GTEQUAL;
else {
retract(s, 1);
brackets_decrement(s);
return SWIG_TOKEN_GREATERTHAN;
}
break;
@ -1311,7 +1344,6 @@ static int look(Scanner * s) {
break;
case 240: /* LSHIFT, LSEQUAL */
Scanner_inc_brackets(s);
if ((c = nextchar(s)) == 0)
return SWIG_TOKEN_LSHIFT;
else if (c == '=')
@ -1323,7 +1355,6 @@ static int look(Scanner * s) {
break;
case 250: /* RSHIFT, RSEQUAL */
Scanner_dec_brackets(s);
if ((c = nextchar(s)) == 0)
return SWIG_TOKEN_RSHIFT;
else if (c == '=')
@ -1361,7 +1392,7 @@ static int look(Scanner * s) {
* Real entry point to return the next token. Returns 0 if at end of input.
* ----------------------------------------------------------------------------- */
int Scanner_token(Scanner * s) {
int Scanner_token(Scanner *s) {
int t;
Delete(s->error);
if (s->nexttoken >= 0) {
@ -1385,7 +1416,7 @@ int Scanner_token(Scanner * s) {
* Return the lexene associated with the last returned token.
* ----------------------------------------------------------------------------- */
String *Scanner_text(Scanner * s) {
String *Scanner_text(Scanner *s) {
return s->text;
}
@ -1395,7 +1426,7 @@ String *Scanner_text(Scanner * s) {
* Skips to the end of a line
* ----------------------------------------------------------------------------- */
void Scanner_skip_line(Scanner * s) {
void Scanner_skip_line(Scanner *s) {
char c;
int done = 0;
Clear(s->text);
@ -1420,7 +1451,7 @@ void Scanner_skip_line(Scanner * s) {
* (...). Ignores symbols inside comments or strings.
* ----------------------------------------------------------------------------- */
int Scanner_skip_balanced(Scanner * s, int startchar, int endchar) {
int Scanner_skip_balanced(Scanner *s, int startchar, int endchar) {
char c;
int num_levels = 1;
int state = 0;
@ -1557,7 +1588,7 @@ String *Scanner_get_raw_text_balanced(Scanner *s, int startchar, int endchar) {
char c;
int old_line = s->line;
String *old_text = Copy(s->text);
int position = Tell(s->str);
long position = Tell(s->str);
int num_levels = 1;
int state = 0;