]> git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/c++-lib/inc/tcl-if.h
Security-28.tar.gz
[apple/security.git] / SecuritySNACCRuntime / c++-lib / inc / tcl-if.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
8 * using this file.
9 *
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
16 */
17
18
19 // file: .../c++-lib/inc/tcl-if.h
20 //
21 // $Header: /cvs/Darwin/Security/SecuritySNACCRuntime/c++-lib/inc/tcl-if.h,v 1.1.1.1 2001/05/18 23:14:06 mb Exp $
22 // $Log: tcl-if.h,v $
23 // Revision 1.1.1.1 2001/05/18 23:14:06 mb
24 // Move from private repository to open source repository
25 //
26 // Revision 1.3 2001/05/05 00:59:18 rmurphy
27 // Adding darwin license headers
28 //
29 // Revision 1.2 2000/06/15 18:48:25 dmitch
30 // Snacc-generated source files, now part of CVS tree to allow for cross-platform build of snaccRuntime.
31 //
32 // Revision 1.1.1.1 2000/03/09 01:00:05 rmurphy
33 // Base Fortissimo Tree
34 //
35 // Revision 1.1 1999/02/25 05:21:48 mb
36 // Added snacc c++ library
37 //
38 // Revision 1.5 1997/01/01 23:27:22 rj
39 // `typename' appears to be a reserved word in gcc 2.7, so prefix it with `_'
40 //
41 // Revision 1.4 1995/09/07 18:50:34 rj
42 // duplicate code merged into a new function SnaccTcl::gettypedesc().
43 //
44 // Revision 1.3 1995/08/17 15:06:43 rj
45 // snacced.[hC] renamed to tcl-if.[hC].
46 // class SnaccEd renamed to SnaccTcl.
47 //
48 // Revision 1.2 1995/07/27 09:53:25 rj
49 // comment leader fixed
50 //
51 // Revision 1.1 1995/07/27 09:52:12 rj
52 // new file: tcl interface used by snacced.
53
54 #ifdef DEBUG
55 #include <assert.h>
56 #endif
57
58 class SnaccTcl
59 {
60 Tcl_Interp *interp;
61 Tcl_HashTable modules,
62 types,
63 files;
64
65 Tcl_HashEntry *create();
66 const AsnTypeDesc *gettypedesc (const char *cmdname, const char *type_name);
67
68 public:
69 SnaccTcl (Tcl_Interp *);
70 ~SnaccTcl();
71
72 int create (int argc, char **argv);
73 int openfile (int argc, char **argv);
74 int finfo (int argc, char **argv);
75 int read (int argc, char **argv);
76 int write (int argc, char **argv);
77 int closefile (int argc, char **argv);
78
79 int modulesinfo (int argc, char **argv);
80 int typesinfo (int argc, char **argv);
81 int typeinfo (int argc, char **argv);
82 int info (int argc, char **argv);
83
84 int getval (int argc, char **argv);
85 int setval (int argc, char **argv);
86 int unsetval (int argc, char **argv);
87
88 int test (int argc, char **argv);
89
90 #ifdef DEBUG
91 void ckip (Tcl_Interp *i) { assert (i == interp); }
92 #endif
93 };
94
95 class ASN1File
96 {
97 const AsnTypeDesc *type;
98 AsnType *pdu;
99
100 char *fn;
101 int fd;
102 off_t filesize;
103
104 public:
105 ASN1File (const AsnTypeDesc *);
106 ASN1File (const AsnTypeDesc *, const char *fn, int fd);
107 virtual ~ASN1File();
108
109 bool bad();
110
111 operator AsnType * () { return pdu; }
112
113 int finfo (Tcl_Interp *);
114
115 int read (Tcl_Interp *, const char *fn=NULL);
116 int write (Tcl_Interp *, const char *fn=NULL);
117 };