mirror of
https://github.com/QB64Official/qb64.git
synced 2024-07-05 18:10:24 +00:00
Fixed ASCII tool colors to match QB64 IDE, and added in EXIT dupport with the red X on top.
Pushed changes introduced by LUKE (Johny B on the QB64 forums) as follows : Fixed setup_lnx.sh, added _CWD$, fixed handling of errno. Converted setup_lnx.sh to Linux line endings (was preventing the script from running). We now include <errno.h>, so the errno variable actually works - before it was just a regular variable that wasn't being set on error. Added a _CWD$ function that returns the current working directory. Should work on all 3 systems, but testing is needed on Win/Mac. Can cause the following runtime errors: 7 (Out of memory), 51 (Internal error).
This commit is contained in:
parent
9d2c936189
commit
ef083bb4af
Binary file not shown.
|
@ -4,4 +4,5 @@
|
||||||
//**
|
//**
|
||||||
//***********************************************
|
//***********************************************
|
||||||
|
|
||||||
#include "Steves_Main-List.cpp"
|
#include "luke_mods.cpp"
|
||||||
|
#include "Steves_Main-List.cpp"
|
||||||
|
|
53
internal/c/User Mods/luke_mods.cpp
Normal file
53
internal/c/User Mods/luke_mods.cpp
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
//Get Current Working Directory
|
||||||
|
qbs *func__cwd(){
|
||||||
|
qbs *final, *tqbs;
|
||||||
|
int length;
|
||||||
|
char *buf, *ret;
|
||||||
|
|
||||||
|
#if defined QB64_WINDOWS
|
||||||
|
length = GetCurrentDirectoryA(0, NULL);
|
||||||
|
buf = (char *)malloc(length);
|
||||||
|
if (!buf) {
|
||||||
|
error(7); //"Out of memory"
|
||||||
|
return tqbs;
|
||||||
|
}
|
||||||
|
if (GetCurrentDirectoryA(length, buf) != --length) { //Sanity check
|
||||||
|
free(buf); //It's good practice
|
||||||
|
tqbs = qbs_new(0, 1);
|
||||||
|
error(51); //"Internal error"
|
||||||
|
return tqbs;
|
||||||
|
}
|
||||||
|
#elif defined QB64_LINUX
|
||||||
|
length = 512;
|
||||||
|
while(1) {
|
||||||
|
buf = (char *)malloc(length);
|
||||||
|
if (!buf) {
|
||||||
|
tqbs = qbs_new(0, 1);
|
||||||
|
error(7);
|
||||||
|
return tqbs;
|
||||||
|
}
|
||||||
|
ret = getcwd(buf, length);
|
||||||
|
if (ret) break;
|
||||||
|
if (errno != ERANGE) {
|
||||||
|
tqbs = qbs_new(0, 1);
|
||||||
|
error(51);
|
||||||
|
return tqbs;
|
||||||
|
}
|
||||||
|
free(buf);
|
||||||
|
length += 512;
|
||||||
|
}
|
||||||
|
length = strlen(ret);
|
||||||
|
ret = (char *)realloc(ret, length); //Chops off the null byte
|
||||||
|
if (!ret) {
|
||||||
|
tqbs = qbs_new(0, 1);
|
||||||
|
error(7);
|
||||||
|
return tqbs;
|
||||||
|
}
|
||||||
|
buf = ret;
|
||||||
|
#endif
|
||||||
|
final = qbs_new(length, 1);
|
||||||
|
memcpy(final->chr, buf, length);
|
||||||
|
free(buf);
|
||||||
|
return final;
|
||||||
|
}
|
||||||
|
|
5
internal/c/User Mods/luke_mods.h
Normal file
5
internal/c/User Mods/luke_mods.h
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
/* Routines by Luke
|
||||||
|
* The actual code is in Luke_Main-List.cpp
|
||||||
|
* Write me at <flukiluke@gmail.com> if I broke something
|
||||||
|
*/
|
||||||
|
qbs *func__cwd();
|
|
@ -9,4 +9,5 @@
|
||||||
//**
|
//**
|
||||||
//*************************************************************
|
//*************************************************************
|
||||||
|
|
||||||
|
#include "luke_mods.h"
|
||||||
#include "steve_mods.h"
|
#include "steve_mods.h"
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
#include "os.h"
|
#include "os.h"
|
||||||
|
|
||||||
#ifdef QB64_ANDROID
|
#ifdef QB64_ANDROID
|
||||||
#define QB64_GLES1
|
#define QB64_GLES1
|
||||||
#define QB64_NOT_X86
|
#define QB64_NOT_X86
|
||||||
#define QB64_GLUT
|
#define QB64_GLUT
|
||||||
#else
|
#else
|
||||||
#define QB64_GL1
|
#define QB64_GL1
|
||||||
#define QB64_GLUT
|
#define QB64_GLUT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QB64_LINUX
|
#ifdef QB64_LINUX
|
||||||
#ifndef QB64_MACOSX
|
#ifndef QB64_MACOSX
|
||||||
#ifndef QB64_ANDROID
|
#ifndef QB64_ANDROID
|
||||||
#define QB64_X11
|
#define QB64_X11
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define NO_S_D_L
|
#define NO_S_D_L
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
#include "parts\\core\\gl_headers\\glew\\glew.h"
|
#include "parts\\core\\gl_headers\\glew\\glew.h"
|
||||||
#else
|
#else
|
||||||
#include "parts/core/gl_headers/glew/glew.h"
|
#include "parts/core/gl_headers/glew/glew.h"
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//core
|
//core
|
||||||
#ifdef QB64_GLUT
|
#ifdef QB64_GLUT
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
#include "parts\\core\\src.c"
|
#include "parts\\core\\src.c"
|
||||||
#else
|
#else
|
||||||
#include "parts/core/src.c"
|
#include "parts/core/src.c"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//common includes
|
//common includes
|
||||||
|
@ -53,131 +53,132 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
//OS/compiler specific includes
|
//OS/compiler specific includes
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
#include <winspool.h>
|
#include <winspool.h>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <process.h> //required for multi-threading
|
#include <process.h> //required for multi-threading
|
||||||
|
|
||||||
//2013 midi
|
//2013 midi
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#ifndef QB64_MACOSX
|
#ifndef QB64_MACOSX
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef QB64_GLUT
|
#ifdef QB64_GLUT
|
||||||
#ifndef QB64_ANDROID
|
#ifndef QB64_ANDROID
|
||||||
#ifdef QB64_BACKSLASH_FILESYSTEM
|
#ifdef QB64_BACKSLASH_FILESYSTEM
|
||||||
#include "parts\\core\\gl_headers\\opengl_org_registery\\glext.h"
|
#include "parts\\core\\gl_headers\\opengl_org_registery\\glext.h"
|
||||||
#else
|
#else
|
||||||
#include "parts/core/gl_headers/opengl_org_registery/glext.h"
|
#include "parts/core/gl_headers/opengl_org_registery/glext.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
//QB64 string descriptor structure
|
//QB64 string descriptor structure
|
||||||
struct qbs_field{
|
struct qbs_field{
|
||||||
int32 fileno;
|
int32 fileno;
|
||||||
int64 fileid;
|
int64 fileid;
|
||||||
int64 size;
|
int64 size;
|
||||||
int64 offset;
|
int64 offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct qbs{
|
struct qbs{
|
||||||
uint8 *chr;//a 32 bit pointer to the string's data
|
uint8 *chr;//a 32 bit pointer to the string's data
|
||||||
int32 len;//must be signed for comparisons against signed int32s
|
int32 len;//must be signed for comparisons against signed int32s
|
||||||
uint8 in_cmem;//set to 1 if in the conventional memory DBLOCK
|
uint8 in_cmem;//set to 1 if in the conventional memory DBLOCK
|
||||||
uint16 *cmem_descriptor;
|
uint16 *cmem_descriptor;
|
||||||
uint16 cmem_descriptor_offset;
|
uint16 cmem_descriptor_offset;
|
||||||
uint32 listi;//the index in the list of strings that references it
|
uint32 listi;//the index in the list of strings that references it
|
||||||
uint8 tmp;//set to 1 if the string can be deleted immediately after being processed
|
uint8 tmp;//set to 1 if the string can be deleted immediately after being processed
|
||||||
uint32 tmplisti;//the index in the list of strings that references it
|
uint32 tmplisti;//the index in the list of strings that references it
|
||||||
uint8 fixed;//fixed length string
|
uint8 fixed;//fixed length string
|
||||||
uint8 readonly;//set to 1 if string is read only
|
uint8 readonly;//set to 1 if string is read only
|
||||||
qbs_field *field;
|
qbs_field *field;
|
||||||
};
|
};
|
||||||
|
|
||||||
//substitute functionality
|
//substitute functionality
|
||||||
|
|
||||||
#ifdef QB64_WINDOWS
|
#ifdef QB64_WINDOWS
|
||||||
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
|
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
|
||||||
Sleep(milliseconds);
|
Sleep(milliseconds);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
|
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
|
||||||
static uint64 sec,nsec;
|
static uint64 sec,nsec;
|
||||||
sec=milliseconds/1000;
|
sec=milliseconds/1000;
|
||||||
nsec=(milliseconds%1000)*1000000;
|
nsec=(milliseconds%1000)*1000000;
|
||||||
static timespec ts;
|
static timespec ts;
|
||||||
ts.tv_sec = sec;
|
ts.tv_sec = sec;
|
||||||
ts.tv_nsec = nsec;
|
ts.tv_nsec = nsec;
|
||||||
nanosleep (&ts, NULL);
|
nanosleep (&ts, NULL);
|
||||||
}
|
}
|
||||||
inline void Sleep(uint32 milliseconds){
|
inline void Sleep(uint32 milliseconds){
|
||||||
SDL_Delay(milliseconds);
|
SDL_Delay(milliseconds);
|
||||||
}
|
}
|
||||||
inline uint32 _lrotl(uint32 word,uint32 shift){
|
inline uint32 _lrotl(uint32 word,uint32 shift){
|
||||||
return (word << shift) | (word >> (32 - shift));
|
return (word << shift) | (word >> (32 - shift));
|
||||||
}
|
}
|
||||||
inline void ZeroMemory(void *ptr,int64 bytes){
|
inline void ZeroMemory(void *ptr,int64 bytes){
|
||||||
memset(ptr,0,bytes);
|
memset(ptr,0,bytes);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct img_struct{
|
struct img_struct{
|
||||||
void *lock_offset;
|
void *lock_offset;
|
||||||
int64 lock_id;
|
int64 lock_id;
|
||||||
uint8 valid;//0,1 0=invalid
|
uint8 valid;//0,1 0=invalid
|
||||||
uint8 text;//if set, surface is a text surface
|
uint8 text;//if set, surface is a text surface
|
||||||
uint8 console;//dummy surface to absorb unimplemented console functionality
|
uint8 console;//dummy surface to absorb unimplemented console functionality
|
||||||
uint16 width,height;
|
uint16 width,height;
|
||||||
uint8 bytes_per_pixel;//1,2,4
|
uint8 bytes_per_pixel;//1,2,4
|
||||||
uint8 bits_per_pixel;//1,2,4,8,16(text),32
|
uint8 bits_per_pixel;//1,2,4,8,16(text),32
|
||||||
uint32 mask;//1,3,0xF,0xFF,0xFFFF,0xFFFFFFFF
|
uint32 mask;//1,3,0xF,0xFF,0xFFFF,0xFFFFFFFF
|
||||||
uint16 compatible_mode;//0,1,2,7,8,9,10,11,12,13,32,256
|
uint16 compatible_mode;//0,1,2,7,8,9,10,11,12,13,32,256
|
||||||
uint32 color,background_color,draw_color;
|
uint32 color,background_color,draw_color;
|
||||||
uint32 font;//8,14,16,?
|
uint32 font;//8,14,16,?
|
||||||
int16 top_row,bottom_row;//VIEW PRINT settings, unique (as in QB) to each "page"
|
int16 top_row,bottom_row;//VIEW PRINT settings, unique (as in QB) to each "page"
|
||||||
int16 cursor_x,cursor_y;//unique (as in QB) to each "page"
|
int16 cursor_x,cursor_y;//unique (as in QB) to each "page"
|
||||||
uint8 cursor_show, cursor_firstvalue, cursor_lastvalue;
|
uint8 cursor_show, cursor_firstvalue, cursor_lastvalue;
|
||||||
union{
|
union{
|
||||||
uint8 *offset;
|
uint8 *offset;
|
||||||
uint32 *offset32;
|
uint32 *offset32;
|
||||||
};
|
};
|
||||||
uint32 flags;
|
uint32 flags;
|
||||||
uint32 *pal;
|
uint32 *pal;
|
||||||
int32 transparent_color;//-1 means no color is transparent
|
int32 transparent_color;//-1 means no color is transparent
|
||||||
uint8 alpha_disabled;
|
uint8 alpha_disabled;
|
||||||
uint8 holding_cursor;
|
uint8 holding_cursor;
|
||||||
uint8 print_mode;
|
uint8 print_mode;
|
||||||
//BEGIN apm ('active page migration')
|
//BEGIN apm ('active page migration')
|
||||||
//everything between apm points is migrated during active page changes
|
//everything between apm points is migrated during active page changes
|
||||||
//note: apm data is only relevent to graphics modes
|
//note: apm data is only relevent to graphics modes
|
||||||
uint8 apm_p1;
|
uint8 apm_p1;
|
||||||
int32 view_x1,view_y1,view_x2,view_y2;
|
int32 view_x1,view_y1,view_x2,view_y2;
|
||||||
int32 view_offset_x,view_offset_y;
|
int32 view_offset_x,view_offset_y;
|
||||||
float x,y;
|
float x,y;
|
||||||
uint8 clipping_or_scaling;
|
uint8 clipping_or_scaling;
|
||||||
float scaling_x,scaling_y,scaling_offset_x,scaling_offset_y;
|
float scaling_x,scaling_y,scaling_offset_x,scaling_offset_y;
|
||||||
float window_x1,window_y1,window_x2,window_y2;
|
float window_x1,window_y1,window_x2,window_y2;
|
||||||
double draw_ta;
|
double draw_ta;
|
||||||
double draw_scale;
|
double draw_scale;
|
||||||
uint8 apm_p2;
|
uint8 apm_p2;
|
||||||
//END apm
|
//END apm
|
||||||
};
|
};
|
||||||
//img_struct flags
|
//img_struct flags
|
||||||
#define IMG_FREEPAL 1 //free palette data before freeing image
|
#define IMG_FREEPAL 1 //free palette data before freeing image
|
||||||
|
@ -185,89 +186,89 @@ uint8 apm_p2;
|
||||||
#define IMG_FREEMEM 4 //if set, it means memory must be freed
|
#define IMG_FREEMEM 4 //if set, it means memory must be freed
|
||||||
|
|
||||||
#ifdef QB64_NOT_X86
|
#ifdef QB64_NOT_X86
|
||||||
inline int64 qbr(long double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
inline int64 qbr(long double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
||||||
inline uint64 qbr_longdouble_to_uint64(long double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
inline uint64 qbr_longdouble_to_uint64(long double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
||||||
inline int32 qbr_float_to_long(float f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
inline int32 qbr_float_to_long(float f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
||||||
inline int32 qbr_double_to_long(double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
inline int32 qbr_double_to_long(double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
|
||||||
#else
|
#else
|
||||||
//QBASIC compatible rounding via FPU:
|
//QBASIC compatible rounding via FPU:
|
||||||
#ifdef QB64_MICROSOFT
|
#ifdef QB64_MICROSOFT
|
||||||
inline int64 qbr(long double f){
|
inline int64 qbr(long double f){
|
||||||
int64 i;
|
int64 i;
|
||||||
__asm{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
fistp i
|
fistp i
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline uint64 qbr_longdouble_to_uint64(long double f){
|
inline uint64 qbr_longdouble_to_uint64(long double f){
|
||||||
uint64 i;
|
uint64 i;
|
||||||
__asm{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
fistp i
|
fistp i
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline int32 qbr_float_to_long(float f){
|
inline int32 qbr_float_to_long(float f){
|
||||||
int32 i;
|
int32 i;
|
||||||
__asm{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
fistp i
|
fistp i
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline int32 qbr_double_to_long(double f){
|
inline int32 qbr_double_to_long(double f){
|
||||||
int32 i;
|
int32 i;
|
||||||
__asm{
|
__asm{
|
||||||
fld f
|
fld f
|
||||||
fistp i
|
fistp i
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
//FLDS=load single
|
//FLDS=load single
|
||||||
//FLDL=load double
|
//FLDL=load double
|
||||||
//FLDT=load long double
|
//FLDT=load long double
|
||||||
inline int64 qbr(long double f){
|
inline int64 qbr(long double f){
|
||||||
int64 i;
|
int64 i;
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"fldt %1;"
|
"fldt %1;"
|
||||||
"fistpll %0;"
|
"fistpll %0;"
|
||||||
:"=m" (i)
|
:"=m" (i)
|
||||||
:"m" (f)
|
:"m" (f)
|
||||||
);
|
);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline uint64 qbr_longdouble_to_uint64(long double f){
|
inline uint64 qbr_longdouble_to_uint64(long double f){
|
||||||
uint64 i;
|
uint64 i;
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"fldt %1;"
|
"fldt %1;"
|
||||||
"fistpll %0;"
|
"fistpll %0;"
|
||||||
:"=m" (i)
|
:"=m" (i)
|
||||||
:"m" (f)
|
:"m" (f)
|
||||||
);
|
);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline int32 qbr_float_to_long(float f){
|
inline int32 qbr_float_to_long(float f){
|
||||||
int32 i;
|
int32 i;
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"flds %1;"
|
"flds %1;"
|
||||||
"fistpl %0;"
|
"fistpl %0;"
|
||||||
:"=m" (i)
|
:"=m" (i)
|
||||||
:"m" (f)
|
:"m" (f)
|
||||||
);
|
);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
inline int32 qbr_double_to_long(double f){
|
inline int32 qbr_double_to_long(double f){
|
||||||
int32 i;
|
int32 i;
|
||||||
__asm__ (
|
__asm__ (
|
||||||
"fldl %1;"
|
"fldl %1;"
|
||||||
"fistpl %0;"
|
"fistpl %0;"
|
||||||
:"=m" (i)
|
:"=m" (i)
|
||||||
:"m" (f)
|
:"m" (f)
|
||||||
);
|
);
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif //x86 support
|
#endif //x86 support
|
||||||
|
|
||||||
|
@ -276,22 +277,22 @@ static int64 bmask;
|
||||||
static uint64 *bptr64;
|
static uint64 *bptr64;
|
||||||
static int64 bval64;
|
static int64 bval64;
|
||||||
inline uint64 getubits(uint32 bsize,uint8 *base,ptrszint i){
|
inline uint64 getubits(uint32 bsize,uint8 *base,ptrszint i){
|
||||||
bmask=~(-(((int64)1)<<bsize));
|
bmask=~(-(((int64)1)<<bsize));
|
||||||
i*=bsize;
|
i*=bsize;
|
||||||
return ((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
|
return ((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
|
||||||
}
|
}
|
||||||
inline int64 getbits(uint32 bsize,uint8 *base,ptrszint i){
|
inline int64 getbits(uint32 bsize,uint8 *base,ptrszint i){
|
||||||
bmask=~(-(((int64)1)<<bsize));
|
bmask=~(-(((int64)1)<<bsize));
|
||||||
i*=bsize;
|
i*=bsize;
|
||||||
bval64=((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
|
bval64=((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
|
||||||
if (bval64&(((int64)1)<<(bsize-1))) return bval64|(~bmask);
|
if (bval64&(((int64)1)<<(bsize-1))) return bval64|(~bmask);
|
||||||
return bval64;
|
return bval64;
|
||||||
}
|
}
|
||||||
inline void setbits(uint32 bsize,uint8 *base,ptrszint i,int64 val){
|
inline void setbits(uint32 bsize,uint8 *base,ptrszint i,int64 val){
|
||||||
bmask=(((uint64)1)<<bsize)-1;
|
bmask=(((uint64)1)<<bsize)-1;
|
||||||
i*=bsize;
|
i*=bsize;
|
||||||
bptr64=(uint64*)(base+(i>>3));
|
bptr64=(uint64*)(base+(i>>3));
|
||||||
*bptr64=(*bptr64&( ( (bmask<<(i&7)) ^-1) )) | ((val&bmask)<<(i&7));
|
*bptr64=(*bptr64&( ( (bmask<<(i&7)) ^-1) )) | ((val&bmask)<<(i&7));
|
||||||
}
|
}
|
||||||
|
|
||||||
//QB64 internal variable type flags (internally referenced by some C functions)
|
//QB64 internal variable type flags (internally referenced by some C functions)
|
||||||
|
@ -304,98 +305,98 @@ bptr64=(uint64*)(base+(i>>3));
|
||||||
#define ISOFFSETINBITS 16777216
|
#define ISOFFSETINBITS 16777216
|
||||||
|
|
||||||
struct ontimer_struct{
|
struct ontimer_struct{
|
||||||
uint8 allocated;
|
uint8 allocated;
|
||||||
uint32 id;//the event ID to trigger (0=no event)
|
uint32 id;//the event ID to trigger (0=no event)
|
||||||
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
||||||
uint8 active;//0=OFF, 1=ON, 2=STOP
|
uint8 active;//0=OFF, 1=ON, 2=STOP
|
||||||
uint8 state;//0=untriggered,1=triggered
|
uint8 state;//0=untriggered,1=triggered
|
||||||
double seconds;//how many seconds between events
|
double seconds;//how many seconds between events
|
||||||
double last_time;//the last time this event was triggered
|
double last_time;//the last time this event was triggered
|
||||||
};
|
};
|
||||||
|
|
||||||
struct onkey_struct{
|
struct onkey_struct{
|
||||||
uint32 id;//the event ID to trigger (0=no event)
|
uint32 id;//the event ID to trigger (0=no event)
|
||||||
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
||||||
uint8 active;//0=OFF, 1=ON, 2=STOP
|
uint8 active;//0=OFF, 1=ON, 2=STOP
|
||||||
uint8 state;//0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
|
uint8 state;//0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
|
||||||
uint32 keycode;//32-bit code, same as what _KEYHIT returns
|
uint32 keycode;//32-bit code, same as what _KEYHIT returns
|
||||||
uint32 keycode_alternate;//an alternate keycode which may also trigger event
|
uint32 keycode_alternate;//an alternate keycode which may also trigger event
|
||||||
uint8 key_scancode;
|
uint8 key_scancode;
|
||||||
uint8 key_flags;
|
uint8 key_flags;
|
||||||
//flags:
|
//flags:
|
||||||
//0 No keyboard flag, 1-3 Either Shift key, 4 Ctrl key, 8 Alt key,32 NumLock key,64 Caps Lock key, 128 Extended keys on a 101-key keyboard
|
//0 No keyboard flag, 1-3 Either Shift key, 4 Ctrl key, 8 Alt key,32 NumLock key,64 Caps Lock key, 128 Extended keys on a 101-key keyboard
|
||||||
//To specify multiple shift states, add the values together. For example, a value of 12 specifies that the user-defined key is used in combination with the Ctrl and Alt keys.
|
//To specify multiple shift states, add the values together. For example, a value of 12 specifies that the user-defined key is used in combination with the Ctrl and Alt keys.
|
||||||
qbs *text;
|
qbs *text;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct onstrig_struct{
|
struct onstrig_struct{
|
||||||
uint32 id;//the event ID to trigger (0=no event)
|
uint32 id;//the event ID to trigger (0=no event)
|
||||||
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
int64 pass;//the value to pass to the triggered event (only applicable to ON ... CALL ...(x)
|
||||||
uint8 active;//0=OFF, 1=ON, 2=STOP
|
uint8 active;//0=OFF, 1=ON, 2=STOP
|
||||||
uint8 state;//0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
|
uint8 state;//0=untriggered,1=triggered,2=in progress(TIMER only),2+=multiple events queued(KEY only)
|
||||||
};
|
};
|
||||||
|
|
||||||
struct byte_element_struct
|
struct byte_element_struct
|
||||||
{
|
{
|
||||||
uint64 offset;
|
uint64 offset;
|
||||||
int32 length;
|
int32 length;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct device_struct{
|
struct device_struct{
|
||||||
int32 used;
|
int32 used;
|
||||||
int32 type;
|
int32 type;
|
||||||
//0=Unallocated
|
//0=Unallocated
|
||||||
//1=SDL joystick interface
|
//1=SDL joystick interface
|
||||||
//2=?
|
//2=?
|
||||||
qbs *name;
|
qbs *name;
|
||||||
int32 connected;
|
int32 connected;
|
||||||
int32 lastbutton;
|
int32 lastbutton;
|
||||||
int32 lastaxis;
|
int32 lastaxis;
|
||||||
int32 lastwheel;
|
int32 lastwheel;
|
||||||
//--------------
|
//--------------
|
||||||
int32 max_events;
|
int32 max_events;
|
||||||
int32 queued_events;
|
int32 queued_events;
|
||||||
uint8 *events;//the structure and size of the events depends greatly on the device and its capabilities
|
uint8 *events;//the structure and size of the events depends greatly on the device and its capabilities
|
||||||
int32 event_size;
|
int32 event_size;
|
||||||
//--------------
|
//--------------
|
||||||
uint8 STRIG_button_pressed[256];//checked and cleared by the STRIG function
|
uint8 STRIG_button_pressed[256];//checked and cleared by the STRIG function
|
||||||
//--------------
|
//--------------
|
||||||
uint8 id[1024];
|
uint8 id[1024];
|
||||||
/////SDL_Joystick *SDL_js;
|
/////SDL_Joystick *SDL_js;
|
||||||
int32 SDL_js_index;
|
int32 SDL_js_index;
|
||||||
int32 SDL_buttons;
|
int32 SDL_buttons;
|
||||||
int32 SDL_axes;
|
int32 SDL_axes;
|
||||||
int32 SDL_balls;
|
int32 SDL_balls;
|
||||||
int32 SDL_hats;
|
int32 SDL_hats;
|
||||||
};
|
};
|
||||||
#define QUEUED_EVENTS_LIMIT 1024
|
#define QUEUED_EVENTS_LIMIT 1024
|
||||||
|
|
||||||
struct mem_block{
|
struct mem_block{
|
||||||
ptrszint offset;
|
ptrszint offset;
|
||||||
ptrszint size;
|
ptrszint size;
|
||||||
int64 lock_id;//64-bit key, must be present at lock's offset or memory region is invalid
|
int64 lock_id;//64-bit key, must be present at lock's offset or memory region is invalid
|
||||||
ptrszint lock_offset;//pointer to lock
|
ptrszint lock_offset;//pointer to lock
|
||||||
int32 type;
|
int32 type;
|
||||||
/*
|
/*
|
||||||
memorytype (4 bytes, but only the first used, for flags):
|
memorytype (4 bytes, but only the first used, for flags):
|
||||||
1 integer values
|
1 integer values
|
||||||
2 unsigned (set in conjunction with integer)
|
2 unsigned (set in conjunction with integer)
|
||||||
4 floating point values
|
4 floating point values
|
||||||
8 char string(s) 'element-size is the memory size of 1 string
|
8 char string(s) 'element-size is the memory size of 1 string
|
||||||
*/
|
*/
|
||||||
ptrszint elementsize;
|
ptrszint elementsize;
|
||||||
int32 image;
|
int32 image;
|
||||||
};
|
};
|
||||||
struct mem_lock{
|
struct mem_lock{
|
||||||
uint64 id;
|
uint64 id;
|
||||||
int32 type;//required to know what action to take (if any) when a request is made to free the block
|
int32 type;//required to know what action to take (if any) when a request is made to free the block
|
||||||
//0=no security (eg. user defined block from _OFFSET)
|
//0=no security (eg. user defined block from _OFFSET)
|
||||||
//1=C-malloc'ed block
|
//1=C-malloc'ed block
|
||||||
//2=image
|
//2=image
|
||||||
//3=sub/function scope block
|
//3=sub/function scope block
|
||||||
//4=array
|
//4=array
|
||||||
//---- type specific variables follow ----
|
//---- type specific variables follow ----
|
||||||
void *offset;//used by malloc'ed blocks to free them
|
void *offset;//used by malloc'ed blocks to free them
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3484,10 +3484,6 @@ void AllocConsole(){
|
||||||
void FreeConsole(){
|
void FreeConsole(){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32 errno;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int MessageBox2(int ignore,char* message,char* title,int type){
|
int MessageBox2(int ignore,char* message,char* title,int type){
|
||||||
|
|
8
internal/source/User Mods/Luke Stuff-ID_Includes.bi
Normal file
8
internal/source/User Mods/Luke Stuff-ID_Includes.bi
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
'Get Current Working Directory
|
||||||
|
clearid
|
||||||
|
id.n = "_CWD"
|
||||||
|
id.musthave = "$"
|
||||||
|
id.subfunc = 1
|
||||||
|
id.callname = "func__cwd"
|
||||||
|
id.ret = STRINGTYPE - ISPOINTER
|
||||||
|
regid
|
|
@ -1 +1,2 @@
|
||||||
|
'$INCLUDE:'internal/source/User Mods/Luke Stuff-ID_Includes.bi'
|
||||||
'$INCLUDE:'internal/source/User Mods/Steve Stuff-ID_Includes.bi'
|
'$INCLUDE:'internal/source/User Mods/Steve Stuff-ID_Includes.bi'
|
||||||
|
|
|
@ -43,19 +43,19 @@ if(_SUB_IDEASCIIBOX_INTEGER_CURRENTONE==NULL){
|
||||||
_SUB_IDEASCIIBOX_INTEGER_CURRENTONE=(int16*)mem_static_malloc(2);
|
_SUB_IDEASCIIBOX_INTEGER_CURRENTONE=(int16*)mem_static_malloc(2);
|
||||||
*_SUB_IDEASCIIBOX_INTEGER_CURRENTONE=0;
|
*_SUB_IDEASCIIBOX_INTEGER_CURRENTONE=0;
|
||||||
}
|
}
|
||||||
int32 *_SUB_IDEASCIIBOX_LONG_X=NULL;
|
int32 *_SUB_IDEASCIIBOX_LONG_Y=NULL;
|
||||||
if(_SUB_IDEASCIIBOX_LONG_X==NULL){
|
if(_SUB_IDEASCIIBOX_LONG_Y==NULL){
|
||||||
_SUB_IDEASCIIBOX_LONG_X=(int32*)mem_static_malloc(4);
|
_SUB_IDEASCIIBOX_LONG_Y=(int32*)mem_static_malloc(4);
|
||||||
*_SUB_IDEASCIIBOX_LONG_X=0;
|
*_SUB_IDEASCIIBOX_LONG_Y=0;
|
||||||
}
|
}
|
||||||
int64 fornext_value1863;
|
int64 fornext_value1863;
|
||||||
int64 fornext_finalvalue1863;
|
int64 fornext_finalvalue1863;
|
||||||
int64 fornext_step1863;
|
int64 fornext_step1863;
|
||||||
uint8 fornext_step_negative1863;
|
uint8 fornext_step_negative1863;
|
||||||
int32 *_SUB_IDEASCIIBOX_LONG_Y=NULL;
|
int32 *_SUB_IDEASCIIBOX_LONG_X=NULL;
|
||||||
if(_SUB_IDEASCIIBOX_LONG_Y==NULL){
|
if(_SUB_IDEASCIIBOX_LONG_X==NULL){
|
||||||
_SUB_IDEASCIIBOX_LONG_Y=(int32*)mem_static_malloc(4);
|
_SUB_IDEASCIIBOX_LONG_X=(int32*)mem_static_malloc(4);
|
||||||
*_SUB_IDEASCIIBOX_LONG_Y=0;
|
*_SUB_IDEASCIIBOX_LONG_X=0;
|
||||||
}
|
}
|
||||||
int64 fornext_value1865;
|
int64 fornext_value1865;
|
||||||
int64 fornext_finalvalue1865;
|
int64 fornext_finalvalue1865;
|
||||||
|
@ -128,6 +128,11 @@ if(_SUB_IDEASCIIBOX_LONG_ATALL==NULL){
|
||||||
_SUB_IDEASCIIBOX_LONG_ATALL=(int32*)mem_static_malloc(4);
|
_SUB_IDEASCIIBOX_LONG_ATALL=(int32*)mem_static_malloc(4);
|
||||||
*_SUB_IDEASCIIBOX_LONG_ATALL=0;
|
*_SUB_IDEASCIIBOX_LONG_ATALL=0;
|
||||||
}
|
}
|
||||||
|
int32 *_SUB_IDEASCIIBOX_LONG_EX=NULL;
|
||||||
|
if(_SUB_IDEASCIIBOX_LONG_EX==NULL){
|
||||||
|
_SUB_IDEASCIIBOX_LONG_EX=(int32*)mem_static_malloc(4);
|
||||||
|
*_SUB_IDEASCIIBOX_LONG_EX=0;
|
||||||
|
}
|
||||||
int16 *_SUB_IDEASCIIBOX_INTEGER_RET=NULL;
|
int16 *_SUB_IDEASCIIBOX_INTEGER_RET=NULL;
|
||||||
if(_SUB_IDEASCIIBOX_INTEGER_RET==NULL){
|
if(_SUB_IDEASCIIBOX_INTEGER_RET==NULL){
|
||||||
_SUB_IDEASCIIBOX_INTEGER_RET=(int16*)mem_static_malloc(2);
|
_SUB_IDEASCIIBOX_INTEGER_RET=(int16*)mem_static_malloc(2);
|
||||||
|
|
70871
internal/source/main.txt
70871
internal/source/main.txt
File diff suppressed because it is too large
Load diff
Binary file not shown.
31
qb64.bas
31
qb64.bas
|
@ -11966,10 +11966,10 @@ ws = _NEWIMAGE(640, 480, 32)
|
||||||
SCREEN temp
|
SCREEN temp
|
||||||
DIM CurrentASC(1 TO 16, 1 TO 16)
|
DIM CurrentASC(1 TO 16, 1 TO 16)
|
||||||
DIM CurrentOne AS INTEGER
|
DIM CurrentOne AS INTEGER
|
||||||
CLS , _RGB(100, 0, 200)
|
CLS , _RGB(0, 0, 170)
|
||||||
COLOR , _RGB(100, 0, 200)
|
COLOR , _RGB(0, 0, 170)
|
||||||
FOR x = 1 TO 16
|
FOR y = 1 TO 16
|
||||||
FOR y = 1 TO 16
|
FOR x = 1 TO 16
|
||||||
LINE (x * 40, 0)-(x * 40, 480), _RGB32(255, 255, 0)
|
LINE (x * 40, 0)-(x * 40, 480), _RGB32(255, 255, 0)
|
||||||
LINE (0, y * 30)-(640, y * 30), _RGB32(255, 255, 0)
|
LINE (0, y * 30)-(640, y * 30), _RGB32(255, 255, 0)
|
||||||
IF counter THEN _PRINTSTRING (x * 40 - 28, y * 30 - 23), CHR$(counter)
|
IF counter THEN _PRINTSTRING (x * 40 - 28, y * 30 - 23), CHR$(counter)
|
||||||
|
@ -11978,11 +11978,11 @@ FOR x = 1 TO 16
|
||||||
NEXT
|
NEXT
|
||||||
|
|
||||||
_DEST temp1
|
_DEST temp1
|
||||||
CLS , _RGB(100, 0, 200)
|
CLS , _RGB(0, 0, 170)
|
||||||
COLOR , _RGB(100, 0, 200)
|
COLOR , _RGB(0, 0, 170)
|
||||||
counter = 0
|
counter = 0
|
||||||
FOR x = 1 TO 16
|
FOR y = 1 TO 16
|
||||||
FOR y = 1 TO 16
|
FOR x = 1 TO 16
|
||||||
LINE (x * 40, 0)-(x * 40, 480), _RGB32(255, 255, 0)
|
LINE (x * 40, 0)-(x * 40, 480), _RGB32(255, 255, 0)
|
||||||
LINE (0, y * 30)-(640, y * 30), _RGB32(255, 255, 0)
|
LINE (0, y * 30)-(640, y * 30), _RGB32(255, 255, 0)
|
||||||
text$ = LTRIM$(STR$(counter))
|
text$ = LTRIM$(STR$(counter))
|
||||||
|
@ -12003,17 +12003,17 @@ DO
|
||||||
|
|
||||||
x = _MOUSEX \ 40 + 1 'If mouse moved, where are we now?
|
x = _MOUSEX \ 40 + 1 'If mouse moved, where are we now?
|
||||||
y = _MOUSEY \ 30 + 1
|
y = _MOUSEY \ 30 + 1
|
||||||
num = (x - 1) * 16 + y - 1
|
num = (y - 1) * 16 + x - 1
|
||||||
IF num = 0 THEN
|
IF num = 0 THEN
|
||||||
text$ = ""
|
text$ = ""
|
||||||
ELSE
|
ELSE
|
||||||
flashcounter = flashcounter + 1
|
flashcounter = flashcounter + 1
|
||||||
IF flashcounter > 30 THEN
|
IF flashcounter > 30 THEN
|
||||||
COLOR _RGB32(255, 255, 255), _RGB(100, 0, 200)
|
COLOR _RGB32(255, 255, 255), _RGB(0, 0, 170)
|
||||||
text$ = CHR$(num)
|
text$ = CHR$(num)
|
||||||
IF LEN(text$) = 1 THEN text$ = " " + text$ + " "
|
IF LEN(text$) = 1 THEN text$ = " " + text$ + " "
|
||||||
ELSE
|
ELSE
|
||||||
COLOR _RGB32(255, 0, 0), _RGB(100, 0, 200)
|
COLOR _RGB32(255, 255, 255), _RGB(0, 0, 170)
|
||||||
text$ = RTRIM$(LTRIM$(STR$(num)))
|
text$ = RTRIM$(LTRIM$(STR$(num)))
|
||||||
END IF
|
END IF
|
||||||
END IF
|
END IF
|
||||||
|
@ -12043,9 +12043,16 @@ DO
|
||||||
IF y < 1 THEN y = 1
|
IF y < 1 THEN y = 1
|
||||||
IF y > 16 THEN y = 16
|
IF y > 16 THEN y = 16
|
||||||
_DISPLAY
|
_DISPLAY
|
||||||
|
Ex = _EXIT
|
||||||
|
IF Ex THEN
|
||||||
|
_AUTODISPLAY
|
||||||
|
SCREEN 0: WIDTH w, h: _DEST 0: _DELAY .2
|
||||||
|
IF _RESIZE THEN donothing = atall
|
||||||
|
EXIT FUNCTION
|
||||||
|
END IF
|
||||||
LOOP UNTIL _MOUSEBUTTON(1)
|
LOOP UNTIL _MOUSEBUTTON(1)
|
||||||
|
|
||||||
ret% = (x - 1) * 16 + y - 1
|
ret% = (y - 1) * 16 + x - 1
|
||||||
IF ret% > 0 AND ret% < 255 THEN
|
IF ret% > 0 AND ret% < 255 THEN
|
||||||
l = idecy
|
l = idecy
|
||||||
a$ = idegetline(l)
|
a$ = idegetline(l)
|
||||||
|
|
464
setup_lnx.sh
464
setup_lnx.sh
|
@ -1,232 +1,232 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#QB64 Installer -- Shell Script -- Matt Kilgore 2013
|
#QB64 Installer -- Shell Script -- Matt Kilgore 2013
|
||||||
#Version 4 -- April 4, 2013
|
#Version 4 -- April 4, 2013
|
||||||
#Compiles:
|
#Compiles:
|
||||||
# GL : .978
|
# GL : .978
|
||||||
# SDL: .954
|
# SDL: .954
|
||||||
|
|
||||||
|
|
||||||
#This checks the currently installed packages for the one's QB64 needs
|
#This checks the currently installed packages for the one's QB64 needs
|
||||||
#And runs the package manager to install them if that is the case
|
#And runs the package manager to install them if that is the case
|
||||||
pkg_install() {
|
pkg_install() {
|
||||||
#Search
|
#Search
|
||||||
packages_to_install=
|
packages_to_install=
|
||||||
for pkg in $pkg_list; do
|
for pkg in $pkg_list; do
|
||||||
if [ -z "$(echo "$installed_packages" | grep $pkg)" ]; then
|
if [ -z "$(echo "$installed_packages" | grep $pkg)" ]; then
|
||||||
packages_to_install="$packages_to_install $pkg"
|
packages_to_install="$packages_to_install $pkg"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ -n "$packages_to_install" ]; then
|
if [ -n "$packages_to_install" ]; then
|
||||||
echo "Installing required packages. If Prompted to, please enter your password"
|
echo "Installing required packages. If Prompted to, please enter your password"
|
||||||
$installer_command $packages_to_install
|
$installer_command $packages_to_install
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#Set this to 1 to make it download everything
|
#Set this to 1 to make it download everything
|
||||||
DOWNLOAD=
|
DOWNLOAD=
|
||||||
|
|
||||||
|
|
||||||
#Set this to 1 to compile SDL instead (Only works if DOWNLOAD=1)
|
#Set this to 1 to compile SDL instead (Only works if DOWNLOAD=1)
|
||||||
SDL=
|
SDL=
|
||||||
|
|
||||||
if [ "$DOWNLOAD" == "1" ]; then
|
if [ "$DOWNLOAD" == "1" ]; then
|
||||||
#Various URL's for downloads
|
#Various URL's for downloads
|
||||||
QB64_URL="http://www.qb64.net/qb64v0978-lnx.tar.gz"
|
QB64_URL="http://www.qb64.net/qb64v0978-lnx.tar.gz"
|
||||||
QB64_SDL_URL="http://www.qb64.net/qb64v0954-lnx.tar.gz"
|
QB64_SDL_URL="http://www.qb64.net/qb64v0954-lnx.tar.gz"
|
||||||
QB64_ICON_URL="http://www.qb64.net/qb64icon32.png"
|
QB64_ICON_URL="http://www.qb64.net/qb64icon32.png"
|
||||||
|
|
||||||
#Name for download QB64
|
#Name for download QB64
|
||||||
QB64_ZIP_NAME=qb64.tar.gz
|
QB64_ZIP_NAME=qb64.tar.gz
|
||||||
#Will be downloaded to current directory
|
#Will be downloaded to current directory
|
||||||
QB64_ICON_PATH="."
|
QB64_ICON_PATH="."
|
||||||
GET_WGET="wget"
|
GET_WGET="wget"
|
||||||
else
|
else
|
||||||
GET_WGET=
|
GET_WGET=
|
||||||
#Path to Icon
|
#Path to Icon
|
||||||
#Relative Path to icon -- Don't include beginning or trailing '/'
|
#Relative Path to icon -- Don't include beginning or trailing '/'
|
||||||
QB64_ICON_PATH="internal/source"
|
QB64_ICON_PATH="internal/source"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Name of the Icon picture
|
#Name of the Icon picture
|
||||||
QB64_ICON_NAME="qb64icon32.png"
|
QB64_ICON_NAME="qb64icon32.png"
|
||||||
|
|
||||||
DISTRO=
|
DISTRO=
|
||||||
|
|
||||||
if [ -f ./qb64 ] && [ "$DOWNLOAD" == "1" ]; then
|
if [ -f ./qb64 ] && [ "$DOWNLOAD" == "1" ]; then
|
||||||
echo "Removing old QB64 files in preperation for installing new version..."
|
echo "Removing old QB64 files in preperation for installing new version..."
|
||||||
rm ./qb64
|
rm ./qb64
|
||||||
rm -fr ./internal
|
rm -fr ./internal
|
||||||
echo "Done. Installing QB64 now."
|
echo "Done. Installing QB64 now."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
lsb_command=`which lsb_release 2> /dev/null`
|
lsb_command=`which lsb_release 2> /dev/null`
|
||||||
if [ -z "$lsb_command" ]; then
|
if [ -z "$lsb_command" ]; then
|
||||||
lsb_command=`which lsb_release 2> /dev/null`
|
lsb_command=`which lsb_release 2> /dev/null`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Outputs from lsb_command:
|
#Outputs from lsb_command:
|
||||||
|
|
||||||
#Arch Linux = arch
|
#Arch Linux = arch
|
||||||
#Debian = debian
|
#Debian = debian
|
||||||
#Fedora = Fedora
|
#Fedora = Fedora
|
||||||
#KUbuntu = ubuntu
|
#KUbuntu = ubuntu
|
||||||
#LUbuntu = ubuntu
|
#LUbuntu = ubuntu
|
||||||
#Linux Mint = linuxmint
|
#Linux Mint = linuxmint
|
||||||
#Ubuntu = ubuntu
|
#Ubuntu = ubuntu
|
||||||
#Slackware = slackware
|
#Slackware = slackware
|
||||||
#XUbuntu = ubuntu
|
#XUbuntu = ubuntu
|
||||||
#Zorin = Zorin
|
#Zorin = Zorin
|
||||||
if [ -n "$lsb_command" ]; then
|
if [ -n "$lsb_command" ]; then
|
||||||
DISTRO=`$lsb_command -si | tr '[:upper:]' '[:lower:]'`
|
DISTRO=`$lsb_command -si | tr '[:upper:]' '[:lower:]'`
|
||||||
elif [ -e /etc/arch-release ]; then
|
elif [ -e /etc/arch-release ]; then
|
||||||
DISTRO=arch
|
DISTRO=arch
|
||||||
elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
|
elif [ -e /etc/debian_version ] || [ -e /etc/debian_release ]; then
|
||||||
DISTRO=debian
|
DISTRO=debian
|
||||||
elif [ -e /etc/fedora-release ]; then
|
elif [ -e /etc/fedora-release ]; then
|
||||||
DISTRO=fedora
|
DISTRO=fedora
|
||||||
elif [ -e /etc/redhat-release ]; then
|
elif [ -e /etc/redhat-release ]; then
|
||||||
DISTRO=redhat
|
DISTRO=redhat
|
||||||
elif [ -e /etc/centos-release ]; then
|
elif [ -e /etc/centos-release ]; then
|
||||||
DISTRO=centos
|
DISTRO=centos
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Find and install packages
|
#Find and install packages
|
||||||
if [ "$DISTRO" == "arch" ]; then
|
if [ "$DISTRO" == "arch" ]; then
|
||||||
echo "ArchLinux detected."
|
echo "ArchLinux detected."
|
||||||
if [ "$SDL" == "1" ]; then
|
if [ "$SDL" == "1" ]; then
|
||||||
pkg_list="gcc sdl sdl_image sdl_mixer sdl_net sdl_ttf $GET_WGET"
|
pkg_list="gcc sdl sdl_image sdl_mixer sdl_net sdl_ttf $GET_WGET"
|
||||||
else
|
else
|
||||||
pkg_list="gcc $GET_WGET"
|
pkg_list="gcc $GET_WGET"
|
||||||
fi
|
fi
|
||||||
installed_packages=`pacman -Q`
|
installed_packages=`pacman -Q`
|
||||||
installer_command="sudo pacman -S "
|
installer_command="sudo pacman -S "
|
||||||
pkg_install
|
pkg_install
|
||||||
elif [ "$DISTRO" == "linuxmint" ] || [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "zorin" ]; then
|
elif [ "$DISTRO" == "linuxmint" ] || [ "$DISTRO" == "ubuntu" ] || [ "$DISTRO" == "debian" ] || [ "$DISTRO" == "zorin" ]; then
|
||||||
echo "Debian based distro detected."
|
echo "Debian based distro detected."
|
||||||
if [ "$SDL" == "1" ]; then
|
if [ "$SDL" == "1" ]; then
|
||||||
pkg_list="g++ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev $GET_WGET"
|
pkg_list="g++ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-net1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev $GET_WGET"
|
||||||
else
|
else
|
||||||
pkg_list="g++ mesa-common-dev libglu1-mesa-dev libasound2-dev $GET_WGET"
|
pkg_list="g++ mesa-common-dev libglu1-mesa-dev libasound2-dev $GET_WGET"
|
||||||
fi
|
fi
|
||||||
installed_packages=`dpkg -l`
|
installed_packages=`dpkg -l`
|
||||||
installer_command="sudo apt-get -y install "
|
installer_command="sudo apt-get -y install "
|
||||||
pkg_install
|
pkg_install
|
||||||
elif [ "$DISTRO" == "fedora" ] || [ "$DISTRO" == "redhat" ] || [ "$DISTRO" == "centos" ]; then
|
elif [ "$DISTRO" == "fedora" ] || [ "$DISTRO" == "redhat" ] || [ "$DISTRO" == "centos" ]; then
|
||||||
echo "Fedora/Redhat based distro detected."
|
echo "Fedora/Redhat based distro detected."
|
||||||
if [ "$SDL" == "1" ]; then
|
if [ "$SDL" == "1" ]; then
|
||||||
pkg_list="gcc-c++ SDL-devel SDL_image-devel SDL_mixer-devel SDL_net-devel SDL_ttf-devel $GET_WGET"
|
pkg_list="gcc-c++ SDL-devel SDL_image-devel SDL_mixer-devel SDL_net-devel SDL_ttf-devel $GET_WGET"
|
||||||
else
|
else
|
||||||
pkg_list="gcc-c++ mesa-libGLU-devel alsa-lib-devel $GET_WGET"
|
pkg_list="gcc-c++ mesa-libGLU-devel alsa-lib-devel $GET_WGET"
|
||||||
fi
|
fi
|
||||||
installed_packages=`yum list installed`
|
installed_packages=`yum list installed`
|
||||||
installer_command="sudo yum install "
|
installer_command="sudo yum install "
|
||||||
pkg_install
|
pkg_install
|
||||||
elif [ -z "$DISTRO" ]; then
|
elif [ -z "$DISTRO" ]; then
|
||||||
echo "Unable to detect distro, skipping package installation"
|
echo "Unable to detect distro, skipping package installation"
|
||||||
echo "Please be aware that for QB64 to compile, you will need the following installed:"
|
echo "Please be aware that for QB64 to compile, you will need the following installed:"
|
||||||
echo " OpenGL developement libraries"
|
echo " OpenGL developement libraries"
|
||||||
echo " ALSA development libraries"
|
echo " ALSA development libraries"
|
||||||
echo " GNU C++ Compiler (g++)"
|
echo " GNU C++ Compiler (g++)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DOWNLOAD" == "1" ]; then
|
if [ "$DOWNLOAD" == "1" ]; then
|
||||||
echo "Downloading QB64..."
|
echo "Downloading QB64..."
|
||||||
if [ "$SDL" == "1" ]; then
|
if [ "$SDL" == "1" ]; then
|
||||||
wget $QB64_SDL_URL -O $QB64_ZIP_NAME
|
wget $QB64_SDL_URL -O $QB64_ZIP_NAME
|
||||||
else
|
else
|
||||||
wget $QB64_URL -O $QB64_ZIP_NAME
|
wget $QB64_URL -O $QB64_ZIP_NAME
|
||||||
fi
|
fi
|
||||||
if [ ! -f $QB64_ICON_NAME ]; then
|
if [ ! -f $QB64_ICON_NAME ]; then
|
||||||
echo "Grabbing QB64 Icon..."
|
echo "Grabbing QB64 Icon..."
|
||||||
wget $QB64_ICON_URL
|
wget $QB64_ICON_URL
|
||||||
fi
|
fi
|
||||||
echo "Uncompressing to directory..."
|
echo "Uncompressing to directory..."
|
||||||
#strip-components=1 removes the leading ./qb64 directory from the archive
|
#strip-components=1 removes the leading ./qb64 directory from the archive
|
||||||
tar --strip-components=1 -zxvf $QB64_ZIP_NAME >/dev/null
|
tar --strip-components=1 -zxvf $QB64_ZIP_NAME >/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Compiling and installing QB64..."
|
echo "Compiling and installing QB64..."
|
||||||
if [ "$SDL" == "1" ]; then
|
if [ "$SDL" == "1" ]; then
|
||||||
|
|
||||||
### SDL Installation process
|
### SDL Installation process
|
||||||
cp ./internal/source/* ./internal/temp/
|
cp ./internal/source/* ./internal/temp/
|
||||||
cd ./internal/c
|
cd ./internal/c
|
||||||
g++ -c -w -Wall libqbx.cpp -o libqbx_lnx.o `sdl-config --cflags`
|
g++ -c -w -Wall libqbx.cpp -o libqbx_lnx.o `sdl-config --cflags`
|
||||||
g++ -w libqbx_lnx.o qbx.cpp `sdl-config --cflags --libs` -lSDL_mixer -lSDL_ttf -lSDL_net -lSDL_image -lX11 -o ../../qb64
|
g++ -w libqbx_lnx.o qbx.cpp `sdl-config --cflags --libs` -lSDL_mixer -lSDL_ttf -lSDL_net -lSDL_image -lX11 -o ../../qb64
|
||||||
cd ../..
|
cd ../..
|
||||||
else
|
else
|
||||||
|
|
||||||
### GL installation process
|
### GL installation process
|
||||||
find . -name "*.sh" -exec chmod +x {} \;
|
find . -name "*.sh" -exec chmod +x {} \;
|
||||||
find . -type f -iname "*.a" -exec rm -f {} \;
|
find . -type f -iname "*.a" -exec rm -f {} \;
|
||||||
find . -type f -iname "*.o" -exec rm -f {} \;
|
find . -type f -iname "*.o" -exec rm -f {} \;
|
||||||
rm ./internal/temp/*
|
rm ./internal/temp/*
|
||||||
|
|
||||||
echo "Building library 'LibQB'"
|
echo "Building library 'LibQB'"
|
||||||
cd internal/c/libqb/os/lnx
|
cd internal/c/libqb/os/lnx
|
||||||
rm -f libqb_setup.o
|
rm -f libqb_setup.o
|
||||||
./setup_build.sh
|
./setup_build.sh
|
||||||
cd ../../../../..
|
cd ../../../../..
|
||||||
|
|
||||||
echo "Building library 'FreeType'"
|
echo "Building library 'FreeType'"
|
||||||
cd internal/c/parts/video/font/ttf/os/lnx
|
cd internal/c/parts/video/font/ttf/os/lnx
|
||||||
rm -f src.o
|
rm -f src.o
|
||||||
./setup_build.sh
|
./setup_build.sh
|
||||||
cd ../../../../../../../..
|
cd ../../../../../../../..
|
||||||
|
|
||||||
echo "Building library 'Core:FreeGLUT'"
|
echo "Building library 'Core:FreeGLUT'"
|
||||||
cd internal/c/parts/core/os/lnx
|
cd internal/c/parts/core/os/lnx
|
||||||
rm -f src.a
|
rm -f src.a
|
||||||
./setup_build.sh
|
./setup_build.sh
|
||||||
cd ../../../../../..
|
cd ../../../../../..
|
||||||
|
|
||||||
echo "Building 'QB64'"
|
echo "Building 'QB64'"
|
||||||
cp -r ./internal/source/* ./internal/temp/
|
cp -r ./internal/source/* ./internal/temp/
|
||||||
cd internal/c
|
cd internal/c
|
||||||
g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
|
g++ -w qbx.cpp libqb/os/lnx/libqb_setup.o parts/video/font/ttf/os/lnx/src.o parts/core/os/lnx/src.a -lGL -lGLU -lX11 -lpthread -ldl -lrt -D FREEGLUT_STATIC -o ../../qb64
|
||||||
cd ../..
|
cd ../..
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -e "./qb64" ]; then
|
if [ -e "./qb64" ]; then
|
||||||
echo "Done compiling!!"
|
echo "Done compiling!!"
|
||||||
|
|
||||||
echo "Creating ./run_qb64.sh script..."
|
echo "Creating ./run_qb64.sh script..."
|
||||||
_pwd=`pwd`
|
_pwd=`pwd`
|
||||||
echo "#!/bin/sh" > ./run_qb64.sh
|
echo "#!/bin/sh" > ./run_qb64.sh
|
||||||
echo "cd $_pwd" >> ./run_qb64.sh
|
echo "cd $_pwd" >> ./run_qb64.sh
|
||||||
echo "./qb64 &" >> ./run_qb64.sh
|
echo "./qb64 &" >> ./run_qb64.sh
|
||||||
|
|
||||||
chmod +x ./run_qb64.sh
|
chmod +x ./run_qb64.sh
|
||||||
#chmod -R 777 ./
|
#chmod -R 777 ./
|
||||||
echo "Adding QB64 menu entry..."
|
echo "Adding QB64 menu entry..."
|
||||||
cat > ~/.local/share/applications/qb64.desktop <<EOF
|
cat > ~/.local/share/applications/qb64.desktop <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Name=QB64 Programming IDE
|
Name=QB64 Programming IDE
|
||||||
GenericName=QB64 Programming IDE
|
GenericName=QB64 Programming IDE
|
||||||
Exec=$_pwd/run_qb64.sh
|
Exec=$_pwd/run_qb64.sh
|
||||||
Icon=$_pwd/$QB64_ICON_PATH/$QB64_ICON_NAME
|
Icon=$_pwd/$QB64_ICON_PATH/$QB64_ICON_NAME
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Development;IDE;
|
Categories=Development;IDE;
|
||||||
Path=$_pwd
|
Path=$_pwd
|
||||||
StartupNotify=false
|
StartupNotify=false
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "Running QB64..."
|
echo "Running QB64..."
|
||||||
./qb64 &
|
./qb64 &
|
||||||
echo "QB64 is located in this folder:"
|
echo "QB64 is located in this folder:"
|
||||||
echo "`pwd`"
|
echo "`pwd`"
|
||||||
echo "There is a ./run_qb64.sh script in this folder that should let you run qb64 if using the executable directly isn't working."
|
echo "There is a ./run_qb64.sh script in this folder that should let you run qb64 if using the executable directly isn't working."
|
||||||
echo
|
echo
|
||||||
echo "You should also find a QB64 option in the Programming/Development section of your menu you can use."
|
echo "You should also find a QB64 option in the Programming/Development section of your menu you can use."
|
||||||
else
|
else
|
||||||
### QB64 didn't compile
|
### QB64 didn't compile
|
||||||
echo "It appears that the qb64 executable file was not created, this is usually an indication of a compile failure (You probably saw lots of error messages pop up on the screen)"
|
echo "It appears that the qb64 executable file was not created, this is usually an indication of a compile failure (You probably saw lots of error messages pop up on the screen)"
|
||||||
echo "Usually these are due to missing packages needed for compilation. If you're not running a distro supported by this compiler, please note you will need to install the packages listed above."
|
echo "Usually these are due to missing packages needed for compilation. If you're not running a distro supported by this compiler, please note you will need to install the packages listed above."
|
||||||
echo "If you need help, please feel free to post on the QB64 Forums detailing what happened and what distro you are using."
|
echo "If you need help, please feel free to post on the QB64 Forums detailing what happened and what distro you are using."
|
||||||
echo "Also, please tell them the exact contents of this next line:"
|
echo "Also, please tell them the exact contents of this next line:"
|
||||||
echo "DISTRO: $DISTRO"
|
echo "DISTRO: $DISTRO"
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
echo "Thank you for using the QB64 installer."
|
echo "Thank you for using the QB64 installer."
|
||||||
|
|
Loading…
Reference in a new issue