add DoCharX

This commit is contained in:
Stefan `Sec` Zehl 2011-07-14 02:01:41 +02:00
parent fc85fde75e
commit 508838231b
2 changed files with 10 additions and 8 deletions

View File

@ -196,8 +196,7 @@ int DoInt(int sx, int sy, int num){
#undef mxlen
};
int DoIntX(int sx, int sy, unsigned int num){
#define mxlen 8
int DoIntXn(int sx, int sy, unsigned int num, unsigned int mxlen){
char s[(mxlen+1)];
char * o=s;
int len;
@ -206,14 +205,15 @@ int DoIntX(int sx, int sy, unsigned int num){
s[len]=(num%16)+'0';
if(s[len]>'9')
s[len]+='A'-'9'-1;
if(num==0){
// s[len]=' '; // configurable?
// o=s+len; break;
};
num/=16;
};
return DoString(sx,sy,o);
#undef mxlen
};
int DoIntX(int sx, int sy, unsigned int num){
return DoIntXn(sx, sy, num, 8);
};
int DoCharX(int sx, int sy, unsigned char num){
return DoIntXn(sx, sy, num, 2);
};

View File

@ -29,6 +29,8 @@
int DoChar(int sx, int sy, int c);
int DoString(int sx, int sy, const char *s);
int DoInt(int sx, int sy, int num);
int DoIntXn(int sx, int sy, unsigned int num, unsigned int maxlen);
int DoIntX(int sx, int sy, unsigned int num);
int DoCharX(int sx, int sy, unsigned char num);
#endif