File:  [local] / rpl / modules / motif / types.rplc
Revision 1.6: download - view: text, annotated - select for diffs - revision graph
Sun Jul 30 21:59:41 2017 UTC (6 years, 9 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, rpl-4_1_27, HEAD
Ajout d'une série de patches pour gérer les instructions de type A->B
dans les bibliothèques externes.

    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 (subType(oObject) == APPCONTEXT)
   12:     {
   13:         if (nullified(nObject = allocation(s_etat_processus, EXT)))
   14:         {
   15:             typeSystemError;
   16:         }
   17: 
   18:         initializeObject(nObject, oObject);
   19: 
   20:         if (nullified(objectOf(nObject) =
   21:                 malloc(sizeof(XtAppContext))))
   22:         {
   23:             typeSystemError;
   24:         }
   25: 
   26:         target(objectContainer(sXtAppContext, nObject)).widget =
   27:                 target(objectContainer(sXtAppContext, oObject)).widget;
   28:         target(objectContainer(sXtAppContext, nObject)).context =
   29:                 target(objectContainer(sXtAppContext, oObject)).context;
   30:     }
   31:     else if (subType(oObject) == CALLBACK)
   32:     {
   33:         typeError;
   34:     }
   35:     else if (subType(oObject) == WIDGET)
   36:     {
   37:         if (nullified(nObject = allocation(s_etat_processus, EXT)))
   38:         {
   39:             typeSystemError;
   40:         }
   41: 
   42:         initializeObject(nObject, oObject);
   43: 
   44:         if (nullified(objectOf(nObject) =
   45:                 malloc(sizeof(sXtAppContext))))
   46:         {
   47:             typeSystemError;
   48:         }
   49: 
   50:         target(objectContainer(Widget, nObject)) =
   51:                 target(objectContainer(Widget, oObject));
   52:     }
   53:     else
   54:     {
   55:         typeError;
   56:     }
   57: 
   58:     target((struct_objet **) arg) = nObject;
   59:     typeSuccess;
   60: endTypeExtension
   61: 
   62: declareTypeExtension(drop)
   63:     declareObject(oObject);
   64: 
   65:     oObject = (*((structObject **) arg));
   66: 
   67:     if (subType(oObject) == APPCONTEXT)
   68:     {
   69:         free(objectOf(oObject));
   70:     }
   71:     else if (subType(oObject) == CALLBACK)
   72:     {
   73:         free(objectOf(oObject));
   74:     }
   75:     else if (subType(oObject) == WIDGET)
   76:     {
   77:         free(objectOf(oObject));
   78:     }
   79:     else
   80:     {
   81:         typeError;
   82:     }
   83: 
   84:     typeSuccess;
   85: endTypeExtension
   86: 
   87: declareTypeExtension(disp)
   88:     declareObject(oObject);
   89: 
   90:     string      s;
   91: 
   92:     oObject = (*((structObject **) arg));
   93: 
   94:     if (subType(oObject) == APPCONTEXT)
   95:     {
   96:         if ((s = malloc(32 * sizeof(unsigned char))) == NULL)
   97:         {
   98:             typeSystemError;
   99:         }
  100: 
  101:         sprintf(s, "XtAppContext $ %016llX",
  102:                 (long long unsigned int) objectOf(oObject));
  103:     }
  104:     else if (subType(oObject) == CALLBACK)
  105:     {
  106:         if ((s = malloc(28 * sizeof(unsigned char))) == NULL)
  107:         {
  108:             typeSystemError;
  109:         }
  110: 
  111:         sprintf(s, "Callback $ %016llX",
  112:                 (long long unsigned int) objectOf(oObject));
  113:     }
  114:     else if (subType(oObject) == WIDGET)
  115:     {
  116:         if ((s = malloc(26 * sizeof(unsigned char))) == NULL)
  117:         {
  118:             typeSystemError;
  119:         }
  120: 
  121:         sprintf(s, "Widget $ %016llX",
  122:                 (long long unsigned int) objectOf(oObject));
  123:     }
  124:     else
  125:     {
  126:         typeSystemError;
  127:     }
  128: 
  129:     (*arg) = s;
  130:     typeSuccess;
  131: endTypeExtension
  132: 
  133: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>