Annotation of rpl/modules/motif/XtAppMainLoop.rplc, revision 1.2

1.1       bertrand    1: #include "src/rplexternals.h"
                      2: #include "motif.h"
                      3: 
                      4: declareExternalFunction(XtAppMainLoop)
                      5:    XEvent      event;
                      6: 
                      7:    declareObject(appObject);
                      8: 
                      9:    HEADER
                     10:        declareHelpString("Main loop of a Motif application\n"
                     11:                "    1: AppContext\n");
                     12:        numberOfArguments(1);
                     13:    FUNCTION
                     14:        if (initializationDone eq true) then
                     15:            pullFromStack(appObject, external);
                     16:            returnOnError(freeObject(appObject));
                     17: 
                     18:            if (subType(appObject) ne APPCONTEXT) then
                     19:                executionError("Type mismatch");
                     20:                returnOnError(freeObject(appObject));
                     21:            endIf
                     22: 
                     23:            doUntil
                     24:                if (XtAppPending(target((sXtAppContext *)
                     25:                        objectContainer(appObject)).context) ne 0) then
                     26:                    XtAppNextEvent(target((sXtAppContext *)
                     27:                            objectContainer(appObject)).context, &event);
                     28: 
                     29:                    if (event.type eq DestroyNotify) then
                     30:                        if (event.xdestroywindow.window eq
                     31:                                XtWindow(target((sXtAppContext *)
                     32:                                objectContainer(appObject)).widget)) then
                     33:                            XtAppSetExitFlag(target((sXtAppContext *)
                     34:                                    objectContainer(appObject)).context);
                     35:                        endIf
                     36:                    endIf
                     37: 
                     38:                    XtDispatchEvent(&event);
                     39:                orElse
                     40:                    pollSignalsAndInterrupts();
                     41:                    usleep(10000);
                     42:                endIf
                     43:            repeatUntil(XtAppGetExitFlag(target((sXtAppContext *)
                     44:                    objectContainer(appObject)).context) or
                     45:                    (stopRequest eq -1) or
                     46:                    (exitMainLoop ne 0))
                     47: 
                     48:            XtDestroyApplicationContext(target((sXtAppContext *)
                     49:                    objectContainer(appObject)).context);
                     50:        orElse
                     51:            executionError("Application not initialized");
                     52:            returnOnError();
                     53:        endIf
                     54: 
                     55:        setFalse(initializationDone);
                     56:    END
                     57: endExternalFunction
1.2     ! bertrand   58: 
        !            59: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>