/* Use this to generate a signed constant of the given size, shifted
   by the given amount, with the specified endianness.  */
int
signed_constant (func_arg * arg, insn_data * data)
#define signed_constant(bits, shift, revert) \
  { signed_constant, { i1: shift, i2: bits * (revert ? -1 : 1), \
		       mk_get_bits (bits ## s) } }
{
  long val = get_bits_from_size ((unsigned *) arg->p2, arg->i3);
  int len = (val >= 0 ? ulen (val, 10) : (1 + ulen (-val, 10)));
  int nbits = (arg->i2 >= 0 ? arg->i2 : -arg->i2);
  word bits = ((word) val) & (((((word) 1) << (nbits - 1)) << 1) - 1);

  data->as_in = data->dis_out = malloc (len + 1);
  sprintf (data->as_in, "%ld", val);
  if (arg->i2 < 0)
    {
      word rbits = 0;

      do
	{
	  rbits <<= 8;
	  rbits |= bits & 0xff;
	  bits >>= 8;
	  nbits -= 8;
	}
      while (nbits > 0);

      bits = rbits;
    }
ulen ScrollListShape::getPosition(Point point) const
 {
  Pane inner=pane.shrink(+cfg.space);

  if( !inner ) return 0;

  if( point.y<inner.y ) return yoff?yoff-1:0;

  if( point.y>=inner.y+inner.dy ) return yoff+page;

  FontSize fs=cfg.font.get()->getSize();

  return yoff+ulen((point.y-inner.y)/fs.dy);
 }
Exemple #3
0
void Bridge::send_to_client(XPoint point,Packet<uint8> packet)
 {
  if( point==0 || point>clients.getLen() )
    {
     packet.complete();
    }
  else
    {
     ulen i=ulen(point-1);

     if( drop() )
       packet.complete();
     else
       clients[i].inbound(packet);
    }
 }
void InfoShape::setMax()
 {
  Pane inner=pane.shrink(+cfg.space);

  if( +inner )
    {
     ulen count=info->getLineCount();

     Font font=cfg.font.get();

     FontSize fs=font->getSize();

     Coord dx=0;

     for(ulen index=0; index<count ;index++)
       {
        TextSize ts=font->text(info->getLine(index));

        IntGuard( !ts.overflow );

        Replace_max(dx,ts.full_dx);
       }

     if( dx>inner.dx )
       xoffMax=dx-inner.dx;
     else
       xoffMax=0;

     ulen h=ulen(inner.dy/fs.dy);

     if( count>h )
       yoffMax=count-h;
     else
       yoffMax=0;

     dxoff=fs.medDx();
    }
  else
    {
     xoffMax=0;
     yoffMax=0;
     dxoff=0;
    }
 }
void ScrollListShape::setMax()
 {
  Pane inner=pane.shrink(+cfg.space);

  if( +inner )
    {
     ulen count=info->getLineCount();

     Font font=cfg.font.get();

     FontSize fs=font->getSize();

     Coord off=fs.dy;

     Coord dx=0;

     for(ulen index=0; index<count ;index++)
       {
        Replace_max(dx,GetLineDX(font,info->getLine(index),off));
       }

     if( dx>inner.dx )
       xoffMax=dx-inner.dx;
     else
       xoffMax=0;

     page=ulen(inner.dy/fs.dy);

     if( count>page )
       yoffMax=count-page;
     else
       yoffMax=0;

     dxoff=fs.medDX();
    }
  else
    {
     xoffMax=0;
     yoffMax=0;
     dxoff=0;
     page=0;
    }
 }
Exemple #6
0
int main( int argc, char **argv )
{
    int i;

    if ( argc < 2 )
    {
        usage();
        exit( -1 );

    }

    for ( i = 1; i < argc; i ++ )
    {
        if ( strcmp( argv[ i ], "--prefix" ) == 0 )
        {
            printf( "%s\n", PREFIX );
        }
        else if ( strcmp( argv[ i ], "--exec-prefix" ) == 0 )
        {
            printf( "%s\n", EXEC_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--bin-prefix" ) == 0 )
        {
            printf( "%s\n", BIN_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--include-prefix" ) == 0 )
        {
            printf( "%s\n", INCLUDE_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--lib-prefix" ) == 0 )
        {
            printf( "%s\n", LIB_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--version" ) == 0 )
        {
            printf( "%s\n", VERSION );
        }
        else if ( strcmp( argv[ i ], "--libs" ) == 0 )
        {
            printf( "-L%s -lodbc\n", LIB_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--static-libs" ) == 0 )
        {
            printf( "%s/libodbc.a\n", LIB_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--libtool-libs" ) == 0 )
        {
            printf( "%s/libodbc.la\n", LIB_PREFIX );
        }
        else if ( strcmp( argv[ i ], "--cflags" ) == 0 )
        {
            cflags();
        }
        else if ( strcmp( argv[ i ], "--header" ) == 0 )
        {
            cInc();
        }
        else if ( strcmp( argv[ i ], "--odbcversion" ) == 0 )
        {
            printf( "3\n" );
        }
        else if ( strcmp( argv[ i ], "--longodbcversion" ) == 0 )
        {
            printf( "3.52\n" );
        }
        else if ( strcmp( argv[ i ], "--odbcini" ) == 0 )
        {
            printf( "%s/odbc.ini\n", SYSTEM_FILE_PATH );
        }
        else if ( strcmp( argv[ i ], "--odbcinstini" ) == 0 )
        {
            printf( "%s/odbcinst.ini\n", SYSTEM_FILE_PATH );
        }
        else if ( strcmp( argv[ i ], "--ulen" ) == 0 )
        {
            ulen();
        }
        else
        {
            usage();
            exit( -1 );
        }
    }

	exit(0);
}