CRIMP
Check-in [360c8724f9]
Not logged in

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

Overview
Comment:Modified the demos framework to provide a documented api for access to app and demos directories, replaced outdated and broken (since [3ca084f409], and [3f01ece746]) uses of the $dir variable with these APIs.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 360c8724f9089b0fc3d060192df2743dca902f09
User & Date: andreask 2011-11-18 05:47:15.251
References
2011-11-18
06:15
Following up on [360c8724f9]. Fixed the equivalent issue with the image reading demos. check-in: d0822bb9f6 user: andreask tags: trunk
Context
2011-11-18
05:48
Updated the embedded documentation. check-in: fb38f887d3 user: andreask tags: trunk
05:47
Modified the demos framework to provide a documented api for access to app and demos directories, replaced outdated and broken (since [3ca084f409], and [3f01ece746]) uses of the $dir variable with these APIs. check-in: 360c8724f9 user: andreask tags: trunk
05:34
Disabled currently not usable demos. check-in: 06731c8280 user: andreask tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to demos.tcl.
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	    setup       {}
	    setup_image {}
	    shutdown    {}
	}
    }
    set demo_index(A:Unmodified) [list aaaaa N/A]

    foreach f [glob -directory $selfdir/demos *.tcl] {
	set thedemo {}
	source $f
	set name [dict get $thedemo name]
	set demo_label [dict get $thedemo label]
	set demo_index(${demo_label}) [list ${name} [file tail ${f}]]
	#puts <$thedemo>
	set demo($name) $thedemo







|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	    setup       {}
	    setup_image {}
	    shutdown    {}
	}
    }
    set demo_index(A:Unmodified) [list aaaaa N/A]

    foreach f [glob -directory [demodir] *.tcl] {
	set thedemo {}
	source $f
	set name [dict get $thedemo name]
	set demo_label [dict get $thedemo label]
	set demo_index(${demo_label}) [list ${name} [file tail ${f}]]
	#puts <$thedemo>
	set demo($name) $thedemo
906
907
908
909
910
911
912










913
914
915
916
917
918
919

proc base {{i 0}} {
    global base
    return [lindex $base $i]
    #return [crimp degamma [lindex $base $i] 2.2]
    #return [crimp gamma [lindex $base $i] 2.2]
}











proc bases {} {
    global base
    return [llength $base]
}

proc thebases {} {







>
>
>
>
>
>
>
>
>
>







906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929

proc base {{i 0}} {
    global base
    return [lindex $base $i]
    #return [crimp degamma [lindex $base $i] 2.2]
    #return [crimp gamma [lindex $base $i] 2.2]
}

proc appdir {} {
    global selfdir
    return $selfdir
}

proc demodir {} {
    global selfdir
    return $selfdir/demos
}

proc bases {} {
    global base
    return [llength $base]
}

proc thebases {} {
Changes to demos/write_pgm.tcl.
1
2
3

4
5
6
def write_pgm {
    label {Write (PGM/plain)}
    setup_image {

	crimp write 2file pgm-plain $dir/written.pgm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_pgm {
    label {Write (PGM/plain)}
    setup_image {
	log "Destination [appdir]/written.pgm"
	crimp write 2file pgm-plain [appdir]/written.pgm [base]
    }
}
Changes to demos/write_pgm_raw.tcl.
1
2
3

4
5
6
def write_pgmraw {
    label {Write (PGM/raw)}
    setup_image {

	crimp write 2file pgm-raw $dir/written.pgm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_pgmraw {
    label {Write (PGM/raw)}
    setup_image {
	log "Destination [appdir]/written.pgm"
	crimp write 2file pgm-raw [appdir]/written.pgm [base]
    }
}
Changes to demos/write_ppm.tcl.
1
2
3

4
5
6
def write_ppm {
    label {Write (PPM/plain)}
    setup_image {

	crimp write 2file ppm-plain $dir/written.ppm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_ppm {
    label {Write (PPM/plain)}
    setup_image {
	log "Destination [appdir]/written.ppm"
	crimp write 2file ppm-plain [appdir]/written.ppm [base]
    }
}
Changes to demos/write_ppm_raw.tcl.
1
2
3

4
5
6
def write_ppmraw {
    label {Write (PPM/raw)}
    setup_image {

	crimp write 2file ppm-raw $dir/written.ppm [base]
    }
}



>
|


1
2
3
4
5
6
7
def write_ppmraw {
    label {Write (PPM/raw)}
    setup_image {
	log "Destination [appdir]/written.ppm"
	crimp write 2file ppm-raw [appdir]/written.ppm [base]
    }
}
Changes to doc/crimp_devguide.man.
682
683
684
685
686
687
688




689
690
691
692
693
694
695
696




697
698
699
700
701
702
703
	[enum] [package crimp]
	[enum] [package crimp::tk]
	[enum] [package crimp::bmp]
	[enum] [package crimp::pgm]
	[enum] [package crimp::pfm]
	[enum] [package crimp::ppm]
	[list_end]





    [call [cmd base] [opt [arg N]]]
        Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.

    [call [cmd bases]]
        Returns the number of selected images. Most useful to the
        'active' script.





    [call [cmd thebases]]
        Returns a list containing all selected images.

    [call [cmd show_image] [arg I]]
        Takes an image I and displays it in the demo result area for
        the user to see.







>
>
>
>








>
>
>
>







682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
	[enum] [package crimp]
	[enum] [package crimp::tk]
	[enum] [package crimp::bmp]
	[enum] [package crimp::pgm]
	[enum] [package crimp::pfm]
	[enum] [package crimp::ppm]
	[list_end]

    [call [cmd appdir]]
        Returns the path of the directory the demo application is
        contained in.

    [call [cmd base] [opt [arg N]]]
        Returns the N'th image selected by the user. Counted from 0.
        If not specified 'N' defaults 0.

    [call [cmd bases]]
        Returns the number of selected images. Most useful to the
        'active' script.

    [call [cmd demodir]]
        Returns the path of the directory the demo's sources are
        contained in.

    [call [cmd thebases]]
        Returns a list containing all selected images.

    [call [cmd show_image] [arg I]]
        Takes an image I and displays it in the demo result area for
        the user to see.