/usr/share/tcltk/stubs/gen_macro.tcl is in critcl 3.1.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 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 | # -*- tcl -*-
# STUBS handling -- Code generation: Writing the stub macros.
#
# (c) 2011 Andreas Kupries http://wiki.tcl.tk/andreas%20kupries
# A stubs table is represented by a dictionary value.
# A gen is a variable holding a stubs table value.
# # ## ### ##### ######## #############
## Requisites
package require Tcl 8.4
package require stubs::gen
package require stubs::container
package require lassign84
namespace eval ::stubs::gen::macro::g {
namespace import ::stubs::gen::*
}
namespace eval ::stubs::gen::macro::c {
namespace import ::stubs::container::*
}
# # ## ### ##### ######## #############
## Implementation.
proc ::stubs::gen::macro::multiline {{flag 1}} {
variable multiline $flag
return $flag
}
proc ::stubs::gen::macro::gen {table name} {
set upName [string toupper [string map {:: _} [c::library? $table]]]
set sguard "defined(USE_${upName}_STUBS)"
append text "\n#if $sguard\n"
append text "\n/*\n * Inline function declarations:\n */\n\n"
append text [g::forall $table $name [namespace current]::Make 0]
append text "\n#endif /* $sguard */\n"
return $text
}
# # ## ### #####
## Internal helpers.
proc ::stubs::gen::macro::Make {name decl index} {
variable multiline
#puts "MACRO($name $index) = |$decl|"
lassign $decl rtype fname args
set capName [g::uncap $fname]
append text "#define $fname "
if {$multiline} { append text "\\\n\t" }
append text "("
if {![llength $args]} { append text "*" }
append text "${name}StubsPtr->$capName)"
append text " /* $index */\n"
return $text
}
# # ## ### #####
namespace eval ::stubs::gen::macro {
#checker exclude warnShadowVar
variable multiline 1
namespace export gen multiline
}
# # ## ### ##### ######## #############
package provide stubs::gen::macro 1
return
|