File:  [local] / rpl / modules / motif / types.rplc
Revision 1.3: download - view: text, annotated - select for diffs - revision graph
Wed Jul 12 15:42:23 2017 UTC (6 years, 10 months ago) by bertrand
Branches: MAIN
CVS tags: HEAD
Correction d'un bug dans les fonctions __type.

    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:     target((struct_objet **) arg) = nObject;
   48:     typeSuccess;
   49: endTypeExtension
   50: 
   51: declareTypeExtension(drop)
   52:     declareObject(oObject);
   53: 
   54:     oObject = (*((structObject **) arg));
   55: 
   56:     if (subType(oObject) == APPCONTEXT)
   57:     {
   58:         free(objectContainer(oObject));
   59:     }
   60:     else if (subType(oObject) == WIDGET)
   61:     {
   62:         free(objectContainer(oObject));
   63:     }
   64:     else
   65:     {
   66:         typeError;
   67:     }
   68: 
   69:     typeSuccess;
   70: endTypeExtension
   71: 
   72: declareTypeExtension(disp)
   73:     declareObject(oObject);
   74: 
   75:     string      s;
   76: 
   77:     oObject = (*((structObject **) arg));
   78: 
   79:     if (subType(oObject) == APPCONTEXT)
   80:     {
   81:         if ((s = malloc(32 * sizeof(unsigned char))) == NULL)
   82:         {
   83:             typeSystemError;
   84:         }
   85: 
   86:         sprintf(s, "XtAppContext $ %016llX",
   87:                 (long long unsigned int) objectContainer(oObject));
   88:     }
   89:     else if (subType(oObject) == WIDGET)
   90:     {
   91:         if ((s = malloc(26 * sizeof(unsigned char))) == NULL)
   92:         {
   93:             typeSystemError;
   94:         }
   95: 
   96:         sprintf(s, "Widget $ %016llX",
   97:                 (long long unsigned int) objectContainer(oObject));
   98:     }
   99:     else
  100:     {
  101:         typeSystemError;
  102:     }
  103: 
  104:     (*arg) = s;
  105:     typeSuccess;
  106: endTypeExtension
  107: 
  108: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>