Tcl Extension Architecture (TEA) Sample Extension

Check-in [71ae82d8f5]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

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

Overview
Comment:Zap trailing whitespace. No functional change. Fix wrong date in previous ChangeLog entry.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 71ae82d8f5548d61c1fcc8a8864d39065b47febf
User & Date: stwo 2012-08-02 04:02:50
Context
2012-08-03
07:03
Zap trailing whitespace. No functional change. DON'T use gnu tar; use normal tar. check-in: ff435aac8d user: stwo tags: trunk
2012-08-02
04:02
Zap trailing whitespace. No functional change. Fix wrong date in previous ChangeLog entry. check-in: 71ae82d8f5 user: stwo tags: trunk
2012-08-01
19:48
Tidy: Whitespace, formatting, spelling. No functional change. check-in: 3a392bec00 user: stwo tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.

1










2
3
4
5
6
7
8
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
...
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
...
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
...
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
2010-12-15  Stuart Cassoff  <[email protected]>











	* Makefile.in:	Tidy: Whitespace, formatting, spelling.
	* configure.in:	No functional change.

2012-08-01  Jan Nijtmans <[email protected]>

	* win/makefile.vc: Sync with latest Tcl 8.6 updates
................................................................................
	*** Tagged tea-3-branch to start TEA 4 development on HEAD ***

	* Makefile.in: separate PKG_ENV parts from TCLSH/WISH_ENV parts to
	better allow 8.4 and 8.5 core variant testing.

2007-05-11  Pat Thoyts  <[email protected]>

	* win/nmakehlp.c:  Added support for simple substitution of an 
	* win/makefile.vc: input file. This permits us to make use of
	pkgIndex.tcl.in style files without resorting to use of the tclsh
	we are building against -- when compiling for a foreign target (eg
	AMD64 from a ix86 host) we may not be able to run the
	tclsh. nmakehlp however must always be a native executable.

