Back to index

salome-paravis  6.5.0
vtkWrapIDL.c
Go to the documentation of this file.
00001 // PARAVIS : ParaView wrapper SALOME module
00002 //
00003 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00018 //
00019 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00020 //
00021 // File   : vtkWrapIDL.c
00022 // Author : Vladimir TURIN
00023 
00024 #include <stdio.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <ctype.h>
00028 #include "vtkParse.h"
00029 #include "vtkParseType.h"
00030 #include "vtkWrapIDL.h"
00031 #include "vtkWrap.h"
00032 
00033 char* Copyright[] = {
00034   "// Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,",
00035   "// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS",
00036   "//",
00037   "// This library is free software; you can redistribute it and/or",
00038   "// modify it under the terms of the GNU Lesser General Public",
00039   "// License as published by the Free Software Foundation; either",
00040   "// version 2.1 of the License.",
00041   "//",
00042   "// This library is distributed in the hope that it will be useful,",
00043   "// but WITHOUT ANY WARRANTY; without even the implied warranty of",
00044   "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU",
00045   "// Lesser General Public License for more details.",
00046   "//",
00047   "// You should have received a copy of the GNU Lesser General Public",
00048   "// License along with this library; if not, write to the Free Software",
00049   "// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA",
00050   "//",
00051   "// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com",
00052   ""
00053 };
00054 
00055 #define bs 12288
00056 
00057 int numberOfWrappedFunctions = 0;
00058 FunctionInfo *wrappedFunctions[1000];
00059 extern FunctionInfo *currentFunction;
00060 
00061 
00062 static void add_to_sig(char *sig, const char *add, int *i)
00063 {
00064   strcpy(&sig[*i],add);
00065   *i += (int)strlen(add);
00066 }
00067 
00068 int IsReturnArg(int I) {
00069   return (I == MAX_ARGS);
00070 }
00071 
00072 void AddReturnArg(char *Result, int *CurrPos) {
00073   add_to_sig(Result,"virtual ",CurrPos);
00074 }
00075 
00076 int IsIn(ValueInfo* Type) {
00077   return 1;
00078   //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 < 1 || (Type % VTK_PARSE_BASE_TYPE)/0x100 > 7);
00079 }
00080 
00081 void AddNotReturnArg(ValueInfo* Type, char *Result, int *CurrPos) {
00082 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00083   ;
00084 #else
00085   if(IsIn(Type))
00086     add_to_sig(Result,"in ",CurrPos);
00087   else
00088     add_to_sig(Result,"inout ",CurrPos);
00089 #endif
00090 }
00091 
00092 int IsFunction(ValueInfo* Type) {
00093   //return (Type == VTK_PARSE_FUNCTION);
00094   return vtkWrap_IsFunction(Type);
00095 }
00096 
00097 int IsConst(ValueInfo* Type) {
00098   //return ((Type % 0x2000) >= 0x1000);
00099   return vtkWrap_IsConst(Type);
00100 }
00101 
00102 void AddConst(char *Result, int *CurrPos) {
00103 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00104   add_to_sig(Result,"const ",CurrPos);
00105 #else
00106   add_to_sig(Result,"in ",CurrPos);
00107 #endif
00108 }
00109 
00110 
00111 int IsClass(ValueInfo* theType) {
00112   //return ((theType->Type % 0x10) == 0x9);
00113   return vtkWrap_IsObject(theType) || vtkWrap_IsVTKObject(theType);
00114 }
00115 
00116 int IsString(ValueInfo* Type) {
00117   //return (IsChar(Type) && IsArray(Type));
00118   //return (IsChar(Type) && IsPtr(Type));
00119   return vtkWrap_IsCharPointer(Type) || vtkWrap_IsString(Type) || (strcmp(Type->Class, "vtkStdString") == 0);
00120 }
00121 
00122 int IsPtr(ValueInfo* Type) {
00123   //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x1);
00124   return vtkWrap_IsPointer(Type) && (!IsString(Type)) && (!IsClass(Type));
00125 }
00126 
00127 int IsUnknown(ValueInfo* theType) {
00128   //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x8);
00129   return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_UNKNOWN;
00130 }
00131 
00132 void AddAtomArg(int I, ValueInfo* Type, char *TypeIDL, char *TypeCorba, char *Result, int *CurrPos) {
00133 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00134   add_to_sig(Result,"CORBA::",CurrPos);
00135   add_to_sig(Result,TypeCorba,CurrPos);
00136 
00137   if (!IsReturnArg(I) && !IsConst(Type) && !IsIn(Type))
00138     add_to_sig(Result,"&",CurrPos);
00139 #else
00140   add_to_sig(Result,TypeIDL,CurrPos);
00141 #endif
00142   add_to_sig(Result," ",CurrPos);
00143 }
00144 
00145 int IsArray(ValueInfo* Type) {
00146   //return ((Type % VTK_PARSE_BASE_TYPE)/0x100 == 0x3);
00147   return vtkWrap_IsArray(Type);
00148 }
00149 
00150 void AddArrayArg(int I, ValueInfo* Type, char *TypeIDL, char *Result, int *CurrPos) {
00151 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00152   if(!IsReturnArg(I) && !IsConst(Type))
00153     add_to_sig(Result, "const ",CurrPos);
00154 #endif
00155   add_to_sig(Result, TypeIDL,CurrPos);
00156   add_to_sig(Result, "_array",CurrPos);
00157 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00158   if(IsReturnArg(I)) {
00159     add_to_sig(Result, "*",CurrPos);
00160   } else {
00161     add_to_sig(Result, "&",CurrPos);
00162   }
00163 #else
00164 #endif
00165   add_to_sig(Result, " ",CurrPos);
00166 }
00167 
00168 int IsBoolean(ValueInfo* Type) {
00169   //return ((Type % 0x10) == 0xE);
00170   return vtkWrap_IsBool(Type);
00171 }
00172 
00173 void AddBooleanAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00174   AddAtomArg(I,Type,"boolean","Boolean",Result,CurrPos);
00175 }
00176 
00177 int IsChar(ValueInfo* theType) {
00178   //return ((Type % 0x10) == 0x3 || (Type % 0x10) == 0xD);
00179   int aBase = theType->Type & VTK_PARSE_BASE_TYPE;
00180   return (aBase == VTK_PARSE_CHAR) || (aBase == VTK_PARSE_UNSIGNED_CHAR) || (aBase == VTK_PARSE_SIGNED_CHAR);
00181 }
00182 
00183 int IsCharArray(ValueInfo* theType) {
00184   return (IsChar(theType) && IsArray(theType));
00185 }
00186 
00187 void AddCharAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00188   AddAtomArg(I,Type,"char","Char",Result,CurrPos);
00189 }
00190 
00191 void AddStringArg(int I, char *Result, int *CurrPos) {
00192 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00193   add_to_sig(Result,"char ",CurrPos);
00194 #else
00195   add_to_sig(Result,"string ",CurrPos);
00196 #endif
00197 }
00198 
00199 int IsFloat(ValueInfo* theType) {
00200   //return ((Type % 0x10) == 0x1);
00201   return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_FLOAT;
00202 }
00203 
00204 void AddFloatAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00205   AddAtomArg(I,Type,"float","Float",Result,CurrPos);
00206 }
00207 
00208 int IsFloatArray(ValueInfo* theType) {
00209   return (IsFloat(theType) && IsArray(theType));
00210 }
00211 
00212 void AddFloatArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00213   AddArrayArg(I,Type,"float",Result,CurrPos);
00214 }
00215 
00216 int IsDouble(ValueInfo* theType) {
00217   //return ((Type % 0x10) == 0x7);
00218   return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_DOUBLE;
00219 }
00220 
00221 void AddDoubleAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00222   AddAtomArg(I,Type,"double","Double",Result,CurrPos);
00223 }
00224 
00225 int IsDoubleArray(ValueInfo*  Type) {
00226   return (IsDouble(Type) && IsArray(Type));
00227 }
00228 
00229 void AddDoubleArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00230   AddArrayArg(I,Type,"double",Result,CurrPos);
00231 }
00232 
00233 int IsvtkIdType(ValueInfo* theType) {
00234   //return((Type % 0x10) == 0xA);
00235   return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_ID_TYPE;
00236 }
00237 
00238 int IsShort(ValueInfo* theType) {
00239   //return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA);
00240   int aVal = theType->Type & VTK_PARSE_BASE_TYPE;
00241   return (aVal == VTK_PARSE_SHORT) || (aVal == VTK_PARSE_INT) || 
00242     (aVal == VTK_PARSE_ID_TYPE) || (aVal == VTK_PARSE_UNSIGNED_INT) || (aVal == VTK_PARSE_UNSIGNED_SHORT) ||
00243     (aVal == VTK_PARSE_SSIZE_T) || (aVal == VTK_PARSE_SIZE_T);
00244 }
00245 
00246 void AddShortAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00247   AddAtomArg(I,Type,"short","Short",Result,CurrPos);
00248 }
00249 
00250 int IsShortArray(ValueInfo* Type) {
00251   return (IsShort(Type) && IsArray(Type));
00252 }
00253 
00254 void AddShortArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00255   AddArrayArg(I,Type,"short",Result,CurrPos);
00256 }
00257 
00258 int IsLong(ValueInfo* theType) {
00259   //return ((Type % 0x10) == 0x6 || (Type % 0x10) == 0xB || (Type % 0x10) == 0xC);
00260   unsigned int aVal = theType->Type & VTK_PARSE_BASE_TYPE;
00261   return (aVal == VTK_PARSE_LONG) || (aVal == VTK_PARSE_UNSIGNED_LONG) || 
00262     (aVal == VTK_PARSE___INT64) || (aVal == VTK_PARSE_UNSIGNED___INT64) || (aVal == VTK_PARSE_LONG_LONG) || 
00263     (aVal == VTK_PARSE_UNSIGNED_LONG_LONG);
00264 }
00265 
00266 void AddLongAtomArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00267   AddAtomArg(I,Type,"long","Long",Result,CurrPos);
00268 }
00269 
00270 int IsLongArray(ValueInfo* Type) {
00271   return (IsLong(Type) && IsArray(Type));
00272 }
00273 
00274 void AddLongArrayArg(int I, ValueInfo* Type, char *Result, int *CurrPos) {
00275   AddArrayArg(I,Type,"long",Result,CurrPos);
00276 }
00277 
00278 void AddClassArg(int I, ValueInfo* Type, const char *Class, char *Result, int *CurrPos) {
00279 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00280   add_to_sig(Result,"PARAVIS_Base",CurrPos);
00281   if(IsReturnArg(I) || IsConst(Type) || IsIn(Type)) {
00282     add_to_sig(Result,"_ptr",CurrPos);
00283   } else {
00284     add_to_sig(Result,"_ptr&",CurrPos);
00285   }
00286   add_to_sig(Result," ",CurrPos);
00287 #else
00288   add_to_sig(Result,"PARAVIS_Base ",CurrPos);
00289 #endif
00290 }
00291 
00292 int _IsVoid(ValueInfo* theType) {
00293   //return ((Type % 0x10) == 0x2);
00294   return (theType->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_VOID;
00295 }
00296 
00297 int IsVoid(ValueInfo* Type) {
00298   return (_IsVoid(Type) && (!IsPtr(Type)));
00299 }
00300 
00301 int IsUnsigned(ValueInfo* theType) {
00302   unsigned int aVal = theType->Type & VTK_PARSE_BASE_TYPE;
00303   switch (aVal) {
00304   case VTK_PARSE_UNSIGNED_CHAR:
00305   case VTK_PARSE_UNSIGNED_INT:
00306   case VTK_PARSE_UNSIGNED_SHORT:
00307   case VTK_PARSE_UNSIGNED_LONG:
00308   case VTK_PARSE_UNSIGNED_ID_TYPE:
00309   case VTK_PARSE_UNSIGNED_LONG_LONG:
00310   case VTK_PARSE_UNSIGNED___INT64:
00311   case VTK_PARSE_UNSIGNED_CHAR_PTR:
00312   case VTK_PARSE_UNSIGNED_INT_PTR:
00313   case VTK_PARSE_UNSIGNED_SHORT_PTR:
00314   case VTK_PARSE_UNSIGNED_LONG_PTR:
00315   case VTK_PARSE_UNSIGNED_ID_TYPE_PTR:
00316   case VTK_PARSE_UNSIGNED_LONG_LONG_PTR:
00317   case VTK_PARSE_UNSIGNED___INT64_PTR:
00318     return 1;
00319   }
00320   return 0;
00321 }
00322 
00323 void AddVoid(char *Result, int *CurrPos) {
00324   add_to_sig(Result,"void ",CurrPos);
00325 }
00326 
00327 int IsVoidPtr(ValueInfo* Type) {
00328   return (_IsVoid(Type) && (IsPtr(Type) || IsArray(Type)));
00329 }
00330 
00331 void AddVoidArg(int I, char *Result, int *CurrPos, ValueInfo* Type) {
00332 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00333   if(!IsReturnArg(I)) {
00334     if(!IsConst(Type))
00335       add_to_sig(Result,"const ",CurrPos);
00336     add_to_sig(Result,"CORBA::Any& ",CurrPos);
00337   } else {
00338     add_to_sig(Result,"CORBA::Any ",CurrPos);
00339   }
00340 #else
00341   add_to_sig(Result,"any ",CurrPos);
00342 #endif
00343 }
00344 
00345 void AddTypeArray(ValueInfo* Type, char *Result, int *CurrPos) {
00346   if(IsShort(Type))
00347     add_to_sig(Result,"short",CurrPos);
00348   if(IsLong(Type))
00349     add_to_sig(Result,"long",CurrPos);
00350   if(IsFloat(Type))
00351     add_to_sig(Result,"float",CurrPos);
00352   if(IsDouble(Type))
00353     add_to_sig(Result,"double",CurrPos);
00354   if(IsChar(Type))
00355     add_to_sig(Result,"char",CurrPos);
00356   add_to_sig(Result,"_array",CurrPos);
00357 }
00358 
00359 typedef struct _ReadFuncs
00360 {
00361   char* Name;
00362   char* Signature;
00363   int   EndPos;
00364   int   NumPos;
00365 } ReadFuncs;
00366 
00367 ReadFuncs readFunctions[1000];
00368 int numberOfReadFunctions = 0;
00369 
00370 static int class_has_new = 0;
00371 
00372 void output_type(char* result, int *currPos, int i, ValueInfo* aType, const char *Id)
00373 {
00374   if (vtkWrap_IsConst(aType))
00375     add_to_sig(result,"const ",currPos);
00376     
00377   if(IsFloat(aType)) {
00378     if(IsArray(aType)) {
00379       add_to_sig(result,"float",currPos);
00380     } else {
00381       add_to_sig(result,"CORBA::Float",currPos);
00382     }
00383   }
00384   
00385   if(IsDouble(aType)) {
00386     if(IsArray(aType)) {
00387       add_to_sig(result,"double",currPos);
00388     } else {
00389       add_to_sig(result,"CORBA::Double",currPos);
00390     }
00391   }
00392   
00393   if(IsShort(aType)) {
00394     if(IsArray(aType)) {
00395       if (IsUnsigned(aType))
00396         add_to_sig(result,"unsigned ",currPos);
00397       if(IsvtkIdType(aType)) {
00398         add_to_sig(result,"vtkIdType",currPos);
00399       } else {
00400         add_to_sig(result,"int",currPos);
00401       }
00402     } else {
00403       add_to_sig(result,"CORBA::Short",currPos);
00404     }
00405   }
00406   
00407   if(IsLong(aType)) {
00408     if(IsArray(aType)) {
00409       if (IsUnsigned(aType))
00410         add_to_sig(result,"unsigned ",currPos);
00411       add_to_sig(result,"long",currPos);
00412     } else {
00413       add_to_sig(result,"CORBA::Long",currPos);
00414     }
00415   }
00416   
00417   if(IsChar(aType)) {
00418     if(IsString(aType)) {
00419       if(IsReturnArg(i))
00420         add_to_sig(result,"const ",currPos);
00421       add_to_sig(result,"char",currPos);
00422     } else {
00423       add_to_sig(result,"CORBA::Char",currPos);      
00424     }
00425   }
00426   
00427   if(IsBoolean(aType)) {
00428     add_to_sig(result,"CORBA::Boolean",currPos);
00429   }
00430   
00431   if(IsVoidPtr(aType)) {
00432     add_to_sig(result,"void",currPos);
00433   }
00434   
00435   if(IsClass(aType)) {
00436     add_to_sig(result,"::",currPos);
00437     add_to_sig(result,Id,currPos);
00438   }
00439   
00440   if(IsArray(aType) || IsPtr(aType) || IsClass(aType) || IsString(aType)) {
00441     add_to_sig(result,"*",currPos);
00442   }
00443 }
00444 
00445 void output_typedef(char* result, int *currPos, int i, ValueInfo* aType, const char *Id)
00446 {
00447   add_to_sig(result,"  typedef ",currPos);
00448   output_type(result,currPos,i,aType,Id);
00449 }
00450 
00451 void output_temp(char* result, int *currPos, int i, ValueInfo* aType, const char *Id, int aCount)
00452 {
00453   static char buf[bs];
00454 
00455   /* handle VAR FUNCTIONS */
00456   if (IsFunction(aType)) {
00457     return;
00458   }
00459 
00460 #if defined(IDL_I_HH)
00461   if(IsReturnArg(i)) {
00462     AddReturnArg(result,currPos);
00463   }
00464 #endif
00465 
00466   if (IsReturnArg(i) && IsVoid(aType) && !IsVoidPtr(aType)) {
00467     AddVoid(result,currPos);
00468     return;
00469   }
00470 
00471   /* for const * return types prototype with const */
00472   if ( IsConst(aType) || IsString(aType)) {
00473     if(!IsReturnArg(i))     {
00474       AddConst(result,currPos);
00475     }
00476   } else {
00477     if(!IsReturnArg(i))     {
00478       AddNotReturnArg(aType,result,currPos);
00479     }
00480   }
00481 
00482   if(IsFloat(aType)) {
00483     if(IsFloatArray(aType)) {
00484       AddFloatArrayArg(i,aType,result,currPos);
00485     } else {
00486       AddFloatAtomArg(i,aType,result,currPos);
00487     }
00488   }
00489   
00490   if(IsDouble(aType)) {
00491     if(IsDoubleArray(aType)) {
00492       AddDoubleArrayArg(i,aType,result,currPos);
00493     } else {
00494       AddDoubleAtomArg(i,aType,result,currPos);
00495     }
00496   }
00497 
00498   if(IsShort(aType)) {
00499     if(IsShortArray(aType)) {
00500       AddShortArrayArg(i,aType,result,currPos);
00501     } else {
00502       AddShortAtomArg(i,aType,result,currPos);
00503     }
00504   }
00505 
00506   if(IsLong(aType)) {
00507     if(IsLongArray(aType)) {
00508       AddLongArrayArg(i,aType,result,currPos);
00509     } else {
00510       AddLongAtomArg(i,aType,result,currPos);
00511     }
00512   }
00513 
00514   if(IsChar(aType)) {
00515     if(IsString(aType)) {
00516       AddStringArg(i,result,currPos);
00517     } else {
00518       AddCharAtomArg(i,aType,result,currPos);
00519     }
00520   } else if (IsString(aType)) 
00521     AddStringArg(i,result,currPos);
00522 
00523   if(IsBoolean(aType)) {
00524     AddBooleanAtomArg(i,aType,result,currPos);
00525   }
00526 
00527   if(IsVoid(aType)) {
00528     AddVoidArg(i,result,currPos,aType);
00529   }
00530 
00531   if(IsClass(aType)) {
00532     AddClassArg(i,aType,Id,result,currPos);
00533   }
00534 
00535   if(IsUnknown(aType)) {
00536     return;
00537   }
00538 
00539   if(!IsClass(aType)) {
00540     if(IsPtr(aType)) {
00541       add_to_sig(result," *",currPos);
00542     }
00543 #if defined(IDL_I_HH) || defined(IDL_I_CC)
00544     if(IsString(aType) && !IsIn(aType) && !IsConst(aType) && !IsReturnArg(i)) {
00545       add_to_sig(result,"*&",currPos);
00546     } else {
00547       if(IsString(aType) || (IsReturnArg(i) && IsVoidPtr(aType))) {
00548         add_to_sig(result," *",currPos);
00549       }
00550     }
00551 #endif
00552   }
00553 
00554   if(!IsReturnArg(i)) {
00555     sprintf(buf,"temp%i",i);
00556     add_to_sig(result,buf,currPos);
00557   }
00558   
00559   return;
00560 }
00561 
00562 void read_class_functions(const char* name, const char* classname, FILE* fp)
00563 {
00564   int len=0;
00565   int curlen=0;
00566   int i, j;
00567   int flen=0;
00568   //int num=0;
00569   int ret_str=0;
00570   FILE *fin;
00571   char buf[bs];
00572   char buf1[bs];
00573   char fname[bs];
00574   static char sig[bs];
00575   static int slen=8;
00576 #if ! defined(IDL_I_CC)
00577   static int clen=15;
00578 #else
00579   static int clen=7;
00580 #endif
00581 
00582 
00583 #if defined(IDL_I_HH)
00584   sprintf(buf,"PARAVIS_Gen_%s_i.hh",name);
00585 #elif defined(IDL_I_CC)
00586   sprintf(buf,"PARAVIS_Gen_%s_i.cc",name);
00587 #else
00588   sprintf(buf,"PARAVIS_Gen_%s.idl",name);
00589 #endif
00590   if (!(fin = fopen(buf,"r"))) {
00591     fprintf(stderr,"Error opening input file %s\n",buf);
00592     exit(1);
00593   }
00594   while (fgets(sig,bs-1,fin) != 0) {
00595 #if defined(IDL_I_CC)
00596     if(strncmp("#include \"PARAVIS_Gen_vtk",sig,25)==0) {
00597       fprintf(fp, "%s",sig);
00598     }
00599     if(strncmp("#include <vtk",sig,13)==0) {
00600       fprintf(fp, "%s",sig);
00601     }
00602 #endif
00603 
00604 #if ! defined(IDL_I_CC)
00605     if(strncmp("        //C++: ",sig,clen)==0) {
00606 #else
00607     if(strncmp("//C++: ",sig,clen)==0) {
00608 #endif
00609 #if defined(IDL_I_CC)
00610       while(fgets(buf,bs-1,fin) != 0) {
00611        len=strlen(sig);
00612        strcpy(sig+len,buf);
00613        if(strlen(buf) == 3 && buf[0]=='/' && buf[1]=='/')
00614          break;
00615       }
00616 #endif
00617       len=strlen(sig);
00618       if(fgets(buf,bs-1,fin)!=NULL && strlen(buf) > 1) {
00619        ret_str=0;
00620 #if defined(IDL_I_HH)
00621        strcpy(sig+len,buf);
00622        readFunctions[numberOfReadFunctions].EndPos=strlen(sig);  
00623        sscanf(sig+len,"%s %s %s",buf,buf1,fname);
00624        if(fname[0] == '*') {
00625          ret_str=1;
00626        }
00627 #elif defined(IDL_I_CC)
00628        strcpy(buf1,buf);
00629        sscanf(buf1,"%s %s",buf,fname);
00630 
00631        curlen=strlen(sig);
00632        sprintf(sig+curlen,"%s ",buf);
00633        j=strlen(buf)+1;
00634 
00635        if(fname[0] == '*') {
00636          curlen=strlen(sig);
00637          sprintf(sig+curlen," *");
00638          j+=1;
00639        }
00640        curlen=strlen(sig);
00641        sprintf(sig+curlen,"%s_i::",classname);
00642 
00643        for(i = 0; i < strlen(fname)-1; i++) {
00644          ret_str+=1;
00645          j+=1;
00646          if(fname[i] == ':' && fname[i] == ':') {
00647            ret_str+=1;
00648            j+=1;
00649            break;
00650          }
00651        }
00652        curlen=strlen(sig);
00653        sprintf(sig+curlen,"%s", buf1+j);
00654 
00655        curlen=strlen(sig);
00656        readFunctions[numberOfReadFunctions].EndPos=curlen;  
00657        while (fgets(sig+curlen,bs-1-curlen,fin) != 0) {
00658          if(sig[curlen] == '}')
00659            break;
00660          curlen=strlen(sig);
00661        }
00662 #else
00663        strcpy(sig+len,buf);
00664        readFunctions[numberOfReadFunctions].EndPos=strlen(sig);  
00665        sscanf(sig+len,"%s _%s",buf,fname);
00666 #endif
00667        flen=strlen(fname);
00668        if(flen>0) {
00669          if(flen>2 && fname[flen-2]=='_') {
00670            flen-=2;
00671          }
00672          readFunctions[numberOfReadFunctions].Name = malloc((flen+1-ret_str)*sizeof(char));
00673          strncpy(readFunctions[numberOfReadFunctions].Name,fname+ret_str,flen-ret_str);
00674          readFunctions[numberOfReadFunctions].Name[flen-ret_str]='\0';
00675          
00676 #if defined(IDL_I_HH)
00677          len+=slen+strlen(buf)+1+strlen(buf1)+2+flen+ret_str-1; //spaces+virtual+space+return+space+space+*+name
00678 #elif defined(IDL_I_CC)
00679          len+=2+strlen(buf)+2+strlen(classname)+2+strlen(readFunctions[numberOfReadFunctions].Name)-1; //return+space+space+name
00680          if(fname[0] == '*') {
00681            len+=2;
00682          }
00683          if(fname[flen-2]=='_') {
00684            len+=2;
00685          }
00686 #else
00687          len+=slen+strlen(buf)+2+flen; //spaces+return+space+_+name
00688 #endif
00689          readFunctions[numberOfReadFunctions].NumPos=len;
00690          if(fname[flen]=='_') {
00691            readFunctions[numberOfReadFunctions].NumPos=len+2; //+_+num
00692          }
00693          
00694          len=strlen(sig);
00695          readFunctions[numberOfReadFunctions].Signature = malloc((len+1)*sizeof(char));
00696          strncpy(readFunctions[numberOfReadFunctions].Signature,sig,len);
00697          readFunctions[numberOfReadFunctions].Signature[len]='\0';
00698 
00699          numberOfReadFunctions++;
00700        }
00701       }
00702     }
00703   }
00704   fclose (fin);
00705   return;
00706 }
00707 
00708 void get_signature(const char* num, ClassInfo *data)
00709 {
00710   static char result[bs];
00711   int currPos = 0;
00712   int currPos_sig = 0;
00713   //int argtype;
00714   int i, j;
00715   static char buf[bs];
00716   static char buf1[bs];
00717   int ret = 0;
00718   int found = 0;
00719   int currPos_num = 0;
00720   ValueInfo* aRetVal = NULL;
00721   ValueInfo* aArgVal = NULL;
00722   char *cp;
00723 
00724   aRetVal = currentFunction->ReturnValue;
00725 
00726   add_to_sig(result,"\n",&currPos);
00727   if (currentFunction->Signature) {
00728 #if ! defined(IDL_I_CC)
00729     add_to_sig(result,"        ",&currPos);
00730 #endif
00731     add_to_sig(result,"//C++: ",&currPos);
00732     add_to_sig(result,currentFunction->Signature,&currPos);
00733     add_to_sig(result,"\n",&currPos);
00734   }
00735   
00736   if(IsClass(aRetVal) && ret == 0) {
00737     found = 0;
00738     for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) {
00739       if(strcmp(wrapped_classes[i],currentFunction->ReturnValue->Class) == 0)
00740         found = 1;
00741     }
00742     if(!found)
00743       ret = 1;
00744   }
00745   
00746   for (j = 0; j < currentFunction->NumberOfArguments; j++) {
00747     aArgVal = currentFunction->Arguments[j];
00748     if(IsFunction(aArgVal))
00749       ret == 1;
00750     if(IsClass(aArgVal) && ret == 0) {
00751       found = 0;
00752       for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) {
00753         if(strcmp(wrapped_classes[i],aArgVal->Class) == 0)
00754           found = 1;
00755       }
00756       if(!found)
00757         ret = 1;
00758     }
00759   }
00760   
00761   if (IsArray(aRetVal) && !IsClass(aRetVal) && !IsString(aRetVal) && currentFunction->HintSize == 0) {
00762     ret = 1;
00763   }
00764   
00765   if(ret) {
00766     add_to_sig(result,"//\n",&currPos);
00767     /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature,
00768       (size_t)(currPos+1));*/
00769     //strcpy((char*)currentFunction->Signature,result);
00770     cp = (char *)malloc(currPos+1);
00771     strcpy(cp, result);
00772     currentFunction->Signature = cp;
00773     return;
00774   }
00775 
00776 #if defined(IDL_I_CC)
00777   add_to_sig(result,"struct CreateEventName(",&currPos);
00778   add_to_sig(result,currentFunction->Name,&currPos);
00779   if( strlen(num)!=0 ) {
00780     add_to_sig(result,num,&currPos);
00781   }
00782   add_to_sig(result,")",&currPos);
00783   add_to_sig(result,": public SALOME_Event\n",&currPos);
00784   add_to_sig(result,"{\n",&currPos);
00785   if(!IsVoid(aRetVal)) {
00786     //output_typedef(result,&currPos,MAX_ARGS,aRetVal, currentFunction->ReturnValue->Class);
00787     add_to_sig(result,"  typedef ",&currPos);
00788     if (vtkWrap_IsConst(aRetVal))
00789       add_to_sig(result, " const ",&currPos);
00790     if (vtkWrap_IsObject(aRetVal))
00791       add_to_sig(result, " ::",&currPos);
00792     add_to_sig(result, aRetVal->Class,&currPos);
00793     if (vtkWrap_IsPointer(aRetVal) || vtkWrap_IsArray(aRetVal))
00794       add_to_sig(result, "*",&currPos);
00795     add_to_sig(result," TResult;\n",&currPos);
00796     add_to_sig(result,"  TResult myResult;\n",&currPos);
00797   }
00798   
00799   //output_typedef(result, &currPos, 0, 0x309, data->Name); //!!??
00800   add_to_sig(result,"  typedef ::",&currPos);
00801   add_to_sig(result,data->Name,&currPos);
00802   add_to_sig(result,"* TObj;\n",&currPos);
00803   add_to_sig(result,"  TObj myObj;\n",&currPos);
00804   
00805   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00806     aArgVal = currentFunction->Arguments[i];
00807     //output_typedef(result, &currPos, i, currentFunction->ArgTypes[i],
00808     //               currentFunction->ArgClasses[i]);
00809     output_typedef(result, &currPos, i, aArgVal, currentFunction->ArgClasses[i]);
00810     sprintf(buf," TParam%d;\n",i);
00811     add_to_sig(result,buf,&currPos);
00812     sprintf(buf,"  TParam%d myParam%d;\n",i,i);
00813     add_to_sig(result,buf,&currPos);
00814   }
00815     
00816   add_to_sig(result,"\n",&currPos);  
00817   add_to_sig(result,"  CreateEventName(",&currPos);  
00818   add_to_sig(result,currentFunction->Name,&currPos);
00819   if( strlen(num)!=0 ) {
00820     add_to_sig(result,num,&currPos);
00821   }
00822   add_to_sig(result,")",&currPos);
00823   add_to_sig(result,"(TObj theObj",&currPos);  
00824   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00825     sprintf(buf,", TParam%d theParam%d",i,i);
00826     add_to_sig(result,buf,&currPos);
00827   }
00828   add_to_sig(result,"):\n",&currPos);  
00829   add_to_sig(result,"  myObj(theObj)",&currPos);  
00830   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00831     sprintf(buf,", myParam%d(theParam%d)",i,i);
00832     add_to_sig(result,buf,&currPos);
00833   }
00834   add_to_sig(result,"\n",&currPos);  
00835   add_to_sig(result,"  { }\n",&currPos);  
00836   add_to_sig(result,"\n",&currPos);  
00837   add_to_sig(result,"  virtual void Execute()\n",&currPos);  
00838   add_to_sig(result,"  {\n",&currPos);  
00839   add_to_sig(result,"    ",&currPos);  
00840   if(!IsVoid(aRetVal)/* && !IsString(aRetVal)*/) {
00841     add_to_sig(result,"myResult = ",&currPos);  
00842   }
00843   //if(IsString(aRetVal)) {
00844   //add_to_sig(result,"const char* ret = ",&currPos);  
00845   //}
00846   add_to_sig(result,"myObj->",&currPos);  
00847   add_to_sig(result,currentFunction->Name,&currPos);  
00848   add_to_sig(result,"(",&currPos);  
00849   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00850     aArgVal = currentFunction->Arguments[i];
00851     if(i!=0)
00852       add_to_sig(result,", ",&currPos);  
00853     if(IsClass(aArgVal) && IsPtr(aArgVal)) {
00854       add_to_sig(result,"*",&currPos);  
00855     }
00856     if (IsString(aArgVal) && IsConst(aArgVal))
00857       sprintf(buf,"checkNullStr(myParam%d)",i);
00858     else
00859       sprintf(buf,"myParam%d",i);
00860     add_to_sig(result,buf,&currPos);
00861   }
00862   add_to_sig(result,");\n",&currPos);  
00863   //if(IsString(aRetVal)) {
00864   //add_to_sig(result,"    myResult = (ret==NULL)?NULL:CORBA::string_dup(\"\");\n",&currPos);  
00865   //}
00866   add_to_sig(result,"  }\n",&currPos);  
00867   
00868   add_to_sig(result,"};\n",&currPos);  
00869   add_to_sig(result,"//\n",&currPos);  
00870 #endif
00871   currPos_sig=currPos;
00872   
00873 #if ! defined(IDL_I_CC)
00874   add_to_sig(result,"        ",&currPos);
00875 #endif
00876 
00877   output_temp(result,&currPos,MAX_ARGS,aRetVal,
00878               currentFunction->ReturnValue->Class,0);
00879 
00880 #if defined(IDL_I_CC)
00881   add_to_sig(result,data->Name,&currPos);
00882   add_to_sig(result,"_i::",&currPos);
00883 #endif
00884 #if ! defined(IDL_I_HH) && ! defined(IDL_I_CC)
00885   add_to_sig(result,"_",&currPos);
00886 #endif
00887   add_to_sig(result,currentFunction->Name,&currPos);
00888 
00889   if( strlen(num)!=0 ) {
00890     add_to_sig(result,num,&currPos);
00891   }
00892   currPos_num=currPos;
00893   add_to_sig(result," ",&currPos);
00894 
00895   /* print the arg list */
00896   add_to_sig(result,"(",&currPos);
00897 
00898   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00899     aArgVal = currentFunction->Arguments[i];
00900     if( i != 0 ) {
00901       add_to_sig(result,", ",&currPos);     
00902     }
00903     /*    output_temp(result, &currPos, i, currentFunction->ArgTypes[i],
00904                 (char*)currentFunction->ArgClasses[i],
00905                 currentFunction->ArgCounts[i]);*/
00906     output_temp(result, &currPos, i, aArgVal,  aArgVal->Class, currentFunction->NumberOfArguments);
00907   }
00908 
00909   add_to_sig(result,")",&currPos);
00910 #if defined(IDL_I_CC)
00911   add_to_sig(result," {\n",&currPos);
00912   add_to_sig(result,"  try {\n",&currPos);
00913   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
00914     aArgVal = currentFunction->Arguments[i];
00915     if(IsClass(aArgVal)) {
00916       sprintf(buf,"    PARAVIS_Base_i* i_temp%d = GET_SERVANT(temp%d);\n",i,i);
00917       add_to_sig(result,buf,&currPos);
00918     }
00919     
00920     if(IsArray(aArgVal) && !IsString(aArgVal) && !IsClass(aArgVal) && !IsVoid(aArgVal) ) {
00921       sprintf(buf,"    CORBA::ULong j_temp%d;\n",i);
00922       add_to_sig(result,buf,&currPos);
00923       sprintf(buf,"    CORBA::ULong l_temp%d = temp%d.length();\n",i,i);
00924       add_to_sig(result,buf,&currPos);
00925       add_to_sig(result,"    ",&currPos);       
00926       
00927       if(IsFloat(aArgVal))
00928         add_to_sig(result,"float",&currPos);
00929       
00930       if(IsDouble(aArgVal))
00931         add_to_sig(result,"double",&currPos);
00932       
00933       if(IsvtkIdType(aArgVal)) {
00934         if (IsUnsigned(aArgVal))
00935           add_to_sig(result,"unsigned ",&currPos);
00936         add_to_sig(result,"vtkIdType",&currPos);
00937       } else {
00938         if(IsShort(aArgVal)) {
00939           if (IsUnsigned(aArgVal))
00940             add_to_sig(result,"unsigned ",&currPos);
00941           add_to_sig(result,"int",&currPos);
00942         }
00943       }
00944       
00945       if(IsLong(aArgVal)) {
00946         if (IsUnsigned(aArgVal))
00947           add_to_sig(result,"unsigned ",&currPos);
00948         add_to_sig(result,"long",&currPos);
00949       }
00950       sprintf(buf,"* a_temp%d = new ",i);
00951       add_to_sig(result,buf,&currPos);
00952       
00953       if(IsFloat(aArgVal))
00954         add_to_sig(result,"float",&currPos);
00955       
00956       if(IsDouble(aArgVal))
00957         add_to_sig(result,"double",&currPos);
00958       
00959       if(IsvtkIdType(aArgVal)) {
00960         if (IsUnsigned(aArgVal))
00961           add_to_sig(result,"unsigned ",&currPos);
00962         add_to_sig(result,"vtkIdType",&currPos);
00963       } else {
00964         if(IsShort(aArgVal)) {
00965           if (IsUnsigned(aArgVal))
00966             add_to_sig(result,"unsigned ",&currPos);
00967           add_to_sig(result,"int",&currPos);
00968         }
00969       }
00970       
00971       if(IsLong(aArgVal)) {
00972         if (IsUnsigned(aArgVal))
00973           add_to_sig(result,"unsigned ",&currPos);
00974         add_to_sig(result,"long",&currPos);
00975       }
00976       
00977       sprintf(buf,"[l_temp%d];\n",i);
00978       add_to_sig(result,buf,&currPos);
00979       
00980       sprintf(buf,"    for(j_temp%d=0;j_temp%d<l_temp%d;j_temp%d++) {\n",i,i,i,i);
00981       add_to_sig(result,buf,&currPos);
00982       
00983       sprintf(buf,"      a_temp%d[j_temp%d]=temp%d[j_temp%d];\n",i,i,i,i);
00984       add_to_sig(result,buf,&currPos);
00985       
00986       add_to_sig(result,"    }\n",&currPos);
00987     }
00988 
00989     if(IsString(aArgVal)) {
00990       sprintf(buf,"    char *c_temp%d = CORBA::string_dup(temp%d);\n",i,i);
00991       add_to_sig(result,buf,&currPos);
00992     }
00993 
00994     if(IsVoid(aArgVal)) {
00995       sprintf(buf,"    long v_temp%d;\n",i);
00996       add_to_sig(result,buf,&currPos);
00997       
00998       sprintf(buf,"    temp%d.operator>>=(v_temp%d);\n",i,i);
00999       add_to_sig(result,buf,&currPos);
01000     }
01001   }  
01002   add_to_sig(result,"    ",&currPos);
01003 
01004   if(IsArray(aRetVal) && !IsClass(aRetVal) && !IsString(aRetVal)) {
01005     add_to_sig(result,"CORBA::ULong i_ret;\n",&currPos); 
01006     add_to_sig(result,"    PARAVIS::",&currPos); 
01007     AddTypeArray(aRetVal,result,&currPos);
01008     add_to_sig(result,"_var s_ret = new ",&currPos);
01009     AddTypeArray(aRetVal,result,&currPos);
01010     add_to_sig(result,"();\n",&currPos);
01011     sprintf(buf,"    s_ret->length(%d);\n",currentFunction->HintSize);
01012     add_to_sig(result,buf,&currPos);
01013     add_to_sig(result,"    ",&currPos); 
01014   }
01015   
01016   if(IsFloat(aRetVal)) {
01017     if(IsArray(aRetVal)) {
01018       add_to_sig(result,"float* a_ret = ",&currPos);
01019     } else {
01020       add_to_sig(result,"CORBA::Float ret = ",&currPos);
01021     }
01022   }
01023   
01024   if(IsDouble(aRetVal)) {
01025     if(IsArray(aRetVal)) {
01026       add_to_sig(result,"double* a_ret = ",&currPos);
01027     } else {
01028       add_to_sig(result,"CORBA::Double ret = ",&currPos);
01029     }
01030   }
01031   
01032   if(IsShort(aRetVal)) {
01033     if(IsArray(aRetVal)) {
01034       if(IsvtkIdType(aRetVal)) {
01035         add_to_sig(result,"vtkIdType",&currPos);
01036       } else {
01037         add_to_sig(result,"int",&currPos);
01038       }
01039       add_to_sig(result,"* a_ret = ",&currPos);
01040     } else {
01041       add_to_sig(result,"CORBA::Short ret = ",&currPos);
01042     }
01043   }
01044   
01045   if(IsLong(aRetVal)) {
01046     if(IsArray(aRetVal)) {
01047       add_to_sig(result,"long* a_ret = ",&currPos);
01048     } else {
01049       add_to_sig(result,"CORBA::Long ret = ",&currPos);
01050     }
01051   }
01052   
01053   //if(IsChar(aRetVal)) {
01054     if(IsString(aRetVal)) {
01055       add_to_sig(result,"char * ret = CORBA::string_dup(\"\");\n",&currPos);
01056       add_to_sig(result,"    const char * cret = ",&currPos);
01057     } else if (IsChar(aRetVal)) { 
01058       add_to_sig(result,"CORBA::Char ret = ",&currPos);     
01059     }
01060     //}
01061 
01062   if(IsBoolean(aRetVal)) {
01063     add_to_sig(result,"CORBA::Boolean ret = ",&currPos);
01064   }
01065   
01066   if(IsVoidPtr(aRetVal)) {
01067     add_to_sig(result,"void * v_ret = ",&currPos);
01068   }
01069   
01070   if(IsClass(aRetVal)) {
01071     add_to_sig(result,"::",&currPos);
01072     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);
01073     add_to_sig(result,"* a",&currPos);
01074     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);
01075     add_to_sig(result," = ",&currPos);
01076   }
01077   if(IsVoid(aRetVal)) {
01078     add_to_sig(result,"if(getVTKObject() != NULL) ProcessVoidEvent",&currPos);
01079   } else {
01080     add_to_sig(result,"(getVTKObject() != NULL) ? ProcessEvent",&currPos);
01081   }
01082   add_to_sig(result,"(\n",&currPos);
01083   add_to_sig(result,"      new CreateEventName(",&currPos);
01084   add_to_sig(result,currentFunction->Name,&currPos);
01085   if( strlen(num)!=0 ) {
01086     add_to_sig(result,num,&currPos);
01087   }
01088   add_to_sig(result,")",&currPos);
01089   
01090   add_to_sig(result,"((::",&currPos);
01091   add_to_sig(result,data->Name,&currPos);       
01092   add_to_sig(result,"*)",&currPos);
01093   add_to_sig(result,"getVTKObject()\n",&currPos);
01094   
01095   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
01096     aArgVal = currentFunction->Arguments[i];
01097     add_to_sig(result,"      , ",&currPos);
01098     
01099     //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) {
01100     //add_to_sig(result,"*(",&currPos);
01101     //}
01102     
01103     if(IsClass(aArgVal)) {
01104       //sprintf(buf,"(i_temp%d != NULL)?dynamic_cast< ::%s*>(i_temp%d->getVTKObject()):NULL",i,currentFunction->ArgClasses[i],i);
01105       sprintf(buf,"(i_temp%d != NULL)?dynamic_cast< ::%s*>(i_temp%d->getVTKObject()):NULL",i,aArgVal->Class,i);
01106     } else {
01107       if(IsArray(aArgVal) && !IsString(aArgVal) && !IsVoid(aArgVal)) {
01108         sprintf(buf,"a_temp%d",i);
01109       } else {
01110         if(IsVoidPtr(aArgVal)) {
01111           sprintf(buf,"(void*)v_temp%d",i);
01112         } else {
01113           if(IsString(aArgVal)) {
01114             sprintf(buf,"c_temp%d",i);
01115           } else {
01116             sprintf(buf,"temp%d",i);
01117           }
01118         }
01119       }
01120     }
01121     
01122     add_to_sig(result,buf,&currPos);
01123     //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) {
01124     //add_to_sig(result,")",&currPos);
01125     //}
01126     add_to_sig(result,"\n",&currPos);
01127   }
01128   
01129   add_to_sig(result,"      )\n",&currPos);             
01130   add_to_sig(result,"    )",&currPos);
01131   if(!IsVoid(aRetVal)) {
01132     add_to_sig(result,":",&currPos);
01133     if(IsClass(aRetVal) || IsString(aRetVal) || IsPtr(aRetVal) || IsArray(aRetVal))
01134       add_to_sig(result,"NULL",&currPos);
01135     else
01136       add_to_sig(result,"0",&currPos);
01137   }
01138   add_to_sig(result,";\n",&currPos);
01139   if(IsString(aRetVal)) {
01140     add_to_sig(result,"    if(cret!=NULL) ret=CORBA::string_dup(cret);\n",&currPos);
01141   }
01142   
01143   if(IsClass(aRetVal)) {
01144     add_to_sig(result,"    if(a",&currPos);
01145     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);        
01146     add_to_sig(result," == NULL) {\n",&currPos);
01147     add_to_sig(result,"      return PARAVIS::",&currPos);            
01148     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);        
01149     add_to_sig(result,"::_nil();\n",&currPos);         
01150     add_to_sig(result,"    }\n",&currPos);             
01151     add_to_sig(result,"    ",&currPos);         
01152     add_to_sig(result,"PARAVIS_Base_i* aPtr = ::CreateInstance(a",&currPos);       
01153     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);        
01154     add_to_sig(result,", a",&currPos);          
01155     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);        
01156     add_to_sig(result,"->GetClassName());\n",&currPos);
01157     add_to_sig(result,"    aPtr->Init(a",&currPos);           
01158     add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);        
01159     add_to_sig(result,");\n",&currPos);         
01160   }
01161     
01162   for (i = 0; i < currentFunction->NumberOfArguments; i++) {
01163     aArgVal = currentFunction->Arguments[i];
01164     if(IsArray(aArgVal) && !IsVoid(aArgVal) && !IsString(aArgVal) && !IsClass(aArgVal)) {
01165       if (!IsIn(aArgVal)) {
01166         sprintf(buf,"    for(j_temp%d=0;j_temp%d<l_temp%d;j_temp%d++) {\n",i,i,i,i);
01167         add_to_sig(result,buf,&currPos);
01168         
01169         sprintf(buf,"      temp%d[j_temp%d]=a_temp%d[j_temp%d];\n",i,i,i,i);
01170         add_to_sig(result,buf,&currPos);
01171         
01172         add_to_sig(result,"    }\n",&currPos);
01173       }
01174       sprintf(buf,"    delete [] a_temp%d;\n",i);
01175       add_to_sig(result,buf,&currPos);
01176     }
01177   }
01178 
01179   if (IsVoid(aRetVal) && !IsVoidPtr(aRetVal)) {
01180     add_to_sig(result,"    return;\n",&currPos); 
01181   } else {
01182     if(IsClass(aRetVal)) {
01183       add_to_sig(result,"    return aPtr->_this();\n",&currPos);
01184     } else {
01185       if(IsVoid(aRetVal)) {
01186         add_to_sig(result,"    CORBA::Any* ret = new CORBA::Any;\n",&currPos);
01187         add_to_sig(result,"    (*ret) <<= v_ret;\n",&currPos);
01188         add_to_sig(result,"    return ret;\n",&currPos); 
01189       } else {
01190         if(IsArray(aRetVal) && !IsString(aRetVal)) {
01191           sprintf(buf,"    for(i_ret=0; i_ret<%d; i_ret++) {\n",currentFunction->HintSize);
01192           add_to_sig(result,buf,&currPos); 
01193           add_to_sig(result,"      s_ret[i_ret]=a_ret[i_ret];\n",&currPos); 
01194           add_to_sig(result,"    }\n",&currPos); 
01195           add_to_sig(result,"    return s_ret._retn();\n",&currPos); 
01196         } else {
01197           add_to_sig(result,"    return ret;\n",&currPos); 
01198         }
01199       }
01200     }
01201   }
01202 
01203   add_to_sig(result,"  } catch(...) {\n",&currPos);
01204   add_to_sig(result,"    MESSAGE(\"",&currPos);
01205   //add_to_sig(result,data->ClassName,&currPos);       
01206   //add_to_sig(result,"::",&currPos);
01207   add_to_sig(result,currentFunction->Name,&currPos);          
01208   add_to_sig(result," - Unknown exception was occured!!!\");\n",&currPos);
01209 
01210   if (IsVoid(aRetVal)&& !IsVoidPtr(aRetVal)) {
01211     add_to_sig(result,"    return;\n",&currPos);
01212   } else{
01213     if(IsString(aRetVal)) {
01214       add_to_sig(result,"    return CORBA::string_dup(\"\");\n",&currPos);
01215     } else {
01216       if(IsClass(aRetVal)) {
01217         add_to_sig(result,"    return PARAVIS::",&currPos);
01218         add_to_sig(result,currentFunction->ReturnValue->Class,&currPos);
01219         add_to_sig(result,"::_nil();\n",&currPos);
01220       } else {
01221         if(IsArray(aRetVal) && !IsVoid(aRetVal)) {
01222           add_to_sig(result,"    PARAVIS::",&currPos);
01223           AddTypeArray(aRetVal,result,&currPos);
01224           add_to_sig(result,"_var s_ret = new ",&currPos);
01225           AddTypeArray(aRetVal,result,&currPos);
01226           add_to_sig(result,"();\n",&currPos);
01227           sprintf(buf,"    s_ret->length(%d);\n",currentFunction->HintSize);
01228           add_to_sig(result,buf,&currPos);
01229           add_to_sig(result,"    return s_ret._retn();\n",&currPos);
01230         } else {
01231           add_to_sig(result,"    return 0;\n",&currPos);
01232         }
01233       }
01234     }
01235   }
01236 
01237   add_to_sig(result,"  }\n",&currPos);
01238   add_to_sig(result,"}\n",&currPos);
01239 #else
01240   add_to_sig(result,";\n",&currPos);
01241 #endif
01242 
01243   if(ret)
01244     {
01245       result[currPos_sig]='\0';
01246       /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature,
01247         (size_t)(currPos_sig+1));*/
01248       cp = (char *)malloc(currPos_sig+1);
01249       strcpy(cp, result);
01250       currentFunction->Signature = cp;
01251       //strcpy((char*)currentFunction->Signature,result);
01252 
01253       return;
01254     }
01255 
01256   //if(strcmp(currentFunction->Name,"NewInstance") == 0) {
01257   //currentFunction->Signature[0]='\0';
01258   //return;
01259   //}
01260 
01261   for(i = 0; i < numberOfReadFunctions; i++) {
01262     if(strcmp(readFunctions[i].Name,currentFunction->Name) == 0) {
01263       j=readFunctions[i].EndPos-readFunctions[i].NumPos;
01264       strncpy(buf,result+currPos_num,j);
01265       strncpy(buf1,readFunctions[i].Signature+readFunctions[i].NumPos,j);
01266       buf[j]=0;
01267       buf1[j]=0;
01268       if(strcmp(buf,buf1) == 0) {
01269         ((char*)currentFunction->Signature)[0]='\0';
01270         return;
01271       }
01272     }
01273   }
01274   /*currentFunction->Signature = (const char*)realloc((void*)currentFunction->Signature,
01275     (size_t)(currPos+1));*/
01276   //strcpy((char*)currentFunction->Signature, result);
01277   cp = (char *)malloc(currPos+1);
01278   strcpy(cp, result);
01279   currentFunction->Signature = cp;
01280 }
01281 
01282 void outputFunction2(FILE *fp, ClassInfo *data)
01283 {
01284   int i, j, k, is_vtkobject, fnum, backnum;//, is_static, occ, goto_used;
01285   //int all_legacy;
01286   FunctionInfo *theFunc;
01287   FunctionInfo *backFunc;
01288   const char *theName;
01289   unsigned int theType;
01290   const char *backName;
01291   int backType;
01292   char static num[8];
01293   //int isSMObject = 0;
01294   int found = 0;
01295   ValueInfo* aArgVal = 0;
01296   ValueInfo* aBackArgVal = 0;
01297 
01298 
01299 #if defined(IDL_I_HH)
01300   fprintf(fp,"#include \"SALOMEconfig.h\"\n");
01301   fprintf(fp,"#include CORBA_SERVER_HEADER(PARAVIS_Gen_%s)\n",data->Name);
01302   fprintf(fp,"\n");
01303   fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n");
01304   fprintf(fp,"#include \"PARAVIS_Gen_i.hh\"\n");
01305   fprintf(fp,"#include \"PARAVIS_Gen_Types.hh\"\n");
01306   fprintf(fp,"#include \"vtkSmartPointer.h\"\n");
01307   fprintf(fp,"#include \"SALOME_Event.h\"\n");
01308 
01309   for(i=0;i<data->NumberOfSuperClasses;i++)
01310   {
01311     fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->SuperClasses[i]);
01312   }
01313 
01314   fprintf(fp,"\nclass %s;\n",data->Name);
01315   fprintf(fp,"\nnamespace PARAVIS\n{\n\n");
01316 #elif defined(IDL_I_CC)
01317   fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n");
01318   fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->Name);
01319   fprintf(fp,"#include \"PV_Tools.h\"\n");
01320   fprintf(fp,"#include \"SALOME_Event.h\"\n");
01321   fprintf(fp,"#include <%s.h>\n",data->Name);
01322 #else
01323   fprintf(fp,"#include \"PARAVIS_Gen.idl\"\n");
01324   fprintf(fp,"#include \"PARAVIS_Gen_Types.idl\"\n");
01325 
01326   for(i=0;i<data->NumberOfSuperClasses;i++)
01327   {
01328     fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",data->SuperClasses[i]);
01329   }
01330 
01331   fprintf(fp,"\nmodule PARAVIS\n{\n\n");
01332 #endif
01333 
01334   is_vtkobject = ((strcmp(data->Name,"vtkObjectBase") == 0) || 
01335                   (data->NumberOfSuperClasses != 0));
01336 
01337   for(i = 0; i < data->NumberOfSuperClasses; i++) {
01338     read_class_functions(data->SuperClasses[i],data->Name,fp);
01339   }
01340 
01341   /* create a idl signature for each method */
01342   for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
01343     {
01344       theFunc = wrappedFunctions[fnum];
01345       currentFunction = theFunc;
01346       //printf("#### %i)Function %s\n", fnum, theFunc->Name);
01347       
01348       /* names of idl methods should be unique */
01349       num[0]='\0';
01350       j=-1;
01351       for (i = 0; i < numberOfReadFunctions; i++) {
01352         if(strcmp(currentFunction->Name,readFunctions[i].Name) == 0)
01353           j++;
01354       }
01355       for (i = 0; i < fnum; i++)
01356         {
01357           if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) ==  0 )
01358             j++;
01359         }
01360       
01361       if(j<0) {
01362         for (i = fnum+1; i < numberOfWrappedFunctions; i++) {
01363           if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) ==  0 ) {
01364             j=0;
01365             break;
01366           }
01367         }
01368       } else {
01369         j++;
01370       }
01371       
01372       if(j>=0)
01373         {
01374           sprintf(num,"_%d",j);
01375         }
01376       
01377       get_signature(num,data);
01378     }
01379   /* create external type declarations for all object
01380      return types */
01381   for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
01382     {
01383       theFunc = wrappedFunctions[fnum];
01384       currentFunction = theFunc;
01385       theName = NULL;
01386       theType = 0;
01387       
01388       for (i = theFunc->NumberOfArguments; i >= 0; i--)
01389         {
01390           if (i==0)/* return type */
01391             {
01392               aArgVal = theFunc->ReturnValue;
01393               //theType = theFunc->ReturnType;
01394               //theName = (char*)theFunc->ReturnClass;
01395             }
01396           else /* arg type */
01397             {
01398               aArgVal = theFunc->Arguments[i-1];
01399               //theType = theFunc->ArgTypes[i-1];
01400               //theName = (char*)theFunc->ArgClasses[i-1];
01401             }
01402           theType = aArgVal->Type & VTK_PARSE_BASE_TYPE;
01403           theName = aArgVal->Class;
01404           /* check for object types */
01405           /*if ((theType & VTK_PARSE_BASE_TYPE == 0x309)||
01406             (theType & VTK_PARSE_BASE_TYPE == 0x109))*/
01407           if ((theType == VTK_PARSE_OBJECT) || (theType == VTK_PARSE_OBJECT_REF))
01408             {
01409               /* check that we haven't done this type (no duplicate declarations) */
01410               for (backnum = fnum; backnum >= 0; backnum--) 
01411                 {
01412                   backFunc = wrappedFunctions[backnum];
01413                   backName = NULL;
01414                   backType = 0;
01415                   if (backnum == fnum)
01416                     k = i+1;
01417                   else
01418                     k = 0;
01419                   for (j = backFunc->NumberOfArguments; j >= k; j--)
01420                     {
01421                       if (j==0) /* return type */
01422                         {
01423                           aBackArgVal = backFunc->ReturnValue;
01424                           //backType = backFunc->ReturnType;
01425                           //backName = (char*)backFunc->ReturnClass;
01426                         }
01427                       else /* arg type */
01428                         {
01429                           aBackArgVal = backFunc->Arguments[j-1];
01430                           //backType = backFunc->ArgTypes[j-1];
01431                           //backName = (char*)backFunc->ArgClasses[j-1];
01432                         }
01433                       backType = aBackArgVal->Type & VTK_PARSE_BASE_TYPE;
01434                       backName = aBackArgVal->Class;
01435                       /*if (((backType % VTK_PARSE_BASE_TYPE == 0x309)||
01436                         (backType % VTK_PARSE_BASE_TYPE == 0x109)))*/
01437                       if ((backType == VTK_PARSE_OBJECT) || (backType == VTK_PARSE_OBJECT_REF))
01438                        {
01439                           if(strcmp(theName,backName) == 0)
01440                             {
01441                               break;
01442                             }
01443                         }
01444                     }
01445                   if (j >= k)
01446                     {
01447                       break;
01448                     }
01449                 }
01450               if (backnum < 0 && strcmp(data->Name,theName) != 0)
01451                 {
01452                   found = 0;
01453                   for(j = 0; strcmp(wrapped_classes[j],"") != 0 && found == 0; j++)
01454                     {
01455                       if(strcmp(wrapped_classes[j],theName) == 0)
01456                         found = 1;
01457                     }
01458                   if(found)
01459                     {
01460 #if defined(IDL_I_HH)
01461                       fprintf(fp,"    class %s_i;\n",theName);
01462 #elif defined(IDL_I_CC)
01463                       fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",theName);
01464                       fprintf(fp,"#include <%s.h>\n",theName);
01465 #else
01466                       //fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",theName);
01467                       fprintf(fp,"    interface %s;\n",theName);
01468 #endif
01469                     }
01470                 }
01471             }
01472         }
01473     }
01474   
01475   //fprintf(fp,"\nmodule PARAVIS\n{\n");
01476 #if defined(IDL_I_HH)
01477   fprintf(fp,"\n    class %s_i : public virtual POA_PARAVIS::%s, public virtual PARAVIS::PARAVIS_Base_i",data->Name,data->Name);
01478   //for(i = 0; i < data->NumberOfSuperClasses; i++) {
01479   //  fprintf(fp,", public virtual %s_i",data->SuperClasses[i]);
01480   //}
01481   //fprintf(fp,", public virtual SALOME::GenericObj_i");
01482   fprintf(fp," {");
01483   fprintf(fp,"\n    public:\n");
01484   fprintf(fp,"\n        %s_i();\n",data->Name);
01485   if(strcmp(data->Name,"vtkSMSessionProxyManager") != 0) {
01486     fprintf(fp,"\n        ::vtkObjectBase* GetNew();\n");
01487   }
01488 
01489 #elif defined(IDL_I_CC)
01490   fprintf(fp,"extern PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString&);\n");
01491   fprintf(fp,"\nnamespace PARAVIS\n{\n");
01492   fprintf(fp,"typedef %s_i current_interface;\n",data->Name);
01493   fprintf(fp,"#define CreateEventName(Function) Event%s ##Function\n",data->Name);
01494   fprintf(fp,"%s_i::%s_i() {\n",data->Name,data->Name);
01495   //fprintf(fp,"    Init(::%s::New());\n",data->Name);
01496   fprintf(fp,"}\n");
01497   fprintf(fp,"\n");
01498   
01499   if(strcmp(data->Name,"vtkSMSessionProxyManager") != 0) {
01500     fprintf(fp,"::vtkObjectBase* %s_i::GetNew() {\n", data->Name);
01501     if(strcmp(data->Name,"vtkSMProxyManager") == 0) {
01502       fprintf(fp,"  return ::%s::GetProxyManager();\n",data->Name);
01503     } else {
01504       fprintf(fp,"  return ::%s::New();\n",data->Name);
01505     }
01506     fprintf(fp,"}\n");
01507   }
01508 #else
01509   fprintf(fp,"\n    interface %s : PARAVIS_Base",data->Name);
01510   fprintf(fp,"\n    {\n");
01511 #endif
01512 
01513   for(i = 0; i < numberOfReadFunctions; i++) {
01514     fprintf(fp, "%s\n", readFunctions[i].Signature);
01515   }
01516 
01517   for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++) {
01518     fprintf(fp,"%s\n",wrappedFunctions[fnum]->Signature);
01519   }
01520 
01521 #if defined(IDL_I_HH)
01522   fprintf(fp,"    };\n");
01523   fprintf(fp,"}\n");
01524 #elif defined(IDL_I_CC)
01525   fprintf(fp,"};\n");
01526 #else
01527   fprintf(fp,"    };\n");
01528   fprintf(fp,"};\n");
01529 #endif
01530 
01531   return;
01532 }
01533 
01534 void outputFunction(FILE *fp, ClassInfo *data)
01535 {
01536   int i;
01537   //int args_ok = 1;
01538   ValueInfo* aRetVal = NULL;//currentFunction->ReturnValue;
01539   ValueInfo* aArgVal = NULL;
01540   unsigned int aType;
01541   unsigned int argtype;
01542 
01543   fp = fp;
01544   /* some functions will not get wrapped no matter what else,
01545      and some really common functions will appear only in vtkObjectPython */
01546   if (currentFunction->IsOperator || 
01547       currentFunction->ArrayFailure ||
01548       !currentFunction->IsPublic ||
01549       !currentFunction->Name)
01550     {
01551       return;
01552     }
01553   //printf("#### Check %s\n", currentFunction->Name);
01554  
01555   /* check to see if we can handle the args */
01556   for (i = 0; i < currentFunction->NumberOfArguments; i++)
01557     {
01558       aArgVal = currentFunction->Arguments[i];
01559       /*printf("  Argument: %s ", vtkWrap_GetTypeName(aArgVal));
01560       if (vtkWrap_IsArray(aArgVal)) {
01561         printf("!!!! Argument %i is array\n", i);
01562         return;
01563         }*/
01564       if (vtkWrap_IsStream(aArgVal)) {
01565         //printf("!!!! Argument %i is stream\n", i);
01566         return;
01567       }
01568       if (IsPtr(aArgVal)) {
01569         //printf("!!!! Argument %i is pointer value\n", i);
01570         return;
01571       }
01572       if (IsUnknown(aArgVal)) {
01573         //printf("!!!! Argument %i is unknown value\n", i);
01574        return;
01575       }
01576       if (vtkWrap_IsVoidPointer(aArgVal)) {
01577         //printf("!!!! Argument %i is void pointer\n", i);
01578         return;
01579       }
01580       if (vtkWrap_IsVoidFunction(aArgVal)) {
01581         //printf("!!!! Argument %i is void function\n", i);
01582         return;
01583       }
01584       argtype = (aArgVal->Type & VTK_PARSE_INDIRECT);
01585       if (argtype == VTK_PARSE_POINTER_POINTER){
01586         //printf("!!!! Argument %i is pointer to pointer\n", i);
01587         return;
01588       }
01589       if (vtkWrap_IsNonConstRef(aArgVal)) {
01590         //printf("!!!! Argument %i is non const ref\n", i);
01591         return;
01592       }
01593       if (vtkWrap_IsSpecialObject(aArgVal)) {
01594         //printf("!!!! Argument %i is special object\n", i);
01595         return;
01596       }
01597       /*if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 9) args_ok = 0;
01598       if ((currentFunction->ArgTypes[i] % 0x10) == 8) args_ok = 0;
01599       if (((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100 != 0x3)&&
01600           (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x109)&&
01601           ((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100)) args_ok = 0;
01602       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x313) args_ok = 0;
01603       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x314) args_ok = 0;
01604       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31A) args_ok = 0;
01605       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31B) args_ok = 0;
01606       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x31C) args_ok = 0;
01607       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x315) args_ok = 0;
01608       if (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE == 0x316) args_ok = 0;*/
01609     }
01610   aRetVal = currentFunction->ReturnValue;
01611   if (aRetVal) {
01612     //printf("#### Return type: %s\n", vtkWrap_GetTypeName(aRetVal));
01613     aType = aRetVal->Type & VTK_PARSE_BASE_TYPE;
01614     if (IsPtr(aRetVal)) {
01615       //printf("!!!! Return Value is pointer\n");
01616       return;
01617     }
01618     /* eliminate unsigned char * and unsigned short * */
01619     argtype = (aRetVal->Type & VTK_PARSE_UNQUALIFIED_TYPE);
01620     if ((argtype == VTK_PARSE_UNSIGNED_CHAR_PTR) || (argtype == VTK_PARSE_UNSIGNED_SHORT)) { 
01621       //printf("!!!! Return Value is unsigned char or short\n");
01622       return;
01623     }
01624 
01625     if ((aType == VTK_PARSE_UNKNOWN)) {
01626       //printf("!!!! Return Value is unknown\n");
01627       return;
01628     }
01629     argtype = (aRetVal->Type & VTK_PARSE_INDIRECT);
01630     if (argtype == VTK_PARSE_POINTER_POINTER){
01631       //printf("!!!! Return value is pointer to pointer\n", i);
01632       return;
01633     }
01634     if (vtkWrap_IsSpecialObject(aRetVal)) {
01635       //printf("!!!! Return is special object\n", i);
01636       return;
01637     }
01638   }
01639   /*if ((aRetVal % 0x10) == 0x8) args_ok = 0;
01640   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x9) args_ok = 0;
01641   if (((aRetVal % VTK_PARSE_BASE_TYPE)/0x100 != 0x3)&&
01642       (aRetVal % VTK_PARSE_BASE_TYPE != 0x109)&&
01643       ((aRetVal % VTK_PARSE_BASE_TYPE)/0x100)) args_ok = 0;
01644   */
01645 
01646   /*if (aRetVal % VTK_PARSE_BASE_TYPE == 0x313) args_ok = 0;
01647   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x314) args_ok = 0;
01648   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31A) args_ok = 0;
01649   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31B) args_ok = 0;
01650   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x31C) args_ok = 0;
01651   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x315) args_ok = 0;
01652   if (aRetVal % VTK_PARSE_BASE_TYPE == 0x316) args_ok = 0;
01653   
01654 
01655   if (currentFunction->NumberOfArguments && 
01656       (currentFunction->ArgTypes[0] == 0x5000)
01657       &&(currentFunction->NumberOfArguments != 0x1)) args_ok = 0;*/
01658 
01659   /* make sure we have all the info we need for array arguments in */
01660   /*for (i = 0; i < currentFunction->NumberOfArguments; i++)
01661     {
01662     if (((currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE)/0x100 == 0x3)&&
01663         (currentFunction->ArgCounts[i] <= 0)&&
01664         (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x309)&&
01665         (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x303)&&
01666         (currentFunction->ArgTypes[i] % VTK_PARSE_BASE_TYPE != 0x302)) args_ok = 0;
01667         }*/
01668 
01669   /* if we need a return type hint make sure we have one */
01670   //switch (aRetVal % VTK_PARSE_BASE_TYPE)
01671   /*switch (aRetVal->Type % VTK_PARSE_BASE_TYPE)
01672     {
01673     case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D: case 0x30E:
01674     case 0x304: case 0x305: case 0x306:
01675       args_ok = currentFunction->HaveHint;
01676       break;
01677       }*/
01678   
01679   /* make sure it isn't a Delete or New function */
01680   if (!strcmp("Delete",currentFunction->Name) ||
01681       !strcmp("New",currentFunction->Name))
01682     {
01683       return;
01684     }
01685 
01686   if (vtkWrap_IsDestructor(data, currentFunction) || vtkWrap_IsConstructor(data, currentFunction)) {
01687     //printf("!!!! Return Value is constructor or destructor\n");
01688     return;
01689   }
01690   
01691   /* check for New() function */
01692   if (!strcmp("New",currentFunction->Name) && currentFunction->NumberOfArguments == 0)
01693     {
01694       class_has_new = 1;
01695     }
01696 
01697   if (currentFunction->IsPublic && //args_ok && 
01698       strcmp(data->Name,currentFunction->Name) &&
01699       strcmp(data->Name, currentFunction->Name + 1))
01700     {
01701       //printf("#### %i Function %s\n", numberOfWrappedFunctions, currentFunction->Name);
01702       wrappedFunctions[numberOfWrappedFunctions] = currentFunction;
01703       numberOfWrappedFunctions++;
01704     }
01705   
01706   return;
01707 }
01708 
01709 /* print the parsed structures */
01710 void vtkParseOutput(FILE *fp, FileInfo *file_info)
01711 {
01712   int i;
01713   ClassInfo *data;
01714 
01715   /* get the main class */
01716   data = file_info->MainClass;
01717 
01718   // Do not wrap this class
01719   //  if (strcmp(data->Name, "vtkVariant") == 0)
01720   //  return;
01721 
01722 #if defined(IDL_I_HH)
01723   fprintf(fp, "// idl wrapper interface for %s object implementation\n//\n", data->Name);
01724 #elif defined(IDL_I_CC)
01725   fprintf(fp, "// idl wrapper implementation for %s object\n//\n", data->Name);
01726 #else
01727   fprintf(fp, "// idl wrapper for %s object\n//\n", data->Name);
01728 #endif
01729   for (i = 0;1;i++)
01730     {
01731       if(strlen(Copyright[i]) != 0)
01732         {
01733           fprintf(fp,"%s\n",Copyright[i]);
01734         }
01735       else
01736         {
01737           break;
01738         }
01739     }
01740   fprintf(fp,"\n");
01741 #if defined(IDL_I_HH)
01742   fprintf(fp,"#ifndef PARAVIS_Gen_%s_i_HeaderFile\n",data->Name);
01743   fprintf(fp,"#define PARAVIS_Gen_%s_i_HeaderFile\n",data->Name);
01744   fprintf(fp,"\n");
01745 #elif defined(IDL_I_CC)
01746 #else
01747   fprintf(fp,"#ifndef __PARAVIS_Gen_%s__\n",data->Name);
01748   fprintf(fp,"#define __PARAVIS_Gen_%s__\n",data->Name);
01749   fprintf(fp,"\n");
01750 #endif
01751 
01752   /* insert function handling code here */
01753   for (i = 0; i < data->NumberOfFunctions; i++)
01754     {
01755       currentFunction = data->Functions[i];
01756       outputFunction(fp, data);
01757     }
01758   //printf("#### NbFunctions %i\n", numberOfWrappedFunctions);
01759   //if (data->NumberOfSuperClasses || (!data->IsAbstract))
01760   //if (numberOfWrappedFunctions)
01761   // {
01762       outputFunction2(fp, data);
01763       // }
01764 
01765 #if defined(IDL_I_HH)
01766   fprintf(fp,"\n#endif\n");
01767 #elif defined(IDL_I_CC)
01768 #else
01769   fprintf(fp,"\n#endif\n");
01770 #endif
01771   return;
01772 }