| |
469 |
469 |
set nrIfds [expr {[llength $ifds]+1}] |
| |
470 |
470 |
puts [subst -nocommands { |
| |
471 |
471 |
/* just to define the symbol */ |
| |
472 |
472 |
static Nsf_methodDefinition method_definitions[$nrIfds]; |
| |
473 |
473 |
}] |
| |
474 |
474 |
|
| |
475 |
475 |
set namespaces [list] |
| |
476 |
476 |
foreach {key value} [array get ::ns] { |
| |
477 |
477 |
# no need to create the ::nsf namespace |
| |
478 |
478 |
if {$value eq "::nsf"} continue |
| |
479 |
479 |
lappend namespaces "\"$value\"" |
| |
480 |
480 |
} |
| |
481 |
481 |
set namespaceString [join $namespaces ",\n "] |
| |
482 |
482 |
puts "static const char *method_command_namespace_names\[\] = {\n $namespaceString\n};" |
| |
483 |
483 |
puts $stubDecls |
| |
484 |
484 |
puts $decls |
| |
485 |
485 |
set enumString [join $enums ",\n "] |
| |
486 |
486 |
puts "enum {\n $enumString\n} NsfMethods;\n" |
| |
487 |
487 |
puts $fns |
| |
488 |
488 |
set definitionString [join $ifds ",\n"] |
| |
489 |
|
puts "static Nsf_methodDefinition method_definitions\[$nrIfds\] = \{\n$definitionString,\{NULL\}\n\};\n" |
| |
|
489 |
set terminator {NULL, NULL, 0, {{NULL, 0, 0, ConvertToNothing, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}} |
| |
|
490 |
puts "static Nsf_methodDefinition method_definitions\[$nrIfds\] = \{\n$definitionString,\n{$terminator}\n\};\n" |
| |
490 |
491 |
} |
| |
491 |
492 |
|
| |
492 |
493 |
proc methodDefinition {methodName methodType implementation parameterDefinitions options} { |
| |
493 |
494 |
array set opts [list -ns $::ns($methodType) -nxdoc 0 -objv0 0] |
| |
494 |
495 |
array set opts $options |
| |
495 |
496 |
set d(methodName) $methodName |
| |
496 |
497 |
set d(implementation) $implementation |
| |
497 |
498 |
set d(stub) ${implementation}Stub |
| |
498 |
499 |
set d(idx) ${implementation}Idx |
| |
499 |
500 |
set d(methodType) $methodType |
| |
500 |
501 |
set d(ns) $opts(-ns) |
| |
501 |
502 |
set d(options) [array get opts] |
| |
502 |
503 |
switch $methodType { |
| |
503 |
504 |
classMethod {set d(clientData) class} |
| |
504 |
505 |
objectMethod {set d(clientData) object} |
| |
505 |
506 |
default {set d(clientData) ""} |
| |
506 |
507 |
} |
| |
507 |
508 |
set completed [list] |
| |
508 |
509 |
foreach parameterDefinition $parameterDefinitions { |
| |
509 |
510 |
array unset "" |