head	1.2;
access;
symbols
	tcllib-1-13:1.2
	tcllib-1-12:1.2
	tklib-0-5:1.2
	tcllib-1-11-1:1.2
	tcllib-1-11:1.2
	tcllib-1-10:1.2
	tcllib-1-9:1.2
	tcllib-1-8:1.2
	tcllib-1-7:1.2
	tcllib-1-6-1:1.1.2.1
	tcllib-1-6-branch:1.1.0.2
	tcllib-1-6:1.1
	tcllib-1-4-0:1.1;
locks; strict;
comment	@# @;


1.2
date	2004.03.09.08.20.19;	author andreas_kupries;	state Exp;
branches;
next	1.1;

1.1
date	2003.03.05.06.50.34;	author andreas_kupries;	state Exp;
branches
	1.1.2.1;
next	;

1.1.2.1
date	2004.05.24.02.58.10;	author andreas_kupries;	state Exp;
branches;
next	;


desc
@@


1.2
log
@Unified the startup header of all applications, using
suggestions made by Stuart Cassof <stwo@@telus.net>.
@
text
@#! /bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@@"}

rename source __source 
proc source {path} {
    set f [file join [pwd] $path]
    uplevel 1 __source $path
}


lappend auto_path [file dirname [file dirname [info script]]]
package require doctools::toc

# ---------------------------------------------------------------------
#  1. Handle command line options, input and output
#  2. Initialize a doctools object.
#  3. Run the input through the object.
#  4. Write output.
# ---------------------------------------------------------------------

proc usage {{exitstate 1}} {
    global argv0
    puts "Usage: $argv0\
	    ?-h|--help|-help|-??\
	    ?-help-fmt|--help-fmt?\
	    format in|- ?out|-?"
    exit $exitstate
}

# ---------------------------------------------------------------------

proc fmthelp {} {
    # Tcllib FR #527029: short reference of formatting commands.

    global argv0
    puts "$argv0 [doctools::toc::help]"
    exit 0
}

# ---------------------------------------------------------------------
# 1. Handle command line options, input and output

proc cmdline {} {
    global argv0 argv format in out

    set copyright ""
    set extmodule ""
    set deprecated 0

    while {[string match -* [set opt [lindex $argv 0]]]} {
	switch -exact -- $opt {
	    -help - -h - --help - -? {
		# Tcllib FR #527029
		usage 0
	    }
	    -help-fmt - --help-fmt {
		# Tcllib FR #527029
		fmthelp
	    }
	    default {
		# Unknown option
		usage
	    }
	}
    }

    if {[llength $argv] < 3} {
	usage
    }
    foreach {format in out} $argv break

    if {$format == {} || $in == {}} {
	usage
    }
    if {$out == {}} {set out -}
    return $format
}

# ---------------------------------------------------------------------
#  3. Read input. Also providing the namespace with file information.

proc get_input {} {
    global in
    if {[string equal $in -]} {
	return [read stdin]
    } else {
	set if [open $in r]
	set text [read $if]
	close $if
	return $text
    }
}

# ---------------------------------------------------------------------
# 4. Write output.

proc write_out {text} {
    global out
    if {[string equal $out -]} {
	puts -nonewline stdout $text
    } else {
	set of [open $out w]
	puts -nonewline $of $text
	close $of
    }
}


# ---------------------------------------------------------------------
# Get it all together

proc main {} {
    global format in

    #if {[catch {}
	cmdline

	::doctools::toc::new dt -format $format
	write_out [dt format [get_input]]

	set warnings [dt warnings]
	if {[llength $warnings] > 0} {
	    puts stderr [join $warnings \n]
	}

	#{} msg]} {}
	#puts stderr "Execution error: $msg"
    #{}
    return
}


# ---------------------------------------------------------------------
main
exit
@


