Changes On Branch py-tinkering
Not logged in

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

Changes In Branch py-tinkering Excluding Merge-Ins

This is equivalent to a diff from 948e056a45 to f2f521f5e7

2021-06-15
14:54
Fix [18f4a94d03] by backing out [9bcec7cd880540c3] check-in: a785b5bf5e user: jan.nijtmans tags: core-8-branch
12:56
Fix [18f4a94d03] by backout out [9bcec7cd880540c3] check-in: 3f466e55c8 user: jan.nijtmans tags: bug-18f4a94d03
2021-06-12
19:43
Make it an error to provide neither --tcl or --tk, or to provide both. Closed-Leaf check-in: f2f521f5e7 user: pooryorick tags: py-tinkering
19:15
Make the search for the project's .h file a little more specific. EDIT: Maybe good ideas here, bu... check-in: 9f8b78d60f user: pooryorick tags: py-tinkering
2021-06-11
17:49
merge 8.7 check-in: e80a5588eb user: dgp tags: core-8-7-a5-rc
14:01
Merge 8.7 check-in: 05c20ec9d0 user: jan.nijtmans tags: trunk, main
13:59
Merge 8.6 check-in: 948e056a45 user: jan.nijtmans tags: core-8-branch
13:57
Fix [d6b10a9256]: Two files under compat/zlib/contrib/ are CRLF check-in: ed73bed5c1 user: jan.nijtmans tags: core-8-6-branch
13:48
Somehow "zip -A" appears not to work in the github actions environment. Try to find out why. check-in: 8f88456ba0 user: jan.nijtmans tags: core-8-branch

Changes to tools/tcltk-man2html.tcl.
18
19
20
21
22
23
24
25
26


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

45
46
47
48



49
50
51
52
53
54
55
56
57
58
59
60
61




62
63
64
65
66
67
68
69
70
71
72
73












74
75
76
77
78
79
80
18
19
20
21
22
23
24


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44




45
46
47
48
49
50
51
52
53
54
55
56
57



58
59
60
61
62











63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81







-
-
+
+

















-
+
-
-
-
-
+
+
+










-
-
-
+
+
+
+

-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+







# an example of how someone might convert a specific set of man pages
# into hypertext, not as a general solution to the problem.  If you
# try to use this, you'll be very much on your own.
#
# Copyright (c) 1995-1997 Roger E. Critchlow Jr
# Copyright (c) 2004-2010 Donal K. Fellows

set ::Version "50/8.7"
set ::CSSFILE "docs.css"
set ::Version 50/8.7
set ::CSSFILE docs.css

##
## Source the utility functions that provide most of the
## implementation of the transformation from nroff to html.
##
source [file join [file dirname [info script]] tcltk-man2html-utils.tcl]

