80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
tailcall $command {*}$args
}
proc $command args [list apply [list {handle command} $body] $handle $command]
}
proc ::critcl::cheaders {header} {
set handle [::critcl::_allocateHandle]
$handle ccode "#include \"$header\""
}
proc ::critcl::csources {file} {
set handle [::critcl::_allocateHandle]
# Locate file relative to current script
set file [file join $::critcl::dir $file]
set fd [open $file]
$handle ccode [read $fd]
close $fd
}
proc ::critcl::cflags args {
set handle [::critcl::_allocateHandle]
$handle process_command_line [join $args " "]
}
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>
>
>
>
>
>
>
|
>
|
>
>
|
|
|
>
|
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
tailcall $command {*}$args
}
proc $command args [list apply [list {handle command} $body] $handle $command]
}
proc ::critcl::cheaders {args} {
set handle [::critcl::_allocateHandle]
foreach arg $args {
unset -nocomplain includeDir
if {[info exists nextArg]} {
set thisArg $nextArg
unset nextArg
set $thisArg $arg
}
switch -glob -- $arg {
"-I" {
set nextArg "includeDir"
}
"-I*" {
set includeDir [string trim [string range $arg 2 end]]
}
}
if {[info exists includeDir]} {
$handle add_include_path [file join $::critcl::dir $includeDir]
unset includeDir
continue
}
foreach header [glob -tails -nocomplain -directory $::critcl::dir -- $arg] {
$handle add_include_path [file join $::critcl::dir [file dirname $header]]
$handle ccode "#include \"$header\""
}
}
}
proc ::critcl::csources {file} {
set handle [::critcl::_allocateHandle]
if {![info exists ::critcl::csources]} {
set ::critcl::csources [list]
}
# Locate file relative to current script
foreach file [glob -nocomplain -directory $::critcl::dir -- $file] {
set fullFile [file normalize $file]
if {$fullFile in $::critcl::csources} {
continue
}
lappend ::critcl::csources $fullFile
set fd [open $file]
$handle ccode [read $fd]
close $fd
}
}
proc ::critcl::cflags args {
set handle [::critcl::_allocateHandle]
$handle process_command_line [join $args " "]
}
|