1
1
Fork 0
mirror of https://github.com/QB64Official/qb64.git synced 2024-07-05 01:50:25 +00:00

Merge branch 'development' of github.com:Galleondragon/qb64 into development

This commit is contained in:
Luke Ceddia 2019-12-17 23:19:23 +11:00
commit 23915bf296
5 changed files with 346 additions and 182 deletions

View file

@ -6792,6 +6792,12 @@ void sub__keyclear(int32 buf, int32 passed) {
//INP(&H60) buffer
port60h_events = 0;
}
#ifdef QB64_WINDOWS
//Windows Console Buffer
FlushConsoleInputBuffer(GetStdHandle (STD_INPUT_HANDLE));
#endif
}
//STR() functions
@ -11522,63 +11528,84 @@ void qbg_sub_locate(int32 row,int32 column,int32 cursor,int32 start,int32 stop,i
//input helper functions:
uint64 hexoct2uint64_value;
int32 hexoct2uint64(qbs* h){
//returns 0=failed
// 1=HEX value (default if unspecified)
// 2=OCT value
static int32 i,i2;
static uint64 result;
result=0;
static int32 type;
type=0;
hexoct2uint64_value=0;
if (!h->len) return 1;
if (h->chr[0]!=38) return 0;//not "&"
if (h->len==1) return 1;//& received, but awaiting further input
i=h->chr[1];
if ((i==72)||(i==104)) type=1;//"H"or"h"
if ((i==79)||(i==111)) type=2;//"O"or"o"
if (!type) return 0;
if (h->len==2) return type;
if (type==1){
if (h->len>18) return 0;//larger than int64
for (i=2;i<h->len;i++){
result<<=4;
i2=h->chr[i];
// 0 - 9 A - F a - f
if ( ((i2>=48)&&(i2<=57)) || ((i2>=65)&&(i2<=70)) || ((i2>=97)&&(i2<=102)) ){
if (i2>=97) i2-=32;
if (i2>=65) i2-=7;
i2-=48;
//i2 is now a values between 0 and 15
result+=i2;
}else return 0;//invalid character
}//i
hexoct2uint64_value=result;
return 1;
}//type==1
if (type==2){
//unsigned _int64 max=18446744073709551615 (decimal, 20 chars)
// =1777777777777777777777 (octal, 22 chars)
// =FFFFFFFFFFFFFFFF (hex, 16 chars)
if (h->len>24) return 0;//larger than int64
if (h->len==24){
if ((h->chr[2]!=48)&&(h->chr[2]!=49)) return 0;//larger than int64
}
for (i=2;i<h->len;i++){
result<<=3;
i2=h->chr[i];
if ((i2>=48)&&(i2<=55)){//0-7
i2-=48;
result+=i2;
}else return 0;//invalid character
}//i
hexoct2uint64_value=result;
return 2;
}//type==2
int32 hexoct2uint64(qbs *h) {
// returns 0 = failed
// 1 = HEX value (default if unspecified)
// 2 = OCT value
// 3 = BIN value
static int32 i, i2;
static uint64 result;
result = 0;
static int32 type;
type = 0;
hexoct2uint64_value = 0;
if (!h->len) return 1;
if (h->chr[0] != 38) return 0; // not "&"
if (h->len == 1) return 1; // "&" received, but awaiting further input
i = h->chr[1];
if ((i == 72) || (i == 104)) type = 1; // "H" or "h"
if ((i == 79) || (i == 111)) type = 2; // "O" or "o"
if ((i == 66) || (i == 98)) type = 3; // "B" or "b"
if (!type) return 0;
if (h->len == 2) return type;
// unsigned _int64 max = 18446744073709551615 (decimal, 20 chars)
// = 1111111 etc., max. 64x (binary, 64 chars)
// = 1777777777777777777777 (octal, 22 chars)
// = FFFFFFFFFFFFFFFF (hex, 16 chars)
if (type == 1) {
if (h->len > 18) return 0; // larger than int64
for (i = 2; i < h->len; i++) {
result <<= 4;
i2 = h->chr[i];
// 0 - 9 / A - F / a - f
if (((i2 >= 48) && (i2 <= 57)) || ((i2 >= 65) && (i2 <= 70)) || ((i2 >= 97) && (i2 <= 102))) {
if (i2 >= 97) i2 -= 32;
if (i2 >= 65) i2 -= 7;
i2 -= 48;
// i2 is now a values between 0 and 15
result += i2;
} else
return 0; // invalid character
} // i
hexoct2uint64_value = result;
return 1;
} // type == 1
if (type == 2) {
if (h->len > 24) return 0; // larger than int64
if (h->len == 24) {
if ((h->chr[2] != 48) && (h->chr[2] != 49))
return 0; // larger than int64
}
for (i = 2; i < h->len; i++) {
result <<= 3;
i2 = h->chr[i];
if ((i2 >= 48) && (i2 <= 55)) { // 0-7
i2 -= 48;
result += i2;
} else
return 0; // invalid character
} // i
hexoct2uint64_value = result;
return 2;
} // type == 2
if (type == 3) {
if (h->len > 66) return 0; // larger than int64
for (i = 2; i < h->len; i++) {
result <<= 1;
i2 = h->chr[i];
if ((i2 >= 48) && (i2 <= 49)) { // 0-1
i2 -= 48;
result += i2;
} else
return 0; // invalid character
} // i
hexoct2uint64_value = result;
return 3;
} // type == 3
}
@ -11749,7 +11776,7 @@ void qbs_input(int32 numvariables,uint8 newline){
max<<=i4;
max--;
//check for hex/oct
//check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
if (hexvalue>max){valid=0; goto typechecked;}
@ -11774,7 +11801,18 @@ void qbs_input(int32 numvariables,uint8 newline){
value>>=3;
}
if (l>(2+i)){valid=0; goto typechecked;}
if (l==1) completewith=111;//"O"
if (l==1) completewith=79;//"O"
if (l==2) completewith=48;//"0"
}
if (i3==3){
value=max;
i=0;
for (i2=1;i2<=64;i2++){
if (value&0x1) i=i2;
value>>=1;
}
if (l>(2+i)){valid=0; goto typechecked;}
if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
}
finalvalue=hexvalue;
@ -11846,13 +11884,14 @@ void qbs_input(int32 numvariables,uint8 newline){
if ((qbs_input_variabletypes[argn]&511)==64){
if (l==0){completewith=48; *(int64*)qbs_input_variableoffsets[argn]=0; goto typechecked;}
//check for hex/oct
//check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
if (hexvalue>max){valid=0; goto typechecked;}
//set completewith value (if necessary)
if (i3==1) if (l==1) completewith=72;//"H"
if (i3==2) if (l==1) completewith=111;//"O"
if (i3==2) if (l==1) completewith=79;//"O"
if (i3==3) if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
*(uint64*)qbs_input_variableoffsets[argn]=hexvalue;
goto typechecked;
@ -11936,12 +11975,13 @@ void qbs_input(int32 numvariables,uint8 newline){
//begin with a generic assessment, regardless of whether it is single, double or float
if (l==0){completewith=48; goto typechecked;}
//check for hex/oct
//check for hex/oct/bin
if (i3=hexoct2uint64(qbs_input_arguements[argn])){
hexvalue=hexoct2uint64_value;
//set completewith value (if necessary)
if (i3==1) if (l==1) completewith=72;//"H"
if (i3==2) if (l==1) completewith=111;//"O"
if (i3==2) if (l==1) completewith=79;//"O"
if (i3==3) if (l==1) completewith=66;//"B"
if (l==2) completewith=48;//"0"
//nb. because VC6 didn't support...
//error C2520: conversion from uint64 to double not implemented, use signed int64
@ -13271,8 +13311,9 @@ uint8 n_digit[256];
int64 n_exp;//if 0, there is one digit in front of the decimal place
uint8 n_neg;//if 1, the number is negative
uint8 n_hex;//if 1, the digits are in hexidecimal and n_exp should be ignored
//if 2, the digits are in octal and n_exp should be ignored
//(consider revising variable name n_hex)
//if 2, the digits are in octal and n_exp should be ignored
//if 3, the digits are in binary and n_exp should be ignored
//(consider revising variable name n_hex)
int32 n_roundincrement(){
static int32 i,i2,i3;
@ -13323,6 +13364,17 @@ int32 n_float(){
n_float_value=value;
return 1;
}
//bin?
if (n_hex==3){
if (n_digits>64) return 0;
for (i=0;i<n_digits;i++){
i2=n_digit[i]-48;
value<<=1;
value|=i2;
}
n_float_value=value;
return 1;
}
//max range check (+-1.7976931348623157E308)
if (n_exp>308)return 0;//overflow
@ -13393,7 +13445,6 @@ int32 n_int64(){
return 1;
}
//oct
if (n_hex==2){
if (n_digits>=22){
@ -13407,6 +13458,17 @@ int32 n_int64(){
n_int64_value=value;
return 1;
}
//bin
if (n_hex==3){
if (n_digits>64) return 0;
for (i=0;i<n_digits;i++){
i2=n_digit[i]-48;
value<<=1;
value|=i2;
}
n_int64_value=value;
return 1;
}
//range check: int64 (-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)
if (n_exp>18)return 0;//overflow
@ -13487,6 +13549,17 @@ int32 n_uint64(){
n_uint64_value=uvalue;
return 1;
}
//bin
if (n_hex==3){
if (n_digits>64) return 0;
for (i=0;i<n_digits;i++){
i2=n_digit[i]-48;
uvalue<<=1;
uvalue|=i2;
}
n_uint64_value=uvalue;
return 1;
}
//negative?
if (n_neg){
@ -13555,41 +13628,72 @@ int32 n_inputnumberfromdata(uint8 *data,ptrszint *data_offset,ptrszint data_size
//read character
c=data[*data_offset];
//hex/oct
if (c==38){//&
(*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
c=data[*data_offset];
if (c==44){(*data_offset)++; goto gotnumber;}
if ((c==72)||(c==104)){//"H"or"h"
nexthexchr:
(*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
c=data[*data_offset];
if (c==44){(*data_offset)++; goto gotnumber;}
if ( ((c>=48)&&(c<=57)) || ((c>=65)&&(c<=70)) || ((c>=97)&&(c<=102)) ){//0-9 or A-F or a-f
if (n_digits==256) return 1;//Overflow
n_digit[n_digits]=c;
n_digits++;
n_hex=1;
goto nexthexchr;
}
return 3;//Syntax error
// hex/oct/bin
if (c == 38) { // "&"
(*data_offset)++;
if (*data_offset >= data_size) goto gotnumber;
c = data[*data_offset];
if (c == 44) {
(*data_offset)++;
goto gotnumber;
}
if ((c == 72) || (c == 104)) { // "H" or "h"
nexthexchr:
(*data_offset)++;
if (*data_offset >= data_size) goto gotnumber;
c = data[*data_offset];
if (c == 44) {
(*data_offset)++;
goto gotnumber;
}
if ((c==79)||(c==111)){//"O"or"o"
nexthexchr2:
(*data_offset)++; if (*data_offset>=data_size) goto gotnumber;
c=data[*data_offset];
if (c==44){(*data_offset)++; goto gotnumber;}
if ((c>=48)&&(c<=55)){//0-7
if (n_digits==256) return 1;//Overflow
n_digit[n_digits]=c;
n_digits++;
n_hex=2;
goto nexthexchr2;
}
return 3;//Syntax error
if (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70)) ||
((c >= 97) && (c <= 102))) { // 0-9 or A-F or a-f
if (n_digits == 256) return 1; // Overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 1;
goto nexthexchr;
}
return 3;//Syntax error
}//&
return 3; // Syntax error
}
if ((c == 79) || (c == 111)) { // "O" or "o"
nexthexchr2:
(*data_offset)++;
if (*data_offset >= data_size) goto gotnumber;
c = data[*data_offset];
if (c == 44) {
(*data_offset)++;
goto gotnumber;
}
if ((c >= 48) && (c <= 55)) { // 0-7
if (n_digits == 256) return 1; // Overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 2;
goto nexthexchr2;
}
return 3; // Syntax error
}
if ((c == 66) || (c == 98)) { // "B" or "b"
nexthexchr3:
(*data_offset)++;
if (*data_offset >= data_size) goto gotnumber;
c = data[*data_offset];
if (c == 44) {
(*data_offset)++;
goto gotnumber;
}
if ((c >= 48) && (c <= 49)) { // 0-1
if (n_digits == 256) return 1; // Overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 3;
goto nexthexchr3;
}
return 3; // Syntax error
}
return 3; // Syntax error
} // "&"
readnextchr:
if (c==44){(*data_offset)++; goto gotnumber;}
@ -13731,36 +13835,53 @@ int32 n_inputnumberfromfile(int32 fileno){
if (c==-1){return_value=2; goto error;}//input past end of file
}while(c==32);
//hex/oct
if (c==38){//&
c=file_input_chr(fileno); if (c==-2) return 3;
if (c==-1) goto gotnumber;
if ((c==72)||(c==104)){//"H"or"h"
nexthexchr:
c=file_input_chr(fileno); if (c==-2) return 3;
if ( ((c>=48)&&(c<=57)) || ((c>=65)&&(c<=70)) || ((c>=97)&&(c<=102)) ){//0-9 or A-F or a-f
if (n_digits==256) goto error;//overflow
n_digit[n_digits]=c;
n_digits++;
n_hex=1;
goto nexthexchr;
}
goto gotnumber;
}
if ((c==79)||(c==111)){//"O"or"o"
nexthexchr2:
c=file_input_chr(fileno); if (c==-2) return 3;
if ((c>=48)&&(c<=55)){//0-7
if (n_digits==256) goto error;//overflow
n_digit[n_digits]=c;
n_digits++;
n_hex=2;
goto nexthexchr2;
}
goto gotnumber;
// hex/oct/bin
if (c == 38) { // "&"
c = file_input_chr(fileno);
if (c == -2) return 3;
if (c == -1) goto gotnumber;
if ((c == 72) || (c == 104)) { // "H" or "h"
nexthexchr:
c = file_input_chr(fileno);
if (c == -2) return 3;
if (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70)) ||
((c >= 97) && (c <= 102))) { // 0-9 or A-F or a-f
if (n_digits == 256) goto error; // overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 1;
goto nexthexchr;
}
goto gotnumber;
}//&
}
if ((c == 79) || (c == 111)) { // "O" or "o"
nexthexchr2:
c = file_input_chr(fileno);
if (c == -2) return 3;
if ((c >= 48) && (c <= 55)) { // 0-7
if (n_digits == 256) goto error; // overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 2;
goto nexthexchr2;
}
goto gotnumber;
}
if ((c == 66) || (c == 98)) { // "B" or "b"
nexthexchr3:
c = file_input_chr(fileno);
if (c == -2) return 3;
if ((c >= 48) && (c <= 49)) { // 0-1
if (n_digits == 256) goto error; // overflow
n_digit[n_digits] = c;
n_digits++;
n_hex = 3;
goto nexthexchr3;
}
goto gotnumber;
}
goto gotnumber;
} // "&"
readnextchr:
if (c==-1) goto gotnumber;
@ -14046,7 +14167,7 @@ long double func_read_float(uint8 *data,ptrszint *data_offset,ptrszint data_size
}
if ((value>maxval)||(value<minval)) goto overflow;
if (((typ&ISUNSIGNED)==0)&&n_hex){//signed hex/oct/...
if (((typ&ISUNSIGNED)==0)&&n_hex){//signed hex/oct/bin/...
if ( ( ((int64)1) << ((typ&511)-1) ) &value){//if top bit is set, set all bits above it to form a negative value
value=(maxval^((int64)-1))+value;
}
@ -14151,7 +14272,7 @@ long double func_file_input_float(int32 fileno,int32 typ){
}
if ((value>maxval)||(value<minval)){error(6); return 0;}
if (((typ&ISUNSIGNED)==0)&&n_hex){//signed hex/oct/...
if (((typ&ISUNSIGNED)==0)&&n_hex){//signed hex/oct/bin/...
if ( ( ((int64)1) << ((typ&511)-1) ) &value){//if top bit is set, set all bits above it to form a negative value
value=(maxval^((int64)-1))+value;
}
@ -15290,27 +15411,51 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
void sub_sleep(int32 seconds,int32 passed){
if (new_error) return;
sleep_break=0;
double prev,ms,now,elapsed;//cannot be static
prev=GetTicks();
ms=1000.0*(double)seconds;
#ifdef QB64_WINDOWS
if (read_page->console){
int32 junk=0,junk2=0;
DWORD dwRet;
HANDLE hStdin = GetStdHandle (STD_INPUT_HANDLE);
FlushConsoleInputBuffer(hStdin);
if (passed){
do{
now=GetTicks();
if (now<prev)return;//value looped?
elapsed=now-prev;//elapsed time since prev
ms = ms-elapsed;
prev=now;
dwRet = WaitForSingleObject(hStdin,ms); //this should provide our pause
if (dwRet==WAIT_TIMEOUT)return; //and if we timeout without any input, we exit early.
if (dwRet==WAIT_OBJECT_0){//this says the console had input
junk=func__getconsoleinput();
if(junk==1){//this is a valid keyboard event. Let's exit SLEEP in the console.
Sleep(100);//Give the user time to remove their finger from the key, before clearing the buffer.
FlushConsoleInputBuffer(hStdin);//flush the keyboard buffer after, so we don't leave stray events to be processed (such as key up events).
return;
}else{//we had an input event such as the mouse. Ignore it and clear the buffer so we don't keep responding to mouse inputs
FlushConsoleInputBuffer(hStdin);
}
}
}while(ms>0);//as long as our timer hasn't expired, we continue to run the loop and countdown the time remaining
return; //if we get here, something odd happened. We should expire automatically with the WAIT_TIMEOUT event before this occurs.
}
do{ //ignore all console input unless it's a keydown event
do{ //ignore all console input uless it's a keyboard event
junk=func__getconsoleinput();
junk2=consolekey;
}while(junk!=1); //only when junk = 1 do we have a keyboard event
}while(junk2<=0); //only when junk2 > 0 do we have a key down event. (values less than 0 are key up events; 0 is a non event)
do{ //now continue to get the console input
junk=func__getconsoleinput();
}while(consolekey!=-junk2); //until that key is released. We don't need to leave the key up sequence in the buffer to screw things up with future reads.
}while(junk!=1); //only when junk = 1 do we have a keyboard event
Sleep(100); //Give the user time to remove their finger from the key, before clearing the buffer.
FlushConsoleInputBuffer(hStdin); //and flush the keyboard buffer after, so we don't leave stray events to be processed.
return;
}
#endif
sleep_break=0;
double prev,ms,now,elapsed;//cannot be static
if (passed) prev=GetTicks();
ms=1000.0*(double)seconds;
recalculate:
wait:
evnt(0);//handle general events
@ -18373,7 +18518,10 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
i2=newimg();
d=&img[i2];
memcpy(d,s,sizeof(img_struct));
img[i2].lock_id=NULL; img[i2].lock_offset=NULL; // force _MEMIMGAGE to get a new lock for the copy
//don't duplicate the memory lock (if any),
//_MEMIMAGE needs to obtain a new lock for the copy
img[i2].lock_id=NULL;
img[i2].lock_offset=NULL;
//duplicate pixel data
bytes=d->width*d->height*d->bytes_per_pixel;
d->offset=(uint8*)malloc(bytes);
@ -19746,6 +19894,7 @@ void sub_put2(int32 i,int64 offset,void *element,int32 passed){
#ifdef QB64_WINDOWS
cout<<"\nPress any key to continue";
int32 junk;
FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE)); //clear any stray buffer events before we run END.
do{ //ignore all console input
junk=func__getconsoleinput();
}while(junk!=1); //until we have a key down event
@ -29631,19 +29780,16 @@ void reinit_glut_callbacks(){
int32 func__getconsoleinput(){
HANDLE hStdin = GetStdHandle (STD_INPUT_HANDLE);
INPUT_RECORD irInputRecord;
DWORD dwEventsRead, fdwMode;
DWORD dwEventsRead, fdwMode, dwMode;
CONSOLE_SCREEN_BUFFER_INFO cl_bufinfo;
SECURITY_ATTRIBUTES SecAttribs = {sizeof(SECURITY_ATTRIBUTES), 0, 1};
HANDLE cl_conout = CreateFileA("CONOUT$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
HANDLE cl_conin = CreateFileA("CONIN$", GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, & SecAttribs, OPEN_EXISTING, 0, 0);
GetConsoleScreenBufferInfo(cl_conout, &cl_bufinfo);
GetConsoleMode(hStdin, (LPDWORD)&dwMode);
fdwMode = ENABLE_EXTENDED_FLAGS;
SetConsoleMode(cl_conin, fdwMode);
fdwMode = ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
SetConsoleMode(cl_conin, fdwMode);
SetConsoleMode(hStdin, fdwMode);
fdwMode = dwMode | ENABLE_WINDOW_INPUT | ENABLE_MOUSE_INPUT;
SetConsoleMode(hStdin, fdwMode);
ReadConsoleInputA (cl_conin, &irInputRecord, 1, &dwEventsRead);
ReadConsoleInputA (hStdin, &irInputRecord, 1, &dwEventsRead);
switch(irInputRecord.EventType){
case KEY_EVENT: //keyboard input
consolekey = irInputRecord.Event.KeyEvent.wVirtualScanCode;
@ -29653,6 +29799,7 @@ void reinit_glut_callbacks(){
consolemousex = irInputRecord.Event.MouseEvent.dwMousePosition.X + 1;
consolemousey = irInputRecord.Event.MouseEvent.dwMousePosition.Y - cl_bufinfo.srWindow.Top + 1;
consolebutton = irInputRecord.Event.MouseEvent.dwButtonState; //button state for all buttons
//SetConsoleMode(hStdin, dwMode);
return 2;
}
return 0; //in case it's some other odd input

View file

@ -641,12 +641,12 @@ extern float string2s(qbs*str);
extern double string2d(qbs*str);
extern long double string2f(qbs*str);
//Cobalt(aka Dave) added the next 2 lines
int64 func__shr(int64 a1, int b1);
int64 func__shl(int64 a1, int b1);
int64 func__readbit(int64 a1, int b1);
int64 func__setbit(int64 a1, int b1);
int64 func__resetbit(int64 a1, int b1);
int64 func__togglebit(int64 a1, int b1);
uint64 func__shr(uint64 a1, int b1);
uint64 func__shl(uint64 a1, int b1);
int64 func__readbit(uint64 a1, int b1);
uint64 func__setbit(uint64 a1, int b1);
uint64 func__resetbit(uint64 a1, int b1);
uint64 func__togglebit(uint64 a1, int b1);
#ifndef QB64_WINDOWS
extern void Sleep(uint32 milliseconds);
extern void ZeroMemory(void *ptr,int64 bytes);
@ -975,22 +975,22 @@ inline int32 func_sgn(long double v){
}
//bit-shifting
inline int64 func__shl(int64 a1,int b1)
inline uint64 func__shl(uint64 a1,int b1)
{return a1<<b1;}
inline int64 func__shr(int64 a1,int b1)
inline uint64 func__shr(uint64 a1,int b1)
{return a1>>b1;}
inline int64 func__readbit(int64 a1, int b1)
inline int64 func__readbit(uint64 a1, int b1)
{if (a1 & 1ull<<b1) return -1; else return 0;}
inline int64 func__setbit(int64 a1, int b1)
inline uint64 func__setbit(uint64 a1, int b1)
{return a1 | 1ull<<b1;}
inline int64 func__resetbit(int64 a1, int b1)
inline uint64 func__resetbit(uint64 a1, int b1)
{return a1 & ~(1ull<<b1);}
inline int64 func__togglebit(int64 a1, int b1)
inline uint64 func__togglebit(uint64 a1, int b1)
{return a1 ^ 1ull<<b1;}
//Working with 32bit colors:

View file

@ -201,7 +201,7 @@ DIM SHARED menusize(1 TO 10)
DIM SHARED menus AS INTEGER, idecontextualmenuID AS INTEGER
DIM SHARED ideeditmenuID AS INTEGER, SearchMenuID AS INTEGER
DIM SHARED OptionsMenuID AS INTEGER, OptionsMenuSwapMouse AS INTEGER, OptionsMenuPasteCursor AS INTEGER
DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER
DIM SHARED OptionsMenuShowErrorsImmediately AS INTEGER, OptionsMenuIgnoreWarnings AS INTEGER
DIM SHARED ViewMenuID AS INTEGER, ViewMenuShowLineNumbersSubMenuID AS INTEGER
DIM SHARED ViewMenuShowSeparatorID AS INTEGER, ViewMenuShowBGID AS INTEGER
DIM SHARED ViewMenuCompilerWarnings AS INTEGER

View file

@ -333,8 +333,8 @@ FUNCTION ide2 (ignore)
END IF
OptionsMenuIgnoreWarnings = i
menu$(m, 11) = "Ignore Warnings": i = 12
IF IgnoreWarnings THEN menu$(OptionsMenuID, 11) = CHR$(7) + "Ignore Warnings"
menu$(m, i) = "Ignore #Warnings": i = i + 1
IF IgnoreWarnings THEN menu$(OptionsMenuID, OptionsMenuIgnoreWarnings) = CHR$(7) + "Ignore #Warnings"
@ -4127,8 +4127,20 @@ FUNCTION ide2 (ignore)
s = 0
parentMenu = 0
parentMenuSetup%% = 0
IF idecontextualmenu = 1 THEN idectxmenuX = mX: idectxmenuY = mY: m = idecontextualmenuID
IF idecontextualmenu = 2 THEN idectxmenuX = xx + w + 3: idectxmenuY = yy + r: parentMenu = m: m = ViewMenuShowLineNumbersSubMenuID
SELECT CASE idecontextualmenu
CASE 1
'right-click on text area
idectxmenuX = mX
idectxmenuY = mY
m = idecontextualmenuID
CASE 2
'line numbers menu item in View menu
idectxmenuX = xx + w + 3
idectxmenuY = yy + r
parentMenu = m
m = ViewMenuShowLineNumbersSubMenuID
END SELECT
IdeMakeEditMenu
IF totalWarnings = 0 THEN
@ -4298,6 +4310,7 @@ FUNCTION ide2 (ignore)
m = parentMenu
r = parentMenuR
parentMenu = 0
parentMenuR = 0
idecontextualmenu = 0
PCOPY 3, 2
_CONTINUE
@ -4308,6 +4321,7 @@ FUNCTION ide2 (ignore)
GOTO ideloop
END IF
END IF
IF NOT mouseup AND NOT mousedown THEN 'Check if we're hovering on menu options
IF parentMenu > 0 AND oldmy <> mY AND oldmx <> mX AND _
mX >= backToParent.x1 AND mX =< backToParent.x2 AND _
@ -4315,6 +4329,7 @@ FUNCTION ide2 (ignore)
m = parentMenu
r = parentMenuR
parentMenu = 0
parentMenuR = 0
idecontextualmenu = 0
PCOPY 3, 2
_CONTINUE
@ -4342,6 +4357,8 @@ FUNCTION ide2 (ignore)
IF mX >= x AND mX < x2 THEN
m = i
r = 1
parentMenuR = 0
parentMenu = 0
IF idecontextualmenu > 1 THEN idecontextualmenu = 0: PCOPY 3, 2
EXIT FOR
END IF
@ -4664,16 +4681,16 @@ FUNCTION ide2 (ignore)
GOTO ideloop
END IF
IF RIGHT$(menu$(m, s), 15) = "Ignore Warnings" THEN
IF RIGHT$(menu$(m, s), 16) = "Ignore #Warnings" THEN
PCOPY 2, 0
IF Ignorewarnings = 0 THEN
Ignorewarnings = -1
WriteConfigSetting "'[GENERAL SETTINGS]", "IgnoreWarnings", "TRUE"
menu$(OptionsMenuID, 11) = CHR$(7) + "Ignore Warnings"
menu$(OptionsMenuID, OptionsMenuIgnoreWarnings) = CHR$(7) + "Ignore #Warnings"
ELSE
Ignorewarnings = 0
WriteConfigSetting "'[GENERAL SETTINGS]", "IgnoreWarnings", "FALSE"
menu$(OptionsMenuID, 11) = "Ignore Warnings"
menu$(OptionsMenuID, OptionsMenuIgnoreWarnings) = "Ignore #Warnings"
END IF
idechangemade = 1
PCOPY 3, 0: SCREEN , , 3, 0: idewait4mous: idewait4alt

View file

@ -3268,8 +3268,8 @@ id.n = "_SHR"
id.subfunc = 1
id.callname = "func__shr"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3277,8 +3277,8 @@ id.n = "_SHL"
id.subfunc = 1
id.callname = "func__shl"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3413,7 +3413,7 @@ id.n = "_READBIT"
id.subfunc = 1
id.callname = "func__readbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
regid
@ -3422,8 +3422,8 @@ id.n = "_SETBIT"
id.subfunc = 1
id.callname = "func__setbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3431,8 +3431,8 @@ id.n = "_RESETBIT"
id.subfunc = 1
id.callname = "func__resetbit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid
clearid
@ -3440,6 +3440,6 @@ id.n = "_TOGGLEBIT"
id.subfunc = 1
id.callname = "func__togglebit"
id.args = 2
id.arg = MKL$(INTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = INTEGER64TYPE - ISPOINTER
id.arg = MKL$(UINTEGER64TYPE - ISPOINTER) + MKL$(LONGTYPE - ISPOINTER)
id.ret = UINTEGER64TYPE - ISPOINTER
regid