summaryrefslogtreecommitdiffstats
path: root/tcllib/modules/fumagic/fileutil_magic_rt.pcx
blob: 9dc45d1face1184bd4ba616091f42e09d33c9c7a (plain)
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
75
76
77
78
79
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
# -*- tcl -*- fileutil::magic::rt.pcx
# Syntax of the commands provided by package fileutil::magic::rt.
#
# For use by TclDevKit's static syntax checker (v4.1+).
# See http://www.activestate.com/solutions/tcl/
# See http://aspn.activestate.com/ASPN/docs/Tcl_Dev_Kit/4.0/Checker.html#pcx_api
# for the specification of the format of the code in this file.
#

package require pcx
pcx::register fileutil::magic::rt
pcx::tcldep   1.0 needs tcl 8.4

namespace eval ::fileutil::magic::rt {}

#pcx::message FOO {... text ...} type
#pcx::scan <VERSION> <NAME> <RULE>

pcx::check 1.0 std ::fileutil::magic::rt::I \
    {checkSimpleArgs 3 3 {
	checkWholeNum
	fileutil::magic::rt::checkType
	checkInt
    }}
pcx::check 1.0 std ::fileutil::magic::rt::L \
    {checkSimpleArgs 1 1 {
	checkWholeNum
    }}
pcx::check 1.0 std ::fileutil::magic::rt::N \
    {checkSimpleArgs 4 5 {
	fileutil::magic::rt::checkType
	checkWholeNum
	{checkKeyword 1 {x < > <= >= == !=}}
	checkInt
	checkWord
    }}
# TODO: syntax of qualifiers.
pcx::check 1.0 std ::fileutil::magic::rt::Nv \
    {checkSimpleArgs 2 3 {
	fileutil::magic::rt::checkType
	checkWholeNum
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::Nvx \
    {checkSimpleArgs 3 4 {
	checkWholeNum
	fileutil::magic::rt::checkType
	checkWholeNum
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::Nx \
    {checkSimpleArgs 5 6 {
	checkWholeNum
	fileutil::magic::rt::checkType
	checkWholeNum
	{checkKeyword 1 {x < > <= >= == !=}}
	checkInt
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::R \
    {checkSimpleArgs 1 1 {
	checkWholeNum
    }}
pcx::check 1.0 std ::fileutil::magic::rt::S \
    {checkSimpleArgs 3 4 {
	checkWholeNum
	{checkKeyword 1 {x < > <= >= == !=}}
	checkInt
	checkWord

    }}
pcx::check 1.0 std ::fileutil::magic::rt::Sx \
    {checkSimpleArgs 4 -5 {
	checkWholeNum
	checkWholeNum
	{checkKeyword 1 {x < > <= >= == !=}}
	checkInt
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::close \
    {checkAtEnd}
# TODO: check string for the special placeholders
pcx::check 1.0 std ::fileutil::magic::rt::emit \
    {checkSimpleArgs 1 1 {
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::file_start \
    {checkSimpleArgs 1 1 {
	checkWord
    }}
# TODO: syntax of complex offsets.
pcx::check 1.0 std ::fileutil::magic::rt::offset \
    {checkSimpleArgs 1 1 {
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::open \
    {checkSimpleArgs 1 1 {
	checkFileName
    }}
# TODO: check string for the special placeholders
pcx::check 1.0 std ::fileutil::magic::rt::result \
    {checkSimpleArgs 0 1 {
	checkWord
    }}
pcx::check 1.0 std ::fileutil::magic::rt::resultv \
    {checkSimpleArgs 0 1 {
	checkWord
    }}

proc fileutil::magic::rt::checkType {t i} {
    return [checkKeyword 1 {c s S i I Q Y date bedate ledate ldatebeldate leldate byte short beshort leshort long belong lelong ubyte ushort ubeshort uleshort ulong ubelong ulelong} $t $i]
}

# Initialization via pcx::init.
# Use a ::fileutil::magic::rt::init procedure for non-standard initialization.
pcx::complete