Branch: Tag:

2001-03-29

2001-03-29 02:54:12 by Per Hedbor <ph@opera.com>

IDs for the image-programs added to program_id.h, the image module now have constant IDs. This is not yet used in the types for it, though. Also added optimization for object( id<65536) in encode.c:encode_type and decode_type. Left to do is the code that encodes programs. It is possible to add that in the codec if int __program_to_id( program ) and program __id_to_program( int id ) or similar are added, otherwise the code has to go into encode.c

Rev: src/encode.c:1.95
Rev: src/modules/Gmp/mpz_glue.c:1.92
Rev: src/modules/Image/colors.c:1.48
Rev: src/modules/Image/image_module.c:1.11
Rev: src/modules/Image/initstuff.h:1.12
Rev: src/program.h:1.122
Rev: src/program_id.h:1.7

25:   #include "version.h"   #include "bignum.h"    - RCSID("$Id: encode.c,v 1.94 2001/03/28 15:07:39 grubba Exp $"); + RCSID("$Id: encode.c,v 1.95 2001/03/29 02:54:10 per Exp $");      /* #define ENCODE_DEBUG */   
364: Inside #if defined(USE_PIKE_TYPE)
      if(t->cdr)    { +  int id = (int)(ptrdiff_t)t->cdr; +  if( id >= 65536 ) +  {    struct program *p=id_to_program((ptrdiff_t)t->cdr);    if(p)    {
371: Inside #if defined(USE_PIKE_TYPE)
   }else{    push_int(0);    } +  } else +  push_int( id );    }else{    push_int(0);    }
452:    addchar(EXTRACT_UCHAR(t++));    x=EXTRACT_INT(t);    t+=sizeof(INT32); -  if(x) +  if(x >= 65536)    {    struct program *p=id_to_program(x);    if(p)
462:    push_int(0);    }    }else{ -  push_int(0); +  push_int(x);    }    encode_value2(Pike_sp-1, data);    pop_stack();
756:    {    INT32 e;    struct program *p=val->u.program; -  if(p->event_handler || (p->flags & PROGRAM_HAS_C_METHODS)) +  if( p->event_handler ) +  Pike_error("Cannot encode programs with event handlers.\n"); +  if( (p->flags & PROGRAM_HAS_C_METHODS) )    Pike_error("Cannot encode C programs.\n");    code_entry(type_to_tag(val->type), 1,data);    f_version(0);
1276:    switch(Pike_sp[-1].type)    {    case T_INT: -  push_object_type_backwards(flag, 0); +  push_object_type_backwards(flag, Pike_sp[-1].u.integer );    break;       case T_PROGRAM: