00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 #include "udanax.h"
00085 #include "requests.h"
00086
00087 extern FILE *logfile;
00088 extern FILE *nulllog;
00089 extern FILE *reallog;
00090 extern bool logstuff;
00091 extern FILE *interfaceinput;
00092
00093 bool gettumbler(Session * sess, Tumbler * tumblerptr);
00094 bool gettextset(Session * sess, typetextset * textsetptr);
00095 bool getspecset(Session * sess, typespecset * specsetptr);
00096 bool getcutseq(Session * sess, typecutseq * cutseqptr);
00097 bool getspanset(Session * sess, typespanset * spansetptr, typeitemid id);
00098 bool kluge();
00099 bool getnumber(Session * sess, int * numptr);
00100 bool getspan(Session * sess, typespan * spanptr, typeitemid id);
00101 void prompt(Session * sess, char *string);
00102 bool getfindlinksfromtothree(Session * sess, typespecset * fromvspecsetptr, typespecset * tovspecsetptr, typespecset * threevspecsetptr, typeispanset * homesetptr);
00103 bool validaccount(Session * sess, IStreamAddr * accountptr);
00104
00112 bool
00113 getinsert(
00114 Session *sess,
00115 IStreamAddr *docisaptr,
00116 Tumbler *vsaptr,
00117 typetextset *textsetptr)
00118 {
00119
00120 logstuff = true;
00121 fprintf(interfaceinput, "%d~", INSERT);
00122 return (gettumbler(sess, docisaptr)
00123 && gettumbler(sess, vsaptr)
00124 && gettextset(sess, textsetptr));
00125
00126
00127
00128
00129
00130
00131 }
00132
00140 bool
00141 getretrievedocvspanset(
00142 Session *sess,
00143 IStreamAddr *docisaptr)
00144 {
00145
00146 return (gettumbler(sess, docisaptr));
00147 }
00148
00156 bool
00157 getcopy(
00158 Session *sess,
00159 IStreamAddr *docisaptr,
00160 IStreamAddr *vsaptr,
00161 typespecset *localspecsetptr)
00162 {
00163
00164 logstuff = true;
00165 fprintf(interfaceinput, "%d~", COPY);
00166 return (gettumbler(sess, docisaptr)
00167 && gettumbler(sess, vsaptr)
00168 && getspecset(sess, localspecsetptr));
00169 }
00170
00178 bool
00179 getrearrange(
00180 Session *sess,
00181 IStreamAddr *docisaptr,
00182 typecutseq *cutseqptr)
00183 {
00184
00185 logstuff = true;
00186 fprintf(interfaceinput, "%d~", REARRANGE);
00187 return (gettumbler(sess, docisaptr)
00188 && getcutseq(sess, cutseqptr));
00189 }
00190
00198 bool
00199 getcreatelink(
00200 Session *sess,
00201 IStreamAddr *docisaptr,
00202 typespecset *fromspecsetptr,
00203 typespecset *tospecsetptr,
00204 typespecset *threespecsetptr)
00205 {
00206 logstuff = true;
00207 fprintf(interfaceinput, "%d~", CREATELINK);
00208 return (gettumbler(sess, docisaptr)
00209 && getspecset(sess, fromspecsetptr)
00210 && getspecset(sess, tospecsetptr)
00211 && getspecset(sess, threespecsetptr));
00212 }
00213
00221 bool
00222 getretrievev(
00223 Session *sess,
00224 typespecset *specsetptr)
00225 {
00226
00227
00228 if (getspecset(sess, specsetptr)) {
00229 return (true);
00230 } else {
00231 return (false);
00232 }
00233 }
00234
00242 bool
00243 getfindnumoflinksfromtothree(
00244 Session *sess,
00245 typespecset *fromvspecsetptr,
00246 typespecset *tovspecsetptr,
00247 typespecset *threevspecsetptr,
00248 typeispanset *homesetptr)
00249 {
00250 return (getfindlinksfromtothree(sess, fromvspecsetptr, tovspecsetptr, threevspecsetptr, homesetptr));
00251 }
00252
00260 bool
00261 getfindlinksfromtothree(
00262 Session *sess,
00263 typespecset *fromvspecsetptr,
00264 typespecset *tovspecsetptr,
00265 typespecset *threevspecsetptr,
00266 typeispanset *homesetptr)
00267 {
00268 return (getspecset(sess, fromvspecsetptr)
00269 && getspecset(sess, tovspecsetptr)
00270 && getspecset(sess, threevspecsetptr)
00271 && getspanset(sess, homesetptr, ISPANID) && kluge());
00272 }
00273
00281 bool
00282 getfindnextnlinksfromtothree(
00283 Session *sess,
00284 typespecset *fromvspecsetptr,
00285 typespecset *tovspecsetptr,
00286 typespecset *threevspecsetptr,
00287 typeispanset *homesetptr,
00288 IStreamAddr *lastlinkptr,
00289 int *nptr)
00290 {
00291 return getfindlinksfromtothree(sess, fromvspecsetptr, tovspecsetptr, threevspecsetptr, homesetptr)
00292 && gettumbler(sess, lastlinkptr)
00293 && getnumber(sess, nptr);
00294 }
00295
00303 bool
00304 getshowrelationof2versions(
00305 Session *sess,
00306 typespecset *version1ptr,
00307 typespecset *version2ptr)
00308 {
00309 return getspecset(sess, version1ptr)
00310 && getspecset(sess, version2ptr);
00311 }
00312
00320
00321 void
00322 getcreatenewdocument()
00323 {
00324 logstuff = true;
00325 fprintf(interfaceinput, "%d~", CREATENEWDOCUMENT);
00326 }
00327
00335 bool
00336 getdeletevspan(
00337 Session *sess,
00338 IStreamAddr *docisaptr,
00339 typevspan *vspanptr)
00340 {
00341
00342 logstuff = true;
00343 fprintf(interfaceinput, "%d~", DELETEVSPAN);
00344 return (gettumbler(sess, docisaptr)
00345 && getspan(sess, vspanptr, VSPANID));
00346 }
00347
00355 bool
00356 getcreatenewversion(
00357 Session *sess,
00358 IStreamAddr *docisaptr)
00359 {
00360
00361 logstuff = true;
00362 fprintf(interfaceinput, "%d~", CREATENEWVERSION);
00363 return (gettumbler(sess, docisaptr));
00364 }
00365
00373 bool
00374 getretrievedocvspan(
00375 Session *sess,
00376 IStreamAddr *docisaptr)
00377 {
00378
00379 return (gettumbler(sess, docisaptr));
00380 }
00381
00389 void
00390 setdebug(
00391 Session *sess)
00392 {
00393 getnumber(sess, &debug);
00394 }
00395
00396
00397
00398
00399
00407 bool
00408 getfollowlink(
00409 Session *sess,
00410 IStreamAddr *linkisaptr,
00411 int *whichendptr)
00412 {
00413
00414 return getnumber(sess, whichendptr)
00415 && gettumbler(sess, linkisaptr);
00416 }
00417
00418
00419
00420
00421
00429 bool
00430 getfinddocscontaining(
00431 Session *sess,
00432 typespecset *specsetptr)
00433 {
00434
00435 return getspecset(sess, specsetptr);
00436 }
00437
00445 bool
00446 getretrieveendsets(
00447 Session *sess,
00448 typespecset *specsetptr)
00449 {
00450
00451 return getspecset(sess, specsetptr);
00452 }
00453
00461 bool
00462 kluge()
00463 {
00464 return (true);
00465 }
00466
00474 void
00475 playwithalloc(
00476 Session *sess)
00477 {
00478 prompt(sess, "playwithalloc\n");
00479 lookatalloc();
00480 }
00481
00482 #include "players.h"
00483
00491 bool
00492 getxaccount(
00493 Session *sess,
00494 IStreamAddr *accountptr)
00495 {
00496 logstuff = true;
00497 if (interfaceinput)
00498 fprintf(interfaceinput, "%d~", XACCOUNT);
00499
00500 gettumbler(sess, accountptr)
00501 && validaccount(sess, accountptr);
00502 player[user].account = *accountptr;
00503 sess->account = *accountptr;
00504 return (true);
00505 }
00506
00514 bool
00515 getcreatenode_or_account(
00516 Session *sess,
00517 Tumbler *tp)
00518 {
00519 logstuff = true;
00520 if (interfaceinput)
00521 fprintf(interfaceinput, "%d~", CREATENODE_OR_ACCOUNT);
00522 gettumbler(sess, tp);
00523 return (true);
00524
00525 }
00526
00534 void
00535 logaccount(
00536 Tumbler *tp)
00537 {
00538 if (interfaceinput) {
00539 fprintf(interfaceinput, "%d~", XACCOUNT);
00540 puttumbler(interfaceinput, tp);
00541 }
00542 }
00543
00551 bool
00552 getclose(
00553 Session *sess,
00554 Tumbler *tp)
00555 {
00556 logstuff = true;
00557 if (interfaceinput)
00558 fprintf(interfaceinput, "%d~", CLOSE);
00559 gettumbler(sess, tp);
00560 return (true);
00561 }
00562
00570 bool
00571 getopen(
00572 Session *sess,
00573 Tumbler *tp,
00574 int *typep,
00575 int *modep)
00576 {
00577 logstuff = true;
00578 if (interfaceinput)
00579 fprintf(interfaceinput, "%d~", OPEN);
00580 gettumbler(sess, tp);
00581 getnumber(sess, typep);
00582 getnumber(sess, modep);
00583 return (*typep != NOBERTREQUIRED);
00584 }