Tcl Extension Architecture (TEA) Sample Extension

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

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

Overview
Comment:nmakehlp: Add "-V<num>" option, in order to be able to detect partial version numbers
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8a099dbcebae2a09eca262613a16222a8cf1bae2
User & Date: jan.nijtmans 2012-08-17 10:35:15
Context
2013-03-01
14:10
sync with latest version from Tcl 8.6 check-in: abacf662e3 user: jan.nijtmans tags: trunk
2012-08-17
10:35
nmakehlp: Add "-V<num>" option, in order to be able to detect partial version numbers check-in: 8a099dbceb user: jan.nijtmans tags: trunk
2012-08-12
07:15
update to latest TEA Remove some unused code Always set USE_THREAD_ALLOC in combination with TCL_THREADS check-in: 93359838d0 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.






1
2
3
4
5
6
7
8
9
10
11
12
13





2012-08-12  Jan Nijtmans <nijtmans@users.sf.net>

	* configure:	Regenerated to use latest TEA tcl.m4.
	* win/rules.vc: Remove some unused code, always set
	USE_THREAD_ALLOC in combination with TCL_THREADS
	

2010-08-03  Stuart Cassoff  <stwo@users.sourceforge.net>

	* ChangeLog:		Zap trailing whitespace.
	* README.sha:		No functional change.
	* win/nmakehlp.c:
	* Makefile.in:		DON'T use gnu tar; use normal tar.
>
>
>
>
>





<







1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
2012-08-17  Jan Nijtmans  <nijtmans@users.sf.net>

	* win/nmakehlp.c: Add "-V<num>" option, in order to be able
	to detect partial version numbers.

2012-08-12  Jan Nijtmans <nijtmans@users.sf.net>

	* configure:	Regenerated to use latest TEA tcl.m4.
	* win/rules.vc: Remove some unused code, always set
	USE_THREAD_ALLOC in combination with TCL_THREADS


2010-08-03  Stuart Cassoff  <stwo@users.sourceforge.net>

	* ChangeLog:		Zap trailing whitespace.
	* README.sha:		No functional change.
	* win/nmakehlp.c:
	* Makefile.in:		DON'T use gnu tar; use normal tar.

Changes to win/nmakehlp.c.

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
475
476
477
478
479
480
481
482

483
484
485
486
487
488
489
...
505
506
507
508
509
510
511
512

513
514
515
516
517
518
519
/* protos */

static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char *option);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static const char *GetVersionFromFile(const char *filename, const char *match);
static DWORD WINAPI ReadFromPipe(LPVOID args);

/* globals */

#define CHUNK	25
#define STATICBUFFERSIZE    1000
typedef struct {
................................................................................
		    "Extract a version from a file:\n"
		    "eg: pkgIndex.tcl \"package ifneeded http\"",
		    argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 0;
	    }
	    printf("%s\n", GetVersionFromFile(argv[2], argv[3]));
	    return 0;
	case 'Q':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
		    "usage: %s -Q path\n"
		    "Emit the fully qualified path\n"
		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
................................................................................
 * 	following the match where a version is anything acceptable to
 * 	package provide or package ifneeded.
 */

static const char *
GetVersionFromFile(
    const char *filename,
    const char *match)

{
    size_t cbBuffer = 100;
    static char szBuffer[100];
    char *szResult = NULL;
    FILE *fp = fopen(filename, "rt");

    if (fp != NULL) {
................................................................................
		}

		/*
		 * Find ending whitespace.
		 */

		q = p;
		while (*q && (isalnum(*q) || *q == '.')) {

		    ++q;
		}

		memcpy(szBuffer, p, q - p);
		szBuffer[q-p] = 0;
		szResult = szBuffer;
		break;







|







 







|







 







|
>







 







|
>







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
...
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
...
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
/* protos */

static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char *option);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);

/* globals */

#define CHUNK	25
#define STATICBUFFERSIZE    1000
typedef struct {
................................................................................
		    "Extract a version from a file:\n"
		    "eg: pkgIndex.tcl \"package ifneeded http\"",
		    argv[0]);
		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
		    &dwWritten, NULL);
		return 0;
	    }
	    printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
	    return 0;
	case 'Q':
	    if (argc != 3) {
		chars = snprintf(msg, sizeof(msg) - 1,
		    "usage: %s -Q path\n"
		    "Emit the fully qualified path\n"
		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
................................................................................
 * 	following the match where a version is anything acceptable to
 * 	package provide or package ifneeded.
 */

static const char *
GetVersionFromFile(
    const char *filename,
    const char *match,
    int numdots)
{
    size_t cbBuffer = 100;
    static char szBuffer[100];
    char *szResult = NULL;
    FILE *fp = fopen(filename, "rt");

    if (fp != NULL) {
................................................................................
		}

		/*
		 * Find ending whitespace.
		 */

		q = p;
		while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
			    && (!strchr("ab", q[-1])) || --numdots))) {
		    ++q;
		}

		memcpy(szBuffer, p, q - p);
		szBuffer[q-p] = 0;
		szResult = szBuffer;
		break;