diff --git a/.gitattributes b/.gitattributes index 3592683238..db61c819ba 100644 --- a/.gitattributes +++ b/.gitattributes @@ -44,6 +44,7 @@ UDLIST eol=lf tests/* eol=lf tests/*/* eol=lf tests/*/*/* eol=lf +adm/upgrade.dat eol=lf *.bat eol=crlf *.cmd eol=crlf *.rc eol=crlf diff --git a/.gitignore b/.gitignore index 4964a0fefe..c2da7e3b03 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ Release /adm/mac /adm/make *.vcproj*user +*.vcxproj*user *.csproj*user *.ncb *.suo diff --git a/adm/genconf.tcl b/adm/genconf.tcl index 7293ab62b5..26f9201da1 100644 --- a/adm/genconf.tcl +++ b/adm/genconf.tcl @@ -1,8 +1,30 @@ #!/usr/bin/tclsh -package require Tk +# ======================================================================= +# Created on: 2012-01-26 +# Created by: Kirill GAVRILOV +# Copyright (c) 2012 OPEN CASCADE SAS +# +# This file is part of Open CASCADE Technology software library. +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License version 2.1 as published +# by the Free Software Foundation, with special exception defined in the file +# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +# distribution for complete text of the license and disclaimer of any warranty. +# +# Alternatively, this file may be used under the terms of Open CASCADE +# commercial license or contractual agreement. -source "./adm/genconfdeps.tcl" +# ======================================================================= +# GUI procedure for search of third-party tools and generation of environment +# customization script +# ======================================================================= + +# load tools +source [file join [file dirname [info script]] genconfdeps.tcl] + +package require Tk set aRowIter 0 frame .myFrame -padx 5 -pady 5 diff --git a/adm/genconfdeps.tcl b/adm/genconfdeps.tcl index 2263a2928b..602426d8dc 100644 --- a/adm/genconfdeps.tcl +++ b/adm/genconfdeps.tcl @@ -1,4 +1,23 @@ -#!/usr/bin/tclsh +# ======================================================================= +# Created on: 2012-01-26 +# Created by: Kirill GAVRILOV +# Copyright (c) 2012 OPEN CASCADE SAS +# +# This file is part of Open CASCADE Technology software library. +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License version 2.1 as published +# by the Free Software Foundation, with special exception defined in the file +# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +# distribution for complete text of the license and disclaimer of any warranty. +# +# Alternatively, this file may be used under the terms of Open CASCADE +# commercial license or contractual agreement. + +# ======================================================================= +# Tools for search of third-party libraries and generation on environment +# customization script +# ======================================================================= set ARCH "64" diff --git a/adm/gendoc.tcl b/adm/gendoc.tcl index ec44d44673..a9c2e5658e 100644 --- a/adm/gendoc.tcl +++ b/adm/gendoc.tcl @@ -14,10 +14,15 @@ # # Alternatively, this file may be used under the terms of Open CASCADE # commercial license or contractual agreement. -# -# Brief: This script compiles OCCT documents from *.md files to HTML pages + +# ======================================================================= +# This script defines command gendoc compiling OCCT documents +# from *.md files to HTML pages # ======================================================================= +# load auxiliary tools +source [file join [file dirname [info script]] occaux.tcl] + # ====================================== # Common functions # ====================================== diff --git a/adm/genproj.tcl b/adm/genproj.tcl index 7257976cff..e767c87736 100644 --- a/adm/genproj.tcl +++ b/adm/genproj.tcl @@ -1,12 +1,31 @@ # ======================================================================= -# This script generates project files for different IDEs: -# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "amk" "xcd" +# Created on: 2014-07-24 +# Created by: SKI +# Copyright (c) 2014 OPEN CASCADE SAS +# +# This file is part of Open CASCADE Technology software library. +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License version 2.1 as published +# by the Free Software Foundation, with special exception defined in the file +# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +# distribution for complete text of the license and disclaimer of any warranty. +# +# Alternatively, this file may be used under the terms of Open CASCADE +# commercial license or contractual agreement. + +# ======================================================================= +# This script defines Tcl command genproj generating project files for +# different IDEs: +# "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "amk" "xcd" # # Example: # genproj -path=D:/occt -target=vc10 # genproj -target=xcd -ios -static # ======================================================================= +source [file join [file dirname [info script]] genconfdeps.tcl] + set path "" set fBranch "" switch -exact -- "$tcl_platform(platform)" { @@ -18,8 +37,6 @@ switch -exact -- "$tcl_platform(os)" { "Darwin" {set targetStation "mac"} } -source "./adm/genconfdeps.tcl" - proc _get_options { platform type branch } { global path set res "" @@ -3793,6 +3810,3 @@ proc osutils:xcdx { theOutDir theExecutable theGuidsMap } { puts $aPlistFile $aPlistTmpl close $aPlistFile } - -# launch generation -genproj {*}$::argv diff --git a/adm/occaux.tcl b/adm/occaux.tcl index ed3aaadcbc..f8a13c6b1c 100644 --- a/adm/occaux.tcl +++ b/adm/occaux.tcl @@ -14,9 +14,10 @@ # # Alternatively, this file may be used under the terms of Open CASCADE # commercial license or contractual agreement. -# -# Brief: This script contains auxilary functions which can be used -# in documentation generation process + +# ======================================================================= +# This script contains auxilary functions which can be used +# in documentation generation process # ======================================================================= # ============================================== diff --git a/adm/start.tcl b/adm/start.tcl index b9d4c70f1c..9b16406b64 100644 --- a/adm/start.tcl +++ b/adm/start.tcl @@ -1,8 +1,30 @@ #!/usr/bin/tclsh -# Command-line starter for occdoc command, use it as follows: -# tclsh> source dox/start.tcl [arguments] +# ======================================================================= +# Created on: 2014-03-21 +# Created by: OMY +# Copyright (c) 1996-1999 Matra Datavision +# Copyright (c) 1999-2014 OPEN CASCADE SAS +# +# This file is part of Open CASCADE Technology software library. +# +# This library is free software; you can redistribute it and/or modify it under +# the terms of the GNU Lesser General Public License version 2.1 as published +# by the Free Software Foundation, with special exception defined in the file +# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT +# distribution for complete text of the license and disclaimer of any warranty. +# +# Alternatively, this file may be used under the terms of Open CASCADE +# commercial license or contractual agreement. + +if { [llength $argv] < 1 } { + puts "Command-line starter for Tcl command defined in same-named file." + puts "Use it as follows:" + puts "\> tclsh start.tcl command \[arguments\]" + return +} -source [file join [file dirname [info script]] occaux.tcl] -source [file join [file dirname [info script]] gendoc.tcl] -gendoc {*}$::argv +set cmdname [lindex $argv 0] +source [file join [file dirname [info script]] $cmdname.tcl] + +eval $cmdname [lrange $argv 1 end] diff --git a/adm/upgrade.dat b/adm/upgrade.dat new file mode 100644 index 0000000000..96872023a3 --- /dev/null +++ b/adm/upgrade.dat @@ -0,0 +1,924 @@ +[rename] +BRepExtrema_OverlappedSubShapes BRepExtrema_MapOfIntegerPackedMapOfInteger + +[tcollection] +AdvApp2Var_SequenceOfNode +AdvApp2Var_SequenceOfPatch +AdvApp2Var_SequenceOfStrip +AdvApp2Var_Strip +AIS_DataMapOfILC +AIS_DataMapofIntegerListOfinteractive +AIS_DataMapOfIOStatus +AIS_DataMapOfSelStat +AIS_IndexedDataMapOfOwnerPrs +AIS_ListOfInteractive +AIS_MapOfInteractive +AIS_SequenceOfDimension +AIS_SequenceOfInteractive +AppDef_Array1OfMultiPointConstraint +AppDef_HArray1OfMultiPointConstraint +AppParCurves_Array1OfConstraintCouple +AppParCurves_Array1OfMultiBSpCurve +AppParCurves_Array1OfMultiCurve +AppParCurves_Array1OfMultiPoint +AppParCurves_HArray1OfConstraintCouple +AppParCurves_HArray1OfMultiBSpCurve +AppParCurves_HArray1OfMultiCurve +AppParCurves_HArray1OfMultiPoint +AppParCurves_SequenceOfMultiBSpCurve +AppParCurves_SequenceOfMultiCurve +Approx_Array1OfAdHSurface +Approx_Array1OfGTrsf2d +Approx_HArray1OfAdHSurface +Approx_HArray1OfGTrsf2d +Approx_SequenceOfHArray1OfReal +Aspect_SequenceOfColor +BinMDF_TypeADriverMap +BinMDF_TypeIdMap +BiTgte_DataMapOfShapeBox +Blend_SequenceOfPoint +Bnd_Array1OfBox +Bnd_Array1OfBox2d +Bnd_Array1OfSphere +Bnd_HArray1OfBox +Bnd_HArray1OfBox2d +Bnd_HArray1OfSphere +Bnd_SeqOfBox +BRep_ListOfCurveRepresentation +BRep_ListOfPointRepresentation +BRepAdaptor_Array1OfCurve +BRepAdaptor_HArray1OfCurve +BRepAlgo_DataMapOfShapeBoolean +BRepAlgo_DataMapOfShapeInterference +BRepAlgo_SequenceOfSequenceOfInteger +BRepBlend_SequenceOfLine +BRepBlend_SequenceOfPointOnRst +BRepCheck_DataMapOfShapeListOfStatus +BRepCheck_DataMapOfShapeResult +BRepCheck_ListOfStatus +BRepClass3d_MapOfInter +BRepFill_DataMapOfNodeDataMapOfShapeShape +BRepFill_DataMapOfNodeShape +BRepFill_DataMapOfOrientedShapeListOfShape +BRepFill_DataMapOfShapeDataMapOfShapeListOfShape +BRepFill_DataMapOfShapeHArray2OfShape +BRepFill_DataMapOfShapeSequenceOfPnt +BRepFill_DataMapOfShapeSequenceOfReal +BRepFill_IndexedDataMapOfOrientedShapeListOfShape +BRepFill_ListOfOffsetWire +BRepFill_SequenceOfEdgeFaceAndOrder +BRepFill_SequenceOfFaceAndOrder +BRepFill_SequenceOfSection +BRepMAT2d_DataMapOfBasicEltShape +BRepMAT2d_DataMapOfShapeSequenceOfBasicElt +BRepOffset_DataMapOfShapeListOfInterval +BRepOffset_DataMapOfShapeMapOfShape +BRepOffset_DataMapOfShapeOffset +BRepOffset_ListOfInterval +BRepOffsetAPI_SequenceOfSequenceOfReal +BRepOffsetAPI_SequenceOfSequenceOfShape +BRepTools_MapOfVertexPnt2d +BRepTopAdaptor_MapOfShapeTool +CDM_DocumentHasher +CDM_ListOfDocument +CDM_ListOfReferences +CDM_MapOfDocument +CDM_MetaDataLookUpTable +CDM_PresentationDirectory +ChFiDS_HData +ChFiDS_IndexedDataMapOfVertexListOfStripe +ChFiDS_ListOfHElSpine +ChFiDS_ListOfStripe +ChFiDS_Regularities +ChFiDS_SecArray1 +ChFiDS_SecHArray1 +ChFiDS_SequenceOfSpine +ChFiDS_SequenceOfSurfData +ChFiDS_StripeArray1 +ChFiKPart_RstMap +Contap_TheHSequenceOfPoint +Contap_TheSequenceOfLine +Contap_TheSequenceOfPoint +Convert_SequenceOfArray1OfPoles +DBRep_ListOfEdge +DBRep_ListOfFace +DBRep_ListOfHideData +DDF_TransactionStack +DNaming_DataMapOfShapeOfName +Draft_DataMapOfEdgeEdgeInfo +Draft_DataMapOfFaceFaceInfo +Draft_DataMapOfVertexVertexInfo +Draw_MapOfAsciiString +Draw_SequenceOfDrawable3D +Expr_Array1OfGeneralExpression +Expr_Array1OfNamedUnknown +Expr_Array1OfSingleRelation +Expr_MapOfNamedUnknown +Expr_SequenceOfGeneralExpression +Expr_SequenceOfGeneralRelation +ExprIntrp_SequenceOfNamedExpression +ExprIntrp_SequenceOfNamedFunction +ExprIntrp_StackOfGeneralExpression +ExprIntrp_StackOfGeneralFunction +ExprIntrp_StackOfGeneralRelation +Extrema_Array1OfPOnCurv +Extrema_Array1OfPOnCurv2d +Extrema_Array1OfPOnSurf +Extrema_Array2OfPOnCurv +Extrema_Array2OfPOnCurv2d +Extrema_Array2OfPOnSurf +Extrema_Array2OfPOnSurfParams +Extrema_HArray1OfPOnCurv +Extrema_HArray1OfPOnCurv2d +Extrema_HArray1OfPOnSurf +Extrema_HArray2OfPOnCurv +Extrema_HArray2OfPOnCurv2d +Extrema_HArray2OfPOnSurf +Extrema_HArray2OfPOnSurfParams +Extrema_SequenceOfPOnCurv +Extrema_SequenceOfPOnCurv2d +Extrema_SequenceOfPOnSurf +FEmTool_AssemblyTable +FEmTool_HAssemblyTable +FEmTool_ListOfVectors +FEmTool_SeqOfLinConstr +GccEnt_Array1OfPosition +Geom2dHatch_Hatchings +Geom2dHatch_MapOfElements +Geom_HSequenceOfBSplineSurface +Geom_SequenceOfBSplineSurface +GeomFill_Array1OfLocationLaw +GeomFill_Array1OfSectionLaw +GeomFill_HArray1OfLocationLaw +GeomFill_HArray1OfSectionLaw +GeomFill_HSequenceOfAx2 +GeomFill_SequenceOfAx2 +GeomFill_SequenceOfTrsf +GeomInt_SequenceOfParameterAndOrientation +GeomLib_Array1OfMat +GeomPlate_Array1OfHCurveOnSurface +GeomPlate_Array1OfSequenceOfReal +GeomPlate_HArray1OfHCurveOnSurface +GeomPlate_HArray1OfSequenceOfReal +GeomPlate_HSequenceOfCurveConstraint +GeomPlate_HSequenceOfPointConstraint +GeomPlate_SequenceOfAij +GeomPlate_SequenceOfCurveConstraint +GeomPlate_SequenceOfPointConstraint +Graphic3d_Array1OfVector +Graphic3d_Array1OfVertex +Graphic3d_Array2OfVertex +Graphic3d_HSequenceOfStructure +Graphic3d_ListOfShortReal +Graphic3d_SequenceOfStructure +Hatch_SequenceOfLine +Hatch_SequenceOfParameter +HatchGen_Domains +HatchGen_PointsOnElement +HatchGen_PointsOnHatching +HLRAlgo_Array1OfPHDat +HLRAlgo_Array1OfPINod +HLRAlgo_Array1OfPISeg +HLRAlgo_Array1OfTData +HLRAlgo_HArray1OfPHDat +HLRAlgo_HArray1OfPINod +HLRAlgo_HArray1OfPISeg +HLRAlgo_HArray1OfTData +HLRAlgo_InterferenceList +HLRAlgo_ListOfBPoint +HLRBRep_Array1OfEData +HLRBRep_Array1OfFData +HLRBRep_ListOfBPnt2D +HLRBRep_ListOfBPoint +HLRBRep_SeqOfShapeBounds +HLRTopoBRep_DataMapOfShapeFaceData +HLRTopoBRep_ListOfVData +HLRTopoBRep_MapOfShapeListOfVData +IFSelect_HSeqOfSelection +IFSelect_SequenceOfAppliedModifiers +IFSelect_SequenceOfGeneralModifier +IFSelect_SequenceOfInterfaceModel +IFSelect_TSeqOfDispatch +IFSelect_TSeqOfSelection +IGESAppli_Array1OfFiniteElement +IGESAppli_Array1OfFlow +IGESAppli_Array1OfNode +IGESAppli_HArray1OfFiniteElement +IGESAppli_HArray1OfFlow +IGESAppli_HArray1OfNode +IGESBasic_Array1OfLineFontEntity +IGESBasic_Array2OfHArray1OfReal +IGESBasic_HArray1OfLineFontEntity +IGESBasic_HArray2OfHArray1OfReal +IGESData_Array1OfDirPart +IGESData_Array1OfIGESEntity +IGESData_HArray1OfIGESEntity +IGESDefs_Array1OfTabularData +IGESDefs_HArray1OfTabularData +IGESDimen_Array1OfGeneralNote +IGESDimen_Array1OfLeaderArrow +IGESDimen_HArray1OfGeneralNote +IGESDimen_HArray1OfLeaderArrow +IGESDraw_Array1OfConnectPoint +IGESDraw_Array1OfViewKindEntity +IGESDraw_HArray1OfConnectPoint +IGESDraw_HArray1OfViewKindEntity +IGESGeom_Array1OfBoundary +IGESGeom_Array1OfCurveOnSurface +IGESGeom_Array1OfTransformationMatrix +IGESGeom_HArray1OfBoundary +IGESGeom_HArray1OfCurveOnSurface +IGESGeom_HArray1OfTransformationMatrix +IGESGraph_Array1OfColor +IGESGraph_Array1OfTextDisplayTemplate +IGESGraph_Array1OfTextFontDef +IGESGraph_HArray1OfColor +IGESGraph_HArray1OfTextDisplayTemplate +IGESGraph_HArray1OfTextFontDef +IGESSolid_Array1OfFace +IGESSolid_Array1OfLoop +IGESSolid_Array1OfShell +IGESSolid_Array1OfVertexList +IGESSolid_HArray1OfFace +IGESSolid_HArray1OfLoop +IGESSolid_HArray1OfShell +IGESSolid_HArray1OfVertexList +IntAna_ListOfCurve +IntCurveSurface_SequenceOfPnt +IntCurveSurface_SequenceOfSeg +Interface_Array1OfFileParameter +Interface_Array1OfHAsciiString +Interface_DataMapOfTransientInteger +Interface_HArray1OfHAsciiString +Interface_HSequenceOfCheck +Interface_IndexedMapOfAsciiString +Interface_SequenceOfCheck +Intf_Array1OfLin +Intf_SeqOfSectionLine +Intf_SeqOfSectionPoint +Intf_SeqOfTangentZone +IntPatch_SequenceOfLine +IntPatch_SequenceOfPoint +IntPolyh_SeqOfStartPoints +IntRes2d_SequenceOfIntersectionPoint +IntRes2d_SequenceOfIntersectionSegment +Intrv_SequenceOfInterval +IntSurf_ListOfPntOn2S +IntSurf_SequenceOfCouple +IntSurf_SequenceOfInteriorPoint +IntSurf_SequenceOfPathPoint +IntTools_Array1OfRange +IntTools_Array1OfRoots +IntTools_DataMapOfCurveSampleBox +IntTools_DataMapOfSurfaceSampleBox +IntTools_IndexedDataMapOfTransientAddress +IntTools_ListOfBox +IntTools_ListOfCurveRangeSample +IntTools_ListOfSurfaceRangeSample +IntTools_MapOfCurveSample +IntTools_MapOfSurfaceSample +IntTools_SequenceOfCommonPrts +IntTools_SequenceOfCurves +IntTools_SequenceOfPntOn2Faces +IntTools_SequenceOfRanges +IntTools_SequenceOfRoots +Law_Laws +LocOpe_DataMapOfShapePnt +LocOpe_SequenceOfCirc +LocOpe_SequenceOfLin +LocOpe_SequenceOfPntFace +LProp_SequenceOfCIType +MAT2d_Array2OfConnexion +MAT2d_DataMapOfBiIntInteger +MAT2d_DataMapOfBiIntSequenceOfInteger +MAT2d_DataMapOfIntegerBisec +MAT2d_DataMapOfIntegerConnexion +MAT2d_DataMapOfIntegerPnt2d +MAT2d_DataMapOfIntegerSequenceOfConnexion +MAT2d_DataMapOfIntegerVec2d +MAT2d_SequenceOfConnexion +MAT2d_SequenceOfSequenceOfCurve +MAT2d_SequenceOfSequenceOfGeometry +MAT_DataMapOfIntegerArc +MAT_DataMapOfIntegerBasicElt +MAT_DataMapOfIntegerBisector +MAT_DataMapOfIntegerNode +MAT_SequenceOfArc +MAT_SequenceOfBasicElt +math_Array1OfValueAndWeight +MDF_ARDriverHSequence +MDF_ARDriverSequence +MDF_ASDriverHSequence +MDF_ASDriverSequence +MDF_TypeARDriverMap +MDF_TypeASDriverMap +MeshVS_Array1OfSequenceOfInteger +MeshVS_DataMapOfColorMapOfInteger +MeshVS_DataMapOfHArray1OfSequenceOfInteger +MeshVS_DataMapOfIntegerAsciiString +MeshVS_DataMapOfIntegerBoolean +MeshVS_DataMapOfIntegerColor +MeshVS_DataMapOfIntegerMaterial +MeshVS_DataMapOfIntegerMeshEntityOwner +MeshVS_DataMapOfIntegerOwner +MeshVS_DataMapOfIntegerTwoColors +MeshVS_DataMapOfIntegerVector +MeshVS_DataMapOfTwoColorsMapOfInteger +MeshVS_HArray1OfSequenceOfInteger +MeshVS_MapOfTwoNodes +MeshVS_SequenceOfPrsBuilder +MeshVS_TwoColorsHasher +MeshVS_TwoNodesHasher +Message_ListOfMsg +Message_SequenceOfPrinters +Message_SequenceOfProgressScale +MoniTool_DataMapOfShapeTransient +MoniTool_DataMapOfTimer +MoniTool_HSequenceOfElement +MoniTool_IndexedDataMapOfShapeTransient +MoniTool_SequenceOfElement +NLPlate_SequenceOfHGPPConstraint +NLPlate_StackOfPlate +PCDM_SequenceOfDocument +PCDM_SequenceOfReference +Plate_Array1OfPinpointConstraint +Plate_HArray1OfPinpointConstraint +Plate_SequenceOfLinearScalarConstraint +Plate_SequenceOfLinearXYZConstraint +Plate_SequenceOfPinpointConstraint +Plugin_MapOfFunctions +Poly_Array1OfTriangle +Poly_HArray1OfTriangle +ProjLib_HSequenceOfHSequenceOfPnt +ProjLib_SequenceOfHSequenceOfPnt +PrsMgr_Presentations +PTColStd_DoubleMapOfTransientPersistent +PTColStd_MapPersistentHasher +PTColStd_PersistentTransientMap +PTColStd_TransientPersistentMap +QANCollection_DataMapOfRealPnt +QANCollection_DoubleMapOfRealInteger +QANCollection_IndexedDataMapOfRealPnt +QANCollection_ListOfPnt +Quantity_Array1OfCoefficient +Quantity_Array1OfColor +Quantity_Array2OfColor +Quantity_HArray1OfColor +Resource_DataMapOfAsciiStringAsciiString +Resource_DataMapOfAsciiStringExtendedString +SelectMgr_DataMapOfObjectSelectors +SelectMgr_IndexedDataMapOfOwnerCriterion +SelectMgr_IndexedMapOfOwner +SelectMgr_ListOfFilter +SelectMgr_SequenceOfFilter +SelectMgr_SequenceOfOwner +SelectMgr_SequenceOfSelector +ShapeAnalysis_DataMapOfShapeListOfReal +ShapeAnalysis_HSequenceOfFreeBounds +ShapeAnalysis_SequenceOfFreeBounds +ShapeExtend_DataMapOfShapeListOfMsg +ShapeExtend_DataMapOfTransientListOfMsg +ShapeFix_DataMapOfShapeBox2d +ShapeFix_SequenceOfWireSegment +StdSelect_IndexedDataMapOfOwnerPrs +StepAP203_Array1OfApprovedItem +StepAP203_Array1OfCertifiedItem +StepAP203_Array1OfChangeRequestItem +StepAP203_Array1OfClassifiedItem +StepAP203_Array1OfContractedItem +StepAP203_Array1OfDateTimeItem +StepAP203_Array1OfPersonOrganizationItem +StepAP203_Array1OfSpecifiedItem +StepAP203_Array1OfStartRequestItem +StepAP203_Array1OfWorkItem +StepAP203_HArray1OfApprovedItem +StepAP203_HArray1OfCertifiedItem +StepAP203_HArray1OfChangeRequestItem +StepAP203_HArray1OfClassifiedItem +StepAP203_HArray1OfContractedItem +StepAP203_HArray1OfDateTimeItem +StepAP203_HArray1OfPersonOrganizationItem +StepAP203_HArray1OfSpecifiedItem +StepAP203_HArray1OfStartRequestItem +StepAP203_HArray1OfWorkItem +StepAP214_Array1OfApprovalItem +StepAP214_Array1OfAutoDesignDateAndPersonItem +StepAP214_Array1OfAutoDesignDateAndTimeItem +StepAP214_Array1OfAutoDesignDatedItem +StepAP214_Array1OfAutoDesignGeneralOrgItem +StepAP214_Array1OfAutoDesignGroupedItem +StepAP214_Array1OfAutoDesignPresentedItemSelect +StepAP214_Array1OfAutoDesignReferencingItem +StepAP214_Array1OfDateAndTimeItem +StepAP214_Array1OfDateItem +StepAP214_Array1OfDocumentReferenceItem +StepAP214_Array1OfExternalIdentificationItem +StepAP214_Array1OfGroupItem +StepAP214_Array1OfOrganizationItem +StepAP214_Array1OfPersonAndOrganizationItem +StepAP214_Array1OfPresentedItemSelect +StepAP214_Array1OfSecurityClassificationItem +StepAP214_HArray1OfApprovalItem +StepAP214_HArray1OfAutoDesignDateAndPersonItem +StepAP214_HArray1OfAutoDesignDateAndTimeItem +StepAP214_HArray1OfAutoDesignDatedItem +StepAP214_HArray1OfAutoDesignGeneralOrgItem +StepAP214_HArray1OfAutoDesignGroupedItem +StepAP214_HArray1OfAutoDesignPresentedItemSelect +StepAP214_HArray1OfAutoDesignReferencingItem +StepAP214_HArray1OfDateAndTimeItem +StepAP214_HArray1OfDateItem +StepAP214_HArray1OfDocumentReferenceItem +StepAP214_HArray1OfExternalIdentificationItem +StepAP214_HArray1OfGroupItem +StepAP214_HArray1OfOrganizationItem +StepAP214_HArray1OfPersonAndOrganizationItem +StepAP214_HArray1OfPresentedItemSelect +StepAP214_HArray1OfSecurityClassificationItem +StepBasic_Array1OfApproval +StepBasic_Array1OfDerivedUnitElement +StepBasic_Array1OfDocument +StepBasic_Array1OfNamedUnit +StepBasic_Array1OfOrganization +StepBasic_Array1OfPerson +StepBasic_Array1OfProduct +StepBasic_Array1OfProductContext +StepBasic_Array1OfProductDefinition +StepBasic_Array1OfUncertaintyMeasureWithUnit +StepBasic_HArray1OfApproval +StepBasic_HArray1OfDerivedUnitElement +StepBasic_HArray1OfDocument +StepBasic_HArray1OfNamedUnit +StepBasic_HArray1OfOrganization +StepBasic_HArray1OfPerson +StepBasic_HArray1OfProduct +StepBasic_HArray1OfProductContext +StepBasic_HArray1OfProductDefinition +StepBasic_HArray1OfUncertaintyMeasureWithUnit +STEPCAFControl_DataMapOfLabelExternFile +STEPCAFControl_DataMapOfLabelShape +STEPCAFControl_DataMapOfPDExternFile +STEPCAFControl_DataMapOfSDRExternFile +STEPCAFControl_DataMapOfShapePD +STEPCAFControl_DataMapOfShapeSDR +STEPConstruct_DataMapOfAsciiStringTransient +STEPConstruct_DataMapOfPointTransient +StepData_Array1OfField +StepData_HArray1OfField +StepDimTol_Array1OfDatumReference +StepDimTol_HArray1OfDatumReference +StepElement_Array1OfCurveElementEndReleasePacket +StepElement_Array1OfCurveElementSectionDefinition +StepElement_Array1OfHSequenceOfCurveElementPurposeMember +StepElement_Array1OfHSequenceOfSurfaceElementPurposeMember +StepElement_Array1OfMeasureOrUnspecifiedValue +StepElement_Array1OfSurfaceSection +StepElement_Array1OfVolumeElementPurpose +StepElement_Array1OfVolumeElementPurposeMember +StepElement_Array2OfCurveElementPurposeMember +StepElement_Array2OfSurfaceElementPurpose +StepElement_Array2OfSurfaceElementPurposeMember +StepElement_HArray1OfCurveElementEndReleasePacket +StepElement_HArray1OfCurveElementSectionDefinition +StepElement_HArray1OfHSequenceOfCurveElementPurposeMember +StepElement_HArray1OfHSequenceOfSurfaceElementPurposeMember +StepElement_HArray1OfMeasureOrUnspecifiedValue +StepElement_HArray1OfSurfaceSection +StepElement_HArray1OfVolumeElementPurpose +StepElement_HArray1OfVolumeElementPurposeMember +StepElement_HArray2OfCurveElementPurposeMember +StepElement_HArray2OfSurfaceElementPurpose +StepElement_HArray2OfSurfaceElementPurposeMember +StepElement_HSequenceOfCurveElementPurposeMember +StepElement_HSequenceOfCurveElementSectionDefinition +StepElement_HSequenceOfElementMaterial +StepElement_HSequenceOfSurfaceElementPurposeMember +StepElement_SequenceOfCurveElementPurposeMember +StepElement_SequenceOfCurveElementSectionDefinition +StepElement_SequenceOfElementMaterial +StepElement_SequenceOfSurfaceElementPurposeMember +StepFEA_Array1OfCurveElementEndOffset +StepFEA_Array1OfCurveElementEndRelease +StepFEA_Array1OfCurveElementInterval +StepFEA_Array1OfDegreeOfFreedom +StepFEA_Array1OfElementRepresentation +StepFEA_Array1OfNodeRepresentation +StepFEA_HArray1OfCurveElementEndOffset +StepFEA_HArray1OfCurveElementEndRelease +StepFEA_HArray1OfCurveElementInterval +StepFEA_HArray1OfDegreeOfFreedom +StepFEA_HArray1OfElementRepresentation +StepFEA_HArray1OfNodeRepresentation +StepFEA_HSequenceOfCurve3dElementProperty +StepFEA_HSequenceOfElementGeometricRelationship +StepFEA_HSequenceOfElementRepresentation +StepFEA_HSequenceOfNodeRepresentation +StepFEA_SequenceOfCurve3dElementProperty +StepFEA_SequenceOfElementGeometricRelationship +StepFEA_SequenceOfElementRepresentation +StepFEA_SequenceOfNodeRepresentation +StepGeom_Array1OfBoundaryCurve +StepGeom_Array1OfCartesianPoint +StepGeom_Array1OfCompositeCurveSegment +StepGeom_Array1OfCurve +StepGeom_Array1OfPcurveOrSurface +StepGeom_Array1OfSurfaceBoundary +StepGeom_Array1OfTrimmingSelect +StepGeom_Array2OfCartesianPoint +StepGeom_Array2OfSurfacePatch +StepGeom_HArray1OfBoundaryCurve +StepGeom_HArray1OfCartesianPoint +StepGeom_HArray1OfCompositeCurveSegment +StepGeom_HArray1OfCurve +StepGeom_HArray1OfPcurveOrSurface +StepGeom_HArray1OfSurfaceBoundary +StepGeom_HArray1OfTrimmingSelect +StepGeom_HArray2OfCartesianPoint +StepGeom_HArray2OfSurfacePatch +StepRepr_Array1OfMaterialPropertyRepresentation +StepRepr_Array1OfPropertyDefinitionRepresentation +StepRepr_Array1OfRepresentationItem +StepRepr_HArray1OfMaterialPropertyRepresentation +StepRepr_HArray1OfPropertyDefinitionRepresentation +StepRepr_HArray1OfRepresentationItem +StepRepr_HSequenceOfMaterialPropertyRepresentation +StepRepr_HSequenceOfRepresentationItem +StepRepr_SequenceOfMaterialPropertyRepresentation +StepRepr_SequenceOfRepresentationItem +STEPSelections_HSequenceOfAssemblyLink +STEPSelections_SequenceOfAssemblyComponent +STEPSelections_SequenceOfAssemblyLink +StepShape_Array1OfConnectedEdgeSet +StepShape_Array1OfConnectedFaceSet +StepShape_Array1OfEdge +StepShape_Array1OfFace +StepShape_Array1OfFaceBound +StepShape_Array1OfGeometricSetSelect +StepShape_Array1OfOrientedClosedShell +StepShape_Array1OfOrientedEdge +StepShape_Array1OfShell +StepShape_Array1OfValueQualifier +StepShape_HArray1OfConnectedEdgeSet +StepShape_HArray1OfConnectedFaceSet +StepShape_HArray1OfEdge +StepShape_HArray1OfFace +StepShape_HArray1OfFaceBound +StepShape_HArray1OfGeometricSetSelect +StepShape_HArray1OfOrientedClosedShell +StepShape_HArray1OfOrientedEdge +StepShape_HArray1OfShell +StepShape_HArray1OfValueQualifier +StepToTopoDS_DataMapOfRI +StepToTopoDS_DataMapOfRINames +StepToTopoDS_DataMapOfTRI +StepToTopoDS_PointEdgeMap +StepToTopoDS_PointVertexMap +StepVisual_Array1OfBoxCharacteristicSelect +StepVisual_Array1OfCurveStyleFontPattern +StepVisual_Array1OfDirectionCountSelect +StepVisual_Array1OfFillStyleSelect +StepVisual_Array1OfInvisibleItem +StepVisual_Array1OfLayeredItem +StepVisual_Array1OfPresentationStyleAssignment +StepVisual_Array1OfPresentationStyleSelect +StepVisual_Array1OfStyleContextSelect +StepVisual_Array1OfSurfaceStyleElementSelect +StepVisual_Array1OfTextOrCharacter +StepVisual_HArray1OfBoxCharacteristicSelect +StepVisual_HArray1OfCurveStyleFontPattern +StepVisual_HArray1OfDirectionCountSelect +StepVisual_HArray1OfFillStyleSelect +StepVisual_HArray1OfInvisibleItem +StepVisual_HArray1OfLayeredItem +StepVisual_HArray1OfPresentationStyleAssignment +StepVisual_HArray1OfPresentationStyleSelect +StepVisual_HArray1OfStyleContextSelect +StepVisual_HArray1OfSurfaceStyleElementSelect +StepVisual_HArray1OfTextOrCharacter +StlMesh_SequenceOfMesh +StlMesh_SequenceOfMeshDomain +StlMesh_SequenceOfMeshTriangle +Storage_ArrayOfCallBack +Storage_ArrayOfSchema +Storage_HArrayOfCallBack +Storage_HArrayOfSchema +Storage_HPArray +Storage_HSeqOfRoot +Storage_MapOfCallBack +Storage_MapOfPers +Storage_PArray +Storage_PType +Storage_SeqOfRoot +TColGeom2d_Array1OfBezierCurve +TColGeom2d_Array1OfBSplineCurve +TColGeom2d_Array1OfCurve +TColGeom2d_HArray1OfBezierCurve +TColGeom2d_HArray1OfBSplineCurve +TColGeom2d_HArray1OfCurve +TColGeom2d_HSequenceOfBoundedCurve +TColGeom2d_HSequenceOfCurve +TColGeom2d_SequenceOfBoundedCurve +TColGeom2d_SequenceOfCurve +TColGeom2d_SequenceOfGeometry +TColGeom_Array1OfBezierCurve +TColGeom_Array1OfBSplineCurve +TColGeom_Array1OfCurve +TColGeom_Array1OfSurface +TColGeom_Array2OfBezierSurface +TColGeom_Array2OfSurface +TColGeom_HArray1OfBezierCurve +TColGeom_HArray1OfBSplineCurve +TColGeom_HArray1OfCurve +TColGeom_HArray1OfSurface +TColGeom_HArray2OfSurface +TColGeom_HSequenceOfBoundedCurve +TColGeom_HSequenceOfCurve +TColGeom_SequenceOfBoundedCurve +TColGeom_SequenceOfCurve +TColGeom_SequenceOfSurface +TColgp_Array1OfCirc2d +TColgp_Array1OfDir +TColgp_Array1OfDir2d +TColgp_Array1OfLin2d +TColgp_Array1OfPnt +TColgp_Array1OfPnt2d +TColgp_Array1OfVec +TColgp_Array1OfVec2d +TColgp_Array1OfXY +TColgp_Array1OfXYZ +TColgp_Array2OfCirc2d +TColgp_Array2OfDir +TColgp_Array2OfDir2d +TColgp_Array2OfLin2d +TColgp_Array2OfPnt +TColgp_Array2OfPnt2d +TColgp_Array2OfVec +TColgp_Array2OfVec2d +TColgp_Array2OfXY +TColgp_Array2OfXYZ +TColgp_HArray1OfCirc2d +TColgp_HArray1OfDir +TColgp_HArray1OfDir2d +TColgp_HArray1OfLin2d +TColgp_HArray1OfPnt +TColgp_HArray1OfPnt2d +TColgp_HArray1OfVec +TColgp_HArray1OfVec2d +TColgp_HArray1OfXY +TColgp_HArray1OfXYZ +TColgp_HArray2OfCirc2d +TColgp_HArray2OfDir +TColgp_HArray2OfDir2d +TColgp_HArray2OfLin2d +TColgp_HArray2OfPnt +TColgp_HArray2OfPnt2d +TColgp_HArray2OfVec +TColgp_HArray2OfVec2d +TColgp_HArray2OfXY +TColgp_HArray2OfXYZ +TColgp_HSequenceOfDir +TColgp_HSequenceOfDir2d +TColgp_HSequenceOfPnt +TColgp_HSequenceOfPnt2d +TColgp_HSequenceOfVec +TColgp_HSequenceOfVec2d +TColgp_HSequenceOfXY +TColgp_HSequenceOfXYZ +TColgp_SequenceOfArray1OfPnt2d +TColgp_SequenceOfAx1 +TColgp_SequenceOfDir +TColgp_SequenceOfDir2d +TColgp_SequenceOfPnt +TColgp_SequenceOfPnt2d +TColgp_SequenceOfVec +TColgp_SequenceOfVec2d +TColgp_SequenceOfXY +TColgp_SequenceOfXYZ +TColQuantity_Array1OfLength +TColQuantity_Array2OfLength +TColQuantity_HArray1OfLength +TColQuantity_HArray2OfLength +TColStd_Array1OfAsciiString +TColStd_Array1OfBoolean +TColStd_Array1OfByte +TColStd_Array1OfCharacter +TColStd_Array1OfExtendedString +TColStd_Array1OfInteger +TColStd_Array1OfListOfInteger +TColStd_Array1OfReal +TColStd_Array1OfTransient +TColStd_Array2OfBoolean +TColStd_Array2OfCharacter +TColStd_Array2OfInteger +TColStd_Array2OfReal +TColStd_Array2OfTransient +TColStd_DataMapOfAsciiStringInteger +TColStd_DataMapOfIntegerInteger +TColStd_DataMapOfIntegerListOfInteger +TColStd_DataMapOfIntegerReal +TColStd_DataMapOfIntegerTransient +TColStd_DataMapOfStringInteger +TColStd_DataMapOfTransientTransient +TColStd_HArray1OfAsciiString +TColStd_HArray1OfBoolean +TColStd_HArray1OfByte +TColStd_HArray1OfCharacter +TColStd_HArray1OfExtendedString +TColStd_HArray1OfInteger +TColStd_HArray1OfListOfInteger +TColStd_HArray1OfReal +TColStd_HArray1OfTransient +TColStd_HArray2OfBoolean +TColStd_HArray2OfCharacter +TColStd_HArray2OfInteger +TColStd_HArray2OfReal +TColStd_HArray2OfTransient +TColStd_HSequenceOfAsciiString +TColStd_HSequenceOfExtendedString +TColStd_HSequenceOfHAsciiString +TColStd_HSequenceOfHExtendedString +TColStd_HSequenceOfInteger +TColStd_HSequenceOfReal +TColStd_HSequenceOfTransient +TColStd_IndexedDataMapOfTransientTransient +TColStd_IndexedMapOfInteger +TColStd_IndexedMapOfReal +TColStd_IndexedMapOfTransient +TColStd_ListOfAsciiString +TColStd_ListOfInteger +TColStd_ListOfReal +TColStd_ListOfTransient +TColStd_MapIntegerHasher +TColStd_MapOfAsciiString +TColStd_MapOfInteger +TColStd_MapOfReal +TColStd_MapOfTransient +TColStd_MapRealHasher +TColStd_MapTransientHasher +TColStd_SequenceOfAddress +TColStd_SequenceOfAsciiString +TColStd_SequenceOfBoolean +TColStd_SequenceOfExtendedString +TColStd_SequenceOfHAsciiString +TColStd_SequenceOfHExtendedString +TColStd_SequenceOfInteger +TColStd_SequenceOfReal +TColStd_SequenceOfTransient +TDataStd_DataMapOfStringByte +TDataStd_DataMapOfStringHArray1OfInteger +TDataStd_DataMapOfStringHArray1OfReal +TDataStd_DataMapOfStringReal +TDataStd_DataMapOfStringString +TDataStd_HLabelArray1 +TDataStd_LabelArray1 +TDataStd_ListOfByte +TDataStd_ListOfExtendedString +TDataXtd_Array1OfTrsf +TDataXtd_HArray1OfTrsf +TDF_AttributeArray1 +TDF_AttributeDataMap +TDF_AttributeDeltaList +TDF_AttributeDoubleMap +TDF_AttributeIndexedMap +TDF_AttributeList +TDF_AttributeMap +TDF_AttributeSequence +TDF_DeltaList +TDF_GUIDProgIDMap +TDF_HAttributeArray1 +TDF_IDList +TDF_IDMap +TDF_LabelDataMap +TDF_LabelDoubleMap +TDF_LabelIndexedMap +TDF_LabelIntegerMap +TDF_LabelList +TDF_LabelMap +TDF_LabelSequence +TDocStd_LabelIDMapDataMap +TDocStd_SequenceOfApplicationDelta +TDocStd_SequenceOfDocument +TestTopOpeDraw_Array1OfDrawableMesure +TestTopOpeDraw_Array1OfDrawableP3D +TestTopOpeDraw_HArray1OfDrawableMesure +TestTopOpeDraw_HArray1OfDrawableP3D +TestTopOpeDraw_ListOfPnt2d +TestTopOpeTools_Array1OfMesure +TestTopOpeTools_HArray1OfMesure +TFunction_Array1OfDataMapOfGUIDDriver +TFunction_DataMapOfGUIDDriver +TFunction_DataMapOfLabelListOfLabel +TFunction_DoubleMapOfIntegerLabel +TFunction_HArray1OfDataMapOfGUIDDriver +TNaming_DataMapOfShapePtrRefShape +TNaming_DataMapOfShapeShapesSet +TNaming_ListOfIndexedDataMapOfShapeListOfShape +TNaming_ListOfMapOfShape +TNaming_ListOfNamedShape +TNaming_MapOfNamedShape +TNaming_NamedShapeHasher +TopBas_ListOfTestInterference +TopLoc_IndexedMapOfLocation +TopLoc_MapLocationHasher +TopLoc_MapOfLocation +TopoDS_ListOfShape +TopOpeBRep_Array1OfLineInter +TopOpeBRep_Array1OfVPointInter +TopOpeBRep_DataMapOfTopolTool +TopOpeBRep_HArray1OfLineInter +TopOpeBRep_HArray1OfVPointInter +TopOpeBRep_ListOfBipoint +TopOpeBRep_SequenceOfPoint2d +TopOpeBRepBuild_DataMapOfShapeListOfShapeListOfShape +TopOpeBRepBuild_IndexedDataMapOfShapeVertexInfo +TopOpeBRepBuild_ListOfListOfLoop +TopOpeBRepBuild_ListOfLoop +TopOpeBRepBuild_ListOfPave +TopOpeBRepBuild_ListOfShapeListOfShape +TopOpeBRepDS_Array1OfDataMapOfIntegerListOfInterference +TopOpeBRepDS_DataMapOfCheckStatus +TopOpeBRepDS_DataMapOfIntegerListOfInterference +TopOpeBRepDS_DataMapOfInterferenceListOfInterference +TopOpeBRepDS_DataMapOfInterferenceShape +TopOpeBRepDS_DataMapOfShapeListOfShapeOn1State +TopOpeBRepDS_DataMapOfShapeState +TopOpeBRepDS_DoubleMapOfIntegerShape +TopOpeBRepDS_HArray1OfDataMapOfIntegerListOfInterference +TopOpeBRepDS_IndexedDataMapOfShapeWithState +TopOpeBRepDS_IndexedDataMapOfVertexPoint +TopOpeBRepDS_ListOfInterference +TopOpeBRepDS_MapOfCurve +TopOpeBRepDS_MapOfIntegerShapeData +TopOpeBRepDS_MapOfPoint +TopOpeBRepDS_MapOfShapeData +TopOpeBRepDS_MapOfSurface +TopOpeBRepDS_ShapeSurface +TopOpeBRepTool_DataMapOfOrientedShapeC2DF +TopOpeBRepTool_DataMapOfShapeface +TopOpeBRepTool_DataMapOfShapeListOfC2DF +TopOpeBRepTool_IndexedDataMapOfShapeBox +TopOpeBRepTool_IndexedDataMapOfShapeBox2d +TopOpeBRepTool_IndexedDataMapOfShapeconnexity +TopOpeBRepTool_IndexedDataMapOfSolidClassifier +TopOpeBRepTool_ListOfC2DF +TopTools_Array1OfListOfShape +TopTools_Array1OfShape +TopTools_Array2OfShape +TopTools_DataMapOfIntegerListOfShape +TopTools_DataMapOfIntegerShape +TopTools_DataMapOfOrientedShapeInteger +TopTools_DataMapOfOrientedShapeShape +TopTools_DataMapOfShapeInteger +TopTools_DataMapOfShapeListOfInteger +TopTools_DataMapOfShapeListOfShape +TopTools_DataMapOfShapeReal +TopTools_DataMapOfShapeSequenceOfShape +TopTools_DataMapOfShapeShape +TopTools_HArray1OfListOfShape +TopTools_HArray1OfShape +TopTools_HArray2OfShape +TopTools_HSequenceOfShape +TopTools_IndexedDataMapOfShapeAddress +TopTools_IndexedDataMapOfShapeListOfShape +TopTools_IndexedDataMapOfShapeShape +TopTools_IndexedMapOfOrientedShape +TopTools_IndexedMapOfShape +TopTools_ListOfShape +TopTools_MapOfOrientedShape +TopTools_MapOfShape +TopTools_SequenceOfShape +TopTrans_Array2OfOrientation +TPrsStd_DataMapOfGUIDDriver +Transfer_HSequenceOfBinder +Transfer_HSequenceOfFinder +Transfer_SequenceOfBinder +Transfer_SequenceOfFinder +TransferBRep_HSequenceOfTransferResultInfo +TransferBRep_SequenceOfTransferResultInfo +TShort_Array1OfShortReal +TShort_Array2OfShortReal +TShort_HArray1OfShortReal +TShort_HArray2OfShortReal +TShort_HSequenceOfShortReal +TShort_SequenceOfShortReal +Units_QtsSequence +Units_QuantitiesSequence +Units_TksSequence +Units_TokensSequence +Units_UnitsSequence +Units_UtsSequence +ViewerTest_DoubleMapOfInteractiveAndName +Visual3d_HSequenceOfLight +Visual3d_HSequenceOfView +Visual3d_SequenceOfLight +Visual3d_SequenceOfView +XCAFDoc_DataMapOfShapeLabel +XCAFDoc_GraphNodeSequence +XCAFPrs_DataMapOfShapeStyle +XCAFPrs_DataMapOfStyleShape +XCAFPrs_DataMapOfStyleTransient +XmlLDrivers_SequenceOfNamespaceDef +XmlMDF_MapOfDriver +XmlMDF_TypeADriverMap +XSDRAWSTLVRML_CoordsMap +XSDRAWSTLVRML_ElemNodesMap diff --git a/adm/upgrade.tcl b/adm/upgrade.tcl new file mode 100644 index 0000000000..204fca691b --- /dev/null +++ b/adm/upgrade.tcl @@ -0,0 +1,1319 @@ +# This script provides commands for upgrade of OCCT and software based on it +# to a newer version of OCCT (7.0) + + +# source code for upgrading +set ArgName(HelpInfo) "h" + +set ArgName(SourceCode) "src" +set ArgName(IncPath) "inc" + +set ArgName(IncExtension) "incext" +set ArgName(SrcExtension) "srcext" + +set ArgName(RTTI) "rtti" + +set ArgName(CStyleCastHandle) "handlecast" +set ArgName(All) "all" + +set ArgName(Handle) "handle" +set ArgName(TCollection) "tcollection" + +set ArgName(CompatibleMode) "compat" + +set ArgName(Recurse) "recurse" +set ArgName(Rename) "rename" + +set ArgName(CheckOnly) "check" +set ArgName(WLog) "wlog" +set ArgName(Log) "log" + +proc HelpInformation {} { + global ArgName + global DataSectionName + + loginfo "Tool for upgrade of application code from older versions of OCCT." + loginfo "" + loginfo "Required parameter:" + loginfo " -$ArgName(SourceCode)= - path to sources to upgrade" + loginfo "" + loginfo "File search options:" + loginfo " -$ArgName(IncPath)= - path to header files of OCCT or other used libraries" + loginfo " -$ArgName(Recurse) - process all subfolders of '-$ArgName(SourceCode)' and '-$ArgName(IncPath)'" + loginfo " -$ArgName(SrcExtension)=cxx,cpp - extensions of source files" + loginfo " -$ArgName(IncExtension)=hxx,h,lxx,gxx - extensions of header files" + loginfo "" + loginfo "Upgrade options:" + loginfo " -$ArgName(All) - do all upgrades (if neither of below options are given)" + loginfo " -$ArgName(RTTI) - adapt code for changes in type system (RTTI) in OCCT 7.0" + loginfo " -$ArgName(Handle) - adapt code for changes in OCCT Handle" + loginfo " -$ArgName(TCollection) - replace forward declaration of TCollection classes by #include" + loginfo " -$ArgName(CStyleCastHandle) - replace c-style casts of Handle by DownCast()" + loginfo " -$ArgName(Rename) - apply renaming of classes" + loginfo "" + loginfo "Advanced options:" + loginfo " -$ArgName(CompatibleMode) - preserve old RTTI macros for compatability with OCCT 6.x" + loginfo " -$ArgName(CheckOnly) - do check only, no modifications will be made" + loginfo " -$ArgName(WLog) - show gui log of upgrade process" + loginfo " -$ArgName(Log)= - put the log into a file" + + return +} + +proc ParseArgs {theArgValues theArgs {theRemoveFromArgs "false"}} { + upvar $theArgValues anArgValues + + global ArgName + global DataSectionName + + # help information + set anArgValues(HelpInfo) [SeekArg $ArgName(HelpInfo) theArgs "false" $theRemoveFromArgs] + + # sources that will be upgraded + set anArgValues(SourceCode) [SeekArg $ArgName(SourceCode) theArgs "" $theRemoveFromArgs] + + set anArgValues(IncExtension) [SeekArg $ArgName(IncExtension) theArgs "h,hpp,hxx,gxx,lxx" $theRemoveFromArgs] + set anArgValues(SrcExtension) [SeekArg $ArgName(SrcExtension) theArgs "c,cpp,cxx" $theRemoveFromArgs] + + # inc folder + set anArgValues(IncPath) [SeekArg $ArgName(IncPath) theArgs "$anArgValues(SourceCode)" $theRemoveFromArgs] + + set anArgValues(RTTI) [SeekArg $ArgName(RTTI) theArgs "false" $theRemoveFromArgs] + set anArgValues(CStyleCastHandle) [SeekArg $ArgName(CStyleCastHandle) theArgs "false" $theRemoveFromArgs] + + set anArgValues(Handle) [SeekArg $ArgName(Handle) theArgs "false" $theRemoveFromArgs] + set anArgValues(TCollection) [SeekArg $ArgName(TCollection) theArgs "false" $theRemoveFromArgs] + + set anArgValues(Rename) [SeekArg $ArgName(Rename) theArgs "false" $theRemoveFromArgs] + + set aHasAgentArgs [expr {$anArgValues(RTTI) || $anArgValues(CStyleCastHandle) || \ + $anArgValues(Handle) || $anArgValues(TCollection)} || \ + $anArgValues(Rename)] + + set anArgValues(All) [SeekArg $ArgName(All) theArgs [expr {!$aHasAgentArgs}] $theRemoveFromArgs] + + set anArgValues(Recurse) [SeekArg $ArgName(Recurse) theArgs "false" $theRemoveFromArgs] + set anArgValues(CompatibleMode) [SeekArg $ArgName(CompatibleMode) theArgs "false" $theRemoveFromArgs] + set anArgValues(CheckOnly) [SeekArg $ArgName(CheckOnly) theArgs "false" $theRemoveFromArgs] + set anArgValues(WLog) [SeekArg $ArgName(WLog) theArgs "false" $theRemoveFromArgs] + + set anArgValues(Log) [SeekArg $ArgName(Log) theArgs "" $theRemoveFromArgs] + + return $theArgs +} + +proc SeekArg {theSoughtArgName theArgs {theDefaultArgValue ""} {theRemoveFromArgs false}} { + upvar ${theArgs} anArgs + + set aBooleanValue [string is boolean -strict $theDefaultArgValue] + + set anArgValues {} + + set anArgsIndex -1 + foreach anArg $anArgs { + incr anArgsIndex + + if {[regexp -- "-${theSoughtArgName}\=\(.\*\)" $anArg dummy anArgValue]} { + set anArgValue [regsub -all {\\} $anArgValue {/}] + if {$theRemoveFromArgs} { + set anArgs [lreplace $anArgs $anArgsIndex $anArgsIndex] + incr anArgsIndex -1 + } + if {"$anArgValue" != ""} { + lappend anArgValues $anArgValue + } else { + logwarn "'-${theSoughtArgName}' is skipped because it has empty value" + } + } elseif [string match "-${theSoughtArgName}" $anArg] { + if {$theRemoveFromArgs} { + set anArgs [lreplace $anArgs $anArgsIndex $anArgsIndex] + } + # skip non-boolean empty argument; do not break the foreach loop + if {$aBooleanValue} { + lappend anArgValues "true" + break + } else { + logwarn "'-${theSoughtArgName}' is skipped because it has empty value" + } + } + } + + # return boolean value as string + if {$aBooleanValue} { + if {[llength $anArgValues] > 0} { + return [lindex $anArgValues 0] + } else { + return $theDefaultArgValue + } + } + + if {[llength $anArgValues] == 0 && "$theDefaultArgValue" != ""} { + lappend anArgValues $theDefaultArgValue + } + + return $anArgValues +} + +# section names in the data file +set DataSectionName(TCollection) "tcollection" +set DataSectionName(Rename) "rename" + +proc DataFileName {} { + return [file join [file dirname [info script]] upgrade.dat] +} + +proc IsDataFileExist {} { + return [file exists [DataFileName]] +} + +proc ReadFromDataFile {theSectionName} { + if {![file exists [DataFileName]]} { + return + } + + set aFileContent [ReadFileToList [DataFileName] aFileRawContent aDataEOL] + + set aSectionValueList {} + + set anIsSection false + set aSectionPattern {^ *\[ *([A-Za-z0-9_\.]*) *\]+} + foreach aLine $aFileContent { + if {[regexp -- $aSectionPattern $aLine dummy aSectionName]} { + if {"$aSectionName" == "$theSectionName"} { + set anIsSection true + continue + } elseif {$anIsSection == true} { + set anIsSection false + break + } + } + + if {$anIsSection == true} { + set aTrimmedLine [string trimright $aLine] + if {"$aTrimmedLine" != ""} { + lappend aSectionValueList $aTrimmedLine + } + } + } + + return $aSectionValueList +} + +proc SaveToDataFile {theSectionName theSectionContent} { + if {![file exists [DataFileName]]} { + return + } + + set aFileContent [ReadFileToList [DataFileName] aFileRawContent aDataEOL] + + set aLinesBefore {} + set aLinesAfter {} + + set anIsSection false + set anIsSectionBefore true + set anIsSectionAfter false + + set aSectionPattern {^ *\[ *([A-Za-z0-9_\.]*) *\]+} + foreach aLine $aFileContent { + if {$anIsSectionBefore} { + lappend aLinesBefore $aLine + } + + if {[regexp -- $aSectionPattern $aLine dummy aSectionName]} { + if {"$aSectionName" == "$theSectionName"} { + set anIsSectionBefore false + set anIsSection true + } elseif {$anIsSection == true} { + set anIsSection false + set anIsSectionAfter true + } + } + + if {$anIsSection == true} { + continue + } + + if {$anIsSectionAfter} { + lappend aLinesAfter $aLine + } + } + + # write to file + SaveListToFile [DataFileName] [list {*}$aLinesBefore {*}$theSectionContent {*}$aLinesAfter] $aDataEOL +} + +# Main tool, accepts path to location of source tree to be upgraded. +proc upgrade {args} { + + global ArgName + global LogFilePath + global DataSectionName + + set theArgs $args + set anUnparsedArgs [ParseArgs anArgValues $theArgs "true"] + + if {"$anUnparsedArgs" != ""} { + logerr "undefined arguments: $anUnparsedArgs" + loginfo "use -$ArgName(HelpInfo) to show all the arguments" + return + } + + if {$anArgValues(HelpInfo) || [llength $anArgValues(SourceCode)] == 0} { + HelpInformation + return + } + + if {"$anArgValues(Log)" != ""} { + set LogFilePath $anArgValues(Log) + + # clean file before writing + if {[file exists "$LogFilePath"]} { + set fd [open "$LogFilePath" r+] + chan truncate $fd 0 + close $fd + } + } + + if {$anArgValues(WLog)} { + _create_logger + } + + # collect src directory structure (all subdirs) + set anIncPaths {} + foreach aSrcDir $anArgValues(SourceCode) { + lappend anIncPaths $aSrcDir + foreach aSubSrcDir [CollectDirStructure $aSrcDir] { + lappend anIncPaths $aSubSrcDir + } + } + + foreach anIncDir $anArgValues(IncPath) { + lappend anIncPaths $anIncDir + foreach aSubIncDir [CollectDirStructure $anIncDir] { + lappend anIncPaths $aSubIncDir + } + } + + set anIncPaths [lsort -unique -dictionary $anIncPaths] + # end the collect + + set aRawNewNames [ReadFromDataFile $DataSectionName(Rename)] + foreach aRawName $aRawNewNames { + set aRawName [split $aRawName " "] + if {[llength $aRawName] > 1} { + # set aNewNames (old name) [new name] + set aNewNames([lindex ${aRawName} 0]) [lindex ${aRawName} 1] + } + } + + set aDoRename true + if {[llength [array names aNewNames]] == 0} { + set aDoRename false + + logwarn "renaming skipped. there is no class names to rename" + logwarn "see the content of [DataFileName] file, $DataSectionName(Rename) section" + } + + set aProcNameWithArgs "[lindex [info level 0] 0]" + foreach anArgName [array names anArgValues] { + if [string is boolean -strict $anArgValues($anArgName)] { + if [string is true "$anArgValues($anArgName)"] { + set aProcNameWithArgs [format "$aProcNameWithArgs -%s" "$ArgName($anArgName)"] + } + } else { + set aProcNameWithArgs [format "$aProcNameWithArgs -%s" "$ArgName($anArgName)=$anArgValues($anArgName)"] + } + } + + loginfo "$aProcNameWithArgs" + + # merge all processed extensions + set anExtensions "$anArgValues(SrcExtension),$anArgValues(IncExtension)" + + set aSourceCodePaths $anArgValues(SourceCode) + while {[llength $aSourceCodePaths]} { + set aSourceCodePaths [lassign $aSourceCodePaths aProcessedPath] + + loginfo "Processing: $aProcessedPath" + + if {$anArgValues(All) || $anArgValues(RTTI)} { + ConvertRtti $aProcessedPath \ + $anIncPaths \ + $anArgValues(CheckOnly) \ + $anArgValues(CompatibleMode) \ + $anArgValues(IncExtension) \ + $anArgValues(SrcExtension) + } + + if {$anArgValues(All) || $anArgValues(Handle)} { + ConvertHandle $aProcessedPath $anIncPaths $anArgValues(CheckOnly) $anExtensions + } + + if {$anArgValues(All) || $anArgValues(TCollection)} { + ConvertTColFwd $aProcessedPath $anArgValues(IncExtension) + } + + if {$anArgValues(All) || $anArgValues(CStyleCastHandle)} { + ConvertCStyleHandleCast $aProcessedPath $anExtensions $anArgValues(CheckOnly) + } + + if {$anArgValues(All) || $anArgValues(Rename)} { + if {$aDoRename} { + Rename $aProcessedPath $anExtensions aNewNames $anArgValues(CheckOnly) + } + } + + # Recurse processing + if {$anArgValues(Recurse)} { + lappend aSourceCodePaths {*}[glob -nocomplain -directory $aProcessedPath -type d *] + } + } +} + +# search and rename the indeces (old names) of @theNewNames with their values (new ones) +# processes files that have @theExtensions only in @thePath folder +proc Rename {thePath theExtensions theNewNames theCheckMode} { + upvar $theNewNames aNewNames + + set aNames [array names aNewNames] + + foreach aFile [glob -nocomplain -type f -directory $thePath *.{$theExtensions}] { +# loginfo "$aFile processing" + set aFileContent [ReadFileToRawText $aFile] + + set aHasChanges false + foreach aName $aNames { + set anIndexInRow 0 + set aClassNameTmpl "\\m$aName\\M" + while { [regexp -start $anIndexInRow -indices -lineanchor $aClassNameTmpl $aFileContent aFoundClassNameLoc] } { + set anIndexInRow [lindex $aFoundClassNameLoc 1] + + if {$theCheckMode} { + logwarn "Warning: $aFile contains $aName" + break + } else { + set aHasChanges true + ReplaceSubString aFileContent $aFoundClassNameLoc "$aNewNames($aName)" anIndexInRow + incr anIndexInRow -1 + } + } + } + + if {$aHasChanges} { + SaveTextToFile $aFile $aFileContent + } + } +} + +# @thePackagePath eather file or folder. If it is a folder, +# all files with @theHeaderExtensions are processed. +# "fwd.tcollection" section from upgrade.ini file is used to find out what +# classes have been converted and, thus, what forward declarations can be replaced +proc ConvertTColFwd {thePackagePath theHeaderExtensions} { + global DataSectionName + + # Note: the content of theHeaderExtensions should have + # further form (values separated by comma): "ext1,ext2,ext3" + # this form will be used below in reg expression to collect all header files + + if {! [file exists $thePackagePath]} { + logerr "Error: $thePackagePath does not exist" + return + } + + # read the list of already converted TCollection classes + if [IsDataFileExist] { + set aConvertedTColClasses [ReadFromDataFile $DataSectionName(TCollection)] + } else { + logerr "[DataFileName] file of upgrade process does not exist" + return + } + + # pattern that will be used + set aForwardDeclPattern {^ *class *([A-Za-z0-9_/\.]+) *;} + + set aTargetPaths ${thePackagePath} + while {[llength $aTargetPaths]} { + set aTargetPaths [lassign $aTargetPaths aProcessedPath] + + # if aProcessedPath is a folder, collect all files with $theHeaderExtensions from it + set aProcessedHeaders ${aProcessedPath} + if {[file isdirectory $aProcessedPath]} { + # get all header files + set aProcessedHeaders [glob -nocomplain -type f -directory $aProcessedPath *.{$theHeaderExtensions}] + } + + foreach aHeader $aProcessedHeaders { + set aHeaderLineIndex -1 + set aHeaderContentUpdated false + + # read the content of the header file + set aHeaderContent [ReadFileToList $aHeader aHeaderRawContent aHeaderEOL] + + # remove _isMulti variable that used in _check_line + set _isMulti false + + foreach aHeaderContentLine $aHeaderContent { + incr aHeaderLineIndex + + # remove _cmnt variable that used in _check_line + set _cmnt "" + + set aHeaderContentLine [_check_line $aHeaderContentLine] + if {[regexp {^ *class *([A-Za-z0-9_/\.]+) *;} $aHeaderContentLine dummy aForwardDeclClass]} { + if {[lsearch $aConvertedTColClasses $aForwardDeclClass] != -1} { + set aHeaderContentUpdated true + set aHeaderContentRow "\#include <$aForwardDeclClass.hxx>" + set aHeaderContent [lreplace $aHeaderContent $aHeaderLineIndex $aHeaderLineIndex $aHeaderContentRow] + } + } + } + + if {$aHeaderContentUpdated} { + loginfo "$aHeader updated" + SaveListToFile $aHeader $aHeaderContent $aHeaderEOL + } + } + } +} + +# Parse source files and: +# +# - add second argument to macro DEFINE_STANDARD_RTTI specifying first base +# class found in the class declaration; +# - replace includes of Standard_DefineHandle.hxx by Standard_Type.hxx; +# - add #includes for all classes used as argument to macro +# STANDARD_TYPE(), except of already included ones +# +# If theCompatibleMode is false, in addition: +# - removes macros IMPLEMENT_DOWNCAST() and IMPLEMENT_STANDARD_*(); +proc ConvertRtti {theProcessedPath theIncPaths theCheckMode theCompatibleMode \ + theHeaderExtensions theSourceExtensions} { + + # iterate by header and source files + foreach aProcessedFile [glob -nocomplain -type f -directory $theProcessedPath *.{$theHeaderExtensions,$theSourceExtensions}] { + set aProcessedFileName [file tail $aProcessedFile] + + set aProcessedFileContent [ReadFileToRawText $aProcessedFile] + + # find all declarations of classes with public base in this header file; + # the result is stored in array inherits(class) + set index 0 + array unset inherits + set pattern_class {^\s*class\s+([A-Za-z_0-9:]+)\s*:\s*public\s+([A-Za-z_0-9:]+)\s*([,]?)} + while {[regexp -start $index -indices -lineanchor $pattern_class $aProcessedFileContent location class base comma]} { + set index [lindex $location 1] + + set class [eval string range \$aProcessedFileContent $class] + set base [eval string range \$aProcessedFileContent $base] + + if { [info exists inherits($class)] } { + set inherits($class,multiple) "found multiple declarations of class $class" + } else { + if { [lindex $comma 0] <= [lindex $comma 1] } { + set inherits($class,multiple) "class $class uses multiple inheritance" + } + set inherits($class) $base + } + } + + set change_flag 0 + + # find all instances of DEFINE_STANDARD_RTTI with single or two arguments + set index 0 + set pattern_rtti {^(\s*DEFINE_STANDARD_RTTI\s*)\(\s*([A-Za-z_0-9,\s]+)\s*\)} + while { [regexp -start $index -indices -lineanchor $pattern_rtti \ + $aProcessedFileContent location start clist] } { + set index [lindex $location 1] + + set start [eval string range \$aProcessedFileContent $start] + set clist [split [eval string range \$aProcessedFileContent $clist] ,] + + if { [llength $clist] == 1 } { + set class [string trim [lindex $clist 0]] + if { [info exists inherits($class)] } { + if { ! $theCheckMode } { + if { [info exists inherits($class,multiple)] } { + logwarn "Warning in $aProcessedFileName: $inherits($class,multiple);" + logwarn "macro DEFINE_STANDARD_RTTI is changed assuming it inherits $inherits($class), please check!" + } + set change_flag 1 + ReplaceSubString aProcessedFileContent $location "${start}($class, $inherits($class))" index + } + } else { + logwarn "Error in $aProcessedFile: Macro DEFINE_STANDARD_RTTI used for class $class whose declaration is not found in this file, cannot fix" + } + } elseif { [llength $clist] == 2 } { + set class [string trim [lindex $clist 0]] + set base [string trim [lindex $clist 1]] + if { ! [info exists inherits($class)] } { + logwarn "Warning in $aProcessedFile: Macro DEFINE_STANDARD_RTTI used for class $class whose declaration is not found in this file" + } elseif { $base != $inherits($class) } { + logwarn "Warning in $aProcessedFile: Second argument in macro DEFINE_STANDARD_RTTI for class $class is $base while $class seems to inherit from $inherits($class)" + if { ! $theCheckMode && ! [info exists inherits($class,multiple)] } { + set change_flag 1 + ReplaceSubString aProcessedFileContent $location "${start}($class, $inherits($class))" index + } + } + } + } + + # replace includes of Standard_DefineHandle.hxx by Standard_Type.hxx +# set index 0 +# set pattern_definehandle {\#\s*include\s*<\s*Standard_DefineHandle.hxx\s*>} +# while { [regexp -start $index -indices -lineanchor $pattern_definehandle $aProcessedFileContent location] } { +# set index [lindex $location 1] +# if { ! $theCheckMode } { +# set change_flag 1 +# ReplaceSubString aProcessedFileContent $location "\#include " index +# incr index -1 +# } else { +# logwarn "Warning: $aProcessedFile contains obsolete forward declarations of Handle classes" +# break +# } +# } + + # remove macros IMPLEMENT_DOWNCAST() and IMPLEMENT_STANDARD_*(); + if { ! $theCompatibleMode } { + set index 0 + set first_newline \n\n + set pattern_implement {\\?\n\s*IMPLEMENT_(DOWNCAST|STANDARD_[A-Z_]+|HARRAY1|HARRAY2|HUBTREE|HEBTREE|HSEQUENCE)\s*\([A-Za-z0-9_ ,]*\)\s*;?} + while { [regexp -start $index -indices -lineanchor $pattern_implement $aProcessedFileContent location] } { + set index [lindex $location 1] + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString aProcessedFileContent $location $first_newline index +# set first_newline "" + incr index -1 + } else { + logwarn "Warning: $aProcessedFile contains deprecated macros IMPLEMENT_*" + break + } + } + } + + # find all uses of macro STANDARD_TYPE and method DownCast and ensure that + # argument class is explicitly included + set pattern_incbeg {\s*#\s*include\s*[\"<]\s*} + set pattern_incend {[.][a-zA-Z]+\s*[\">]} + set index 0 + set addtype {} + set pattern_type1 {STANDARD_TYPE\s*\(\s*([A-Za-z0-9_]+)\s*\)} + while { [regexp -start $index -indices $pattern_type1 $aProcessedFileContent location name] } { + set index [lindex $location 1] + set name [eval string range \$aProcessedFileContent $name] + if { ! [regexp -lineanchor "^${pattern_incbeg}${name}${pattern_incend}" $aProcessedFileContent] && + [lsearch -exact $addtype $name] < 0 && + [SearchForFile $theIncPaths $name.hxx]} { + lappend addtype $name + } + } + set pattern_type2 {Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*::\s*DownCast} + while { [regexp -start $index -indices $pattern_type2 $aProcessedFileContent location name] } { + set index [lindex $location 1] + set name [eval string range \$aProcessedFileContent $name] + if { ! [regexp -lineanchor "^${pattern_incbeg}${name}${pattern_incend}" $aProcessedFileContent] && + [lsearch -exact $addtype $name] < 0 && + [SearchForFile $theIncPaths $name.hxx]} { + lappend addtype $name + } + } + if { [llength $addtype] > 0 } { + if { ! $theCheckMode } { + set addinc "" + foreach type $addtype { + append addinc "\n#include <$type.hxx>" + } + if { [regexp -indices ".*\n${pattern_incbeg}\[A-Za-z0-9_/\]+${pattern_incend}" $aProcessedFileContent location] } { + set change_flag 1 + ReplaceSubString aProcessedFileContent $location "[eval string range \$aProcessedFileContent $location]$addinc" index + } else { + logerr "Error: $aProcessedFile: Cannot find #include statement to add more includes..." + } + } else { + logwarn "Warning: $aProcessedFile: The following class names are used as arguments of STANDARD_TYPE" + logwarn " macro, but not included directly: $addtype" + break + } + } + + # apply changes to the header file + if { $change_flag } { + SaveTextToFile $aProcessedFile $aProcessedFileContent + } + } +} + +# replace all forward declarations of "class Handle(...)" with fwd of "class ..." +proc ConvertHandle {theTargetPath theIncPaths theCheckMode theExtensions} { + + # iterate by header files + foreach aHeader [glob -nocomplain -type f -directory $theTargetPath *.{$theExtensions}] { + + # skip gxx files, as names Handle_xxx used there are in most cases + # placeholders of the argument types substituted by #define + if {[file extension $aHeader] == ".gxx"} { + continue + } + + # read the content of the header + if { [catch {set fd [open $aHeader rb]}] } { + logerr "Error: cannot open $aHeader" + continue + } + close $fd + + set aHeaderContent [ReadFileToList $aHeader aHeaderRawContent aHeaderEOL] + + set anUpdateHeader false + + # if file contains "slots:" or "signals:", assume it defines some QObject + # class(es). + # In this case, type names "Handle_T" will not be replaced by Handle(T) to + # prevent failure of compilation of MOC code if such types are used in + # slots or signals (MOC does not expand macros). + # Forward declaration of a Handle will be then replaced by #include of + # corresponding class header (if such header is found), assuming that name + # typedefed Handle_T is defined in corresponding header (as typedef). + set isQObject [expr [regexp "Q_OBJECT" $aHeaderContent] && [regexp "(slots|signals)\s*:" $aHeaderContent]] + + # replace all IDs with prefix Handle_ by use of Handle() macro + if { ! $isQObject } { + set anUpdatedHeaderContent {} + set pattern_handle {\mHandle_([A-Za-z0-9_]+)} + foreach line $aHeaderContent { + # do not touch #include and #if... statements + if { [regexp {\s*\#\s*include} $line] || [regexp {\s*\#\s*if} $line] } { + lappend anUpdatedHeaderContent $line + continue + } + + # in other preprocessor statements, skip first expression to avoid + # replacements in #define Handle_... and similar cases + set index 0 + if { [regexp -indices {\s*#\s*[A-Za-z]+\s+[^\s]+} $line location] } { + set index [expr 1 + [lindex $location 1]] + } + + # replace Handle_T by Handle(T) + while { [regexp -start $index -indices $pattern_handle $line location class] } { + set index [lindex $location 1] + + set class [eval string range \$line $class] +# puts "Found: [eval string range \$line $location]" + + if { ! $theCheckMode } { + set anUpdateHeader true + ReplaceSubString line $location "Handle($class)" index + } else { + logwarn "Warning: $aHeader refers to IDs starting with \"Handle_\" which are likely" + logwarn " instances of OCCT Handle classes (e.g. \"$class\"); these are to be " + logwarn " replaced by template opencascade::handle<> or legacy macro Handle()" + set index -1 ;# to break outer cycle + break + } + } + lappend anUpdatedHeaderContent $line + + if { $index < 0 } { + set anUpdatedHeaderContent $aHeaderContent + break + } + } + set aHeaderContent $anUpdatedHeaderContent + } + + # replace NS::Handle(A) by Handle(NS::A) + set anUpdatedHeaderContent {} + set pattern_nshandle {([A-Za-z0-9_]+)\s*::\s*Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)} + foreach line $aHeaderContent { + set index 0 + + while { [regexp -start $index -indices -lineanchor $pattern_nshandle $line location scope class]} { + set index [lindex $location 1] + + set scope [eval string range \$line $scope] + set class [eval string range \$line $class] + + if { ! $theCheckMode } { + set anUpdateHeader true + ReplaceSubString line $location "Handle(${scope}::${class})" index + } else { + logwarn "Warning in $aHeader: usage of Handle macro inside scope is incorrect: [eval string range \$line $location]" + set index -1 ;# to break outer cycle + break + } + } + lappend anUpdatedHeaderContent $line + + if { $index < 0 } { + set anUpdatedHeaderContent $aHeaderContent + break + } + } + set aHeaderContent $anUpdatedHeaderContent + + # remove all forward declarations of Handle classes + set anUpdatedHeaderContent {} + set aFwdHandlePattern {^\s*class\s+Handle[_\(]([A-Za-z0-9_]+)[\)]?\s*\;\s*$} + foreach aHeaderContentLine $aHeaderContent { + if {[regexp $aFwdHandlePattern $aHeaderContentLine dummy aForwardDeclHandledClass]} { + if {$theCheckMode} { + loginfo "Info: $aHeader contains statement involving forward decl of Handle_$aForwardDeclHandledClass" + } else { + # replace by forward declaration of a class or its include unless + # it is already declared or included + if { ! [regexp "^\s*\#\s*include\s*\[\<\"\]\s*$aForwardDeclHandledClass\s*\[\>\"\]" $aHeaderContent] } { + if { $isQObject } { + lappend anUpdatedHeaderContent "#include <${aForwardDeclHandledClass}.hxx>" + if { ! [SearchForFile $theIncPaths ${aForwardDeclHandledClass}.hxx] } { + loginfo "Warning: include ${aForwardDeclHandledClass}.hxx added in $aHeader, assuming it exists and defines Handle_$aForwardDeclHandledClass" + } + } elseif { ! [regexp "^\s*class\s+$aForwardDeclHandledClass\s*;" $aHeaderContent] } { + lappend anUpdatedHeaderContent "class $aForwardDeclHandledClass;" + } + } + set anUpdateHeader true + continue + } + } + lappend anUpdatedHeaderContent $aHeaderContentLine + } + set aHeaderContent $anUpdatedHeaderContent + + # remove all typedefs using Handle() macro to generate typedefed name + set anUpdatedHeaderContent {} + set aTypedefHandlePattern {^\s*typedef\s+[_A-Za-z\<\>, \s]+\s+Handle\([A-Za-z0-9_]+\)\s*\;\s*$} + foreach aHeaderContentLine $aHeaderContent { + if {[regexp $aTypedefHandlePattern $aHeaderContentLine aFoundPattern]} { + if {$theCheckMode} { + loginfo "Info: $aHeader contains typedef using Handle macro to generate name: $aFoundPattern" + } else { + set anUpdateHeader true + continue + } + } + lappend anUpdatedHeaderContent $aHeaderContentLine + } + set aHeaderContent $anUpdatedHeaderContent + + # remove all #include statements for files starting with "Handle_" + set anUpdatedHeaderContent {} + set anIncHandlePattern {^\s*\#\s*include\s+[\<\"]\s*(Handle[\(_][A-Za-z0-9_.]+[\)]?)\s*[\>\"]\s*$} + foreach aHeaderContentLine $aHeaderContent { + if {[regexp $anIncHandlePattern $aHeaderContentLine aFoundPattern anHxxName] && + ! [SearchForFile $theIncPaths $anHxxName]} { + if {$theCheckMode} { + loginfo "Info: $aHeader includes missing header: $anHxxName" + } else { + set anUpdateHeader true + continue + } + } + lappend anUpdatedHeaderContent $aHeaderContentLine + } + + # save result + if {$anUpdateHeader} { + SaveListToFile $aHeader $anUpdatedHeaderContent $aHeaderEOL + } + } +} + +# Replaces C-style casts of Handle object to Handle to derived type +# by call to DownCast() method +proc ConvertCStyleHandleCast {pkpath theExtensions theCheckMode} { + + # iterate by header files + foreach afile [glob -nocomplain -type f -directory $pkpath *.\{$theExtensions\}] { + set hxx [ReadFileToRawText $afile] + + set change_flag 0 + + # replace ((Handle(A)&)b) by Handle(A)::DownCast(b) + set index 0 + set pattern_refcast1 {\(\(\s*Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[&]\s*\)\s*([A-Za-z0-9_]+)\)} + while { [regexp -start $index -indices -lineanchor $pattern_refcast1 $hxx location class var]} { + set index [lindex $location 1] + + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "Handle($class)::DownCast ($var)" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # replace (Handle(A)&)b, by Handle(A)::DownCast(b), + # replace (Handle(A)&)b; by Handle(A)::DownCast(b); + # replace (Handle(A)&)b) by Handle(A)::DownCast(b)) + set index 0 + set pattern_refcast2 {\(\s*Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[&]\s*\)\s*([A-Za-z0-9_]+)(\s*[,;\)])} + while { [regexp -start $index -indices -lineanchor $pattern_refcast2 $hxx location class var end]} { + set index [lindex $location 1] + + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + set end [eval string range \$hxx $end] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "Handle($class)::DownCast ($var)$end" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # replace (*((Handle(A)*)&b)) by Handle(A)::DownCast(b) + set index 0 + set pattern_ptrcast1 {([^A-Za-z0-9_]\s*)\(\s*[*]\s*\(\(Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[*]\s*\)\s*[&]\s*([A-Za-z0-9_]+)\s*\)\s*\)} + while { [regexp -start $index -indices -lineanchor $pattern_ptrcast1 $hxx location start class var] } { + set index [lindex $location 1] + + set start [eval string range \$hxx $start] + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "${start}Handle($class)::DownCast ($var)" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # replace *((Handle(A)*)&b) by Handle(A)::DownCast(b) + set index 0 + set pattern_ptrcast2 {[*]\s*\(\(Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[*]\s*\)\s*[&]\s*([A-Za-z0-9_]+)\s*\)} + while { [regexp -start $index -indices -lineanchor $pattern_ptrcast2 $hxx location class var] } { + set index [lindex $location 1] + + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "Handle($class)::DownCast ($var)" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # replace (*(Handle(A)*)&b) by Handle(A)::DownCast(b) + set index 0 + set pattern_ptrcast3 {([^A-Za-z0-9_]\s*)\(\s*[*]\s*\(Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[*]\s*\)\s*[&]\s*([A-Za-z0-9_]+)\s*\)} + while { [regexp -start $index -indices -lineanchor $pattern_ptrcast3 $hxx location start class var] } { + set index [lindex $location 1] + + set start [eval string range \$hxx $start] + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "${start}Handle($class)::DownCast ($var)" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # replace *(Handle(A)*)&b, by Handle(A)::DownCast(b), + # replace *(Handle(A)*)&b; by Handle(A)::DownCast(b); + # replace *(Handle(A)*)&b) by Handle(A)::DownCast(b)) + set index 0 + set pattern_ptrcast4 {[*]\s*\(Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[*]\s*\)\s*[&]\s*([A-Za-z0-9_]+)(\s*[,;\)])} + while { [regexp -start $index -indices -lineanchor $pattern_ptrcast4 $hxx location class var end] } { + set index [lindex $location 1] + + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + set end [eval string range \$hxx $end] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "Handle($class)::DownCast ($var)$end" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # just warn if some casts to & are still there + set index 0 + set pattern_refcast0 {\(\s*Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[&]\s*\)\s*([A-Za-z0-9_]+)} + while { [regexp -start $index -indices -lineanchor $pattern_refcast0 $hxx location class var] } { + set index [lindex $location 1] + + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + + # replace const Handle(A)& a = Handle(B)::DownCast (b); by + # Handle(A) a ( Handle(B)::DownCast (b) ); + set index 0 + set pattern_refvar {\mconst\s+Handle\s*\(\s*([A-Za-z0-9_]+)\s*\)\s*[&]\s*([A-Za-z0-9_]+)\s*=\s*(Handle\s*\(\s*[A-Za-z0-9_]+\s*\)\s*::\s*DownCast\s*\([^;]+);} + while { [regexp -start $index -indices -lineanchor $pattern_refvar $hxx location class var hexpr] } { + set index [lindex $location 1] + + set class [eval string range \$hxx $class] + set var [eval string range \$hxx $var] + set hexpr [eval string range \$hxx $hexpr] + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString hxx $location "Handle($class) $var ($hexpr);" index + } else { + logwarn "Warning in $afile: C-style cast: [eval string range \$hxx $location]" + } + } + + # apply changes to the header file + if { $change_flag } { + SaveTextToFile $afile $hxx + } + } +} + +# Remove unnecessary forward declaration of a class if found immediately before +# its use in DEFINE_STANDARD_HANDLE +proc RemoveFwdClassForDefineStandardHandle {pkpath theCheckMode} { + + # iterate by header files + foreach afile [glob -nocomplain -type f -directory $pkpath *.?xx] { + + # load a file + if { [catch {set fd [open $afile rb]}] } { + logerr "Error: cannot open $afile" + continue + } + set hxx [read $fd] + close $fd + + set change_flag 0 + + # replace + set index 0 + set pattern_fwddef {class\s+([A-Za-z0-9_]+)\s*;\s*DEFINE_STANDARD_HANDLE\s*\(\s*([A-Za-z0-9_]+)\s*,\s*([A-Za-z0-9_]+)\s*\)[ \t]*} + while { [regexp -start $index -indices -lineanchor $pattern_fwddef $aProcessedFileContent location fwdclass class1 class2] } { + set index [lindex $location 1] + + set fwdclass [eval string range \$aProcessedFileContent $fwdclass] + set class1 [eval string range \$aProcessedFileContent $class1] + set class2 [eval string range \$aProcessedFileContent $class2] + + if { $fwdclass != $class1 } { + continue + } + + if { ! $theCheckMode } { + set change_flag 1 + ReplaceSubString aProcessedFileContent $location "DEFINE_STANDARD_HANDLE($class1, $class2)" index + incr index -1 + } else { + logwarn "Warning: $aProcessedFile contains unnecessary forward declarations of class $fwdclass" + break + } + } + + # apply changes to the header file + if { $change_flag } { + SaveTextToFile $afile $hxx + } + } +} + +# auxiliary: modifies variable text_var replacing part defined by two indices +# given in location by string str, and updates index_var variable to point to +# the end of the replaced string. Variable flag_var is set to 1. +proc ReplaceSubString {theSource theLocation theSubstitute theEndIndex} { + + upvar $theSource aSource + upvar $theEndIndex anEndIndex + + set aStartIndex [lindex $theLocation 0] + set anEndIndex [lindex $theLocation 1] + set aSource [string replace "$aSource" $aStartIndex $anEndIndex "$theSubstitute"] + set anEndIndex [expr $aStartIndex + [string length $theSubstitute]] +} + +# Save theFileContent some text to theFilePath file +proc SaveTextToFile {theFilePath theFileContent} { + if { [catch {set aFile [open ${theFilePath} w];} aReason] } { + logerr "Error: cannot open file \"${theFilePath}\" for writing: $aReason" + return + } + + fconfigure $aFile -translation binary + puts -nonewline $aFile "$theFileContent" + close $aFile + + loginfo "File $theFilePath modified" +} + +# read content from theFilePath to list, theFileContent is a raw content of the file +proc ReadFileToList {theFilePath theFileContent theFileEOL} { + upvar $theFileContent aFileContent + upvar $theFileEOL aFileEOL + + if {"$theFilePath" == "" || ![file exists $theFilePath]} { + return + } + + if { [catch {set aFile [open ${theFilePath} r]} aReason] } { + logerr "Error: cannot open file \"${theFilePath}\" for reading: $aReason" + return + } + + fconfigure $aFile -translation binary + set aFileContent [read $aFile] + close $aFile + + set aFileEOL "\r" + if [regexp "\r\n" $aFileContent] { + set aFileEOL "\r\n" + } elseif [regexp "\n" $aFileContent] { + set aFileEOL "\n" + } + + # convert to unix eol + if {"$aFileEOL" != "\n"} { + regsub -all {$aFileEOL} $aFileContent "\n" aFileContent + } + + set aList {} + foreach aLine [split $aFileContent "\n"] { + lappend aList [string trimright $aLine] + } + + return $aList +} + +# read content from theFilePath to raw text (with unix eol) +proc ReadFileToRawText {theFilePath} { + if {"$theFilePath" == "" || ![file exists $theFilePath]} { + return + } + + if { [catch {set aFile [open ${theFilePath} r]} aReason] } { + logerr "Error: cannot open file \"${theFilePath}\" for reading: $aReason" + return + } + + fconfigure $aFile -translation binary + set aFileContent [read $aFile] + close $aFile + + set aFileEOL "\r" + if [regexp "\r\n" $aFileContent] { + set aFileEOL "\r\n" + } elseif [regexp "\n" $aFileContent] { + set aFileEOL "\n" + } + + # convert to unix eol + if {"$aFileEOL" != "\n"} { + regsub -all {$aFileEOL} $aFileContent "\n" aFileContent + } + + return $aFileContent +} + +# auxiliary: saves content of "theData" list to "theFilePath" +proc SaveListToFile {theFilePath theData {theEOL "auto"}} { + set anUsedEol $theEOL + + if {"$anUsedEol" == ""} { + set anUsedEol "auto" + } + + # if the file exists and "eol choice" is "auto", detect the file eol + if {$anUsedEol == "auto" && [file exists $theFilePath]} { + if { [catch {set aFile [open ${theFilePath} r]} aReason] } { + logerr "Error: cannot open file \"${theFilePath}\" for reading: $aReason" + } else { + fconfigure $aFile -translation binary + set aFileContent [read $aFile] + close $aFile + + set anUsedEol "\r" + if [regexp "\r\n" $aFileContent] { + set anUsedEol "\r\n" + } elseif [regexp "\n" $aFileContent] { + set anUsedEol "\n" + } + } + } + + # write + if { [catch {set aFile [open ${theFilePath} w];} aReason] } { + logerr "Error: cannot open file \"${theFilePath}\" for writing: $aReason" + return + } + + fconfigure $aFile -translation binary + puts -nonewline $aFile [join $theData $anUsedEol] + close $aFile +} + +# collect all subdirs of theBaseDir +proc CollectDirStructure {theBaseDir} { + set aDirs [glob -nocomplain -directory $theBaseDir -type d *] + + set aSubDirs {} + foreach aDir $aDirs { + foreach aSubDir [CollectDirStructure $aDir] { + lappend aSubDirs $aSubDir + } + } + + foreach aSubDir $aSubDirs { + lappend aDirs $aSubDir + } + + return $aDirs +} + +# check existence of theFileName file in several folders (theIncPaths) +proc SearchForFile {theIncPaths theFileName} { + foreach aPath $theIncPaths { + if {[file exists "${aPath}/${theFileName}"]} { + return true + } + } + + return false +} + +# auxiliary: parse the string to comment and not comment parts +# variable "_cmnt" should be created before using the operation, it will save comment part of line +# variable "_isMulti" should be created before the loop, equal to "false" if first line in the loop is not multi-comment line +proc _check_line { line } { + upvar _isMulti _isMulti + upvar _cmnt _cmnt + + set string_length [string length $line] + set c_b $string_length + set mc_b $string_length + set mc_e $string_length + regexp -indices {//} $line c_b + regexp -indices {/\*} $line mc_b + regexp -indices {\*/} $line mc_e + if {!${_isMulti}} { + if {[lindex $c_b 0] < [lindex $mc_b 0] && [lindex $c_b 0] < [lindex $mc_e 0]} { + set notComment_c [string range $line 0 [expr [lindex $c_b 0]-1]] + set Comment_c [string range $line [lindex $c_b 0] end] + set _cmnt $_cmnt$Comment_c + return $notComment_c + } elseif {[lindex $mc_b 0] < [lindex $c_b 0] && [lindex $mc_b 0] < [lindex $mc_e 0]} { + set _isMulti true + set _cmnt "${_cmnt}/*" + set notComment_mc [string range $line 0 [expr [lindex $mc_b 0]-1]] + set Comment_mc [string range $line [expr [lindex $mc_b 1]+1] end] + return [_check_line "${notComment_mc}[_check_line ${Comment_mc}]"] + } elseif {[lindex $mc_e 0] < [lindex $c_b 0] && [lindex $mc_e 0] < [lindex $mc_b 0]} { + set notComment_mc [string range $line [expr [lindex $mc_e 1]+1] end] + set Comment_mc [string range $line 0 [expr [lindex $mc_e 0]-1]] + set _cmnt "${_cmnt}${Comment_mc}*/" + set chk [_check_line ${notComment_mc}] + set _isMulti true + return $chk + } + } else { + if {[lindex $mc_e 0] < [lindex $mc_b 0]} { + set _isMulti false + set Comment_mc [string range $line 0 [lindex $mc_e 1]] + set notComment_mc [string range $line [expr [lindex $mc_e 1]+1] end] + set _cmnt $_cmnt$Comment_mc + return [_check_line $notComment_mc] + } elseif {[lindex $mc_b 0] < [lindex $mc_e 0] } { + set notComment_mc [string range $line 0 [expr [lindex $mc_b 0]-1]] + set Comment_mc [string range $line [expr [lindex $mc_b 1]+1] end] + set _cmnt "${_cmnt}/*" + set chk [_check_line "${notComment_mc}[_check_line ${Comment_mc}]"] + set _isMulti false + return $chk + } else { + set _cmnt $_cmnt$line + return "" + } + } + return $line +} + +# Create Tk-based logger which allows convenient consulting the upgrade process. +proc _create_logger {} { + if { [catch {winfo exists .h}] } { + logerr "Error: Tk commands are not available, cannot create UI!" + return + } + + if { ![winfo exists .h ] } { + toplevel .h + wm title .h "Conversion log" + wm geometry .h +320+200 + wm resizable .h 0 0 + + text .h.t -yscrollcommand {.h.sbar set} + scrollbar .h.sbar -orient vertical -command {.h.t yview} + + pack .h.sbar -side right -fill y + pack .h.t + } +} + +set LogFilePath "" + +# Puts the passed string into Tk-based logger highlighting it with the +# given color for better view. If no logger exists (-wlog option was not +# activated), the standard output is used. +proc _logcommon {theLogMessage {theMessageColor ""}} { + global LogFilePath + + if {"$LogFilePath" != ""} { + if { ! [catch {set aLogFile [open ${LogFilePath} a];} aReason] } { + set t [clock milliseconds] + set aTimeAndMessage [format "\[%s\] %s" \ + [clock format [expr {$t / 1000}] -format %T] \ + $theLogMessage \ + ] + + + puts $aLogFile $aTimeAndMessage + close $aLogFile + } else { + logerr "Error: cannot open $LogFilePath log file due to $aReason" + } + } + + if { ! [catch {winfo exists .h} res] && $res } { + .h.t insert end "$theLogMessage\n" + + if {$theLogMessage != ""} { + # We use the current number of lines to generate unique tag in the text + set aLineNb [lindex [split [.h.t index "end - 1 line"] "."] 0] + + .h.t tag add my_tag_$aLineNb end-2l end-1l + .h.t tag configure my_tag_$aLineNb -background $theMessageColor + } + + update + } else { + puts $theLogMessage + } +} + +# Puts information message to logger. +proc loginfo {a} { + _logcommon $a +} + +# Puts warning message to logger. +proc logwarn {a} { + _logcommon $a "pink" +} + +# Puts error message to logger. +proc logerr {a} { + _logcommon $a "red" +} diff --git a/dox/FILES_HTML.txt b/dox/FILES_HTML.txt index 49221ccda8..7db38e4504 100644 --- a/dox/FILES_HTML.txt +++ b/dox/FILES_HTML.txt @@ -45,8 +45,7 @@ dev_guides/contribution_workflow/contribution_workflow.md dev_guides/git_guide/git_guide.md dev_guides/tests/tests.md dev_guides/debug/debug.md -dev_guides/cdl/cdl.md -dev_guides/wok/wok.md +dev_guides/upgrade/upgrade.md dev_guides/building/building.md dev_guides/building/3rdparty/3rdparty_windows.md @@ -60,6 +59,4 @@ dev_guides/building/code_blocks.md dev_guides/building/msvc.md dev_guides/building/xcode.md -dev_guides/upgrade/upgrade.md - license.md diff --git a/dox/FILES_PDF.txt b/dox/FILES_PDF.txt index fae962c282..3d1d797a1e 100644 --- a/dox/FILES_PDF.txt +++ b/dox/FILES_PDF.txt @@ -28,7 +28,6 @@ dev_guides/documentation/documentation.md dev_guides/contribution/coding_rules.md dev_guides/git_guide/git_guide.md dev_guides/tests/tests.md -dev_guides/wok/wok.md -dev_guides/cdl/cdl.md +dev_guides/upgrade/upgrade.md tutorial/tutorial.md diff --git a/dox/dev_guides/cdl/cdl.md b/dox/dev_guides/cdl/cdl.md deleted file mode 100644 index 412c9a8b0b..0000000000 --- a/dox/dev_guides/cdl/cdl.md +++ /dev/null @@ -1,1846 +0,0 @@ - Component Definition Language (CDL) {#occt_dev_guides__cdl} -============================== - -@tableofcontents - -@section occt_cdl_0 DEPRECATION WARNING - -Please note that CDL is considered as obsolete and is to be removed in one of future releases of OCCT. - -@section occt_cdl_1 CDL and Application Architecture - -CDL is the component definition language of the Open CASCADE Technology (**OCCT**) programming platform. Some components, which CDL allows you to create, are specific to OCCT application architecture. These and other components, which you can define using CDL include the following: - - * Class (including enumeration, exception) - * Package - * Schema - * Executable - * Client. - -A **class** is the fundamental software component in object-oriented development. Because of a very large number of resources used in large-scale applications, the **class** itself is too small to be used as a basic management unit. - -So, while the class is the basic data component defined in CDL, this language also provides a way to group classes, **enumerations**, and **exceptions** together – the **package**. A package groups together a number of classes, which have semantic links. For example, a geometry package would contain Point, Line, and Circle classes. A package can also contain enumerations, exceptions, and package methods. In practice, a class name is prefixed with the name of its package e.g. *Geom_Circle*. - -Using the services described in the **packages**, you can construct an **executable**. You can also group together services provided by **packages**. - -To save data in a file, you need to define persistent classes. Then, you group these classes in a schema, which provides the necessary read/write tools. - - -@image html /dev_guides/cdl/images/cdl_image003.png "Building an Open CASCADE Technology application" -@image latex /dev_guides/cdl/images/cdl_image003.png "Building an Open CASCADE Technology application" - -@section occt_cdl_2 Introduction to CDL -@subsection occt_cdl_2_1 Purposes of the Language - -You can use CDL to **define** **data** in the Open CASCADE Technology environment. CDL allows you to define various kinds of data types supporting the application architecture and development methodology, which you envision. CDL is neither an analysis formalism (e.g. Booch methodology) nor a data manipulation language (e.g. C++). - -You use CDL in the **design** **phase** of a development process to define a set of software components which best model the concepts stated in the application specification. - -@image html /dev_guides/cdl/images/cdl_image004.png "The Development Process" -@image latex /dev_guides/cdl/images/cdl_image004.png "The Development Process" - - -From a structural point of view, CDL is an object-oriented language. It is centered on the notion of the **class** - a data type, which represents an elementary concept. CDL offers various means of organizing classes, mostly under the fundamental form of **packages**. A package contains a set of classes, which share some semantic relationship. This greatly simplifies your task of managing individual classes when confronted with a very large number of them. - -Once you have defined the classes and packages using CDL, you can implement their **methods** - i.e., their functionality - in one of the data manipulation languages supported by the OCCT environment (currently C++). - -Even though you can describe classes directly in C++ and save them as header files (.hxx), to do so would forfeit all the advantages of using CDL. These are: - - * Precise, complete, and easy-to-read description of the software components. - * Creation of a link with the database; object persistence forms part of the predefined environment of the language. - * Multi-language access to the services of an application engine – a specific architectural form created using the CDL tools, which serves as the motor of an application. - -@subsection occt_cdl_2_2 Overview of CDL - -CDL is an object-oriented language. In other words, it structures a system around data types rather than around the actions carried out on them. In this context, an **object** is an **instance** of a data type, and its definition determines how you can use it. Each data type is implemented by one or more classes, which make up the basic elements of the system. - -@subsubsection occt_cdl_2_2_1 Classes - -A class is an implementation of a **data type**. It defines its **behavior** and its **representation**. - -The behavior of a class is its programming interface - the services offered by its **methods**. The representation of a class is its data structure - the **fields**, which store its data. - -Every object is an **instance** of its class. For example, the object *p* of the data type *Point* is an instance of the class *Point*. - -The class Point could be defined as in the example below: - -@code -class Point from GeomPack - ---Purpose: represents a point in 3D space. - is - Create returns Point; -fields - x, y, z : Real; -end Point; -@endcode - -The definition of this class comprises two sections: - - * one starting with the keywords **is** - * one starting with the keyword **fields**. - -The first section contains a list of methods available to the clients of the class. The second section defines the way in which instances are represented. Once this class has been compiled you could **instantiate** its data type in a C++ test program as in the example below: - - - -@code -GeomPack_Point p; -@endcode - - -@subsubsection occt_cdl_2_2_2 Categories of Types - -You declare the variables of a **data manipulation language** as being of certain data types. These fall into two categories: - - * Data types manipulated by handle (or reference) - * Data types manipulated by value - - @image html /dev_guides/cdl/images/cdl_image005.png "Manipulation of data types" - @image latex /dev_guides/cdl/images/cdl_image005.png "Manipulation of data types" - -As seen above, you implement data types using classes. However, classes not only define their data representation and methods available for their instances, but they also define how the instances will be manipulated: - * A data type manipulated by value contains the instance itself. - * A data type manipulated by handle contains a reference to the instance. - -The most obvious examples of data types manipulated by value are the predefined **primitive types**: Boolean, Character, Integer, Real... - -A variable of a data type manipulated by handle, which is not attached to an object, is said to be **null**. To reference an object, you need to instantiate the class with one of its constructors. This is done in C++ as in the following syntax: - -~~~~~ -Handle(myClass) m = new myClass; -~~~~~ - - -@subsubsection occt_cdl_2_2_3 Persistence - -An object is called **persistent** if it can be permanently stored. In other words, you can use the object again at a later date, both in the application, which created it, and in another application. - -In order to make an object persistent, you need to declare it in CDL as inheriting from the **Persistent** class, or to have one of its parent classes inheriting from the *Persistent* class. - -Note that the classes inheriting from the *Persistent* class are handled by reference. - -**Example** -~~~~~ -class Watch inherits Persistent -~~~~~ - -In this example, building the application, you add the *Watch* class to the corresponding schema of data types. -If, running the application, you instantiate an object of the *Watch* class, you have the possibility of storing it in a file. -You cannot store objects instantiated from classes, which inherit from the *Storable* class. However, you can store them as fields of an object, which inherits from *Persistent*. - -Note that the objects inheriting from Storable are handled by value. - -**Example** -~~~~~ -If -class WatchSpring inherits Storable -//then this could be stored as a field of a Watch -//object: -class Watch inherits Persistent -is...... -fields -name : ConstructorName; -powersource : WatchSpring; -end; -~~~~~ - -@subsubsection occt_cdl_2_2_4 Packages - -In large-scale long-term development the task of marshalling potentially thousands of classes is likely to quickly prove unmanageable. CDL introduces the notion of **package** of classes containing a set of classes, which have some semantic or syntactic relationship. For example, all classes representing a particular set of electronic components might make up a package called Diode. - -As the package name prefixes the class name when implementing such class (in C++ for example), classes belonging to different packages can have the same name. For example, two packages, one dealing with finance and the other dealing with aircraft maneuvers, might both contain a class called *Bank*, without any possibility of confusion. - -**Example** -~~~~~ -Finance_Bank -Attitude_Bank -~~~~~ - - -@subsubsection occt_cdl_2_2_5 Inheritance - -The purpose of inheritance is to reduce development workload. The inheritance mechanisms allow you to declare a new class as already containing the characteristics of an existing class. This new class can then be rapidly specialized for a task at hand. This eliminates the necessity of developing each component “from scratch”. - -For example, having already developed a class *BankAccount*, you can quickly specialize new classes - *SavingsAccount, LongTermDepositAccount, MoneyMarketAccount, RevolvingCreditAccount*, etc.. - -As a consequence, when two or more classes inherit from a parent (or ancestor) class, all these classes surely inherit the behavior of their parent (or ancestor). For example, if the parent class *BankAccount* contains the method *Print* that tells it to print itself out, then all its descendent classes offer the same service. - -One way of ensuring the use of inheritance is to declare classes at the top of a hierarchy as being **deferred**. In such classes, the inherited methods are not implemented. This forces you to create a new class used to redefine the methods. In this way, you guarantee a certain minimum common behavior among descendent classes. - -**Example** -~~~~~ -deferred class BankAccount inherits Persistent -is -....... -fields -name : AccountHolderName; -balance : CreditBalance; -end; -~~~~~ - -@subsubsection occt_cdl_2_2_6 Genericity - -You will often wish to model a certain type of behavior as a class. For example, you will need a list modeled as a class. - -In order to be able to list different objects, the class *List* must be able to accept different data types as parameters. This is where genericity comes in: you first declare a list declared as the generic class *List*, willing to accept any data type (or only a particular set of acceptable data types). Then, when you want to make a list of a certain type of object, you instantiate the class *List* with the appropriate data type. - -**Example** - -~~~~~ -generic class NewList (Item) -inherits OldList -is -..... -end ; -~~~~~ - -Items may be of any type, an Integer or a Real for example. - -When defining the package, add the following line: -**Example** -~~~~~ -class NewListOfInteger instantiates -NewList (Integer); -~~~~~ - -@subsubsection occt_cdl_2_2_7 Exceptions - -The behavior of any object is implemented by methods, which you define in its class declaration. The definition of these methods includes not only their signature (their programming interface) but also their domain of validity. - -In CDL, this domain is expressed by **exceptions**. Exceptions are raised under various error conditions. This mechanism is a safeguard of software quality. - -@subsubsection occt_cdl_2_2_8 Completeness - -You use CDL to define data types. Such definitions are not considered complete unless they contain the required amount of structured commentary. - -The compiler does not enforce this required degree of completeness, so it is the responsibility of the developer to ensure that all CDL codes are properly annotated. - -Completeness is regarded as an essential component of long-term viability of a software component. - - -@subsection occt_cdl_2_3 Lexical Conventions -@subsubsection occt_cdl_2_3_1 Syntax notation - -In this manual, CDL declarations are described using a simple variant of the Backus-Naur formalism. Note the following: - - * Italicized words, which may also be hyphenated, denote syntactical categories, for example *declaration-of-a-non-generic-class* ; - * Keywords appear in bold type: **class** ; - * Brackets enclose optional elements: -~~~~~ - identifier [from package-name] -~~~~~ - * Curly braces enclose repeated elements. The element may appear zero or many times: -~~~~~ - integer ::= digit{digit} -~~~~~ - * Vertical bars separate alternatives: -~~~~~ -passing-method ::= [in] | out | in out -~~~~~ - * Two apostrophes enclose a character or a string of characters, which must appear: -~~~~~ -exponent ::= ’E’[’+’]integer | ’E-’ integer -~~~~~ -**NOTE** To introduce the ideas progressively, the examples presented in this manual may be incomplete, and thus not compilable by the CDL compiler. - - -@subsubsection occt_cdl_2_3_2 Lexical elements - -A CDL source is composed of text from one or more compiled units. The text of each compiled unit is a string of separate lexical elements: **identifiers**, **keywords**, **constants**, and **separators**. The separators (blank spaces, end of line, format characters) are ignored by the CDL compiler, but these are often necessary for separating identifiers, keywords, and constants. - - -@subsubsection occt_cdl_2_3_3 Comments - -With CDL, you cannot use the expression of all useful information about a development unit. In particular, certain information is more easily expressed in natural language. You can add such information to the CDL description of a data type. - -Rubrics and free comments are to be differentiated: - -**Free comments** are preceded by the characters “--” (two hyphens), and they terminate at the end of the line in which they appear. -**Example** -~~~~~ ---This is a comment -~~~~~ - -Unlike rubrics, free comments can appear before or after any lexical element. The first written character of the comment itself *must not* be a hyphen. If a hyphen is necessary make sure it is preceded by a blank. -**Example** -~~~~~ --- -List item -~~~~~ -**Rubrics** are various types of comments attached to CDL components. A rubric is a comment made up of three hyphens, name of the rubric (without any intermediary space) and then a colon and a space. It is terminated by the beginning of the following rubric, or by the end of the commentary. - -**Example** -~~~~~ ----Purpose:This is an example of a ---rubric composed of a ---comment which extends to ---four lines. -~~~~~ - -The different categories of rubrics and the form of their content do not depend on the Component Description Language, but on the tool for which it is intended. - -The use of commentary is generally governed by the internal programming standards of an enterprise. You are encouraged to use various well-defined rubrics, such as Purpose, Warning, Example, References, Keywords, etc. - -These rubrics can be attached to: - - * Packages - * Classes - * Methods - * Schemas - * Executables - * Clients - -@subsubsection occt_cdl_2_3_4 Identifiers - -An identifier is an arbitrary chain of characters, either letters or digits, but it must begin with a letter. - -The underscore “_” is considered to be a letter as long as it doesn’t appear at the beginning or the end of an identifier. - -Capital and small letters are not equivalent (i.e. AB, Ab, aB, ab are four different identifiers). - - -@subsubsection occt_cdl_2_3_5 Keywords - -The following is a list of keywords. - -* alias -* any -* as -* asynchronous -* class -* client -* deferred -* end -* enumeration -* exception -* executable -* external -* fields -* friends -* from -* generic -* immutable -* imported -* inherits -* instantiates -* is -* library -* like -* me -* mutable -* myclass -* out -* package -* pointer -* primitive -* private -* protected -* raises -* redefined -* returns -* schema -* static -* to -* uses -* virtual - -In a CDL file, the following characters are used as punctuation: -; : , = ( ) [ ] ‘ “ - -@subsubsection occt_cdl_2_3_6 Constants - -There are three categories of constants: - - * Numeric - * Literal - * Named - -#### Numeric Constants - -There are two types of numeric constants: integer and real. - -An **integer** constant consists of a string of digits, which may or may not be preceded by a sign. Integer constants express whole numbers. - -**Examples** -~~~~~ -1995 0 -273 +78 -~~~~~ -A **real** constant may or may not be preceded by a sign, and consists of an integral part followed by a decimal point and a fractional part (either one or both parts may be null, but both parts must always be present). It may also be followed by the letter E to indicate that the following figures represent the exponent (also optionally signed). - -**Examples** -~~~~~ -5.0 0.0 -0.8E+3 5.67E-12 -~~~~~ -#### Literal Constants - -Literal constants include individual characters and strings of characters. - -An **individual character** constant is a single printable character enclosed by two apostrophes. (See the definition of the class Character in the Standard Package). - -**Examples** -~~~~~ - ‘B’ ‘y’ ‘&’ ‘*’ ‘’’ ‘‘ -~~~~~ -A **string** constant is composed of printable characters enclosed by quotation marks. - -**Examples** -~~~~~ -’’G’’ ’’jjjj’’ ’’This is a character string, isn’t it?’’ -~~~~~ -The **quotation mark** can itself appear within a character string as long as it is preceded by a backslash. - -**Examples** -~~~~~ -’’This film was originally called \’’Gone with the Tide\’’.’’ -~~~~~ - -#### Named Constants - -Named constants are sub-divided into two categories: Booleans and enumerations. - -**Booleans** can be of two types: True or False. - -An **enumeration** constant is an identifier, which appears in the description of an enumeration. - -@section occt_cdl_3 Software Components - -@subsection occt_cdl_3_1 Predefined Resources -@subsubsection occt_cdl_3_1_1 Primitive types - -Primitive types are predefined in the language and they are **manipulated by value**. - -Four of these primitives are known to the schema of the database because they inherit from the class **Storable**. In other words, they can be used in the implementation of persistent objects, either when contained in entities declared within the methods of the object, or when they form part of the internal representation of the object. - -The primitives inheriting from **Storable** are the following: - -* **Boolean** Is used to represent logical data. It has only two values: *True* and *False*. -* **Byte** 8-bit number. -* **Character** Designates any ASCII character. -* **ExtCharacter** Is an extended character. -* **Integer** Is an integer number. -* **Real** Denotes a real number (i.e. one with a whole and a fractional part, either of which may be null). -* **ShortReal** Real with a smaller choice of values and memory size. - -There are also non-storable primitives. They are: - -* **CString** Is used for literal constants. -* **ExtString** Is an extended string. -* **Address** Represents a byte address of undetermined size. - -The services offered by each of these types are described in the Standard Package. - - -@subsubsection occt_cdl_3_1_2 Manipulating types by reference (by handle) - -Two types are manipulated by handle: - - * Types defined using classes inheriting from the **Persistent** class are storable in a file. - * Types defined using classes inheriting from the **Transient** class. - -These types are not storable as such in a file. - -@image html /dev_guides/cdl/images/cdl_image006.png "Manipulation of a data type by reference" -@image latex /dev_guides/cdl/images/cdl_image006.png "Manipulation of a data type by reference" - - -@subsubsection occt_cdl_3_1_3 Manipulating types by value - -Types, which are manipulated by value, behave in a more direct fashion than those manipulated by handle. As a consequence, they can be expected to perform operations faster, but they cannot be stored independently in a file. - -You can store types known to the schema (i.e. either primitives or inheriting from Storable) and manipulated by value inside a persistent object as part of the representation. This is the only way for you to store objects “manipulated by value” in a file. - -@image html /dev_guides/cdl/images/cdl_image007.png "Manipulation of a data type by value" -@image latex /dev_guides/cdl/images/cdl_image007.png "Manipulation of a data type by value" - -Three types are manipulated by value: - - * Primitive types - * Enumerated types - * Types defined by classes not inheriting from Persistent or Transient, whether directly or not - -@subsubsection occt_cdl_3_1_4 Summary of properties - - -Here is a summary of how various data types are handled and their storability: - -| | Manipulated by handle | Manipulated by value | -| :---- | :---- | :---- | -| storable | Persistent | Primitive, Storable (storable if nested in a persistent class) | -| temporary | Transient | Other | - - - - -@subsection occt_cdl_3_2 Classes - -@subsubsection occt_cdl_3_2_1 Class declaration - -The class is the main system for creating data types under CDL. By analyzing any CDL-based software, you find that classes are the modular units that make up packages. When you describe a new class, you introduce a new data type. - -Whatever the category of the described type (manipulated by value, Storable or not, manipulated by handle, Persistent or not) the structure of the class definition remains the same. The syntax below illustrates it: - -~~~~~ --- declaration-of-a-simple-class ::= -class class-name from package-name -[uses data-type { ’,’ data-type } ] -[raises exception-name { ’,’ exception-name} ] -is class-definition -end [ class-name ] ’;’ -data-type ::= enumeration-name | class-name | -exception-name | primitive-type -package-name ::= identifier -class-name ::= identifier -class-definition ::= -[{member-method}] -[declaration-of-fields] -[declaration-of-friends] -~~~~~ -Class name becomes a new data type, which you can use inside its own definition. Other types appearing in the definition must either be primitive types, previously declared classes, exceptions, or enumerations. - -Apart from the types defined in the Standard Package, which are **implicitly visible** everywhere, you need to declare the data types after the keyword **uses**. This concerns both the class behavior and its internal representation. - -**Exceptions** are declared after the word **raises**. - -**Example** -~~~~~ -class Line from GeomPack -usesPoint, Direction, Transformation -raisesNullDirection, IdenticalPoints -is-- class definition follows here --- using Point, Direction and --- Transformation objects,and the --- NullDirection and Identical- --- -Points exceptions. -end Line; -~~~~~ - -The elements, which make up the definition of a class, are divided into four parts: - * the behavior - * the invariants - * the internal representation - * the friend methods and friend classes. - - @image html /dev_guides/cdl/images/cdl_image009.png "Contents of a class" - @image latex /dev_guides/cdl/images/cdl_image009.png "Contents of a class" - -@subsubsection occt_cdl_3_2_2 Categories of classes - -Classes fall into three categories: - * Ordinary classes - * Deferred classes - * Generic classes - -#### Deferred classes - -The principal characteristic of a **deferred class** is that you cannot instantiate it. Its purpose is to provide a given behavior shared by a hierarchy of classes and dependent on the implementation of the descendents. This allows guaranteeing a certain base of inherited behavior common to all classes based on a particular deferred class. Deferred classes are declared as in the following syntax: - -~~~~~ --- declaration-of-a-deferred-class ::= deferred class class-name -[inherits class-name {’,’ class-name}] -[uses data-type {’,’ data-type}] -[raises exception-name {’,’ exception-name}] - is class-definition - end [class-name]’;’ -~~~~~ -Please, note that a deferred class does not have to contain a constructor - -

