From: cas Date: Fri, 22 Oct 1999 18:05:40 +0000 (+0000) Subject: Initial revision X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=7ca8286f0164dd8677ac124a1b92098c48c5fa15;p=occt-wok.git Initial revision --- diff --git a/src/MSAPI/MSAPI.cdl b/src/MSAPI/MSAPI.cdl new file mode 100755 index 0000000..e108903 --- /dev/null +++ b/src/MSAPI/MSAPI.cdl @@ -0,0 +1,39 @@ +-- File: MSAPI.cdl +-- Created: Fri Sep 15 14:26:33 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +package MSAPI + + ---Purpose: Encapsulation of MS package + +uses + MS, + WOKTools +is + + class MetaSchema; + + class Package; + + class Schema; + + class Class; + + class StdClass; + + class GenClass; + + class InstClass; + + -- class Error; + + class Method; + + class MemberMet; + + class ExternMet; + +end MSAPI; diff --git a/src/MSAPI/MSAPI_Class.cdl b/src/MSAPI/MSAPI_Class.cdl new file mode 100755 index 0000000..f0740df --- /dev/null +++ b/src/MSAPI/MSAPI_Class.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_Class.cdl +-- Created: Tue Sep 19 19:35:56 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class Class from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end Class; diff --git a/src/MSAPI/MSAPI_Class.cxx b/src/MSAPI/MSAPI_Class.cxx new file mode 100755 index 0000000..6657b77 --- /dev/null +++ b/src/MSAPI/MSAPI_Class.cxx @@ -0,0 +1,299 @@ +// File: MSAPI_Class.cxx +// Created: Tue Sep 19 19:36:54 1995 +// Author: Jean GAUTIER +// + +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + + char *MSAPI_Class_Info_Options = "tdpNniIucCmrfMPTSe"; + +void MSAPI_Class_Info_Usage(char *cmd) +{ + cerr << "usage : " << cmd << "\n"; + cerr << " -t : type of class\n"; + cerr << " -d : 1 if class is deferred 0 sinon\n"; + cerr << " -p : 1 if class is private 0 sinon\n"; + cerr << " -N : Nesting Class\n"; + cerr << " -n : Is Nested\n"; + cerr << " -i : Base class\n"; + cerr << " -I : Full inheritance\n"; + cerr << " -u : uses of class\n"; + cerr << " -c : fields\n"; + cerr << " -C : fields with their type\n"; + cerr << " -m : methods\n"; + cerr << " -r : raises of class\n"; + cerr << " -f : friends\n"; + cerr << " -M : friend methods\n"; + cerr << " -P : Is Persistent class\n"; + cerr << " -T : Is Transient class\n"; + cerr << " -S : Is Storable class\n"; + cerr << " -e : Is Empty (Incomplete) class\n"; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_Class::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + WOKTools_Options opts(argc, argv, MSAPI_Class_Info_Options, MSAPI_Class_Info_Usage, MSAPI_Class_Info_Options); + Standard_Boolean gettype = Standard_False; + Standard_Boolean deferred = Standard_False; + Standard_Boolean isprivate = Standard_False; + Standard_Boolean getnesting = Standard_False; + Standard_Boolean getisnested = Standard_False; + Standard_Boolean baseclass = Standard_False; + Standard_Boolean inheritance = Standard_False; + Standard_Boolean uses = Standard_False; + Standard_Boolean fields = Standard_False; + Standard_Boolean fullfields = Standard_False; + Standard_Boolean methods = Standard_False; + Standard_Boolean raises = Standard_False; + Standard_Boolean friends = Standard_False; + Standard_Boolean friendmethods = Standard_False; + Standard_Boolean ispersistent = Standard_False; + Standard_Boolean istransient = Standard_False; + Standard_Boolean isstorable = Standard_False; + Standard_Boolean isempty = Standard_False; + Handle(TCollection_HAsciiString) name, astr; + Standard_Integer i; + + while(opts.More()) + { + switch(opts.Option()) + { + case 't': + gettype = Standard_True; + break; + case 'd': + deferred = Standard_True; + break; + case 'p': + isprivate = Standard_True; + break; + case 'N': + getnesting = Standard_True; + break; + case 'n': + getisnested = Standard_True; + break; + case 'i': + baseclass = Standard_True; + break; + case 'I': + inheritance = Standard_True; + break; + case 'u': + uses = Standard_True; + break; + case 'c': + fields = Standard_True; + break; + case 'C': + fullfields = Standard_True; + break; + case 'm': + methods = Standard_True; + break; + case 'r': + raises = Standard_True; + break; + case 'f': + friends = Standard_True; + break; + case 'M': + friendmethods = Standard_True; + break; + case 'P': + ispersistent = Standard_True; + break; + case 'T': + istransient = Standard_True; + break; + case 'S': + isstorable = Standard_True; + break; + case 'e': + isempty = Standard_True; + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_Class_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_Class_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known type name" << endm;; + return 1; + } + + Handle(MS_Type) type = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetType(name); + + if(type->IsKind(STANDARD_TYPE(MS_Class)) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a class name" << endm; + return 1; + } + + Handle(MS_Class) aclass = Handle(MS_Class)::DownCast(type); + + + // OK le nom est bien un nom connu de classe + + // pour deferred et private la classe n'a pas a etre complete dans le MS + + + if(gettype) + { + if(aclass->IsKind(STANDARD_TYPE(MS_Error)) == Standard_True) {values.AddStringValue("error"); return 0;} + if(aclass->IsKind(STANDARD_TYPE(MS_StdClass)) == Standard_True) + { + Handle(MS_StdClass) astdclass = Handle(MS_StdClass)::DownCast(aclass); + + if(astdclass->GetMyCreator().IsNull()) + { + values.AddStringValue("stdclass"); + return 0; + } + else + { + values.AddStringValue("instclass"); + return 0; + } + } + if(aclass->IsKind(STANDARD_TYPE(MS_GenClass)) == Standard_True) {values.AddStringValue("genclass"); return 0;} + if(aclass->IsKind(STANDARD_TYPE(MS_InstClass)) == Standard_True) {values.AddStringValue("instclass"); return 0;} + ErrorMsg << argv[0] << "Unknown class type of " << aclass->FullName() << endm; + return 1; + } + + if(deferred||isprivate||ispersistent||istransient||isstorable||isempty||getisnested) + { + if(deferred) values.AddBooleanValue(aclass->Deferred()); + if(isprivate) values.AddBooleanValue(aclass->Private()); + if(ispersistent) values.AddBooleanValue(aclass->IsPersistent()); + if(istransient) values.AddBooleanValue(aclass->IsTransient()); + if(isstorable) values.AddBooleanValue(aclass->IsStorable()); + if(isempty) values.AddBooleanValue(aclass->Incomplete()); + if(getisnested) values.AddBooleanValue(aclass->IsNested()); + return 0; + } + + // pour les infos suivantes la classe doit etre complete + + if(aclass->Incomplete() == Standard_True) + { + ErrorMsg << argv[0] << "Class (" << name->ToCString() << ") is incomplete" << endm; + return 1; + } + + Handle(TColStd_HSequenceOfHAsciiString) aseq; + + if(baseclass) + { + aseq = aclass->GetInheritsNames(); + + if(aseq->Length() > 0) + values.AddStringValue(aseq->Value(1)); + return 0; + } + + if(getnesting) + { + astr = aclass->GetNestingClass(); + if(astr.IsNull() == Standard_False) + { + values.AddStringValue(astr); + } + return 0; + } + + if(fields||fullfields) + { + Handle(MS_HSequenceOfField) aseq = aclass->GetFields(); + + for(i=1; i<=aseq->Length(); i++) + { + if(fullfields) + { + astr = new TCollection_HAsciiString(aseq->Value(i)->TYpe()); + astr->AssignCat(" "); + astr->AssignCat(aseq->Value(i)->FullName()); + values.AddStringValue(astr); + } + else + { + values.AddStringValue(aseq->Value(i)->FullName()); + } + } + return 0; + } + + if(inheritance||uses||friends||friendmethods||raises) + { + + if(inheritance) aseq = aclass->GetFullInheritsNames(); + if(uses) aseq = aclass->GetUsesNames(); + if(friends) aseq = aclass->GetFriendsNames(); + if(friendmethods) aseq = aclass->GetFriendMets(); + if(raises) aseq = aclass->GetRaises(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + + if(methods) + { + Handle(MS_HSequenceOfMemberMet) aseq = aclass->GetMethods(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)->FullName()); + } + return 0; + } + return 0; +} + diff --git a/src/MSAPI/MSAPI_ExternMet.cdl b/src/MSAPI/MSAPI_ExternMet.cdl new file mode 100755 index 0000000..160a7b8 --- /dev/null +++ b/src/MSAPI/MSAPI_ExternMet.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_ExternMet.cdl +-- Created: Tue Sep 19 22:14:22 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class ExternMet from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end ExternMet; diff --git a/src/MSAPI/MSAPI_ExternMet.cxx b/src/MSAPI/MSAPI_ExternMet.cxx new file mode 100755 index 0000000..8fe44b2 --- /dev/null +++ b/src/MSAPI/MSAPI_ExternMet.cxx @@ -0,0 +1,99 @@ +// File: MSAPI_ExternMet.cxx +// Created: Tue Sep 19 22:42:02 1995 +// Author: Jean GAUTIER +// + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +extern char *MSAPI_Method_Info_Options; +extern void MSAPI_Method_Info_Usage(char *cmd); + +void MSAPI_ExternMet_Info_Usage(char *cmd) +{ + MSAPI_Method_Info_Usage(cmd); +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_ExternMet::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + + Handle(TCollection_HAsciiString) name; + Standard_Boolean methodoption; + TCollection_AsciiString astr(MSAPI_Method_Info_Options); + + astr.AssignCat(""); + + WOKTools_Options opts(argc, argv, astr.ToCString(), MSAPI_ExternMet_Info_Usage, astr.ToCString()); + + while(opts.More()) + { + if(strchr(MSAPI_Method_Info_Options, opts.Option())) + { + methodoption = Standard_True; + } + else + { + switch(opts.Option()) + { + } + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_ExternMet_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_ExternMet_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsMethod(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known method name" << endm; + return 1; + } + + Handle(MS_Method) method = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetMethod(name); + + if(method->IsKind(STANDARD_TYPE(MS_ExternMet)) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a extern method name" << endm; + return 1; + } + + if(methodoption) + { + return MSAPI_Method::Info(argc, argv, values); + } + + return 0; +} + diff --git a/src/MSAPI/MSAPI_GenClass.cdl b/src/MSAPI/MSAPI_GenClass.cdl new file mode 100755 index 0000000..59b6be6 --- /dev/null +++ b/src/MSAPI/MSAPI_GenClass.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_GenClass.cdl +-- Created: Tue Sep 19 21:05:50 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class GenClass from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end GenClass; diff --git a/src/MSAPI/MSAPI_GenClass.cxx b/src/MSAPI/MSAPI_GenClass.cxx new file mode 100755 index 0000000..544d150 --- /dev/null +++ b/src/MSAPI/MSAPI_GenClass.cxx @@ -0,0 +1,146 @@ +// File: MSAPI_GenClass.cxx +// Created: Tue Sep 19 21:06:38 1995 +// Author: Jean GAUTIER +// + + + +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + + +#include + +extern void MSAPI_Class_Info_Usage(char *cmd); +extern char *MSAPI_Class_Info_Options; + +void MSAPI_GenClass_Info_Usage(char *cmd) +{ + MSAPI_Class_Info_Usage(cmd); + cerr << " -n : nested classes\n"; + cerr << " -g : generic type\n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_GenClass::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + Standard_Boolean nesteds = Standard_False; + Standard_Boolean gentypes = Standard_False; + Standard_Boolean classoption = Standard_False; + Handle(TCollection_HAsciiString) name; + Standard_Integer i; + TCollection_AsciiString astr(MSAPI_Class_Info_Options); + + astr.AssignCat("ng"); + WOKTools_Options opts(argc, argv, astr.ToCString(), MSAPI_GenClass_Info_Usage, astr.ToCString()); + + while(opts.More()) + { + switch(opts.Option()) + { + case 'd': + case 'p': + case 'i': + case 'I': + case 'u': + case 'c': + case 'C': + case 'm': + case 'r': + case 'f': + case 'M': + classoption = Standard_True; + break; + case 'n': + nesteds = Standard_True; + break; + case 'g': + gentypes = Standard_True; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_GenClass_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_GenClass_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known type name" << endm; + return 1; + } + + Handle(MS_Type) type = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetType(name); + + if(type->IsKind(STANDARD_TYPE(MS_GenClass)) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a class name" << endm; + return 1; + } + + if(classoption) + { + return MSAPI_Class::Info(argc, argv, values); + } + + Handle(MS_GenClass) aclass = Handle(MS_GenClass)::DownCast(type); + + if(nesteds) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = aclass->GetNestedName(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + + if(gentypes) + { + Handle(MS_HSequenceOfGenType) aseq = aclass->GenTypes(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)->FullName()); + } + return 0; + } + + return 0; +} + diff --git a/src/MSAPI/MSAPI_InstClass.cdl b/src/MSAPI/MSAPI_InstClass.cdl new file mode 100755 index 0000000..7a3b9cd --- /dev/null +++ b/src/MSAPI/MSAPI_InstClass.cdl @@ -0,0 +1,19 @@ +-- File: MSAPI_InstClass.cdl +-- Created: Tue Sep 19 21:25:48 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + +class InstClass from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end InstClass; diff --git a/src/MSAPI/MSAPI_InstClass.cxx b/src/MSAPI/MSAPI_InstClass.cxx new file mode 100755 index 0000000..e3a6827 --- /dev/null +++ b/src/MSAPI/MSAPI_InstClass.cxx @@ -0,0 +1,186 @@ +// File: MSAPI_InstClass.cxx +// Created: Tue Sep 19 21:26:20 1995 +// Author: Jean GAUTIER +// + + +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + +#include + + +extern void MSAPI_Class_Info_Usage(char *cmd); +extern char *MSAPI_Class_Info_Options; + +void MSAPI_InstClass_Info_Usage(char *cmd) +{ + MSAPI_Class_Info_Usage(cmd); + cerr << " -g : generic class\n"; + cerr << " -G : generic types\n"; + cerr << " -s : inStantiation types\n"; + cerr << " -a : nested intantiation classes\n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_InstClass::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + + Standard_Boolean genclass = Standard_False; + Standard_Boolean insttypes = Standard_False; + Standard_Boolean gentypes = Standard_False; + Standard_Boolean nesteds = Standard_False; + Standard_Boolean nesting = Standard_False; + Standard_Boolean classoption = Standard_False; + Handle(TCollection_HAsciiString) name; + Standard_Integer i; + TCollection_AsciiString astr(MSAPI_Class_Info_Options); + + astr.AssignCat("gGsa"); + WOKTools_Options opts(argc, argv, astr.ToCString(), MSAPI_InstClass_Info_Usage, astr.ToCString()); + + while(opts.More()) + { + if(strchr(MSAPI_Class_Info_Options, opts.Option())) + { + classoption = Standard_True; + } + else + { + switch(opts.Option()) + { + case 'g': + genclass = Standard_True; + break; + case 'G': + gentypes = Standard_True; + break; + case 's': + insttypes = Standard_True; + break; + case 'a': + nesteds = Standard_True; + break; + } + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_InstClass_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_InstClass_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known type name" << endm; + return 1; + } + + Handle(MS_Type) type = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetType(name); + + if(classoption) + { + return MSAPI_Class::Info(argc, argv, values); + } + + Handle(MS_InstClass) aclass; + + + if(type->IsKind(STANDARD_TYPE(MS_StdClass))) + { + aclass = Handle(MS_StdClass)::DownCast(type)->GetMyCreator(); + } + else + { + aclass = Handle(MS_InstClass)::DownCast(type); + } + + if(aclass.IsNull()) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a Instantiation name" << endm; + return 1; + } + + if(genclass) + { + values.AddStringValue(aclass->GenClass()); + return 0; + } + + if(insttypes) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = aclass->InstTypes(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + if(gentypes) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = aclass->GenTypes(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + + if(nesteds) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = aclass->GetNestedStdClassesName(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + + aseq = aclass->GetNestedInsClassesName(); + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + + return 0; + } + + return 0; +} + diff --git a/src/MSAPI/MSAPI_MemberMet.cdl b/src/MSAPI/MSAPI_MemberMet.cdl new file mode 100755 index 0000000..6b70d35 --- /dev/null +++ b/src/MSAPI/MSAPI_MemberMet.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_MemberMet.cdl +-- Created: Tue Sep 19 22:13:54 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class MemberMet from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools +is + + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end MemberMet; diff --git a/src/MSAPI/MSAPI_MemberMet.cxx b/src/MSAPI/MSAPI_MemberMet.cxx new file mode 100755 index 0000000..40e0c73 --- /dev/null +++ b/src/MSAPI/MSAPI_MemberMet.cxx @@ -0,0 +1,116 @@ +// File: MSAPI_MemberMet.cxx +// Created: Tue Sep 19 22:41:53 1995 +// Author: Jean GAUTIER +// + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + + +extern char *MSAPI_Method_Info_Options; +extern void MSAPI_Method_Info_Usage(char *cmd); + +void MSAPI_MemberMet_Info_Usage(char *cmd) +{ + MSAPI_Method_Info_Usage(cmd); + cerr << " -P : is protected ?\n"; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_MemberMet::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + Handle(TCollection_HAsciiString) name; + Standard_Boolean methodoption = Standard_False; + Standard_Boolean isprotected = Standard_False; + TCollection_AsciiString astr(MSAPI_Method_Info_Options); + + astr.AssignCat("P"); + + WOKTools_Options opts(argc, argv, astr.ToCString(), MSAPI_MemberMet_Info_Usage, astr.ToCString()); + + while(opts.More()) + { + if(strchr(MSAPI_Method_Info_Options, opts.Option())) + { + methodoption = Standard_True; + } + else + { + switch(opts.Option()) + { + case 'P': + isprotected = Standard_True; + break; + } + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_MemberMet_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_MemberMet_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsMethod(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name << ") is not a known method name" << endm; + return 1; + } + + Handle(MS_Method) method = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetMethod(name); + + if(method->IsKind(STANDARD_TYPE(MS_MemberMet)) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name << ") is not a member method name" << endm; + return 1; + } + + if(methodoption) + { + return MSAPI_Method::Info(argc, argv, values); + } + + Handle(MS_MemberMet) membermet = Handle(MS_MemberMet)::DownCast(method); + + if(isprotected) + { + if(membermet->IsProtected()) values.AddStringValue("1"); + else values.AddStringValue("0"); + return 0; + } + return 0; +} + + + + + diff --git a/src/MSAPI/MSAPI_MetaSchema.cdl b/src/MSAPI/MSAPI_MetaSchema.cdl new file mode 100755 index 0000000..065b415 --- /dev/null +++ b/src/MSAPI/MSAPI_MetaSchema.cdl @@ -0,0 +1,35 @@ +-- File: MSAPI_MetaSchema.cdl +-- Created: Fri Sep 15 14:28:03 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class MetaSchema from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools +is + + Translate(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + Check(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + Extract(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + Remove(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + Clear(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end MetaSchema; diff --git a/src/MSAPI/MSAPI_MetaSchema.cxx b/src/MSAPI/MSAPI_MetaSchema.cxx new file mode 100755 index 0000000..9d15c1c --- /dev/null +++ b/src/MSAPI/MSAPI_MetaSchema.cxx @@ -0,0 +1,695 @@ +// File: MSAPI_MetaSchema.cxx +// Created: Fri Sep 15 14:33:17 1995 +// Author: Jean GAUTIER +// + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#define MAX_ARGCHAR 512 + +Standard_IMPORT void MS_ClearMapOfName(); +extern Standard_IMPORT MMgt_StorageManager aStorageManager; + +//======================================================================= +//Author : Jean Gautier (jga) +//function : SearchFile +//purpose : +//======================================================================= +Handle(WOKUtils_Path) SearchFile(const Handle(TCollection_HAsciiString)& afile, const Handle(TColStd_HSequenceOfHAsciiString)& aseq) +{ + Standard_Integer i; + Handle(WOKUtils_Path) apath; + Handle(TCollection_HAsciiString) astr; + + // d'abord regarder si on ne le trouve pas + apath = new WOKUtils_Path(afile); + if(apath->Exists() == Standard_True) + { + return apath; + } + + + // rechercher ensuite dans les -I + for(i=1; i<=aseq->Length(); i++) + { + astr = new TCollection_HAsciiString(aseq->Value(i)); + + astr->AssignCat("/"); + astr->AssignCat(afile); + + apath = new WOKUtils_Path(astr); + + if(apath->Exists() == Standard_True) return apath; + + } + return Handle(WOKUtils_Path)(); +} + + + +//======================================================================= +//Author : Jean Gautier (jga) +//function : SearchEntity +//purpose : +//======================================================================= +Handle(WOKUtils_Path) SearchEntity(const Handle(TCollection_HAsciiString)& anentity, const Handle(TColStd_HSequenceOfHAsciiString)& aseq) +{ + Handle(TCollection_HAsciiString) astr = new TCollection_HAsciiString(anentity); + astr->AssignCat(".cdl"); + + return SearchFile(astr, aseq); +} + +void MSAPI_MetaSchema_CDLTranslate_Usage(char *cmd) +{ + cerr << "usage : " << cmd << " [-v] [-I] -e -t \n"; + cerr << " -v : verbose mode\n"; + cerr << " -I : directory to search files\n"; + cerr << " -p : package translation\n"; + cerr << " -i : interface translation\n"; + cerr << " -t : Type translation\n"; + cerr << " -L : shared object path\n"; + cerr << " -T : Translator name\n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : CDLTranslate +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Translate(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& ) +{ + WOKTools_Options opts(argc, argv, "vI:p:i:t:L:T:", MSAPI_MetaSchema_CDLTranslate_Usage); + Standard_Boolean averbose = Standard_False; + Handle(TColStd_HSequenceOfHAsciiString) incdirectives = new TColStd_HSequenceOfHAsciiString; + Handle(TCollection_HAsciiString) package; + Handle(TCollection_HAsciiString) interface; + Handle(TCollection_HAsciiString) allentity; + Handle(TCollection_HAsciiString) type; + Handle(TCollection_HAsciiString) afile; + Handle(TCollection_HAsciiString) thefile; + Handle(TCollection_HAsciiString) shared; + Handle(TCollection_HAsciiString) name; + Handle(WOKUtils_Path) apath; + + while(opts.More()) + { + switch(opts.Option()) + { + case 'v': + averbose = Standard_True; + break; + case 'I': + incdirectives->Append(opts.OptionArgument()); + break; + case 'f': + thefile = opts.OptionArgument(); + break; + case 'p': + package = opts.OptionArgument(); + break; + case 'i': + interface = opts.OptionArgument(); + break; + case 't': + type = opts.OptionArgument(); + break; + case 'L': + shared = opts.OptionArgument(); + break; + case 'T': + name = opts.OptionArgument(); + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + Handle(TColStd_HSequenceOfHAsciiString) entities = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) inctypes = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) instypes = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) gentypes = new TColStd_HSequenceOfHAsciiString; + + if(!opts.Arguments().IsNull()) + { + + switch(opts.Arguments()->Length()) + { + case 0: + break; + default: + MSAPI_MetaSchema_CDLTranslate_Usage(argv[0]); + return 1; + } + } + + Handle(WOKBuilder_MSTranslator) acdlt = new WOKBuilder_MSTranslator(name, shared); + + acdlt->Load(); + acdlt->SetMSchema(WOKBuilder_MSTool::GetMSchema()); + + Handle(WOKBuilder_Specification) cdlfile; + + WOKBuilder_MSTranslatorIterator anit(WOKBuilder_MSTool::GetMSchema()); + + if(!package.IsNull()) + { + anit.AddInStack(package, WOKBuilder_Package); + } + if(!interface.IsNull()) + { + anit.AddInStack(interface, WOKBuilder_Interface); + } + if(!type.IsNull()) + { + anit.AddInStack(WOKBuilder_MSTool::GetMSchema()->AssociatedEntity(type), WOKBuilder_DirectUses); + anit.AddInStack(type, WOKBuilder_CompleteType); + } + + while(anit.More()) + { + Handle(WOKBuilder_MSAction) action = anit.Value(); + + afile = WOKBuilder_MSTool::GetMSchema()->AssociatedFile(action->Entity()->Name()); + + apath = SearchFile(afile,incdirectives); + + cdlfile = new WOKBuilder_CDLFile(apath); + + if(!apath.IsNull()) + { + anit.Execute(acdlt, action, cdlfile); + } + else + { + WarningMsg << argv[0] << "No file for : " << action->Entity()->Name() << endm; + } + anit.Next(); + } + + return 0; +} + +void MSAPI_MetaSchema_Check_Usage(char *cmd) +{ + cerr << "usage : " << cmd << " \n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Check +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Check(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return&) +{ + WOKTools_Options opts(argc, argv, "", MSAPI_MetaSchema_Check_Usage); + Handle(TCollection_HAsciiString) aname; + + while(opts.More()) + { + switch(opts.Option()) + { + default: + break; + } + opts.Next(); + } + + if(opts.Failed()) return 1; + + switch(opts.Arguments()->Length()) + { + case 1: + aname = opts.Arguments()->Value(1); + break; + default: + MSAPI_MetaSchema_Check_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->Check(aname)) + { + InfoMsg << argv[0] << aname << " successfully checked" << endm; + } + else + { + ErrorMsg << argv[0] << aname << " check has failed" << endm; + } + return 0; +} + +void MSAPI_MetaSchema_Extract_Usage(char *cmd) +{ + cerr << "usage : " << cmd << "\n"; + cerr << " -E : Extractor name\n"; + cerr << " -I : Search path for EDL Files\n"; + cerr << " -L : Load Dynamic Library\n"; + cerr << " -o : Output dir\n"; + cerr << " -e : Extract global entity\n"; + cerr << " -t : Extract Type\n"; + cerr << " -a : Extract entity and its nested types\n"; +} + + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Extract +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Extract(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& ) +{ + WOKTools_Options opts(argc, argv, "E:I:L:o:e:t:a:", MSAPI_MetaSchema_Extract_Usage); + Handle(TCollection_HAsciiString) aname; + Handle(TCollection_HAsciiString) ashared; + Handle(TCollection_HAsciiString) anoutdir; + Standard_Boolean entity = Standard_False; + Standard_Boolean type = Standard_False; + Standard_Boolean all = Standard_False; + Handle(TColStd_HSequenceOfHAsciiString) entities = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) types = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) alls = new TColStd_HSequenceOfHAsciiString; + Handle(TColStd_HSequenceOfHAsciiString) searchlist = new TColStd_HSequenceOfHAsciiString; + Handle(MS_Package) apk; + Standard_Integer i,j; + + while(opts.More()) + { + switch(opts.Option()) + { + case 'E': + aname = opts.OptionArgument(); + break; + case 'I': + searchlist->Append(opts.OptionArgument()); + break; + case 'L': + ashared = opts.OptionArgument(); + break; + case 'o': + anoutdir = opts.OptionArgument(); + break; + case 'e': + entity = Standard_True; + entities->Append(opts.OptionArgument()); + break; + case 't': + type = Standard_True; + types->Append(opts.OptionArgument()); + break; + case 'a': + all = Standard_True; + alls->Append(opts.OptionArgument()); + break; + } + opts.Next(); + } + + if(opts.Failed()) return 1; + + switch(opts.Arguments()->Length()) + { + case 0: + break; + default: + MSAPI_MetaSchema_Extract_Usage(argv[0]); + return 1; + } + + Handle(WOKBuilder_HSequenceOfEntity) extr_entities = new WOKBuilder_HSequenceOfEntity; + + if(entity) + { + for(i=1; i<=entities->Length(); i++) + { + extr_entities->Append(new WOKBuilder_MSEntity(entities->Value(i))); + } + } + if(type) + { + for(i=1; i<=types->Length(); i++) + { + extr_entities->Append(new WOKBuilder_MSEntity(types->Value(i))); + } + } + if(all) + { + Handle(TCollection_HAsciiString) fullname; + + for(i=1; i<=alls->Length(); i++) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq; + + aseq = WOKBuilder_MSTool::GetMSchema()->GetEntityTypes(alls->Value(i)); + + for(j=1; j<=aseq->Length(); j++) + { + extr_entities->Append(new WOKBuilder_MSEntity(aseq->Value(j))); + } + } + } + + Handle(WOKBuilder_MSExtractor) anextractor;// = new WOKBuilder_MSExtractor(aname, ashared, searchlist); + Handle(WOKBuilder_HSequenceOfEntity) aseq; + Handle(WOKBuilder_MSEntity) theentity; + + anextractor->Load(); + anextractor->SetOutputDir(new WOKUtils_Path(anoutdir)); + + + WOKBuilder_MSExtractorIterator anit(WOKBuilder_MSTool::GetMSchema(), + anextractor); + + + for(j=1; j<=extr_entities->Length(); j++) + { + theentity = Handle(WOKBuilder_MSEntity)::DownCast(extr_entities->Value(j)); + + InfoMsg << argv[0] << "Extracting : " << theentity->Name() << endm; + + anit.Execute(theentity); + + aseq = anextractor->Produces(); + + for(Standard_Integer i=1; i<=aseq->Length(); i++) + { + InfoMsg << argv[0] << "File " << aseq->Value(i)->Path()->Name() << " is extracted" << endm; + } + + } + return 0; +} + +void MSAPI_MetaSchema_Info_Usage(char *cmd) +{ + cerr << "usage : " << cmd << "\n"; + cerr << " -p : package list\n"; + cerr << " -s : schema list\n"; + cerr << " -i : interface list\n"; + cerr << " -e : engine list\n"; + cerr << " -x : executable list\n"; + cerr << " -a : all global entity list\n"; + cerr << " -t : all type list\n"; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + WOKTools_Options opts(argc, argv, "psiexatf:", MSAPI_MetaSchema_Info_Usage, "atf"); + Standard_Boolean packages = Standard_False; + Standard_Boolean schemas = Standard_False; + Standard_Boolean interfaces = Standard_False; + Standard_Boolean engines = Standard_False; + Standard_Boolean executables = Standard_False; + Standard_Boolean all = Standard_False; + Standard_Boolean types = Standard_False; + Handle(TCollection_HAsciiString) anentityname; + + + while(opts.More()) + { + switch(opts.Option()) + { + case 'p': + packages = Standard_True; + break; + case 's': + schemas = Standard_True; + break; + case 'i': + interfaces = Standard_True; + break; + case 'e': + engines = Standard_True; + break; + case 'x': + executables = Standard_True; + break; + case 'a': + all = Standard_True; + break; + case 't': + types = Standard_True; + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_False) + { + switch(opts.Arguments()->Length()) + { + case 0: + break; + default: + MSAPI_MetaSchema_Info_Usage(argv[0]); + return 1; + } + } + + Handle(MS_MetaSchema) ameta = WOKBuilder_MSTool::GetMSchema()->MetaSchema(); + Handle(TColStd_HSequenceOfHAsciiString) aseq; + + if(types) + { + MS_DataMapIteratorOfMapOfType anit = ameta->Types(); + + while(anit.More()) + { + values.AddStringValue(anit.Key()); + anit.Next(); + } + return 0; + } + + + if(packages||interfaces||schemas||engines||executables||all) + { + MS_DataMapIteratorOfMapOfGlobalEntity anit; + + if(packages||all) {anit = ameta->Packages(); while(anit.More()){values.AddStringValue(anit.Key());anit.Next();}} + if(interfaces||all) {anit = ameta->Interfaces(); while(anit.More()){values.AddStringValue(anit.Key());anit.Next();}} + if(schemas||all) {anit = ameta->Schemas(); while(anit.More()){values.AddStringValue(anit.Key());anit.Next();}} + if(executables||all) {anit = ameta->Executables(); while(anit.More()){values.AddStringValue(anit.Key());anit.Next();}} + if(engines||all) {anit = ameta->Engines(); while(anit.More()){values.AddStringValue(anit.Key());anit.Next();}} + + return 0; + } + + return 0; +} + +void MSAPI_MetaSchema_Remove_Usage(char *cmd) +{ + cerr << "usage : " << cmd << " [-e|-t] \n"; + cerr << " -e : Remove global entity\n"; + cerr << " -t : Remove Type\n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Remove +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Remove(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& ) +{ + WOKTools_Options opts(argc, argv, "ie:t:", MSAPI_MetaSchema_Remove_Usage, "et"); + Standard_Boolean entity = Standard_False; + Standard_Boolean type = Standard_False; + Handle(TCollection_HAsciiString) name; + + while(opts.More()) + { + switch(opts.Option()) + { + case 'e': + entity = Standard_True; + name = opts.OptionArgument(); + break; + case 't': + type = Standard_True; + name = opts.OptionArgument(); + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_False) + { + switch(opts.Arguments()->Length()) + { + case 0: + break; + default: + MSAPI_MetaSchema_Remove_Usage(argv[0]); + return 1; + } + } + + Handle(WOKBuilder_MSchema) ameta = WOKBuilder_MSTool::GetMSchema(); + + if(entity) + { + if(ameta->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name << ") is unknown" << endm; + return 1; + } + ameta->RemoveEntity(name); + return 0; + } + if(type) + { + if(ameta->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name << ") is unknown" << endm; + return 1; + } + ameta->RemoveType(name); + return 0; + } + return 0; +} + +void MSAPI_MetaSchema_Clear_Usage(char *cmd) +{ + cerr << "usage : " << cmd << "\n"; + return; +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Clear +//purpose : +//======================================================================= +Standard_Integer MSAPI_MetaSchema::Clear(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& ) +{ + WOKTools_Options opts(argc, argv, "awmnpS", MSAPI_MetaSchema_Clear_Usage); + Standard_Boolean + autotypes = Standard_False, woksd = Standard_False, meta = Standard_False, names = Standard_False, showmemory = Standard_False, purge = Standard_False; + + + while(opts.More()) + { + switch (opts.Option()) + { + case 'a': + autotypes = Standard_True; + break; + case 'w': + woksd = Standard_True; + break; + case 'm': + meta = Standard_True; + break; + case 'n': + names = Standard_True; + break; + case 'S': + showmemory = Standard_True; + break; + case 'P': + purge = Standard_True; + break; + default: + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(!autotypes && !woksd && !meta && !names && !showmemory && !purge) + { + MS_ClearMapOfName(); + WOKBuilder_MSTool::GetMSchema()->Clear(); + aStorageManager.Purge(); + } + else + { + if(autotypes) + { + WOKBuilder_MSTool::GetMSchema()->RemoveAutoTypes(); + } + if(woksd) + { + Handle(MS_MetaSchema) ameta = WOKBuilder_MSTool::GetMSchema()->MetaSchema(); + WOKBuilder_MSTool::GetMSchema()->Clear(); + + *((Handle(MS_MetaSchema) *) &(WOKBuilder_MSTool::GetMSchema()->MetaSchema())) = ameta; + } + if(meta) + { + (*((Handle(MS_MetaSchema) *) &(WOKBuilder_MSTool::GetMSchema()->MetaSchema()))).Nullify(); + } + if(names) + { + MS_ClearMapOfName(); + } + if(showmemory) + { + aStorageManager.ShallowDump(cout); + } + if(purge) + { + aStorageManager.Purge(); + } + } + + return 0; +} + diff --git a/src/MSAPI/MSAPI_Method.cdl b/src/MSAPI/MSAPI_Method.cdl new file mode 100755 index 0000000..7fbe1e3 --- /dev/null +++ b/src/MSAPI/MSAPI_Method.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_Method.cdl +-- Created: Tue Sep 19 22:13:12 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class Method from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end Method; diff --git a/src/MSAPI/MSAPI_Method.cxx b/src/MSAPI/MSAPI_Method.cxx new file mode 100755 index 0000000..3d4f211 --- /dev/null +++ b/src/MSAPI/MSAPI_Method.cxx @@ -0,0 +1,200 @@ +// File: MSAPI_Method.cxx +// Created: Tue Sep 19 22:14:50 1995 +// Author: Jean GAUTIER +// + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include + +#include + +#include +#include + +#include + +#include + +char *MSAPI_Method_Info_Options = "tnaprRicAfd"; + +void MSAPI_Method_Info_Usage(char *cmd) +{ + cerr << "usage : " << cmd << " \n"; + cerr << " -t : type of method (externmet, membermet)\n"; + cerr << " -n : name of method\n"; + cerr << " -a : parameters\n"; + cerr << " -p : private ?\n"; + cerr << " -r : return type\n"; + cerr << " -R : raises\n"; + cerr << " -i : inline ?\n"; + cerr << " -c : const return ?\n"; + cerr << " -A : alias ?\n"; + cerr << " -f : reF return ?\n"; + cerr << " -d : destructor ?\n"; + return; +} + + +Standard_Integer MSAPI_Method::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + WOKTools_Options opts(argc, argv, MSAPI_Method_Info_Options, MSAPI_Method_Info_Usage, MSAPI_Method_Info_Options); + Standard_Boolean gettype = Standard_False; + Standard_Boolean getname = Standard_False; + Standard_Boolean params = Standard_False; + Standard_Boolean isprivate = Standard_False; + Standard_Boolean returns = Standard_False; + Standard_Boolean raises = Standard_False; + Standard_Boolean isinline = Standard_False; + Standard_Boolean constret = Standard_False; + Standard_Boolean alias = Standard_False; + Standard_Boolean refreturn = Standard_False; + Standard_Boolean destructs = Standard_False; + Handle(TCollection_HAsciiString) name; + Standard_Integer i; + + while(opts.More()) + { + switch(opts.Option()) + { + case 't': + gettype = Standard_True; + break; + case 'n': + getname = Standard_True; + case 'a': + params = Standard_True; + break; + case 'p': + isprivate = Standard_True; + break; + case 'r': + returns = Standard_True; + break; + case 'R': + raises = Standard_True; + break; + case 'i': + isinline = Standard_True; + break; + case 'c': + constret = Standard_True; + break; + case 'A': + alias = Standard_True; + break; + case 'f': + refreturn = Standard_True; + break; + case 'd': + destructs = Standard_True; + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_Method_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_Method_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsMethod(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known method name" << endm; + return 1; + } + + Handle(MS_Method) method = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetMethod(name); + + if(isprivate||isinline||constret||refreturn||destructs) + { + Standard_Boolean retvalue; + + if(isprivate) retvalue = method->Private(); + if(isinline) retvalue = method->IsInline(); + if(constret) retvalue = method->IsConstReturn(); + if(alias) retvalue = method->IsAlias().IsNull(); + if(refreturn) retvalue = method->IsRefReturn(); + if(destructs) retvalue = method->IsDestructor(); + + if(retvalue) values.AddStringValue("1"); + else values.AddStringValue("0"); + return 0; + } + + if(alias) + { + if(method->IsAlias().IsNull()) + { + values.AddStringValue(new TCollection_HAsciiString); + } + else + { + values.AddStringValue(method->IsAlias()); + } + return 0; + } + + if(getname) + { + values.AddStringValue(method->Name()); + return 0; + } + + if(returns) + { + if(method->Returns().IsNull() == Standard_False) + { + values.AddStringValue(method->Returns()->TypeName()); + } + return 0; + } + + if(gettype) + { + if(method->IsKind(STANDARD_TYPE(MS_MemberMet))) {values.AddStringValue("membermet");return 0;} + if(method->IsKind(STANDARD_TYPE(MS_ExternMet))) {values.AddStringValue("externmet");return 0;} + ErrorMsg << argv[0] << "Unknown method type of " << method->FullName() << endm; + return 1; + } + + if(params) + { + Handle(MS_HArray1OfParam) aseq = method->Params(); + Handle(TCollection_HAsciiString) astr; + + if(!aseq.IsNull()) + { + for(i=1; i<=aseq->Length(); i++) + { + astr = new TCollection_HAsciiString(aseq->Value(i)->TypeName()); + astr->AssignCat(" "); + astr->AssignCat(aseq->Value(i)->FullName()); + values.AddStringValue(astr); + } + } + return 0; + } + + return 0; +} + diff --git a/src/MSAPI/MSAPI_Package.cdl b/src/MSAPI/MSAPI_Package.cdl new file mode 100755 index 0000000..5fcf87f --- /dev/null +++ b/src/MSAPI/MSAPI_Package.cdl @@ -0,0 +1,22 @@ +-- File: MSAPI_Package.cdl +-- Created: Mon Sep 18 10:27:26 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class Package from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + + +end Package; diff --git a/src/MSAPI/MSAPI_Package.cxx b/src/MSAPI/MSAPI_Package.cxx new file mode 100755 index 0000000..d978264 --- /dev/null +++ b/src/MSAPI/MSAPI_Package.cxx @@ -0,0 +1,165 @@ +// File: MSAPI_Package.cxx +// Created: Mon Sep 18 10:43:59 1995 +// Author: Jean GAUTIER +// + + +#include + +#include + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + + +void MSAPI_Package_Info_Usage(char *cmd) +{ + cerr << "usage : " << cmd << "[-u] [-U ] \n"; + cerr << " -u : uses of package\n"; + cerr << " -U : 1 if pkname is used by apk\n"; + cerr << " -c : classes of \n"; + cerr << " -x : exceptions of \n"; + cerr << " -e : enums of \n"; + cerr << " -a : aliases of \n"; + cerr << " -p : pointers of \n"; + cerr << " -i : importeds of \n"; + cerr << " -P : primitives of \n"; + cerr << " -m : methods of \n"; +} + + + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_Package::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + WOKTools_Options opts(argc, argv, "uU:cxeapiPm", MSAPI_Package_Info_Usage, "uU:m"); + Handle(TCollection_HAsciiString) apkisused; + Handle(TCollection_HAsciiString) pkname; + Handle(MS_Package) apk; + Standard_Integer i; + Standard_Boolean uses = Standard_False; + Standard_Boolean isused = Standard_False; + Standard_Boolean classes = Standard_False; + Standard_Boolean expections = Standard_False; + Standard_Boolean enums = Standard_False; + Standard_Boolean aliases = Standard_False; + Standard_Boolean pointers = Standard_False; + Standard_Boolean importeds = Standard_False; + Standard_Boolean primitives = Standard_False; + Standard_Boolean methods = Standard_False; + + while(opts.More()) + { + switch(opts.Option()) + { + case 'u': + uses = Standard_True; + break; + case 'U': + isused = Standard_True; + apkisused = opts.OptionArgument(); + break; + case 'c': + classes = Standard_True; + break; + case 'x': + expections = Standard_True; + break; + case 'e': + enums = Standard_True; + break; + case 'a': + aliases = Standard_True; + break; + case 'p': + pointers = Standard_True; + break; + case 'i': + importeds = Standard_True; + break; + case 'P': + primitives = Standard_True; + break; + case 'm': + methods = Standard_True; + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_Package_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + pkname = opts.Arguments()->Value(1); + break; + default: + MSAPI_Package_Info_Usage(argv[0]); + return 1; + } + + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsPackage(pkname) == Standard_False) + { + ErrorMsg << argv[0] << "Given name (" << pkname->ToCString() << ") is not a known package" << endm; + } + + apk = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetPackage(pkname); + + + if(isused) + { + if(apk->IsUsed(apkisused)) values.AddStringValue("1"); + else values.AddStringValue("0"); + return 0; + } + + if(methods) + { + for(i=1; i<= apk->Methods()->Length(); i++) + { + values.AddStringValue(apk->Methods()->Value(i)->FullName()); + } + return 0; + } + + Handle(TColStd_HSequenceOfHAsciiString) aseq; + + if(uses) aseq = apk->Uses(); + if(classes) aseq = apk->Classes(); + if(expections) aseq = apk->Excepts(); + if(enums) aseq = apk->Enums(); + if(aliases) aseq = apk->Aliases(); + if(pointers) aseq = apk->Pointers(); + if(importeds) aseq = apk->Importeds(); + if(primitives) aseq = apk->Primitives(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; +} + diff --git a/src/MSAPI/MSAPI_Schema.cdl b/src/MSAPI/MSAPI_Schema.cdl new file mode 100755 index 0000000..e3ca590 --- /dev/null +++ b/src/MSAPI/MSAPI_Schema.cdl @@ -0,0 +1,21 @@ +-- File: MSAPI_Schema.cdl +-- Created: Thu Apr 25 16:06:42 1996 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1996 + + +class Schema from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools + +is + + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end Schema; diff --git a/src/MSAPI/MSAPI_Schema.cxx b/src/MSAPI/MSAPI_Schema.cxx new file mode 100755 index 0000000..7abc6c4 --- /dev/null +++ b/src/MSAPI/MSAPI_Schema.cxx @@ -0,0 +1,176 @@ +// File: MSAPI_Schema.cxx +// Created: Thu Apr 25 16:12:07 1996 +// Author: Jean GAUTIER +// + + +#include + +#include + +#include + +#include +#include + +#include + +#include +#include + +#include +#include +#include + +#include + + +void MSAPI_Schema_Info_Usage(char *cmd) +{ + cerr << "usage : " << cmd << " -c \n"; + cerr << endl; + cerr << "Options are : " << endl; + cerr << " -c : Classes listed in .cdl" << endl; + cerr << " -p : Packages listed in .cdl" << endl; + cerr << " -C : All classes listed in Schema" << endl; + cerr << " -d : All classes needed not listed in schema" << endl; + cerr << " -a : All classes in schema" << endl; + cerr << " -s : All classes in sorted in \"DDL\" order" << endl; +} + + + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_Schema::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + WOKTools_Options opts(argc, argv, "cpCdash", MSAPI_Schema_Info_Usage, "cpCdash"); + Handle(TCollection_HAsciiString) schname; + Handle(MS_Schema) asch; + Standard_Boolean getclasses = Standard_False; + Standard_Boolean getpks = Standard_False; + Standard_Boolean getallclasses = Standard_False; + Standard_Boolean getdeepclasses = Standard_False; + Standard_Boolean getAllClasses = Standard_False; + Standard_Boolean getSortedClasses = Standard_False; + Standard_Integer i; + + while(opts.More()) + { + switch(opts.Option()) + { + case 'c': + getclasses = Standard_True; + break; + case 'p': + getpks = Standard_True; + break; + case 'C': + getallclasses = Standard_True; + break; + case 'd': + getdeepclasses = Standard_True; + break; + case 'a': + getAllClasses = Standard_True; + break; + case 's': + getSortedClasses = Standard_True; + break; + default: + break; + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_Schema_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + schname = opts.Arguments()->Value(1); + break; + default: + MSAPI_Schema_Info_Usage(argv[0]); + return 1; + } + + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsSchema(schname) == Standard_False) + { + ErrorMsg << argv[0] << "Given name (" << schname->ToCString() << ") is not a known Schema" << endm; + } + + asch = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetSchema(schname); + + if(getclasses) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = asch->GetClasses(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + if(getpks) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = asch->GetPackages(); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + + if(getallclasses) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = + WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetPersistentClassesFromSchema(asch->Name()); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + if(getdeepclasses) + { + Handle(TColStd_HSequenceOfHAsciiString) theseq = + WOKBuilder_MSTool::GetMSchema()->SchemaDescrMissingClasses(asch->Name()); + + for(i=1; i<=theseq->Length(); i++) + { + values.AddStringValue(theseq->Value(i)); + } + return 0; + } + if(getAllClasses) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = WOKBuilder_MSTool::GetMSchema()->SchemaClasses(asch->Name()); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + if(getSortedClasses) + { + Handle(TColStd_HSequenceOfHAsciiString) aseq = WOKBuilder_MSTool::GetMSchema()->SortedSchemaClasses(asch->Name()); + + for(i=1; i<=aseq->Length(); i++) + { + values.AddStringValue(aseq->Value(i)); + } + return 0; + } + return 0; +} + diff --git a/src/MSAPI/MSAPI_StdClass.cdl b/src/MSAPI/MSAPI_StdClass.cdl new file mode 100755 index 0000000..3b1b180 --- /dev/null +++ b/src/MSAPI/MSAPI_StdClass.cdl @@ -0,0 +1,20 @@ +-- File: MSAPI_StdClass.cdl +-- Created: Tue Sep 19 17:53:26 1995 +-- Author: Jean GAUTIER +-- +---Copyright: Matra Datavision 1995 + + +class StdClass from MSAPI + + ---Purpose: + +uses + ArgTable from WOKTools, + Return from WOKTools +is + + Info(myclass; argc : Integer from Standard; argv : ArgTable from WOKTools; values : out Return from WOKTools) + returns Integer from Standard; + +end StdClass; diff --git a/src/MSAPI/MSAPI_StdClass.cxx b/src/MSAPI/MSAPI_StdClass.cxx new file mode 100755 index 0000000..1c7ca3f --- /dev/null +++ b/src/MSAPI/MSAPI_StdClass.cxx @@ -0,0 +1,103 @@ +// File: MSAPI_StdClass.cxx +// Created: Tue Sep 19 17:54:04 1995 +// Author: Jean GAUTIER +// + + +#include + +#include + +#include +#include + +#include + +#include + +#include +#include + +#include + +#include + + +#include + +extern void MSAPI_Class_Info_Usage(char *cmd); +extern char *MSAPI_Class_Info_Options; + +void MSAPI_StdClass_Info_Usage(char *cmd) +{ + MSAPI_Class_Info_Usage(cmd); +} + +//======================================================================= +//Author : Jean Gautier (jga) +//function : Info +//purpose : +//======================================================================= +Standard_Integer MSAPI_StdClass::Info(const Standard_Integer argc, const WOKTools_ArgTable& argv, WOKTools_Return& values) +{ + Standard_Boolean classoption = Standard_False; + Handle(TCollection_HAsciiString) name; + TCollection_AsciiString astr(MSAPI_Class_Info_Options); + + astr.AssignCat(""); + + WOKTools_Options opts(argc, argv, astr.ToCString(), MSAPI_StdClass_Info_Usage, astr.ToCString()); + + while(opts.More()) + { + if(strchr(MSAPI_Class_Info_Options, opts.Option())) + { + classoption = Standard_True; + } + else + { + switch(opts.Option()) + { + default: + break; + } + } + opts.Next(); + } + + if(opts.Failed() == Standard_True) return 1; + + if(opts.Arguments().IsNull() == Standard_True) {MSAPI_StdClass_Info_Usage(argv[0]); return 1;} + + switch(opts.Arguments()->Length()) + { + case 1: + name = opts.Arguments()->Value(1); + break; + default: + MSAPI_StdClass_Info_Usage(argv[0]); + return 1; + } + + if(WOKBuilder_MSTool::GetMSchema()->MetaSchema()->IsDefined(name) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a known type name" << endm; + return 1; + } + + Handle(MS_Type) type = WOKBuilder_MSTool::GetMSchema()->MetaSchema()->GetType(name); + + if(type->IsKind(STANDARD_TYPE(MS_StdClass)) == Standard_False) + { + ErrorMsg << argv[0] << "Name (" << name->ToCString() << ") is not a class name" << endm; + return 1; + } + + if(classoption) + { + return MSAPI_Class::Info(argc, argv, values); + } + + return 0; +} +