]> OCCT Git - occt-wok.git/commitdiff
No comments
authorcas <cas@opencascade.com>
Tue, 11 Jul 2000 18:15:51 +0000 (18:15 +0000)
committercas <cas@opencascade.com>
Tue, 11 Jul 2000 18:15:51 +0000 (18:15 +0000)
src/CPPJini/CPPJini.cxx
src/CPPJini/CPPJini_ClientInfo.cdl
src/CPPJini/CPPJini_ClientInfo.lxx
src/CPPJini/CPPJini_MPV.cxx
src/CPPJini/CPPJini_Template.edl

index 48aaf71a59d90f7c8bffe9646cdb763a4b108364..3a27cf21fcb987ed696e808f9f469e6ae51c9567 100755 (executable)
@@ -17,6 +17,8 @@
 #include <TColStd_SequenceOfInteger.hxx>
 #include <TColStd_Array1OfInteger.hxx>
 
+#include <Standard_ProgramError.hxx>
+
 #include <limits.h>
 
 #define CPPJINI_BOOLEAN         1
@@ -41,8 +43,8 @@ Handle( TCollection_HAsciiString ) CPPJini_ErrorArgument =
 Handle( TCollection_HAsciiString ) CPPJini_DotReplace ( char*, char = '_' );
 
 static CPPJini_SequenceOfClientInfo s_CltInfo;
-static WOKTools_MapOfHAsciiString   s_CltMap;
 static Standard_Integer             s_UseLevel;
+static WOKTools_MapOfHAsciiString   s_CltMap;
 
 WOKTools_MapOfHAsciiString                   g_ImportMap;
 WOKTools_DataMapOfHAsciiStringOfHAsciiString g_SkipMap;
