Annotation of rpl/modules/motif/motif.rplc, revision 1.1

1.1     ! bertrand    1: #define __RPLC_MAIN
        !             2: #include "src/rplexternals.h"
        !             3: #include "motif.h"
        !             4: 
        !             5: libraryName(motif);
        !             6: 
        !             7: exportExternalFunctions(
        !             8:        XSynchronize,
        !             9:        XtAddCallback,
        !            10:        XtAppInitialize,
        !            11:        XtAppMainLoop,
        !            12:        XtAppExitMainLoop,
        !            13:        XtCreatePopupShell,
        !            14:        XtCreateWidget,
        !            15:        XtDestroyWidget,
        !            16:        XtPopdown,
        !            17:        XtPopup,
        !            18:        XtRealizeWidget,
        !            19:        XtRemoveAllCallbacks,
        !            20:        XtRemoveCallback);
        !            21: 
        !            22: declareSubroutine(onLoading)
        !            23:    declareInteger(i);
        !            24: 
        !            25:    notice(stdout, "\nMotif library V1R1 for RPL/2 (C) 2017 BERTRAND Joel\n");
        !            26:    notice(stdout, "Motif library loaded.\n\n");
        !            27: 
        !            28:    nombre_widgets = 256;
        !            29:    widgets = sys_malloc(nombre_widgets * size(Widget));
        !            30:    presence_widget = sys_malloc(nombre_widgets * size(char));
        !            31: 
        !            32:    loop(i = 0, i < nombre_widgets, i++)
        !            33:        presence_widget[i] = 0;
        !            34:    endLoop
        !            35: 
        !            36:    nombre_callbacks = 256;
        !            37:    callbacks = sys_malloc(nombre_callbacks * size(callbackArg));
        !            38:    presence_callback = sys_malloc(nombre_callbacks * size(char));
        !            39:    
        !            40:    loop(i = 0, i < nombre_callbacks, i++)
        !            41:        presence_callback[i] = 0;
        !            42:    endLoop
        !            43: 
        !            44:    // Création des variables spécifiques
        !            45: 
        !            46:    declareObject(variable);
        !            47:    declareObject(value);
        !            48: 
        !            49: #define createVariable(var) createVariable2(var, var)
        !            50: #define createVariable2(var, val) \
        !            51:        do { \
        !            52:            createNameObject(variable); \
        !            53:            setSymbolicName(variable, #var); \
        !            54:            createIntegerObject(value); \
        !            55:            setInteger(value, val); \
        !            56:            pushOnStack(variable); \
        !            57:            pushOnStack(value); \
        !            58:            intrinsic(over); \
        !            59:            intrinsic(save); \
        !            60:            intrinsic(parameter); \
        !            61:        } while(0)
        !            62: 
        !            63:    createVariable2(XmFalse, 0);
        !            64:    createVariable2(XmTrue, 1);
        !            65: 
        !            66:    createVariable(XmATTACH_NONE);
        !            67:    createVariable(XmATTACH_FORM);
        !            68:    createVariable(XmATTACH_OPPOSITE_FORM);
        !            69:    createVariable(XmATTACH_WIDGET);
        !            70:    createVariable(XmATTACH_OPPOSITE_WIDGET);
        !            71:    createVariable(XmATTACH_POSITION);
        !            72:    createVariable(XmATTACH_SELF);
        !            73: 
        !            74:    createVariable(XmALIGNMENT_BEGINNING);
        !            75:    createVariable(XmALIGNMENT_CENTER);
        !            76:    createVariable(XmALIGNMENT_END);
        !            77: 
        !            78:    createVariable(XmHORIZONTAL);
        !            79:    createVariable(XmVERTICAL);
        !            80: 
        !            81:    createVariable(XtGrabNone);
        !            82:    createVariable(XtGrabNonexclusive);
        !            83:    createVariable(XtGrabExclusive);
        !            84: 
        !            85:    createVariable(XmSTRING);
        !            86: endSubroutine
        !            87: 
        !            88: declareSubroutine(onClosing)
        !            89:    // Destruction des variables spécifiques
        !            90:    declareInteger(i);
        !            91: 
        !            92:    declareObject(variable);
        !            93: 
        !            94: #define purgeVariable(var) \
        !            95:        do { \
        !            96:            createNameObject(variable); \
        !            97:            setName(variable, #var); \
        !            98:            pushOnStack(variable); \
        !            99:            intrinsic(dup); \
        !           100:            intrinsic(variable); \
        !           101:            intrinsic(purge); \
        !           102:        } while(0)
        !           103: 
        !           104:    purgeVariable(XmFalse);
        !           105:    purgeVariable(XmTrue);
        !           106: 
        !           107:    purgeVariable(XmATTACH_NONE);
        !           108:    purgeVariable(XmATTACH_FORM);
        !           109:    purgeVariable(XmATTACH_OPPOSITE_FORM);
        !           110:    purgeVariable(XmATTACH_WIDGET);
        !           111:    purgeVariable(XmATTACH_OPPOSITE_WIDGET);
        !           112:    purgeVariable(XmATTACH_POSITION);
        !           113:    purgeVariable(XmATTACH_SELF);
        !           114: 
        !           115:    purgeVariable(XmALIGNMENT_BEGINNING);
        !           116:    purgeVariable(XmALIGNMENT_CENTER);
        !           117:    purgeVariable(XmALIGNMENT_END);
        !           118: 
        !           119:    purgeVariable(XmHORIZONTAL);
        !           120:    purgeVariable(XmVERTICAL);
        !           121: 
        !           122:    purgeVariable(XtGrabNone);
        !           123:    purgeVariable(XtGrabNonexclusive);
        !           124:    purgeVariable(XtGrabExclusive);
        !           125: 
        !           126:    purgeVariable(XmSTRING);
        !           127: 
        !           128:    sys_free(widgets);
        !           129:    sys_free(presence_widget);
        !           130: 
        !           131:    loop(i = 0, i < nombre_callbacks, i++)
        !           132:        if (presence_callback[i] ne 0) then
        !           133:            freeObject(callbacks[i].s_objet);
        !           134:        endIf
        !           135:    endLoop
        !           136:    
        !           137:    sys_free(callbacks);
        !           138:    sys_free(presence_callback);
        !           139: 
        !           140:    notice(stdout, "Motif library unloaded.\n\n");
        !           141: endSubroutine
        !           142: 
        !           143: declareExternalFunction(XtDestroyWidget)
        !           144:    HEADER
        !           145:    FUNCTION
        !           146:    END
        !           147: endExternalFunction
        !           148: 
        !           149: declareExternalFunction(XtRemoveCallback)
        !           150:    HEADER
        !           151:    FUNCTION
        !           152:    END
        !           153: endExternalFunction
        !           154: 
        !           155: declareExternalFunction(XtRemoveAllCallbacks)
        !           156:    HEADER
        !           157:    FUNCTION
        !           158:    END
        !           159: endExternalFunction
        !           160: 
        !           161: /*
        !           162: XmStringCreateLtoR
        !           163: XmCreateRadioBox
        !           164: XtVaSetValues
        !           165: XmStringFree
        !           166: XmTextFieldSetString
        !           167: XtManageChild
        !           168: XtSetSensitive
        !           169: XtVaGetValues
        !           170: XtAncetre
        !           171: */
        !           172: 
        !           173: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>