pike.git / src / pike_types.cmod

version» Context lines:

pike.git/src/pike_types.cmod:3711:            /******/      struct remap_state {    unsigned char map[0x20];    unsigned INT32 allocated;   };    - static int alloc_remap_marker(struct remap_state *remap, int marker, int flags) + static int alloc_remap_marker(struct remap_state *remap, int marker, +  enum pt_remap_flags flags)   {    int ret;       if (!remap) return '0' | (marker & 0x0f);    -  if (flags & PT_FLAG_SWAP_MARKERS) flags ^= 0x10; +  if (flags & PT_FLAG_REMAP_SWAP_MARKERS) marker ^= 0x10;       if ((ret = remap->map[marker & 0x1f])) return ret;       for (ret = 0; ret < 10; ret++) {    if (!(remap->allocated & (1 << ret))) {    remap->allocated |= (1 << ret);    ret |= '0';    remap->map[marker & 0x1f] = ret;    return ret;    }    }       return 0;   }    - static int remap_marker(struct remap_state *remap, int marker, int flags) + static int remap_marker(struct remap_state *remap, int marker, +  enum pt_remap_flags flags)   {    int ret;       if (!remap) return '0' | (marker & 0x0f);    -  if (flags & PT_FLAG_SWAP_MARKERS) flags ^= 0x10; +  if (flags & PT_FLAG_REMAP_SWAP_MARKERS) marker ^= 0x10;       if ((ret = remap->map[marker & 0x1f])) return ret;       for (ret = 0; ret < 10; ret++) {    if (!(remap->allocated & (1 << ret))) {    remap->allocated |= (1 << ret);    ret |= '0';    remap->map[marker & 0x1f] = ret;    return ret;    }    }       return 0;   }    - static void free_marker(struct remap_state *remap, int marker) + static void free_marker(struct remap_state *remap, int marker, +  enum pt_remap_flags flags)   {    int m;       if (!remap) return;    -  +  if (flags & PT_FLAG_REMAP_SWAP_MARKERS) marker ^= 0x10; +     if (!(m = remap->map[marker & 0x1f])) return;       remap->map[marker & 0x1f] = 0;    remap->allocated &= ~(1 << (m & 0x0f));   }      static void push_remap_markers(struct pike_type *t,    struct remap_state *remap, -  int flags) +  enum pt_remap_flags flags)   {    if (!remap) {    push_finished_type(t);    return;    }       /* FIXME: Use the type flags to detect whether we can just push    * the type verbatim.    */   
pike.git/src/pike_types.cmod:3794:    push_remap_markers(t->cdr, remap, flags);    push_assign_type(marker);    break;    }       case '0': case '1': case '2': case '3': case '4':    case '5': case '6': case '7': case '8': case '9':    {    int marker = remap_marker(remap, t->type, flags);    if (!marker) { -  /* FIXME: Improved error handling here. */ +  /* FIXME: Improve error handling here. */    push_type(T_MIXED);    } else {    push_type(marker);    } -  if (flags & PT_FLAG_BOTH_MARKERS) { -  marker = remap_marker(remap, t->type ^ 0x10, flags); +  if (flags & PT_FLAG_REMAP_BOTH_MARKERS) { +  marker = remap_marker(remap, t->type, +  flags ^ PT_FLAG_REMAP_SWAP_MARKERS);    if (!marker) { -  /* FIXME: Improved error handling here. */ +  /* FIXME: Improve error handling here. */    push_type(T_MIXED);    } else {    push_type(marker);    } -  switch(flags & PT_FLAG_BOTH_MARKERS_MASK) { -  case PT_FLAG_BOTH_MARKERS_AND: +  switch(flags & PT_FLAG_REMAP_BOTH_MARKERS_MASK) { +  case PT_FLAG_REMAP_BOTH_MARKERS_AND:    push_type(T_AND);    break; -  case PT_FLAG_BOTH_MARKERS_OR: +  case PT_FLAG_REMAP_BOTH_MARKERS_OR:    push_type(T_OR);    break;    default:    Pike_fatal("Unsupported marker joining method.\n");    break;    }    }    break;    }   
pike.git/src/pike_types.cmod:3899:    push_reverse_type(t->type);    break;    }   }      /**    * Remap markers (if any) in the type.    */   static struct pike_type *remap_markers(struct pike_type *t,    struct remap_state *remap, -  int flags) +  enum pt_remap_flags flags)   {    type_stack_mark();    push_remap_markers(t, remap, flags);    return pop_unfinished_type();   }      /*    * match two type strings, return zero if they don't match, and return    * the part of 'a' that _did_ match if it did.    */