1# -*- tcl -*- uuencode.pcx
2# Syntax of the commands provided by package uuencode.
3#
4# For use by TclDevKit's static syntax checker.
5# See http://www.activestate.com/solutions/tcl/
6# See http://aspn.activestate.com/ASPN/docs/Tcl_Dev_Kit/4.0/Checker.html#pcx_api
7# for the documentation describing the format of the code contained in this file
8#
9
10package require pcx
11pcx::register uuencode
12pcx::tcldep   1.1.4 needs tcl 8.2
13
14namespace eval ::uuencode {}
15
16# Using the indirections below looks to be quite pointless, given that
17# they simply substitute the commands for others. I am doing this for
18# two reasons.
19
20# First, the rules coming after become self-commenting, i.e. a
21# maintainer can immediately see what an argument is supposed to be,
22# instead of having to search elsewhere (like the documentation and
23# implementation). In this manner our definitions here are a type of
24# semantic markup.
25
26# The second reason is that while we have no special checks now we
27# cannot be sure if such will (have to) be added in the future. With
28# all checking routed through our definitions we now already have the
29# basic infrastructure (i.e. hooks) in place in which we can easily
30# add any new checks by simply redefining the relevant command, and
31# all the rules update on their own. Mostly. This should cover 90% of
32# the cases. Sometimes new checks will require to create deeper
33# distinctions between different calls of the same thing. For such we
34# may have to update the rules as well, to provide the necessary
35# information to the checker.
36
37interp alias {} uuencode::checkMode        {} checkWord ; #
38interp alias {} uuencode::checkDstFilename {} checkWord ; #
39interp alias {} uuencode::checkData        {} checkWord ; #
40
41#pcx::message FOO {... text ...} type
42#pcx::scan <VERSION> <NAME> <RULE>
43
44pcx::check 1.1.4 std ::uuencode::uudecode \
45    {checkConstrained {checkSimpleArgs 1 -1 {
46	{checkSwitches 1 {
47	    {-filename {checkSetConstraint hasfilename checkFileName}}
48	    --
49	} {checkConstraint {
50	    {hasfilename  {checkSimpleArgs 0 0 {}}}
51	    {!hasfilename {checkSimpleArgs 1 1 {
52		uuencode::checkData
53	    }}}
54	} {}}}
55    }}}
56# TODO: Limit -mode to a octal numbers (file permissions)
57pcx::check 1.1.4 std ::uuencode::uuencode \
58    {checkConstrained {checkSimpleArgs 1 -1 {
59	{checkSwitches 1 {
60	    {-filename {checkSetConstraint hasfilename checkFileName}}
61	    {-mode     uuencode::checkMode}
62	    {-name     uuencode::checkDstFilename}
63	    --
64	} {checkConstraint {
65	    {hasfilename  {checkSimpleArgs 0 0 {}}}
66	    {!hasfilename {checkSimpleArgs 1 1 {
67		uuencode::checkData
68	    }}}
69	} {}}}
70    }}}
71
72# Initialization via pcx::init.
73# Use a ::uuencode::init procedure for non-standard initialization.
74pcx::complete
75