#endif /* WNT */
#include <cdl_defines.hxx>
-void add_cpp_comment(int,char*);
+void add_cpp_comment(int, char*);
+void add_documentation(char*);
+void add_documentation1(char*);
+
#define yylval CDLlval
#include <CDL.tab.h>
int CDLlineno;
/* The specials key words */
COMMENTER [-][-]
+DOCUMENTATION [-][-][-][ \t]?[P][u][r][p][o][s][e].*[\n]
+DOCUMENTATION1 [-]{2,}[ \t]{1,}.*[\n]
FCPLUSPLUS [-][-][-][C][+][+][ \t]*
CPLUSPLUS [-][-][-][C][+][+][ \t]*[:][ \t]*
FCPLUSPLUSD [-][-][-][C][+][+][ \t]*[2][.][0][ \t]*
/* %o 10000 */
/* The rules section execfile { return(execfile); }*/
+%s DOC_BLOCK
%%
-{REF}\n { add_cpp_comment(CDL_REF,CDLtext); CDLlineno++; }
-{CONSTREF}\n { add_cpp_comment(CDL_CONSTREF,CDLtext); CDLlineno++; }
-{CONSTRET}\n { add_cpp_comment(CDL_CONSTRET,CDLtext); CDLlineno++; }
-{DESTRUCTOR}\n { add_cpp_comment(CDL_DESTRUCTOR,CDLtext); CDLlineno++; }
-{INLINE}\n { add_cpp_comment(CDL_INLINE,CDLtext); CDLlineno++; }
-{OPERATOR}.*\n { add_cpp_comment(CDL_OPERATOR,CDLtext); CDLlineno++; }
-{HARDALIAS}\n { add_cpp_comment(CDL_HARDALIAS,CDLtext); CDLlineno++; }
-{FUNCTIONCALL}\n { add_cpp_comment(CDL_FUNCTIONCALL,CDLtext); CDLlineno++; }
-{CPLUSPLUSD}.*\n { CDLlineno++; CDLerror("C++2.0 directive no more supported."); }
-{FCPLUSPLUSD}.*\n { CDLlineno++; CDLerror("C++2.0 directive no more supported (':' missing)."); }
-{CPLUSPLUSD1}.*\n { CDLlineno++; CDLerror("C++2.1 directive no more supported."); }
-{FCPLUSPLUSD1}.*\n { CDLlineno++; CDLerror("C++2.1 directive no more supported (':' missing)."); }
-{CPLUSPLUS}\n { CDLlineno++; CDLerror("Empty C++ directive."); }
-{FCPLUSPLUS}.*\n { CDLlineno++; CDLerror("C++ directive without ':'."); }
-{COMMENTER}.*\n { CDLlineno++; }
-
-
-alias { return(alias); }
-any { return(any); }
-asynchronous { return(asynchronous); }
-as { return(as); }
-class { return(class); }
-client { return(client); }
-component { return(component); }
-deferred { return(deferred); }
-schema { return(schema); }
-end { return(end); }
-engine { return(engine); }
-enumeration { return(enumeration); }
-exception { return(exception); }
-executable { return(executable); }
-fields { return(fields); }
-friends { return(friends); }
-from { return(CDL_from); }
-generic { return(generic); }
-immutable { return(immutable); }
-imported { return(imported); }
-in { return(in); }
-inherits { return(inherits); }
-instantiates { return(instantiates); }
-interface { return(interface); }
-is { return(is); }
-like { return(like); }
-me { return(me); }
-mutable { return(mutable); }
+{DOCUMENTATION} { add_documentation(CDLtext); BEGIN(DOC_BLOCK); CDLlineno++; }
+<DOC_BLOCK>{DOCUMENTATION1} { add_documentation1(CDLtext); CDLlineno++; }
+{REF}\n { add_cpp_comment(CDL_REF,CDLtext); CDLlineno++; BEGIN(0);}
+{CONSTREF}\n { add_cpp_comment(CDL_CONSTREF,CDLtext); CDLlineno++; BEGIN(0); }
+{CONSTRET}\n { add_cpp_comment(CDL_CONSTRET,CDLtext); CDLlineno++; BEGIN(0); }
+{DESTRUCTOR}\n { add_cpp_comment(CDL_DESTRUCTOR,CDLtext); CDLlineno++; BEGIN(0);}
+{INLINE}\n { add_cpp_comment(CDL_INLINE,CDLtext); CDLlineno++; BEGIN(0);}
+{OPERATOR}.*\n { add_cpp_comment(CDL_OPERATOR,CDLtext); CDLlineno++; BEGIN(0); }
+{HARDALIAS}\n { add_cpp_comment(CDL_HARDALIAS,CDLtext); CDLlineno++; BEGIN(0); }
+{FUNCTIONCALL}\n { add_cpp_comment(CDL_FUNCTIONCALL,CDLtext); CDLlineno++; BEGIN(0); }
+{CPLUSPLUSD}.*\n { CDLlineno++; CDLerror("C++2.0 directive no more supported."); BEGIN(0); }
+{FCPLUSPLUSD}.*\n { CDLlineno++; CDLerror("C++2.0 directive no more supported (':' missing)."); BEGIN(0);}
+{CPLUSPLUSD1}.*\n { CDLlineno++; CDLerror("C++2.1 directive no more supported."); BEGIN(0);}
+{FCPLUSPLUSD1}.*\n { CDLlineno++; CDLerror("C++2.1 directive no more supported (':' missing)."); BEGIN(0);}
+{CPLUSPLUS}\n { CDLlineno++; CDLerror("Empty C++ directive."); BEGIN(0); }
+{FCPLUSPLUS}.*\n { CDLlineno++; CDLerror("C++ directive without ':'."); BEGIN(0);}
+{COMMENTER}.*\n { CDLlineno++; BEGIN(0); }
+
+alias { BEGIN(0); return(alias); }
+any { BEGIN(0); return(any); }
+asynchronous { BEGIN(0); return(asynchronous); }
+as { BEGIN(0); return(as); }
+class { BEGIN(0); return(class); }
+client { BEGIN(0); return(client); }
+component { BEGIN(0); return(component); }
+deferred { BEGIN(0); return(deferred); }
+schema { BEGIN(0); return(schema); }
+end { BEGIN(0); return(end); }
+engine { BEGIN(0); return(engine); }
+enumeration { BEGIN(0); return(enumeration); }
+exception { BEGIN(0); return(exception); }
+executable { BEGIN(0); return(executable); }
+fields { BEGIN(0); return(fields); }
+friends { BEGIN(0); return(friends); }
+from { BEGIN(0); return(CDL_from); }
+generic { BEGIN(0); return(generic); }
+immutable { BEGIN(0); return(immutable); }
+imported { BEGIN(0); return(imported); }
+in { BEGIN(0); return(in); }
+inherits { BEGIN(0); return(inherits); }
+instantiates { BEGIN(0); return(instantiates); }
+interface { BEGIN(0); return(interface); }
+is { BEGIN(0); return(is); }
+like { BEGIN(0); return(like); }
+me { BEGIN(0); return(me); }
+mutable { BEGIN(0); return(mutable); }
myclass { return(myclass); }
out { return(out); }
package { return(package); }
virtual { return(virtual); }
library { return(library); }
external { return(external); }
-as[ \t]*[c][+][+] { return(cpp); }
+as[ \t]*[c][+][+] { BEGIN(0); return(cpp); }
as[ \t]*c { return(krc); }
as[ \t]*fortran { return(fortran); }
as[ \t]*object { return(object); }
"=" { return('='); }
[ \t] { /* We don't take care of line feed, space or tabulation */ }
-[\n] { CDLlineno++; }
+[\n] { CDLlineno++; BEGIN(0);}
. { return(INVALID); }
%%
strcpy(&comment[comment_nb],CDLtext);
comment_nb += size;
new_comment = 1;
+ cout << comment << endl;
}
}
#else
extern "C" int CDLlineno;
#endif // WNT
-
+
+#ifndef WNT
+extern FILE *CDLin;
+#else
+extern "C" FILE *CDLin;
+#endif // WNT
+
// The Flags
//
static Standard_Boolean Private = Standard_False,
Handle(TColStd_HSequenceOfHAsciiString) ListOfItem = new TColStd_HSequenceOfHAsciiString;
Handle(TColStd_HSequenceOfHAsciiString) ListOfName = new TColStd_HSequenceOfHAsciiString;
Handle(TColStd_HSequenceOfHAsciiString) ListOfCplusplus = new TColStd_HSequenceOfHAsciiString;
+Handle(TColStd_HSequenceOfHAsciiString) ListOfComments = new TColStd_HSequenceOfHAsciiString;
Handle(TColStd_HSequenceOfInteger) ListOfCPPType = new TColStd_HSequenceOfInteger;
Handle(TColStd_HSequenceOfHAsciiString) ListOfInteger = new TColStd_HSequenceOfHAsciiString;
ListOfItem = new TColStd_HSequenceOfHAsciiString;
ListOfName = new TColStd_HSequenceOfHAsciiString;
ListOfCplusplus = new TColStd_HSequenceOfHAsciiString;
+ ListOfComments = new TColStd_HSequenceOfHAsciiString;
ListOfCPPType = new TColStd_HSequenceOfInteger;
ListOfInteger = new TColStd_HSequenceOfHAsciiString;
ListOfGlobalUsed.Nullify();
}
}
+ //for (i = 1; i <= ListOfComments->Length(); i++ ) {
+ // SimpleClass->SetComment(ListOfComments->Value(i));
+ //}
+
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "The 'uses' statement of your class has no declaration of : " << thetypename << endm;
YY_nb_error++;
}
Handle(MS_Engine) anEngine;
Handle(MS_Component) aComponent;
Standard_Boolean status = Standard_False;
-
+ Standard_Integer i;
+
if (theMetaSchema->IsPackage(Container)) {
aPackage = theMetaSchema->GetPackage(Container);
aSeqOfPackage = aPackage->Uses();
+ //for (i = 1; i <= ListOfComments->Length(); i++ ) {
+ //aPackage->SetComment(ListOfComments->Value(i));
+ //}
+
}
else if (theMetaSchema->IsInterface(Container)) {
anInterface = theMetaSchema->GetInterface(Container);
aSeqOfPackage = aComponent->Uses();
}
- for (Standard_Integer i = 1; i <= aSeqOfPackage->Length() && (status == 0); i++) {
+ for (i = 1; i <= aSeqOfPackage->Length() && (status == 0); i++) {
if (strcmp(aSeqOfPackage->Value(i)->ToCString(),used) == 0) {
status = Standard_True;
}
}
-
+ ListOfComments->Clear();
+
return status;
}
else return Standard_True;
msg->AssignCat(Container);
CDLerror(msg->ToCString());
}
+
strncpy(Pack_Name,aName,MAX_CHAR);
}
Handle(TCollection_HAsciiString) aPackageName, thethetypename = new TCollection_HAsciiString(aName);
- if (SimpleClass->Name()->IsSameString(thethetypename)) {
+ if (SimpleClass->Name()->IsSameString(thethetypename)) {
return Container->ToCString();
- }
+ }
aSeqOfPackage = SimpleClass->GetUsesNames();
-
for (i = 1; i <= aSeqOfPackage->Length(); i++) {
aPackageName = aSeqOfPackage->Value(i)->Token("_");
if (aSeqOfPackage->Value(i)->IsSameString(MS::BuildFullName(aPackageName,thethetypename))) {
else {
Type_Pack(Container->ToCString());
}
+
}
void Add_Type()
ListOfPackages->Append(aPackName);
}
+void add_documentation(char *comment)
+{
+ Handle(TCollection_HAsciiString) aComment;
+ Handle(TCollection_HAsciiString) aRealComment;
+ Standard_Integer pos;
+ aComment = new TCollection_HAsciiString(comment);
+ pos = aComment->Location(1,':',1,aComment->Length());
+ aRealComment = aComment->SubString(pos + 1, aComment->Length());
+ aRealComment->LeftAdjust();
+ if (!aRealComment->IsEmpty()) {
+ aRealComment->Insert(aRealComment->Length(), "<br>");
+ aRealComment->Insert(1,"///");
+ ListOfComments->Append(aRealComment);
+ }
+}
+
+void add_documentation1(char *comment)
+{
+ Handle(TCollection_HAsciiString) aComment;
+ Handle(TCollection_HAsciiString) aRealComment;
+ aComment = new TCollection_HAsciiString(comment);
+ aRealComment = aComment;
+ aRealComment->RemoveAll('-');
+ aRealComment->Insert(aRealComment->Length(), "<br>");
+ aRealComment->Insert(1,"///");
+ if (!aRealComment->IsEmpty()) {
+ aRealComment->LeftAdjust();
+ ListOfComments->Append(aRealComment);
+ }
+}
+
void add_cpp_comment(int cpptype, char *comment)
{
Handle(TCollection_HAsciiString) aComment;
YY_nb_warning++;
}
else {
- // cout << Method->Name()->ToCString() << " " << comment << endl;
+ //cout << Method->Name()->ToCString() << " " << comment << endl;
if (cpptype == CDL_HARDALIAS || cpptype == CDL_OPERATOR) {
Standard_Integer pos;
- aComment = new TCollection_HAsciiString(comment),
+ aComment = new TCollection_HAsciiString(comment);
pos = aComment->Location(1,':',1,aComment->Length());
aRealComment = aComment->SubString(pos + 1,aComment->Length());
void Schema_Begin(char *name)
{
Handle(TCollection_HAsciiString) aSchemaName = new TCollection_HAsciiString(name);
-
+
Schema = new MS_Schema(aSchemaName);
Schema->MetaSchema(theMetaSchema);
Container = aSchemaName;
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Schema : " << aSchemaName << " is already defined." << endm;
YY_nb_error++;
}
+ ListOfComments->Clear();
}
void Schema_Package(char *name)
{
+ Standard_Integer i;
Handle(TCollection_HAsciiString) aName = new TCollection_HAsciiString(name);
-
Schema->Package(aName);
+ for(i = 1; i <= ListOfComments->Length(); i++) {
+ Schema->SetComment(ListOfComments->Value(i));
+ }
+ ListOfComments->Clear();
}
void Schema_Class()
//
void Pack_Begin(char *aPackageName)
{
+
+ Standard_Integer i;
+
Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName);
Container = aPackName;
Package = new MS_Package(aPackName);
Package->MetaSchema(theMetaSchema);
-
+
+ for (i = 1; i <= ListOfComments->Length(); i++) {
+ Package->SetComment(ListOfComments->Value(i));
+ }
+
if (!theMetaSchema->AddPackage(Package)) {
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Package : " << aPackageName << " is already defined." << endm;
YY_nb_error++;
}
Package->Use(MS::GetPackageRootName());
+
+
Current_Entity = CDL_PACKAGE;
+ ListOfComments->Clear();
+
}
void Pack_Use(char *aPackageName)
{
Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(aPackageName);
+ for (Standard_Integer i = 1; i <= ListOfComments->Length(); i++) {
+ Package->SetComment(ListOfComments->Value(i));
+ }
ListOfGlobalUsed->Append(aPackName);
Package->Use(aPackName);
-
+ ListOfComments->Clear();
+
}
void Pack_End()
Package.Nullify();
ListOfTypes->Clear();
ListOfPackages->Clear();
+ ListOfComments->Clear();
+
}
// The actions for the classes
void Imported_Begin()
{
Handle(TCollection_HAsciiString) anImportedName = new TCollection_HAsciiString(thetypename);
-
+
Imported = new MS_Imported(anImportedName,Container,Container,Private);
Imported->MetaSchema(theMetaSchema);
void Prim_Begin()
{
Handle(TCollection_HAsciiString) aPrimName = new TCollection_HAsciiString(thetypename);
-
+
Primitive = new MS_PrimType(aPrimName,Container,Container,Private);
Primitive->MetaSchema(theMetaSchema);
void Inc_Class_Dec()
{
+ Standard_Integer i;
Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename);
StdClass = new MS_StdClass(aClassName,Container);
StdClass->MetaSchema(theMetaSchema);
+ for (i =1; i <= ListOfComments->Length(); i++) {
+ //StdClass->SetComment(ListOfComments->Value(i));
+ }
if (!theMetaSchema->AddType(StdClass)) {
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Class : " << StdClass->FullName() << " is already defined." << endm;
Deferred = Standard_False;
Redefined = Standard_False;
Like = Standard_False;
+ ListOfComments->Clear();
}
void Inc_GenClass_Dec()
Deferred = Standard_False;
Redefined = Standard_False;
Like = Standard_False;
+ ListOfComments->Clear();
}
void Add_GenType()
{
Handle(TCollection_HAsciiString) aPackName = Container;
Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename);
-
+ Standard_Integer i;
+
if (Current_Entity == CDL_GENCLASS) {
aPackName = GenClass->Package()->Name();
}
InstClass->MetaSchema(theMetaSchema);
+ for (i =1; i <= ListOfComments->Length(); i++) {
+ //InstClass->SetComment(ListOfComments->Value(i));
+ }
+
if (!theMetaSchema->IsDefined(InstClass->FullName()) || Current_Entity == CDL_GENCLASS) {
if (Current_Entity == CDL_GENCLASS && theMetaSchema->IsDefined(InstClass->FullName())) {
theMetaSchema->RemoveType(InstClass->FullName(),Standard_False);
ListOfTypes->Clear();
ListOfPackages->Clear();
+ ListOfComments->Clear();
}
void Add_Gen_Class()
SaveState = Current_Entity;
Current_Entity = CDL_GENTYPE;
-
if (! ListOfItem->IsEmpty()) {
Standard_Integer i;
Handle(TCollection_HAsciiString) aPackName;
{
Handle(TCollection_HAsciiString) aClassName = new TCollection_HAsciiString(thetypename);
Handle(TCollection_HAsciiString) aPackName = new TCollection_HAsciiString(Pack_Name);
+ Standard_Integer i;
if (Current_Entity == CDL_GENCLASS) {
aPackName = GenClass->Package()->Name();
}
Container = aPackName;
-
+
if (!theMetaSchema->IsPackage(Container)) {
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Unknown package " << Container << endm;
YY_nb_error++;
CDL_InitVariable();
MS_TraductionError::Raise("Unknown package.");
}
-
// si la classe n a pas ete cree par une dec incomplete
//
StdClass = new MS_StdClass(aClassName,aPackName);
-
StdClass->MetaSchema(theMetaSchema);
if (!theMetaSchema->IsDefined(StdClass->FullName()) || Current_Entity == CDL_GENCLASS) {
if (Current_Entity != CDL_GENCLASS) {
Current_Entity = CDL_STDCLASS;
}
+ for (i =1; i <= ListOfComments->Length(); i++) {
+ StdClass->SetComment(ListOfComments->Value(i));
+ }
SimpleClass = StdClass;
-
+
Private = Standard_False;
Protected = Standard_False;
Static = Standard_True;
ListOfTypes->Clear();
ListOfPackages->Clear();
+ ListOfComments->Clear();
+
}
void Add_Std_Ancestors()
YY_nb_error++;
}
}
-
+ //SimpleClass->MetaSchema(theMetaSchema);
+ for (i =1; i <= ListOfComments->Length(); i++) {
+ SimpleClass->SetComment(ListOfComments->Value(i));
+ }
+
ListOfTypes->Clear();
ListOfPackages->Clear();
+ ListOfComments->Clear();
}
void Add_Std_Uses()
{
- Standard_Integer i;
-
+ Standard_Integer i;
+
+
+ //SimpleClass->MetaSchema(theMetaSchema);
+ for (i =1; i <= ListOfComments->Length(); i++) {
+ SimpleClass->SetComment(ListOfComments->Value(i));
+ }
+
for (i = 1; i <= ListOfTypes->Length(); i++) {
Handle(TCollection_HAsciiString) aFullName = MS::BuildFullName(ListOfPackages->Value(i),ListOfTypes->Value(i));
ListOfTypeUsed->Append(aFullName);
}
+ ListOfComments->Clear();
ListOfTypes->Clear();
ListOfPackages->Clear();
}
StdClass.Nullify();
ListOfTypes->Clear();
ListOfPackages->Clear();
+ ListOfComments->Clear();
}
void Enum_Begin()
{
Handle(TCollection_HAsciiString) anEnumName = new TCollection_HAsciiString(thetypename);
-
+ Standard_Integer i;
+
anEnumMap.Clear();
Enum = new MS_Enum(anEnumName,Container,Container,Private);
Enum->MetaSchema(theMetaSchema);
Enum->Package(Package->FullName());
-
+ for(i = 1; i <= ListOfComments->Length(); i++) {
+ Enum->SetComment(ListOfComments->Value(i));
+ }
+ ListOfComments->Clear();
if (!theMetaSchema->AddType(Enum)) {
ErrorMsg << "CDL" << "\"" << CDLFileName->ToCString() << "\"" << ", line " << CDLlineno << ": " << "Enumeration : " << Enum->FullName() << " is already defined." << endm;
YY_nb_error++;
void Add_Enum(char *aValue)
{
Handle(TCollection_HAsciiString) anEnumValue = new TCollection_HAsciiString(aValue);
-
+ for(Standard_Integer i = 1; i <= ListOfComments->Length(); i++) {
+ Enum->SetComment(ListOfComments->Value(i));
+ }
+ ListOfComments->Clear();
+
if (!anEnumMap.Contains(anEnumValue)) {
anEnumMap.Add(anEnumValue);
Enum->Enum(anEnumValue);
{
//Enum->Check();
Package->Enum(Enum->Name());
+ for(Standard_Integer i = 1; i <= ListOfComments->Length(); i++) {
+ Enum->SetComment(ListOfComments->Value(i));
+ }
+ ListOfComments->Clear();
Enum.Nullify();
anEnumMap.Clear();
Standard_Integer i;
Handle(TCollection_HAsciiString) aCP;
+ for(i = 1; i <= ListOfComments->Length(); i++) {
+ Method->SetComment(ListOfComments->Value(i));
+ }
for(i = 1; i <= ListOfCplusplus->Length(); i++) {
aCommentType = ListOfCPPType->Value(i);
break;
}
}
+ ListOfComments->Clear();
ListOfCplusplus->Clear();
ListOfCPPType->Clear();
theMetaSchema->AddMethod(Method);
extern "C" {
void CDLrestart(FILE*);
}
-#ifndef WNT
-extern FILE *CDLin;
-#else
-extern "C" FILE *CDLin;
-#endif // WNT
int TraductionMain(char *FileName)
{
ListOfTypeUsed.Nullify();
ListOfInst.Nullify();
ListOfGen.Nullify();
-
+ ListOfComments.Nullify();
return ErrorLevel;
}