Check-in [c45f0d9d7c]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Got instance creation working!
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:c45f0d9d7c8870856ffecead249087d3f77f1ff14a7faeb8c2eaaec39aa1a0c5
User & Date: gwlester 2018-02-03 04:37:38
Context
2018-02-03
05:27
Added makefile to create module. check-in: a9112f2b6a user: gwlester tags: trunk, Release_0.5
04:37
Got instance creation working! check-in: c45f0d9d7c user: gwlester tags: trunk
2018-02-02
23:49
Initial implementation. Creation of a new instance does not work. check-in: 5d85eb1bdd user: gwlester tags: trunk
Changes

Changes to src/pyman.tcl.

    16     16   
    17     17           set tclModuleName [join [lrange [split $className {:}] 0 end-2] {:}]
    18     18           set pythonModuleName [set ${tclModuleName}::pythonModuleName]
    19     19           set pythonClassName [lindex [split $className {:}] end]
    20     20           set pythonObject [string map {{::} {_}} [self]]
    21     21   
    22     22           ##
    23         -        ## Not sure about the line below!!
           23  +        ## Define a function to create the object and assign it to a global variable
    24     24           ##
    25         -        py eval "$pythonObject = $pythonModuleName.${pythonClassName}([join $args ,])"
           25  +        set defineInstance {def pymanDefineInstance( objName}
           26  +        set createString {globals()[objName] = }
           27  +        append createString "$pythonModuleName.${pythonClassName}("
           28  +        set argCnt [llength $args]
           29  +        for {set i 1} {$i <= $argCnt} {incr i} {
           30  +            append defineInstance ", x$i"
           31  +            if {$i > 1} {
           32  +                append createString ", "
           33  +            }
           34  +            append createString x$i
           35  +        }
           36  +        append defineInstance "):"
           37  +        append defineInstance "\n    " $createString ")"
           38  +        append defineInstance "\n    " "return"
           39  +
           40  +        py eval $defineInstance
           41  +        py call pymanDefineInstance $pythonObject {*}$args
    26     42       }
    27     43   
    28     44       classmethod import {args} {
    29     45           switch -exact -- [llength $args] {
    30     46               1   {
    31     47                   ##
    32     48                   ## Just a moduleName