File:  [local] / rpl / modules / motif / XtAppInitialize.rplc
Revision 1.8: download - view: text, annotated - select for diffs - revision graph
Wed Aug 23 09:40:53 2017 UTC (6 years, 8 months ago) by bertrand
Branches: MAIN
CVS tags: rpl-4_1_35, rpl-4_1_34, rpl-4_1_33, rpl-4_1_32, rpl-4_1_31, rpl-4_1_30, rpl-4_1_29, rpl-4_1_28, HEAD
Ajout de XtOpenApplication.

    1: #include "src/rplexternals.h"
    2: #include "motif.h"
    3: 
    4: declareExternalFunction(XtAppInitialize)
    5:     int             argc;
    6:     String          *argv;
    7:     char            *name;
    8: 
    9:     declareObject(appObject);
   10:     declareObject(nameObject);
   11:     declareObject(widgetObject);
   12: 
   13:     HEADER
   14:         declareHelpString("Initialize application context\n"
   15:                 "    1: \"application name\"\n"
   16:                 " -> 2: AppContext\n"
   17:                 "    1: Widget\n");
   18:         numberOfArguments(1);
   19:     FUNCTION
   20:         pullFromStack(nameObject, string);
   21:         returnOnError(freeObject(nameObject));
   22:         getString(nameObject, name);
   23: 
   24:         argc = 0;
   25:         nullify(argv);
   26: 
   27:         createExternalObject(appObject, APPCONTEXT);
   28:         createExternalObject(widgetObject, WIDGET);
   29: 
   30:         objectOf(appObject) = allocate(size(sXtAppContext));
   31:         objectOf(widgetObject) = allocate(size(Widget));
   32: 
   33:         XtSetLanguageProc(NULL, NULL, NULL);
   34: 
   35:         target(objectContainer(Widget, widgetObject)) =
   36:                 XtVaAppInitialize(address(target(
   37:                 objectContainer(sXtAppContext, appObject)).context),
   38:                 name, NULL, 0, address(argc), argv, NULL, NULL);
   39:         target(objectContainer(sXtAppContext, appObject)).widget =
   40:                 target(objectContainer(Widget, widgetObject));
   41: 
   42:         XtVaSetValues(target(objectContainer(Widget, widgetObject)),
   43:                 XmNtitle, name,
   44:                 NULL);
   45:         freeObject(nameObject);
   46: 
   47:         if (nullified(objectOf(appObject))) then
   48:             executionError("Nullified XtAppContext");
   49:             freeObject(appObject);
   50:             freeObject(widgetObject);
   51:             returnOnError();
   52:         endIf
   53: 
   54:         pushOnStack(appObject);
   55:         pushOnStack(widgetObject);
   56: 
   57:         setFalse(exitMainLoop);
   58:         setTrue(initializationDone);
   59:     END
   60: endExternalFunction
   61: 
   62: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>