6 #ifdef EXTERNAL_TO_REGINA
7 #define exiterror __regina_exiterror
8 void DropStreng( streng
*str
)
14 streng
*MakeStreng( int num
)
16 streng
*out
= (streng
*)malloc( sizeof(streng
) + num
);
19 out
->len
= out
->max
= num
;
22 memset( out
->value
, '$', num
);
25 if ( out
== NULL
) fprintf(stderr
,"ERROR allocating RXSTRING\n");
28 void exiterror( int errorno
, int suberrorno
, ... )
33 int Rexx_x2d( const tsd_t
*TSD
, const streng
*hex
, int *error
)
38 TSD
= TSD
; /* keep compiler happy */
40 if ( PSTRENGLEN(hex
) == 0 )
45 for ( i
= 0; i
< PSTRENGLEN(hex
); i
++ )
49 if ( c
>='0'&& c
<='9')
51 else if ( c
>= 'A' &&c
<= 'F' )
53 else if( c
>='a' && c
<='f' )
65 streng
*Rexx_right( const tsd_t
*TSD
, streng
*str
, int length
, char padch
)
67 streng
*out
= MAKESTRENG( length
);
71 for ( j
= 0; PSTRENGLEN(str
) > j
; j
++) ;
72 for (i
=length
-1,j
--;(i
>=0)&&(j
>=0);out
->value
[i
--]=str
->value
[j
--]) ;
73 for (;i
>=0;out
->value
[i
--]=padch
) ;
79 streng
*Rexx_d2x( const tsd_t
*TSD
, int num
)
82 out
= MAKESTRENG( 100 ); /* use 100 as the largest length of a hex value we will ever get */
85 out
->len
= sprintf( PSTRENGVAL(out
), "%X", num
);