2007-05-03  Pat Thoyts  <[email protected]>
................................................................................
	yet create a stub library.

	* configure, tclconfig/tcl.m4: updated OpenBSD support based on
	[Patch #775246] (cassoff)

2003-12-08  Jeff Hobbs  <[email protected]>

	* generic/sample.c: 
	* generic/sample.h: updated for 64-bit correctness

2003-12-05  Jeff Hobbs  <[email protected]>

	* configure:
	* configure.in:
	* Makefile.in (VPATH): readd $(srcdir) to front of VPATH as the
................................................................................
	Broke TCLSH_PROG into TCLSH_ENV and TCLSH_PROG with TCLSH var and
	added comments about TCLSH_ENV.
	Added default shell and gdb targets.
	Added comments about using RUNTIME_SOURCES var.

	* README.cygwin: updated notes about using mingw gcc as a compiler.

	* configure: 
	* configure.in: updated to new TEA base that: prefixes all macros
	with TEA_* instead of SC_*; adds TEA_PREFIX, which defaults the
	prefix and exec_prefix values to what Tcl used; adds
	TEA_SETUP_COMPILER, which handles basic compiler / support program
	checks and simplifies the configure.in.

2002-04-01  Jeff Hobbs  <[email protected]>
................................................................................
2002-03-05  Jeff Hobbs  <[email protected]>

	* Makefile.in: removed unused @[email protected]  Cleaned up targets.  Added
	dist and dist-clean generic targets.  Improved use of OBJEXT.

	* configure.in: bumped package to 0.3, cleaned up macro usage.

	* README: 
	* README.cygwin: 
	* aclocal.m4:
	* configure (new):
	* install-sh, mkinstalldirs, tcl.m4 (removed): complete revamp to
	use the tclconfig updated TEA module

	* exampleA.c, sample.c:
	* exampleA.h, sample.h:
|
>
>
>
>
>
>
>
>
>
>







 







|







 







|







 







|







 







|
|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
...
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
...
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
...
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
2010-08-02  Stuart Cassoff  <[email protected]>

	* README.sha:		Zap trailing whitespace.
	* doc/sha1.n:		No functional change.
	* generic/sample.c:
	* generic/tclsample.c:
	* license.terms:
	* win/makefile.vc:
	* ChangeLog:		Fix wrong date in previous ChangeLog entry.

2010-08-01  Stuart Cassoff  <[email protected]>

	* Makefile.in:	Tidy: Whitespace, formatting, spelling.
	* configure.in:	No functional change.

2012-08-01  Jan Nijtmans <[email protected]>

	* win/makefile.vc: Sync with latest Tcl 8.6 updates
................................................................................
	*** Tagged tea-3-branch to start TEA 4 development on HEAD ***

	* Makefile.in: separate PKG_ENV parts from TCLSH/WISH_ENV parts to
	better allow 8.4 and 8.5 core variant testing.

2007-05-11  Pat Thoyts  <[email protected]>

	* win/nmakehlp.c:  Added support for simple substitution of an
	* win/makefile.vc: input file. This permits us to make use of
	pkgIndex.tcl.in style files without resorting to use of the tclsh
	we are building against -- when compiling for a foreign target (eg
	AMD64 from a ix86 host) we may not be able to run the
	tclsh. nmakehlp however must always be a native executable.

2007-05-03  Pat Thoyts  <[email protected]>
................................................................................
	yet create a stub library.

	* configure, tclconfig/tcl.m4: updated OpenBSD support based on
	[Patch #775246] (cassoff)

2003-12-08  Jeff Hobbs  <[email protected]>

	* generic/sample.c:
	* generic/sample.h: updated for 64-bit correctness

2003-12-05  Jeff Hobbs  <[email protected]>

	* configure:
	* configure.in:
	* Makefile.in (VPATH): readd $(srcdir) to front of VPATH as the
................................................................................
	Broke TCLSH_PROG into TCLSH_ENV and TCLSH_PROG with TCLSH var and
	added comments about TCLSH_ENV.
	Added default shell and gdb targets.
	Added comments about using RUNTIME_SOURCES var.

	* README.cygwin: updated notes about using mingw gcc as a compiler.

	* configure:
	* configure.in: updated to new TEA base that: prefixes all macros
	with TEA_* instead of SC_*; adds TEA_PREFIX, which defaults the
	prefix and exec_prefix values to what Tcl used; adds
	TEA_SETUP_COMPILER, which handles basic compiler / support program
	checks and simplifies the configure.in.

2002-04-01  Jeff Hobbs  <[email protected]>
................................................................................
2002-03-05  Jeff Hobbs  <[email protected]>

	* Makefile.in: removed unused @[email protected]  Cleaned up targets.  Added
	dist and dist-clean generic targets.  Improved use of OBJEXT.

	* configure.in: bumped package to 0.3, cleaned up macro usage.

	* README:
	* README.cygwin:
	* aclocal.m4:
	* configure (new):
	* install-sh, mkinstalldirs, tcl.m4 (removed): complete revamp to
	use the tclconfig updated TEA module

	* exampleA.c, sample.c:
	* exampleA.h, sample.h:

Changes to README.sha.

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
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
SHA1 is NIST's Secure Hashing Algorithm (also known as Secure Hashing
Standard) with the minor modification that they proposed on 7/11/94.

To make type:

      ./configure
      make 
      make install

The configure script will deduce $PREFIX from the tcl installation.
The generated Makefile uses the file $PREFIX/lib/tclConfig.sh that was left by
the make of tcl for most of its configuration parameters.

The Makefile generates pkgIndex.tcl files that are compatible with
tcl7.6.   If you are using tcl7.5 then you will need to edit 
$PREFIX/lib/pkgIndex.tcl by hand.

Usage:

      sha1 ?-log2base log2base? -string string

	or
................................................................................
      sha1 ?-log2base log2base? ?-copychan chanID? -chan chanID
	
	or

      sha1 -init (returns descriptor)
      sha1 -update descriptor ?-maxbytes n? ?-copychan chanID? -chan chanID
      sha1 ?-log2base log2base? -final descriptor
      

Switches can be in any order.

Returns a sha1 digest in base 2 ** log2base ascii representation.
log2base defaults to 4, i.e. hex representation.

       log2base   length   chars 
         1          160      01            (binary)
         2           80      0..3
         3           54      0...7         (octal)
         4           40      0..9a..f      (hex)
         5           32      0..9a..v      
         6           27      0..9a..zA..Z_, 

(The characters in the digest string have been chosen to be usable in 
filenames so that the sha1 command can be used, for example, 
to digest URLs into shorter strings for filenames in a cache.)

In the -string version, returns sha1 digest of string.

In the -chan version, returns list of 2 items: length of data
in chanID followed by sha1 digest of all data in chanID.  ChanID is
identifier returned from "open" for example.  If -copychan is supplied,






|







|







 







|






|




|
|

|
|







2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
..
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
SHA1 is NIST's Secure Hashing Algorithm (also known as Secure Hashing
Standard) with the minor modification that they proposed on 7/11/94.

