Fix typos in docs and comments

This commit is contained in:
Olly Betts 2022-02-26 18:36:12 +13:00
commit b127e11f1e
27 changed files with 46 additions and 46 deletions

View file

@ -151,7 +151,7 @@ The python/lua ones are great, but C++ ones I don't like
(mainly because I cannot get the stack trace out of it)
Therefore I have not bothered to try doing much in this
Therefore currently its just enough to get a few test cases running ok
Therefore currently it's just enough to get a few test cases running ok
note: if you wish to throw anything related to std::exception
use %include <std_except.i> instead
@ -191,7 +191,7 @@ use %include <std_except.i> instead
Throwing object is a serious problem:
Assuming some code throws a 'FooBar'
There are a few options:
- return a pointer to it: but its unclear how long this will last for.
- return a pointer to it: but it's unclear how long this will last for.
- return a copy of it: but not all objects are copyable
(see exception_partial_info in the test suite for a case where you cannot do this)
- convert to a string & throw that
@ -224,7 +224,7 @@ SWIG_fail;%}
// note: no support for object pointers
// its not clear how long the pointer is valid for, therefore not supporting it
// it's not clear how long the pointer is valid for, therefore not supporting it
/* -----------------------------------------------------------------------------
* extras

View file

@ -17,7 +17,7 @@ note: it should be passed by value, not byref or as a pointer.
The SWIGLUA_FN holds a pointer to the lua_State, and the stack index where the function is held.
The macro SWIGLUA_FN_GET() will put a copy of the lua function at the top of the stack.
After that its fairly simple to write the rest of the code (assuming know how to use lua),
After that it's fairly simple to write the rest of the code (assuming know how to use lua),
just push the parameters, call the function and return the result.
int my_func(int a, int b, SWIGLUA_FN fn)

View file

@ -826,7 +826,7 @@ SWIGINTERN int SWIG_Lua_class_do_get_item(lua_State *L, swig_type_info *type, i
/* NEW: looks for the __getitem() fn
this is a user provided get fn */
SWIG_Lua_get_table(L,"__getitem"); /* find the __getitem fn */
if (lua_iscfunction(L,-1)) /* if its there */
if (lua_iscfunction(L,-1)) /* if it's there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
@ -883,7 +883,7 @@ SWIGINTERN int SWIG_Lua_class_do_get(lua_State *L, swig_type_info *type, int SW
lua_pushvalue(L,substack_start+2); /* key */
lua_rawget(L,-2); /* look for the fn */
lua_remove(L,-2); /* stack tidy, remove .fn table */
if (lua_isfunction(L,-1)) /* note: if its a C function or lua function */
if (lua_isfunction(L,-1)) /* note: if it's a C function or lua function */
{ /* found it so return the fn & let lua call it */
lua_remove(L,-2); /* stack tidy, remove metatable */
if(ret)
@ -966,7 +966,7 @@ SWIGINTERN int SWIG_Lua_class_do_set(lua_State *L, swig_type_info *type, int fi
/* NEW: looks for the __setitem() fn
this is a user provided set fn */
SWIG_Lua_get_table(L,"__setitem"); /* find the fn */
if (lua_iscfunction(L,-1)) /* if its there */
if (lua_iscfunction(L,-1)) /* if it's there */
{ /* found it so call the fn & return its value */
lua_pushvalue(L,substack_start+1); /* the userdata */
lua_pushvalue(L,substack_start+2); /* the parameter */
@ -1343,7 +1343,7 @@ SWIGINTERN void SWIG_Lua_add_class_instance_details(lua_State *L, swig_lua_clas
SWIGRUNTIME int SWIG_Lua_resolve_metamethod(lua_State *L); /*forward declaration*/
/* The real function that resolves a metamethod.
* Function searches given class and all it's bases(recursively) for first instance of something that is
* Function searches given class and all its bases (recursively) for first instance of something that is
* not equal to SWIG_Lua_resolve_metamethod. (Almost always this 'something' is actual metamethod implementation
* and it is a SWIG-generated C function.). It returns value on the top of the L and there is no garbage below the
* answer.

View file

@ -252,7 +252,7 @@ $1=($1_ltype)&temp;%}
/* void* is a special case
A function void fn(void*) should take any kind of pointer as a parameter (just like C/C++ does)
but if its an output, then it should be wrapped like any other SWIG object (using default typemap)
but if it's an output, then it should be wrapped like any other SWIG object (using default typemap)
*/
%typemap(in,checkfn="SWIG_isptrtype") void*
%{$1=($1_ltype)SWIG_MustGetPtr(L,$input,0,0,$argnum,"$symname");%}
@ -285,7 +285,7 @@ parameters match which function
// unfortunately lua only considers one type of number
// so all numbers (int,float,double) match
// you could add an advanced fn to get type & check if its integral
// you could add an advanced fn to get type & check if it's integral
%typecheck(SWIG_TYPECHECK_INTEGER)
int, short, long,
unsigned int, unsigned short, unsigned long,
@ -396,7 +396,7 @@ parameters match which function
* Specials
* ----------------------------------------------------------------------------- */
// swig::LANGUAGE_OBJ was added to allow containers of native objects
// however its rather difficult to do this in lua, as you cannot hold pointers
// however it's rather difficult to do this in lua, as you cannot hold pointers
// to native objects (they are held in the interpreter)
// therefore for now: just ignoring this feature
#ifdef __cplusplus

View file

@ -28,7 +28,7 @@ The basic code looks like this:
However the code below is a mixture of #defines & such, so nowhere as easy to read
To make you code work correctly its not just a matter of %including this file
To make you code work correctly it's not just a matter of %including this file
You also have to give SWIG the hints on which to use where
eg
@ -77,7 +77,7 @@ SWIG_NUMBER_TYPEMAP(enum SWIGTYPE);
// also for long longs's
SWIG_NUMBER_TYPEMAP(long long); SWIG_NUMBER_TYPEMAP(unsigned long long); SWIG_NUMBER_TYPEMAP(signed long long);
// note we dont do char, as a char* is probably a string not a ptr to a single char
// note we don't do char, as a char* is probably a string not a ptr to a single char
// similar for booleans
%typemap(in,checkfn="lua_isboolean") bool *INPUT(bool temp), bool &INPUT(bool temp)