Branch: Tag:

2007-03-03

2007-03-03 16:46:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Added support for string widths to the type system.

Rev: src/encode.c:1.240
Rev: src/language.yacc:1.373
Rev: src/pike_types.c:1.262

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: encode.c,v 1.239 2007/01/05 15:49:47 grubba Exp $ + || $Id: encode.c,v 1.240 2007/03/03 16:46:12 grubba Exp $   */      #include "global.h"
272:   #endif      /* NOTE: Take care to encode it exactly as the corresponing -  * type string would have been encoded (cf TFUNCTION, T_MANY). +  * type string would have been encoded (cf T_FUNCTION, T_MANY, +  * T_STRING, PIKE_T_NSTRING).    */   static void encode_type(struct pike_type *t, struct encode_data *data)   {
280:    if (t->type == T_MANY) {    addchar(T_FUNCTION);    addchar(T_MANY); +  } else if (t->type == T_STRING) { +  if (CAR_TO_INT(t) == 32) { +  addchar(T_STRING);    } else { -  +  /* Narrow string */ +  addchar(PIKE_T_NSTRING); +  addchar(CAR_TO_INT(t)); +  } +  return; +  } else {    addchar(t->type);    }    switch(t->type) {
2144:    }    break;    +  case T_STRING: +  /* Common case and compat */ +  push_string_type(32); +  break; +  +  case PIKE_T_NSTRING: +  { +  INT32 width = GETC(); +  push_string_type(width); +  } +  break; +     case '0':    case '1':    case '2':
2155:    case '8':    case '9':    case T_FLOAT: -  case T_STRING: +     case T_MIXED:    case T_ZERO:    case T_VOID: