mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-06 00:00:22 +00:00
Allows _MK$/_CV to deal with _OFFSET
_UNSIGNED _OFFSET too.
This commit is contained in:
parent
fa96640624
commit
7e5710a364
|
@ -6462,6 +6462,8 @@ qbs *ui642string(uint64 v){ static qbs *tqbs; tqbs=qbs_new(8,1); *((uint64*)(tqb
|
||||||
qbs *s2string(float v){ static qbs *tqbs; tqbs=qbs_new(4,1); *((float*)(tqbs->chr))=v; return tqbs;}
|
qbs *s2string(float v){ static qbs *tqbs; tqbs=qbs_new(4,1); *((float*)(tqbs->chr))=v; return tqbs;}
|
||||||
qbs *d2string(double v){ static qbs *tqbs; tqbs=qbs_new(8,1); *((double*)(tqbs->chr))=v; return tqbs;}
|
qbs *d2string(double v){ static qbs *tqbs; tqbs=qbs_new(8,1); *((double*)(tqbs->chr))=v; return tqbs;}
|
||||||
qbs *f2string(long double v){ static qbs *tqbs; tqbs=qbs_new(32,1); memset(tqbs->chr,0,32); *((long double*)(tqbs->chr))=v; return tqbs;}
|
qbs *f2string(long double v){ static qbs *tqbs; tqbs=qbs_new(32,1); memset(tqbs->chr,0,32); *((long double*)(tqbs->chr))=v; return tqbs;}
|
||||||
|
qbs *o2string(ptrszint v){ static qbs *tqbs; tqbs=qbs_new(sizeof(ptrszint),1); memset(tqbs->chr,0,sizeof(ptrszint)); *((ptrszint*)(tqbs->chr))=v; return tqbs;}
|
||||||
|
qbs *uo2string(uptrszint v){ static qbs *tqbs; tqbs=qbs_new(sizeof(uptrszint),1); memset(tqbs->chr,0,sizeof(uptrszint)); *((uptrszint*)(tqbs->chr))=v; return tqbs;}
|
||||||
qbs *bit2string(uint32 bsize,int64 v){
|
qbs *bit2string(uint32 bsize,int64 v){
|
||||||
static qbs* tqbs;
|
static qbs* tqbs;
|
||||||
tqbs=qbs_new(8,1);
|
tqbs=qbs_new(8,1);
|
||||||
|
@ -6492,6 +6494,8 @@ uint64 string2ui64(qbs*str){ if (str->len<8) {error(5); return 0;} else {return
|
||||||
float string2s(qbs*str){ if (str->len<4) {error(5); return 0;} else {return *((float*)str->chr);} }
|
float string2s(qbs*str){ if (str->len<4) {error(5); return 0;} else {return *((float*)str->chr);} }
|
||||||
double string2d(qbs*str){ if (str->len<8) {error(5); return 0;} else {return *((double*)str->chr);} }
|
double string2d(qbs*str){ if (str->len<8) {error(5); return 0;} else {return *((double*)str->chr);} }
|
||||||
long double string2f(qbs*str){ if (str->len<32) {error(5); return 0;} else {return *((long double*)str->chr);} }
|
long double string2f(qbs*str){ if (str->len<32) {error(5); return 0;} else {return *((long double*)str->chr);} }
|
||||||
|
ptrszint string2o(qbs*str){ if (str->len<sizeof(ptrszint)) {error(5); return 0;} else {return *((ptrszint*)str->chr);} }
|
||||||
|
uptrszint string2uo(qbs*str){ if (str->len<sizeof(uptrszint)) {error(5); return 0;} else {return *((uptrszint*)str->chr);} }
|
||||||
uint64 string2ubit(qbs*str,uint32 bsize){
|
uint64 string2ubit(qbs*str,uint32 bsize){
|
||||||
int64 bmask;
|
int64 bmask;
|
||||||
if (str->len<((bsize+7)>>3)) {error(5); return 0;}
|
if (str->len<((bsize+7)>>3)) {error(5); return 0;}
|
||||||
|
|
|
@ -634,6 +634,8 @@ extern qbs *ui642string(uint64 v);
|
||||||
extern qbs *s2string(float v);
|
extern qbs *s2string(float v);
|
||||||
extern qbs *d2string(double v);
|
extern qbs *d2string(double v);
|
||||||
extern qbs *f2string(long double v);
|
extern qbs *f2string(long double v);
|
||||||
|
extern qbs *o2string(ptrszint v);
|
||||||
|
extern qbs *uo2string(uptrszint v);
|
||||||
extern char string2b(qbs*str);
|
extern char string2b(qbs*str);
|
||||||
extern uint8 string2ub(qbs*str);
|
extern uint8 string2ub(qbs*str);
|
||||||
extern int16 string2i(qbs*str);
|
extern int16 string2i(qbs*str);
|
||||||
|
@ -645,6 +647,8 @@ extern uint64 string2ui64(qbs*str);
|
||||||
extern float string2s(qbs*str);
|
extern float string2s(qbs*str);
|
||||||
extern double string2d(qbs*str);
|
extern double string2d(qbs*str);
|
||||||
extern long double string2f(qbs*str);
|
extern long double string2f(qbs*str);
|
||||||
|
extern ptrszint string2o(qbs*str);
|
||||||
|
extern uptrszint string2uo(qbs*str);
|
||||||
//Cobalt(aka Dave) added the next 2 lines
|
//Cobalt(aka Dave) added the next 2 lines
|
||||||
uint64 func__shr(uint64 a1, int b1);
|
uint64 func__shr(uint64 a1, int b1);
|
||||||
uint64 func__shl(uint64 a1, int b1);
|
uint64 func__shl(uint64 a1, int b1);
|
||||||
|
|
|
@ -17073,7 +17073,7 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
||||||
IF n$ = "_MK" OR (n$ = "MK" AND qb64prefix_set = 1) THEN mktype = -1
|
IF n$ = "_MK" OR (n$ = "MK" AND qb64prefix_set = 1) THEN mktype = -1
|
||||||
IF mktype THEN
|
IF mktype THEN
|
||||||
IF mktype <> -1 OR curarg = 2 THEN
|
IF mktype <> -1 OR curarg = 2 THEN
|
||||||
IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert " + qb64prefix$ + "OFFSET type to other types": EXIT FUNCTION
|
'IF (sourcetyp AND ISOFFSET) THEN Give_Error "Cannot convert " + qb64prefix$ + "OFFSET type to other types": EXIT FUNCTION
|
||||||
'both _MK and trad. process the following
|
'both _MK and trad. process the following
|
||||||
qtyp& = 0
|
qtyp& = 0
|
||||||
IF mktype$ = "%%" THEN ctype$ = "b": qtyp& = BYTETYPE - ISPOINTER
|
IF mktype$ = "%%" THEN ctype$ = "b": qtyp& = BYTETYPE - ISPOINTER
|
||||||
|
@ -17087,6 +17087,8 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
||||||
IF mktype$ = "!" THEN ctype$ = "s": qtyp& = SINGLETYPE - ISPOINTER
|
IF mktype$ = "!" THEN ctype$ = "s": qtyp& = SINGLETYPE - ISPOINTER
|
||||||
IF mktype$ = "#" THEN ctype$ = "d": qtyp& = DOUBLETYPE - ISPOINTER
|
IF mktype$ = "#" THEN ctype$ = "d": qtyp& = DOUBLETYPE - ISPOINTER
|
||||||
IF mktype$ = "##" THEN ctype$ = "f": qtyp& = FLOATTYPE - ISPOINTER
|
IF mktype$ = "##" THEN ctype$ = "f": qtyp& = FLOATTYPE - ISPOINTER
|
||||||
|
IF mktype$ = "%&" THEN ctype$ = "o": qtyp& = OFFSETTYPE - ISPOINTER
|
||||||
|
IF mktype$ = "~%&" THEN ctype$ = "uo": qtyp& = UOFFSETTYPE - ISPOINTER
|
||||||
IF LEFT$(mktype$, 2) = "~`" THEN ctype$ = "ubit": qtyp& = UINTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(mktype$, LEN(mktype$) - 2))
|
IF LEFT$(mktype$, 2) = "~`" THEN ctype$ = "ubit": qtyp& = UINTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(mktype$, LEN(mktype$) - 2))
|
||||||
IF LEFT$(mktype$, 1) = "`" THEN ctype$ = "bit": qtyp& = INTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(mktype$, LEN(mktype$) - 1))
|
IF LEFT$(mktype$, 1) = "`" THEN ctype$ = "bit": qtyp& = INTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(mktype$, LEN(mktype$) - 1))
|
||||||
IF qtyp& = 0 THEN Give_Error qb64prefix$ + "MK only accepts numeric types": EXIT FUNCTION
|
IF qtyp& = 0 THEN Give_Error qb64prefix$ + "MK only accepts numeric types": EXIT FUNCTION
|
||||||
|
@ -17124,6 +17126,8 @@ FUNCTION evaluatefunc$ (a2$, args AS LONG, typ AS LONG)
|
||||||
IF cvtype$ = "!" THEN ctype$ = "s": typ& = SINGLETYPE - ISPOINTER
|
IF cvtype$ = "!" THEN ctype$ = "s": typ& = SINGLETYPE - ISPOINTER
|
||||||
IF cvtype$ = "#" THEN ctype$ = "d": typ& = DOUBLETYPE - ISPOINTER
|
IF cvtype$ = "#" THEN ctype$ = "d": typ& = DOUBLETYPE - ISPOINTER
|
||||||
IF cvtype$ = "##" THEN ctype$ = "f": typ& = FLOATTYPE - ISPOINTER
|
IF cvtype$ = "##" THEN ctype$ = "f": typ& = FLOATTYPE - ISPOINTER
|
||||||
|
IF cvtype$ = "%&" THEN ctype$ = "o": typ& = OFFSETTYPE - ISPOINTER
|
||||||
|
IF cvtype$ = "~%&" THEN ctype$ = "uo": typ& = UOFFSETTYPE - ISPOINTER
|
||||||
IF LEFT$(cvtype$, 2) = "~`" THEN ctype$ = "ubit": typ& = UINTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(cvtype$, LEN(cvtype$) - 2))
|
IF LEFT$(cvtype$, 2) = "~`" THEN ctype$ = "ubit": typ& = UINTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(cvtype$, LEN(cvtype$) - 2))
|
||||||
IF LEFT$(cvtype$, 1) = "`" THEN ctype$ = "bit": typ& = INTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(cvtype$, LEN(cvtype$) - 1))
|
IF LEFT$(cvtype$, 1) = "`" THEN ctype$ = "bit": typ& = INTEGER64TYPE - ISPOINTER: size = VAL(RIGHT$(cvtype$, LEN(cvtype$) - 1))
|
||||||
IF typ& = 0 THEN Give_Error qb64prefix$ + "CV cannot return STRING type!": EXIT FUNCTION
|
IF typ& = 0 THEN Give_Error qb64prefix$ + "CV cannot return STRING type!": EXIT FUNCTION
|
||||||
|
|
Loading…
Reference in a new issue