Version:
~ [ 10.0 ] ~
** Warning: Cannot open xref database.
1
2 /* $Id: dbverbs.c,v 1.4 2005/01/11 22:48:05 andreradke Exp $ */
3
4 /******************************************************************************
5
6 UserLand Frontier(tm) -- High performance Web content management,
7 object database, system-level and Internet scripting environment,
8 including source code editing and debugging.
9
10 Copyright (C) 1992-2004 UserLand Software, Inc.
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
26 ******************************************************************************/
27
28 /*
29 4.1b4 dmb: new verbs based on ODB Engine API
30 */
31
32 #include "frontier.h"
33 #include "standard.h"
34
35 #ifdef MACVERSION
36 #include <land.h>
37 #include "mac.h"
38 #endif
39
40 #include "ops.h"
41 #include "memory.h"
42 #include "error.h"
43 #include "file.h"
44 #include "resources.h"
45 #include "scrap.h"
46 #include "strings.h"
47 #include "launch.h"
48 #include "notify.h"
49 #include "shell.h"
50 #include "lang.h"
51 #include "langexternal.h"
52 #include "langinternal.h"
53 #include "langipc.h"
54 #include "kernelverbs.h"
55 #include "kernelverbdefs.h"
56 #include "tablestructure.h"
57 #include "process.h"
58 #include "processinternal.h"
59 #include "odbinternal.h"
60
61 /*
62 if we're generating cfm (powerpc), we're linking to an odb engine shared
63 library, which has it's own globals. on 68k machines, we're staically linked,
64 so the odb calls mess with out global data. so we need to protect it.
65 */
66
67 #ifdef usingsharedlibrary
68
69 #define odbnewfile odbNewFile
70 #define odbopenfile odbOpenFile
71 #define odbsavefile odbSaveFile
72 #define odbclosefile odbCloseFile
73 #define odbdefined odbDefined
74 #define odbdelete odbDelete
75 #define odbgettype odbGetType
76 #define odbgetvalue odbGetValue
77 #define odbsetvalue odbSetValue
78 #define odbnewtable odbNewTable
79 #define odbcountitems odbCountItems
80 #define odbgetnthitem odbGetNthItem
81 #define odbgetmoddate odbGetModDate
82 #define odbdisposevalue odbDisposeValue
83 #define odbgeterror odbGetError
84
85 #else
86
87 /*Prototypes*/
88
89 boolean odbnewfile (hdlfilenum fnum);
90
91 boolean odbaccesswindow (WindowPtr w, odbref *odb);
92
93 boolean odbopenfile (hdlfilenum fnum, odbref *odb, boolean flreadonly);
94
95 boolean odbsavefile (odbref odb);
96
97 boolean odbclosefile (odbref odb);
98
99 boolean odbdefined (odbref odb, bigstring bspath);
100
101 boolean odbdelete (odbref odb, bigstring bspath);
102
103 boolean odbgettype (odbref odb, bigstring bspath, OSType *odbType);
104
105 boolean odbgetvalue (odbref odb, bigstring bspath, odbValueRecord *value);
106
107 boolean odbsetvalue (odbref odb, bigstring bspath, odbValueRecord *value);
108
109 boolean odbnewtable (odbref odb, bigstring bspath);
110
111 boolean odbcountitems (odbref odb, bigstring bspath, long *count);
112
113 boolean odbgetnthitem (odbref odb, bigstring bspath, long n, bigstring bsname);
114
115 boolean odbgetmoddate (odbref odb, bigstring bspath, unsigned long *date);
116
117 boolean odbdisposevalue (odbref odb, odbValueRecord *value);
118
119
120 /*Functions*/
121
122 boolean odbnewfile (hdlfilenum fnum) {
123
124 boolean fl;
125 hdlthreadglobals htg = getcurrentthreadglobals ();
126
127 copythreadglobals (htg);
128
129 swapinthreadglobals (nil);
130
131 fl = odbNewFile (fnum);
132
133 cancoonglobals = nil;
134
135 swapinthreadglobals (htg);
136
137 return (fl);
138 }
139
140 boolean odbaccesswindow (WindowPtr w, odbref *odb) {
141
142 boolean fl;
143 hdlthreadglobals htg = getcurrentthreadglobals ();
144
145 copythreadglobals (htg);
146
147 swapinthreadglobals (nil);
148
149 fl = odbAccessWindow (w, odb);
150
151 cancoonglobals = nil;
152
153 swapinthreadglobals (htg);
154
155 return (fl);
156 }
157
158 boolean odbopenfile (hdlfilenum fnum, odbref *odb, boolean flreadonly) {
159
160 boolean fl;
161 hdlthreadglobals htg = getcurrentthreadglobals ();
162
163 copythreadglobals (htg);
164
165 swapinthreadglobals (nil);
166
167 fl = odbOpenFile (fnum, odb, flreadonly);
168
169 cancoonglobals = nil;
170
171 swapinthreadglobals (htg);
172
173 return (fl);
174 }
175
176 boolean odbsavefile (odbref odb) {
177
178 boolean fl;
179 hdlthreadglobals htg = getcurrentthreadglobals ();
180
181 copythreadglobals (htg);
182
183 swapinthreadglobals (nil);
184
185 fl = odbSaveFile (odb);
186
187 cancoonglobals = nil;
188
189 swapinthreadglobals (htg);
190
191 return (fl);
192 }
193
194 boolean odbclosefile (odbref odb) {
195
196 boolean fl;
197 hdlthreadglobals htg = getcurrentthreadglobals ();
198
199 copythreadglobals (htg);
200
201 swapinthreadglobals (nil);
202
203 fl = odbCloseFile (odb);
204
205 cancoonglobals = nil;
206
207 swapinthreadglobals (htg);
208
209 return (fl);
210 }
211
212 boolean odbdefined (odbref odb, bigstring bspath) {
213
214 boolean fl;
215 hdlthreadglobals htg = getcurrentthreadglobals ();
216
217 copythreadglobals (htg);
218
219 swapinthreadglobals (nil);
220
221 fl = odbDefined (odb, bspath);
222
223 cancoonglobals = nil;
224
225 swapinthreadglobals (htg);
226
227 return (fl);
228 }
229
230 boolean odbdelete (odbref odb, bigstring bspath) {
231
232 boolean fl;
233 hdlthreadglobals htg = getcurrentthreadglobals ();
234
235 copythreadglobals (htg);
236
237 swapinthreadglobals (nil);
238
239 fl = odbDelete (odb, bspath);
240
241 cancoonglobals = nil;
242
243 swapinthreadglobals (htg);
244
245 return (fl);
246 }
247
248 boolean odbgettype (odbref odb, bigstring bspath, OSType *odbType) {
249
250 boolean fl;
251 hdlthreadglobals htg = getcurrentthreadglobals ();
252
253 copythreadglobals (htg);
254
255 swapinthreadglobals (nil);
256
257 fl = odbGetType (odb, bspath, odbType);
258
259 cancoonglobals = nil;
260
261 swapinthreadglobals (htg);
262
263 return (fl);
264 }
265
266 boolean odbgetvalue (odbref odb, bigstring bspath, odbValueRecord *value) {
267
268 boolean fl;
269 hdlthreadglobals htg = getcurrentthreadglobals ();
270
271 copythreadglobals (htg);
272
273 swapinthreadglobals (nil);
274
275 fl = odbGetValue (odb, bspath, value);
276
277 cancoonglobals = nil;
278
279 swapinthreadglobals (htg);
280
281 return (fl);
282 }
283
284 boolean odbsetvalue (odbref odb, bigstring bspath, odbValueRecord *value) {
285
286 boolean fl;
287 hdlthreadglobals htg = getcurrentthreadglobals ();
288
289 copythreadglobals (htg);
290
291 swapinthreadglobals (nil);
292
293 fl = odbSetValue (odb, bspath, value);
294
295 cancoonglobals = nil;
296
297 swapinthreadglobals (htg);
298
299 return (fl);
300 }
301
302 boolean odbnewtable (odbref odb, bigstring bspath) {
303
304 boolean fl;
305 hdlthreadglobals htg = getcurrentthreadglobals ();
306
307 copythreadglobals (htg);
308
309 swapinthreadglobals (nil);
310
311 fl = odbNewTable (odb, bspath);
312
313 cancoonglobals = nil;
314
315 swapinthreadglobals (htg);
316
317 return (fl);
318 }
319
320 boolean odbcountitems (odbref odb, bigstring bspath, long *count) {
321
322 boolean fl;
323 hdlthreadglobals htg = getcurrentthreadglobals ();
324
325 copythreadglobals (htg);
326
327 swapinthreadglobals (nil);
328
329 fl = odbCountItems (odb, bspath, count);
330
331 cancoonglobals = nil;
332
333 swapinthreadglobals (htg);
334
335 return (fl);
336 }
337
338 boolean odbgetnthitem (odbref odb, bigstring bspath, long n, bigstring bsname) {
339
340 boolean fl;
341 hdlthreadglobals htg = getcurrentthreadglobals ();
342
343 copythreadglobals (htg);
344
345 swapinthreadglobals (nil);
346
347 fl = odbGetNthItem (odb, bspath, n, bsname);
348
349 cancoonglobals = nil;
350
351 swapinthreadglobals (htg);
352
353 return (fl);
354 }
355
356 boolean odbgetmoddate (odbref odb, bigstring bspath, unsigned long *date) {
357
358 boolean fl;
359 hdlthreadglobals htg = getcurrentthreadglobals ();
360
361 copythreadglobals (htg);
362
363 swapinthreadglobals (nil);
364
365 fl = odbGetModDate (odb, bspath, date);
366
367 cancoonglobals = nil;
368
369 swapinthreadglobals (htg);
370
371 return (fl);
372 }
373
374 boolean odbdisposevalue (odbref odb, odbValueRecord *value) {
375
376 hdlthreadglobals htg = getcurrentthreadglobals ();
377
378 copythreadglobals (htg);
379
380 swapinthreadglobals (nil);
381
382 odbDisposeValue (odb, value);
383
384 cancoonglobals = nil;
385
386 swapinthreadglobals (htg);
387
388 return (true);
389 }
390
391 #define odbgeterror odbGetError
392
393 #endif
394
395
396 typedef struct tyodblistrecord {
397
398 struct tyodblistrecord **hnext;
399
400 tyfilespec fs;
401
402 hdlfilenum fref;
403
404 boolean flreadonly;
405
406 odbref odb;
407 } tyodbrecord, *ptrodbrecord, **hdlodbrecord;
408
409
410 static hdlodbrecord hodblist = nil;
411
412
413 typedef enum tydbtoken { /*verbs that are processed by db*/
414
415 newfunc,
416
417 openfunc,
418
419 savefunc,
420
421 closefunc,
422
423 definedfunc,
424
425 /*
426 gettypefunc,
427 */
428
429 getvaluefunc,
430
431 setvaluefunc,
432
433 deletefunc,
434
435 newtablefunc,
436
437 istablefunc,
438
439 countitemsfunc,
440
441 getnthitemfunc,
442
443 getmoddatefunc,
444
445 ctdbverbs
446 } tydbtoken;
447
448
449 static boolean odberror (boolean flresult) {
450
451 bigstring bserror;
452
453 if (flresult)
454 return (false);
455
456 odbgeterror (bserror);
457
458 langerrormessage (bserror);
459
460 return (true);
461 } /*odberror*/
462
463
464 static boolean getodbparam (hdltreenode hparam1, short pnum, hdlodbrecord *hodbrecord) {
465
466 hdlodbrecord hodb;
467 tyfilespec fs;
468 tyfilespec * ptrfs;
469
470 ptrfs = &fs;
471
472 if (!getfilespecvalue (hparam1, pnum, ptrfs))
473 return (false);
474
475 for (hodb = hodblist; hodb != nil; hodb = (**hodb).hnext) {
476
477 if (equalfilespecs (&(**hodb).fs, ptrfs)) {
478
479 *hodbrecord = hodb;
480
481 return (true);
482 }
483 }
484
485 lang2paramerror (dbnotopenederror, bsfunctionname, fsname(ptrfs));
486
487 return (false);
488 } /*getodbparam*/
489
490
491 static boolean getodbvalue (hdltreenode hparam1, short pnum, tyodbrecord *odb, boolean flreadonly) {
492
493 hdlodbrecord hodb;
494
495 if (!getodbparam (hparam1, pnum, &hodb))
496 return (false);
497
498 *odb = **hodb;
499
500 if ((*odb).flreadonly && !flreadonly) {
501
502 lang2paramerror (dbopenedreadonlyerror, bsfunctionname, fsname(&(*odb).fs));
503
504 return (false);
505 }
506
507 return (true);
508 } /*getodbvalue*/
509
510
511 static boolean dbclosefile (hdlodbrecord hodb) {
512
513 if (!odbclosefile ((**hodb).odb))
514 return (false);
515
516 closefile ((**hodb).fref);
517
518 listunlink ((hdllinkedlist) hodblist, (hdllinkedlist) hodb);
519
520 disposehandle ((Handle) hodb);
521
522 return (true);
523 } /*dbclosefile*/
524
525
526 boolean dbcloseallfiles (long refcon) {
527
528 return (true);
529 } /*dbcloseallfiles*/
530
531
532 #if 0
533
534 static ptrfilespec fsfind;
535
536 static WindowPtr wfound;
537
538 static boolean odbfindfilevisit (WindowPtr w) {
539
540 /*
541 if the filespec for the given window is the one we're looking for,
542 select that window and stop visiting
543 */
544
545 tyfilespec fs;
546
547 windowgetfspec (w, &fs);
548
549 if (equalfilespecs (fsfind, &fs)) {
550
551 wfound = w;
552
553 return (false);
554 }
555
556 return (true);
557 } /*odbfindfilevisit*/
558
559 #endif
560
561
562 static boolean dbnewverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
563
564 /*
565 4.1b5 dmb: new verb
566 */
567
568 tyodbrecord odbrec;
569 boolean fl;
570
571 flnextparamislast = true;
572
573 if (!getfilespecvalue (hparam1, 1, &odbrec.fs))
574 return (false);
575
576 shellpushdefaultglobals (); /*so that config is correct*/
577
578 fl = opennewfile (&odbrec.fs, config.filecreator, config.filetype, &odbrec.fref);
579
580 shellpopglobals ();
581
582 if (!fl)
583 return (false);
584
585 fl = odbnewfile (odbrec.fref);
586
587 closefile (odbrec.fref);
588
589 if (odberror (fl)) {
590
591 deletefile (&odbrec.fs);
592
593 return (false);
594 }
595
596 return (setbooleanvalue (true, vreturned));
597 } /*dbnewverb*/
598
599
600 static boolean dbopenverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
601
602 /*
603 4.1b5 dmb: added ability to access already-open root in Frontier
604 */
605
606 tyodbrecord odbrec;
607 hdlodbrecord hodb;
608 WindowPtr w;
609
610 odbrec.fref = 0;
611
612 if (!getfilespecvalue (hparam1, 1, &odbrec.fs))
613 return (false);
614
615 flnextparamislast = true;
616
617 if (!getbooleanvalue (hparam1, 2, &odbrec.flreadonly))
618 return (false);
619
620 w = shellfindfilewindow (&odbrec.fs);
621
622 if (w != nil) {
623
624 if (odberror (odbaccesswindow (w, &odbrec.odb)))
625 return (false);
626
627 /*fref remains zero, so unwanted closefiles aren't a problem*/
628 }
629 else {
630
631 if (!openfile (&odbrec.fs, &odbrec.fref, odbrec.flreadonly))
632 return (false);
633
634 if (odberror (odbopenfile (odbrec.fref, &odbrec.odb, odbrec.flreadonly))) {
635
636 closefile (odbrec.fref);
637
638 return (false);
639 }
640 }
641
642 if (!newfilledhandle (&odbrec, sizeof (odbrec), (Handle *) &hodb)) {
643
644 odbclosefile (odbrec.odb);
645
646 closefile (odbrec.fref);
647
648 return (false);
649 }
650
651 listlink ((hdllinkedlist) hodblist, (hdllinkedlist) hodb);
652
653 return (setbooleanvalue (true, vreturned));
654 } /*dbopenverb*/
655
656
657 static boolean dbsaveverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
658
659 tyodbrecord odbrec;
660
661 flnextparamislast = true;
662
663 if (!getodbvalue (hparam1, 1, &odbrec, false))
664 return (false);
665
666 return (setbooleanvalue (odbsavefile (odbrec.odb), vreturned));
667 } /*dbsaveverb*/
668
669
670 static boolean dbcloseverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
671
672 hdlodbrecord hodb;
673
674 flnextparamislast = true;
675
676 if (!getodbparam (hparam1, 1, &hodb))
677 return (false);
678
679 return (setbooleanvalue (dbclosefile (hodb), vreturned));
680 } /*dbcloseverb*/
681
682
683 static boolean dbdefinedverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
684
685 /*
686 4.1b5 dmb: new verb
687 */
688
689 tyodbrecord odbrec;
690 bigstring bsaddress;
691 boolean fl;
692
693 if (!getodbvalue (hparam1, 1, &odbrec, true))
694 return (false);
695
696 flnextparamislast = true;
697
698 if (!getstringvalue (hparam1, 2, bsaddress))
699 return (false);
700
701 fl = odbdefined (odbrec.odb, bsaddress);
702
703 return (setbooleanvalue (fl, vreturned));
704 } /*dbdefinedverb*/
705
706
707 static boolean dbgetvalueverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
708
709 /*
710 4.1.1b1 dmb: fixed memory leak; push value on temp stack
711
712 5.0b17 dmb: use pushtmpstackvalue to put external types returned from
713 the other odb onto our temp stack
714
715 5.0.1 dmb: but only pushtmpstack if heapallocated
716 */
717
718 tyodbrecord odbrec;
719 bigstring bsaddress;
720 odbValueRecord value;
721 tyvaluetype type;
722
723 if (!getodbvalue (hparam1, 1, &odbrec, true))
724 return (false);
725
726 flnextparamislast = true;
727
728 if (!getstringvalue (hparam1, 2, bsaddress))
729 return (false);
730
731 if (odberror (odbgetvalue (odbrec.odb, bsaddress, &value)))
732 return (false);
733
734 type = langexternalgetvaluetype (value.valuetype);
735
736 if (type == (tyvaluetype) -1) {
737
738 return (setbinaryvalue (value.data.binaryvalue, value.valuetype, vreturned));
739 }
740 else {
741
742 initvalue (vreturned, type);
743
744 (*vreturned).data.binaryvalue = value.data.binaryvalue;
745
746 if (langheapallocated (vreturned, nil))
747 pushtmpstackvalue (vreturned); //5.0b17
748
749 return (true);
750
751 /*
752 initvalue (&val, type);
753
754 val.data.binaryvalue = value.data.binaryvalue;
755
756 return (copyvaluerecord (val, vreturned));
757 */
758 }
759 } /*dbgetvalueverb*/
760
761
762 static boolean dbsetvalueverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
763
764 tyodbrecord odbrec;
765 bigstring bsaddress;
766 odbValueRecord value;
767 tyvaluerecord val;
768 boolean flerror;
769
770 if (!getodbvalue (hparam1, 1, &odbrec, false))
771 return (false);
772
773 if (!getstringvalue (hparam1, 2, bsaddress))
774 return (false);
775
776 flnextparamislast = true;
777
778 if (!getparamvalue (hparam1, 3, &val))
779 return (false);
780
781 if (!copyvaluedata (&val))
782 return (false);
783
784 value.valuetype = (odbValueType) langexternalgettypeid (val);
785
786 /*
787 if (val.valuetype == binaryvaluetype)
788 pullfromhandle (val.data.binaryvalue, 0L, sizeof (value.valuetype), &value.valuetype);
789 */
790
791 value.data.binaryvalue = val.data.binaryvalue; /*largest field covers everything*/
792
793 flerror = odberror (odbsetvalue (odbrec.odb, bsaddress, &value));
794
795 disposevaluerecord (val, false);
796
797 if (flerror)
798 return (false);
799
800 return (setbooleanvalue (true, vreturned));
801 } /*dbsetvalueverb*/
802
803
804 static boolean dbdeleteverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
805
806 tyodbrecord odbrec;
807 bigstring bsaddress;
808
809 if (!getodbvalue (hparam1, 1, &odbrec, false))
810 return (false);
811
812 flnextparamislast = true;
813
814 if (!getstringvalue (hparam1, 2, bsaddress))
815 return (false);
816
817 if (odberror (odbdelete (odbrec.odb, bsaddress)))
818 return (false);
819
820 return (setbooleanvalue (true, vreturned));
821 } /*dbdeleteverb*/
822
823
824 static boolean dbnewtableverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
825
826 tyodbrecord odbrec;
827 bigstring bsaddress;
828
829 if (!getodbvalue (hparam1, 1, &odbrec, false))
830 return (false);
831
832 flnextparamislast = true;
833
834 if (!getstringvalue (hparam1, 2, bsaddress))
835 return (false);
836
837 if (odberror (odbnewtable (odbrec.odb, bsaddress)))
838 return (false);
839
840 return (setbooleanvalue (true, vreturned));
841 } /*dbnewtableverb*/
842
843
844 static boolean dbistableverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
845
846 tyodbrecord odbrec;
847 bigstring bsaddress;
848 OSType odbtype;
849
850 if (!getodbvalue (hparam1, 1, &odbrec, true))
851 return (false);
852
853 flnextparamislast = true;
854
855 if (!getstringvalue (hparam1, 2, bsaddress))
856 return (false);
857
858 if (odberror (odbgettype (odbrec.odb, bsaddress, &odbtype)))
859 return (false);
860
861 return (setbooleanvalue (odbtype == tableT, vreturned));
862 } /*dbistableverb*/
863
864
865 static boolean dbcountitemsverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
866
867 tyodbrecord odbrec;
868 bigstring bsaddress;
869 long ctitems;
870
871 if (!getodbvalue (hparam1, 1, &odbrec, true))
872 return (false);
873
874 flnextparamislast = true;
875
876 if (!getstringvalue (hparam1, 2, bsaddress))
877 return (false);
878
879 if (odberror (odbcountitems (odbrec.odb, bsaddress, &ctitems)))
880 return (false);
881
882 return (setlongvalue (ctitems, vreturned));
883 } /*dbcountitemsverb*/
884
885
886 static boolean dbgetnthitemverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
887
888 tyodbrecord odbrec;
889 bigstring bsaddress;
890 bigstring bsname;
891 long n;
892
893 if (!getodbvalue (hparam1, 1, &odbrec, true))
894 return (false);
895
896 if (!getstringvalue (hparam1, 2, bsaddress))
897 return (false);
898
899 flnextparamislast = true;
900
901 if (!getlongvalue (hparam1, 3, &n))
902 return (false);
903
904 if (odberror (odbgetnthitem (odbrec.odb, bsaddress, n, bsname)))
905 return (false);
906
907 return (setstringvalue (bsname, vreturned));
908 } /*dbgetnthitemverb*/
909
910
911 static boolean dbgetmoddateverb (hdltreenode hparam1, tyvaluerecord *vreturned) {
912
913 tyodbrecord odbrec;
914 bigstring bsaddress;
915 unsigned long moddate;
916
917 if (!getodbvalue (hparam1, 1, &odbrec, true))
918 return (false);
919
920 flnextparamislast = true;
921
922 if (!getstringvalue (hparam1, 2, bsaddress))
923 return (false);
924
925 if (odberror (odbgetmoddate (odbrec.odb, bsaddress, &moddate)))
926 return (false);
927
928 return (setdatevalue (moddate, vreturned));
929 } /*dbgetmoddateverb*/
930
931
932 static boolean dbfunctionvalue (short token, hdltreenode hparam1, tyvaluerecord *vreturned, bigstring bserror) {
933
934 /*
935 4.1b4 dmb: new verb set based on odbEngine
936
937 5.0b17 dmb: use swapinthreadglobals (nil) for all our odb calls to protect ours
938 */
939
940 register hdltreenode hp1 = hparam1;
941 register tyvaluerecord *v = vreturned;
942
943 setbooleanvalue (false, v); /*assume the worst*/
944
945 switch (token) {
946
947 case newfunc:
948 return (dbnewverb (hp1, v));
949
950 case openfunc:
951 return (dbopenverb (hp1, v));
952
953 case savefunc:
954 return (dbsaveverb (hp1, v));
955
956 case closefunc:
957 return (dbcloseverb (hp1, v));
958
959 case definedfunc:
960 return (dbdefinedverb (hp1, v));
961
962 case getvaluefunc:
963 return (dbgetvalueverb (hp1, v));
964
965 case setvaluefunc:
966 return (dbsetvalueverb (hp1, v));
967
968 case deletefunc:
969 return (dbdeleteverb (hp1, v));
970
971 case newtablefunc:
972 return (dbnewtableverb (hp1, v));
973
974 case istablefunc:
975 return (dbistableverb (hp1, v));
976
977 case countitemsfunc:
978 return (dbcountitemsverb (hp1, v));
979
980 case getnthitemfunc:
981 return (dbgetnthitemverb (hp1, v));
982
983 case getmoddatefunc:
984 return (dbgetmoddateverb (hp1, v));
985
986 default:
987 return (false);
988 }
989 } /*dbfunctionvalue*/
990
991
992 boolean dbinitverbs (void) {
993
994 if (!loadfunctionprocessor (iddbverbs, &dbfunctionvalue))
995 return (false);
996
997 if (!newclearhandle (sizeof (tyodbrecord), (Handle *) &hodblist))
998 return (false);
999
1000 return (true);
1001 } /*dbinitverbs*/
1002
1003
1004
1005
1006
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.