To make type:

      ./configure
      make
      make install

The configure script will deduce $PREFIX from the tcl installation.
The generated Makefile uses the file $PREFIX/lib/tclConfig.sh that was left by
the make of tcl for most of its configuration parameters.

The Makefile generates pkgIndex.tcl files that are compatible with
tcl7.6.   If you are using tcl7.5 then you will need to edit
$PREFIX/lib/pkgIndex.tcl by hand.

Usage:

      sha1 ?-log2base log2base? -string string

	or
................................................................................
      sha1 ?-log2base log2base? ?-copychan chanID? -chan chanID
	
	or

      sha1 -init (returns descriptor)
      sha1 -update descriptor ?-maxbytes n? ?-copychan chanID? -chan chanID
      sha1 ?-log2base log2base? -final descriptor


Switches can be in any order.

Returns a sha1 digest in base 2 ** log2base ascii representation.
log2base defaults to 4, i.e. hex representation.

       log2base   length   chars
         1          160      01            (binary)
         2           80      0..3
         3           54      0...7         (octal)
         4           40      0..9a..f      (hex)
         5           32      0..9a..v
         6           27      0..9a..zA..Z_,

(The characters in the digest string have been chosen to be usable in
filenames so that the sha1 command can be used, for example,
to digest URLs into shorter strings for filenames in a cache.)

In the -string version, returns sha1 digest of string.

In the -chan version, returns list of 2 items: length of data
in chanID followed by sha1 digest of all data in chanID.  ChanID is
identifier returned from "open" for example.  If -copychan is supplied,

Changes to doc/sha1.n.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PP
.nf
       \fBlog2base   length    chars\fR
         1          160      01            \fI(binary)\fR
         2           80      0..3
         3           54      0...7         \fI(octal)\fR
         4           40      0..9a..f      \fI(hex)\fR
         5           32      0..9a..v      
         6           27      0..9a..zA..Z_, 
.fi
.PP
(The characters in the digest string have been chosen to be usable in
filenames so that the sha1 command can be used, for example, to digest URLs
into shorter strings for filenames in a cache.)
.PP
In the \fB\-string\fR version, returns sha1 digest alone of \fIstring\fR.






|
|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
.PP
.nf
       \fBlog2base   length    chars\fR
         1          160      01            \fI(binary)\fR
         2           80      0..3
         3           54      0...7         \fI(octal)\fR
         4           40      0..9a..f      \fI(hex)\fR
         5           32      0..9a..v
         6           27      0..9a..zA..Z_,
.fi
.PP
(The characters in the digest string have been chosen to be usable in
filenames so that the sha1 command can be used, for example, to digest URLs
into shorter strings for filenames in a cache.)
.PP
In the \fB\-string\fR version, returns sha1 digest alone of \fIstring\fR.

Changes to generic/sample.c.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 */

/*
 * SHA-1 in C
 * By Steve Reid <[email protected]>
 * 100% Public Domain
 * 
 * Test Vectors (from FIPS PUB 180-1)
 * "abc"
 *   A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
 *   84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
 * A million repetitions of "a"
 *   34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F






|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 *
 */

