pike.git / src / modules / SANE / sane.c

version» Context lines:

pike.git/src/modules/SANE/sane.c:52:      static void init_sane(void)   {    if( sane_init( NULL, NULL ) )    Pike_error( "Sane init failed.\n" );    sane_is_inited = 1;   }      static void push_device( SANE_Device *d )   { -  push_text( "name" ); push_text( d->name ); -  push_text( "vendor" ); push_text( d->vendor ); -  push_text( "model" ); push_text( d->model ); +  push_static_text( "name" ); push_text( d->name ); +  push_static_text( "vendor" ); push_text( d->vendor ); +  push_static_text( "model" ); push_text( d->model );    ref_push_string( literal_type_string ); push_text( d->type );    f_aggregate_mapping( 8 );   }         /*! @decl array(mapping) list_scanners()    *!    *! Returns an array with all available scanners.    *!    *! @example
pike.git/src/modules/SANE/sane.c:105:    Pike_error("Failed to get device list\n");    }   }      #define THIS ((struct scanner *)Pike_fp->current_storage)      static void push_option_descriptor( const SANE_Option_Descriptor *o )   {    int i;    struct svalue *osp = sp; -  push_text( "name" ); +  push_static_text( "name" );    if( o->name )    push_text( o->name );    else    push_int( 0 ); -  push_text( "title" ); +  push_static_text( "title" );    if( o->title )    push_text( o->title );    else    push_int( 0 ); -  push_text( "desc" ); +  push_static_text( "desc" );    if( o->desc )    push_text( o->desc );    else    push_int( 0 );    ref_push_string( literal_type_string );    switch( o->type )    { -  case SANE_TYPE_BOOL: push_text( "boolean" ); break; +  case SANE_TYPE_BOOL: push_static_text( "boolean" ); break;    case SANE_TYPE_INT: ref_push_string( literal_int_string ); break;    case SANE_TYPE_FIXED: ref_push_string( literal_float_string ); break;    case SANE_TYPE_STRING: ref_push_string( literal_string_string ); break; -  case SANE_TYPE_BUTTON: push_text( "button" ); break; -  case SANE_TYPE_GROUP: push_text( "group" ); break; +  case SANE_TYPE_BUTTON: push_static_text( "button" ); break; +  case SANE_TYPE_GROUP: push_static_text( "group" ); break;    }       -  push_text( "unit" ); +  push_static_text( "unit" );    switch( o->unit )    { -  case SANE_UNIT_NONE: push_text( "none" ); break; -  case SANE_UNIT_PIXEL: push_text( "pixel" ); break; -  case SANE_UNIT_BIT: push_text( "bit" ); break; -  case SANE_UNIT_MM: push_text( "mm" ); break; -  case SANE_UNIT_DPI: push_text( "dpi" ); break; -  case SANE_UNIT_PERCENT: push_text( "percent" ); break; -  case SANE_UNIT_MICROSECOND: push_text( "microsecond" ); break; +  case SANE_UNIT_NONE: push_static_text( "none" ); break; +  case SANE_UNIT_PIXEL: push_static_text( "pixel" ); break; +  case SANE_UNIT_BIT: push_static_text( "bit" ); break; +  case SANE_UNIT_MM: push_static_text( "mm" ); break; +  case SANE_UNIT_DPI: push_static_text( "dpi" ); break; +  case SANE_UNIT_PERCENT: push_static_text( "percent" ); break; +  case SANE_UNIT_MICROSECOND: push_static_text( "microsecond" ); break;    }    -  push_text( "size" ); push_int( o->size ); +  push_static_text( "size" ); push_int( o->size );    -  push_text( "cap" ); +  push_static_text( "cap" );    {    struct svalue *osp = sp; -  if( o->cap & SANE_CAP_SOFT_SELECT ) push_text( "soft_select" ); -  if( o->cap & SANE_CAP_HARD_SELECT ) push_text( "hard_select" ); -  if( o->cap & SANE_CAP_EMULATED ) push_text( "emulated" ); -  if( o->cap & SANE_CAP_AUTOMATIC ) push_text( "automatic" ); -  if( o->cap & SANE_CAP_INACTIVE ) push_text( "inactive" ); -  if( o->cap & SANE_CAP_ADVANCED ) push_text( "advanced" ); +  if( o->cap & SANE_CAP_SOFT_SELECT ) push_static_text( "soft_select" ); +  if( o->cap & SANE_CAP_HARD_SELECT ) push_static_text( "hard_select" ); +  if( o->cap & SANE_CAP_EMULATED ) push_static_text( "emulated" ); +  if( o->cap & SANE_CAP_AUTOMATIC ) push_static_text( "automatic" ); +  if( o->cap & SANE_CAP_INACTIVE ) push_static_text( "inactive" ); +  if( o->cap & SANE_CAP_ADVANCED ) push_static_text( "advanced" );    f_aggregate_multiset( sp - osp );    }    -  push_text( "constaint" ); +  push_static_text( "constaint" );    switch( o->constraint_type )    {    case SANE_CONSTRAINT_NONE: push_int( 0 ); break;    case SANE_CONSTRAINT_RANGE: -  ref_push_string( literal_type_string ); push_text( "range" ); -  push_text( "min" ); push_int( o->constraint.range->min ); -  push_text( "max" ); push_int( o->constraint.range->max ); -  push_text( "quant" ); push_int( o->constraint.range->quant ); +  ref_push_string( literal_type_string ); push_static_text( "range" ); +  push_static_text( "min" ); push_int( o->constraint.range->min ); +  push_static_text( "max" ); push_int( o->constraint.range->max ); +  push_static_text( "quant" ); push_int( o->constraint.range->quant );    f_aggregate_mapping( 8 );    break;    case SANE_CONSTRAINT_WORD_LIST:    ref_push_string( literal_type_string ); -  push_text( "list" ); -  push_text( "list" ); +  push_static_text( "list" ); +  push_static_text( "list" );    for( i = 0; i<o->constraint.word_list[0]; i++ )    if( o->type == SANE_TYPE_FIXED )    push_float( SANE_UNFIX(o->constraint.word_list[i+1]) );    else    push_int( o->constraint.word_list[i+1] );    f_aggregate( o->constraint.word_list[0] );    f_aggregate_mapping( 4 );    break;    case SANE_CONSTRAINT_STRING_LIST:    ref_push_string( literal_type_string ); -  push_text( "list" ); -  push_text( "list" ); +  push_static_text( "list" ); +  push_static_text( "list" );    for( i = 0; o->constraint.string_list[i]; i++ )    push_text( o->constraint.string_list[i] );    f_aggregate( i );    f_aggregate_mapping( 4 );    break;    }    f_aggregate_mapping( sp - osp );   }      /*! @class Scanner
pike.git/src/modules/SANE/sane.c:406:    *! @member int "depth"    *! @member int "pixels_per_line"    *! @member int "bytes_per_line"    *! @endmapping    */   static void f_scanner_get_parameters( INT32 args )   {    SANE_Parameters p;    pop_n_elems( args );    sane_get_parameters( THIS->h, &p ); -  push_text( "format" ); push_int( p.format ); -  push_text( "last_frame" ); push_int( p.last_frame ); -  push_text( "lines" ); push_int( p.lines ); -  push_text( "depth" ); push_int( p.depth ); -  push_text( "pixels_per_line" ); push_int( p.pixels_per_line ); -  push_text( "bytes_per_line" ); push_int( p.bytes_per_line ); +  push_static_text( "format" ); push_int( p.format ); +  push_static_text( "last_frame" ); push_int( p.last_frame ); +  push_static_text( "lines" ); push_int( p.lines ); +  push_static_text( "depth" ); push_int( p.depth ); +  push_static_text( "pixels_per_line" ); push_int( p.pixels_per_line ); +  push_static_text( "bytes_per_line" ); push_int( p.bytes_per_line );    f_aggregate_mapping( 12 );   }         static struct program *image_program;      static void get_grey_frame( SANE_Handle h, SANE_Parameters *p,    SANE_Byte *data )   {    SANE_Byte buffer[8000];
pike.git/src/modules/SANE/sane.c:474:    data[0] = *(pp++);    data += 3;    }    }   }      static void assert_image_program(void)   {    if( !image_program )    { -  push_text( "Image.Image" ); +  push_static_text( "Image.Image" );    APPLY_MASTER( "resolv", 1 );    image_program = program_from_svalue( sp - 1 );    sp--;/* Do not free image program.. */    }    if( !image_program )    Pike_error("No Image.Image?!\n");   }      /*! @decl Image.Image simple_scan()    */