Branch: Tag:

1996-11-08

1996-11-08 04:57:40 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

object(foo), prog(), 'constant' and class foo {} implemented

Rev: src/ChangeLog:1.18
Rev: src/builtin_functions.c:1.9
Rev: src/builtin_functions.h:1.2
Rev: src/docode.c:1.3
Rev: src/interpret.c:1.8
Rev: src/language.yacc:1.6
Rev: src/lex.c:1.6
Rev: src/object.c:1.3
Rev: src/object.h:1.3
Rev: src/pike_types.c:1.5
Rev: src/program.c:1.4
Rev: src/program.h:1.2
Rev: src/testsuite.in:1.6

93:    case T_INT:    case T_FLOAT:    case T_STRING: -  case T_OBJECT: +     case T_PROGRAM:    case T_MIXED:    case T_VOID:    case T_UNKNOWN:    break; -  +  +  +  case T_OBJECT: +  t+=sizeof(INT32); +  break;    }    return t-q;   }
161:    yyerror("Type stack overflow.");   }    + void push_type_int(unsigned INT32 i) + { +  if(type_stackp + sizeof(i)> type_stack + sizeof(type_stack)) +  yyerror("Type stack overflow."); +  +  type_stack_mark(); +  MEMCPY(type_stackp, &i, sizeof(i)); +  type_stackp+=sizeof(i); +  type_stack_reverse(); + } +    void push_unfinished_type(char *s)   {    int e;
217:       if(!strcmp(buf,"int")) push_type(T_INT);    else if(!strcmp(buf,"float")) push_type(T_FLOAT); -  else if(!strcmp(buf,"object")) push_type(T_OBJECT); +  else if(!strcmp(buf,"object")) +  { +  push_type_int(0); +  push_type(T_OBJECT); +  }    else if(!strcmp(buf,"program")) push_type(T_PROGRAM);    else if(!strcmp(buf,"string")) push_type(T_STRING);    else if(!strcmp(buf,"void")) push_type(T_VOID);
439: Inside #if defined(DEBUG)
   case T_FLOAT: printf("float"); break;    case T_STRING: printf("string"); break;    case T_PROGRAM: printf("program"); break; -  case T_OBJECT: printf("object"); break; +  case T_OBJECT: +  printf("object(%ld)",(long)EXTRACT_INT(a+e+1)); +  e+=sizeof(INT32); +  break;    case T_FUNCTION: printf("function"); break;    case T_ARRAY: printf("array"); break;    case T_MAPPING: printf("mapping"); break;
475:    case T_INT: my_strcat("int"); break;    case T_FLOAT: my_strcat("float"); break;    case T_PROGRAM: my_strcat("program"); break; -  case T_OBJECT: my_strcat("object"); break; +  case T_OBJECT: +  my_strcat("object"); +  /* Prog id */ +  break;    case T_STRING: my_strcat("string"); break;       case T_FUNCTION:
654:    /* 'mixed' matches anything */    if(EXTRACT_UCHAR(a) == T_MIXED && !(flags & A_EXACT)) return a;    if(EXTRACT_UCHAR(b) == T_MIXED && !(flags & B_EXACT)) return a; +  +  /* Special case (tm) */ +  if(EXTRACT_UCHAR(a) == T_PROGRAM && EXTRACT_UCHAR(b)==T_FUNCTION) +  { +  return a; +  } +     if(EXTRACT_UCHAR(a) != EXTRACT_UCHAR(b)) return 0;       ret=a;
702:    if(!low_match_types(a+type_length(a),b+type_length(b),flags)) return 0;    break;    +  case T_OBJECT: +  a++; +  b++; +  if(!EXTRACT_INT(a) || !EXTRACT_INT(b)) break; +  if(EXTRACT_INT(a) != EXTRACT_INT(b)) return 0; +  break; +     case T_MULTISET:    case T_ARRAY:    if(!low_match_types(++a,++b,flags)) return 0;
709:    case T_INT:    case T_FLOAT:    case T_STRING: -  case T_OBJECT: +     case T_PROGRAM:    case T_VOID:    case T_MIXED:
802:    push_unfinished_type(a);    return 1;    +  case T_PROGRAM: +  push_type_int(0); +  push_type(T_OBJECT); +  return 1; +     default:    push_type(T_MIXED);    return 1;