Changeset 19b018 in git


Ignore:
Timestamp:
Sep 7, 2012, 10:17:48 PM (10 years ago)
Author:
Alexander Dreyer <alexander.dreyer@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'ad2543eab51733612ba7d118afc77edca719600e')
Children:
c4d8c3a681ea70bc8bd0864ac803ece0f451e619
Parents:
8357e215b04863da2f7f9897d29475d589e7c2f8
git-author:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-09-07 22:17:48+02:00
git-committer:
Alexander Dreyer <alexander.dreyer@itwm.fraunhofer.de>2012-09-08 00:20:23+02:00
Message:
reference and shared do not rely on their type id anymore
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/countedref.cc

    r8357e21 r19b018  
    2626#include "ipshell.h"
    2727
    28 class CountedRefEnv {
    29   typedef CountedRefEnv self;
    30 
    31 public:
    32 
    33   static int& ref_id() {
    34     static int g_ref_id = 0;
    35     return g_ref_id;
    36   }
    37 
    38   static int& sh_id() {
    39     static int g_sh_id = 0;
    40     return g_sh_id;
    41   }
    42 };
    4328
    4429/// Overloading ring destruction
     
    198183}
    199184
     185/// We use the as a marker of refernce types.
     186BOOLEAN countedref_CheckAssign(blackbox *b, leftv L, leftv R)
     187{
     188  return FALSE;
     189}
     190
    200191
    201192class CountedRef {
     
    215206  static BOOLEAN is_ref(leftv arg) {
    216207    int typ = arg->Typ();
    217     return ((typ==CountedRefEnv::ref_id())  ||(typ==CountedRefEnv::sh_id()) );
    218     //    return ((typ > MAX_TOK) &&
    219     //            (getBlackboxStuff(typ)->blackbox_Init == countedref_Init));
     208    return ((typ > MAX_TOK) &&
     209            (getBlackboxStuff(typ)->blackbox_CheckAssign == countedref_CheckAssign));
    220210  }
    221211
     
    684674{
    685675  blackbox *bbx = (blackbox*)omAlloc0(sizeof(blackbox));
     676  bbx->blackbox_CheckAssign = countedref_CheckAssign;
    686677  bbx->blackbox_destroy = countedref_destroy;
    687678  bbx->blackbox_String  = countedref_String;
     
    697688  bbx->blackbox_deserialize = countedref_deserialize;
    698689  bbx->data             = omAlloc0(newstruct_desc_size());
    699   CountedRefEnv::ref_id()=setBlackboxStuff(bbx, "reference");
     690  setBlackboxStuff(bbx, "reference");
    700691
    701692  /// The @c shared type is "inherited" from @c reference.
     
    703694  blackbox *bbxshared =
    704695    (blackbox*)memcpy(omAlloc(sizeof(blackbox)), bbx, sizeof(blackbox));
     696  bbxshared->blackbox_CheckAssign = countedref_CheckAssign;
    705697  bbxshared->blackbox_Assign  = countedref_AssignShared;
    706698  bbxshared->blackbox_destroy = countedref_destroyShared;
     
    709701  bbxshared->blackbox_Init    = countedref_InitShared;
    710702  bbxshared->data             = omAlloc0(newstruct_desc_size());
    711   CountedRefEnv::sh_id()=setBlackboxStuff(bbxshared, "shared");
     703  setBlackboxStuff(bbxshared, "shared");
    712704}
    713705
Note: See TracChangeset for help on using the changeset viewer.