Generic classes

- -The principal characteristic of a **generic class** is that it offers a set of functional behavior to manipulate other data types. To instantiate a generic class you need to pass a data type in argument. Generic classes are declared as in the following syntax: - -~~~~~ --- declaration-of-a-generic-class ::= [deferred] generic class class-name ’(’generic-type {’,’generic-type}’)’ -[inheritsclass-name {’,’ class-name}] -[usesdata-type {’,’ data-type}] -[raisesexception-name {’,’ exception-name}] -[{[visibility] declaration-of-a-class}] - is class-definition - end [class-name]’;’ -generic-type ::= identifier as type-constraint -identifier ::= letter{[underscore]alphanumeric} -type-constraint ::= any | class-name [’(’data-type {’,’ data-type}’)’] -~~~~~ - - -@subsection occt_cdl_3_3 Packages - -@subsubsection occt_cdl_3_3_1 Package declaration - -**Packages** are used to group classes, which have some logical coherence. For example, the Standard Package groups together all the predefined resources of the language. In its simplest form, a package contains the declaration of all data types, which it introduces. You may also use a package to offer public methods and hide its internal classes by declaring them private. - -**Example** - -~~~~~ --- package-declaration ::= package package-name - [uses package-name {’,’ package-name}] - is package-definition - end [package-name]’;’ --- package-name ::= identifier --- package-definition ::= - [{type-declaration}] - [{package-method}] --- type-declaration ::= - [private] declaration-of-an-enumeration | [private] declaration-of-a-class | declaration-of-an-exception --- package-method ::= identifier [simple-formal-part][returned-type -declaration] -[error-declaration] -[is private]’;’ -~~~~~ - -The data types described in a package *may* include one or more of the following data types: - * Enumerations - * Object classes - * Exceptions - * Pointers to other object classes. - -Inside a package, two data types *cannot* have the same name. - -You declare data types before using them in the definition of other data types. - -When two classes are **mutually recursive**, one of the two must be first declared in an incomplete fashion. - -Grouped behind the keyword **uses** are the names of all the packages containing definitions of classes of which the newly introduced data types are clients. - -The methods you declare in a package do not belong to any particular class. **Package methods** must carry a name different from the data types contained in the package. Like any other method, they can be overloaded. With the exception of the keyword **me** and the visibility (a package method can *only* be either public or private) package methods are described in the same way as **instance methods**. - -@image html /dev_guides/cdl/images/cdl_image010.png "Contents of a package" -@image latex /dev_guides/cdl/images/cdl_image010.png "Contents of a package" - - -The example of the package below includes some of the basic data structures: - -~~~~~ -package Collection - uses - Standard - is -exception NoSuchObject inherits Failure; -exception NoMoreObject inherits Failure; -generic class SingleList; -generic class Set; -end Collection; -~~~~~ - -Note that the class *Set* is declared after the declarations of the *NoSuchObject* and *NoMoreObject* exceptions and the *SingleList* class of which Set is a client. In the same way, the classes *Failure*, *Persistent*, and the exception *NoSuchObject* are defined before they are used. They are defined in the *Standard* package, which appears after the keyword **uses**. - -@subsubsection occt_cdl_3_3_2 Name space - -The **name space** or **scope** of a class extends from the beginning of its declaration up to the end of the package in which it appears. - -Sometimes, two classes, which come from separate packages, are both visible to a third package and carry the same name. For example, there might be two different classes both called “Window” in a screen generator package and in an architectural package. As a client of a data type, you can find yourself in the position of having to remove the ambiguity over the origin of this type; you do this by means of the keyword **from**. - - -~~~~~ --- class-name ::= identifier [from package-name] --- exception-name ::= identifier [from package-name] --- enumeration-name ::= identifier [from package-name] -~~~~~ - -You can use the keyword **from** everywhere the name of a class, exception, or enumeration appears. As a consequence, as a client of the class “Window” you could write wherever necessary: - -~~~~~ -Window from ScreenGenerator --- or -Window from ArchitecturalFeatures -~~~~~ - -**Note** that within the description of a package the keyword **from** must be used when referencing any data type that is not defined in this package. - -Here is a further example: - -~~~~~ -class Line from Geom -uses - Point from Geom2d, - Point from Geom3d -is - -- class definition using Point from AppropriatePackage wherever Point appears -end; -~~~~~ - -@subsubsection occt_cdl_3_3_3 Declaration of classes - -You cannot describe a package in one single file. You need to describe it in different units and send them separately to the CDL compiler. Each compilation unit can contain the declaration of a class or of a package. When you describe a class in a unit different than that, which describes its package, you need to specify which package the class belongs to. You do this using the keyword **from**. - -If the **from** clause appears in the **uses** clause of the package, it does not need to be repeated elsewhere. - -The following example takes the package “Collection” which was presented above, but this time it is divided into three compilation units. - -~~~~~ --- First compilation unit, the package “Collection” : -package Collection - uses - Standard - is -exception NoMoreObject inherits Failure from Standard; -exception NoSuchObject inherits Failure from Standard; -generic class SingleList; -generic class Set, Node, Iterator; -end Collection; --- Second compilation unit, the class “SingleList” : -generic class SingleList from Collection (Item as -Storable) - inherits - Persistent from Standard - raises - NoSuchObject from Collection - is - -- definition of the SingleList class - end SingleList; --- Third compilation unit, the class “Set” : -generic class Set from Collection (Item as Storable) - inherits - Persistent from Standard; - raises - NoSuchObject from Collection, - NoMoreObject from Collection - private class Node instantiates SingleList - from Collection (Item); - end Set; -~~~~~ - -NOTE -It is not explicitly stated that the *Node* class belongs to the *Collection* package. In fact any nested class necessarily belongs to the package of the class, which encompasses it. - -Note that a package can hide certain classes (just as it can hide methods) by declaring them **private**. To make a class private, you prefix its description with the keyword **private**. In the example of the *Collection* package, the *SingleList* class serves only to implement the *Set* class. It is recommended to make it private. You write this as in the following syntax: - - -**Example** -~~~~~ -package Collection - uses - Standard - is -generic class Set, Node, Iterator; -private generic class SingleList; -exception NoMoreObject inherits Failure from Standard; -end Collection; -~~~~~ - - - -@subsection occt_cdl_3_4 Other Data Types - -The other data types are: - * Enumerations - * Imports - * Aliases - * Exceptions - * Pointers - -@subsubsection occt_cdl_3_4_1 Enumerations - -The **enumerated types** are the second type, which is manipulated by value. Unlike the primitive types they are extensible because they are defined by the user under the form of enumerations. An enumeration is an ordered sequence of named whole constant values called enumeration constants. - -**Example** -~~~~~ -declaration-of-an-enumeration ::= -enumeration enumeration-name -is identifier {’,’ identifier} -[end [enumeration-name]]’;’ -enumeration-name ::= identifier -~~~~~ -The declaration of an enumeration creates an enumerated type. An object of this type can successively take the value of any one of the constants cited in the list. - -**Example** -~~~~~ -enumeration MagnitudeSign is Negative, Null, Positive; -~~~~~ - -Inside a package, two enumeration constants cannot have the same name, even if they belong to different enumerated types. - -**Example** -~~~~~ -enumeration Cars is - Honda, - Ford, - Volkswagen, - Renault -end; -enumeration AmericanPresidents is - Nixon, - Reagan, - Ford, -- Error: ‘Ford’ already defined - Carter -end; -~~~~~ - -@subsubsection occt_cdl_3_4_2 Imports - -An **imported type** is one of which which has not been defined in CDL. It is up to the supplier of this data type to ensure compatibility with the CDL language by providing services which allow CDL to recognize the imported data type. - -The CDL syntax for declaring an imported type is: -~~~~~ -declaration-of-an-imported-type::=[private] imported typename ; -~~~~~ - -Let us try to define an imported type: - -* In the *MyPack.cdl* file, you declare the imported type: -~~~~~ -package MyPack - .... - imported MyImport; - .... - end Mypack; -~~~~~ -* In the *MyPack_MyImport.hxx* file, you write the following C++ code: -~~~~~ -#ifndef _MyPack_MyImport_HeaderFile -#define _MyPack_MyImport_HeaderFile -#include Standard_Type.hxx -typedef unsigned long MyPack_MyImport; -extern const Handle(Standard_Type)& TYPE -(MyPack_MyImport); -~~~~~ -* In the *MyPack_MyImport.cxx* file, you write the following C++ code: -~~~~~ -#ifndef _MyPack_MyImport_HeaderFile -#include MyPack_MyImport.hxx -#endif -const Handle(Standard_Type)& TYPE (MyPack_MyImport) -{ - static Handle(Standard_Type) _aType = - new Standard_Type (“MyPack_MyImport”,sizeof - (MyPack_MyImport)) - return _aType; - } -~~~~~ - -Then, add the names of these two files (MyPack_MyImport.hxx, MyPack_MyImport.cxx) to a file called FILES in the src subdirectory of the package. If the file does not exist you must create it. - - -@subsubsection occt_cdl_3_4_3 Aliases - -An **alias** is an extra name for a type, which is already known. It is declared as in the following syntax: - -~~~~~ -declaration-of-an-alias::= [private] alias type1 is type2 [from apackage] ; -~~~~~ - -**Example** -~~~~~ -alias Mass is Real; ----Purpose: --- Defined as a quantity of matter. --- Gives rise to the inertial and --- gravitational properties of a body. --- It is measured in kilograms. -~~~~~ - -Having defined *Mass* as a type of *Real*, you can use either *Mass* or *Real* to type an argument when defining a method. - - -@subsubsection occt_cdl_3_4_4 Exceptions - -In the model recommended by CDL, the principal characteristic of errors is that they are treated in a different place from the place where they appear. In other words, the methods recovering and those raising a given exception are written independently from each other. - -Subsequently this poses the problem of communication between the two programs. The principle adopted consists in viewing the exception as both a class and an object. The exception class (by means of one of its instances) is used to take control of an exception, which has been raised. - -Consequently, error conditions are defined by means of **classes of exceptions**. Exception classes are arranged hierarchically so as to be able to recover them in groups. They are all descendents of a single root class called *Failure*, and it is at the level of this class that the behavior linked to the raising of exceptions is implemented. -~~~~~ -declaration-of-an-exception ::=exception exception-name inherits exception-name -~~~~~ - -All exceptions share identical behavior, that of the class *Failure*. Here are some examples of exception classes: -~~~~~ -exception NumericError inherits Failure; -exception Overflow inherits NumericError; -exception Underflow inherits NumericError; -~~~~~ - -The use of exceptions as a means to interrupt the normal execution of one program and then take control of another one depends on the programming language used to implement the methods. See the following chapter “Defining the Software Components” on page 32. - - -@subsection occt_cdl_3_5 Schemas - -The purpose of a **schema** is to list persistent data types, which will be stored in files by the application. A schema groups together persistent packages. A persistent package is one, which contains at least one persistent class. - -~~~~~ -declaration-of-a-schema ::= -schema SchemaName -is -{package PackageName;} -{class ClassName;} -end; -~~~~~ - -For example -~~~~~ -schema Bicycle ----Purpose: Defines the Bicycle schema. -is -package FrameComponents; -package WheelComponents; -end; -~~~~~ - - -**Note** that it is unnecessary to specify all the dependencies of the packages. It is sufficient to specify the highest level ones. The others on which they depend are automatically supplied. - -@subsection occt_cdl_3_6 Executables - -The purpose of an **executable** is to make an executable program without a front-end. It can be used to test more than one package at a time. An executable is written in a .cdl file as a set of packages. -**Example** -~~~~~ -definition-of-an-executable ::= - executable ExecutableName - is -{ -executable ExecutablePart - [uses [Identifier as external] - [{’,’ Identifier as external}] - [UnitName as library] - [{’,’ UnitName as library}] - is - {FileName [as C++|c|fortran|object];} - end; - } -end; -~~~~~ - -**Example** -~~~~~ -executable MyExecUnit - ---Purpose: - -- Describes the executable MyExecUnit - is - executable myexec - -- the binary file - uses - Tcl_Lib as external - is - myexec; - -- the C++ file - end; - -- several binaries can be specified in one .cdl file. - executable myex2 - is - myex2; -end; -end; -~~~~~ - -@section occt_cdl_4 Defining the Software Components - -@subsection occt_cdl_4_1 Behavior - -The behavior of an object class is defined by a list of **methods**, which are either **functions** or **procedures**. Functions return an object, whereas procedures only communicate by passing arguments. In both cases, when the transmitted object is an instance manipulated by a handle, its identifier is passed. There are three categories of methods: - -* **Object constructor** Creates an instance of the described class. A class will have one or more object constructors with various arguments or none. -* **Instance method** Operates on the instance which owns it. -* **Class method** Does not work on individual instances, only on the class itself. - -@subsubsection occt_cdl_4_11 Object Constructors - -A constructor is a function, which allows the **creation of instances** of the class it describes. - -~~~~~ -constructor-declaration ::= -Create [ simple-formal-part ] declaration-ofconstructed-type -[ exception-declarations ] -simple-formal-part ::= -’(’ initialization-parameter {’;’ initialization parameter}’)’ -initialization-parameter ::= -identifier {’,’ identifier} ’:’ parameter-access datatype -[ ’=’ initial-value ] -parameter-access ::= -mutable | [ immutable ] -initial_value ::= -numeric-constant | literal-constant | named-constant -declaration-of-constructed-type ::= -returns [ mutable ] class-name -~~~~~ - -The name of the constructors is fixed: “Create”. The object returned by a constructor is always of the type of the described class. If that type is manipulated by a handle, you *must* declare it as **mutable**, in which case the content of the instance it references is accessible for further modification. - -For example, the constructor of the class “Point” -~~~~~ -Create (X, Y, Z : Real) -returns mutable Point; -~~~~~ - -With the exception of the types predefined by the language, all types of initialization parameters *must* appear in the **uses** clause of the class of which the constructor is a member. - -When an initialization parameter is of a type which is manipulated by a handle, an access right *must* be associated with it so as to express if the internal representation of the referenced object is modifiable (**mutable**) or not (**immutable**). The default option is **immutable**. Let, for example, take the constructor of the persistent class “Line”. - -~~~~~ -Create (P : mutable Point; D : mutable Direction) -returns mutable Line; -~~~~~ - -In the above example “P” and “D” must be mutable because the constructor stores them in the internal representation of the created line, which is mutable itself. An alternative would be to accept immutable initialization parameters and then copy them into the constructor in a mutable form. - -The parameters of a native type can have a default value: this is expressed by assigning a constant of the same type to the parameter concerned. Parameters, which have a default value, may not be present when the call to the constructor is made, in which case they take the value specified in the declaration. For this reason, they must all be grouped at the end of the list. Let, for example, take the constructor of the persistent class “Vector”. - -~~~~~ -Create (D : mutable Direction; M : Real = 1.0) -returns mutable Vector; -~~~~~ - -A class can have many constructors (in this case, you say they are **overloaded**) provided that they differ in their syntax and that the presence of parameters having default values does not create ambiguities. - -The restrictions on their use are expressed by a list of **exceptions** against which each constructor is protected. - -Each class must have at least one constructor to be able to create objects of its type. - -@subsubsection occt_cdl_4_1_2 Instance Methods - -An instance method is a function or procedure, which applies to any instance of the class, which describes it. - -**Example** -~~~~~ -declaration-of-an-instance-method ::= identifier formal-part-of-instance-method -[ declaration-of-returned-type ] -[ exception-declaration ] -formal-part-of-instance-method ::= ’(’ me [’:’ passing-mode parameter-access ] {’;’ parameter}’)’ -parameter ::= identifier {’,’ identifier} ’:’ passing-mode -parameter-access -data-type [ ’=’ initial-value ] -passing-mode ::= [ in ] | out | in out -parameter-access ::= mutable | [immutable] -declaration-of-returned-type ::= returns return-access data-type -return-access ::= mutable |[ immutable ]| any -~~~~~ - -The name **me** denotes the object to which the method is applied: you call this the “principal object” of the method. The passing mode expresses whether the direct content of the principal object or a parameter is either: - - * read - * created and returned - * read then updated and returned by the method. - -Remember that the direct content of an argument of a type which is manipulated by value contains the internal representation of the object itself. Thus, when the argument is of this type, **out** and **in out** mean that the content of the object will undergo a modification. When the method is a function (as is the case for constructors), all the arguments must be **in** (read). This is the default mode. - -In case of an argument of a type manipulated by a handle, the direct content being an object identifier, the passing mode addresses itself to the handle, and no longer to the internal representation of the object, the modification of which is controlled by the access right. An argument of this type declared **mutable** may see its internal representation modified. If declared **immutable**, it is protected. When a parameter is both **in out** and **mutable**, the identifiers passed and returned denote two distinct modifiable objects. - -When the returned object is manipulated by a handle it can be declared modifiable or not, or indeterminate (**any**). To return an object with an indeterminate access right means that the method transmits the identifier without changing its state and that the method has no right to alter the access right. This functionality is particularly useful in the case of collections; temporarily storing an object in a structure and unable to modify its state. - -With the exception of the types predefined by the language, all types of parameters and returned objects, whether manipulated by a handle or by value, *must* appear in the **uses** clause of the class of which the method is a member. -As is the case for constructors, some parameters can have a default value, provided that they are of primitive or enumerated type. They are passed in the **in** mode, and they are found at the end of the list of arguments. - -Overloading of instance methods and use of exceptions and post-conditions is allowed and respects the same rules than constructors. - -Note the overloading of “Coord” in the following example of instance methods associated with the persistent class “Point”: - -~~~~~ -Coord (me; X, Y, Z : out Real); ----Purpose: returns the coordinates of me - -Coord (me; i : Integer) returns Real; ----Purpose: returns the abscissa (i=1), the --- ordinate (i=2) or the value (i=3) of me - -SetCoord (me : mutable; X, Y, Z : Real); ----Purpose: modifies the coordinates of me - -Distance (me; P : Point) returns Real ----Purpose: returns the distance to a point -~~~~~ - -In all these cases, **me** is implicitly an object of type *Point*. Only “SetCoord” is able to modify the internal representation of a point. - -@subsubsection occt_cdl_4_1_3 Class Methods - -A class method is a function or procedure relative to the class it describes, but does not apply to a particular instance of the class. - -~~~~~ -declaration-of-a-class-method ::= identifier formal-part-of-class-method -[ declaration-of-returned-type ] -[ exception-declaration ] -formal-part-of-class-method ::= ’(’ myclass {’;’ parameter}’)’ -~~~~~ - -The first parameter **myclass** indicates that the method does not apply to a previously created instance, but to the class itself. The rest of the syntax is identical to that of the instance methods. In particular, access rights (**mutable**, **immutable**, **any**) and the argument passing mode (**in**, **out**, **in out**) must remain unchanged. With the exception of the types predefined by the language, all types of parameters must appear in the **uses** clause of the class of which the method is a member. Overloading of class methods and the use of exceptions and post-conditions is allowed, and it follows the same rules as for constructors and instance methods. - -Examples of class methods associated with the class “Real”: - -~~~~~ -First (myclass) returns Real; ----Purpose: returns lower limit of reals - -Last (myclass) returns Real; ----Purpose: returns upper limit of reals -~~~~~ - -@subsubsection occt_cdl_4_1_4 Package Methods - -Package methods are methods which are members of a package. They are frequently used for library or application initialization, or for offering an application programming interface to the sources to the package. They are sometimes methods used for development purposes but which are not made available to final end-users of the package. - -~~~~~ -package-method ::= identifier [simple-formal-part][returned-type-declaration] -[exception-declaration] -[is private]’;’ -~~~~~ - -@subsubsection occt_cdl_4_1_5 Sensitivity to Overloading - -When there is more than one method of a class, several methods share the same name but have different syntax, you say the method is overloaded. - -In order that the methods can be considered distinct, they must differ either in the number of parameters, or one of their parameters must be of a different type. In particular, you *cannot* overload a method if you merely modify it as follows: - - * The type of the returned object when the method behaves as a function - * The name or the mode of passing a parameter (**in**, **out**, or **in out**) - * The mutability of passed objects (**mutable**, **immutable**, **any**) - * Default value of a parameter. - -@subsection occt_cdl_4_2 Internal Representation - -Each object contains its own state in a private space in the memory. This state consists of a set of **fields**, which include or reference other objects. - -**Example** -~~~~~ -declaration-of-the-internal-representation-of-a-class ::= fields field {field} -field ::= identifier {’,’ identifier} ’:’ data-type [’[’integer {’,’integer}’]’]’;’ -~~~~~ - -A copy of all the defined fields exists locally in each instance of the class. This group of fields will be initialized by the class constructors when the object is instantiated. - -Fields *must not* have the same name as any method of the class in which they appear. When the field type is followed by a list of integer constants between square brackets, the data will take the form of a multi-dimensional array containing objects of this type. - -The following example shows two equivalent ways of describing three fields of the “Real” type: - -**Example** -~~~~~ -fields -x, y, z: Real; -coord: Real[3]; -~~~~~ - - -Depending on their type, Object fields have one of the two forms. When the field is of the “manipulated by handle” type, it corresponds to an identifier. In this case, the contents of the object can be shared by other objects or by a handle in a program. When the field is of a “manipulated by value” type, it contains the value of the object. In this case you say the object is **embedded**. - -@subsection occt_cdl_4_3 Exceptions - -Exceptions describe exceptional situations, which can arise during the execution of a method. With the raising of an exception, the normal course of program execution is interrupted. The actions carried out in response to this situation are called treatment of exception. -~~~~~ -exception-treatment ::= raises exception-name {’,’ exception-name} -~~~~~ -Each exception name corresponds to a class of exceptions previously defined as being susceptible to being raised by the method under which it appears. Exception classes must all appear in the **raises** clause of the class of which the method is a member. The class of exceptions is analogous to the class of objects described in this manual. - -Take for example the method which returns the x, y, or z coordinate of a point. - -~~~~~ -Coord (me; i : Integer) returns Real ----Purpose: --- Returns the abscissa (i=1) --- the ordinate (i=2) --- or the value (i=3) --- of me. -raises OutOfRange; --- if i is not equal to 1, 2, or 3. -~~~~~ - - -Instance methods are likely to raise certain exceptions called **systematic exceptions** which do not have to appear. They are: - -* *NullObject* - raised when the principal object does not exist. -* *ImmutableObject* - raised when a method tries to modify an immutable principal object. -* *TypeMismatch* - raised if an argument typed by association is of an unsuitable type. - -These exceptions are described in the Standard Package (System Toolkits). - - -@subsection occt_cdl_4_4 Inheritance - -@subsubsection occt_cdl_4_4_1 Overview - -The notion of inheritance comes from a development strategy according to which you begin by modeling data in the most general fashion. Then you specialize it more and more so as to correspond to more and more precise cases. - -For example, to develop a basic geometry, you can first of all consider the group of geometric objects, and then differentiate the points, vectors, and curves. You can specialize the latter into conic sections, and then decompose them into circles, ellipses, and hyperbolas. Then, the class of conics is considered as a sub-class of curves, and a super-class of circles. - -A sub-class has at least the behavior of its super-classes. Thus, a circle could be viewed as a conic, a curve, or even as a geometric object. In each case, the applicable methods belong to the level where you view the class. In this case, you say that the sub-class inherits the behavior from its super-classes. - - -**Example** -~~~~~ -declaration-of-a-sub-class ::= class class-name -inherits class-name -[uses data-type {’,’ data-type}] -[raises exception-name {’,’ exception-name}] -is class-definition -end [class-name]’;’ -~~~~~ - -A class cannot inherit one of its descendent classes; nor can it inherit a native type. All the classes of a system can be described in a non-cyclic diagram called the **inheritance graph**. - -The definition of a sub-class is identical to that of a simple class. Note that a super-class must not appear in the **uses** clause of the sub-class, even if it appears in the definition of the sub-class. The behavior of a sub-class includes as a minimum all instance methods and protected methods of its super-classes. - -**Note** that constructors and class methods are never inherited. - -@subsubsection occt_cdl_4_4_2 Redefining methods - -Certain inherited methods can be redefined. - -**Example** - -~~~~~ -declaration-of-a-redefined-method ::= identifier formal-part-of-instance-method [returnedtype- declaration] -[declaration-of-exceptions] -is redefined [visibility]’;’ -~~~~~ - -A redefined method must conform to the syntax described in the super-class where it appears. The exceptions contained in the super-class can be renewed, and others may be added as long as they inherit from an ancestor class. - -The redefined attribute can be applied neither to a constructor, nor to a class method, since neither of them can be inherited. If the redefined method is private or protected, the visibility must be exactly repeated in the redefinition. For further details on visibility, refer to Visibility section. - - -**Example** -~~~~~ -SquareDistance (me; P : Point) returns Real -is redefined private; -~~~~~ - -With regards to the internal representation, all fields defined in the super-classes are, by default, inherited, but they can also be redefined. - -@subsubsection occt_cdl_4_4_3 Non-redefinable methods - -Instance methods, which are declared virtual are redefinable in descendent classes, and you can force this redefinition by making a method **deferred**. For more details, see the next section. - -**Example** - -~~~~~ -declaration-of-a-non-redefinable-method ::= identifier formal-part-of-instance-method [returnedtype- declaration] -[declaration-of-exceptions] - is virtual [visibility]’;’ -~~~~~ - -All methods are static by default. To enable redefinition in all the child classes, add **is virtual** when declaring the method. - -You must also be able to forbid redefinition. A redefinable method can become non-redefinable if you declare: **is redefined static**. - - -@subsubsection occt_cdl_4_4_4 Deferred Classes and Methods - -The presence of certain classes in the inheritance graph can be justified purely by their ability to force certain behavior on other classes, in other words, to make other classes provide various services. - -The CDL language allows you to describe a class, which introduces methods without implementing them, so as to force its descendent classes to define them. These are called **deferred classes**; the non-implemented methods are also termed **deferred methods**. - - -**Example** -~~~~~ -declaration-of-a-deferred-class ::= deferred class class-name -[inherits class-name [uses data-type {’,’ data-type}] -[raises exception-name {’,’ exception-name}] -is class-definition -end [class-name]’;’ -declaration-of-a-deferred-method ::= identifier formal-part-of-instance-method [returnedtype- declaration] -[declaration-of-exceptions] -is deferred [visibility]’;’ -~~~~~ - -Only instance methods can be deferred. - -It is sufficient for a class to contain one deferred method for it to be a deferred class. It can contain any number of deferred methods (or none). - -A deferred class may still have an internal representation but one or more **non-protected** constructors would be necessary to initialize them. The constructors must be visible in the sub-classes. - -The constructors of a deferred class are called **Initialize** (not **Create**). They are **protected** by default, and do not return any object. You cannot create an object of a deferred class type. -For example, consider the class *Point*, and its declaration as deferred. - -**Example** -~~~~~ -deferred class Point inherits Geometry is -Initialize; ----Purpose: Initializes the point. -Coord (me; X, Y, Z : out Real) ----Purpose: Returns the coordinates -is deferred; -SetCoord (me : mutable; X, Y, Z : Real) ----Purpose: Modifies the coordinates -is deferred; -Distance (me; P : Point) returns Real; ----Purpose: Returns the distance from the point P -end Point; -~~~~~ - -Notice that the function *Distance* is not deferred. Although this class contains no representation, this method is programmable by calling *Coord*. - -In a sub-class of a deferred class, all deferred methods, which have been inherited, must be implemented, then redeclared (the attribute **redefined** is useless for this purpose), unless the sub-class is itself deferred. - -A non-deferred method can be redefined as a deferred one, in which case it will be declared as follows: **is redefined deferred**. - -The notion of deferred class is very useful. The advantage of introducing it, as was previously shown in the deferred class *Point*, is that the corresponding resources will be available even before being implemented. Later, you can add different representations to Point (for example, spherical or Cartesian coordinates) without having to modify client programs. - -Thanks to the possibility of redefining methods, this approach does not have any negative impact on performance: a method implemented at the level of a deferred class can be reprogrammed in one of its sub-classes while taking into account the data representation. - -@subsubsection occt_cdl_4_4_5 Declaration by Association - -At the heart of a class hierarchy, object identifiers are compatible in the ascendant sense. Since the *Conic* class is descended from the *Curve* class, an identifier of type *Curve* can reference an object of type *Conic* (remember that the behavior of *Curve* is applicable to *Conic*). In other words, you can assign a reference to a *Conic* to an identifier of type *Curve*, but not vice versa. - -For example, once the classes have been compiled you could write a C++ test program in which you instantiate a Conic but reference it with a handle to a Curve: -~~~~~ -Handle(Curve) c = new Conic -~~~~~ -This same rule applies to parameters of methods; that is to say, you can call a method with identifiers corresponding to a sub-type of that specified in its declaration. To illustrate this, let us go back to the “Distance” method of the “Point” class: - -~~~~~ -Distance (me; P : point) returns Real; -~~~~~ -Conforming to the rule of type compatibility, you could make a call to the method “Distance” with reference to an object from a class descended from “Point”. Consequently, if “SphericPoint” is a sub-class of “Point” and therefore inherits this method, it will be possible to calculate the distance between two “SphericPoint”, or between a “SphericPoint” and a “Point”, without having to redefine the method. - -On the other hand, sometimes you may want to force two parameters to be exactly of the same type, and thus not apply the rule of type compatibility. To do this, you need to associate the type of the concerned parameters in the method declaration. - -~~~~~ -association-typing ::= like associated-parameter -associated-parameter ::= me | identifier -~~~~~ - -Note that identifier is the name of a parameter, which appears first in the formal part of the declaration of the method. - - -You can use this technique, which consists in declaring by association, to declare a method that will exchange the content of two objects, or a method, which copies another object: - -~~~~~ -Swap (me : mutable; With : mutable like me); -DeepCopy (me) returns mutable like me; -~~~~~ - -Make sure not to write the Swap method as in the syntax below: - - -~~~~~ -Swap (me : mutable; With : mutable Point); -~~~~~ - -In this case **me** may be a CartesianPoint or a SphericalPoint, while *With* can only be a Point. - -@subsubsection occt_cdl_4_4_6 Redefinition of Fields - -The creation of a hierarchy of classes should be viewed as a means to specialize their behavior, (e.g. a circle is more specialized than a conic section). The more you specialize the object classes, the more it is justified to call into question the inherited fields in order to obtain greater optimization. So, in the description of the internal representation of a sub-class, it is possible not to inherit all of the fields of the super-classes. You then say the fields have been redefined. - -~~~~~ -redefinition-of-the-representation-of-a-class ::= redefined redefinition-of-a-field {’,’ redefinition-of-a- -field}’,’ -redefinition-of-a-field ::= [field-name] from [class] class-name -~~~~~ - -Redefinition of fields can only be done in classes manipulated by a handle. - -This declaration appears at the beginning of the definition of the internal representation of the sub-class, which breaks the field inheritance. The non-inherited fields are all those which come from the class specified behind the rubric **from**. - - -@subsection occt_cdl_4_5 Genericity - -@subsubsection occt_cdl_4_5_1 Overview - -Inheritance is a powerful mechanism for extending a system, but it does not always allow you to avoid code duplication, particularly in the case where two classes differ only in the type of objects they manipulate (you certainly encounter this phenomenon in all basic structures). In such cases, it is convenient to send arbitrary parameters representing types to a class. Such a class is called a **generic class**. Its parameters are the generic types of the class. - -Generic classes are implemented in two steps. You first declare the generic class to establish the model, and then instantiate this class by giving information about the generic types. - -@subsubsection occt_cdl_4_5_2 Declaration of a Generic Class - -The syntax is as follows: - -~~~~~ -declaration-of-a-generic-class ::= [deferred] generic class class-name ’(’generic-type {’,’generic-type}’)’ -[inherits class-name -[uses data-type {’,’ data-type}] -[raises exception-name {’,’ exception-name}] - is class-definition - end [class-name]’;’ -generic-type ::= identifier as type-constraint -type-constraint ::= any | class-name [’(’data-type {’,’data-type}’)’] -~~~~~ - -The names of generic types become new types, which are usable in the definition of a class, both in its behavior (methods) and its representation (fields). The generic type is only visible inside the generic class introducing it. As a result, it is possible to have another generic class using the same generic type within the same package. - -When you specify the type constraint under the form of a class name, you impose a minimum set of behavior on the manipulated object. - -This shows that the generic type has as a minimum the services defined in the class. This can be any kind of a previously defined class, including another generic class, in which case you state exactly with what types they are instantiated. - -When the generic type is constrained by the attribute **any**, the generic class is intended to be used for any type at all, and thus corresponds to classes whether manipulated by a handle or by value. - -No class can inherit from a generic class. - -A generic class can be a deferred class. A generic class can also accept a deferred class as its argument. In both these cases any class instantiated from it will also be deferred. The resulting class can then be inherited by another class. - -Below is a partial example of a generic class: a persistent singly linked list. - -~~~~~ -generic class SingleList (Item as Storable) - inherits Persistent - raises NoSuchObject - is - Create returns mutable SingleList; - ---Purpose: Creates an empty list - IsEmpty (me) returns Boolean; - ---Purpose: Returns true if the list me is empty - SwapTail (me : mutable; S : in out mutable - SingleList) - ---Purpose: Exchanges the tail of list me with S - -- Exception NoSuchObject raised when me is empty - raises NoSuchObject; - Value (me) returns Item - ---Purpose: Returns first element of the list me - -- Exception NoSuchObject raised when me is empty - raises NoSuchObject; - Tail (me) returns mutable SingleList - ---Purpose: Returns the tail of the list me - -- Exception NoSuchObject raised when me is empty - raises NoSuchObject; - fields - Data : Item; - Next : SingleList; - end SingleList; -~~~~~ - -Even though no object of the type “SingleList” IS created, the class contains a constructor. This class constitutes a model, which will be recopied at instantiation time to create a new class which will generate objects. The constructor will then be required. - -**Example** -~~~~~ -generic class Sequence(Item as any, Node as -SingleList(Item)) -inherits Object -. . . -end Sequence -~~~~~ - -In the above example, there are two generic types: *Item* and *Node*. The first imposes no restriction. The second must at least have available the services of the class *SingleList* instantiated with the type with which *Sequence* will itself be instantiated. - -In the incomplete declaration of a generic class, the keyword **generic** must appear. - -**Example** -~~~~~ -generic class SingleList; -generic class Sequence; -~~~~~ - -@subsubsection occt_cdl_4_5_3 Instantiation of a Generic Class - -The syntax is as follows: - -~~~~~ -instantiation-of-a-generic-class ::= [deferred] class class-name - instantiates class-name ’(’data-type {’,’ data-type}’);’ -~~~~~ - -Instantiation is said to be **static**. In other words, it must take place before any use can be made of the type of the instantiated class. Each data type is associated term by term with those declared at the definition of the generic class. These latter ones, when they are not of the type **any**, restrict instantiation to those classes, which have a behavior at least equal to that of the class specified in the type constraint, including constructors. Note that this is not guaranteed by inheritance itself. - -For example, let’s instantiate the class *Sequence* for the type *Point*: - -~~~~~ -class SingleListOfPoint instantiates SingleList(Point); -class Sequence instantiates - Sequence(Point,SingleListOfPoint); -~~~~~ - -The instantiation of a generic deferred class is a deferred class (the **deferred** attribute must be present during instantiation). An instantiated class cannot be declared in an incomplete fashion. - -@subsubsection occt_cdl_4_5_4 Nested Generic Classes - -It often happens that many classes are linked by a common generic type. This is the case when a base structure provides an iterator, for example, in the class *Graph*. A graph is made up of arcs, which join together the nodes, which reference objects of any type. This type is generic both for the graph and for the node. In this context, it is necessary to make sure that the group of linked generic classes is indeed instantiated for the same type of object. So as to group the instantiation, CDL allows the declaration of certain classes to be nested. - -**Example** - -~~~~~ -declaration-of-a-generic-class ::= [deferred] generic class class-name ’(’generic-type{’,’generic-type}’)’ - [inherits class-name {’,’ class-name}] - [uses data-type {’,’ data-type}] - [raises exception-name {’,’ exception-name}] - [{[visibility] class-declaration}] - is class-definition -end [class-name]’;’ - class-declaration ::= incomplete-declaration-of-a-class | declaration-of-a-non-generic-class | instantiation-of-a-generic-class -~~~~~ - -**Nested classes**, even though they are described as non-generic classes, are generic by construction, being inside the class of which they are a part. As a consequence, the generic types introduced by the **encompassing class** can be used in the definition of the nested class. This is true even if the generic type is only used in a nested class. The generic types still must appear as an argument of the encompassing class. All other types used by a nested class must appear in its **uses** or **raises** clauses, just as if it were an independent class. - -Nested classes are, by default, **public**. In other words, they can be used by the clients of the encompassing class. On the other hand, when one of the nested classes is declared **private** or **protected**, this class must not appear in any of the public methods of the other classes. It cannot be used in a protected field because then it could be used in a sub-class, which implies it would not be private. - -The following example shows how to write the Set class with its iterator. - -~~~~~ -generic class Set (Item as Storable) - inherits Persistent - private class Node instantiates SingleList (Item); - class Iterator - uses Set, Node - raises NoSuchObject, NoMoreObject - is - Create (S : Set) returns mutable Iterator; - ---Purpose: Creates an iterator on the group S - More (me) returns Boolean; - ---Purpose: Returns true if there are still elements - -- to explore - Next (me) raises NoMoreObject; - ---Purpose: Passes to the following element - Value (me) returns any Item raises NoSuchObject; - ---Purpose: Returns the current element - fields - Current : Node; - end Iterator; - is - Create returns mutable Set; - ---Purpose: Creates an empty group - IsEmpty (me) returns Boolean; - ---Purpose: Returns true if the group is empty - Add (me : mutable; T : Item); - ---Purpose: Adds an item to the group me - Remove (me : mutable; T : item) raises - NoSuchObject; - ---Purpose: Removes an item from the group me - etc. - fields - Head : Node; - end Set; -~~~~~ - -Note that in their fields, both “Set” and “Iterator” are clients of another class, “Node”. This last can be effectively declared **private** for it only appears in fields which are themselves private. - -The instantiation of a generic class containing nested classes remains unchanged. The same declaration is used to instantiate the encompassing class and the nested classes. These latter will have their name suffixed by the name supplied at instantiation, separated by “Of”. For example, you instantiate the class “Set” described above for the type “Point” as follows: - -~~~~~ -class SetOfPoint instantiates Set(Point); -~~~~~ -In doing so, you implicitly describe the classes “NodeOfSetOfPoint” and “IteratorOfSetOfPoint”, which are respectively the result of the concatenation of “Node” and “Iterator” with “Of” then “SetOfPoint”. - -Note that in the incomplete declaration of an encompassing class, all the names of the nested classes *must* appear behind that of the encompassing class. - -~~~~~ -incomplete-declaration-of-a-generic-class ::= [deferred] generic class-name {’,’ class-name}; -~~~~~ - -For example, an incomplete declaration of the above class “Set” would be as in the example below: - -~~~~~ -generic class Set, Node, Iterator; -~~~~~ - -Only the encompassing class can be deferred. In the above example only the class “Set” can be deferred. - - - -@subsection occt_cdl_4_6 Visibility - -@subsubsection occt_cdl_4_6_1 Overview - -A field, method, class, or package method is only available for use if it is **visible**. -Each of these components has a default visibility, which can be explicitly modified during class or package declaration. The three possible states of visibility are: - * Public - * Private - * Protected - -@subsubsection occt_cdl_4_6_2 Visibility of Fields - -A field is **private**. It can never be public - this would destroy the whole concept of data encapsulation. The attribute **private** is redundant when it is applied to a field. This means that a field is only visible to methods within its own class. -A field can be declared **protected**, which means that it becomes visible in subclasses of its own class. Its contents can be modified by methods in subclasses. - -~~~~~ -field ::= identifier {’,’ identifier} ’:’ data-type -[’[’integer{’,’integer}’]’] -[is protected]’;’ -~~~~~ - -**Example** - -~~~~~ -fields - Phi, Delta, Gamma : AngularMomenta [3] - is protected ; -~~~~~ - -@subsubsection occt_cdl_4_6_3 Visibility of Methods - -Methods act on fields. Only methods belonging to a class can act on the fields of the class; this stems from the principle of object encapsulation. Methods can be characterized in three ways: by default, methods are **public**. Methods can be declared **private** or **protected** to restrict their usage. - -* **Public** methods are the default and generally the most common. They describe the behavior of a class or a package, and they are callable by any part of a program. -* **Private** methods exist only for the internal structuring of their class or their package. Private class methods can only be called by methods belonging to the same class. Private package methods can only be called by all methods belonging to the same package and its classes. -* **Protected** methods are private methods, which are also callable from the interior of descendent classes. - -If you want to restrict the usage of a method, you associate with it a visibility as follows : -~~~~~ --- declaration-of-the-visibility ::= is visibility -visibility ::= private | protected -~~~~~ - -The declaration of the visibility of a method appears at the end of its definition, before the final semi-colon. The attribute **private** indicates that the method will only be visible to the behavior of the class of which the method is a member; **protected** will propagate the visibility among the sub-classes of this class. - -For example, add to the class “Line” an internal method allowing the calculation of the perpendicular distance to the power of two, from the line to a point. - -~~~~~ -SquareDistance (me; P : Point) returns Real -is private; -~~~~~ - -@subsubsection occt_cdl_4_6_4 Visibility of Classes, Exceptions and Enumerations - -The visibility of a class is the facility to be able to use this class in the definition of another class. The visibility of a class extends from the beginning of its declaration up to the end of the package in which it appears. You have seen that the keyword **uses** allows extension of this visibility to other packages. - -As was explained in the section on “Name Space”, any ambiguity, which arises from having two classes with the same name coming from different packages, is dealt with by the use of the keyword **from**. - -A class declared **private** is only available within its own package. - -@subsubsection occt_cdl_4_6_5 Friend Classes and Methods - -In certain cases, methods need to have direct access to the private or protected parts of classes of which they are clients. Such a method is called a **friend** of the class, which is accessed. For example, you declare a method to be a friend when a service can only be obtained via the use of another non-descendent class, or perhaps when this will help to improve performance. - -Classes can also be declared friends of other classes. In this case all the methods of the friend class will have access to the fields and methods of the host class. The right is **not reciprocal**. - -Friend classes or methods are declared inside the class, which reveals its private and protected data or methods to them. This helps in managing the continuing evolution of a class, helping to recognize and to avoid the creation of side effects. - -**Example** -~~~~~ -declaration-of-friends ::= friends friend {’,’friend} - friend ::= identifier from [class] class-name [formal-part] | --- Defining the Software Components 67 -identifier from [package] package-name [formal-part] | class] class-name - formal-part ::= simple-formal-part | formal-part-of-instance-method | formal-part-of-class-method -~~~~~ - -The formal part must be present if the method contains one; thus this can be overloaded without necessarily propagating the friend relationship among its homonyms. The keyword **class** allows you to avoid certain ambiguities. For example, it removes any confusion between “method M from class C” and “method M from package P”. - -As an example, take a method, which calculates the perpendicular distance between a line and a point. Suppose this method needs to access the fields of the point. In the class “Point” you would write: - -~~~~~ -friends Distance from Line (me; P : Point) -~~~~~ - -A method can be a friend to many classes. The class to which the method belongs does not need to appear in the **uses** clause of other classes of which it is a friend. - -When the methods of a class are all friends of another class, you can establish the friendship at the level of the class. - - -| | Public | Private | Protected | -| :---- | :---- | :---- | :----- | -| Field | Does not exist | **Default** - Visible to methods in its own class and in friend classes | Visible to methods in its own class, sub-classes and friend classes | -| Method | **Default** - Callable anywhere | Callable by methods in its own class and in friend classes | Callable by methods in its own class, sub-classes and friend classes | -| Class | **Default** - Visible everywhere with the use of **from** rubric | Visible to classes in its own package | Does not exist | -| Package method | **Default** - Callable everywhere with the use of **from** rubric | Visible to classes in its own package | Does not exist | -| Nested Class | **Default** - Visible to the clients of the encompassing class | Visible to the encompassing class and other classes nested in the encompassing class | Does not exist | - - -@section occt_cdl_5 Appendix A. Syntax Summary - - -This summary of the CDL syntax will aid in the comprehension of the language, but does *not* constitute an exact definition thereof. In particular, the grammar described here accepts a super-set of CDL constructors semantically validated. - -(1) capital ::= ’A’ | ’B’ | ’C’ | ’D’ | ’E’ | ’F’ | ’G’ | ’H’ | ’I’ | ’J’ | ’K’ | ’L’ | ’M’ | ’N’ | -’O’ | ’P’ | ’Q’ | ’R’ | ’S’ | ’T’ | ’U’ | ’V’ | ’W’ | ’X’ | ’Y’ | ’Z’ - -(2) non-capital ::= ’a’ | ’b’ | ’c’ | ’d’ | ’e’ | ’f’ | ’g’ | ’h’ | ’i’ | ’j’ | ’k’ | ’l’ | ’m’ | ’n’ | -’o’ | ’p’ | ’q’ | ’r’ | ’s’ | ’t’ | ’u’ | ’v’ | ’w’ | ’x’ | ’y’ | ’z’ - -(3) digit ::= ’0’ | ’1’ | ’2’ | ’3’ | ’4’ | ’5’ | ’6’ | ’7’ | ’8’ | ’9’ - -(4) underscore ::= ’_’ - -(5) special character ::= ’ ’ | ’!’ | ’”’ | ’#’ | ’$’ | ’%’ | ’&’ | ’’’ | ’(’ | ’)’ | ’*’ | ’+’ | ’,’ | ’-’ | ’.’ | ’/’ | ’:’ | ’;’ | ’’ | ’=’ | ’’ | ’?’ | ’@’ | ’[’ | ’\’ | ’]’ | ’^’ | ’‘’ | ’{’ | ’|’ | ’}’ | ’~’ - -(6) printable character::= capitals | non-capitals | digits | underscore | special characters - -(7) letter ::= capital | non-capital - -(8) alphanumeric ::= letter | digit - -(9) identifier ::= letter{[underscore]alphanumeric} - -(10) integer ::= digit{digit} - -(11) exponent ::= ’E’[’+’]integer | ’E-’integer - -(12) numeric-constant ::= [’+’]integer ’.’ integer[exponent] | ’-’integer ’.’ integer[exponent] - - -(13) literal-constant ::= ’’’printable character’’’ | ’~’{printable -character}’~’ - -(14) package-name ::= identifier - -(15) enumeration-name ::= identifier [**from** package-name] - -(16) class-name ::= identifier [**from** package-name] - -(17) exception-name ::= identifier [**from** package-name] - -(18) constructor-name ::= ’Create’ | ’Initialize’ - -(19) primitive-type ::= ’Boolean’ | ’Character’ | ’Integer’ | ’Real’ - -(20) data-type ::= enumeration-name | class-name | exception-name | primitive-type - -(21) passed-type ::= data-type | **like me** | **like** identifier - -(22) passing-mode ::= [**in**] | **out** | **in out** - -(23) parameter-access ::= **mutable** | [**immutable**] - -(23A) return-access ::= **mutable** | [**immutable**]| **any** - -(24) value ::= numeric-constant | literal-constant | identifier - -(25) parameter ::= identifier {’,’ identifier} ’:’ passing-mode access-right passed-type [’=’ value] - -(26) simple-formal-part ::= ’(’parameter {’;’ parameter}’)’ - -(27) formal-part-of-instance-method ::= ’(’ **me** [’:’ passing-mode access-right] {’;’ parameter}’)’ - -(28) formal-part-of-class-method ::= ’(’ **myclass** {’;’ parameter}’)’ - -(29) visibility ::= **private** | **protected** - -(30) redefinition ::= **static** | **deferred** - -(31) definition-level ::= redefinition | **redefined** [redefinition] - -(32) declaration-of-constructed-type ::= **returns** [**mutable**] class-name - -(33) declaration-of-returned-type ::= **returns** return-access passed-type - -(34) declaration-of-errors ::= **raises** exception-name {’,’ exception-name} - -(35) declaration-of-visibility ::= **is** visibility - -(36) declaration-of-attributes-of-instance-method ::= **is** visibility | **is** definition-of-level [visibility] - -(37) constructor ::= constructor-name [simple-formal-part] -[declaration-of-constructed-type] -[declaration-of-errors] -[declaration-of-visibility]’;’ - -(38) instance-method ::= identifier formal-part-of-instance-method -[declaration of returned type] -[declaration-of-errors] -[declaration-of-attributes-of-instancemethod]’;’ - -(39) class-method ::= identifier formal-part-of-the-class-method -[declaration of returned type] -[declaration-of-errors] -[declaration-of-visibility]’;’ - -(40) package-method ::= identifier [simple-formal-part] -[declaration-of-returned-type] -[declaration-of-errors] -[**is private**]’;’ - -(41) member-method ::= constructor | instance-method | class-method - -(42) formal-part ::= simple-formal-part | formal-part-of-instance-method| formal-part-of-class-method - -(43) friend ::= identifier **from** [**class**] class-name [formal-part] -| identifier **from** [**package**] package-name [formal-part] | -[**class**] class-name - -(44) field ::= identifier {’,’ identifier} ’:’ data-type -[’[’integer {’,’ integer}’]’] -[**is protected**]’;’ - -45) redefinition-of-field ::= [field-name] **from** [**class**] class-name - -(46) declaration-of-fields ::= **fields** [**redefined** redefinition-of-field {’,’ redefinition-of-field}’;’] -field {field} - -(47) declaration-of-an-alias::= [**private**] **alias** class-name1 **is** class-name2 [**from** package-name] - -(48) declaration-of-friends ::= **friends** friend {’,’ friend} - -(49) class-definition ::= [{member-method}] -[declaration-of-fields] -[declaration-of-friends] - -(50) declaration-of-an-exception ::= **exception** exception-name **inherits** exception-name - -(51) declaration-of-an-enumeration ::= **enumeration** enumeration-name -**is** identifier {’,’ identifier} -[**end** [enumeration-name]]’;’ - -(52) incomplete-declaration-of-a-non-generic-class ::= -[**deferred**] **class** class-name’;’ - -(53) incomplete-declaration-of-a-generic-class ::= -[**deferred**] **generic class** class-name {’,’ class-name}’;’ - -(54) declaration-of-a-non-generic-class ::= -[**deferred**] **class** class-name -[**inherits** class-name -[**uses** data-type {’,’ data-type}] -[**raises** exception-name {’,’ exception-name}] -**is** definition-of-a-class -**end** [class-name]’;’ - -(55) type-constraint ::= **any** | class-name [’(’data-type {’,’ data-type}’)’] - -(56) generic-type ::= identifier **as** type-constraint - -(57) declaration-of-a-generic-class ::= -[**deferred**] **generic class** class-name ’(’generic-type -{’,’ generic-type}’)’ -[**inherits** class-name -[**uses** data-type {’,’ data-type}] -[**raises** exception-name {’,’ exception-name}] -[{[visibility] declaration-of-a-class}] -**is** class-definition -**end** [class-name]’;’ - -(58) instantiation-of-a-generic-class::= -[**deferred**] **class** class-name -**instantiates** class-name ’(’data-type -{’,’ data-type}’);’ - -(59) declaration-of-a-class::= -incomplete-declaration-of-a-non-generic-class -| -incomplete-declaration-of-a-generic-class | -declaration-of-a-non-generic-class | -declaration-of-a-generic-class | -instantiation-of-a-generic-class - -(60) type-declaration ::= -[private] declaration-of-an-enumeration | [**private**] class-declaration | declaration-of-an-exception - -(61) package-definition ::= -[{type-declaration}] -[{package-method}] - -(62) package-declaration ::= **package** package-name -[**uses** package-name {’,’ package-name}] - **is** package-definition -**end** [package-name]’;’ - -(63) executable-declaration ::= - **executable** executable-name - **is** - { - **executable** executable-part -[**uses** [identifier **as external**] - [{’,’ identifier **as external**}] - [unit-name **as library**] - [{’,’ unit-name **as library**}] - **is** - {file-name [as C++|c|fortran|object];} - **end** ’;’ - } - **end** ’;’ - -(64) schema-declaration ::= - **schema** schema-name - **is** -[{**package** package-name ’;’ }] -[{**class** class-name ’;’ }] -**end** ’;’ - - - - - -@section occt_cdl_6 Appendix B Comparison of CDL and C++ - -## Syntax for Data Types manipulated by Handle and by Value in CDL - -| | Handle | Value | -| :---- | :---- | :---- | -| Permanent | Persistent | Storable | -| Temporary | Transient | Any | -| Reading | Immutable | In | -| Writing | Mutable | Out | -| Read/Write | Mutable | In out | -| Return | Not specified : any | Without copy: --C++ return const& | - -## Syntax for Data Types manipulated by Handle and by Value in C++ - -| | Handle | Value | -| :---- | :---- | :--- | -| C++ Declaration | Handle(PGeom_Point) p1; | gp_Pnt p2; | -| C++ Constructor | p1 = newPGeom_Point(p2); | p2(0.,0.,0.); | -| C++ Method | x=p1 -> XCoord(); | x=p2.XCoord(); | - - - - \ No newline at end of file diff --git a/dox/dev_guides/cdl/images/cdl_image003.png b/dox/dev_guides/cdl/images/cdl_image003.png deleted file mode 100644 index 97f44803c1..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image003.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image004.png b/dox/dev_guides/cdl/images/cdl_image004.png deleted file mode 100644 index 9a0713271d..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image004.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image005.png b/dox/dev_guides/cdl/images/cdl_image005.png deleted file mode 100644 index 9c91d68b0d..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image005.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image006.png b/dox/dev_guides/cdl/images/cdl_image006.png deleted file mode 100644 index 3e1ba0759e..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image006.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image007.png b/dox/dev_guides/cdl/images/cdl_image007.png deleted file mode 100644 index 869e4a2bad..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image007.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image008.png b/dox/dev_guides/cdl/images/cdl_image008.png deleted file mode 100644 index 923e014343..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image008.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image009.png b/dox/dev_guides/cdl/images/cdl_image009.png deleted file mode 100644 index 5860e77f56..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image009.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image010.png b/dox/dev_guides/cdl/images/cdl_image010.png deleted file mode 100644 index 701df353b6..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image010.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image011.png b/dox/dev_guides/cdl/images/cdl_image011.png deleted file mode 100644 index 0c1546bd9b..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image011.png and /dev/null differ diff --git a/dox/dev_guides/cdl/images/cdl_image012.png b/dox/dev_guides/cdl/images/cdl_image012.png deleted file mode 100644 index 2785fd923f..0000000000 Binary files a/dox/dev_guides/cdl/images/cdl_image012.png and /dev/null differ diff --git a/dox/dev_guides/dev_guides.md b/dox/dev_guides/dev_guides.md index 44f43bf5ab..f99855ef0c 100644 --- a/dox/dev_guides/dev_guides.md +++ b/dox/dev_guides/dev_guides.md @@ -11,12 +11,6 @@ The following documents provide information on OCCT building, development and te * @subpage occt_dev_guides__tests "Automatic Testing system" * @subpage occt_dev_guides__debug "Debugging tools and hints" -These two documents provide details on obsolete technologies used by OCCT, -to be removed in future releases: - -* @subpage occt_dev_guides__wok "Workshop Organization Kit (WOK)" -* @subpage occt_dev_guides__cdl "Component Definition Language (CDL)" - The following guide provides information relevant to upgrading applications developed with previous versions of OCCT, to recent one: * @subpage occt_dev_guides__upgrade "Upgrade from previous OCCT versions" diff --git a/dox/dev_guides/upgrade/upgrade.md b/dox/dev_guides/upgrade/upgrade.md index ce86f5457a..a8e10b2707 100644 --- a/dox/dev_guides/upgrade/upgrade.md +++ b/dox/dev_guides/upgrade/upgrade.md @@ -3,18 +3,35 @@ Upgrade from older OCCT versions {#occt_dev_guides__upgrade} @tableofcontents -@section occt_upgrade_intro Introduction +@section upgrade_intro Introduction -This document provides technical details on upgrading user applications using previous versions of OCCT, to the current one. +This document provides technical details on changes made in particular versions of OCCT, and is aimed to help upgrading user applications based on previous versions of OCCT to newer ones. -@subsection occt_upgrade_700 Upgrade to OCCT 7.0.0 +@subsection upgrade_intro_precautions Precautions -@subsubsection occt_upgrade_700_persist Removal of legacy persistence +Back-up your code before upgrade. +We strongly recommend using version control system during upgrade process, saving one or several commits for each step of upgrade, until overall result is verified. +This will facilitate identification and correction of possible problems that can occur on intermediate steps of upgrade. +Carefully document each step to be able to repeat it if necessary. + +@subsection upgrade_intro_disclaim Disclaimer + +This document describes known issues that have been encountered in porting of OCCT and some applications, and approaches that helped to resolve these issues in known cases. +It does not pretend to cover all possible migration issues that can appear in your application. +Please take this document with discretion; apply your expertise and knowledge of your application to ensure correct result. + +The automatic upgrade tool is provided as-is, without warranty of any kind, and we explicitly disclaim any liability for possible errors that may appear due to use of this tool. +It is your responsibility to ensure that the changes you made in your code are correct. +When upgrading your code by automatic script, make sure to carefully review the changes made by it, on each step, before committing them. + +@section upgrade_700 Upgrade to OCCT 7.0.0 + +@subsection upgrade_700_persist Removal of legacy persistence Legacy persistence for shapes and OCAF data based on Storage_Schema (toolkits TKShapeShcema, TLStdLSchema, TKStdSchema, TKXCAFSchema) has been removed in OCCT 7.0.0. Applications that used these persistence tools for their data need to be updated to use other persistence mechanisms. -The existing data files in standard formats can be converted using OCCT 6.9.0 or previous, as follows. +The existing data files in standard formats can be converted using OCCT 6.9.0 or previous version, as follows. #### CSFDB files @@ -55,3 +72,316 @@ For that, start *DRAWEXE* and perform the following commands: On Windows, be careful to replace back slashes in the file path by either direct slash or pairs of back slashes. Use "XmlOcaf" or "XmlXCAF" instead of "BinOcaf" and "BinXCAF", respectively, to save in XML format instead of binary one. +@subsection upgrade_occt700_cdl Removal of CDL and WOK + +OCCT code has been completely refactored in version 7.0 to get rid of obsolete technologies used since its inception: CDL (Cas.Cade Definition Language) and WOK (Workshop Organization Kit). +C++ code previously generated by WOK from CDL declarations is now included directly in OCCT sources. + +This modification did not change names, API, and behavior of existing OCCT classes, thus in general the code based on OCCT 6.x should compile and work fine with OCCT 7.0. +However, due to redesign of basic mechanisms (CDL generic classes, Handles and RTTI) using C++ templates, some changes may be necessary in the code when porting to OCCT 7.0, as described below. + +WOK is not necessary anymore for building OCCT from sources, though it still can be used in traditional way -- auxiliary files required for that are preserved. +The recommended method for building OCCT 7.x is CMake, see @ref occt_dev_guides__building_cmake. +Alternative solution is to use legacy generator of project files (extracted from WOK), see @ref occt_dev_guides__building_wok. + +@subsubsection upgrade_occt700_cdl_auto Automatic upgrade + +Most of typical changes required for upgrading code to use OCCT 7.0 can be done automatically using the *upgrade* tool included in OCCT 7.0. +This tool is a Tcl script, thus Tcl should be available on your workstation to run it. + +Example: +~~~~~ + $ tclsh + % source /adm/upgrade.tcl + % upgrade -recurse -all -src= +~~~~~ + +On Windows, helper batch script upgrade.bat can be used, provided that Tcl is either available in PATH, or configured via custom.bat script (for instance, if you use OCCT installed from Windows installer package). Start it from command prompt: + +~~~~~ +cmd> \upgrade.bat -recurse -all -inc=\inc -src= [options] +~~~~~ + +Run upgrade tool without arguments to see the list of available options. + +Upgrade tool performs the following changes in the code. + +1. Adds second argument to macro DEFINE_STANDARD_RTTI indicating base class for its argument class (if inheritance is recognized by the script): +~~~~~ +DEFINE_STANDARD_RTTI(Class) -> DEFINE_STANDARD_RTTI(Class, Base) +~~~~~ + +2. Replaces forward declarations of collection classes previously generated from CDL generics (defined in TCollection package) by \#include of corresponding header: +~~~~~ +class TColStd_Array1OfReal; -> #include +~~~~~ + +3. Replaces underscored names of Handle classes by usage of a macro: +~~~~~ +Handle_Class -> Handle(Class) +~~~~~ + This change is not applied if source or header file is recognized as containing definition of Qt class with signals or slots, to avoid possible compilation errors of MOC files caused by inability of MOC to recognize macros (see http://doc.qt.io/qt-4.8/signalsandslots.html). + The file is considered as defining Qt object if it contains strings "Q_OBJECT" and either "slots:" or "signals". + +4. Removes forward declarations of classes with names Handle(C) or Handle_C, replacing these either by forward declaration of its argument class, or (for files defining Qt objects) \#include statement for header with name of the argument class and extension .hxx: +~~~~~ +class Handle(TColStd_HArray1OfReal); -> #include +~~~~~ + +5. Removes \#includes of files Handle_...hxx disappeared in OCCT 7.0: +~~~~~ +#include -> +~~~~~ + +6. Removes typedef statements that use Handle macro to generate name: +~~~~~ +typedef NCollection_Handle Handle(Message_Msg); -> +~~~~~ + +7. Converts C-style casts applied to Handles to calls to DownCast() method: +~~~~~ + ((Handle(A)&)b) -> Handle(A)::DownCast(b) + (Handle(A)&)b -> Handle(A)::DownCast(b) + (*((Handle(A)*)&b)) -> Handle(A)::DownCast(b) + *((Handle(A)*)&b) -> Handle(A)::DownCast(b) + (*(Handle(A)*)&b) -> Handle(A)::DownCast(b) +~~~~~ + +8. Moves Handle() macro out of namespace scope: +~~~~~ +Namespace::Handle(Class) -> Handle(Namespace::Class) +~~~~~ + +9. Converts local variables of reference type initialized by temporary object returned by call to DownCast(), to non-references (to avoid using reference to destroyed memory): +~~~~~ + const Handle(A)& a = Handle(B)::DownCast (b); -> Handle(A) a (Handle(B)::DownCast (b)); +~~~~~ + +10. Adds \#include for all classes used as argument to macro STANDARD_TYPE(), except of already included ones; + +11. Removes uses of obsolete macros IMPLEMENT_DOWNCAST() and IMPLEMENT_STANDARD_*(). + + > If you plan to keep compatibility of your code with older versions of OCCT, add option "-compat" to avoid the latter change. See also @ref upgrade_occt700_cdl_compat. + +As long as the upgrade routine runs, some information messages are sent to the standard output. +In some cases the warnings or errors like the following may appear: + +~~~~~ + Error in {HEADER_FILE}: Macro DEFINE_STANDARD_RTTI used for class {CLASS_NAME} whose declaration is not found in this file, cannot fix +~~~~~ + +Be sure to check carefully all reported errors and warnings, as corresponding places likely will require manual corrections. +In some cases these messages may help you to detect errors in your code, for instance, cases where DEFINE_STANDARD_RTTI macro passes invalid class name as an argument. + +@subsubsection upgrade_occt700_cdl_compiler Possible compiler errors + +Some situations requiring upgrade cannot be detected and / or handled by automatic procedure. +If you get compiler errors or warnings when trying to build upgraded code, you will need to fix them manually. +The following paragraphs list known situations of this kind. + +#### Missing header files + +Use of handle objects (construction, comparison using operators == or !=, use of function STANDRAD_TYPE() and method DownCast()) now requires the type of the object pointed by Handle to be completely known at compile time. Thus it may be necessary to include header of the corresponding class to make the code compilable. + +For example, the following lines will fail to compile if Geom_Line.hxx is not included: + +~~~~~ +Handle(Geom_Line) aLine = 0; +if (aLine != aCurve) {...} +if (aCurve->IsKind(STANDARD_TYPE(Geom_Line)) {...} +aLine = Handle(Geom_Line)::DownCast (aCurve); +~~~~~ + +Note that it is not necessary to include header of the class to declare Handle to it. +However, if you define a class *B* that uses Handle(*A*) in its fields, or contains a method returning Handle(*A*), it is advisable to have header defining *A* included in the header of *B*. +This will eliminate the need to include the header *A* in each source file where class *B* is used. + +#### Ambiguity of calls to overloaded functions + +This issue appears in compilers that do not support default arguments in template functions (known cases are Visual C++ 10 and 11): compiler reports ambiguity error if handle is used in argument of call to function that has two or move overloaded versions, accepting handles to different types. +The problem is that operator const handle& is defined for any type T2, thus compiler cannot make a right choice. + +Example: +~~~~~ +void func (const Handle(Geom_Curve)&); +void func (const Handle(Geom_Surface)&); + +Handle(Geom_TrimmedCurve) aCurve = new Geom_TrimmedCurve (...); +func (aCurve); // ambiguity error in VC++ 10 +~~~~~ + +To resolve this ambiguity, change your code so that argument type corresponds exactly to the function signature. +In some cases this can be done by using relevant type for the corresponding variable, like in the example above: + +~~~~~ +Handle(Geom_Curve) aCurve = new Geom_TrimmedCurve (...); +~~~~~ + +Other variants are assigning the argument to local variable of correct type, using direct cast or constructor: + +~~~~~ +const Handle(Geom_Curve)& aGCurve (aTrimmedCurve); +func (aGCurve); // OK - argument has exact type +func (static_cast(aCurve)); // OK - direct cast +func (Handle(Geom_Curve)(aCurve)); // OK - temporary handle is constructed +~~~~~ + +Another possibility is defining additional templated variant of the overloaded function causing ambiguity, and use SFINAE to resolve the ambiguity. +For example of this technique, see definition of the template variant of the method IGESData_IGESWriter::Send(). + +#### Lack of implicit cast to base type + +Due to the fact that now cast of handle to reference to handle to the base type is user-defined operation, conversions that require this cast combined with other user-defined cast will not be resolved automatically by compiler. + +For example: + +~~~~~ +Handle(Geom_Geometry) aC = GC_MakeLine (p, v); // compiler error +~~~~~ + +The problem here is that class GCE2d_MakeSegment has user-defined conversion to const Handle(Geom_TrimmedCurve)&, which is not the same as type of the local variable aC. + +To resolve this, use method Value(): + +~~~~~ +Handle(Geom_Geometry) aC = GC_MakeLine (p, v).Value(); // ok +~~~~~ + +or use variable of appropriate type: + +~~~~~ +Handle(Geom_TrimmedCurve) aC = GC_MakeLine (p, v); // ok +~~~~~ + +#### Incorrect use of STANDARD_TYPE and Handle macros + +You might need to clean your code from incorrect use of macros *STANDARD_TYPE*() and *Handle*(). + +1. Explicit definitions of static functions with names generated by macro STANDARD_TYPE(), which are artifacts of old implementation of RTTI, should be removed. + + Example: +~~~~~ +const Handle(Standard_Type)& STANDARD_TYPE(math_GlobOptMin) +{ + static Handle(Standard_Type) _atype = new Standard_Type ("math_GlobOptMin", sizeof (math_GlobOptMin)); + return _atype; +} +~~~~~ + +2. Incorrect location of closing parenthesis of Handle() macro that was not detectable in OCCT 6.x will cause compiler error and must be corrected. + + Example (note misplaced closing parenthesis): +~~~~~ +aBSpline = Handle( Geom2d_BSplineCurve::DownCast(BS->Copy()) ); +~~~~~ + +#### Use of class Standard_AncestorIterator + +Class Standard_AncestorIterator has been removed; use method Parent() of Standard_Type class to parse inheritance chain. + +#### Absence of cast to Standard_Transient* + +Handles in OCCT 7.0 do not have operator of conversion to Standard_Transient*, which was present in earlier versions. +This is done to prevent possible unintended errors like this: + +~~~~~ +Handle(Geom_Line) aLine = ...; +Handle(Geom_Surface) aSurf = ...; +... +if (aLine == aSurf) {...} // will cause compiler error in OCCT 7.0, but not OCCT 6.x +~~~~~ + +Places where this implicit cast has been used should be corrected manually. +The typical situation is when Handle is passed to stream: + +~~~~~ +Handle(Geom_Line) aLine = ...; +os << aLine; // in OCCT 6.9.0, resolves to operator << (void*) +~~~~~ + +Call method get() explicitly to output address of the Handle. + +@subsubsection upgrade_occt700_cdl_runtime Possible runtime problems + +Known situations when problems are possible at run time after upgrade to OCCT 7.0 are listed here. + +#### References to temporary objects + +In previous versions, compiler was able to detect situation when local variable of reference type to Handle is initialized by temporary object, and ensured that lifetime of that object is longer than that of the variable. +Since OCCT 7.0, it will not work if types of the temporary object and variable are different (due to involvement of user-defined type cast), thus such temporary object will be destroyed immediately. + +Example: + +~~~~~ +// note that DownCast() returns new temporary object! +const Handle(Geom_BoundedCurve)& aBC = +Handle(Geom_TrimmedCurve)::DownCast(aCurve); +aBC->Transform (T); // access violation in OCCT 7.0 +~~~~~ + +@subsubsection upgrade_occt700_cdl_compat Preserving compatibility with OCCT 6.x + +If you like to preserve compatibility of your application code with OCCT versions 6.x even after upgrade to 7.0, consider the following suggestions: + +1. When running automatic upgrade tool, add option *-compat*. + +2. In order to overcome incompatibility of macro DEFINE_STANDARD_RTTI which has additional argument in OCCT 7.0, you can replace (after upgrade) its use in your code by your own version-dependent macro, which resolves to either 6.x or 7.x version. + + Example: +~~~~~ +#if OCC_VERSION_HEX < 0x070000 + #define DEFINE_STANDARD_RTTI_COMPAT(C1,C2) DEFINE_STANDARD_RTTI(C1) +#else + #define DEFINE_STANDARD_RTTI_COMPAT(C1,C2) DEFINE_STANDARD_RTTI(C1,C2) +#endif +~~~~~ + +@subsubsection upgrade_occt700_cdl_wok Applications based on CDL and WOK + +If you have application essentially based on CDL, and need to upgrade it to OCCT 7.0, you will very likely need to convert your application code to non-CDL form. +This is non-trivial effort; the required actions would depend strongly on the structure of the code and used features of CDL. + +The upgrade script and sources of specialized version of WOK used for upgrading OCCT code can be found in WOK Git repository in branch [CR0_700_2](http://git.dev.opencascade.org/gitweb/?p=occt-wok.git;a=log;h=refs/heads/CR0_700_2). + +[Contact us](http://www.opencascade.com/contact/) if you need more help. + +@subsection upgrade_occt700_bspline Separation of BSpline cache + +Implementation of NURBS curves and surfaces has been revised: cache of polynomial coefficients, used to accelerate calculate values of B-spline, is separated from data objects (Geom2d_BSplineCurve, Geom_BSplineCurve, Geom_BSplineSurface), into dedicated classes (BSplCLib_Cache and BSplSLib_Cache). + +The benefits of this change are: + +* Reduced memory footprint of OCCT shapes (up to 20% on some cases) +* Possibility to evaluate the same B-Spline concurrently in parallel threads without data races and mutex locks + +The drawback is that direct evaluation of B-Splines using methods of curves and surfaces becomes slower, due to absence of cache. The way to avoid slow down is to use adaptor classes (Geom2dAdaptor_Curve, GeomAdaptor_Curve and GeomAdaptor_Surface): they now use cache when the curve or surface is a B-spline. + +OCCT algorithms are changed to use adaptors for B-spline calculations instead of direct methods of curves and surfaces. +The same changes (use of adaptors instead of direct call to curve and surface methods) should be implemented in relevant places in applications based on OCCT in order to get maximum performance. + +@subsection upgrade_occt700_sorttools Removal of SortTools package + +Package SortTools has been removed. +The code that used the tools provided by that package should be corrected manually. +The recommended approach is to use sorting algorithms provided by STL. + +For instance: +~~~~~ +#include +#include +#include +... +TCollection_Array1OfReal aValues = ...; +... +TCollection_CompareOfReal aCompReal; +SortTools_StraightInsertionSortOfReal::Sort(aValues, aCompReal); +~~~~~ +can be replaced by: +~~~~~ +#include +... +TCollection_Array1OfReal aValues = ...; +... +std::stable_sort (aValues->begin(), aValues->end()); +~~~~~ + diff --git a/dox/dev_guides/wok/images/wok_image005.jpg b/dox/dev_guides/wok/images/wok_image005.jpg deleted file mode 100644 index d5f92d44bd..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image005.jpg and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image005.png b/dox/dev_guides/wok/images/wok_image005.png deleted file mode 100644 index f0937f8ed6..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image005.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image006.png b/dox/dev_guides/wok/images/wok_image006.png deleted file mode 100644 index 29a28432e0..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image006.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image007.png b/dox/dev_guides/wok/images/wok_image007.png deleted file mode 100644 index 3cd21fcf03..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image007.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image008.png b/dox/dev_guides/wok/images/wok_image008.png deleted file mode 100644 index 7df90f6c8e..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image008.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image009.png b/dox/dev_guides/wok/images/wok_image009.png deleted file mode 100644 index 5ede9e433f..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image009.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image010.png b/dox/dev_guides/wok/images/wok_image010.png deleted file mode 100644 index a4fcaa0495..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image010.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image011.png b/dox/dev_guides/wok/images/wok_image011.png deleted file mode 100644 index 172cafd8bd..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image011.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image012.png b/dox/dev_guides/wok/images/wok_image012.png deleted file mode 100644 index 241f534789..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image012.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image013.png b/dox/dev_guides/wok/images/wok_image013.png deleted file mode 100644 index af43ae416d..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image013.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image014.png b/dox/dev_guides/wok/images/wok_image014.png deleted file mode 100644 index 30bb297d2d..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image014.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image015.png b/dox/dev_guides/wok/images/wok_image015.png deleted file mode 100644 index f5e58c16b8..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image015.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image016.png b/dox/dev_guides/wok/images/wok_image016.png deleted file mode 100644 index bc68e2927e..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image016.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image017.png b/dox/dev_guides/wok/images/wok_image017.png deleted file mode 100644 index 47e1ed5dfd..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image017.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image018.png b/dox/dev_guides/wok/images/wok_image018.png deleted file mode 100644 index 57a221ddb4..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image018.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image019.png b/dox/dev_guides/wok/images/wok_image019.png deleted file mode 100644 index fa39eff4b0..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image019.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image020.png b/dox/dev_guides/wok/images/wok_image020.png deleted file mode 100644 index 3540fdce4c..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image020.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image021.png b/dox/dev_guides/wok/images/wok_image021.png deleted file mode 100644 index 795e2e2e85..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image021.png and /dev/null differ diff --git a/dox/dev_guides/wok/images/wok_image022.png b/dox/dev_guides/wok/images/wok_image022.png deleted file mode 100644 index 0dad63cc0f..0000000000 Binary files a/dox/dev_guides/wok/images/wok_image022.png and /dev/null differ diff --git a/dox/dev_guides/wok/wok.md b/dox/dev_guides/wok/wok.md deleted file mode 100644 index d680815602..0000000000 --- a/dox/dev_guides/wok/wok.md +++ /dev/null @@ -1,3277 +0,0 @@ -Workshop Organisation Kit {#occt_dev_guides__wok} -========================= - -@tableofcontents - -@section occt_wok_0 DEPRECATION WARNING - -Please note that this document describes use of WOK as comprehensive build system. This use is outdated, and WOK is to be removed in one of the future OCCT releases. - -Currently only a small subset of WOK capabilities described in this document -is actually necessary for building OCCT. See @ref occt_dev_guides__building_wok -for a more practical guide. - -@section occt_wok_1_ Introduction Glossary - -@subsection occt_wok_1_1 About the Development Environment - -Open CASCADE Technology (**OCCT**) development environment is able to accommodate large numbers of developers working on a variety of products. Within this environment developers can produce multiple versions of products for various hardware and software platforms, including versions corresponding to particular marketing requirements. At the same time, OCCT development environment enables the maximum possible reuse of software components. In other words, OCCT development environment is designed to facilitate industrial scale development. -@subsection occt_wok_1_2 Brief Overview of Open CASCADE Technology Development Environment -The following diagram shows OPEN CASCADE tools and resources, the development method, and the architecture of applications that you can develop with Open CASCADE Technology. - -@image html /dev_guides/wok/images/wok_image005.png "Schematic View of OCCT Development Platform" -@image latex /dev_guides/wok/images/wok_image005.png "Schematic View of OCCT Development Platform" - -The application developer goes about creating his application by editing his source code and producing the final application using a set of intelligent construction tools. These tools are available within a structured development environment called the **software factory**. - -The developer defines new software components in CDL, Component Description Language, and uses a CDL compiler to derive their C++ implementations. These components are then compiled into packages. -@subsection occt_wok_1_3 WOK Components -@subsubsection occt_wok_1_3_1 Entities -The WOK environment is made up of entities, for example software factories and development units. A full list of WOK entities is provided in the Glossary section. -@subsubsection occt_wok_1_3_2 Files -WOK manages two different types of files: user source files and WOK administration files. To support this, each entity has a home directory, which contains its administration directory. This is called *adm* and stores the administration files that WOK needs. In addition development units have a source directory called *src*, which contains both .cdl and .cxx source files, and a header file directory called *inc*, which contains .hxx files. - -@subsection occt_wok_1_4 Glossary -@subsubsection occt_wok_1_4_1 Development Units -A **development unit** is the smallest unit that can be subject to basic development operations such as modifying, compiling, linking and building. -The following list contains all types of development units. The letter in parentheses indicates the letter key by commands such as *ucreate* and *umake*. In the rest of the manual, this letter key is referred to as the *short key*. -* package (p) A set of related classes and methods along with their CDL definitions. -* schema (s) A set of persistent data types. -* executable (x) An executable is used for unit and integration test purposes. It is based on one or more packages. -* nocdlpack (n) A package without a CDL definition. Used for low-level programming or for incorporating foreign resources. -* interface (i) A specific set of services available for wrapping (an interface contains packages, classes, and methods). -* jni (j) A development unit used to wrap C++ classes to Java. It is based on one or more interfaces. -* toolkit (t) A set of packages. Useful in grouping packages together when there is a large number of packages based around a particular subject. -* delivery (d) A development unit for publishing development units. -* resource (r) A development unit containing miscellaneous files. - -@subsubsection occt_wok_1_4_2 Workbenches -A workbench is a specialized directory structure where the user creates, modifies, and uses development units. A workbench is likely to be the personal property of one user or at most a small team of developers. -@image html /dev_guides/wok/images/wok_image006.png "Schema of a Workbench Containing three Development Units" -@image latex /dev_guides/wok/images/wok_image006.png "Schema of a Workbench Containing three Development Units" - -@subsubsection occt_wok_1_4_3 Workshops -A workshop is a tree of workbenches. It provides the development team with an independent workspace inside which the complete cycle of software production can be carried out. -The root workbench is in a valid state and contains the working versions of the development units. -Development units in a root workbench are visible in its child workbenches. - -For example, the schema below shows a workshop containing three workbenches. Workbenches B and C are the children of workbench A. Development units in A are visible in both B and C -@image html /dev_guides/wok/images/wok_image007.png "Workbenches" -@image latex /dev_guides/wok/images/wok_image007.png "Workbenches" - -Workshops are fully independent of each other. They are organized in such a way that development units can be grouped into a delivery and placed in a warehouse. Communication between workshops is carried out by means of these deliveries. A warehouse belongs to a factory and is visible from all workshops in that factory. In this way, development units can be shared between a group of development teams. - -@image html /dev_guides/wok/images/wok_image008.png "Two Workshops Delivering and Borrowing Parcels" -@image latex /dev_guides/wok/images/wok_image008.png "Two Workshops Delivering and Borrowing Parcels" - -@subsubsection occt_wok_1_4_4 Factories -A factory is a set of workshops and their corresponding warehouse. There is a single warehouse in any factory. The continuous upgrading and improvement of a product is carried out in a specific factory. -To create a new version of an application within the factory, you establish a new workshop dedicated to creation and support of the new version. - -@image html /dev_guides/wok/images/wok_image009.png "Factory Contains Workshops and Warehouse" -@image latex /dev_guides/wok/images/wok_image009.png "Factory Contains Workshops and Warehouse" - -@section occt_wok_2_ Elements of the Platform -@subsection occt_wok_2_1 Development Units -A **development unit** is the basic element of WOK development. It includes the following three entities: - * A directory structure (a minor component) - * Source files, also called primary files - * The result of the build process (compilation, etc.), also called derived files. - -@subsubsection occt_wok_2_1_1 Directory Structure of a Development Unit -The directory structure of a development unit consists of a tree of directories, which are created when the development unit is initialized. Refer to the Workbenches section for further details on the workbench structure. -@subsubsection occt_wok_2_1_2 Files in a Development Unit - -#### Source Files - -Source files are written by the developer in the source section (the *src* directory) of the development unit. -Each development unit maintains the description of its own source files, and this description is stored in one or more files within the *src* directory. The details of how the description is stored vary according to development unit type as shown below: -* package (p) The names of all source files are worked out from the CDL description, following the conventions described in the *C++ Programming Guide*. This list of files can be supplemented by additional files listed in the file called FILES. This file must be stored in the unit’s src directory. Whenever header files are included in the *src* directory of a development unit, they must be specified in FILES so that the C++ preprocessor will take them into account. This reduces compilation time by 10 to 40 percent. -* schema (s) No description of the source files is needed. There is a single source file: *schema.cdl*. -* executable (x) The names of all source files are worked out from the CDL description. The format of this file is described in the Building an Executable section. -* nocdlpack (n) The list of source files is contained in the FILES file stored in the unit’s src directory. -interface (i). No description of the source files is needed. There is a single source file: *interface.cdl*. -* jni (j). No description of the source files is needed. There is a single source file: *jni.cdl*. -* toolkit (t) The description is given by the file called PACKAGES which is stored in the unit’s src directory. FILES must also exist in this directory, and must include PACKAGES in its list of files. -* delivery (d) The description is given by two files stored in the unit’s src directory: FILES and a file called COMPONENTS. FILES must include COMPONENTS in its list of files. -* resource (r) A resource unit is used in a delivery. FILES contains a list of the unit’s files, one per line in the following format: *atype\:\:\:afilename* Here, *filename* is the name of a file, which the compiler will look for in the src directory of the unit, and *atype* is a WOK type. To display a list of all available WOK types, use the command: *wokinfo -T*. - -#### Derived files - -Derived files created by compilation are automatically placed in the derived section of the development unit. These may be executable files or archives of compilation results. - -@subsubsection occt_wok_2_1_3 Package - -A package is a development unit that defines a set of classes, which share a number of common features such as similar data structure or a set of complementary algorithmic services. Packages help to manage creation and the use of large hierarchies of software components. -To create a package, you write a .cdl file describing it in the src directory of the package development unit. The description includes classes and global methods, which comprise it. Each class is also described in a separate .cdl file. The package .cdl file also lists the packages used in the specification of its classes and methods. -C++ implementation files are also stored in the src subdirectory of the package development unit. These implementation files are: - * .cxx for an ordinary class - * .lxx for any inline methods - * .pxx for any private declarations - * .gxx for a generic class - -To create the Development Unit structure for a package use the following syntax: -~~~~~ -ucreate –p MyPackage -~~~~~ - -The package description has the following CDL syntax: -~~~~~ -package PackageName -[uses AnotherPackage {‘,’ YetAnotherPackage}] -is -[{type-declaration}] -[{package-method}] -end [PackageName]’:’ -~~~~~ - -For example: -~~~~~ -package CycleModel -uses -Pcollection -Tcollection -BREpPrimAPI -TopExp -Geom -Pgeom -is -deferred class Element; -class Wheel; -class Frame; -class LocalReference; -Adjust(awheel: wheel from CycleModel; -  aframe: Frame from CycleModel); -end CycleModel; -~~~~~ -For full details on the CDL syntax, refer to the *CDL User’s Guide*. - -@subsubsection occt_wok_2_1_4 Schema - -A schema is a development unit that defines the set of all data types, which your application is likely to need in order to read and write files. Such data types are **persistent**. - -To create a schema, write a .cdl file that lists all the packages, which contain all persistent data types used by the application. Note that only persistent classes are taken into account during compilation; transient classes are ignored. - -Note that you don’t have to put dependencies in all packages and classes. You only have to write the highest level dependencies. In other words, the *uses* keyword in the schema file allows you to list packages. Any package similarly listed in the package files for these packages are also incorporated into the schema. - -To create the Development Unit structure for a schema use the syntax below: -~~~~~ -ucreate –s MySchema -~~~~~ - -The schema description has the following CDL syntax : - -~~~~~ -schema SchemaName -is -ListOfPackagesContainingPersistentClasses; -ListOfPersistentClasses; -end; -~~~~~ - -For example: -~~~~~ -schema MyCycleSchema -is -class Wheel from package CycleModel; -class Frame from package CycleModel; -.. -class Spanner from package CycleTools; -end; -~~~~~ -For full details on the CDL syntax, refer to the *CDL User’s Guide*. - -@subsubsection occt_wok_2_1_5 Executable -The purpose of an executable is to make executable programs. The executable can use services from one or more packages and is described in a .cdl file as a set of packages. - -To create an executable, you write one or more MyExe.cxx files in the src subdirectory of the unit. This file will contain the main function. Then it is possible to compile the executable. - -To create the Development Unit structure for an executable, use the syntax below: -~~~~~ -ucreate –x MyExec -~~~~~ - -The executable description has the following CDL syntax: -~~~~~ -executable ExecName -is -executable BinaryFile -uses -LibFile as external -is -C++File; -end; -end; -~~~~~ - -For example: -~~~~~ -executable MyExecUnit’ -is -executable myexec -uses -Tcl_Lib as external -is -myexec; -end; -executable myex2 -is -myex2; -end; -end; -~~~~~ -For full details on the CDL syntax, refer to the *CDL Reference Manual*. - -@subsubsection occt_wok_2_1_6 Toolkit -A toolkit is a development unit that groups a set of packages to create a shareable library. An example of a toolkit is the ModelingData module. Toolkits serve for the following purposes: - * Linking of large numbers of packages - * Faster loading of executable files that use toolkits such as test files. - -A toolkit has no CDL definition. Creating a toolkit involves writing a PACKAGES file in the src subdirectory of its development unit. This file lists all the packages needed in the toolkit. You then create a definition of this file to the FILES. - -You then compile the toolkit to create a shareable library. - -@subsubsection occt_wok_2_1_7 Nocdlpack -A nocdlpack is a development unit that has no CDL definition. It is compiled directly from source files written in C, C++, Fortran, or in sources to be treated by the lex or yacc tools. A nocdlpack is useful when you write a low-level interface with another product, for example, a network application. - -To define a nocdlpack, you create a file called FILES in the src subdirectory of the nocdlpack development unit. In this file, you list the Fortran, C, C++, lex, and yacc files that compose the pack. You list the files one per line. - -On compilation, the result is a shareable library. - -@subsubsection occt_wok_2_1_8 Interface -An interface is a development unit that defines a set of services available for wrapping into Java. -An interface is defined in a .cdl file as a list of packages, package methods, classes, and methods. It makes these available to a jni unit. - -To create the Development Unit structure for an interface, use the syntax below: -~~~~~ -ucreate -i MyInterface -~~~~~ - -The interface description has the following CDL syntax: - -~~~~~ -interface InterfaceName -is -ListOfPackages -ListOfClasses -ListOfMethods -end; -~~~~~ - -For example: -~~~~~ -interface MyInterface -is -        package TopoDS; -        class Shape from ShapeFix; -end ; -~~~~~ - -@subsubsection occt_wok_2_1_9 Jni -A jni is a development unit that wraps declared services into Java using JNI (Java Native Interface). - -A jni creates Java classes that are used as C++ counterparts when developing in Java. - -To create the Development Unit structure for an Jni, use the syntax below: -ucreate -j MyJni - -The interface description has the following CDL syntax: -~~~~~ -client JniName -is -{interface InterfaceName;} -end; -~~~~~ - -For example : -~~~~~ -client MyJni -is -        interface MyInterface; -        interface MyAnotherInterface; -end ; -~~~~~ - -@subsubsection occt_wok_2_1_10 Delivering Parcels -The delivery process allows creating parcels. These parcels group together the development work done within a given workshop. You can ship these parcels to other workshops called client workshops. - -A delivery is autonomous. Once the delivery development unit is compiled, a parcel is stored in the factory warehouse and has no more connection with the workshop where it was created. A parcel has its own directory structure. - -All Open CASCADE Technology resources are seen as parcels. - -@image html /dev_guides/wok/images/wok_image010.png "Parcels" -@image latex /dev_guides/wok/images/wok_image010.png "Parcels" - -You create a delivery unit under a specified workbench. - -You are **strongly advised** to create delivery units under the *root* workbench of the workshop. Child workbenches could be deleted in the future, whereas the root workbench is likely to remain untouched. In other words, you safeguard the delivery by creating it in the root workbench. - -**Note** If you do not specify a workbench when you make a delivery, it is created under the current workbench. - -@subsection occt_wok_2_2 Workbenches -A workbench is generally the place where one particular developer or a team of developers works on a particular development. A workbench is composed of a public part and a private part. - -@subsubsection occt_wok_2_2_1 Roots -The following roots are used in the structure of a workbench: -* **Home** Workbench root containing various administration files of the workbench. -* **Src** Root of the workbench sources, which facilitates the integration into WOK of version management software such as CVS. -* **DBMS** Root of the derived files dependent on the extraction profile (.hxx, _0.cxx files, etc.). -* **DBMS_Station** Roots of the derived files dependent on the extraction profile and on the platform (.o, .so files, etc.). - -Roots are defined for each profile and platform supported by the workbench. For example, a workbench supporting the DFLT profile on Sun and SGI platforms has the following roots: -* **Home** Workbench root, -* **Src** Root of the source files, -* **DFLT** Root of the derived files, -* **DFLT_sun** Root of the files built on Sun platforms, -* **DFLT_sil** Root of the files built on SGI platforms, - -For a workbench additionally supporting *ObjectStore*, the following additional roots are also found: *OBJS, OBJS_sun, OBJS_sil*. - -These roots are defined in the workbench definition file *MyWorkbench.edl* as the parameter \%MyWorkbench_RootName. - -**Note** that default values help to define various roots. - -@subsubsection occt_wok_2_2_2 Directories -Under each root, a hierarchy of directories allows to store various files. -* Under the Home root are found: - * *work*, the private workbench directory reserved for the developer - * *Adm*, the directory reserved for administration files. -* Src contains: - * *src/MyUD*, the directory containing the source files of the development unit MyUD. -* DBMS contains: - * *inc*, containing the public header files of the workbench UDs - * *drv/MyUD*, containing the private extracted files of MyUD - * *drv/MyUD/.adm*, containing the administration files dependent on the extraction profile - * *drv/MyUD/.tmp*, containing the temporary files dependent on the extraction profile. -* DBMS_Station contains: - * *\/lib* with all the libraries produced in the workbench - * *\/bin* with all the binaries produced in the workbench - * *\/MyUD* with all the station dependent files which are private to the development unit such as objects - * *\/MyUD/.adm* with all the station dependent administration files - * *\/MyUD/.tmp* with all the temporary files constructed in the development unit. - - -@image html /dev_guides/wok/images/wok_image011.png "Structure of the workbench Mywb" -@image latex /dev_guides/wok/images/wok_image011.png "Structure of the workbench Mywb" - -@subsection occt_wok_2_2_3 Workshops -A **workshop** is an independent workspace inside which the complete cycle of software production is carried out. Workbenches inside a workshop are organized so that development units can be shared either by being published in a father workbench or by being placed in reference in the root workbench. - -@image html /dev_guides/wok/images/wok_image012.png "Visibility between Workbenches in a Workshop" -@image latex /dev_guides/wok/images/wok_image012.png "Visibility between Workbenches in a Workshop" - -In this image: - * **A** is the development unit A from Grandchild 11 placed in reference in root. It is visible throughout the workshop. - * **B** is the development unit B from Grandchild 12 published in ancestor Child 1. It is visible to Child 1, Grandchild 11 and Grandchild 12. - - -In a large-scale development that involves one or more teams of developers, you should decide how you are going to structure a workshop right at the beginning. If need be, you can review your decision later. - -An existing workshop can be duplicated and the original workshop can be used as the basis for maintaining the present version of a product. The new workshop can then be used to develop and maintain a new version of the product. - -When creating a new workshop, you specify - in the form of parcels – which resources are to be available within the workshop. - -@subsection occt_wok_2_2_4 Factories -A factory contains a number of workshops and a warehouse. When Open CASCADE Technology is installed, the system administrator creates a single factory. This contains a single workshop as well as the warehouse containing OCCT resources in the form of parcels. - -There is no theoretical limit to the number of workshops that can be added to a factory. However, a single factory should be enough. - -@section occt_wok_3 Development Process -@subsection occt_wok_3_1 WOK Environment -The WOK interface is based on tcl, a command language provided by the Regents of the University of California and Sun Microsystems, Inc. The WOK development environment is in fact a tcl session. - - -Before you run a tcl session you must make sure that your account is configured for using tcl, see the Configuring Your Account for Tcl and WOK section. - -To start a tcl session use the command: -~~~~~ -% tclsh -~~~~~ -Within this session, all WOK commands are available as well as standard tcl commands. You can also use tcl language extensions, if these are installed. -To exit from a tcl session use the command: -~~~~~ -> exit -~~~~~ -Online help is provided with tcl. To access this, use the following command: -~~~~~ -% tclhelp -~~~~~ -Online help is also available for all WOK commands. To display help on a particular WOK command, give the command name followed by the -h flag, as in the following example: -~~~~~ -> wokcd -h -~~~~~ - -@subsection occt_wok_3_2 Steps -Implementation of an application is based on the following steps: -1. Enter the software factory using the command wokcd MyFactory -2. Enter a workshop using the command wokcd MyWorkshop -3. Open a workbench using the command wokcd MyWorkbench -4. Search for the data types required among the existing OCCT libraries -5. Define one or more packages which will contain the classes -6. Define new data types as classes -7. Implement the methods of those classes in C++ -8. Implement any package methods in C++ -9. Unite the test packages -10. Define any nocdlpacks (if any) -11. Test the components - -**Note:** Steps 1-3 can be performed with a single WOK command: -~~~~~ -> wokcd MyFactory:MyWorkshop:MyWorkbench -~~~~~ - -@subsection occt_wok_3_3 Getting Started -@subsubsection occt_wok_3_3_1 Entity Names -Before you start, the following restrictions on WOK entity names must be noted: - * Entity names may only contain alphanumeric characters and dashes. - * Entity names must be unique within a hierarchy. For example, you must not have two workbenches called MyBench in the same Workshop. Likewise, you may not have a workshop called CSF in a factory of the same name. - * Do not use upper and lower case characters to distinguish between two entity names, for example ENT1 and eNt1. This restriction is for reasons of portability. - * Parcel names must be unique. - -@subsubsection occt_wok_3_3_2 Entering the Factory -When you start work you go to the factory using the following command: -~~~~~ -> wokcd -~~~~~ -@subsubsection occt_wok_3_3_3 Creating a New Workshop -If you don’t want to work in a workshop already present in the factory, you can create a new one. To do this, use the following command: -~~~~~ -> screate –d -~~~~~ -This creates the new workshop **MyWorkshop** in the current factory. To create the same workshop in a different factory use the syntax below: -~~~~~ -> screate –d -~~~~~ - -When you create a new workshop, it is empty. - -@subsubsection occt_wok_3_3_4 Selecting Parcels -When you create a workshop, you select existing OCCT resources, for example, parcels, to use in it. To do this, you create the workshop and add the parcels using the following syntax: -~~~~~ -> screate –d -DparcelConfig=Parcel1,Parcel2… -~~~~~ -To display available OCCT resources, in other words, to see what parcels are available, you use the following command: -~~~~~ -Winfo –p -~~~~~ -**Note:** parcel configuration rarely needs to change. If it does, only the workshop administrator should make them. -@subsubsection occt_wok_3_3_5 Opening a Workshop -To open a workshop, you use the following command: -~~~~~ -> wokcd -~~~~~ -@subsubsection occt_wok_3_3_6 Creating a New Workbench -When you create a new workshop, it is empty. In other words, it does not contain any workbenches. -To create the root workbench of a new workshop, you use the following command: -~~~~~ -> wcreate -d -~~~~~ -This creates a tree of workbench subdirectories. -If workbenches already exist in your workshop, but you do not want to work in any of these, create a new workbench as a child of an existing one. You do this using the following syntax: -~~~~~ -> wcreate –d -f -~~~~~ -@subsubsection occt_wok_3_3_7 Opening a Workbench -To open a workbench, you use the command below: -~~~~~ -> wokcd -~~~~~ -This automatically takes you to the root directory of the workbench - -@subsubsection occt_wok_3_3_8 Using Existing Resources -Before creating new data types, you should look for existing components that you can reuse. In particular, you should look through the existing resources of your Open CASCADE Technology platform to see if any of the required components already exist, or if any existing generic components can be suitably implemented. This search can be conducted using the online documentation. You should note the packages and classes, which you can reuse. - -@subsection occt_wok_3_4 Creating Software Components - -@subsubsection occt_wok_3_4_1 Creating a Package - -To develop new software components, you usually need to create one or more packages. You do this, by using the following command: -~~~~~ -> ucreate –p -~~~~~ -Because the key -p defines the default value for the *ucreate* command, you do not need to specify it. The following syntax, for example, will also create a package: -~~~~~ - > ucreate -~~~~~ -#### Enter a Package or other Development Unit Structure - -Enter the package or any other development unit structure using the *wokcd* command as in the syntax below: -~~~~~ -> wokcd MyPackage -~~~~~ -The current directory is now: -~~~~~ -MyWorkbenchRoot/src/MyPackage -~~~~~ - -#### Writing the Package and Class Specifications in CDL - -Write the descriptions of the software components in CDL using an editor of your choice. Write each class in its own .cdl file and write one .cdl file (MyPackage.cdl) to specify the package that contains those classes. - -#### CDL Compilation of the Package - -Compile and check the package and its classes using: -~~~~~ - > umake –e xcpp -~~~~~ -This command also extracts the C++ header files (.hxx) and stores them in the derived files directory. - -#### Implementing Methods in C++ - -A package will contain methods, which may be: - * Instance methods - * Class methods - * Package methods. -Extract **prototypes** for the C++ methods using the following command: -~~~~~ - > umake -o xcpp.fill -o xcpp.template -~~~~~ - -You should not confuse this syntax with the template feature of C++ used to implement the genericity. -The *umake -o xcpp.template* command creates a skeleton C++ file for: - * Each class - * All the package methods. -The packages methods will be created in a file called *package.cxx.template*. This command is not included in the umbrella command *MyPackage*. -You will need to use an editor to implement these methods in C++. - - -#### Compiling the Package - -To compile the package, use the command: -~~~~~ - > umake -o obj -~~~~~ -If you do not specify a package, the current development unit is compiled. - -#### Sample Construction of a Package - -In the following example a workbench named **MyWb** is created as a child of an existing workbench **Topo**. MyWb is used for working on the package **MyPack**. Commands preceded by an asterisk below are used only once per session: -1. Create the MyWb workbench as a child of Topo. -~~~~~ - > wcreate MyWb -f Topo -d -~~~~~ -2. Create MyPack in MyWb. -~~~~~ - > ucreate MyPack     -~~~~~ -3. Move to the source directory of MyPack. -~~~~~ - > wokcd MyPack -~~~~~ -4. Edit the source files (MyPack.cdl etc.). You do this outside tcl, using the editor of your choice. -5. Start the extraction of MyPack. -~~~~~ -  > umake -e xcpp -~~~~~ -6. Generate the .cxx templates for MyPack: MyPack.cxx.template -~~~~~ -   > umake -o xcpp.fill -o xcpp.template -t -~~~~~ -7. Edit the source files (MyPack.cxx etc). You do this outside tcl, using the editor of your choice. - -**Note** that *umake* command used without arguments will carry out all the above *umake* steps. You can also use it with specific arguments as above to go through the development process step by step. - -#### Package Files - -* Primary Files for a Package - + \.cdl Primary package file. - + \_\.cdl Primary class file. -* C++ Files for a Package - + \.cxx Primary package source file. - + \_[1..9[0..9]*].cxx Secondary package source files. - + \.lxx Inline package methods source file. - + \.pxx Private instructions source file. -* C++ Files for a Class - + \_\.cxx Primary class source file. - + \_\_[1..9[0..9]*].cxx -* Secondary class source files. - + \_\.gxx Generic class methods source file. This is an alternative to the .cxx file(s), you do not have both. - + \_\.lxx Inline methods source file. - + \_\.pxx Private instructions source file. -* Derived C++ Files for a Package - + \.hxx User header file. - + \.ixx User header file included in \.cxx. - + \.jxx User header file included in \_[1-9].cxx. -* Derived C++ files for a class - + \_\.hxx User header file. - + \_\.ixx User header file included in \_\.cxx. - + \_\.jxx User header file in \_\_[1..9[0..9]*].cxx. - + Handle_\_\.hxx Persistent or Transient class header file. - + \_\_0.cxx For instantiated classes. - -Umake Steps for a Package -------------------------- -The umake steps for development units of package type are explained below. -* *src* Processes the file *MyPackage.cdl* to generate a list of all the CDL files in the development unit. Processes FILES to list source files. -* *xcpp.fill* Compiles the internal data structure to prepare for subsequent extractions. -* *xcpp.src* Lists the source files (.cxx, .gxx, .lxx) deduced from the CDL files. -* *xcpp.header* Extracts header files for the classes in the development unit. -* *xcpp.template* Extracts a template for implementation of methods. (Hidden step.) -* *obj.inc*     Based on the list of source files generated by the src and xcpp.src steps, this step publishes the include files for the development unit so that other units can use them. -* *obj.cgen* Processes the source files to generate code. -* *obj.comp*   Compiles each file that can be compiled. -* *obj.idep*     Generates dependency information for the unit. This comprises: - + Includes performed by unit compilation (Unit.MakeState) - + Implementation dependencies in terms of the unit suppliers (Unit.ImplDep) -* *obj.lib*    Generates the shared library for the development unit. - -@subsubsection occt_wok_3_4_2 Creating a Nocdlpack - -If your executable requires the use of a nocdlpack, create a development unit of nocdlpack type and move to its structure using the commands below: -~~~~~ - > ucreate -n - > wokcd -~~~~~ -Use an editor to write *FILES*, which is a nomenclature file for a nocdlpack. This file must list all the C, C++, Fortran, lex, and yacc sourcs files (one per line). -Build the nocdlpack using the following command: -~~~~~ - > umake [] -~~~~~ -**Note** that a nocdlpack unit is not intended to perform tests. Use an executable unit instead. - - -#### Sample Construction of a Nocdlpack - -In the following example a nocdlpack *MyNocdlpack*, is created. Commands preceded by an asterisk below are used only once per session: -1. \*Create MyNocdlpack in MyWb. -~~~~~ -> ucreate -n -~~~~~ -2. Move to the source directory of MyNocdlpack. -~~~~~ -> wokcd -~~~~~ -3. Write the FILES list. You do this outside tcl, using the editor of your choice. -4. Write the source code. -5. Build MyNocdlpack. -~~~~~ -> umake [] -~~~~~ - -#### Umake Steps for a Nocdlpack - -The *umake* steps for development units of *nocdlpack* type are explained below. -* *src*   Processes FILES to list source files. -* *obj.cgen* Processes the source files to generate code. -* *obj.inc* Based on the list of source files, this step publishes the header files for the unit so that other units can use them. -* *obj.comp* Compiles each file that can be compiled. -* *obj.idep* Generates dependency information for the unit. This comprises: - + Includes performed by unit compilation. (Unit.MakeState) - + Implementation dependencies in terms of the unit suppliers. (Unit.ImplDep) -* *obj.lib* Generates the shared library for the unit. - -@subsubsection occt_wok_3_4_3 Creating a Schema - -If the application, which you intend to build, stores data in a file, you need to define a schema for the persistent data types that are known. - -You create a schema and go to its root directory using the commands: -~~~~~ -> ucreate -n -> wokcd -~~~~~ -Using the editor of your choice, write a .cdl file to define the schema. This schema file lists all the packages that contain persistent data types used in the implementation of your application. It has the following format: -~~~~~ - schema MySchema - is -class from ; - end; -~~~~~ - -#### Building a Schema - -Compile and check the coherence of the CDL specification for the schema: -~~~~~ -> umake -e xcpp.fill -~~~~~ -Extract the C++ description: -~~~~~ -> umake -o xcpp -~~~~~ -Compile the C++ description of the schema: -~~~~~ -> umake -o obj -~~~~~ -Alternatively, the above three steps can all be carried out by one command: -~~~~~ -> umake -~~~~~ -#### Sample Construction of a Schema - -In the following example the schema *MySchema* is created. It contains all the schemas of the persistent classes of your own packages and the packages they depend on. Commands preceded by an asterisk below are used only once per session: -1. Create MySchema in MyWb. -~~~~~ - > ucreate -s MySchema -~~~~~ -2. Move to the source directory of MySchema. -~~~~~ -> wokcd MySchema -~~~~~ -3. Edit the source file MySchema.cdl. You do this outside tcl, using the editor of your choice. -4. Derive implementation files. -~~~~~ - > umake -e xcpp.sch -~~~~~ -5. Derive application schema files. -~~~~~ - > umake -o xcpp.ossg -~~~~~ -6. Compile the schema. -~~~~~ - > umake -o obj -~~~~~ - -#### Schema Files - -* Primary Files for a Schema - + *\.cdl* Primary schema file. -* Derived C++ Files for a Schema - + *\.hxx* User header files. - + *\.cxx* Schema implementation files. - + *\.cxx* Schema implementation files. - -#### Umake Steps for a Schema - -The umake steps for development units of schema type are explained below. -* *src*        Processes MySchema.cdl to generate a list of CDL files for the development unit. Processes the FILES file to list source files. -* *xcpp.fill*  Compiles the internal data structure to prepare for subsequent extractions. -* *xcpp.sch*   Extracts the schema implementation code. -* *obj.comp*   Compiles the extracted files that can be compiled. -* *obj.lib*    Generates the shared library for the unit. -* *obj.idep*   Generates dependency information for the schema. - -@subsection occt_wok_3_5 Building an Executable - -@subsubsection occt_wok_3_5_1 Creating an Executable - -To make an executable from one or more of the packages, which you have created, write a .cdl file to specify the packages to use. - -#### Writing an Executable - -Refer to the **CDL User’s Guide** for full details. A simple example is given below. - -~~~~~ - executable // the executable unit -is - executable myexec // the binary file -uses -Tcl_Lib as external -is - myexec; // the C++ file -end; // several binaries can be specified in one .cdl file. -executable myex2 -is - myex2; -end; - end; -~~~~~ - -Write the C++ file(s). For the example above you write two files: *myexec.cxx* and *myex2.cxx*. - -#### Building the Executable - -To build the executable, use the command *umake* - -#### Construction of an Executable - -In the following example an executable, *MyExec*, is created in the workbench *MyWb*. Commands preceded by an asterisk below are used only once per session: -1. \*Create MyExec in MyWb. -~~~~~ - > ucreate -x MyExec -~~~~~ -2. Move to the source directory of *MyExec*. -~~~~~ - > wokcd MyExec -~~~~~ -3. Edit the cdl source file *MyExec.cdl*. You do this outside tcl, using the editor of your choice. -4. Edit the C++ files *AnExe.cxx*, etc. You do this outside tcl, using the editor of your choice. -5. Build MyExec. -~~~~~ - > umake -~~~~~ -6. Run the executable file. -~~~~~ - > wokcd -PLib - > MyExec -~~~~~ - -#### Executable Files - -| \.cdl | Primary executable file | -| \.cxx | Source C++ file | -| \_[1-9].cxx | Other source C++ files | - -#### Umake Steps for an Executable - -The umake steps for development units of executable type are explained below. -* *src* Processes MyExe.cdl to generate a list of CDL files for the development unit. Processes FILES to list source files. -* *src.list* Based on MyExe.cdl, works out the list of parts and the source files involved for each part. -* *exec.comp* Compiles the files that can be compiled for each part of the executable. -* *exec.idep* Generates dependency information for each part of the executable. -* *exec.libs* Computes full implementation dependency to prepare for linking for each part of the executable. -* *exec.tks* Performs toolkit substitution according to TOOLKITS for each part of the executable. -* *exec.link* Links each part of the executable. - -@subsection occt_wok_3_6 Test Environments - -@subsubsection occt_wok_3_6_1 Testing an Executable - -To test an executable, you create an executable development unit and move to its structure. - -When you write the .cdl file for your test executable, specify the packages to test, for example: -~~~~~ -executable MyTest // the executable unit - is -executable mytest1 // the binary file -is - mytest1; //the C++ file -end; // several binaries can be specified in one .cdl file. -executable mytest2 -is - mytest2; -end; - end; -~~~~~ -Write the C++ test file(s), in the example, *mytest1.cxx* and *mytest2.cxx*. -#### Building the Executable - -To build the executable use the command: -~~~~~ -> umake -~~~~~ - -#### Setting up a Test Environment - -To set up a test environment, move to the /drv subdirectory that corresponds to the current profile (e.g. /MyExec/drv/DFLT/sun) and run the executable test file. -~~~~~ -> wokcd -PLib -> wokenv -s -> myApp -~~~~~ -The command *wokenv* is used with -s option to configure the test environment. -The command *wokenv –s* uses the current workbench to decide what actions are needed to configure the tcl shell for use as your test environment. -WOK sets the following environment variables: - -* $STATION - The current station. -* $TARGET_DBMS - The current database platform. -* $PATH - The current path, plus the bin directories of the parcels. -* $LD_LIBRARY_PATH The current path, plus the lib directories of the parcels. -WOK then sets a variable for each parcel listed in the parcel configuration of the current workshop. This variable is the original name of the delivery unit in the uppercase, with the suffix *HOME*. -* $ORIGDELIVUNITHOME is set as the root directory of the parcel. -WOK then sources the following files: - * MyFactory.tcl, found in the admin directory of the factory. - * MyWorkshop.tcl found in the admin directory of the workshop. -Then for each Workbench, WOK sources according to the hierarchy of the workbenches: - * Workbench.tcl, found in the /Adm directory of the workbench. - -After the environment is set up, you are at a C shell prompt and can run the executable. - -**Note** Environment variables are only set when the command is used with the option -s. Thus, if you change a workbench or a factory within WOK and then return to the test environment you must use *wokenv -s* to ensure that the set environment variables configuration is correct for the current WOK state. -The configuration actions that WOK performs can be written to a file and saved as a script. You can then edit this script to suit it to your own needs, and generate a personalized test environment. - -To create the script file use the following command: -~~~~~ - > wokenv -f -t csh -~~~~~ -This command generates a file, ScriptFile, which configures a C shell to mirror the current WOK environment. An example script file is given below. -~~~~~ -setenv STATION *sil* -setenv TARGET_DBMS *DFLT* -setenv KERNELHOME */adv_22/WOK/BAG/KERNEL-K1-2-WOK* -setenv LD_LIBRARY_PATH */adv_22/WOK/BAG/wok-K1-2/lib/sil:/adv_22/WOK/BAG/KERNEL-K1-2-WOK/sil/lib/* -setenv PATH */usr/tcltk/bin:/usr/bin:/bin:/usr/bin/X11:/lib:.:/SGI_SYSTEM/util_MDTV/factory_proc:/adv_22/WOK/BAG/KERNEL-K1-2-WOK/sil/bin/* -source /adv_22/WOK/BAG/KERNEL-K1-2-WOK/adm/Kernel.csh -~~~~~ - -@subsection occt_wok_3_7 Building a Toolkit -@subsubsection occt_wok_3_7_1 Creating a Toolkit - -You create and enter a toolkit development unit using the following commands: -~~~~~ - > ucreate -t - > wokcd -~~~~~ - -#### Write the Nomenclature File for the Toolkit - -Using an editor, write a nomenclature file called PACKAGES which lists all the packages, one per line, that make up the toolkit. Add PACKAGES to FILES. -Build the shareable library for this toolkit as follows: -~~~~~ -\> umake [] -~~~~~ -**Note:** when one of the packages in the toolkit is modified, recompile the toolkit. A package should belong to one toolkit only. - -#### Sample Construction of a Toolkit - -In the following example, the toolkit **TKMyToolkit** is created. Commands preceded by an asterisk are used only once per session: -1. \*Create MyToolkit in MyWb. -~~~~~ -\> ucreate -t TKMyToolkit -~~~~~ -2. Move to the source directory of MyToolkit. -~~~~~ -\> wokcd TKMyToolkit -~~~~~ -3. Edit the nomenclature files, PACKAGES and FILES. You do this outside tcl, using the editor of your choice. -4. \*Create the library for MyToolkit -~~~~~ -\> umake TKMyToolkit -~~~~~ - -#### Umake Steps for a Toolkit - -The umake steps for development units of toolkit type are explained below. -* *src* Processes FILES to list source files. -* *lib.list* Works out the objects and archive library to add to the toolkit shared library. -* *lib.limit* Manages the build process strategy within the limitations of a particular platform. -* *lib.arch* Builds archives according to the building strategy. -* *lib.uncomp* Decompresses third party archives. -* *lib.arx* Extracts object files from archives. -* *lib.build* Generates the shared library for the toolkit. - -Building strategy depends on the platform. The following step sequences apply: - * On Sun (Solaris): -~~~~~ -src -lib.list -lib.arx -lib.build -~~~~~ - * On sil (IRIX): -~~~~~ -src -lib.list -lib.uncomp -lib.build -~~~~~ - -#### The TOOLKITS File - -When executables are compiled, a TOOLKITS file is used to determine which toolkits are included. This file is located in the src directory of the entity being compiled. The process is as follows: -* If no TOOLKITS file has been found, all toolkits are candidates for substitution. To find out which toolkits are candidates, use the command *w_info -k*. -* If an empty TOOLKITS file has been found, there is no toolkit candidate for substitution. -* If a non-empty TOOLKITS file has been found, only the toolkits listed in this file are candidates for substitution. - -#### Toolkit Substitution - -Toolkit substitution is performed as follows: -1. MyEngine uses A, B and C; -2. The toolkit TK provides A and D; D uses E; -3. Compilation of *MyEngine* includes TK, B C and E. - -Here, for simplicity, assume that additional toolkits are not substituted for B, C and E. - -@subsection occt_wok_3_8 Building a Delivery Unit -@subsubsection occt_wok_3_8_1 Creating a Delivery Unit -~~~~~ -\> ucreate -d -~~~~~ - -#### Writing the COMPONENTS File - -Create a file named COMPONENTS in the src subdirectory of the delivery development unit. List in this file the prerequisites of the delivery and the components that are part of the delivery. Use the syntax shown below. -Note that keywords and default options are shown in bold. - -| **Name** | ParcelName | -| Put path | | -| Put include || -|Put lib || -| **Requires** | DeliveryName\* | -| **Package** | MyPack **[CDL][LIBRARY][INCLUDES][SOURCES]** | -| **Nocdlpack** | MyNcdl **[LIBRARY][INCLUDES][SOURCES]** | -| **Executable** | MyExec **[CDL][DYNAMIC][SOURCES]** | -| **Interface** | MyIntf **[CDL][STUB_SERVER][SOURCES]** | -| **Client** | MyClient **[CDL]**[STUB_CLIENT][SOURCES] | -| **Engine** | MyEng **[CDL][DYNAMIC][SOURCES]** | -| **Schema** | MyShma **[CDL][LIBRARY][SOURCES][DOC]** | -| **Toolkit** |MyTk **[LIBRARY][SOURCES]** | -| **Get** | DevelopmentUnitName::Type\:\:\:File | - -\* Without mention of the version - -If no keywords are specified then all default arguments shown in bold are taken into account. To select arguments, list the ones required explicitly. The arguments are explained below: -* **Name** The full name of the current delivery, including a version number. This is the name of the parcel. -* **Put path** Requires that the delivery be inserted in the user path (bin directory). -* **\[CDL\]** Copy the cdl files to the delivery. -* **\[LIBRARY\]** Generate the static library. Copy the shareable library to the delivery. Copy the list of objects of the library. -* **\[INCLUDES\]** Generate includes.origin. Copy the includes to the delivery. Copy the ddl to the delivery. -* **\[DYNAMIC\]** Select to copy the static or dynamic executable file. -* **\[SOURCES\]** Copy the source files. - -#### Build the Delivery - -To build the delivery unit, use the command: -~~~~~ -\> umake -~~~~~ -The result of building a delivery unit is a **parcel**, which can be installed in a warehouse and used by other workbenches. - -#### Sample Delivery of a Parcel - -In the following example a delivery is created, compiled and made into a parcel. Commands preceded by an asterisk below are used only once per session: -1. Move to the root workbench under which the parcel is to be made. -~~~~~ -> wokcd MyRootWb -~~~~~ -2. \*Create MyDelivery in MyRootwb. -~~~~~ -> ucreate -d MyDelivery -~~~~~ -3. Move to the source directory of MyDelivery. -~~~~~ -> wokcd MyDelivery -~~~~~ -4. Use an editor to list all the prerequisites and components of the delivery in the COMPONENTS files using the appropriate syntax. -5. Build MyDelivery. -~~~~~ -> umake MyDelivery -~~~~~ -The output of the umake process is a parcel - -#### Umake Steps for a Delivery Unit - -The umake steps for development units of type delivery are explained below. -* *src* Processes FILES to list source files. -* *base*     Creates directories, defines the list of units, copies the parcels and the release notes. -* *get.list*        Lists files to get (using Get, Resource). -* *get.copy* Copy the files listed by get.list. -* *cdl.list*    Lists CDL files to copy. -* *cdl.copy*   Copies the files listed by cdl.list. -* *source.list* Lists units from which sources are to be copied. -* *source.build*    Creates a file for sources (in the format: unit.type.Z). -* *inc.list*         Lists includes to copy. -* *inc.copy*   Copies files listed by inc.list. -* *lib.shared* Works out the inputs for building or copying shareable libraries. -* *lib.shared.build* Copies or builds (depending on the platform) the shareable libraries. -* *lib.server.list*   Lists interface files to copy. -* *exec.list*    Lists inputs for executable delivery. -* *exec.build* Creates executable in the parcel. -* *files*   Works out the list of files delivered in the parcel. - -@subsubsection occt_wok_3_8_2 Installing a Parcel -You open the root workbench of the workshop where you want to install the parcel using the following command: -~~~~~ -\> wokcd -~~~~~ -To install the parcel, use the following syntax: -~~~~~ -\> pinstall -~~~~~ - -@subsection occt_wok_3_9 Working with Resource - -### Building a Resource - -There is a single umake step for development units of resource type. -* *src*                 Processes FILES to list source files. - -@subsection occt_wok_3_10 Java wrapping -@subsubsection occt_wok_3_10_1 Creating an interface - -To create an interface development unit and move to its structure, use commands: -~~~~~ -\> ucreate -i -\> wokcd -~~~~~ - -### Writing an Interface - -Having created the interface, you select the classes and packages that you wish to make available for Java wrapping in the jni units. Use an editor of your choice to write a .cdl interface file that specifies these exported services. This file has the format: - -~~~~~ -interface MyInterface -uses -  ListOfPackages; -is -  ListOfPackages; -  ListOfClasses; -  ListOfMethods; -end; -~~~~~ - -### Building an Interface - -To make the services of the interface available for further wrapping, build the interface, using the command: -~~~~~ -> umake [] -o src -~~~~~ - -### Sample Construction of an Interface - -In the following example a workbench, *MyWb*, is used for working on the interface *MyInterface*. Commands preceded by \* (asterisk) are used only once during a session. - -1. \*Create MyInterface in MyWb. -~~~~~ ->ucreate -i MyInterface -~~~~~ -2. Move to the source directory of MyInterface. -~~~~~ ->wokcd MyInterface -~~~~~ -3. Edit the source file MyInterface.cdl. You do this outside tcl, using an editor of your choice. -4. Build the interface. -~~~~~ -> umake -o src -~~~~~ - -### Interface Files - -_.cdl_ is the primary interface file. - -### Umake Steps for an Interface - -The umake steps for development units of type interface are explained below. - -* *src* - processes *MyInt.cdl* to list the CDL files for the development unit. Processes the FILES file to list source files. - -**Note** Make sure you only use the *src* step of umake. Using umake without arguments will lead to an attempt of launching other steps relevant to the interface unit. However these steps will fail and anyway are not required for use in Java wrapping. - -@subsubsection occt_wok_3_10_2 Creating a jni -To create a development unit of type jni and move to its structure, use commands: -~~~~~ -> ucreate -j -> wokcd -~~~~~ - -### Writing a Jni - -Use an editor to write a .cdl file that specifies the interface or interfaces required by the jni. This file has the following format: -~~~~~ -client MyJni -is -{interface MyInterface;} -{interface YourInterface;} -end; -~~~~~ - -### Building a Jni - -To wrap services exported by the interfaces to Java, build the jni, using the command: -~~~~~ - > umake [MyJni] -~~~~~ - -### Sample Construction of a Jni - -In the following example a workbench, *MyWb*, is used for working on the jni, *MyJni*. Commands preceded by \* (asterisk) are used only once during a session. - -1. \*Create MyJni in MyWb. -~~~~~ -> ucreate -j MyJni -~~~~~ -2. Move to the source directory of *MyJni*. -~~~~~ -> wokcd MyJni -~~~~~ -3. Edit the source file *MyJni.cdl*. You do this outside tcl, using an editor of your choice. -4. Derive Java files (.java and .class files) and C++ files (.h and .cxx) used for wrapping. -~~~~~ - > umake -e xcpp -~~~~~ -5. Compile the sources. -~~~~~ -> umake -o obj -~~~~~ -6. Link the object files. -~~~~~ -> umake -o exec -~~~~~ - -Primary jni file is *Jni.cdl* - -Derived Java files for a Jni are: -* \_\.java - Java source file of the class to be wrapped. -* \_\.class - Compiled java source file. - -Derived C++ files for a Jni are: -* \_\_\_java.h - Include file for the C++ implementation of JNI. -* \_\_\_java.cxx - C++ implementation of JNI. - -### Umake Steps for a Jni - -The umake steps for development units of type jni are explained below. -* *src*        Processes MyJni.cdl to list the CDL files for the development unit. Processes the FILES file to list source files. -* *xcpp.fill*     Compiles the internal data structure to prepare for subsequent extractions. -* *xcpp.client* Extracts the services declared in included interface unit(s) into Java and creates .java and \*_java.cxx files. -* *xcpp.javac* Compiles .java files into .class files. -* *xcpp.javah* Creates .h header files. -* *obj.comp* Compiles generated C++ files. -* *obj.idep*    Generates dependency information for the unit. -* *exec.libs* Computes full implementation dependency to prepare for linking. -* *exec.tks*    Performs toolkit substitution. -* *exec.link*    Generates the shared library for the development unit. - -@subsection occt_wok_3_11 More Advanced Use -@subsubsection occt_wok_3_11_1 Default User Profile -There is a default user profile. If you wish to change this profile the command *wokprofile* is available. - -An example profile is given below. -~~~~~ - Info : Profile in : WOK:k1dev:ref - Info : Extractor : DFLT - Info : Compile Mode : Optimized - Info : Station Type : sil -~~~~~ -@subsubsection occt_wok_3_11_2 Changing Parcel Configuration -Parcel configuration rarely needs changes. However, if you do need to modify the list of resources, you can do so by editing the admin parameter file of the factory. This file is found in the admin directory of the factory and is named after the workshop. It has the suffix .edl. Its full name has the following format: -~~~~~ -.edl. -~~~~~ - -Move to the admin directory of the factory: -~~~~~ -\> wokcd -PAdm -~~~~~ - -Then use the editor of your choice to edit the admin parameter file, MyWorkshop.edl. -In this file, the parcel configuration is defined by an entry of the form: -~~~~~ -\@set %_ParcelConfig = “Parcel1 Parcel2...Parceln”; -~~~~~ -The resources are listed within quotation marks. They are separated by spaces. -Edit this list as required. Save the file and close it. -To validate and take into account your changes use the command: -~~~~~ -\> wokclose -a -~~~~~ -This command closes and reopens all the entities. Without the -a option, *wokclose* only applies to the current entity. - -@section occt_wok_4_ Available Services -@subsection occt_wok_4_1 Synopsis -WOK provides sets of services, which can be grouped according to the entity they apply to: - * General Services - * Factories - * Warehouses - * Parcels - * Workshops - * Workbenches - * Development Units - * Source Management Services - * Session Services -@subsubsection occt_wok_4_1_1 Common Command Syntax - -#### Command Names - -All WOK commands follow a common naming convention. This is based on a set of common command names and a group of prefixes, which denote entity type. The command name takes a prefix representing the entity to which it applies. -The following prefixes exist: - * f: for factories - * s: for workshops - * w: for workbenches - * u: for development units - * W: for warehouses - * p: for parcels - * wok: for commands that apply to any type of entity -These prefixes are followed by a command that determines the action to be executed. Examples of such commands are: - * create: create an entity - * rm: delete an entity - * info: request information -Consequently, the command ucreate creates a development unit. The command wrm removes a workbench. - -#### Command Options - -All command options are expressed using a dash (-) followed by one or more key letters and, if applicable, an argument. For example: -~~~~~ -> umake -f -o MyUnit -~~~~~ -The compact version of this syntax is also valid: -~~~~~ - umake -fo argument MyUnit -~~~~~ -This syntax conforms to the POSIX recommendations for UNIX commands. -For all commands, there is a –h option, which displays help on usage. - -#### Presentation of Commands - -The general syntax of the commands is presented in this document as follows: -~~~~~ -CommandName [option(s) [] []] -~~~~~ -Consequently, there are four general cases for a command: -~~~~~ -CommandName -CommandName [] -CommandName [] -CommandName -~~~~~ -**Note** a few commands described in this chapter do not completely respect this syntax; for example, *create* and *rm*. - -As a rule, where an _\_ is given as an argument it specifies which entity the command applies to. Where no _\_ is specified, the command applies to the nearest appropriate entity. The *create* and *rm* commands are notable exceptions: you **must** specify an entity path with these commands. - -@subsection occt_wok_4_2 General Services -General services are commands that apply to any entity manipulated by WOK. They are used for: - * Navigation - * Managing parameters - * Managing profiles. - -@subsubsection occt_wok_4_2_1 wokcd -~~~~~ -wokcd -wokcd -wokcd -P [] -~~~~~ - -Navigates between different WOK entities and changes the current working directory. Without any arguments wokcd lists the current position (the WOK equivalent of ‘pwd’). With an argument, wokcd moves to the specified location. -Options: -* _\_ Moves to the home directory of the entity specified by \, i.e. moves to the location given by the parameter: %wokcd \_Home. -* _-P \ [\]_ Moves to the \ directory of the entity specified by \. i.e. moves to the location given by the parameter: %\_\. If no entity path is specified, this command moves to the \ directory of the current entity. - -Possible values for \ are: Home, Adm and Src. -Use the following commands to change directories within a development unit: -* **wsrc** To access the source files. -* **winc** To access the include files. -* **wobj** To access objects. -* **wlib** To access shareable libraries. -* **wbin** To access executables. -* **wadm** To access the workbench administration files. - -#### Examples - -*wokcd* - Lists the current position. - -*wokcd MODEL:GTI:gti:gp* - Moves to the home directory of the gp package of the gti workbench in the GTI workshop in the MODEL factory. - -*wokcd -P Adm* - Moves to the administration directory of the current entity. - - -@subsubsection occt_wok_4_2_2 wokclose -~~~~~ -wokclose [-a] -~~~~~ -Closes and reopens entities, i.e. reloads them into memory thus taking any changes into account. -Option -a closes and reloads all entities. - -#### Examples - -~~~~~ -wokclose -~~~~~ -Closes and reopens the current entity. -~~~~~ -wokclose -a -~~~~~ -Closes and reopens all the entities. -@subsubsection occt_wok_4_2_3 wokenv -~~~~~ -wokenv -f -t csh -~~~~~ -Creates the file \. This file is a script, which configures a C shell to mirror the current WOK environment. See the Test Environments section for more details. -Options: -* -f \ - Specifies the name of the file to produce. -* -t csh - Produces a file for configuring a C shell. -* -s - Sets up environment variables for application launching. -Example -------- -~~~~~ -> wokenv -f MyTestEnvScript -t csh -~~~~~ -Generates the shell script *MyTestEnvScript* to configure a C shell so that it mirrors the current WOK environment. -@subsubsection occt_wok_4_2_4 wokinfo -~~~~~ -wokinfo -