TDBC

Check-in [b8fd487e3f]
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:Make stub table pointer a 'const'ant, because Tcl_LoadFile is the only function that is allowed to fill the table.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b8fd487e3fd0ad8629898ac13c80520e03341d01
User & Date: jan.nijtmans 2015-06-26 13:01:50
Context
2015-06-26
21:57
Fix [625f0ee464]: Disable writing to build-dir at install time. Thanks to Erik Leunissen for noticing that this copying to the top build directory is completely unnecessary. check-in: 7f0253a5c5 user: jan.nijtmans tags: trunk
13:01
Make stub table pointer a 'const'ant, because Tcl_LoadFile is the only function that is allowed to fill the table. check-in: b8fd487e3f user: jan.nijtmans tags: trunk
2015-06-15
10:09
Make sure that tdbc_LIB_DIR is always a canonical absolute path. Improve formatting in Makefile.in, adapted from latest sampleextension. check-in: 8a460b3726 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/genExtStubs.tcl.

1
2
3
4
5
6
7
8
9
10
11
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# genExtStubs.tcl --
#
#	Generates an import table for one or more external dynamic
#	link libraries.  
#
# Usage:
#
#	tclsh genExtStubs.tcl stubDefs.txt stubStruct.h stubInit.c
#
# Parameters:
#
................................................................................
#	stubDefs -- Name of the file to parse
#
# Results:
#
#	Returns a list of tuples. The possible tuples are:
#
#	    libraries NAME NAME...
#		Sets the names of the 
#	    prefix NAME
#	        Sets the name of the stub structure to NAME and prefixes
#		all the definitions of the stubbed routines with NAME
#	    import TYPE NAME PARAMS
#		Declares the imported routine NAME to return data of type
#		TYPE and accept parmeters PARAMS. 

proc parseImports {stubDefs} {

    set defsFile [open $stubDefs r]
    set imports {}
    set lineNo 0
    while {[gets $defsFile line] >= 0} {
................................................................................

    set structFile [open $stubStruct w]
    chan configure $structFile -translation lf
    writeStructHeader $stubDefs $stubStruct $structFile
    writeStubDeclarations $structFile $imports
    writeStructFooter $stubDefs $structFile
    set stubPrefix [writeStubDefines $structFile $imports]
    chan puts $structFile "MODULE_SCOPE [file rootname [file tail $stubDefs]]\
                           *${stubPrefix};"
    close $structFile

    # Write the initializations of the function names to import

    set initFile [open $stubInit r+]
    set initProgram [chan read $initFile]


|







 







|





|







 







|







1
2
3
4
5
6
7
8
9
10
11
..
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# genExtStubs.tcl --
#
#	Generates an import table for one or more external dynamic
#	link libraries.
#
# Usage:
#
#	tclsh genExtStubs.tcl stubDefs.txt stubStruct.h stubInit.c
#
# Parameters:
#
................................................................................
#	stubDefs -- Name of the file to parse
#
# Results:
#
#	Returns a list of tuples. The possible tuples are:
#
#	    libraries NAME NAME...
#		Sets the names of the
#	    prefix NAME
#	        Sets the name of the stub structure to NAME and prefixes
#		all the definitions of the stubbed routines with NAME
#	    import TYPE NAME PARAMS
#		Declares the imported routine NAME to return data of type
#		TYPE and accept parmeters PARAMS.

proc parseImports {stubDefs} {

    set defsFile [open $stubDefs r]
    set imports {}
    set lineNo 0
    while {[gets $defsFile line] >= 0} {
................................................................................

    set structFile [open $stubStruct w]
    chan configure $structFile -translation lf
    writeStructHeader $stubDefs $stubStruct $structFile
    writeStubDeclarations $structFile $imports
    writeStructFooter $stubDefs $structFile
    set stubPrefix [writeStubDefines $structFile $imports]
    chan puts $structFile "MODULE_SCOPE const [file rootname [file tail $stubDefs]]\
                           *${stubPrefix};"
    close $structFile

    # Write the initializations of the function names to import

    set initFile [open $stubInit r+]
    set initProgram [chan read $initFile]