Ignore:
Timestamp:
03/02/11 01:44:16 (3 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
6ceaa13542b467cc96ac23a26920312a7075c442
Message:

Most C++ classes which are exported through the new modules now show the "correct" names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • source/pyxtract/defvectors.py

    r6538 r7715  
    77$wrappedlistname$ P$pyname$_FromArguments(PyObject *arg) { return $classname$::P_FromArguments(arg); } 
    88PyObject *$pyname$_FromArguments(PyTypeObject *type, PyObject *arg) { return $classname$::_FromArguments(type, arg); } 
    9 PyObject *$pyname$_new(PyTypeObject *type, PyObject *arg, PyObject *kwds) BASED_ON(Orange, "(<list of $pyelement$>)") ALLOWS_EMPTY { return $classname$::_new(type, arg, kwds); } 
     9PyObject *$pyname$_new(PyTypeObject *type, PyObject *arg, PyObject *kwds) BASED_ON(Orange$displayname, "(<list of $pyelement$>)") ALLOWS_EMPTY { return $classname$::_new(type, arg, kwds); } 
    1010PyObject *$pyname$_getitem_sq(TPyOrange *self, Py_ssize_t index) { return $classname$::_getitem(self, index); } 
    1111int       $pyname$_setitem_sq(TPyOrange *self, Py_ssize_t index, PyObject *item) { return $classname$::_setitem(self, index, item); } 
     
    4747outf = open("lib_vectors_auto.txt", "wt") 
    4848 
    49 def normalList(name, goesto): 
    50   return tuple([x % name for x in ("%sList", "%s", "P%sList", "T%sList", "P%s")] + [goesto]) 
     49def normalList(displayname, name, goesto): 
     50  return (displayname,) + tuple([x % name for x in ("%sList", "%s", "P%sList", "T%sList", "P%s")] + [goesto]) 
    5151 
    5252 
    5353#  list name in Python,    element name in Py, wrapped list name in C, list name in C,         list element name in C, interface file 
    54 for (pyname, pyelementname, wrappedlistname, listname, elementname, goesto) in \ 
    55   [("ValueList",           "Value",            "PValueList",           "TValueList",           "TValue",               "cls_value.cpp"), 
    56    ("VarList",             "Variable",         "PVarList",             "TVarList",             "PVariable",            "lib_kernel.cpp"), 
    57    ("VarListList",         "VarList",          "PVarListList",         "TVarListList",         "PVarList",             "lib_kernel.cpp"), 
    58    ("DomainDistributions", "Distribution",     "PDomainDistributions", "TDomainDistributions", "PDistribution",        "lib_kernel.cpp"), 
    59    normalList("Distribution", "lib_kernel.cpp"), 
    60    normalList("ExampleGenerator", "lib_kernel.cpp"), 
    61    normalList("Classifier", "lib_kernel.cpp"), 
     54for (displayname, pyname, pyelementname, wrappedlistname, listname, elementname, goesto) in \ 
     55  [("",                               "ValueList",           "Value",            "PValueList",           "TValueList",           "TValue",               "cls_value.cpp"), 
     56   ("Orange.data.variable.Variables", "VarList",             "Variable",         "PVarList",             "TVarList",             "PVariable",            "lib_kernel.cpp"), 
     57   ("",                               "VarListList",         "VarList",          "PVarListList",         "TVarListList",         "PVarList",             "lib_kernel.cpp"), 
     58   ("",                               "DomainDistributions", "Distribution",     "PDomainDistributions", "TDomainDistributions", "PDistribution",        "lib_kernel.cpp"), 
     59   normalList("", "Distribution", "lib_kernel.cpp"), 
     60   normalList("", "ExampleGenerator", "lib_kernel.cpp"), 
     61   normalList("Orange.classification.ClassifierList", "Classifier", "lib_kernel.cpp"), 
    6262    
    63    ("DomainBasicAttrStat", "BasicAttrStat",    "PDomainBasicAttrStat", "TDomainBasicAttrStat", "PBasicAttrStat",       "lib_components.cpp"), 
    64    ("DomainContingency",   "Contingency",      "PDomainContingency",   "TDomainContingency",   "PContingencyClass",    "lib_components.cpp"), 
    65    normalList("ValueFilter", "lib_components.cpp"), 
    66    normalList("Filter", "lib_components.cpp"), 
    67    normalList("HierarchicalCluster", "lib_components.cpp"), 
     63   ("",                               "DomainBasicAttrStat", "BasicAttrStat",    "PDomainBasicAttrStat", "TDomainBasicAttrStat", "PBasicAttrStat",       "lib_components.cpp"), 
     64   ("",                               "DomainContingency",   "Contingency",      "PDomainContingency",   "TDomainContingency",   "PContingencyClass",    "lib_components.cpp"), 
     65   normalList("", "ValueFilter", "lib_components.cpp"), 
     66   normalList("", "Filter", "lib_components.cpp"), 
     67   normalList("Orange.clustering.hierarchical.HierarchicalClusterList", "HierarchicalCluster", "lib_components.cpp"), 
    6868    
    69    ("AssociationRules",    "AssociationRule",  "PAssociationRules",    "TAssociationRules",    "PAssociationRule",     "lib_learner.cpp"), 
    70    normalList("TreeNode", "lib_learner.cpp"), 
    71    normalList("C45TreeNode", "lib_learner.cpp"), 
    72    normalList("Rule", "lib_learner.cpp"), 
    73    normalList("ConditionalProbabilityEstimator", "lib_components.cpp"), 
    74    normalList("ProbabilityEstimator", "lib_components.cpp"), 
    75    normalList("EVDist", "lib_learner.cpp"), 
     69   ("Orange.associate.AssociationRules",  "AssociationRules", "AssociationRule",  "PAssociationRules",    "TAssociationRules",    "PAssociationRule",     "lib_learner.cpp"), 
     70   normalList("Orange.classification.tree.NodeList", "TreeNode", "lib_learner.cpp"), 
     71   normalList("Orange.classification.tree.C45NodeList", "C45TreeNode", "lib_learner.cpp"), 
     72   normalList("Orange.classification.rules.RuleList", "Rule", "lib_learner.cpp"), 
     73   normalList("", "ConditionalProbabilityEstimator", "lib_components.cpp"), 
     74   normalList("", "ProbabilityEstimator", "lib_components.cpp"), 
     75   normalList("", "EVDist", "lib_learner.cpp"), 
    7676 
    77    normalList("Heatmap", "orangene.cpp"), 
    78    normalList("SOMNode", "som.cpp") 
     77   normalList("", "Heatmap", "orangene.cpp"), 
     78   normalList("", "SOMNode", "som.cpp") 
    7979   ]: 
    8080  outf.write("**** This goes to '%s' ****\n" % goesto) 
    81   outf.write(wdefinition.replace("$pyname$", pyname) 
     81  outf.write(wdefinition.replace("$displayname", ((" - "+displayname) if displayname else "")) 
     82                        .replace("$pyname$", pyname) 
    8283                        .replace("$classname$", "ListOfWrappedMethods<%s, %s, %s, &PyOr%s_Type>" % (wrappedlistname, listname, elementname, pyelementname)) 
    83                        .replace("$pyelement$", pyelementname) 
    84                        .replace("$wrappedlistname$", wrappedlistname) 
    85                        .replace(">>", "> >") 
     84                        .replace("$pyelement$", pyelementname) 
     85                        .replace("$wrappedlistname$", wrappedlistname) 
     86                        .replace(">>", "> >") 
    8687             +"\n\n" 
    8788            ) 
     
    147148 
    148149  outfile.write((wrapped and wdefinition or udefinition) 
     150                       .replace("$displayname", " - Orange.core."+pyname) 
    149151                       .replace("$pyname$", pyname) 
    150152                       .replace("$classname$", classname) 
Note: See TracChangeset for help on using the changeset viewer.