proc getversion {tclh {name {}}} {
    if {[file exists $tclh]} {
	set chan [open $tclh]
	set data [read $chan]
	close $chan
	if {$name eq ""} {
	    set name [string toupper [file root [file tail $tclh]]]
	}
	# backslash isn't required in front of quote, but it keeps syntax
	# highlighting straight in some editors
	if {[regexp -lineanchor \
	if {[regexp -lineanchor [string map [list @name@ $name
	    [string map [list @name@ $name] \
		{^#define\s+@name@_VERSION\s+\"([^.])+\.([^.\"]+)}] \
	    $data -> major minor]} {
		return [list $major $minor]
	    ] {^#define\s+@name@_VERSION\s+\"([^.])+\.([^.\"]+)}
	] $data -> major minor]} {
	    return [list $major $minor]
	}
    }
}
proc findversion {top name useversion} {
    # Default search version is a glob pattern, switch it for string match:
    if {$useversion eq {{,[8-9].[0-9]{,[.ab][0-9]{,[0-9]}}}}} {
	set useversion {[8-9].[0-9]}
    }
    # Search:
    set upper [string toupper $name]
    foreach top1 [list $top $top/..] sub {{} generic} {
	foreach dirname [
	    glob -nocomplain -tails -type d -directory $top1 *] {
    foreach top1 [list $top $top/..] {
	foreach sub {{} generic} {
	    foreach dirname [
		glob -nocomplain -tails -type d -directory $top1 *] {

	    set tclh [join [list $top1 $dirname {*}$sub ${name}.h] /]
	    set v [getversion $tclh $upper]
	    if {[llength $v]} {
		lassign $v major minor
		# to do
		#     use glob matching instead of string matching or add
		#     brace handling to [string matcch]
		if {$useversion eq "" || [string match $useversion $major.$minor]} {
		    set top [file dirname [file dirname $tclh]]
		    set prefix [file dirname $top]
		    return [list $prefix [file tail $top] $major $minor]
		set tclh [join [list $top1 $dirname {*}$sub ${name}.h] /]
		set v [getversion $tclh $upper]
		if {[llength $v]} {
		    lassign $v major minor
		    # to do
		    #     use glob matching instead of string matching or add
		    #     brace handling to [string matcch]
		    if {$useversion eq "" || [string match $useversion $major.$minor]} {
			set top [file dirname [file dirname $tclh]]
			set prefix [file dirname $top]
			return [list $prefix [file tail $top] $major $minor]
		    }
		}
	    }
	}
    }
}

proc parse_command_line {} {
146
147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
162
163
164
165







166
167
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192

193
194
195
196
197
198
199
147
148
149
150
151
152
153


154
155
156
157
158
159
160
161
162
163



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187
188
189
190




191
192
193

194
195
196
197
198
199
200
201







-
-
+
+








-
-
-
+
+
+
+
+
+
+








-
+











-
-
-
-
+


-
+








	    --tk {
		set build_tk 1
		set opt_build_tk 1
	    }

	    --verbose=* {
		set verbose [string range $option \
				 [string length --verbose=] end]
		set verbose [string range $option [
		    string length --verbose=] end]
	    }
	    default {
		puts stderr "tcltk-man-html: unrecognized option -- `$option'"
		exit 1
	    }
	}
    }

    if {!$build_tcl && !$build_tk} {
	set build_tcl 1;
	set build_tk 1
    switch $build_tcl$build_tk {
	00 {
	    error [list {either --tcl or --tk must be given}]
	}
	11 {
	    error [list {both --tcl and --tk may not be given}]
	}
    }

    set major ""
    set minor ""

    if {$build_tcl} {
	# Find Tcl (firstly using glob pattern / backwards compatible way)
	set tcldir [lindex [lsort [glob -nocomplain -tails -type d \
		-directory $tcltkdir tcl$useversion]] end]
	    -directory $tcltkdir tcl$useversion]] end]
	if {$tcldir ne ""} {
	    # obtain version from generic header if we can:
	    lassign [getversion [file join $tcltkdir $tcldir generic tcl.h]] major minor
	} else {
	    lassign [findversion $tcltkdir tcl $useversion] tcltkdir tcldir major minor
	}
	if {$tcldir eq "" && $opt_build_tcl} {
	    puts stderr "tcltk-man-html: couldn't find Tcl below $tcltkdir"
	    exit 1
	}
	puts "using Tcl source directory [file join $tcltkdir $tcldir]"
    }


    if {$build_tk} {
    } elseif {$build_tk} {
	# Find Tk (firstly using glob pattern / backwards compatible way)
	set tkdir [lindex [lsort [glob -nocomplain -tails -type d \
		-directory $tcltkdir tk$useversion]] end]
	    -directory $tcltkdir tk$useversion]] end]
	if {$tkdir ne ""} {
	    if {$major eq ""} {
		# obtain version from generic header if we can:
		lassign [getversion [file join $tcltkdir $tkdir generic tk.h]] major minor
	    }
	} else {
	    lassign [findversion $tcltkdir tk $useversion] tcltkdir tkdir major minor
370
371
372
373
374
375
376
377

378
379
380
381
382
383
384
372
373
374
375
376
377
378

379
380
381
382
383
384
385
386







-
+







	puts stderr "Assembling index"
    }
    file delete -force -- $html/Keywords
    makedirhier $html/Keywords
    set keyfp [open $html/Keywords/[indexfile] w]
    fconfigure $keyfp -translation lf -encoding utf-8
    puts $keyfp [htmlhead "$tcltkdesc Keywords" "$tcltkdesc Keywords" \
		     $overall_title "../[indexfile]"]
	$overall_title "../[indexfile]"]
    set letters {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}
    # Create header first
    set keyheader {}
    foreach a $letters {
	set keys [array names manual "keyword-\[[string totitle $a$a]\]*"]
	if {[llength $keys]} {
	    lappend keyheader "<a href=\"$a.html\">$a</a>"
394
395
396
397
398
399
400
401

402
403
404
405
406
407
408
409
396
397
398
399
400
401
402

403

404
405
406
407
408
409
410







-
+
-







	if {![llength $keys]} {
	    continue
	}
	# Per-keyword page
	set afp [open $html/Keywords/$a.html w]
	fconfigure $afp -translation lf -encoding utf-8
	puts $afp [htmlhead "$tcltkdesc Keywords - $a" \
		       "$tcltkdesc Keywords - $a" \
	    "$tcltkdesc Keywords - $a" $overall_title ../[indexfile]]
		       $overall_title "../[indexfile]"]
	puts $afp $keyheader
	puts $afp "<dl class=\"keylist\">"
	foreach k [lsort -dictionary $keys] {
	    set k [string range $k 8 end]
	    puts $afp "<dt><a name=\"[nospace-text $k]\" id=\"[nospace-text $k]\">$k</a></dt>"
	    puts $afp "<dd>"
	    set refs {}
471
472
473
474
475
476
477
478
479


480
481
482
483
484
485
486
472
473
474
475
476
477
478


479
480
481
482
483
484
485
486
487







-
-
+
+







		puts stderr "rescanning page $manual(name) $ntoc/$ntext"
	    } else {
		puts -nonewline stderr .
	    }
	    set outfd [open $html/$manual(wing-file)/$manual(name).html w]
	    fconfigure $outfd -translation lf -encoding utf-8
	    puts $outfd [htmlhead "$manual($manual(wing-file)-$manual(name)-title)" \
		    $manual(name) $wing_name "[indexfile]" \
		    $overall_title "../[indexfile]"]
		$manual(name) $wing_name "[indexfile]" \
		$overall_title "../[indexfile]"]
	    if {($ntext > 60) && ($ntoc > 32)} {
		foreach item $toc {
		    puts $outfd $item
		}
	    } elseif {$manual(name) in $forced_index_pages} {
		if {!$verbose} {puts stderr ""}
		manerror "forcing index generation"
516
517
518
519
520
521
522
523

524
525
526
527
528
529
530
517
518
519
520
521
522
523

524
525
526
527
528
529
530
531







-
+







    if {$var} {
	if {[file exists $tcltkdir/$root/README]} {
	    set f [open $tcltkdir/$root/README]
	    fconfigure $f -encoding utf-8
	    set d [read $f]
	    close $f
	    if {[regexp {This is the \w+ (\S+) source distribution} $d -> version]} {
	       append name ", version $version"
		append name ", version $version"
	    }
	}
	set glob $root/$glob
	return [list $tcltkdir/$glob $name $dir $desc]
    }
}

544
545
546
547
548
549
550
551

552
553
554
555
556
557
558
545
546
547
548
549
550
551

552
553
554
555
556
557
558
559







-
+







	if {![llength [glob -type f -nocomplain $globpat]]} {
	    # Fallback for manpages generated using doctools
	    set globpat $pkgsdir/$dir/doc/man/*.$type
	    if {![llength [glob -type f -nocomplain $globpat]]} {
		continue
	    }
	}
	set dir [string trimright $dir "0123456789-."]
	set dir [string trimright $dir 0123456789-.]
	switch $type {
	    n {
		set title "$name Package Commands"
		if {$version ne ""} {
		    append title ", version $version"
		}
		set dir [string totitle $dir]Cmd
807
808
809
810
811
812
813
814

815
816

817
818

819
820
821

822
823

824
825
826
827
828
829
830
831
832
833
834
808
809
810
811
812
813
814

815
816

817
818

819
820
821

822
823

824
825
826
827
828
829
830
831
832
833
834
835







-
+

-
+

-
+


-
+

-
+











    }}

    #
    # Invoke the scraper/converter engine.
    #
    make-man-pages $webdir \
	[list $tcltkdir/{$appdir}/doc/*.1 "$tcltkdesc Applications" UserCmd \
	     "The interpreters which implement $cmdesc."] \
	    "The interpreters which implement $cmdesc."] \
	[plus-base $build_tcl $tcldir doc/*.n {Tcl Commands} TclCmd \
	     "The commands which the <b>tclsh</b> interpreter implements."] \
	    "The commands which the <b>tclsh</b> interpreter implements."] \
	[plus-base $build_tk $tkdir doc/*.n {Tk Commands} TkCmd \
	     "The additional commands which the <b>wish</b> interpreter implements."] \
	    "The additional commands which the <b>wish</b> interpreter implements."] \
	{*}[plus-pkgs n {*}$packageBuildList] \
	[plus-base $build_tcl $tcldir doc/*.3 {Tcl C API} TclLib \
	     "The C functions which a Tcl extended C program may use."] \
	    "The C functions which a Tcl extended C program may use."] \
	[plus-base $build_tk $tkdir doc/*.3 {Tk C API} TkLib \
	     "The additional C functions which a Tk extended C program may use."] \
	    "The additional C functions which a Tk extended C program may use."] \
	{*}[plus-pkgs 3 {*}$packageBuildList]
} on error {msg opts} {
    # On failure make sure we show what went wrong. We're not supposed
    # to get here though; it represents a bug in the script.
    puts $msg\n[dict get $opts -errorinfo]
    exit 1
}

# Local-Variables:
# mode: tcl
# End: