Changeset 136929 for trunk/base


Ignore:
Timestamp:
May 30, 2015, 2:14:47 PM (5 years ago)
Author:
cal@…
Message:

machista: add missing include, re-generate with newer swig

This adds a warning about a missing initializer when compiling machista_wrap.c
with clang. This warning is a false positive. While there is no explicit
initializer for the last member of the struct (a Tcl hashtable), the C99
standard guarantees unitialized static structs are set to 0 (and the value
doesn't really matter anyway, because it will be properly initialized later
on). Putting a {0} there does not really help either, because clang doesn't
recognize this standard way to say "initialize the rest with zeroes".

=> I'm ignoring this warning.

Location:
trunk/base/src/machista1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/machista1.0/machista.i

    r93303 r136929  
    33
    44%{
    5     #include "libmachista.h"
     5#include <tcl.h>
     6#include "libmachista.h"
    67%}
    78
  • trunk/base/src/machista1.0/machista_wrap.c

    r93303 r136929  
    11/* ----------------------------------------------------------------------------
    22 * This file was automatically generated by SWIG (http://www.swig.org).
    3  * Version 1.3.40
    4  * 
    5  * This file is not intended to be easily readable and contains a number of 
     3 * Version 3.0.5
     4 *
     5 * This file is not intended to be easily readable and contains a number of
    66 * coding conventions designed to improve portability and efficiency. Do not make
    7  * changes to this file unless you know what you are doing--modify the SWIG 
    8  * interface file instead. 
     7 * changes to this file unless you know what you are doing--modify the SWIG
     8 * interface file instead.
    99 * ----------------------------------------------------------------------------- */
    1010
     
    4242# if defined(__GNUC__)
    4343#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
    44 #     define SWIGUNUSED __attribute__ ((__unused__)) 
     44#     define SWIGUNUSED __attribute__ ((__unused__))
    4545#   else
    4646#     define SWIGUNUSED
    4747#   endif
    4848# elif defined(__ICC)
    49 #   define SWIGUNUSED __attribute__ ((__unused__)) 
     49#   define SWIGUNUSED __attribute__ ((__unused__))
    5050# else
    51 #   define SWIGUNUSED 
     51#   define SWIGUNUSED
    5252# endif
    5353#endif
     
    5656# if defined(_MSC_VER)
    5757#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
    58 # endif 
     58# endif
    5959#endif
    6060
     
    6363#   define SWIGUNUSEDPARM(p)
    6464# else
    65 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
     65#   define SWIGUNUSEDPARM(p) p SWIGUNUSED
    6666# endif
    6767#endif
     
    106106# else
    107107#   define SWIGSTDCALL
    108 # endif 
     108# endif
    109109#endif
    110110
     
    152152  creating a static or dynamic library from the SWIG runtime code.
    153153  In 99.9% of the cases, SWIG just needs to declare them as 'static'.
    154  
     154
    155155  But only do this if strictly necessary, ie, if you have problems
    156156  with your compiler or suchlike.
     
    178178
    179179
    180 /* 
     180/*
    181181   Flags/methods for returning states.
    182    
    183    The SWIG conversion methods, as ConvertPtr, return and integer
     182
     183   The SWIG conversion methods, as ConvertPtr, return an integer
    184184   that tells if the conversion was successful or not. And if not,
    185185   an error code can be returned (see swigerrors.swg for the codes).
    186    
     186
    187187   Use the following macros/flags to set or process the returning
    188188   states.
    189    
     189
    190190   In old versions of SWIG, code such as the following was usually written:
    191191
     
    220220      // fail code
    221221    }
    222    
     222
    223223   I.e., now SWIG_ConvertPtr can return new objects and you can
    224224   identify the case and take care of the deallocation. Of course that
    225225   also requires SWIG_ConvertPtr to return new result values, such as
    226226
    227       int SWIG_ConvertPtr(obj, ptr,...) {         
    228         if (<obj is ok>) {                             
    229           if (<need new object>) {                     
    230             *ptr = <ptr to new allocated object>; 
    231             return SWIG_NEWOBJ;               
    232           } else {                                     
    233             *ptr = <ptr to old object>;       
    234             return SWIG_OLDOBJ;               
    235           }                                   
    236         } else {                                       
    237           return SWIG_BADOBJ;                 
    238         }                                             
     227      int SWIG_ConvertPtr(obj, ptr,...) {
     228        if (<obj is ok>) {
     229          if (<need new object>) {
     230            *ptr = <ptr to new allocated object>;
     231            return SWIG_NEWOBJ;
     232          } else {
     233            *ptr = <ptr to old object>;
     234            return SWIG_OLDOBJ;
     235          }
     236        } else {
     237          return SWIG_BADOBJ;
     238        }
    239239      }
    240240
     
    250250
    251251   and you call
    252  
     252
    253253      food(1)   // cast rank '1'  (1 -> 1.0)
    254254      fooi(1)   // cast rank '0'
     
    257257*/
    258258
    259 #define SWIG_OK                    (0) 
     259#define SWIG_OK                    (0)
    260260#define SWIG_ERROR                 (-1)
    261261#define SWIG_IsOK(r)               (r >= 0)
    262 #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError) 
     262#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
    263263
    264264/* The CastRankLimit says how many bits are used for the cast rank */
     
    291291#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
    292292#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
    293 SWIGINTERNINLINE int SWIG_AddCast(int r) { 
     293SWIGINTERNINLINE int SWIG_AddCast(int r) {
    294294  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
    295295}
    296 SWIGINTERNINLINE int SWIG_CheckState(int r) { 
    297   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
     296SWIGINTERNINLINE int SWIG_CheckState(int r) {
     297  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
    298298}
    299299#else /* no cast-rank mode */
    300 #  define SWIG_AddCast
     300#  define SWIG_AddCast(r) (r)
    301301#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
    302302#endif
     
    342342} swig_module_info;
    343343
    344 /* 
     344/*
    345345  Compare two type names skipping the space characters, therefore
    346346  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
     
    362362/*
    363363  Check type equivalence in a name list like <name1>|<name2>|...
     364  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
     365*/
     366SWIGRUNTIME int
     367SWIG_TypeCmp(const char *nb, const char *tb) {
     368  int equiv = 1;
     369  const char* te = tb + strlen(tb);
     370  const char* ne = nb;
     371  while (equiv != 0 && *ne) {
     372    for (nb = ne; *ne; ++ne) {
     373      if (*ne == '|') break;
     374    }
     375    equiv = SWIG_TypeNameComp(nb, ne, tb, te);
     376    if (*ne) ++ne;
     377  }
     378  return equiv;
     379}
     380
     381/*
     382  Check type equivalence in a name list like <name1>|<name2>|...
    364383  Return 0 if not equal, 1 if equal
    365384*/
    366385SWIGRUNTIME int
    367386SWIG_TypeEquiv(const char *nb, const char *tb) {
    368   int equiv = 0;
    369   const char* te = tb + strlen(tb);
    370   const char* ne = nb;
    371   while (!equiv && *ne) {
    372     for (nb = ne; *ne; ++ne) {
    373       if (*ne == '|') break;
    374     }
    375     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    376     if (*ne) ++ne;
    377   }
    378   return equiv;
    379 }
    380 
    381 /*
    382   Check type equivalence in a name list like <name1>|<name2>|...
    383   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
    384 */
    385 SWIGRUNTIME int
    386 SWIG_TypeCompare(const char *nb, const char *tb) {
    387   int equiv = 0;
    388   const char* te = tb + strlen(tb);
    389   const char* ne = nb;
    390   while (!equiv && *ne) {
    391     for (nb = ne; *ne; ++ne) {
    392       if (*ne == '|') break;
    393     }
    394     equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
    395     if (*ne) ++ne;
    396   }
    397   return equiv;
    398 }
    399 
     387  return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
     388}
    400389
    401390/*
     
    426415}
    427416
    428 /* 
     417/*
    429418  Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
    430419*/
     
    461450}
    462451
    463 /* 
     452/*
    464453   Dynamic pointer casting. Down an inheritance hierarchy
    465454*/
     
    505494}
    506495
    507 /* 
     496/*
    508497   Set the clientdata field for a type
    509498*/
     
    513502  /* if (ti->clientdata == clientdata) return; */
    514503  ti->clientdata = clientdata;
    515  
     504
    516505  while (cast) {
    517506    if (!cast->converter) {
     
    520509        SWIG_TypeClientData(tc, clientdata);
    521510      }
    522     }   
     511    }
    523512    cast = cast->next;
    524513  }
     
    529518  ti->owndata = 1;
    530519}
    531  
     520
    532521/*
    533522  Search for a swig_type_info structure only by mangled name
    534523  Search is a O(log #types)
    535  
    536   We start searching at module start, and finish searching when start == end. 
     524
     525  We start searching at module start, and finish searching when start == end.
    537526  Note: if start == end at the beginning of the function, we go all the way around
    538527  the circular list.
    539528*/
    540529SWIGRUNTIME swig_type_info *
    541 SWIG_MangledTypeQueryModule(swig_module_info *start, 
    542                             swig_module_info *end, 
     530SWIG_MangledTypeQueryModule(swig_module_info *start,
     531                            swig_module_info *end,
    543532                            const char *name) {
    544533  swig_module_info *iter = start;
    545534  do {
    546535    if (iter->size) {
    547       register size_t l = 0;
    548       register size_t r = iter->size - 1;
     536      size_t l = 0;
     537      size_t r = iter->size - 1;
    549538      do {
    550539        /* since l+r >= 0, we can (>> 1) instead (/ 2) */
    551         register size_t i = (l + r) >> 1;
     540        size_t i = (l + r) >> 1;
    552541        const char *iname = iter->types[i]->name;
    553542        if (iname) {
    554           register int compare = strcmp(name, iname);
    555           if (compare == 0) {       
     543          int compare = strcmp(name, iname);
     544          if (compare == 0) {
    556545            return iter->types[i];
    557546          } else if (compare < 0) {
     
    578567  It first searches the mangled names of the types, which is a O(log #types)
    579568  If a type is not found it then searches the human readable names, which is O(#types).
    580  
    581   We start searching at module start, and finish searching when start == end. 
     569
     570  We start searching at module start, and finish searching when start == end.
    582571  Note: if start == end at the beginning of the function, we go all the way around
    583572  the circular list.
    584573*/
    585574SWIGRUNTIME swig_type_info *
    586 SWIG_TypeQueryModule(swig_module_info *start, 
    587                      swig_module_info *end, 
     575SWIG_TypeQueryModule(swig_module_info *start,
     576                     swig_module_info *end,
    588577                     const char *name) {
    589578  /* STEP 1: Search the name field using binary search */
     
    596585    swig_module_info *iter = start;
    597586    do {
    598       register size_t i = 0;
     587      size_t i = 0;
    599588      for (; i < iter->size; ++i) {
    600589        if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
     
    604593    } while (iter != end);
    605594  }
    606  
     595
    607596  /* neither found a match */
    608597  return 0;
    609598}
    610599
    611 /* 
     600/*
    612601   Pack binary data into a string
    613602*/
     
    615604SWIG_PackData(char *c, void *ptr, size_t sz) {
    616605  static const char hex[17] = "0123456789abcdef";
    617   register const unsigned char *u = (unsigned char *) ptr;
    618   register const unsigned char *eu =  u + sz;
     606  const unsigned char *u = (unsigned char *) ptr;
     607  const unsigned char *eu =  u + sz;
    619608  for (; u != eu; ++u) {
    620     register unsigned char uu = *u;
     609    unsigned char uu = *u;
    621610    *(c++) = hex[(uu & 0xf0) >> 4];
    622611    *(c++) = hex[uu & 0xf];
     
    625614}
    626615
    627 /* 
     616/*
    628617   Unpack binary data from a string
    629618*/
    630619SWIGRUNTIME const char *
    631620SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
    632   register unsigned char *u = (unsigned char *) ptr;
    633   register const unsigned char *eu = u + sz;
     621  unsigned char *u = (unsigned char *) ptr;
     622  const unsigned char *eu = u + sz;
    634623  for (; u != eu; ++u) {
    635     register char d = *(c++);
    636     register unsigned char uu;
     624    char d = *(c++);
     625    unsigned char uu;
    637626    if ((d >= '0') && (d <= '9'))
    638627      uu = ((d - '0') << 4);
    639628    else if ((d >= 'a') && (d <= 'f'))
    640629      uu = ((d - ('a'-10)) << 4);
    641     else 
     630    else
    642631      return (char *) 0;
    643632    d = *(c++);
     
    646635    else if ((d >= 'a') && (d <= 'f'))
    647636      uu |= (d - ('a'-10));
    648     else 
     637    else
    649638      return (char *) 0;
    650639    *u = uu;
     
    653642}
    654643
    655 /* 
     644/*
    656645   Pack 'void *' into a string buffer.
    657646*/
     
    713702
    714703/*  Errors in SWIG */
    715 #define  SWIG_UnknownError         -1 
    716 #define  SWIG_IOError              -2 
    717 #define  SWIG_RuntimeError         -3 
    718 #define  SWIG_IndexError           -4 
    719 #define  SWIG_TypeError            -5 
    720 #define  SWIG_DivisionByZero       -6 
    721 #define  SWIG_OverflowError        -7 
    722 #define  SWIG_SyntaxError          -8 
    723 #define  SWIG_ValueError           -9 
     704#define  SWIG_UnknownError         -1
     705#define  SWIG_IOError              -2
     706#define  SWIG_RuntimeError         -3
     707#define  SWIG_IndexError           -4
     708#define  SWIG_TypeError            -5
     709#define  SWIG_DivisionByZero       -6
     710#define  SWIG_OverflowError        -7
     711#define  SWIG_SyntaxError          -8
     712#define  SWIG_ValueError           -9
    724713#define  SWIG_SystemError          -10
    725714#define  SWIG_AttributeError       -11
    726 #define  SWIG_MemoryError          -12 
     715#define  SWIG_MemoryError          -12
    727716#define  SWIG_NullReferenceError   -13
    728717
     
    857846  const char              **base_names;
    858847  swig_module_info   *module;
     848  Tcl_HashTable       hashtable;
    859849} swig_class;
    860850
     
    915905
    916906/* -----------------------------------------------------------------------------
    917  * See the LICENSE file for information on copyright, usage and redistribution
    918  * of SWIG, and the README file for authors - http://www.swig.org/release.html.
    919  *
    920907 * tclrun.swg
    921908 *
     
    990977#ifdef __cplusplus
    991978extern "C" {
    992 #if 0
    993 } /* cc-mode */
    994 #endif
    995979#endif
    996980
     
    11991183  data = SWIG_PackData(buf, &module, sizeof(swig_type_info **));
    12001184  *data = 0;
    1201   Tcl_SetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
     1185  Tcl_SetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, TCL_GLOBAL_ONLY);
    12021186}
    12031187
     
    12621246  cls = inst->classptr;
    12631247  while (1) {
     1248    Tcl_HashEntry* hashentry;
    12641249    bi = cls_stack_bi[cls_stack_top];
    12651250    cls = cls_stack[cls_stack_top];
     
    12861271    cls_stack_bi[cls_stack_top]++;
    12871272
    1288     meth = cls->methods;
    1289     /* Check for methods */
    1290     while (meth && meth->name) {
    1291       if (strcmp(meth->name,method) == 0) {
     1273    hashentry = Tcl_FindHashEntry(&(cls->hashtable), method);
     1274    if (hashentry) {
     1275        ClientData cd = Tcl_GetHashValue(hashentry);
     1276        swig_wrapper method_wrapper = (swig_wrapper)cd;
    12921277        oldarg = objv[1];
    12931278        objv[1] = inst->thisptr;
    12941279        Tcl_IncrRefCount(inst->thisptr);
    1295         rcode = (*meth->method)(clientData,interp,objc,objv);
     1280        rcode = (method_wrapper)(clientData,interp,objc,objv);
    12961281        objv[1] = oldarg;
    12971282        Tcl_DecrRefCount(inst->thisptr);
    12981283        return rcode;
    1299       }
    1300       meth++;
    13011284    }
    13021285    /* Check class methods for a match */
     
    14051388  Tcl_Obj *robj = SWIG_NewPointerObj(thisvalue, type,0);
    14061389  /* Check to see if this pointer belongs to a class or not */
    1407   if ((type->clientdata) && (interp)) {
     1390  if (thisvalue && (type->clientdata) && (interp)) {
    14081391    Tcl_CmdInfo    ci;
    14091392    char          *name;
     
    16041587
    16051588#ifdef __cplusplus
    1606 #if 0
    1607 { /* cc-mode */
    1608 #endif
    16091589}
    16101590#endif
     
    16421622#define SWIG_version "1.0"
    16431623
    1644 #define SWIGVERSION 0x010340
     1624#define SWIGVERSION 0x030005
    16451625#define SWIG_VERSION SWIGVERSION
    16461626
     
    16721652
    16731653
    1674     #include "libmachista.h"
     1654#include <tcl.h>
     1655#include "libmachista.h"
    16751656
    16761657
     
    24022383/* -----------------------------------------------------------------------------
    24032384 * Type initialization:
    2404  * This problem is tough by the requirement that no dynamic 
    2405  * memory is used. Also, since swig_type_info structures store pointers to 
     2385 * This problem is tough by the requirement that no dynamic
     2386 * memory is used. Also, since swig_type_info structures store pointers to
    24062387 * swig_cast_info structures and swig_cast_info structures store pointers back
    2407  * to swig_type_info structures, we need some lookup code at initialization. 
    2408  * The idea is that swig generates all the structures that are needed. 
    2409  * The runtime then collects these partially filled structures. 
    2410  * The SWIG_InitializeModule function takes these initial arrays out of 
     2388 * to swig_type_info structures, we need some lookup code at initialization.
     2389 * The idea is that swig generates all the structures that are needed.
     2390 * The runtime then collects these partially filled structures.
     2391 * The SWIG_InitializeModule function takes these initial arrays out of
    24112392 * swig_module, and does all the lookup, filling in the swig_module.types
    24122393 * array with the correct data and linking the correct swig_cast_info
    24132394 * structures together.
    24142395 *
    2415  * The generated swig_type_info structures are assigned staticly to an initial
     2396 * The generated swig_type_info structures are assigned statically to an initial
    24162397 * array. We just loop through that array, and handle each type individually.
    24172398 * First we lookup if this type has been already loaded, and if so, use the
     
    24232404 * The cast_initial array is actually an array of arrays, because each row has
    24242405 * a variable number of columns. So to actually build the cast linked list,
    2425  * we find the array of casts associated with the type, and loop through it 
     2406 * we find the array of casts associated with the type, and loop through it
    24262407 * adding the casts to the list. The one last trick we need to do is making
    24272408 * sure the type pointer in the swig_cast_info struct is correct.
    24282409 *
    2429  * First off, we lookup the cast->type name to see if it is already loaded. 
     2410 * First off, we lookup the cast->type name to see if it is already loaded.
    24302411 * There are three cases to handle:
    24312412 *  1) If the cast->type has already been loaded AND the type we are adding
     
    24332414 *     replace the cast->type pointer with the type pointer that has already
    24342415 *     been loaded.
    2435  *  2) If BOTH types (the one we are adding casting info to, and the 
     2416 *  2) If BOTH types (the one we are adding casting info to, and the
    24362417 *     cast->type) are loaded, THEN the cast info has already been loaded by
    24372418 *     the previous module so we just ignore it.
     
    24572438  size_t i;
    24582439  swig_module_info *module_head, *iter;
    2459   int found, init;
     2440  int init;
    24602441 
    24612442  /* check to see if the circular list has been setup, if not, set it up */
     
    24762457    /* so set the swig module into the interpreter */
    24772458    SWIG_SetModule(clientdata, &swig_module);
    2478     module_head = &swig_module;
    24792459  } else {
    24802460    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
    2481     found=0;
    24822461    iter=module_head;
    24832462    do {
    24842463      if (iter==&swig_module) {
    2485         found=1;
    2486         break;
     2464        /* Our module is already in the list, so there's nothing more to do. */
     2465        return;
    24872466      }
    24882467      iter=iter->next;
    24892468    } while (iter!= module_head);
    24902469   
    2491     /* if the is found in the list, then all is done and we may leave */
    2492     if (found) return;
    2493     /* otherwise we must add out module into the list */
     2470    /* otherwise we must add our module into the list */
    24942471    swig_module.next = module_head->next;
    24952472    module_head->next = &swig_module;
    24962473  }
    24972474 
    2498   /* When multiple interpeters are used, a module could have already been initialized in
     2475  /* When multiple interpreters are used, a module could have already been initialized in
    24992476       a different interpreter, but not yet have a pointer in this interpreter.
    25002477       In this case, we do not want to continue adding types... everything should be
     
    26482625  SWIGINTERN void
    26492626  SWIG_Tcl_InstallConstants(Tcl_Interp *interp, swig_const_info constants[]) {
    2650     int i;
     2627    size_t i;
    26512628    Tcl_Obj *obj;
    26522629   
     
    26732650  }
    26742651 
     2652  /* Create fast method lookup tables */
     2653 
     2654  SWIGINTERN void
     2655  SWIG_Tcl_InstallMethodLookupTables(void) {
     2656    size_t i;
     2657   
     2658    for (i = 0; i < swig_module.size; ++i) {
     2659      swig_type_info *type = swig_module.type_initial[i];
     2660      if (type->clientdata) {
     2661        swig_class* klass = (swig_class*) type->clientdata;
     2662        swig_method* meth;
     2663        Tcl_InitHashTable(&(klass->hashtable), TCL_STRING_KEYS);
     2664        for (meth = klass->methods; meth && meth->name; ++meth) {
     2665          int newEntry;
     2666          Tcl_HashEntry* hashentry = Tcl_CreateHashEntry(&(klass->hashtable), meth->name, &newEntry);
     2667          Tcl_SetHashValue(hashentry, (ClientData)meth->method);
     2668        }
     2669      }
     2670    }
     2671  }
     2672 
    26752673#ifdef __cplusplus
    26762674}
     
    26822680
    26832681SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
    2684   int i;
     2682  size_t i;
    26852683  if (interp == 0) return TCL_ERROR;
    26862684#ifdef USE_TCL_STUBS
     
    27192717 
    27202718  SWIG_Tcl_InstallConstants(interp, swig_constants);
     2719  SWIG_Tcl_InstallMethodLookupTables();
    27212720 
    27222721 
Note: See TracChangeset for help on using the changeset viewer.