/*
 * SHA-1 in C
 * By Steve Reid <[email protected]>
 * 100% Public Domain
 *
 * Test Vectors (from FIPS PUB 180-1)
 * "abc"
 *   A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
 * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
 *   84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
 * A million repetitions of "a"
 *   34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F

Changes to generic/tclsample.c.

184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
	}
    }

    if (descriptorObj != NULL) {
	if ((sscanf(Tcl_GetString(descriptorObj), "sha1%d",
		&contextnum) != 1) || (contextnum >= numcontexts) ||
		(ctxtotalRead[contextnum] < 0)) {
	    Tcl_AppendResult(interp, "invalid sha1 descriptor \"", 
		    Tcl_GetString(descriptorObj), "\"", (char *) NULL);
	    return TCL_ERROR;
	}
    }

    if (doinit) {
	SHA1Init(&sha1Context);
................................................................................
    }
    return TCL_OK;

wrongArgs:
    Tcl_AppendResult (interp, "wrong # args: should be either:\n",
	    "  ",
	    Tcl_GetString(objv[0]),
	    " ?-log2base log2base? -string string\n", 
	    " or\n",
	    "  ",
	    Tcl_GetString(objv[0]),
	    " ?-log2base log2base? ?-copychan chanID? -chan chanID\n",
	    " or\n",
	    "  ",
	    Tcl_GetString(objv[0]),






|







 







|







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
	}
    }

    if (descriptorObj != NULL) {
	if ((sscanf(Tcl_GetString(descriptorObj), "sha1%d",
		&contextnum) != 1) || (contextnum >= numcontexts) ||
		(ctxtotalRead[contextnum] < 0)) {
	    Tcl_AppendResult(interp, "invalid sha1 descriptor \"",
		    Tcl_GetString(descriptorObj), "\"", (char *) NULL);
	    return TCL_ERROR;
	}
    }

    if (doinit) {
	SHA1Init(&sha1Context);
................................................................................
    }
    return TCL_OK;

wrongArgs:
    Tcl_AppendResult (interp, "wrong # args: should be either:\n",
	    "  ",
	    Tcl_GetString(objv[0]),
	    " ?-log2base log2base? -string string\n",
	    " or\n",
	    "  ",
	    Tcl_GetString(objv[0]),
	    " ?-log2base log2base? ?-copychan chanID? -chan chanID\n",
	    " or\n",
	    "  ",
	    Tcl_GetString(objv[0]),

Changes to license.terms.

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal 
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license. 






|







|
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
MODIFICATIONS.

GOVERNMENT USE: If you are acquiring this software on behalf of the
U.S. government, the Government shall have only "Restricted Rights"
in the software and related documentation as defined in the Federal
Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
are acquiring the software on behalf of the Department of Defense, the
software shall be classified as "Commercial Computer Software" and the
Government shall have only "Restricted Rights" as defined in Clause
252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
authors grant the U.S. Government and others acting in its behalf
permission to use and distribute the software in accordance with the
terms specified in this license.

Changes to win/makefile.vc.

1
2
3
4
5
6
7
8
9
10
11
12
13
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#------------------------------------------------------------- -*- makefile -*-
# makefile.vc --
#
#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
#
# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to 
# make it suitable as a general package makefile. Look for the word EDIT
# which marks sections that may need modification. As a minumum you will
# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
# relevant to your package.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
................................................................................
DLLOBJS = \
	$(TMP_DIR)\tclsample.obj \
	$(TMP_DIR)\sample.obj \
!if !$(STATIC_BUILD)
	$(TMP_DIR)\sample.res
!endif

PRJHEADERS = 

#-------------------------------------------------------------------------
# Target names and paths ( shouldn't need changing )
#-------------------------------------------------------------------------

BINROOT		= .
ROOT            = ..




|







 







|







1
2
3
4
5
6
7
8
9
10
11
12
13
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
#------------------------------------------------------------- -*- makefile -*-
# makefile.vc --
#
#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
#
# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to
# make it suitable as a general package makefile. Look for the word EDIT
# which marks sections that may need modification. As a minumum you will
# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
# relevant to your package.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
................................................................................
DLLOBJS = \
	$(TMP_DIR)\tclsample.obj \
	$(TMP_DIR)\sample.obj \
!if !$(STATIC_BUILD)
	$(TMP_DIR)\sample.res
!endif

PRJHEADERS =

#-------------------------------------------------------------------------
# Target names and paths ( shouldn't need changing )
#-------------------------------------------------------------------------

BINROOT		= .
ROOT            = ..