1.1
log
@
	* A examples/doctools.idx:     Fairly extensive revamping of the
	* A examples/doctools.toc:     codebase. Added a format for
	* A mpformats/_idx_common.tcl: indices, formatting engines, a
	* A mpformats/_toc_common.tcl: package for handling it. Extended
	* A mpformats/idx.html:        all packages to allow engine
	* A mpformats/idx.nroff:       parameters and mapping from
	* A mpformats/idx.null:        symbolic to actual filenames or
	* A mpformats/idx.wiki:        urls. Right now only the HTML
	* A mpformats/toc.html:        engines actually provide
	* A mpformats/toc.nroff:       parameters. Added testsuites for
	* A mpformats/toc.null:        doctoc and docidx. Revamped the
	* A mpformats/toc.tmml:        documentation to cross-reference
	* A mpformats/toc.wiki:        each other better, more uniform in
	* A api_idx.tcl:               structure (not complete), naming of
	* A api_toc.tcl:               the manpages for this module is now
	* A checker_idx.tcl:           uniform. Added examples for doctoc
	* A checker_toc.tcl:           and docidx formats, both in the
	* A docidx.man:                manpages, and as separate files.
	* A docidx.tcl:
	* A docidx.test:
	* A docidx_api.man:
	* A docidx_fmt.man:
	* A doctoc.man:
	* A doctoc.tcl:
	* A doctoc.test:
	* A doctoc_api.man:
	* A doctoc_fmt.man:
	* A doctools_api.man:
	* A doctools_fmt.man:
	* A tocexpand:
	* M ChangeLog:
	* M NOTES:
	* M api.tcl:
	* M checker.tcl:
	* M doctools.man:
	* M doctools.tcl:
	* M doctools.test:
	* M pkgIndex.tcl:
	* M mpformats/_common.tcl:
	* M mpformats/_nroff.tcl:
	* M mpformats/c.msg:
	* M mpformats/de.msg:
	* M mpformats/en.msg:
	* M mpformats/fmt.html:
	* M mpformats/fmt.latex:
	* M mpformats/fmt.list:
	* R dtformat.man:
	* R dtformatter.man:
@
text
@d1 1
a1 1
#!/bin/sh
@


1.1.2.1
log
@Downgraded to version 1.3.6, removed -decode extension from
this branch.

Import of ftpd bugfix by Gerald Lester.

Last commit was a bad update, caused duplicates of changes
to appear. Failed testsuite. Removed all the duplicates now.

Fixed SF Tcllib Bug 954328. Mime now adapts at runtime to
whatever version of md5 has been loaded.

Updated test for rewritten adjust which fixed the infinite
looping demonstrated by tests 2.6 and 2.7. Also fixed a var
usage typo which caused a copy of the input to appear in the
output, before the expected formatted result.

Fixed bug in the processing of multi-word section titles for
text based formats.

Fixed bug 951568, regarding the usage of Trf's generic
transform.

Fixed problems with jpeg recognition (was unable to detect a
jpeg file, if it contained exif data).

Changelog for last patch, and updates in related package.

Completed application of code for various fixes.

Rewritten text adjustment and hyphenation, fixing SF TCllib
Bug 882402.

Fixed SF Tcllib Bug 936064, and evals more robust.

Fixed SF Tcllib Bug 893516

Fixed SF Tcllib Patch 763712

Fixed SF Tcllib Patch 758742

Fixed SF Tcllib Bug 620852

Eval usage made more robust and similar.

Fixed SF Tcllib Bug 943146.

Fixed SF Tcllib Bug 940651

SF Tcllib Bug 784519 fixed.

Pat: sak.tcl update for better use of critcl.

Joe: Fix in doctools xml support.

Import bugfix by Pat Thoyts, Handling of data starting with
hyphen/dash

Import of uuencode changes by Jeff Hobbs.

Changed defaults for package 'log'. No output for the all
levels below 'error'.

Unified the startup header of all applications, using
suggestions made by Stuart Cassof <stwo@@telus.net>.

Added testcase for Tcllib SF Bug 860753. The bug itself was
already fixed for Tcllib 1.6.

Fix for bug 899204. Test data file is opened read-only, and
tests made independent of each other.

Bugfix 899152, 899209. Require Tcl 8.2 for installer, delete
file before writing over it.

Import of time fix by Pat Thoyts, patch #905132.

Cleanup fix: Snit depends on Tcl 8.4, this is documented,
however neither package index, nor testsuite enforced the
restriction, allowing for errors. This has been changed now.

Fixed typos
@
text
@d1 1
a1 1
#! /bin/sh
@


