00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #define _XCLIPSTEXT_SOURCE_
00024
00025 #include <stdio.h>
00026 #include <ctype.h>
00027 #include <stdlib.h>
00028
00029 #include <X11/Xatom.h>
00030 #include <X11/IntrinsicP.h>
00031 #include <X11/StringDefs.h>
00032 #include <X11/keysym.h>
00033 #include <X11/Xlib.h>
00034
00035 #include <X11/Xaw/Text.h>
00036
00037 #include <X11/Xmu/Atoms.h>
00038 #include <X11/Xmu/Misc.h>
00039
00040 #ifdef XAW3D
00041 #include <X11/Xaw3d/TextP.h>
00042 #else
00043 #include <X11/Xaw/TextP.h>
00044 #endif
00045
00046 #include "setup.h"
00047
00048 #include "commline.h"
00049 #include "evaluatn.h"
00050 #include "filertr.h"
00051 #include "router.h"
00052
00053 #include "xclips.h"
00054 #include "xedit.h"
00055 #include "xmenu_file.h"
00056 #include "xmenu_exec.h"
00057 #include "xmenu_wind.h"
00058 #include "xclipstext.h"
00059 #include "xmain.h"
00060
00061 static void StartAction(TextWidget,XEvent *);
00062 static void EndAction(TextWidget);
00063 static void StuffFromBuffer(TextWidget,int);
00064 static void _SelectionReceived(Widget,caddr_t,Atom *,Atom *,caddr_t,unsigned long *,int *);
00065 static void _ClipsSelectionReceived(Widget,caddr_t,Atom *,Atom *,caddr_t,unsigned long *,int *);
00066 static void GetSelection(Widget,Time,String *,Cardinal);
00067 static void ClipsGetSelection(Widget,Time,String *,Cardinal);
00068 static void InsertClipsSelection(Widget,XEvent *,String *,Cardinal *);
00069 static void Move(TextWidget,XEvent *,XawTextScanDirection,XawTextScanType,Boolean);
00070 static void _DeleteOrKill(TextWidget,XawTextPosition, XawTextPosition,Boolean);
00071 static void DeleteOrKill(TextWidget,XEvent *,XawTextScanDirection,XawTextScanType,Boolean,Boolean);
00072 static void DeleteClipsBackwardChar(Widget,XEvent *);
00073 static void InsertClipsNewLine(Widget,XEvent *);
00074 static void AutoFill(TextWidget);
00075 static void InsertClipsChar(Widget,XEvent *);
00076 static void Clear_CLIPS(Widget,XEvent *);
00077 static void IntReset(Widget,XEvent *);
00078 static void FactsWindow(Widget,XEvent *);
00079 static void AgendaWindow(Widget,XEvent *);
00080 static void LoadRulesProc(Widget,XEvent *);
00081 static void Dribble(Widget,XEvent *);
00082 static void QuitProc(Widget,XEvent *);
00083 static void IntRun(Widget,XEvent *);
00084 static void SaveRules(Widget,XEvent *);
00085 static void Step(Widget,XEvent *);
00086 static void Edit(Widget,XEvent *);
00087 static void CommandLineCLIPS(Widget,XEvent *);
00088 static void FindBalance(Widget,XEvent *);
00089 static void CompleteConstructInDialog(Widget,XEvent *);
00090 static void CompleteConstructInEditor(Widget,XEvent *);
00091 static void ClearScreen(Widget,XEvent *);
00092 static void StopExecution(Widget,XEvent *);
00093
00094
00095 #define SrcScan XawTextSourceScan
00096 #define FindDist XawTextSinkFindDistance
00097 #define FindPos XawTextSinkFindPosition
00098
00099
00100
00101
00102
00103
00104 static void StartAction(
00105 TextWidget ctx,
00106 XEvent *event)
00107 {
00108 _XawTextPrepareToUpdate(ctx);
00109 if (event != NULL) {
00110 switch (event->type) {
00111 case ButtonPress:
00112 case ButtonRelease:
00113 ctx->text.time = event->xbutton.time;
00114 ctx->text.ev_x = event->xbutton.x;
00115 ctx->text.ev_y = event->xbutton.y;
00116 break;
00117 case KeyPress:
00118 case KeyRelease:
00119 ctx->text.time = event->xkey.time;
00120 ctx->text.ev_x = event->xkey.x;
00121 ctx->text.ev_y = event->xkey.y;
00122 break;
00123 case MotionNotify:
00124 ctx->text.time = event->xmotion.time;
00125 ctx->text.ev_x = event->xmotion.x;
00126 ctx->text.ev_y = event->xmotion.y;
00127 break;
00128 case EnterNotify:
00129 case LeaveNotify:
00130 ctx->text.time = event->xcrossing.time;
00131 ctx->text.ev_x = event->xcrossing.x;
00132 ctx->text.ev_y = event->xcrossing.y;
00133 }
00134 }
00135 }
00136
00137 static void EndAction(
00138 TextWidget ctx)
00139 {
00140 _XawTextCheckResize(ctx);
00141 _XawTextExecuteUpdate(ctx);
00142 ctx->text.mult = 1;
00143 }
00144
00145
00146
00147
00148
00149
00150
00151 static void StuffFromBuffer(
00152 TextWidget ctx,
00153 int buffer)
00154 {
00155 XawTextBlock text;
00156 text.ptr = XFetchBuffer(XtDisplay(ctx), &(text.length), buffer);
00157 text.firstPos = 0;
00158 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
00159 XBell(XtDisplay(ctx), 0);
00160 return;
00161 }
00162 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
00163 XawstPositions, XawsdRight, text.length, TRUE);
00164 XtFree(text.ptr);
00165 }
00166
00167 void UnKill(
00168 TextWidget ctx,
00169 XEvent *event)
00170 {
00171 StartAction(ctx, event);
00172 StuffFromBuffer(ctx, 1);
00173 EndAction(ctx);
00174 }
00175
00176 void Stuff(
00177 TextWidget ctx,
00178 XEvent *event)
00179 {
00180 StartAction(ctx, event);
00181 StuffFromBuffer(ctx, 0);
00182 EndAction(ctx);
00183 }
00184
00185
00186 struct _SelectionList
00187 {
00188 String *params;
00189 Cardinal count;
00190 Time time;
00191 };
00192
00193
00194 static void _SelectionReceived(
00195 Widget w,
00196 caddr_t client_data,
00197 Atom *selection,
00198 Atom *type,
00199 caddr_t value,
00200 unsigned long *length,
00201 int *format)
00202 {
00203 TextWidget ctx = (TextWidget)w;
00204 XawTextBlock text;
00205
00206 if (*type == 0 || *length == 0) {
00207 struct _SelectionList* list = (struct _SelectionList*)client_data;
00208 if (list != NULL) {
00209 GetSelection(w, list->time, list->params, list->count);
00210 XtFree(client_data);
00211 }
00212 return;
00213 }
00214
00215 StartAction(ctx, NULL);
00216 text.ptr = (char*)value;
00217 text.firstPos = 0;
00218 text.length = *length;
00219 text.format = FMT8BIT;
00220 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
00221 XBell(XtDisplay(ctx), 0);
00222 return;
00223 }
00224 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
00225 XawstPositions, XawsdRight, text.length, TRUE);
00226
00227 EndAction(ctx);
00228 _XawTextSetScrollBars(ctx);
00229 XtFree(client_data);
00230 XtFree(value);
00231 }
00232
00233 static void _ClipsSelectionReceived(
00234 Widget w,
00235 caddr_t client_data,
00236 Atom *selection,
00237 Atom *type,
00238 caddr_t value,
00239 unsigned long *length,
00240 int *format)
00241 {
00242 TextWidget ctx = (TextWidget)w;
00243 XawTextBlock text;
00244 char *cmdstr;
00245
00246 if (*type == 0 || *length == 0) {
00247 struct _SelectionList* list = (struct _SelectionList*)client_data;
00248 if (list != NULL) {
00249 ClipsGetSelection(w, list->time, list->params, list->count);
00250 XtFree(client_data);
00251 }
00252 return;
00253 }
00254 StartAction(ctx, NULL);
00255 text.ptr = (char*)value;
00256 if(send_to_clips)
00257 {
00258 cmdstr = GetCommandString(GetCurrentEnvironment());
00259 if(cmdstr == NULL)
00260 {
00261 SetCommandString(GetCurrentEnvironment(),text.ptr);
00262 }
00263 else
00264 {
00265 AppendCommandString(GetCurrentEnvironment(),text.ptr);
00266 }
00267 send_to_clips = False;
00268 }
00269 text.firstPos = 0;
00270 text.length = *length;
00271 text.format = FMT8BIT;
00272 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text)) {
00273 XBell(XtDisplay(ctx), 0);
00274 return;
00275 }
00276 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos,
00277 XawstPositions, XawsdRight, text.length, TRUE);
00278
00279 EndAction(ctx);
00280 _XawTextSetScrollBars(ctx);
00281 XtFree(client_data);
00282 XtFree(value);
00283 }
00284
00285 static void GetSelection(
00286 Widget w,
00287 Time time,
00288 String *params,
00289 Cardinal num_params)
00290 {
00291 Atom selection;
00292 int buffer;
00293
00294 XmuInternStrings(XtDisplay(w), params, (Cardinal)1, &selection);
00295 switch (selection) {
00296 case XA_CUT_BUFFER0: buffer = 0; break;
00297 case XA_CUT_BUFFER1: buffer = 1; break;
00298 case XA_CUT_BUFFER2: buffer = 2; break;
00299 case XA_CUT_BUFFER3: buffer = 3; break;
00300 case XA_CUT_BUFFER4: buffer = 4; break;
00301 case XA_CUT_BUFFER5: buffer = 5; break;
00302 case XA_CUT_BUFFER6: buffer = 6; break;
00303 case XA_CUT_BUFFER7: buffer = 7; break;
00304 default: buffer = -1;
00305 }
00306 if (buffer >= 0) {
00307 int nbytes;
00308 unsigned long length;
00309 int fmt8 = 8;
00310 Atom type = XA_STRING;
00311 char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer);
00312 if ((length = nbytes) != 0)
00313 _SelectionReceived(w, NULL, &selection, &type, (caddr_t)line,
00314 &length, &fmt8);
00315 else if (num_params > 1)
00316 GetSelection(w, time, params+1, num_params-1);
00317 } else {
00318 struct _SelectionList* list;
00319 if (--num_params) {
00320 list = XtNew(struct _SelectionList);
00321 list->params = params + 1;
00322 list->count = num_params;
00323 list->time = time;
00324 } else list = NULL;
00325 XtGetSelectionValue(w, selection, XA_STRING,
00326 (XtSelectionCallbackProc)_SelectionReceived,
00327 (XtPointer)list, time);
00328 }
00329 }
00330
00331 static void ClipsGetSelection(
00332 Widget w,
00333 Time time,
00334 String *params,
00335 Cardinal num_params)
00336 {
00337 Atom selection;
00338 int buffer;
00339
00340
00341 selection = XInternAtom(XtDisplay(w), *params, False);
00342 switch (selection) {
00343 case XA_CUT_BUFFER0: buffer = 0; break;
00344 case XA_CUT_BUFFER1: buffer = 1; break;
00345 case XA_CUT_BUFFER2: buffer = 2; break;
00346 case XA_CUT_BUFFER3: buffer = 3; break;
00347 case XA_CUT_BUFFER4: buffer = 4; break;
00348 case XA_CUT_BUFFER5: buffer = 5; break;
00349 case XA_CUT_BUFFER6: buffer = 6; break;
00350 case XA_CUT_BUFFER7: buffer = 7; break;
00351 default: buffer = -1;
00352 }
00353 if (buffer >= 0) {
00354 int nbytes;
00355 unsigned long length;
00356 int fmt8 = 8;
00357 Atom type = XA_STRING;
00358 char *line = XFetchBuffer(XtDisplay(w), &nbytes, buffer);
00359 if ((length = nbytes) != 0)
00360 _ClipsSelectionReceived(w, NULL, &selection, &type, (caddr_t)line,
00361 &length, &fmt8);
00362 else if (num_params > 1)
00363 ClipsGetSelection(w, time, params+1, num_params-1);
00364 } else {
00365 struct _SelectionList* list;
00366
00367 if (--num_params) {
00368 list = (struct _SelectionList*)XtNew(struct _SelectionList);
00369 list->params = params + 1;
00370 list->count = num_params;
00371 list->time = time;
00372 } else list = NULL;
00373 XtGetSelectionValue(w, selection, XA_STRING,
00374 (XtSelectionCallbackProc)_ClipsSelectionReceived,
00375 (XtPointer)list, time);
00376 }
00377 }
00378
00379 static void InsertClipsSelection(
00380 Widget w,
00381 XEvent *event,
00382 String *params,
00383 Cardinal *num_params)
00384 {
00385 MoveEndOfFile(dialog_text,event);
00386 StartAction((TextWidget) w, event);
00387 ClipsGetSelection(w, ((TextWidget) w)->text.time, params, *num_params);
00388 EndAction((TextWidget) w);
00389 }
00390
00391
00392
00393
00394
00395
00396
00397 static void Move(
00398 TextWidget ctx,
00399 XEvent *event,
00400 XawTextScanDirection dir,
00401 XawTextScanType type,
00402 Boolean include)
00403 {
00404 StartAction(ctx, event);
00405 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, type, dir, ctx->text.mult, include);
00406 EndAction(ctx);
00407 }
00408
00409 void MoveBeginningOfFile(
00410 Widget w,
00411 XEvent *event)
00412 {
00413 Move((TextWidget) w, event, XawsdLeft, XawstAll, TRUE);
00414 }
00415
00416 void MoveEndOfFile(
00417 Widget w,
00418 XEvent *event)
00419 {
00420 Move((TextWidget) w, event, XawsdRight, XawstAll, TRUE);
00421 }
00422
00423
00424
00425
00426
00427
00428
00429 static void _DeleteOrKill(
00430 TextWidget ctx,
00431 XawTextPosition from,
00432 XawTextPosition to,
00433 Boolean kill)
00434 {
00435 XawTextBlock text;
00436 char *ptr;
00437
00438 if (kill && from < to)
00439 {
00440 ptr = (char *) _XawTextGetText(ctx, from, to);
00441 XStoreBuffer(XtDisplay(ctx), ptr, strlen(ptr), 1);
00442 XtFree(ptr);
00443 }
00444 text.length = 0;
00445 text.firstPos = 0;
00446 if (_XawTextReplace(ctx, from, to, &text))
00447 {
00448 XBell(XtDisplay(ctx), 50);
00449 return;
00450 }
00451 ctx->text.insertPos = from;
00452 ctx->text.showposition = TRUE;
00453 }
00454
00455 static void DeleteOrKill(
00456 TextWidget ctx,
00457 XEvent *event,
00458 XawTextScanDirection dir,
00459 XawTextScanType type,
00460 Boolean include,
00461 Boolean kill)
00462 {
00463 XawTextPosition from, to;
00464
00465 StartAction(ctx, event);
00466 to = SrcScan(ctx->text.source, ctx->text.insertPos, type, dir, ctx->text.mult, include);
00467
00468 if (dir == XawsdLeft)
00469 {
00470 from = to;
00471 to = ctx->text.insertPos;
00472 }
00473 else
00474 from = ctx->text.insertPos;
00475
00476 _DeleteOrKill(ctx, from, to, kill);
00477 _XawTextSetScrollBars(ctx);
00478 EndAction(ctx);
00479 }
00480
00481 static void DeleteClipsBackwardChar(
00482 Widget w,
00483 XEvent *event)
00484 {
00485 TextWidget ctx = (TextWidget)w;
00486 char *cmdstr,strbuf[2];
00487
00488 MoveEndOfFile(w,event);
00489 strbuf[1] = 0;
00490 if(RouterData(GetCurrentEnvironment())->CommandBufferInputCount == 0)
00491 return;
00492 if((!quit_get_event)&&(get_clips_command())&& (!GetManagerList()))
00493 {
00494 cmdstr = GetCommandString(GetCurrentEnvironment());
00495 if((cmdstr != NULL) ? (cmdstr[0] != EOS) :FALSE)
00496 {
00497 strbuf[0] = (char) XK_BackSpace;
00498 ExpandCommandString(GetCurrentEnvironment(),strbuf[0]);
00499 }
00500 }
00501 DeleteOrKill(ctx, event, XawsdLeft, XawstPositions, TRUE, FALSE);
00502 }
00503
00504 void DeleteCurrentSelection(
00505 Widget w,
00506 XEvent *event)
00507 {
00508 _XawTextZapSelection( (TextWidget) w, event, FALSE);
00509 }
00510
00511
00512
00513
00514
00515
00516
00517 static int InsertNewLineAndBackupInternal(
00518 TextWidget ctx)
00519 {
00520 int count, error = XawEditDone;
00521 XawTextBlock text;
00522 char *buf, *ptr;
00523
00524 ptr = buf = XtMalloc(sizeof(char) * ctx->text.mult);
00525 for (count = 0; count < ctx->text.mult; count++, ptr++)
00526 ptr[0] = '\n';
00527
00528 text.length = ctx->text.mult;
00529 text.ptr = buf;
00530 text.firstPos = 0;
00531 text.format = FMT8BIT;
00532
00533 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text))
00534 {
00535 XBell( XtDisplay(ctx), 50);
00536 error = XawEditError;
00537 }
00538 else
00539 ctx->text.showposition = TRUE;
00540
00541 XtFree(buf);
00542 return(error);
00543 }
00544
00545 int LocalClipsInsertNewLine(
00546 TextWidget ctx,
00547 XEvent *event)
00548 {
00549
00550 StartAction(ctx, event);
00551 if (InsertNewLineAndBackupInternal(ctx) == XawEditError)
00552 return(XawEditError);
00553 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, ctx->text.mult, TRUE);
00554 EndAction(ctx);
00555 _XawTextSetScrollBars(ctx);
00556 return(XawEditDone);
00557 }
00558
00559 static void InsertClipsNewLine(
00560 Widget w,
00561 XEvent *event)
00562 {
00563 TextWidget ctx = (TextWidget)w;
00564 char strbuf[2];
00565 strbuf[1] = 0;
00566
00567 MoveEndOfFile(w,event);
00568 if((!quit_get_event)&&(get_clips_command())&& (!GetManagerList()))
00569 {
00570 strbuf[0] = (char) XK_Linefeed;
00571 ExpandCommandString(GetCurrentEnvironment(),strbuf[0]);
00572 quit_get_event = True;
00573 }
00574 (void)LocalClipsInsertNewLine(ctx,event);
00575 }
00576
00577
00578
00579
00580
00581
00582
00583 XComposeStatus compose_status = {NULL, 0};
00584
00585
00586
00587
00588
00589
00590
00591
00592 static void AutoFill(
00593 TextWidget ctx)
00594 {
00595 int width, height, x, line_num, max_width;
00596 XawTextPosition ret_pos;
00597 XawTextBlock text;
00598
00599 if ( !((ctx->text.auto_fill) && (ctx->text.mult == 1)) )
00600 return;
00601
00602 for ( line_num = 0; line_num < ctx->text.lt.lines ; line_num++)
00603 if ( ctx->text.lt.info[line_num].position >= ctx->text.insertPos )
00604 break;
00605 line_num--;
00606
00607 max_width = Max(0, ctx->core.width - HMargins(ctx));
00608
00609 x = ctx->text.margin.left;
00610 XawTextSinkFindPosition( ctx->text.sink,ctx->text.lt.info[line_num].position, x, max_width, TRUE, &ret_pos, &width, &height);
00611
00612 if ( ret_pos >= ctx->text.insertPos )
00613 return;
00614
00615 text.ptr = "\n";
00616 text.length = 1;
00617 text.firstPos = 0;
00618 text.format = FMT8BIT;
00619
00620 _XawTextReplace(ctx, ret_pos - 1, ret_pos, &text);
00621 }
00622
00623 static void InsertClipsChar(
00624 Widget w,
00625 XEvent *event)
00626 {
00627 TextWidget ctx = (TextWidget) w;
00628 char *ptr, strbuf[BUFSIZ];
00629 int count, error;
00630 KeySym keysym;
00631 XawTextBlock text;
00632
00633 MoveEndOfFile(w, event);
00634 if ( (text.length = XLookupString (&event->xkey, strbuf, BUFSIZ, &keysym, &compose_status)) == 0)
00635 return;
00636 if((!quit_get_event)&&(get_clips_command())&& (!GetManagerList()))
00637 {
00638 strbuf[1] = 0;
00639 if((keysym>= XK_space) && (keysym<= XK_asciitilde))
00640 {
00641 ExpandCommandString(GetCurrentEnvironment(),strbuf[0]);
00642 }
00643 }
00644 else
00645 return;
00646 text.ptr = ptr = XtMalloc(sizeof(char) * text.length * ctx->text.mult);
00647 for (count = 0 ; count < ctx->text.mult ; count++)
00648 {
00649 strncpy(ptr, strbuf, text.length);
00650 ptr += text.length;
00651 }
00652
00653 text.length = text.length * ctx->text.mult;
00654 text.firstPos = 0;
00655 text.format = FMT8BIT;
00656
00657 StartAction(ctx, event);
00658
00659 error = _XawTextReplace(ctx, ctx->text.insertPos,ctx->text.insertPos, &text);
00660
00661 if (error == XawEditDone)
00662 {
00663 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, text.length, TRUE);
00664 AutoFill(ctx);
00665 }
00666 else
00667 XBell(XtDisplay(ctx), 50);
00668
00669 XtFree(text.ptr);
00670 EndAction(ctx);
00671 _XawTextSetScrollBars(ctx);
00672 }
00673
00674
00675 void InsertClipsString(
00676 Widget w,
00677 XEvent *event,
00678 String *params,
00679 Cardinal *num_params)
00680 {
00681 TextWidget ctx = (TextWidget) w;
00682 XawTextBlock text;
00683 int i;
00684
00685 text.firstPos = 0;
00686 StartAction(ctx, event);
00687 for (i = *num_params; i; i--, params++)
00688 {
00689 unsigned char hexval;
00690 if ((*params)[0] == '0' && (*params)[1] == 'x' && (*params)[2] != '\0')
00691 {
00692 char c, *p;
00693 hexval = 0;
00694 for (p = *params+2; (c = *p); p++)
00695 {
00696 hexval *= 16;
00697 if (c >= '0' && c <= '9')
00698 hexval += c - '0';
00699 else if (c >= 'a' && c <= 'f')
00700 hexval += c - 'a' + 10;
00701 else if (c >= 'A' && c <= 'F')
00702 hexval += c - 'A' + 10;
00703 else break;
00704 }
00705 if (c == '\0')
00706 {
00707 text.ptr = (char*)&hexval;
00708 text.length = 1;
00709 }
00710 else
00711 text.length = strlen(text.ptr = *params);
00712 }
00713 else
00714 text.length = strlen(text.ptr = *params);
00715 if (text.length == 0)
00716 continue;
00717 if (_XawTextReplace(ctx, ctx->text.insertPos, ctx->text.insertPos, &text))
00718 {
00719 XBell(XtDisplay(ctx), 50);
00720 EndAction(ctx);
00721 return;
00722 }
00723 ctx->text.insertPos = SrcScan(ctx->text.source, ctx->text.insertPos, XawstPositions, XawsdRight, text.length, TRUE);
00724 }
00725 EndAction(ctx);
00726
00727 }
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739 static void Clear_CLIPS(
00740 Widget w,
00741 XEvent *event)
00742 {
00743 ClearCLIPSCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00744 }
00745
00746
00747
00748
00749
00750
00751
00752
00753
00754
00755 static void IntReset(
00756 Widget w,
00757 XEvent *event)
00758 {
00759 ResetCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00760 }
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770
00771 static void FactsWindow(
00772 Widget w,
00773 XEvent *event)
00774 {
00775 FactsWindowCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00776 }
00777
00778
00779
00780
00781
00782
00783
00784
00785
00786
00787 static void AgendaWindow(
00788 Widget w,
00789 XEvent *event)
00790 {
00791 AgendaWindowCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00792 }
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802
00803 static void LoadRulesProc(
00804 Widget w,
00805 XEvent *event)
00806 {
00807 LoadRulesCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00808 }
00809
00810
00811
00812
00813
00814
00815
00816
00817
00818
00819 static void Dribble(
00820 Widget w,
00821 XEvent *event)
00822 {
00823 DribbleCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00824 }
00825
00826
00827
00828
00829
00830
00831
00832
00833
00834
00835 static void QuitProc(
00836 Widget w,
00837 XEvent *event)
00838 {
00839 QuitCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00840 }
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851 static void IntRun(
00852 Widget w,
00853 XEvent *event)
00854 {
00855 RunCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00856 }
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867 static void SaveRules(
00868 Widget w,
00869 XEvent *event)
00870 {
00871 SaveRulesCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00872 }
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883 static void Step(
00884 Widget w,
00885 XEvent *event)
00886 {
00887 StepCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00888 }
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899 static void Edit(
00900 Widget w,
00901 XEvent *event)
00902 {
00903 EditCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00904 }
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 static void CommandLineCLIPS(
00916 Widget w,
00917 XEvent *event)
00918 {
00919 CommandLineCLIPSCallback(w, (XtPointer)NULL, (XtPointer)NULL);
00920 }
00921
00922
00923
00924
00925
00926
00927
00928
00929
00930
00931 static void FindBalance(
00932 Widget w,
00933 XEvent *event)
00934 {
00935 FindMatchingParenthesisCallback(w,(XtPointer)w,(XtPointer)NULL);
00936 }
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947 static void CompleteConstructInDialog(
00948 Widget w,
00949 XEvent *event)
00950 {
00951 CompletionDialogCallback(w,NULL,(XtPointer)NULL);
00952 }
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963 static void CompleteConstructInEditor(
00964 Widget w,
00965 XEvent *event)
00966 {
00967 CompletionEditCallback(w,(XtPointer)w,(XtPointer)NULL);
00968 }
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980 static void ClearScreen(
00981 Widget w,
00982 XEvent *event)
00983 {
00984 ClearScreenCallback(w,(XtPointer)w,(XtPointer)NULL);
00985 }
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996 static void StopExecution(
00997 Widget w,
00998 XEvent *event)
00999 {
01000
01001 if(periodicChecking)
01002 {
01003 SetHaltExecution(GetCurrentEnvironment(),TRUE);
01004 CloseAllFiles(GetCurrentEnvironment());
01005 }
01006 }
01007
01008
01009
01010
01011
01012
01013
01014 XtActionsRec ClipsTxtActsTable[] =
01015 {
01016
01017 {"delete-clips-previous-character", (XtActionProc)DeleteClipsBackwardChar},
01018
01019 {"Clipsnewline", (XtActionProc)InsertClipsNewLine},
01020
01021 {"insert-clips-selection", (XtActionProc)InsertClipsSelection},
01022
01023 {"insert-clips-string", (XtActionProc)InsertClipsString},
01024 {"insert-clips-char", (XtActionProc)InsertClipsChar},
01025
01026 {"clear-clips", (XtActionProc)Clear_CLIPS},
01027 {"reset", (XtActionProc)IntReset},
01028 {"facts-window", (XtActionProc)FactsWindow},
01029 {"agenda-window", (XtActionProc)AgendaWindow},
01030 {"load-constructs", (XtActionProc)LoadRulesProc},
01031 {"dribble", (XtActionProc)Dribble},
01032 {"quit", (XtActionProc)QuitProc},
01033 {"run", (XtActionProc)IntRun},
01034 {"save-rules", (XtActionProc)SaveRules},
01035 {"step", (XtActionProc)Step},
01036 {"edit", (XtActionProc)Edit},
01037 {"command-line-clips", (XtActionProc)CommandLineCLIPS},
01038 {"balance", (XtActionProc)FindBalance},
01039 {"clear-screen", (XtActionProc)ClearScreen},
01040 {"complete-construct-dialog", (XtActionProc)CompleteConstructInDialog},
01041 {"complete-construct-editor", (XtActionProc)CompleteConstructInEditor},
01042 {"stop-execution", (XtActionProc)StopExecution},
01043 };
01044
01045 Cardinal ClipsTxtActsTableCount = XtNumber(ClipsTxtActsTable);
01046