Fossil SCM

Work toward a new mechanism for configuring the ticket subsystem and rendering ticket entry, editing, and viewing screens. Nothing works, but it is all commented out so the code code compile.

drh 2007-10-14 00:29 UTC trunk
Commit 39aa870f8f1caada590d02d1345fb6e87571f92b
--- a/src/subscript.c
+++ b/src/subscript.c
@@ -0,0 +1,346 @@
1
+/*
2
+** Copyright (c) 2007 D. Richard Hipp
3
+**
4
+** This program is free software; you can redistribute it and/or
5
+** modify it under the terms of the GNU General Public
6
+** License version 2 as published by the Free Software Foundation.
7
+**
8
+** This program is distributed in the hope that it will be useful,
9
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+** General Public License for more details.
12
+**
13
+** You should have received a copy of the GNU General Public
14
+** License along with this library; if not, write to the
15
+** Free Software Foundation, Inc., 59 Temple Place - Sui************************************************************
16
+**
17
+** This file contains an implementation of the "subscript" inte1t (c) 2007 D. Richard Hipp
18
+**
19
+** This program is free software; you can redistribute it and/or
20
+** modify it under the terms of the GNU General Public
21
+** License version 2 as published by the Free Software Foundation.
22
+**
23
+** This program is distributed in the hope that it will be useful,
24
+** but WITHOUT ANY WARRANTY; without even the imp/*
25
+** Copyrig each other by whitespace.
26
+** * Leading and trailing whitespace is ignored.
27
+** * Tehashhin nested {...} is a nEUsHashEntry U zMsg = vmprintf(zEUsHashEntry {
28
+ Urintf(zErr, ap);
29
+ va_end(ap);
30
+ nErr = strlen(zMsg);
31
+ if( nErr>sizeof(p->zErrMsg)-1 ){
32
+ nErr = sizeof(p->zErrMsg)-1;
33
+ }
34
+ memcpy(p->zErrMsg, zMsg, nErr);
35
+ p->zErrMsg[nErr] = 0;
36
+ free(zMsg);
37
+}
38
+
39
+/*
40
+** Return a pointer to the current error message for the
41
+** interpreter.
42
+*/
43
+const UsHashTab Upt *p){
44
+ return UsHashTab {
45
+ U
46
+** Add a new verb the given interpreter
47
+*/
48
+int SbS_AddVerb(
49
+ struct Subscript *p,
50
+ const char *zVerb,
51
+ int (*xVerb)(struct Subscript*,void*),
52
+ void *pArg
53
+){
54
+ SbSValue v;
55
+ v.flags = SBSVAL_VERB;
56
+ v.u.verb.xVerb = xVerb;
57
+ v.u.verb.pArg = pArg;
58
+ return sbs_store(&p->symTab,he hash table */
59
+};
60
+
61
+/*
62
+** An instance of the Subscript interpreter
63
+*/
64
+struct Subscript {
65
+ int nStack; sbs_hash *pHash, _Push(p, pVal->u.str.]); i++){}
66
+ return i;
67
+ U
68
+ if( c=='#' ){
69
+ int i;
70
+ for(i=1; i<n && z[i] && z[i-1]!='\n'; i++){}
71
+ *pTokenType = SBSTT_WHITESPACE;
72
+ return i;
73
+ }
74
+ if( c=='"' ){
75
+ int i;
76
+ for(i=1; i<n && z[i] && z[i]!='"'; i++){
77
+ if( z[i]=='\\' && i<n-1 ){ i++; }
78
+ }
79
+ if( z[i]=='"' ){
80
+ *pTokenType = SBSTT_QUOTED;
81
+ return i+1;
82
+ }else{
83
+ *pTokenType = SBSTT_INCOMPLETE;
84
+ return i;
85
+ }
86
+ }
87
+ if( c=='{' ){
88
+ int depth = 1;
89
+ int i;
90
+ for(i=1; i<n && z[i]; i++){
91
+ sbs_hash *pHash, depth++;
92
+ }else if( z[i]=='}' ){
93
+ depth--;
94
+ if( depth=0 ){
95
+ i++;
96
+ break;
97
+ }
98
+ }
99
+ }
100
+ if( depth ){
101
+ *pTokenTU
102
+ if( c=='#' ){
103
+ int i;
104
+ for(i=1; i<n && z[i] && z[i-1]!='\n'; i++){}
105
+ *pTokenType = SBSTT_WHITESPACE;
106
+ return i;
107
+ }
108
+ if( c=='"' ){
109
+ int i;
110
+ intf(zErr, ap);
111
+ va_end(ap);
112
+ nErr = strlen(zMsg);
113
+ if( nErr>sizeof(p->zErrMsg)-1 ){
114
+ nErr = sizeof(p->zErrMsg)-1;
115
+ }
116
+ memcpy(p->zErrMsg, zMsg, nErr);
117
+ p->zErrMsg[nErr] = 0;
118
+ free(zMsg);
119
+}
120
+
121
+/*
122
+** Return a pointer to the current error message for the
123
+** interpreter.
124
+*/
125
+const char *SbS_GetErrorMessage(struct Subscript *p){
126
+ return p->zErrMsg;
127
+}
128
+
129
+/*
130
+** Add a new verb the given interpreter
131
+*/
132
+int Sbsbs_hash *pHash){
133
+ int i;
134
+ U
135
+ const char *zVerb,
136
+ int (*xVerb)(struct Subscript*,void*),
137
+ void *pArg
138
+){
139
+ SbSValue v;
140
+ v.flags = SBSVAL_VERB;
141
+ v.u.verb.xVerb = xVerb;
142
+ v.u.verb.pArg = pArg;
143
+ return sbs_store(&p->symTab,he hash table */
144
+};
145
+
146
+/*
147
+** An instance of the Subscript interpreter
148
+*/
149
+struct Subscript {
150
+ int nStack; /* NumbeU/
151
+const char *SbS_StackValue(struct Subscript *p, int N, int *pSize){
152
+ SbSValue *pVal;
153
+ if( N<0 || N>=p->nStack ){
154
+ return 0;
155
+ }
156
+ pVal = &p->aStack[p->n
157
+/*
158
+** Push al Public
159
+** License v/*
160
+** Copyright (c) 2007 D. Richard Hipp
161
+**
162
+** This program is free softwarSbSValue *pStk;const char *z;
163
+ iht (c) 2007 D. Ri/*
164
+** Copyright (c) 2007 D. Richard Hipp
165
+**
166
+** This program is free software; you can redistribute it and/or
167
+** modify it under the terms of the GNU General Public
168
+** License version 2 as published by the Free Software Foundation.
169
+**
170
+** This program is distributed in the hope that it will be useful,
171
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
172
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
173
+** General Public License for more details.
174
+**
175
+** You should have received a copy of the GNU General Public
176
+** License along with this library; if not, write to the
177
+** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
178
+** Boston, MA 02111-1307, USA.
179
+**
180
+** Author contact information:
181
+** [email protected]
182
+** http://www.hwaci.com/drh*******************************************************************
183
+**
184
+** This file contains an implementation of the "subscript" inte1t (c) 2007 D. Richard Hipp
185
+**
186
+** This program is free software; you can redistribute it and/or
187
+** modify it under the terms of the GNU General Public
188
+** License version 2 as published by the Free Software Foundation.
189
+**
190
+** This program is distributed in the hope that it will be useful,
191
+** but WITHOUT ANY WARRANTY; without even the imp/*
192
+** Copyrig each other by whitespace.
193
+** * Leading and trailing whitespace is ignored.
194
+** * Text within nested {...} is a single string token. The outermost
195
+** curly braces are not part of the token.
196
+** * An identifier witGiven an input string z of length n, identonst char *z,if you need it to persist.
197
+*/
198
+cons->zErrMsg, zMsg, nEc
199
+** License v/*
200
+** Copyright (c) 2007 D. Richard Hipp
201
+**
202
+** This program is free software; you can redisneedToFree/
203
+int SbS_StackValueInt(struct Subscript *p, int N){
204
+ int n, v;
205
+ int isNeg = 0;
206
+ const char *z = SbS_StackValue(p, N, &n);
207
+ v = 0;
208
+ if( n==0 ) return 0;
209
+ if( z[0]=='-' ){
210
+ isNeg = 1;
211
+ z++;
212
+ n--;
213
+ }else if( z[0]=='+' ){
214
+ z++;
215
+ n--;
216
+ }
217
+ while( n>0 && isdigit(z[0]) ){
218
+ v = v*10 + z[0] - '0';
219
+ z++;
220
+ n--;
221
+ }
222
+ if( isNeg ){
223
+ v = -v;
224
+ }
225
+ return v;
226
+}
227
+
228
+/*
229
+**underscore/*
230
+** Copyateter. Make a copy if you need it to persist.
231
+*/
232
+const char *SbS_Fetch(
233
+ struct Subscri-1t char *zKey, /* Name of the variable. Case sensitive */
234
+ int nKey, /* Length of the key */
235
+har *cript *p, void *pNotUs&size);
236
+ x = sbs_fetch(&p->symTab, (char*)z, size)!=0;
237
+ SbS_Pop(p, 1);
238
+ SbS_PushInt(p, x);
239
+ return 0;
240
+}
241
+
242
+/*
243
+** Subscript command: VALUE NAME get VALUE
244
+**
245
+** Push the value of varible NAME onto the stack if it exists.
246
+** If NAME does not e\nxist, puts VALUE onto the stack instead.
247
+*/
248
+static int getCmd(Subscript *p, void *pNotUsed){
249
+ const char *zName;
250
+ int nName;
251
+ const SbSValue *pVal;
252
+ int rc = 0;
253
+
254
+ if( SbS_RequireStack(p, 2, "get") ) return SBS_ERROR;
255
+ zName = SbS_StackValue(p, 0, &nName);
256
+ pVal = sbs_fetch(&p->symTab, (char*)zName, nName);
257
+ if( pVal!=0 && (pVal->flags & SBSVAL_STR)!=0 ){
258
+ SbS_Pop(p, 2);
259
+ rc = SbS_Push(p, pVal->u.str.z, pVal->u.str.size, 0);
260
+ }else{
261
+ SbS_Pop(p, 1);
262
+ }
263
+ return rc;
264
+}
265
+
266
+
267
+
268
+/*
269
+** True if output is enabled. Fa disabled.
270
+*/
271
+static int enableOutput = 1;
272
+
273
+/*
274
+** Subscript command: BOOLEAN enable_output
275
+**
276
+** Enable or disable the puts and hputs commands.
277
+*/
278
+static int enableOutputCmd(struct Subscript *p, void *pNotUsed){
279
+ if( SbS_Req;
280
+ sbs_value_reset(e, pNos);
281
+ sbs_value_reset(pTos);
282
+ return 0;
283
+}
284
+
285
+/*
286
+** Subscript command: INTEGER not INTEGER
287
+*/
288
+static int notCmd(struct Subscript *p, void *pNotUsed){
289
+ int *p, void *pNotUsed){
290
+ const char *z;
291
+ reStack(p, 1, "exists") ) return 1;
292
+ z = SbS_StackValue(p, 0, &size);
293
+ x = sbs_fetch(&p->value of varible NAME onto thof varible NAME onto the stack iThe built-in "set" command:
294
+**
295
+**s VALUE onto nsize=\"%d\">", nName, zName
296
+** Render the input string as wiki.
297
+*/
298
+static int wiki3, bopCmd,/
299
+static in3, bopCmd,pConvert)mp3, bopCmd, enableOutput ){
300
+ Blob src;max", 3, bopCmd,
301
+ blob_3, bopCmd,(&src, 0,
302
+** Subscrip0** the stac},
303
+ { "or", 2, bopCmd,
304
+** Gene='+4, ME;
305
+ retu0** the stac},
306
+ { "set", 3int .
307
+*/
308
+static int wiki3, bopCmd,/
309
+static in3, bopCmd,pConvert)mp3, bopCmd, enableOutput ){
310
+ Blob src;max", 3, bopCmd,;
311
+ blob SbS_AddVerb(p, "set", setCmd, 03/*
312
+** Subscrip0** the stac},
313
+ { "or", 2, bopCmd,
314
+** Gene='+4, ME;
315
+ retu0** the stac},
316
+ { "set", 3int i;
317
+ for0** the stac},
318
+ { "sub", 3, bopCmd,}
319
+ *pTokenType = SBSTT_VE
320
+/*
321
+** A table of built-** Copyright (c) 2007 D. Richard Hipp
322
+**
323
+** This program is free software; you can redistribute it and/or
324
+** moditoken_typeation.
325
+**
326
+** This program is distributed in the hope that it will be useful,
327
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
328
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
329
+** General Public License for more details.
330
+**
331
+** You should have received a copy of the GNU General Public
332
+** License along/*
333
+** Copyri/* F* Unterminated st/
334
+
335
+/*
336
+** Values are storedsbs_push(p, &zScript[1], n-1 of input */
337
+
338
+/*STRINGe following
339
+** stsbs_push(p, &zScript[1], n-2 of input */
340
+
341
+/*VERB: {
342
+ /* Pointer to strinp->pHash, the terms of tht */
343
+
344
+/*
345
+** Values are sVERBsbs_pushunting final zero */
346
+ c
--- a/src/subscript.c
+++ b/src/subscript.c
@@ -0,0 +1,346 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/src/subscript.c
+++ b/src/subscript.c
@@ -0,0 +1,346 @@
1 /*
2 ** Copyright (c) 2007 D. Richard Hipp
3 **
4 ** This program is free software; you can redistribute it and/or
5 ** modify it under the terms of the GNU General Public
6 ** License version 2 as published by the Free Software Foundation.
7 **
8 ** This program is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 ** General Public License for more details.
12 **
13 ** You should have received a copy of the GNU General Public
14 ** License along with this library; if not, write to the
15 ** Free Software Foundation, Inc., 59 Temple Place - Sui************************************************************
16 **
17 ** This file contains an implementation of the "subscript" inte1t (c) 2007 D. Richard Hipp
18 **
19 ** This program is free software; you can redistribute it and/or
20 ** modify it under the terms of the GNU General Public
21 ** License version 2 as published by the Free Software Foundation.
22 **
23 ** This program is distributed in the hope that it will be useful,
24 ** but WITHOUT ANY WARRANTY; without even the imp/*
25 ** Copyrig each other by whitespace.
26 ** * Leading and trailing whitespace is ignored.
27 ** * Tehashhin nested {...} is a nEUsHashEntry U zMsg = vmprintf(zEUsHashEntry {
28 Urintf(zErr, ap);
29 va_end(ap);
30 nErr = strlen(zMsg);
31 if( nErr>sizeof(p->zErrMsg)-1 ){
32 nErr = sizeof(p->zErrMsg)-1;
33 }
34 memcpy(p->zErrMsg, zMsg, nErr);
35 p->zErrMsg[nErr] = 0;
36 free(zMsg);
37 }
38
39 /*
40 ** Return a pointer to the current error message for the
41 ** interpreter.
42 */
43 const UsHashTab Upt *p){
44 return UsHashTab {
45 U
46 ** Add a new verb the given interpreter
47 */
48 int SbS_AddVerb(
49 struct Subscript *p,
50 const char *zVerb,
51 int (*xVerb)(struct Subscript*,void*),
52 void *pArg
53 ){
54 SbSValue v;
55 v.flags = SBSVAL_VERB;
56 v.u.verb.xVerb = xVerb;
57 v.u.verb.pArg = pArg;
58 return sbs_store(&p->symTab,he hash table */
59 };
60
61 /*
62 ** An instance of the Subscript interpreter
63 */
64 struct Subscript {
65 int nStack; sbs_hash *pHash, _Push(p, pVal->u.str.]); i++){}
66 return i;
67 U
68 if( c=='#' ){
69 int i;
70 for(i=1; i<n && z[i] && z[i-1]!='\n'; i++){}
71 *pTokenType = SBSTT_WHITESPACE;
72 return i;
73 }
74 if( c=='"' ){
75 int i;
76 for(i=1; i<n && z[i] && z[i]!='"'; i++){
77 if( z[i]=='\\' && i<n-1 ){ i++; }
78 }
79 if( z[i]=='"' ){
80 *pTokenType = SBSTT_QUOTED;
81 return i+1;
82 }else{
83 *pTokenType = SBSTT_INCOMPLETE;
84 return i;
85 }
86 }
87 if( c=='{' ){
88 int depth = 1;
89 int i;
90 for(i=1; i<n && z[i]; i++){
91 sbs_hash *pHash, depth++;
92 }else if( z[i]=='}' ){
93 depth--;
94 if( depth=0 ){
95 i++;
96 break;
97 }
98 }
99 }
100 if( depth ){
101 *pTokenTU
102 if( c=='#' ){
103 int i;
104 for(i=1; i<n && z[i] && z[i-1]!='\n'; i++){}
105 *pTokenType = SBSTT_WHITESPACE;
106 return i;
107 }
108 if( c=='"' ){
109 int i;
110 intf(zErr, ap);
111 va_end(ap);
112 nErr = strlen(zMsg);
113 if( nErr>sizeof(p->zErrMsg)-1 ){
114 nErr = sizeof(p->zErrMsg)-1;
115 }
116 memcpy(p->zErrMsg, zMsg, nErr);
117 p->zErrMsg[nErr] = 0;
118 free(zMsg);
119 }
120
121 /*
122 ** Return a pointer to the current error message for the
123 ** interpreter.
124 */
125 const char *SbS_GetErrorMessage(struct Subscript *p){
126 return p->zErrMsg;
127 }
128
129 /*
130 ** Add a new verb the given interpreter
131 */
132 int Sbsbs_hash *pHash){
133 int i;
134 U
135 const char *zVerb,
136 int (*xVerb)(struct Subscript*,void*),
137 void *pArg
138 ){
139 SbSValue v;
140 v.flags = SBSVAL_VERB;
141 v.u.verb.xVerb = xVerb;
142 v.u.verb.pArg = pArg;
143 return sbs_store(&p->symTab,he hash table */
144 };
145
146 /*
147 ** An instance of the Subscript interpreter
148 */
149 struct Subscript {
150 int nStack; /* NumbeU/
151 const char *SbS_StackValue(struct Subscript *p, int N, int *pSize){
152 SbSValue *pVal;
153 if( N<0 || N>=p->nStack ){
154 return 0;
155 }
156 pVal = &p->aStack[p->n
157 /*
158 ** Push al Public
159 ** License v/*
160 ** Copyright (c) 2007 D. Richard Hipp
161 **
162 ** This program is free softwarSbSValue *pStk;const char *z;
163 iht (c) 2007 D. Ri/*
164 ** Copyright (c) 2007 D. Richard Hipp
165 **
166 ** This program is free software; you can redistribute it and/or
167 ** modify it under the terms of the GNU General Public
168 ** License version 2 as published by the Free Software Foundation.
169 **
170 ** This program is distributed in the hope that it will be useful,
171 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
172 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
173 ** General Public License for more details.
174 **
175 ** You should have received a copy of the GNU General Public
176 ** License along with this library; if not, write to the
177 ** Free Software Foundation, Inc., 59 Temple Place - Suite 330,
178 ** Boston, MA 02111-1307, USA.
179 **
180 ** Author contact information:
181 ** [email protected]
182 ** http://www.hwaci.com/drh*******************************************************************
183 **
184 ** This file contains an implementation of the "subscript" inte1t (c) 2007 D. Richard Hipp
185 **
186 ** This program is free software; you can redistribute it and/or
187 ** modify it under the terms of the GNU General Public
188 ** License version 2 as published by the Free Software Foundation.
189 **
190 ** This program is distributed in the hope that it will be useful,
191 ** but WITHOUT ANY WARRANTY; without even the imp/*
192 ** Copyrig each other by whitespace.
193 ** * Leading and trailing whitespace is ignored.
194 ** * Text within nested {...} is a single string token. The outermost
195 ** curly braces are not part of the token.
196 ** * An identifier witGiven an input string z of length n, identonst char *z,if you need it to persist.
197 */
198 cons->zErrMsg, zMsg, nEc
199 ** License v/*
200 ** Copyright (c) 2007 D. Richard Hipp
201 **
202 ** This program is free software; you can redisneedToFree/
203 int SbS_StackValueInt(struct Subscript *p, int N){
204 int n, v;
205 int isNeg = 0;
206 const char *z = SbS_StackValue(p, N, &n);
207 v = 0;
208 if( n==0 ) return 0;
209 if( z[0]=='-' ){
210 isNeg = 1;
211 z++;
212 n--;
213 }else if( z[0]=='+' ){
214 z++;
215 n--;
216 }
217 while( n>0 && isdigit(z[0]) ){
218 v = v*10 + z[0] - '0';
219 z++;
220 n--;
221 }
222 if( isNeg ){
223 v = -v;
224 }
225 return v;
226 }
227
228 /*
229 **underscore/*
230 ** Copyateter. Make a copy if you need it to persist.
231 */
232 const char *SbS_Fetch(
233 struct Subscri-1t char *zKey, /* Name of the variable. Case sensitive */
234 int nKey, /* Length of the key */
235 har *cript *p, void *pNotUs&size);
236 x = sbs_fetch(&p->symTab, (char*)z, size)!=0;
237 SbS_Pop(p, 1);
238 SbS_PushInt(p, x);
239 return 0;
240 }
241
242 /*
243 ** Subscript command: VALUE NAME get VALUE
244 **
245 ** Push the value of varible NAME onto the stack if it exists.
246 ** If NAME does not e\nxist, puts VALUE onto the stack instead.
247 */
248 static int getCmd(Subscript *p, void *pNotUsed){
249 const char *zName;
250 int nName;
251 const SbSValue *pVal;
252 int rc = 0;
253
254 if( SbS_RequireStack(p, 2, "get") ) return SBS_ERROR;
255 zName = SbS_StackValue(p, 0, &nName);
256 pVal = sbs_fetch(&p->symTab, (char*)zName, nName);
257 if( pVal!=0 && (pVal->flags & SBSVAL_STR)!=0 ){
258 SbS_Pop(p, 2);
259 rc = SbS_Push(p, pVal->u.str.z, pVal->u.str.size, 0);
260 }else{
261 SbS_Pop(p, 1);
262 }
263 return rc;
264 }
265
266
267
268 /*
269 ** True if output is enabled. Fa disabled.
270 */
271 static int enableOutput = 1;
272
273 /*
274 ** Subscript command: BOOLEAN enable_output
275 **
276 ** Enable or disable the puts and hputs commands.
277 */
278 static int enableOutputCmd(struct Subscript *p, void *pNotUsed){
279 if( SbS_Req;
280 sbs_value_reset(e, pNos);
281 sbs_value_reset(pTos);
282 return 0;
283 }
284
285 /*
286 ** Subscript command: INTEGER not INTEGER
287 */
288 static int notCmd(struct Subscript *p, void *pNotUsed){
289 int *p, void *pNotUsed){
290 const char *z;
291 reStack(p, 1, "exists") ) return 1;
292 z = SbS_StackValue(p, 0, &size);
293 x = sbs_fetch(&p->value of varible NAME onto thof varible NAME onto the stack iThe built-in "set" command:
294 **
295 **s VALUE onto nsize=\"%d\">", nName, zName
296 ** Render the input string as wiki.
297 */
298 static int wiki3, bopCmd,/
299 static in3, bopCmd,pConvert)mp3, bopCmd, enableOutput ){
300 Blob src;max", 3, bopCmd,
301 blob_3, bopCmd,(&src, 0,
302 ** Subscrip0** the stac},
303 { "or", 2, bopCmd,
304 ** Gene='+4, ME;
305 retu0** the stac},
306 { "set", 3int .
307 */
308 static int wiki3, bopCmd,/
309 static in3, bopCmd,pConvert)mp3, bopCmd, enableOutput ){
310 Blob src;max", 3, bopCmd,;
311 blob SbS_AddVerb(p, "set", setCmd, 03/*
312 ** Subscrip0** the stac},
313 { "or", 2, bopCmd,
314 ** Gene='+4, ME;
315 retu0** the stac},
316 { "set", 3int i;
317 for0** the stac},
318 { "sub", 3, bopCmd,}
319 *pTokenType = SBSTT_VE
320 /*
321 ** A table of built-** Copyright (c) 2007 D. Richard Hipp
322 **
323 ** This program is free software; you can redistribute it and/or
324 ** moditoken_typeation.
325 **
326 ** This program is distributed in the hope that it will be useful,
327 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
328 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
329 ** General Public License for more details.
330 **
331 ** You should have received a copy of the GNU General Public
332 ** License along/*
333 ** Copyri/* F* Unterminated st/
334
335 /*
336 ** Values are storedsbs_push(p, &zScript[1], n-1 of input */
337
338 /*STRINGe following
339 ** stsbs_push(p, &zScript[1], n-2 of input */
340
341 /*VERB: {
342 /* Pointer to strinp->pHash, the terms of tht */
343
344 /*
345 ** Values are sVERBsbs_pushunting final zero */
346 c
+168
--- src/tkt.c
+++ src/tkt.c
@@ -22,17 +22,185 @@
2222
*******************************************************************************
2323
**
2424
** This file contains code used render and control ticket entry
2525
** and display pages.
2626
*/
27
+#if 0
2728
#include "config.h"
2829
#include "tkt.h"
2930
#include <assert.h>
31
+
32
+/*
33
+** Flags to indicate what kind of ticket string is being generated.
34
+** A bitmask of these is associated with each verb in order to indicate
35
+** which verbs go on which pages.
36
+*/
37
+#define M_NEW 0x01
38
+#define M_EDIT 0x02
39
+#define M_VIEW 0x04
40
+
41
+/*
42
+** The Subscript interpreter used to parse the ticket configure
43
+** and to render ticket screens.
44
+*/
45
+static struct Subscript *pInterp = 0;
46
+
47
+/*
48
+** The list of database fields in the ticket table.
49
+** This is the user-defined list in the configuration file.
50
+** Add the "tkt_" prefix to all of these names in the real table.
51
+** The real table also contains some addition fields not found
52
+** here.
53
+*/
54
+static int nField = 0;
55
+static Blob fieldList;
56
+static char **azField = 0;
57
+
58
+/*
59
+** Subscript command: LIST setfields
60
+**
61
+** Parse up the list and populate the nField and azField variables.
62
+*/
63
+static int setFieldsCmd(struct Subscript *p, void *pNotUsed){
64
+ if( SbS_RequireStack(p, 1) ) return 1;
65
+ if( nField==0 ){
66
+ char *zFieldList;
67
+ int nFieldList, i;
68
+ Blob field;
69
+ blob_zero(&fieldList);
70
+ zFieldList = SbS_StackValue(p, 0, &nFieldList);
71
+ blob_appendf(&fieldList, zFieldList, nFieldList);
72
+ while( blob_token(&fieldList, &field) ){
73
+ nField++;
74
+ }
75
+ azField = malloc( sizeof(azField[0])*nField );
76
+ blob_rewind(&fieldList);
77
+ i = 0;
78
+ while( blob_token(&fieldList, &field) ){
79
+ azField[i] = blob_terminate(&field);
80
+ }
81
+ }
82
+ SbS_Pop(p, 1);
83
+ return 0;
84
+}
85
+
86
+/*
87
+** Subscript command: INTEGER not INTEGER
88
+*/
89
+static int notCmd(struct Subscript *p, void *pNotUsed){
90
+ int n;
91
+ if( SbS_RequireStack(p, 1) ) return 1;
92
+ n = SbS_StackValueInt(p, 0);
93
+ SbS_Pop(p, 1);
94
+ SbS_PushInt(p, !n);
95
+ return 0;
96
+}
97
+
98
+/*
99
+** Subscript command: INTEGER INTEGER max INTEGER
100
+*/
101
+static int maxCmd(struct Subscript *p, void *pNotUsed){
102
+ int a, b;
103
+ if( SbS_RequireStack(p, 2) ) return 1;
104
+ a = SbS_StackValueInt(p, 0);
105
+ b = SbS_StackValueInt(p, 1);
106
+ SbS_Pop(p, 2);
107
+ SbS_PushInt(p, a>b ? a : b);
108
+ return 0;
109
+}
110
+
111
+/*
112
+** Subscript command: INTEGER INTEGER and INTEGER
113
+*/
114
+static int andCmd(struct Subscript *p, void *pNotUsed){
115
+ int a, b;
116
+ if( SbS_RequireStack(p, 2) ) return 1;
117
+ a = SbS_StackValueInt(p, 0);
118
+ b = SbS_StackValueInt(p, 1);
119
+ SbS_Pop(p, 2);
120
+ SbS_PushInt(p, a && b);
121
+ return 0;
122
+}
123
+
124
+/*
125
+** Subscript command: FIELD wikiview
126
+*/
127
+static int wikiViewCmd(struct Subscript *p, void *pNotUsed){
128
+ if( SbS_RequireStack(p, 2) ) return 1;
129
+
130
+ SbS_Pop(p, 1);
131
+ return 0;
132
+}
133
+
134
+
135
+/*
136
+** Create an Subscript interpreter appropriate for processing
137
+** Ticket pages.
138
+*/
139
+static void tkt_screen_init(int flags){
140
+ char *zConfig;
141
+ int i;
142
+ static const struct {
143
+ const char *zName;
144
+ int (*xVerb);
145
+ int mask;
146
+ } aVerb[] = {
147
+ { "not", notCmd, M_NEW|M_EDIT|M_VIEW },
148
+ { "max", maxCmd, M_NEW|M_EDIT|M_VIEW },
149
+ { "and", andCmd, M_NEW|M_EDIT|M_VIEW },
150
+ { "wikiview", wikiViewCmd, M_NEW|M_EDIT|M_VIEW },
151
+ { "textview", textViewCmd, M_NEW|M_EDIT|M_VIEW },
152
+ { "linecount", lineCountCmd, M_NEW|M_EDIT|M_VIEW },
153
+ { "cgiparam", cgiParamCmd, M_NEW|M_EDIT|M_VIEW },
154
+ { "enable_output", enableOutputCmd, M_NEW|M_EDIT|M_VIEW },
155
+ { "is_anon", isAnonCmd, M_NEW|M_EDIT|M_VIEW },
156
+ { "ok_wrtkt", okWrTktCmd, M_NEW|M_EDIT|M_VIEW },
157
+ { "default_value", dfltValueCmd, M_NEW },
158
+ { "textedit", textEditCmd, M_NEW|M_EDIT },
159
+ { "combobox", comboBoxCmd, M_NEW|M_EDIT },
160
+ { "multilineedit", multiLineEditCmd, M_NEW|M_EDIT },
161
+ { "multilineappend", multiAppendCmd, M_EDIT },
162
+ { "auxbutton", auxButtonCmd, M_NEW|M_EDIT },
163
+ { "submitbutton", submitButtonCmd, M_NEW|M_EDIT },
164
+ };
165
+
166
+ pInterp = SbS_Create();
167
+ SbS_AddVerb(pInterp, "setfields", setFieldsCmd, 0);
168
+ zConfig = db_get("ticket-config","");
169
+ SbS_Eval(pInter, zConfig, -1);
170
+ for(i=0; i<sizeof(aVerb)/sizeof(aVerb[0]); i++){
171
+ SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);
172
+ }
173
+ /* Extract appropriate template */
174
+ return pInterp;
175
+}
30176
31177
/*
32178
** PAGE: tktnew
33179
*/
34180
void tktnew_page(void){
181
+ struct Subscript *pInterp;
182
+ const char *zPage;
183
+ int nPage;
184
+
185
+ tkt_screen_init(M_NEW);
186
+ style_header("New Ticket");
187
+ @ This will become a page for entering new tickets.
188
+ style_footer();
189
+}
190
+
191
+/*
192
+** PAGE: tktview
193
+** URL: tktview?name=UUID
194
+**
195
+*/
196
+void tktnew_page(void){
197
+ struct Subscript *pInterp;
198
+ const char *zPage;
199
+ int nPage;
200
+
201
+ tkt_screen_init(M_NEW);
35202
style_header("New Ticket");
36203
@ This will become a page for entering new tickets.
37204
style_footer();
38205
}
206
+#endif
39207
--- src/tkt.c
+++ src/tkt.c
@@ -22,17 +22,185 @@
22 *******************************************************************************
23 **
24 ** This file contains code used render and control ticket entry
25 ** and display pages.
26 */
 
27 #include "config.h"
28 #include "tkt.h"
29 #include <assert.h>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
31 /*
32 ** PAGE: tktnew
33 */
34 void tktnew_page(void){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35 style_header("New Ticket");
36 @ This will become a page for entering new tickets.
37 style_footer();
38 }
 
39
--- src/tkt.c
+++ src/tkt.c
@@ -22,17 +22,185 @@
22 *******************************************************************************
23 **
24 ** This file contains code used render and control ticket entry
25 ** and display pages.
26 */
27 #if 0
28 #include "config.h"
29 #include "tkt.h"
30 #include <assert.h>
31
32 /*
33 ** Flags to indicate what kind of ticket string is being generated.
34 ** A bitmask of these is associated with each verb in order to indicate
35 ** which verbs go on which pages.
36 */
37 #define M_NEW 0x01
38 #define M_EDIT 0x02
39 #define M_VIEW 0x04
40
41 /*
42 ** The Subscript interpreter used to parse the ticket configure
43 ** and to render ticket screens.
44 */
45 static struct Subscript *pInterp = 0;
46
47 /*
48 ** The list of database fields in the ticket table.
49 ** This is the user-defined list in the configuration file.
50 ** Add the "tkt_" prefix to all of these names in the real table.
51 ** The real table also contains some addition fields not found
52 ** here.
53 */
54 static int nField = 0;
55 static Blob fieldList;
56 static char **azField = 0;
57
58 /*
59 ** Subscript command: LIST setfields
60 **
61 ** Parse up the list and populate the nField and azField variables.
62 */
63 static int setFieldsCmd(struct Subscript *p, void *pNotUsed){
64 if( SbS_RequireStack(p, 1) ) return 1;
65 if( nField==0 ){
66 char *zFieldList;
67 int nFieldList, i;
68 Blob field;
69 blob_zero(&fieldList);
70 zFieldList = SbS_StackValue(p, 0, &nFieldList);
71 blob_appendf(&fieldList, zFieldList, nFieldList);
72 while( blob_token(&fieldList, &field) ){
73 nField++;
74 }
75 azField = malloc( sizeof(azField[0])*nField );
76 blob_rewind(&fieldList);
77 i = 0;
78 while( blob_token(&fieldList, &field) ){
79 azField[i] = blob_terminate(&field);
80 }
81 }
82 SbS_Pop(p, 1);
83 return 0;
84 }
85
86 /*
87 ** Subscript command: INTEGER not INTEGER
88 */
89 static int notCmd(struct Subscript *p, void *pNotUsed){
90 int n;
91 if( SbS_RequireStack(p, 1) ) return 1;
92 n = SbS_StackValueInt(p, 0);
93 SbS_Pop(p, 1);
94 SbS_PushInt(p, !n);
95 return 0;
96 }
97
98 /*
99 ** Subscript command: INTEGER INTEGER max INTEGER
100 */
101 static int maxCmd(struct Subscript *p, void *pNotUsed){
102 int a, b;
103 if( SbS_RequireStack(p, 2) ) return 1;
104 a = SbS_StackValueInt(p, 0);
105 b = SbS_StackValueInt(p, 1);
106 SbS_Pop(p, 2);
107 SbS_PushInt(p, a>b ? a : b);
108 return 0;
109 }
110
111 /*
112 ** Subscript command: INTEGER INTEGER and INTEGER
113 */
114 static int andCmd(struct Subscript *p, void *pNotUsed){
115 int a, b;
116 if( SbS_RequireStack(p, 2) ) return 1;
117 a = SbS_StackValueInt(p, 0);
118 b = SbS_StackValueInt(p, 1);
119 SbS_Pop(p, 2);
120 SbS_PushInt(p, a && b);
121 return 0;
122 }
123
124 /*
125 ** Subscript command: FIELD wikiview
126 */
127 static int wikiViewCmd(struct Subscript *p, void *pNotUsed){
128 if( SbS_RequireStack(p, 2) ) return 1;
129
130 SbS_Pop(p, 1);
131 return 0;
132 }
133
134
135 /*
136 ** Create an Subscript interpreter appropriate for processing
137 ** Ticket pages.
138 */
139 static void tkt_screen_init(int flags){
140 char *zConfig;
141 int i;
142 static const struct {
143 const char *zName;
144 int (*xVerb);
145 int mask;
146 } aVerb[] = {
147 { "not", notCmd, M_NEW|M_EDIT|M_VIEW },
148 { "max", maxCmd, M_NEW|M_EDIT|M_VIEW },
149 { "and", andCmd, M_NEW|M_EDIT|M_VIEW },
150 { "wikiview", wikiViewCmd, M_NEW|M_EDIT|M_VIEW },
151 { "textview", textViewCmd, M_NEW|M_EDIT|M_VIEW },
152 { "linecount", lineCountCmd, M_NEW|M_EDIT|M_VIEW },
153 { "cgiparam", cgiParamCmd, M_NEW|M_EDIT|M_VIEW },
154 { "enable_output", enableOutputCmd, M_NEW|M_EDIT|M_VIEW },
155 { "is_anon", isAnonCmd, M_NEW|M_EDIT|M_VIEW },
156 { "ok_wrtkt", okWrTktCmd, M_NEW|M_EDIT|M_VIEW },
157 { "default_value", dfltValueCmd, M_NEW },
158 { "textedit", textEditCmd, M_NEW|M_EDIT },
159 { "combobox", comboBoxCmd, M_NEW|M_EDIT },
160 { "multilineedit", multiLineEditCmd, M_NEW|M_EDIT },
161 { "multilineappend", multiAppendCmd, M_EDIT },
162 { "auxbutton", auxButtonCmd, M_NEW|M_EDIT },
163 { "submitbutton", submitButtonCmd, M_NEW|M_EDIT },
164 };
165
166 pInterp = SbS_Create();
167 SbS_AddVerb(pInterp, "setfields", setFieldsCmd, 0);
168 zConfig = db_get("ticket-config","");
169 SbS_Eval(pInter, zConfig, -1);
170 for(i=0; i<sizeof(aVerb)/sizeof(aVerb[0]); i++){
171 SbS_AddVerb(pInterp, aVerb[i].zName, aVerb[i].xVerb, 0);
172 }
173 /* Extract appropriate template */
174 return pInterp;
175 }
176
177 /*
178 ** PAGE: tktnew
179 */
180 void tktnew_page(void){
181 struct Subscript *pInterp;
182 const char *zPage;
183 int nPage;
184
185 tkt_screen_init(M_NEW);
186 style_header("New Ticket");
187 @ This will become a page for entering new tickets.
188 style_footer();
189 }
190
191 /*
192 ** PAGE: tktview
193 ** URL: tktview?name=UUID
194 **
195 */
196 void tktnew_page(void){
197 struct Subscript *pInterp;
198 const char *zPage;
199 int nPage;
200
201 tkt_screen_init(M_NEW);
202 style_header("New Ticket");
203 @ This will become a page for entering new tickets.
204 style_footer();
205 }
206 #endif
207
+2 -2
--- src/tktconf.c
+++ src/tktconf.c
@@ -430,17 +430,17 @@
430430
@ template new END-OF-NEW-TEMPLATE
431431
@ <table cellpadding="5">
432432
@ <tr>
433433
@ <td cellpadding="2">
434434
@ Enter a one-line summary of the problem:<br>
435
- @ [entrywidget title]
435
+ @ [/title 60 1 textentry]
436436
@ </td>
437437
@ </tr>
438438
@
439439
@ <tr>
440440
@ <td align="right">Type:
441
- @ [entrywidget type]
441
+ @ [/type entrywidget]
442442
@ </td>
443443
@ <td>What type of ticket is this?</td>
444444
@ </tr>
445445
@
446446
@ <tr>
447447
--- src/tktconf.c
+++ src/tktconf.c
@@ -430,17 +430,17 @@
430 @ template new END-OF-NEW-TEMPLATE
431 @ <table cellpadding="5">
432 @ <tr>
433 @ <td cellpadding="2">
434 @ Enter a one-line summary of the problem:<br>
435 @ [entrywidget title]
436 @ </td>
437 @ </tr>
438 @
439 @ <tr>
440 @ <td align="right">Type:
441 @ [entrywidget type]
442 @ </td>
443 @ <td>What type of ticket is this?</td>
444 @ </tr>
445 @
446 @ <tr>
447
--- src/tktconf.c
+++ src/tktconf.c
@@ -430,17 +430,17 @@
430 @ template new END-OF-NEW-TEMPLATE
431 @ <table cellpadding="5">
432 @ <tr>
433 @ <td cellpadding="2">
434 @ Enter a one-line summary of the problem:<br>
435 @ [/title 60 1 textentry]
436 @ </td>
437 @ </tr>
438 @
439 @ <tr>
440 @ <td align="right">Type:
441 @ [/type entrywidget]
442 @ </td>
443 @ <td>What type of ticket is this?</td>
444 @ </tr>
445 @
446 @ <tr>
447

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button