@@ -307,25 +309,46 @@ static void _CPPJini_FillUses (
 
  ++s_UseLevel;
 
-  Standard_Integer i;
+  Standard_Integer i, j;
 
-  for ( i = 1; i <= use -> Length (); ++i )
+  for ( i = 1; i <= use -> Length (); ++i ) {
 
-   if (   !s_CltMap.Contains (  use -> Value ( i )  )   ) {
+   Handle( MS_Client ) clt;
 
-    Handle( MS_Client ) clt = ms -> GetClient (  use -> Value ( i )  );
+   if (   s_CltMap.Contains (  use -> Value ( i )  )   ) {
 
-    s_CltInfo.Prepend (
-               new CPPJini_ClientInfo (
-                    ms, use -> Value ( i ), s_UseLevel
-                   )
-              );
-    s_CltMap.Add (  use -> Value ( i )  );
-
-    _CPPJini_FillUses (  ms, clt -> Uses ()  );
+    ErrorMsg << "_CPPJini_FillUses"
+             << "Cyclic dependency between clients ( check your 'uses' lists )"
+             << endm;
+    Standard_ProgramError :: Raise ();
 
    }  // end if
 
+   for (  j = 1; j <= s_CltInfo.Length (); ++j  )
+
+    if (   s_CltInfo.Value ( j ) -> Name () -> IsSameString (  use -> Value ( i )  )   ) {
+
+     s_CltInfo.Value ( j ) -> SetLevel (
+                               s_CltInfo.Value ( j ) -> Level () + 1
+                              );
+     goto next;
+
+    }  // end if
+
+   clt = ms -> GetClient (  use -> Value ( i )  );
+
+   s_CltInfo.Prepend (
+              new CPPJini_ClientInfo (
+                   ms, use -> Value ( i ), s_UseLevel
+                  )
+             );
+
+   s_CltMap.Add (  use -> Value ( i )  );
+    _CPPJini_FillUses (  ms, clt -> Uses ()  );
+   s_CltMap.Remove (  use -> Value ( i )  );
+next: continue;
+  }  // end for
+
  if (  i == 1 && s_CltInfo.Length ()  )
 
   s_CltInfo.Value ( 1 ) -> SetRoot ( Standard_True );
@@ -372,7 +395,9 @@ void CPPJini_Init (
  s_CltMap.Clear  ();
 
  s_UseLevel = 0;
- _CPPJini_FillUses ( aMeta, use );
+ s_CltMap.Add ( aName );
+  _CPPJini_FillUses ( aMeta, use );
+ s_CltMap.Remove ( aName );
 
  g_SkipMap.Clear ();
 
@@ -642,7 +667,7 @@ void CPPJini_MethodUsedTypes (
 
   }  // end for
 
-  if ( fEnum ) List -> Append (  new TCollection_HAsciiString ( "Standard_Integer" )  );
+  if ( fEnum ) List -> Append (  new TCollection_HAsciiString ( "Standard_Short" )  );
 
  }  // end if
 
@@ -750,7 +775,7 @@ Handle( TCollection_HAsciiString ) CPPJini_BuildType (
     
   if (   aType -> IsKind (  STANDARD_TYPE( MS_Enum )  )   )
 
-   parname = new TCollection_HAsciiString ( "int" );
+   parname = new TCollection_HAsciiString ( "short" );
 
   result -> AssignCat ( parname );
 
@@ -793,6 +818,7 @@ Standard_Boolean CPPJini_IsCasType (  const Handle( TCollection_HAsciiString )&
  if (  !strcmp ( typeName, "Standard_Byte"         )  ) return Standard_True;
  if (  !strcmp ( typeName, "Standard_ShortReal"    )  ) return Standard_True;
  if (  !strcmp ( typeName, "Standard_Address"      )  ) return Standard_True;
+ if (  !strcmp ( typeName, "Standard_Short"        )  ) return Standard_True;
 
  return Standard_False;
 
@@ -918,11 +944,11 @@ Handle( TCollection_HAsciiString ) CPPJini_BuildParameterList (
 
       if (  aSeq -> Value ( i ) -> IsOut ()  )
 
-       parname = new TCollection_HAsciiString ( "Standard_Integer" );
+       parname = new TCollection_HAsciiString ( "Standard_Short" );
 
       else
 
-       parname = new TCollection_HAsciiString ( "int" );
+       parname = new TCollection_HAsciiString ( "short" );
 
      if (   aType -> IsKind (  STANDARD_TYPE( MS_PrimType )  )   ) {
 
@@ -1140,7 +1166,7 @@ Handle(TCollection_HAsciiString) CPPJini_ConvertToJavaType(const Handle(MS_MetaS
     if (aType->IsKind(STANDARD_TYPE(MS_Enum))) {
       typeprim = CPPJINI_ENUMERATION;
       if (!isout) {
-       result->AssignCat("jint");
+       result->AssignCat("jshort");
       }
       else {
        result->AssignCat("jobject");
@@ -1325,9 +1351,9 @@ void   CPPJini_ArgumentBuilder(const Handle(MS_MetaSchema)& aMeta,
              ArgsInCall->AssignCat("the_");                  
              ArgsInCall->AssignCat(aSeqP->Value(i)->Name());
               api -> AddVariable (  "%EnumName", curtype -> FullName () -> ToCString ()  );
-             api->Apply("%Method","IntegerGetEnumValue");
+             api->Apply("%Method","ShortGetEnumValue");
              ArgsRetrieve->AssignCat(api->GetVariableValue("%Method"));
-             api->Apply("%MetOut","IntegerSetValue");
+             api->Apply("%MetOut","ShortSetValue");
              ArgsOut->AssignCat(api->GetVariableValue("%MetOut"));
              break;
            }
@@ -1844,9 +1870,6 @@ void CPPJini_MethodBuilder(const Handle(MS_MetaSchema)& aMeta,
 
   // c'est fini
 
-  char* var1 = "MethodTemplateDefOBJS";
-  char* var2 = "MethodTemplateDef";
-
   api->AddVariable("%Method",metstart->ToCString());
   api->AddVariable("%MBody",metbody->ToCString());
 
@@ -1854,7 +1877,7 @@ void CPPJini_MethodBuilder(const Handle(MS_MetaSchema)& aMeta,
           "%Method",
           !strcmp (
             api -> GetVariableValue ( "%CPPJiniEXTDBMS" ) -> ToCString (), "OBJS"
-           ) ?  var1 : var2
+           ) ? "MethodTemplateDefOBJS" : "MethodTemplateDef"
          );
 
 }
@@ -2078,14 +2101,14 @@ void CPPJini_Extract (
             << " (already defined in " << cltName << ")" << endm;
 
     g_SkipMap.Bind ( aTypeName, cltName );
-
+#if 0
     if ( fDuplicate )
 
      WarningMsg << "CPPJini"
                 << aTypeName
                 << " defined in more than one client declared in 'uses' statement"
                 << endm;
-
+#endif
     return;
 
    }  // end if
index d0f5e3a7f673d21b4847e01350818b571a2038c0..5c196a01e0d1af05ca33dafe8fd4952d27969d6d 100755 (executable)
@@ -60,6 +60,10 @@ private class ClientInfo from CPPJini inherits Transient from Standard
    --          in the 'uses' hierarchy
    ---C++:     inline
 
+  SetLevel ( me : mutable; aLevel : Integer from Standard );
+   ---Purpose: sets a level of the client in the 'uses' hierarchy
+   ---C++:     inline
+
  fields
 
   myName         : HAsciiString      from TCollection;
index 5ed0cfe341f3ed9281c7fbddfb9cb328ad71d87b..cad005359c7555a779f4bb9b83e950f9cead1330 100755 (executable)
@@ -15,3 +15,9 @@ inline void CPPJini_ClientInfo :: SetRoot ( const Standard_Boolean aRoot )  {
  myRoot = aRoot;
 
 }  // end void CPPJini_ClientInfo :: SetRoot
+
+inline void CPPJini_ClientInfo :: SetLevel ( const Standard_Integer aLevel )  {
+
+ myLevel = aLevel;
+
+}  // end void CPPJini_ClientInfo :: SetLevel
index 58c874db188fd8ea1936a0b0a1fde13c205d25dc..a87e98937d0d216a1d882007958e5911105388cf 100755 (executable)
@@ -394,38 +394,38 @@ void CPPJini_MPVClass (
 
    }  // end else
 
-   if (  CPPJini_Defined ( theClass -> FullName (), aClt )  ) {  // create additional
-                                                                 //  constructors
-    Handle( TCollection_HAsciiString ) aShortClt =
-     new TCollection_HAsciiString ( aClt );
+  } else {
 
-     aShortClt -> RemoveAll ( '.' );
-     api -> AddVariable (  "%ShortPackName", aShortClt             -> ToCString ()  );
-     api -> AddVariable (  "%PackName",      aClt                  -> ToCString ()  );
-     api -> AddVariable (  "%PrevClassName", aClass -> FullName () -> ToCString ()  ); 
+   api -> AddVariable (  "%Inherits", CPPJini_MPVRootName () -> ToCString ()  );
+   api -> AddVariable (  "%Imports",  CPPJini_MPVRootName () -> ToCString ()  );
 
-     Handle( TCollection_HAsciiString ) shortName =
-      new TCollection_HAsciiString (  aClass -> FullName ()  );
+  }  // end else
 
-     shortName -> RemoveAll ( '_' );
+  if (  CPPJini_Defined ( theClass -> FullName (), aClt )  ) {  // create additional
+                                                                 //  constructors
+   Handle( TCollection_HAsciiString ) aShortClt =
+    new TCollection_HAsciiString ( aClt );
 
-     api -> AddVariable (  "%ShortClassName", shortName -> ToCString ()  );
+    aShortClt -> RemoveAll ( '.' );
+    api -> AddVariable (  "%ShortPackName", aShortClt             -> ToCString ()  );
+    api -> AddVariable (  "%PackName",      aClt                  -> ToCString ()  );
+    api -> AddVariable (  "%PrevClassName", aClass -> FullName () -> ToCString ()  ); 
 
-     api -> Apply ( "%thePrevious", "ThePrevious" );
-     api -> Apply ( "%setPrevious", "SetPrevious" );
-     api -> Apply ( "%getPrevious", "GetPrevious" );
-     members -> AssignCat (  api -> GetVariableValue ( "%thePrevious" )  );
-     members -> AssignCat (  api -> GetVariableValue ( "%setPrevious" )  );
-     members -> AssignCat (  api -> GetVariableValue ( "%getPrevious" )  );
+    Handle( TCollection_HAsciiString ) shortName =
+     new TCollection_HAsciiString (  aClass -> FullName ()  );
 
-   }   // end if
+    shortName -> RemoveAll ( '_' );
 
-  } else {
+    api -> AddVariable (  "%ShortClassName", shortName -> ToCString ()  );
 
-   api -> AddVariable (  "%Inherits", CPPJini_MPVRootName () -> ToCString ()  );
-   api -> AddVariable (  "%Imports",  CPPJini_MPVRootName () -> ToCString ()  );
+    api -> Apply ( "%thePrevious", "ThePrevious" );
+    api -> Apply ( "%setPrevious", "SetPrevious" );
+    api -> Apply ( "%getPrevious", "GetPrevious" );
+    members -> AssignCat (  api -> GetVariableValue ( "%thePrevious" )  );
+    members -> AssignCat (  api -> GetVariableValue ( "%setPrevious" )  );
+    members -> AssignCat (  api -> GetVariableValue ( "%getPrevious" )  );
 
-  }  // end else
+  }   // end if
 
   api -> AddVariable (  "%Methods", members -> ToCString ()  );
   api -> AddVariable (  "%Class", theClass -> FullName () -> ToCString ()  );
index 924141aa6b71fc20016db3276442d6e7eccde22b..9fa3f65bd99a7192e62fd4554158d2e600b383d6 100755 (executable)
@@ -361,14 +361,22 @@ $
 
 @template ValueGetValue(%ClassName,%ArgName) is
 $%ClassName* the_%ArgName = (%ClassName*) jcas_GetHandle(env,%ArgName);
+$if ( the_%ArgName == NULL ) {
+$
+$ the_%ArgName = new %ClassName ();
+$ jcas_SetHandle ( env, %ArgName, the_%ArgName );
+$
+$}  // end if
 @end;
 
 @template CStringGetValue(%ArgName) is
-$Standard_CString the_%ArgName = jcas_ConvertToCString(env,%ArgName);
+$TCollection_AsciiString theAscii_%ArgName = jcas_ConvertToCString(env,%ArgName);
+$Standard_CString the_%ArgName = theAscii_%ArgName.ToCString();
 @end;
 
 @template StringGetValue(%ArgName) is
-$Standard_ExtString the_%ArgName = jcas_ConvertToExtString(env,%ArgName);
+$TCollection_ExtendedString theExt_%ArgName = jcas_ConvertToExtString(env,%ArgName);
+$Standard_ExtString the_%ArgName = theExt_%ArgName.ToExtString();
 @end;
 
 @template BooleanGetValue(%ArgName) is
@@ -387,8 +395,8 @@ $Standard_Character the_%ArgName = jcas_GetCharacter(env,%ArgName);
 $Standard_Integer the_%ArgName = jcas_GetInteger(env,%ArgName);
 @end;
 
-@template IntegerGetEnumValue(%ArgName,%EnumName) is
-$%EnumName the_%ArgName = ( %EnumName )jcas_GetInteger ( env, %ArgName );
+@template ShortGetEnumValue(%ArgName,%EnumName) is
+$%EnumName the_%ArgName = ( %EnumName )jcas_GetShort ( env, %ArgName );
 @end;
 
 @template ExtCharacterGetValue(%ArgName) is
@@ -404,7 +412,8 @@ $Standard_ShortReal the_%ArgName = jcas_GetShortReal(env,%ArgName);
 @end;
 
 @template StringBufferGetValue(%ArgName) is
-$Standard_ExtString the_%ArgName = jcas_ConvertSBToExtString(env,%ArgName);
+$TCollection_ExtendedString theExt_%ArgName = jcas_ConvertSBToExtString(env,%ArgName);
+$Standard_ExtString the_%ArgName = theExt_%ArgName.ToExtString();
 @end;
 
 @template ThisTransientGetValue(%ClassName) is
@@ -449,6 +458,10 @@ $jcas_SetReal(env,%ArgName,the_%ArgName);
 $jcas_SetCharacter(env,%ArgName,the_%ArgName);
 @end;
 
+@template ShortSetValue(%ArgName) is
+$jcas_SetShort(env,%ArgName,the_%ArgName);
+@end;
+
 @template IntegerSetValue(%ArgName) is
 $jcas_SetInteger(env,%ArgName,the_%ArgName);
 @end;