File:  [local] / rpl / modules / motif / types.rplc
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Mon Jul 10 14:48:44 2017 UTC (6 years, 10 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Cohérence.

    1: #define TYPE_DECLARATION
    2: #include "src/rplexternals.h"
    3: #include "motif.h"
    4: 
    5: declareTypeExtension(dup)
    6:     declareObject(nObject);
    7:     declareObject(oObject);
    8: 
    9:     oObject = (*((structObject **) arg));
   10: 
   11:     if (nullified(nObject = allocation(s_etat_processus, EXT)))
   12:     {
   13:         typeSystemError;
   14:     }
   15: 
   16:     initializeObject(nObject, oObject);
   17: 
   18:     if (subType(oObject) == APPCONTEXT)
   19:     {
   20:         if (nullified(objectContainer(nObject) =
   21:                 malloc(sizeof(XtAppContext))))
   22:         {
   23:             typeSystemError;
   24:         }
   25: 
   26:         target((sXtAppContext *) objectContainer(nObject)).widget =
   27:                 target((sXtAppContext *) objectContainer(oObject)).widget;
   28:         target((sXtAppContext *) objectContainer(nObject)).context =
   29:                 target((sXtAppContext *) objectContainer(oObject)).context;
   30:     }
   31:     else if (subType(oObject) == WIDGET)
   32:     {
   33:         if (nullified(objectContainer(nObject) =
   34:                 malloc(sizeof(sXtAppContext))))
   35:         {
   36:             typeSystemError;
   37:         }
   38: 
   39:         target((Widget *) objectContainer(nObject)) =
   40:                 target((Widget *) objectContainer(oObject));
   41:     }
   42:     else
   43:     {
   44:         typeError;
   45:     }
   46: 
   47:     typeSuccess;
   48: endTypeExtension
   49: 
   50: declareTypeExtension(drop)
   51:     declareObject(oObject);
   52: 
   53:     oObject = (*((structObject **) arg));
   54: 
   55:     if (subType(oObject) == APPCONTEXT)
   56:     {
   57:         free(objectContainer(oObject));
   58:     }
   59:     else if (subType(oObject) == WIDGET)
   60:     {
   61:         free(objectContainer(oObject));
   62:     }
   63:     else
   64:     {
   65:         typeError;
   66:     }
   67: 
   68:     typeSuccess;
   69: endTypeExtension
   70: 
   71: declareTypeExtension(disp)
   72:     declareObject(oObject);
   73: 
   74:     string      s;
   75: 
   76:     oObject = (*((structObject **) arg));
   77: 
   78:     if (subType(oObject) == APPCONTEXT)
   79:     {
   80:         if ((s = malloc(32 * sizeof(unsigned char))) == NULL)
   81:         {
   82:             typeSystemError;
   83:         }
   84: 
   85:         sprintf(s, "XtAppContext $ %016llX",
   86:                 (long long unsigned int) objectContainer(oObject));
   87:     }
   88:     else if (subType(oObject) == WIDGET)
   89:     {
   90:         if ((s = malloc(26 * sizeof(unsigned char))) == NULL)
   91:         {
   92:             typeSystemError;
   93:         }
   94: 
   95:         sprintf(s, "Widget $ %016llX",
   96:                 (long long unsigned int) objectContainer(oObject));
   97:     }
   98:     else
   99:     {
  100:         typeSystemError;
  101:     }
  102: 
  103:     (*arg) = s;
  104:     typeSuccess;
  105: endTypeExtension
  106: 
  107: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>