1 // PARAVIS : ParaView wrapper SALOME module
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : vtkWrapIDL.c
23 // Author : Vladimir TURIN
30 #include "vtkWrapIDL.h"
33 "// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,",
34 "// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS",
36 "// This library is free software; you can redistribute it and/or",
37 "// modify it under the terms of the GNU Lesser General Public",
38 "// License as published by the Free Software Foundation; either",
39 "// version 2.1 of the License.",
41 "// This library is distributed in the hope that it will be useful,",
42 "// but WITHOUT ANY WARRANTY; without even the implied warranty of",
43 "// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU",
44 "// Lesser General Public License for more details.",
46 "// You should have received a copy of the GNU Lesser General Public",
47 "// License along with this library; if not, write to the Free Software",
48 "// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA",
50 "// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com",
56 int numberOfWrappedFunctions = 0;
57 FunctionInfo *wrappedFunctions[1000];
58 extern FunctionInfo *currentFunction;
60 static void add_to_sig(char *sig, const char *add, int *i)
63 *i += (int)strlen(add);
66 int IsReturnArg(int I) {
67 return (I == MAX_ARGS);
70 void AddReturnArg(char *Result, int *CurrPos) {
71 add_to_sig(Result,"virtual ",CurrPos);
74 void AddNotReturnArg(int Type, char *Result, int *CurrPos) {
75 #if defined(IDL_I_HH) || defined(IDL_I_CC)
79 add_to_sig(Result,"in ",CurrPos);
81 add_to_sig(Result,"inout ",CurrPos);
85 int IsFunction(int Type) {
86 return (Type == 0x5000);
89 int IsConst(int Type) {
90 return ((Type % 0x2000) >= 0x1000);
93 void AddConst(char *Result, int *CurrPos) {
94 #if defined(IDL_I_HH) || defined(IDL_I_CC)
95 add_to_sig(Result,"const ",CurrPos);
97 add_to_sig(Result,"in ",CurrPos);
101 int IsPtr(int Type) {
102 return ((Type % 0x1000)/0x100 == 0x1);
107 //return ((Type % 0x1000)/0x100 < 1 || (Type % 0x1000)/0x100 > 7);
110 int IsUnknown(int Type) {
111 return ((Type % 0x1000)/0x100 == 0x8);
114 void AddAtomArg(int I, int Type, char *TypeIDL, char *TypeCorba, char *Result, int *CurrPos) {
115 #if defined(IDL_I_HH) || defined(IDL_I_CC)
116 add_to_sig(Result,"CORBA::",CurrPos);
117 add_to_sig(Result,TypeCorba,CurrPos);
119 if (!IsReturnArg(I) && !IsConst(Type) && !IsIn(Type))
120 add_to_sig(Result,"&",CurrPos);
122 add_to_sig(Result,TypeIDL,CurrPos);
124 add_to_sig(Result," ",CurrPos);
127 int IsArray(int Type) {
128 return ((Type % 0x1000)/0x100 == 0x3);
131 void AddArrayArg(int I, int Type, char *TypeIDL, char *Result, int *CurrPos) {
132 #if defined(IDL_I_HH) || defined(IDL_I_CC)
133 if(!IsReturnArg(I) && !IsConst(Type))
134 add_to_sig(Result, "const ",CurrPos);
136 add_to_sig(Result, TypeIDL,CurrPos);
137 add_to_sig(Result, "_array",CurrPos);
138 #if defined(IDL_I_HH) || defined(IDL_I_CC)
140 add_to_sig(Result, "*",CurrPos);
142 add_to_sig(Result, "&",CurrPos);
146 add_to_sig(Result, " ",CurrPos);
149 int IsBoolean(int Type) {
150 return ((Type % 0x10) == 0xE);
153 void AddBooleanAtomArg(int I, int Type, char *Result, int *CurrPos) {
154 AddAtomArg(I,Type,"boolean","Boolean",Result,CurrPos);
157 int IsChar(int Type) {
158 return ((Type % 0x10) == 0x3 || (Type % 0x10) == 0xD);
161 void AddCharAtomArg(int I, int Type, char *Result, int *CurrPos) {
162 AddAtomArg(I,Type,"char","Char",Result,CurrPos);
166 return (IsChar(Type) && IsArray(Type));
169 void AddStringArg(int I, char *Result, int *CurrPos) {
170 #if defined(IDL_I_HH) || defined(IDL_I_CC)
171 add_to_sig(Result,"char ",CurrPos);
173 add_to_sig(Result,"string ",CurrPos);
177 int IsFloat(int Type) {
178 return ((Type % 0x10) == 0x1);
181 void AddFloatAtomArg(int I, int Type, char *Result, int *CurrPos) {
182 AddAtomArg(I,Type,"float","Float",Result,CurrPos);
185 int IsFloatArray(int Type) {
186 return (IsFloat(Type) && IsArray(Type));
189 void AddFloatArrayArg(int I, int Type, char *Result, int *CurrPos) {
190 AddArrayArg(I,Type,"float",Result,CurrPos);
193 int IsDouble(int Type) {
194 return ((Type % 0x10) == 0x7);
197 void AddDoubleAtomArg(int I, int Type, char *Result, int *CurrPos) {
198 AddAtomArg(I,Type,"double","Double",Result,CurrPos);
201 int IsDoubleArray(int Type) {
202 return (IsDouble(Type) && IsArray(Type));
205 void AddDoubleArrayArg(int I, int Type, char *Result, int *CurrPos) {
206 AddArrayArg(I,Type,"double",Result,CurrPos);
209 int IsvtkIdType(int Type) {
210 return((Type % 0x10) == 0xA);
213 int IsShort(int Type) {
214 return ((Type % 0x10) == 0x4 || (Type % 0x10) == 0x5 || (Type % 0x10) == 0xA);
217 void AddShortAtomArg(int I, int Type, char *Result, int *CurrPos) {
218 AddAtomArg(I,Type,"short","Short",Result,CurrPos);
221 int IsShortArray(int Type) {
222 return (IsShort(Type) && IsArray(Type));
225 void AddShortArrayArg(int I, int Type, char *Result, int *CurrPos) {
226 AddArrayArg(I,Type,"short",Result,CurrPos);
229 int IsLong(int Type) {
230 return ((Type % 0x10) == 0x6 || (Type % 0x10) == 0xB || (Type % 0x10) == 0xC);
233 void AddLongAtomArg(int I, int Type, char *Result, int *CurrPos) {
234 AddAtomArg(I,Type,"long","Long",Result,CurrPos);
237 int IsLongArray(int Type) {
238 return (IsLong(Type) && IsArray(Type));
241 void AddLongArrayArg(int I, int Type, char *Result, int *CurrPos) {
242 AddArrayArg(I,Type,"long",Result,CurrPos);
245 int IsClass(int Type) {
246 return ((Type % 0x10) == 0x9);
249 void AddClassArg(int I, int Type, char *Class, char *Result, int *CurrPos) {
250 #if defined(IDL_I_HH) || defined(IDL_I_CC)
251 add_to_sig(Result,"PARAVIS_Base",CurrPos);
252 if(IsReturnArg(I) || IsConst(Type) || IsIn(Type)) {
253 add_to_sig(Result,"_ptr",CurrPos);
255 add_to_sig(Result,"_ptr&",CurrPos);
257 add_to_sig(Result," ",CurrPos);
259 add_to_sig(Result,"PARAVIS_Base ",CurrPos);
263 int _IsVoid(int Type) {
264 return ((Type % 0x10) == 0x2);
267 int IsVoid(int Type) {
268 return (_IsVoid(Type) && (!IsPtr(Type)));
271 void AddVoid(char *Result, int *CurrPos) {
272 add_to_sig(Result,"void ",CurrPos);
275 int IsVoidPtr(int Type) {
276 return (_IsVoid(Type) && (IsPtr(Type) || IsArray(Type)));
279 void AddVoidArg(int I, char *Result, int *CurrPos, int Type) {
280 #if defined(IDL_I_HH) || defined(IDL_I_CC)
281 if(!IsReturnArg(I)) {
283 add_to_sig(Result,"const ",CurrPos);
284 add_to_sig(Result,"CORBA::Any& ",CurrPos);
286 add_to_sig(Result,"CORBA::Any ",CurrPos);
289 add_to_sig(Result,"any ",CurrPos);
293 void AddTypeArray(int Type, char *Result, int *CurrPos) {
295 add_to_sig(Result,"short",CurrPos);
297 add_to_sig(Result,"long",CurrPos);
299 add_to_sig(Result,"float",CurrPos);
301 add_to_sig(Result,"double",CurrPos);
302 add_to_sig(Result,"_array",CurrPos);
305 typedef struct _ReadFuncs
313 ReadFuncs readFunctions[1000];
314 int numberOfReadFunctions = 0;
316 static int class_has_new = 0;
318 void output_type(char* result, int *currPos, int i, int aType, char *Id)
322 add_to_sig(result,"float",currPos);
324 add_to_sig(result,"CORBA::Float",currPos);
328 if(IsDouble(aType)) {
330 add_to_sig(result,"double",currPos);
332 add_to_sig(result,"CORBA::Double",currPos);
338 if(IsvtkIdType(aType)) {
339 add_to_sig(result,"vtkIdType",currPos);
341 add_to_sig(result,"int",currPos);
344 add_to_sig(result,"CORBA::Short",currPos);
350 add_to_sig(result,"long",currPos);
352 add_to_sig(result,"CORBA::Long",currPos);
357 if(IsString(aType)) {
359 add_to_sig(result,"const ",currPos);
360 add_to_sig(result,"char",currPos);
362 add_to_sig(result,"CORBA::Char",currPos);
366 if(IsBoolean(aType)) {
367 add_to_sig(result,"CORBA::Boolean",currPos);
370 if(IsVoidPtr(aType)) {
371 add_to_sig(result,"void",currPos);
375 add_to_sig(result,"::",currPos);
376 add_to_sig(result,Id,currPos);
379 if(IsArray(aType) || IsPtr(aType) || IsClass(aType) || IsString(aType)) {
380 add_to_sig(result,"*",currPos);
384 void output_typedef(char* result, int *currPos, int i, int aType, char *Id)
386 add_to_sig(result," typedef ",currPos);
387 output_type(result,currPos,i,aType,Id);
390 void output_temp(char* result, int *currPos, int i, int aType, char *Id, int aCount)
394 /* handle VAR FUNCTIONS */
395 if (IsFunction(aType)) {
399 #if defined(IDL_I_HH)
401 AddReturnArg(result,currPos);
405 if (IsReturnArg(i) && IsVoid(aType) && !IsVoidPtr(aType)) {
406 AddVoid(result,currPos);
410 /* for const * return types prototype with const */
411 if ( IsConst(aType) || IsString(aType)) {
412 if(!IsReturnArg(i)) {
413 AddConst(result,currPos);
416 if(!IsReturnArg(i)) {
417 AddNotReturnArg(aType,result,currPos);
422 if(IsFloatArray(aType)) {
423 AddFloatArrayArg(i,aType,result,currPos);
425 AddFloatAtomArg(i,aType,result,currPos);
429 if(IsDouble(aType)) {
430 if(IsDoubleArray(aType)) {
431 AddDoubleArrayArg(i,aType,result,currPos);
433 AddDoubleAtomArg(i,aType,result,currPos);
438 if(IsShortArray(aType)) {
439 AddShortArrayArg(i,aType,result,currPos);
441 AddShortAtomArg(i,aType,result,currPos);
446 if(IsLongArray(aType)) {
447 AddLongArrayArg(i,aType,result,currPos);
449 AddLongAtomArg(i,aType,result,currPos);
454 if(IsString(aType)) {
455 AddStringArg(i,result,currPos);
457 AddCharAtomArg(i,aType,result,currPos);
461 if(IsBoolean(aType)) {
462 AddBooleanAtomArg(i,aType,result,currPos);
466 AddVoidArg(i,result,currPos,aType);
470 AddClassArg(i,aType,Id,result,currPos);
473 if(IsUnknown(aType)) {
477 if(!IsClass(aType)) {
479 add_to_sig(result," *",currPos);
481 #if defined(IDL_I_HH) || defined(IDL_I_CC)
482 if(IsString(aType) && !IsIn(aType) && !IsConst(aType) && !IsReturnArg(i)) {
483 add_to_sig(result,"*&",currPos);
485 if(IsString(aType) || (IsReturnArg(i) && IsVoidPtr(aType))) {
486 add_to_sig(result," *",currPos);
492 if(!IsReturnArg(i)) {
493 sprintf(buf,"temp%i",i);
494 add_to_sig(result,buf,currPos);
500 void read_class_functions(const char* name, const char* classname, FILE* fp)
515 #if ! defined(IDL_I_CC)
521 #if defined(IDL_I_HH)
522 sprintf(buf,"PARAVIS_Gen_%s_i.hh",name);
523 #elif defined(IDL_I_CC)
524 sprintf(buf,"PARAVIS_Gen_%s_i.cc",name);
526 sprintf(buf,"PARAVIS_Gen_%s.idl",name);
528 if (!(fin = fopen(buf,"r"))) {
529 fprintf(stderr,"Error opening input file %s\n",buf);
532 while (fgets(sig,bs-1,fin) != 0) {
533 #if defined(IDL_I_CC)
534 if(strncmp("#include \"PARAVIS_Gen_vtk",sig,25)==0) {
537 if(strncmp("#include <vtk",sig,13)==0) {
542 #if ! defined(IDL_I_CC)
543 if(strncmp(" //C++: ",sig,clen)==0) {
545 if(strncmp("//C++: ",sig,clen)==0) {
547 #if defined(IDL_I_CC)
548 while(fgets(buf,bs-1,fin) != 0) {
551 if(strlen(buf) == 3 && buf[0]=='/' && buf[1]=='/')
557 if(strlen(buf) > 1) {
559 #if defined(IDL_I_HH)
561 readFunctions[numberOfReadFunctions].EndPos=strlen(sig);
562 sscanf(sig+len,"%s %s %s",buf,buf1,fname);
563 if(fname[0] == '*') {
566 #elif defined(IDL_I_CC)
568 sscanf(buf1,"%s %s",buf,fname);
571 sprintf(sig+curlen,"%s ",buf);
574 if(fname[0] == '*') {
576 sprintf(sig+curlen," *");
580 sprintf(sig+curlen,"%s_i::",classname);
582 for(i = 0; i < strlen(fname)-1; i++) {
585 if(fname[i] == ':' && fname[i] == ':') {
592 sprintf(sig+curlen,"%s", buf1+j);
595 readFunctions[numberOfReadFunctions].EndPos=curlen;
596 while (fgets(sig+curlen,bs-1-curlen,fin) != 0) {
597 if(sig[curlen] == '}')
603 readFunctions[numberOfReadFunctions].EndPos=strlen(sig);
604 sscanf(sig+len,"%s _%s",buf,fname);
608 if(flen>2 && fname[flen-2]=='_') {
611 readFunctions[numberOfReadFunctions].Name = malloc((flen+1-ret_str)*sizeof(char));
612 strncpy(readFunctions[numberOfReadFunctions].Name,fname+ret_str,flen-ret_str);
613 readFunctions[numberOfReadFunctions].Name[flen-ret_str]='\0';
615 #if defined(IDL_I_HH)
616 len+=slen+strlen(buf)+1+strlen(buf1)+2+flen+ret_str-1; //spaces+virtual+space+return+space+space+*+name
617 #elif defined(IDL_I_CC)
618 len+=2+strlen(buf)+2+strlen(classname)+2+strlen(readFunctions[numberOfReadFunctions].Name)-1; //return+space+space+name
619 if(fname[0] == '*') {
622 if(fname[flen-2]=='_') {
626 len+=slen+strlen(buf)+2+flen; //spaces+return+space+_+name
628 readFunctions[numberOfReadFunctions].NumPos=len;
629 if(fname[flen]=='_') {
630 readFunctions[numberOfReadFunctions].NumPos=len+2; //+_+num
634 readFunctions[numberOfReadFunctions].Signature = malloc((len+1)*sizeof(char));
635 strncpy(readFunctions[numberOfReadFunctions].Signature,sig,len);
636 readFunctions[numberOfReadFunctions].Signature[len]='\0';
638 numberOfReadFunctions++;
647 void get_signature(const char* num, FileInfo *data)
649 static char result[bs];
655 static char buf1[bs];
660 add_to_sig(result,"\n",&currPos);
661 if (currentFunction->Signature) {
662 #if ! defined(IDL_I_CC)
663 add_to_sig(result," ",&currPos);
665 add_to_sig(result,"//C++: ",&currPos);
666 add_to_sig(result,currentFunction->Signature,&currPos);
667 add_to_sig(result,"\n",&currPos);
670 if(IsClass(currentFunction->ReturnType) && ret == 0) {
672 for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) {
673 if(strcmp(wrapped_classes[i],currentFunction->ReturnClass) == 0)
680 for (j = 0; j < currentFunction->NumberOfArguments; j++) {
681 if(IsFunction(currentFunction->ArgTypes[j]))
683 if(IsClass(currentFunction->ArgTypes[j]) && ret == 0) {
685 for(i = 0; strcmp(wrapped_classes[i],"") != 0 && found == 0; i++) {
686 if(strcmp(wrapped_classes[i],currentFunction->ArgClasses[j]) == 0)
694 if (IsArray(currentFunction->ReturnType) && !IsClass(currentFunction->ReturnType) && !IsString(currentFunction->ReturnType) && currentFunction->HintSize == 0) {
699 add_to_sig(result,"//\n",&currPos);
700 currentFunction->Signature = realloc(currentFunction->Signature,
701 (size_t)(currPos+1));
702 strcpy(currentFunction->Signature,result);
707 #if defined(IDL_I_CC)
708 add_to_sig(result,"struct CreateEventName(",&currPos);
709 add_to_sig(result,currentFunction->Name,&currPos);
710 if( strlen(num)!=0 ) {
711 add_to_sig(result,num,&currPos);
713 add_to_sig(result,")",&currPos);
714 add_to_sig(result,": public SALOME_Event\n",&currPos);
715 add_to_sig(result,"{\n",&currPos);
716 if(!IsVoid(currentFunction->ReturnType)) {
717 output_typedef(result,&currPos,MAX_ARGS,currentFunction->ReturnType,
718 currentFunction->ReturnClass);
719 add_to_sig(result," TResult;\n",&currPos);
720 add_to_sig(result," TResult myResult;\n",&currPos);
723 output_typedef(result, &currPos, 0, 0x309,
725 add_to_sig(result," TObj;\n",&currPos);
726 add_to_sig(result," TObj myObj;\n",&currPos);
728 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
729 output_typedef(result, &currPos, i, currentFunction->ArgTypes[i],
730 currentFunction->ArgClasses[i]);
731 sprintf(buf," TParam%d;\n",i);
732 add_to_sig(result,buf,&currPos);
733 sprintf(buf," TParam%d myParam%d;\n",i,i);
734 add_to_sig(result,buf,&currPos);
737 add_to_sig(result,"\n",&currPos);
738 add_to_sig(result," CreateEventName(",&currPos);
739 add_to_sig(result,currentFunction->Name,&currPos);
740 if( strlen(num)!=0 ) {
741 add_to_sig(result,num,&currPos);
743 add_to_sig(result,")",&currPos);
744 add_to_sig(result,"(TObj theObj",&currPos);
745 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
746 sprintf(buf,", TParam%d theParam%d",i,i);
747 add_to_sig(result,buf,&currPos);
749 add_to_sig(result,"):\n",&currPos);
750 add_to_sig(result," myObj(theObj)",&currPos);
751 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
752 sprintf(buf,", myParam%d(theParam%d)",i,i);
753 add_to_sig(result,buf,&currPos);
755 add_to_sig(result,"\n",&currPos);
756 add_to_sig(result," { }\n",&currPos);
757 add_to_sig(result,"\n",&currPos);
758 add_to_sig(result," virtual void Execute()\n",&currPos);
759 add_to_sig(result," {\n",&currPos);
760 add_to_sig(result," ",&currPos);
761 if(!IsVoid(currentFunction->ReturnType)/* && !IsString(currentFunction->ReturnType)*/) {
762 add_to_sig(result,"myResult = ",&currPos);
764 //if(IsString(currentFunction->ReturnType)) {
765 //add_to_sig(result,"const char* ret = ",&currPos);
767 add_to_sig(result,"myObj->",&currPos);
768 add_to_sig(result,currentFunction->Name,&currPos);
769 add_to_sig(result,"(",&currPos);
770 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
772 add_to_sig(result,", ",&currPos);
773 if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) {
774 add_to_sig(result,"*",&currPos);
776 sprintf(buf,"myParam%d",i);
777 add_to_sig(result,buf,&currPos);
779 add_to_sig(result,");\n",&currPos);
780 //if(IsString(currentFunction->ReturnType)) {
781 //add_to_sig(result," myResult = (ret==NULL)?NULL:CORBA::string_dup(\"\");\n",&currPos);
783 add_to_sig(result," }\n",&currPos);
785 add_to_sig(result,"};\n",&currPos);
786 add_to_sig(result,"//\n",&currPos);
790 #if ! defined(IDL_I_CC)
791 add_to_sig(result," ",&currPos);
794 output_temp(result,&currPos,MAX_ARGS,currentFunction->ReturnType,
795 currentFunction->ReturnClass,0);
797 #if defined(IDL_I_CC)
798 add_to_sig(result,data->ClassName,&currPos);
799 add_to_sig(result,"_i::",&currPos);
801 #if ! defined(IDL_I_HH) && ! defined(IDL_I_CC)
802 add_to_sig(result,"_",&currPos);
804 add_to_sig(result,currentFunction->Name,&currPos);
806 if( strlen(num)!=0 ) {
807 add_to_sig(result,num,&currPos);
810 add_to_sig(result," ",&currPos);
812 /* print the arg list */
813 add_to_sig(result,"(",&currPos);
815 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
817 add_to_sig(result,", ",&currPos);
819 output_temp(result, &currPos, i, currentFunction->ArgTypes[i],
820 currentFunction->ArgClasses[i],
821 currentFunction->ArgCounts[i]);
824 add_to_sig(result,")",&currPos);
825 #if defined(IDL_I_CC)
826 add_to_sig(result," {\n",&currPos);
827 add_to_sig(result," try {\n",&currPos);
828 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
829 if(IsClass(currentFunction->ArgTypes[i])) {
830 sprintf(buf," PARAVIS_Base_i* i_temp%d = GET_SERVANT(temp%d);\n",i,i);
831 add_to_sig(result,buf,&currPos);
835 IsArray(currentFunction->ArgTypes[i])
836 && !IsString(currentFunction->ArgTypes[i])
837 && !IsClass(currentFunction->ArgTypes[i])
838 && !IsVoid(currentFunction->ArgTypes[i])
840 sprintf(buf," CORBA::ULong j_temp%d;\n",i);
841 add_to_sig(result,buf,&currPos);
842 sprintf(buf," CORBA::ULong l_temp%d = temp%d.length();\n",i,i);
843 add_to_sig(result,buf,&currPos);
844 add_to_sig(result," ",&currPos);
846 if(IsFloat(currentFunction->ArgTypes[i]))
847 add_to_sig(result,"float",&currPos);
849 if(IsDouble(currentFunction->ArgTypes[i]))
850 add_to_sig(result,"double",&currPos);
852 if(IsvtkIdType(currentFunction->ArgTypes[i])) {
853 add_to_sig(result,"vtkIdType",&currPos);
855 if(IsShort(currentFunction->ArgTypes[i])) {
856 add_to_sig(result,"int",&currPos);
860 if(IsLong(currentFunction->ArgTypes[i]))
861 add_to_sig(result,"long",&currPos);
863 sprintf(buf,"* a_temp%d = new ",i);
864 add_to_sig(result,buf,&currPos);
866 if(IsFloat(currentFunction->ArgTypes[i]))
867 add_to_sig(result,"float",&currPos);
869 if(IsDouble(currentFunction->ArgTypes[i]))
870 add_to_sig(result,"double",&currPos);
872 if(IsvtkIdType(currentFunction->ArgTypes[i])) {
873 add_to_sig(result,"vtkIdType",&currPos);
875 if(IsShort(currentFunction->ArgTypes[i])) {
876 add_to_sig(result,"int",&currPos);
880 if(IsLong(currentFunction->ArgTypes[i]))
881 add_to_sig(result,"long",&currPos);
883 sprintf(buf,"[l_temp%d];\n",i);
884 add_to_sig(result,buf,&currPos);
886 sprintf(buf," for(j_temp%d=0;j_temp%d<l_temp%d;j_temp%d++) {\n",i,i,i,i);
887 add_to_sig(result,buf,&currPos);
889 sprintf(buf," a_temp%d[j_temp%d]=temp%d[j_temp%d];\n",i,i,i,i);
890 add_to_sig(result,buf,&currPos);
892 add_to_sig(result," }\n",&currPos);
895 if(IsString(currentFunction->ArgTypes[i])) {
896 sprintf(buf," char *c_temp%d = CORBA::string_dup(temp%d);\n",i,i);
897 add_to_sig(result,buf,&currPos);
900 if(IsVoid(currentFunction->ArgTypes[i])) {
901 sprintf(buf," long v_temp%d;\n",i);
902 add_to_sig(result,buf,&currPos);
904 sprintf(buf," temp%d.operator>>=(v_temp%d);\n",i,i);
905 add_to_sig(result,buf,&currPos);
908 add_to_sig(result," ",&currPos);
910 if(IsArray(currentFunction->ReturnType) && !IsClass(currentFunction->ReturnType) && !IsString(currentFunction->ReturnType)) {
911 add_to_sig(result,"CORBA::ULong i_ret;\n",&currPos);
912 add_to_sig(result," PARAVIS::",&currPos);
913 AddTypeArray(currentFunction->ReturnType,result,&currPos);
914 add_to_sig(result,"_var s_ret = new ",&currPos);
915 AddTypeArray(currentFunction->ReturnType,result,&currPos);
916 add_to_sig(result,"();\n",&currPos);
917 sprintf(buf," s_ret->length(%d);\n",currentFunction->HintSize);
918 add_to_sig(result,buf,&currPos);
919 add_to_sig(result," ",&currPos);
922 if(IsFloat(currentFunction->ReturnType)) {
923 if(IsArray(currentFunction->ReturnType)) {
924 add_to_sig(result,"float* a_ret = ",&currPos);
926 add_to_sig(result,"CORBA::Float ret = ",&currPos);
930 if(IsDouble(currentFunction->ReturnType)) {
931 if(IsArray(currentFunction->ReturnType)) {
932 add_to_sig(result,"double* a_ret = ",&currPos);
934 add_to_sig(result,"CORBA::Double ret = ",&currPos);
938 if(IsShort(currentFunction->ReturnType)) {
939 if(IsArray(currentFunction->ReturnType)) {
940 if(IsvtkIdType(currentFunction->ReturnType)) {
941 add_to_sig(result,"vtkIdType",&currPos);
943 add_to_sig(result,"int",&currPos);
945 add_to_sig(result,"* a_ret = ",&currPos);
947 add_to_sig(result,"CORBA::Short ret = ",&currPos);
951 if(IsLong(currentFunction->ReturnType)) {
952 if(IsArray(currentFunction->ReturnType)) {
953 add_to_sig(result,"long* a_ret = ",&currPos);
955 add_to_sig(result,"CORBA::Long ret = ",&currPos);
959 if(IsChar(currentFunction->ReturnType)) {
960 if(IsString(currentFunction->ReturnType)) {
961 add_to_sig(result,"char * ret = CORBA::string_dup(\"\");\n",&currPos);
962 add_to_sig(result," const char * cret = ",&currPos);
964 add_to_sig(result,"CORBA::Char ret = ",&currPos);
968 if(IsBoolean(currentFunction->ReturnType)) {
969 add_to_sig(result,"CORBA::Boolean ret = ",&currPos);
972 if(IsVoidPtr(currentFunction->ReturnType)) {
973 add_to_sig(result,"void * v_ret = ",&currPos);
976 if(IsClass(currentFunction->ReturnType)) {
977 add_to_sig(result,"::",&currPos);
978 add_to_sig(result,currentFunction->ReturnClass,&currPos);
979 add_to_sig(result,"* a",&currPos);
980 add_to_sig(result,currentFunction->ReturnClass,&currPos);
981 add_to_sig(result," = ",&currPos);
983 if(IsVoid(currentFunction->ReturnType)) {
984 add_to_sig(result,"if(getVTKObject() != NULL) ProcessVoidEvent",&currPos);
986 add_to_sig(result,"(getVTKObject() != NULL) ? ProcessEvent",&currPos);
988 add_to_sig(result,"(\n",&currPos);
989 add_to_sig(result," new CreateEventName(",&currPos);
990 add_to_sig(result,currentFunction->Name,&currPos);
991 if( strlen(num)!=0 ) {
992 add_to_sig(result,num,&currPos);
994 add_to_sig(result,")",&currPos);
996 add_to_sig(result,"((::",&currPos);
997 add_to_sig(result,data->ClassName,&currPos);
998 add_to_sig(result,"*)",&currPos);
999 add_to_sig(result,"getVTKObject()\n",&currPos);
1001 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
1002 add_to_sig(result," , ",&currPos);
1004 //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) {
1005 //add_to_sig(result,"*(",&currPos);
1008 if(IsClass(currentFunction->ArgTypes[i])) {
1009 sprintf(buf,"(i_temp%d != NULL)?dynamic_cast< ::%s*>(i_temp%d->getVTKObject()):NULL",i,currentFunction->ArgClasses[i],i);
1012 IsArray(currentFunction->ArgTypes[i])
1013 && !IsString(currentFunction->ArgTypes[i])
1014 && !IsVoid(currentFunction->ArgTypes[i])
1016 sprintf(buf,"a_temp%d",i);
1018 if(IsVoidPtr(currentFunction->ArgTypes[i])) {
1019 sprintf(buf,"(void*)v_temp%d",i);
1021 if(IsString(currentFunction->ArgTypes[i])) {
1022 sprintf(buf,"c_temp%d",i);
1024 sprintf(buf,"temp%d",i);
1030 add_to_sig(result,buf,&currPos);
1031 //if(IsClass(currentFunction->ArgTypes[i]) && IsPtr(currentFunction->ArgTypes[i])) {
1032 //add_to_sig(result,")",&currPos);
1034 add_to_sig(result,"\n",&currPos);
1037 add_to_sig(result," )\n",&currPos);
1038 add_to_sig(result," )",&currPos);
1039 if(!IsVoid(currentFunction->ReturnType)) {
1040 add_to_sig(result,":",&currPos);
1041 if(IsClass(currentFunction->ReturnType) || IsString(currentFunction->ReturnType) || IsPtr(currentFunction->ReturnType) || IsArray(currentFunction->ReturnType))
1042 add_to_sig(result,"NULL",&currPos);
1044 add_to_sig(result,"0",&currPos);
1046 add_to_sig(result,";\n",&currPos);
1047 if(IsString(currentFunction->ReturnType)) {
1048 add_to_sig(result," if(cret!=NULL) ret=CORBA::string_dup(cret);\n",&currPos);
1051 if(IsClass(currentFunction->ReturnType)) {
1052 add_to_sig(result," if(a",&currPos);
1053 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1054 add_to_sig(result," == NULL) {\n",&currPos);
1055 add_to_sig(result," return PARAVIS::",&currPos);
1056 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1057 add_to_sig(result,"::_nil();\n",&currPos);
1058 add_to_sig(result," }\n",&currPos);
1059 add_to_sig(result," ",&currPos);
1060 add_to_sig(result,"PARAVIS_Base_i* aPtr = ::CreateInstance(a",&currPos);
1061 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1062 add_to_sig(result,", a",&currPos);
1063 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1064 add_to_sig(result,"->GetClassName());\n",&currPos);
1065 add_to_sig(result," aPtr->Init(a",&currPos);
1066 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1067 add_to_sig(result,");\n",&currPos);
1070 for (i = 0; i < currentFunction->NumberOfArguments; i++) {
1072 IsArray(currentFunction->ArgTypes[i])
1073 && !IsVoid(currentFunction->ArgTypes[i])
1074 && !IsString(currentFunction->ArgTypes[i])
1075 && !IsClass(currentFunction->ArgTypes[i])
1077 if (!IsIn(currentFunction->ArgTypes[i])) {
1078 sprintf(buf," for(j_temp%d=0;j_temp%d<l_temp%d;j_temp%d++) {\n",i,i,i,i);
1079 add_to_sig(result,buf,&currPos);
1081 sprintf(buf," temp%d[j_temp%d]=a_temp%d[j_temp%d];\n",i,i,i,i);
1082 add_to_sig(result,buf,&currPos);
1084 add_to_sig(result," }\n",&currPos);
1086 sprintf(buf," delete [] a_temp%d;\n",i);
1087 add_to_sig(result,buf,&currPos);
1091 if (IsVoid(currentFunction->ReturnType) && !IsVoidPtr(currentFunction->ReturnType)) {
1092 add_to_sig(result," return;\n",&currPos);
1094 if(IsClass(currentFunction->ReturnType)) {
1095 add_to_sig(result," return aPtr->_this();\n",&currPos);
1097 if(IsVoid(currentFunction->ReturnType)) {
1098 add_to_sig(result," CORBA::Any* ret = new CORBA::Any;\n",&currPos);
1099 add_to_sig(result," (*ret) <<= v_ret;\n",&currPos);
1100 add_to_sig(result," return ret;\n",&currPos);
1102 if(IsArray(currentFunction->ReturnType) && !IsString(currentFunction->ReturnType)) {
1103 sprintf(buf," for(i_ret=0; i_ret<%d; i_ret++) {\n",currentFunction->HintSize);
1104 add_to_sig(result,buf,&currPos);
1105 add_to_sig(result," s_ret[i_ret]=a_ret[i_ret];\n",&currPos);
1106 add_to_sig(result," }\n",&currPos);
1107 add_to_sig(result," return s_ret._retn();\n",&currPos);
1109 add_to_sig(result," return ret;\n",&currPos);
1115 add_to_sig(result," } catch(...) {\n",&currPos);
1116 add_to_sig(result," MESSAGE(\"",&currPos);
1117 //add_to_sig(result,data->ClassName,&currPos);
1118 //add_to_sig(result,"::",&currPos);
1119 add_to_sig(result,currentFunction->Name,&currPos);
1120 add_to_sig(result," - Unknown exception was occured!!!\");\n",&currPos);
1122 if (IsVoid(currentFunction->ReturnType)&& !IsVoidPtr(currentFunction->ReturnType)) {
1123 add_to_sig(result," return;\n",&currPos);
1125 if(IsString(currentFunction->ReturnType)) {
1126 add_to_sig(result," return CORBA::string_dup(\"\");\n",&currPos);
1128 if(IsClass(currentFunction->ReturnType)) {
1129 add_to_sig(result," return PARAVIS::",&currPos);
1130 add_to_sig(result,currentFunction->ReturnClass,&currPos);
1131 add_to_sig(result,"::_nil();\n",&currPos);
1133 if(IsArray(currentFunction->ReturnType) && !IsVoid(currentFunction->ReturnType)) {
1134 add_to_sig(result," PARAVIS::",&currPos);
1135 AddTypeArray(currentFunction->ReturnType,result,&currPos);
1136 add_to_sig(result,"_var s_ret = new ",&currPos);
1137 AddTypeArray(currentFunction->ReturnType,result,&currPos);
1138 add_to_sig(result,"();\n",&currPos);
1139 sprintf(buf," s_ret->length(%d);\n",currentFunction->HintSize);
1140 add_to_sig(result,buf,&currPos);
1141 add_to_sig(result," return s_ret._retn();\n",&currPos);
1143 add_to_sig(result," return 0;\n",&currPos);
1149 add_to_sig(result," }\n",&currPos);
1150 add_to_sig(result,"}\n",&currPos);
1152 add_to_sig(result,";\n",&currPos);
1157 result[currPos_sig]='\0';
1158 currentFunction->Signature = realloc(currentFunction->Signature,
1159 (size_t)(currPos_sig+1));
1160 strcpy(currentFunction->Signature,result);
1165 //if(strcmp(currentFunction->Name,"NewInstance") == 0) {
1166 //currentFunction->Signature[0]='\0';
1170 for(i = 0; i < numberOfReadFunctions; i++) {
1171 if(strcmp(readFunctions[i].Name,currentFunction->Name) == 0) {
1172 j=readFunctions[i].EndPos-readFunctions[i].NumPos;
1173 strncpy(buf,result+currPos_num,j);
1174 strncpy(buf1,readFunctions[i].Signature+readFunctions[i].NumPos,j);
1177 if(strcmp(buf,buf1) == 0) {
1178 currentFunction->Signature[0]='\0';
1184 currentFunction->Signature = realloc(currentFunction->Signature,
1185 (size_t)(currPos+1));
1186 strcpy(currentFunction->Signature,result);
1189 void outputFunction2(FILE *fp, FileInfo *data)
1191 int i, j, k, is_static, is_vtkobject, fnum, occ, backnum, goto_used;
1193 FunctionInfo *theFunc;
1194 FunctionInfo *backFunc;
1200 //int isSMObject = 0;
1203 #if defined(IDL_I_HH)
1204 fprintf(fp,"#include \"SALOMEconfig.h\"\n");
1205 fprintf(fp,"#include CORBA_SERVER_HEADER(PARAVIS_Gen_%s)\n",data->ClassName);
1207 fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n");
1208 fprintf(fp,"#include \"PARAVIS_Gen_i.hh\"\n");
1209 fprintf(fp,"#include \"PARAVIS_Gen_Types.hh\"\n");
1210 fprintf(fp,"#include \"vtkSmartPointer.h\"\n");
1211 fprintf(fp,"#include \"SALOME_Event.h\"\n");
1213 for(i=0;i<data->NumberOfSuperClasses;i++)
1215 fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->SuperClasses[i]);
1218 fprintf(fp,"\nclass %s;\n",data->ClassName);
1219 fprintf(fp,"\nnamespace PARAVIS\n{\n\n");
1220 #elif defined(IDL_I_CC)
1221 fprintf(fp,"#include \"SALOME_GenericObj_i.hh\"\n");
1222 fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",data->ClassName);
1223 fprintf(fp,"#include \"PV_Tools.h\"\n");
1224 fprintf(fp,"#include \"SALOME_Event.h\"\n");
1225 fprintf(fp,"#include <%s.h>\n",data->ClassName);
1227 fprintf(fp,"#include \"PARAVIS_Gen.idl\"\n");
1228 fprintf(fp,"#include \"PARAVIS_Gen_Types.idl\"\n");
1230 for(i=0;i<data->NumberOfSuperClasses;i++)
1232 fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",data->SuperClasses[i]);
1235 fprintf(fp,"\nmodule PARAVIS\n{\n\n");
1238 is_vtkobject = ((strcmp(data->ClassName,"vtkObjectBase") == 0) ||
1239 (data->NumberOfSuperClasses != 0));
1241 for(i = 0; i < data->NumberOfSuperClasses; i++) {
1242 read_class_functions(data->SuperClasses[i],data->ClassName,fp);
1245 /* create a idl signature for each method */
1246 for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
1249 theFunc = wrappedFunctions[fnum];
1250 currentFunction = theFunc;
1252 /* names of idl methods should be unique */
1255 for (i = 0; i < numberOfReadFunctions; i++) {
1256 if(strcmp(currentFunction->Name,readFunctions[i].Name) == 0)
1260 for (i = 0; i < fnum; i++)
1262 if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) == 0 )
1267 for (i = fnum+1; i < numberOfWrappedFunctions; i++) {
1268 if( strcmp(currentFunction->Name,wrappedFunctions[i]->Name) == 0 ) {
1279 sprintf(num,"_%d",j);
1282 get_signature(num,data);
1285 /* create external type declarations for all object
1287 for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++)
1289 theFunc = wrappedFunctions[fnum];
1290 currentFunction = theFunc;
1294 for (i = theFunc->NumberOfArguments; i >= 0; i--)
1296 if (i==0)/* return type */
1298 theType = theFunc->ReturnType;
1299 theName = theFunc->ReturnClass;
1303 theType = theFunc->ArgTypes[i-1];
1304 theName = theFunc->ArgClasses[i-1];
1306 /* check for object types */
1307 if ((theType % 0x1000 == 0x309)||
1308 (theType % 0x1000 == 0x109))
1310 /* check that we haven't done this type (no duplicate declarations) */
1311 for (backnum = fnum; backnum >= 0; backnum--)
1313 backFunc = wrappedFunctions[backnum];
1316 if (backnum == fnum)
1320 for (j = backFunc->NumberOfArguments; j >= k; j--)
1322 if (j==0) /* return type */
1324 backType = backFunc->ReturnType;
1325 backName = backFunc->ReturnClass;
1329 backType = backFunc->ArgTypes[j-1];
1330 backName = backFunc->ArgClasses[j-1];
1332 if (((backType % 0x1000 == 0x309)||
1333 (backType % 0x1000 == 0x109)))
1335 if(strcmp(theName,backName) == 0)
1346 if (backnum < 0 && strcmp(data->ClassName,theName) != 0)
1349 for(j = 0; strcmp(wrapped_classes[j],"") != 0 && found == 0; j++)
1351 if(strcmp(wrapped_classes[j],theName) == 0)
1356 #if defined(IDL_I_HH)
1357 fprintf(fp," class %s_i;\n",theName);
1358 #elif defined(IDL_I_CC)
1359 fprintf(fp,"#include \"PARAVIS_Gen_%s_i.hh\"\n",theName);
1360 fprintf(fp,"#include <%s.h>\n",theName);
1362 //fprintf(fp,"#include \"PARAVIS_Gen_%s.idl\"\n",theName);
1363 fprintf(fp," interface %s;\n",theName);
1371 //fprintf(fp,"\nmodule PARAVIS\n{\n");
1372 #if defined(IDL_I_HH)
1373 fprintf(fp,"\n class %s_i : public virtual POA_PARAVIS::%s, public virtual PARAVIS::PARAVIS_Base_i",data->ClassName,data->ClassName);
1374 //for(i = 0; i < data->NumberOfSuperClasses; i++) {
1375 // fprintf(fp,", public virtual %s_i",data->SuperClasses[i]);
1377 //fprintf(fp,", public virtual SALOME::GenericObj_i");
1379 fprintf(fp,"\n public:\n");
1380 fprintf(fp,"\n %s_i();\n",data->ClassName);
1381 #elif defined(IDL_I_CC)
1382 fprintf(fp,"extern PARAVIS::PARAVIS_Base_i* CreateInstance(::vtkObjectBase* Inst, const QString&);\n");
1383 fprintf(fp,"\nnamespace PARAVIS\n{\n");
1384 fprintf(fp,"typedef %s_i current_inderface;\n",data->ClassName);
1385 fprintf(fp,"#define CreateEventName(Function) Event%s ##Function\n",data->ClassName);
1386 fprintf(fp,"%s_i::%s_i() {\n",data->ClassName,data->ClassName);
1387 fprintf(fp," Init(::%s::New());\n",data->ClassName);
1391 fprintf(fp,"\n interface %s : PARAVIS_Base",data->ClassName);
1392 fprintf(fp,"\n {\n");
1395 for(i = 0; i < numberOfReadFunctions; i++) {
1396 fprintf(fp, "%s\n", readFunctions[i].Signature);
1399 for (fnum = 0; fnum < numberOfWrappedFunctions; fnum++) {
1400 fprintf(fp,"%s\n",wrappedFunctions[fnum]->Signature);
1403 #if defined(IDL_I_HH)
1404 fprintf(fp," };\n");
1406 #elif defined(IDL_I_CC)
1409 fprintf(fp," };\n");
1416 void outputFunction(FILE *fp, FileInfo *data)
1422 /* some functions will not get wrapped no matter what else,
1423 and some really common functions will appear only in vtkObjectPython */
1424 if (currentFunction->IsOperator ||
1425 currentFunction->ArrayFailure ||
1426 !currentFunction->IsPublic ||
1427 !currentFunction->Name)
1432 /* check to see if we can handle the args */
1433 for (i = 0; i < currentFunction->NumberOfArguments; i++)
1435 if (currentFunction->ArgTypes[i] % 0x1000 == 9) args_ok = 0;
1436 if ((currentFunction->ArgTypes[i] % 0x10) == 8) args_ok = 0;
1437 if (((currentFunction->ArgTypes[i] % 0x1000)/0x100 != 0x3)&&
1438 (currentFunction->ArgTypes[i] % 0x1000 != 0x109)&&
1439 ((currentFunction->ArgTypes[i] % 0x1000)/0x100)) args_ok = 0;
1440 if (currentFunction->ArgTypes[i] % 0x1000 == 0x313) args_ok = 0;
1441 if (currentFunction->ArgTypes[i] % 0x1000 == 0x314) args_ok = 0;
1442 if (currentFunction->ArgTypes[i] % 0x1000 == 0x31A) args_ok = 0;
1443 if (currentFunction->ArgTypes[i] % 0x1000 == 0x31B) args_ok = 0;
1444 if (currentFunction->ArgTypes[i] % 0x1000 == 0x31C) args_ok = 0;
1445 if (currentFunction->ArgTypes[i] % 0x1000 == 0x315) args_ok = 0;
1446 if (currentFunction->ArgTypes[i] % 0x1000 == 0x316) args_ok = 0;
1448 if ((currentFunction->ReturnType % 0x10) == 0x8) args_ok = 0;
1449 if (currentFunction->ReturnType % 0x1000 == 0x9) args_ok = 0;
1450 if (((currentFunction->ReturnType % 0x1000)/0x100 != 0x3)&&
1451 (currentFunction->ReturnType % 0x1000 != 0x109)&&
1452 ((currentFunction->ReturnType % 0x1000)/0x100)) args_ok = 0;
1455 /* eliminate unsigned char * and unsigned short * */
1456 if (currentFunction->ReturnType % 0x1000 == 0x313) args_ok = 0;
1457 if (currentFunction->ReturnType % 0x1000 == 0x314) args_ok = 0;
1458 if (currentFunction->ReturnType % 0x1000 == 0x31A) args_ok = 0;
1459 if (currentFunction->ReturnType % 0x1000 == 0x31B) args_ok = 0;
1460 if (currentFunction->ReturnType % 0x1000 == 0x31C) args_ok = 0;
1461 if (currentFunction->ReturnType % 0x1000 == 0x315) args_ok = 0;
1462 if (currentFunction->ReturnType % 0x1000 == 0x316) args_ok = 0;
1464 if (currentFunction->NumberOfArguments &&
1465 (currentFunction->ArgTypes[0] == 0x5000)
1466 &&(currentFunction->NumberOfArguments != 0x1)) args_ok = 0;
1468 /* make sure we have all the info we need for array arguments in */
1469 for (i = 0; i < currentFunction->NumberOfArguments; i++)
1471 if (((currentFunction->ArgTypes[i] % 0x1000)/0x100 == 0x3)&&
1472 (currentFunction->ArgCounts[i] <= 0)&&
1473 (currentFunction->ArgTypes[i] % 0x1000 != 0x309)&&
1474 (currentFunction->ArgTypes[i] % 0x1000 != 0x303)&&
1475 (currentFunction->ArgTypes[i] % 0x1000 != 0x302)) args_ok = 0;
1478 /* if we need a return type hint make sure we have one */
1479 switch (currentFunction->ReturnType % 0x1000)
1481 case 0x301: case 0x307: case 0x30A: case 0x30B: case 0x30C: case 0x30D: case 0x30E:
1482 case 0x304: case 0x305: case 0x306:
1483 args_ok = currentFunction->HaveHint;
1487 /* make sure it isn't a Delete or New function */
1488 if (!strcmp("Delete",currentFunction->Name) ||
1489 !strcmp("New",currentFunction->Name))
1494 /* check for New() function */
1495 if (!strcmp("New",currentFunction->Name) &&
1496 currentFunction->NumberOfArguments == 0)
1501 if (currentFunction->IsPublic && args_ok &&
1502 strcmp(data->ClassName,currentFunction->Name) &&
1503 strcmp(data->ClassName, currentFunction->Name + 1))
1505 wrappedFunctions[numberOfWrappedFunctions] = currentFunction;
1506 numberOfWrappedFunctions++;
1512 /* print the parsed structures */
1513 void vtkParseOutput(FILE *fp, FileInfo *data)
1517 #if defined(IDL_I_HH)
1518 fprintf(fp, "// idl wrapper interface for %s object implementation\n//\n", data->ClassName);
1519 #elif defined(IDL_I_CC)
1520 fprintf(fp, "// idl wrapper implementation for %s object\n//\n", data->ClassName);
1522 fprintf(fp, "// idl wrapper for %s object\n//\n", data->ClassName);
1526 if(strlen(Copyright[i]) != 0)
1528 fprintf(fp,"%s\n",Copyright[i]);
1536 #if defined(IDL_I_HH)
1537 fprintf(fp,"#ifndef PARAVIS_Gen_%s_i_HeaderFile\n",data->ClassName);
1538 fprintf(fp,"#define PARAVIS_Gen_%s_i_HeaderFile\n",data->ClassName);
1540 #elif defined(IDL_I_CC)
1542 fprintf(fp,"#ifndef __PARAVIS_Gen_%s__\n",data->ClassName);
1543 fprintf(fp,"#define __PARAVIS_Gen_%s__\n",data->ClassName);
1547 /* insert function handling code here */
1548 for (i = 0; i < data->NumberOfFunctions; i++)
1550 currentFunction = data->Functions + i;
1551 outputFunction(fp, data);
1554 if (data->NumberOfSuperClasses || !data->IsAbstract)
1556 outputFunction2(fp, data);
1559 #if defined(IDL_I_HH)
1560 fprintf(fp,"\n#endif\n");
1561 #elif defined(IDL_I_CC)
1563 fprintf(fp,"\n#endif\n");