5 #ifdef EXTERNAL_TO_REGINA
6 #define exiterror __regina_exiterror
7 void DropStreng( streng
*str
)
13 streng
*MakeStreng( int num
)
15 streng
*out
= (streng
*)malloc( sizeof(streng
) + num
);
18 out
->len
= out
->max
= num
;
21 memset( out
->value
, '$', num
);
24 if ( out
== NULL
) fprintf(stderr
,"ERROR allocating RXSTRING\n");
27 void exiterror( int errorno
, int suberrorno
, ... )
32 int Rexx_x2d( const tsd_t
*TSD
, streng
*hex
)
37 TSD
= TSD
; /* keep compiler happy */
39 for ( i
= 0; i
< PSTRENGLEN(hex
); i
++ )
43 if ( c
>='0'&& c
<='9')
45 else if ( c
>= 'A' &&c
<= 'F' )
47 else if( c
>='a' && c
<='f' )
58 streng
*Rexx_right( const tsd_t
*TSD
, streng
*str
, int length
, char padch
)
60 streng
*out
= MAKESTRENG( length
);
64 for ( j
= 0; PSTRENGLEN(str
) > j
; j
++) ;
65 for (i
=length
-1,j
--;(i
>=0)&&(j
>=0);out
->value
[i
--]=str
->value
[j
--]) ;
66 for (;i
>=0;out
->value
[i
--]=padch
) ;
72 streng
*Rexx_d2x( const tsd_t
*TSD
, int num
)
75 out
= MAKESTRENG( (2+(num
/16)) );
78 sprintf( PSTRENGVAL(out
), "%X", num
);
79 out
->len
= strlen( PSTRENGVAL(out
) );