1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-02 03:50:36 +00:00

Merge branch 'development'

This commit is contained in:
Luke Ceddia 2018-02-02 16:40:36 +11:00
commit e3aec0c97a
16 changed files with 395 additions and 4699 deletions

View file

@ -0,0 +1,7 @@
mv setup_win.bat internal\
$filename = "qb64_" + (get-date -uformat "%Y-%m-%d-%H-%M-%S") + "_" + $Env:APPVEYOR_REPO_COMMIT.Substring(0,7) + "-" + $Env:APPVEYOR_REPO_BRANCH + "_win.7z"
cd ..
qb64\internal\c\c_compiler\7z\7za.exe a '-xr@qb64\.travis\common-exclusion.list' '-xr@qb64\.travis\win-exclusion.list' $filename qb64
scp -q -o StrictHostKeyChecking=no $filename m6rosupy1q2t@qb64.org:autobuilds/$Env:APPVEYOR_REPO_BRANCH/

58
.travis/appveyor.bat Normal file
View file

@ -0,0 +1,58 @@
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
del /q /s internal\c\libqb\*.o >nul 2>nul
del /q /s internal\c\libqb\*.a >nul 2>nul
del /q /s internal\c\parts\*.o >nul 2>nul
del /q /s internal\c\parts\*.a >nul 2>nul
del /q /s internal\temp\*.* >nul 2>nul
cd internal\c\c_compiler
echo Extracting C++ compiler
7z\7za.exe x -y c_compiler.7z >nul
cd ..\..\..
echo Building library 'LibQB'
cd internal\c\libqb\os\win
call setup_build.bat
IF ERRORLEVEL 1 exit /b 1
cd ..\..\..\..\..
echo Building library 'FreeType'
cd internal\c\parts\video\font\ttf\os\win
call setup_build.bat
IF ERRORLEVEL 1 exit /b 1
cd ..\..\..\..\..\..\..\..
echo Building library 'Core:FreeGLUT'
cd internal\c\parts\core\os\win
call setup_build.bat
IF ERRORLEVEL 1 exit /b 1
cd ..\..\..\..\..\..
echo Bootstrapping QB64
copy internal\source\*.* internal\temp\ >nul
copy source\qb64.ico internal\temp\ >nul
copy source\icon.rc internal\temp\ >nul
cd internal\c
c_compiler\bin\windres.exe -i ..\temp\icon.rc -o ..\temp\icon.o
c_compiler\bin\g++ -mconsole -s -Wfatal-errors -w -Wall qbx.cpp libqb\os\win\libqb_setup.o ..\temp\icon.o -D DEPENDENCY_LOADFONT parts\video\font\ttf\os\win\src.o -D DEPENDENCY_SOCKETS -D DEPENDENCY_NO_PRINTER -D DEPENDENCY_ICON -D DEPENDENCY_NO_SCREENIMAGE parts\core\os\win\src.a -lopengl32 -lglu32 -mwindows -static-libgcc -static-libstdc++ -D GLEW_STATIC -D FREEGLUT_STATIC -lws2_32 -lwinmm -lgdi32 -o "..\..\qb64_bootstrap.exe"
IF ERRORLEVEL 1 exit /b 1
cd ..\..
echo Compiling new QB64
echo AutoBuildMsg$ = CHR$(10) + "From git %APPVEYOR_REPO_COMMIT:~0,7%" >> source\global\version.bas
qb64_bootstrap.exe -x source\qb64.bas -o qb64.exe
IF ERRORLEVEL 1 exit /b 1
del qb64_bootstrap.exe
del /q /s secure-file
del /q /s internal\source\*
move internal\temp\* internal\source\
del /q /s internal\c\libqb\*.o >nul 2>nul
del /q /s internal\c\libqb\*.a >nul 2>nul
del /q /s internal\c\parts\*.o >nul 2>nul
del /q /s internal\c\parts\*.a >nul 2>nul
cd internal\source
del /q /s debug_* recompile_*

View file

@ -1,5 +1,8 @@
.travis
.travis.yml
appveyor.yml
.git
.gitignore
qb64/internal/c/c_compiler/c_compiler.7z
qb64/internal/c/c_compiler/7z

View file

@ -1,5 +1,7 @@
#!/bin/sh
if [ "$TRAVIS_OS_NAME" != "linux" ]; then exit; fi
# Prepare archives
# mainversion=`awk '$1=="Version$" {split($3, A, /\"/);print A[2];}' < source/global/version.bas`
# buildnum=`awk '$1=="BuildNum$" {split($3,A, /[\"\/]/); print A[3];}' < source/global/version.bas`
@ -10,9 +12,15 @@ rm -r .dpl
cd ..
tar --create --auto-compress --file ${filebase}_osx.tar.gz --exclude-from=qb64/.travis/common-exclusion.list --exclude-from=qb64/.travis/osx-exclusion.list qb64
tar --create --auto-compress --file ${filebase}_lnx.tar.gz --exclude-from=qb64/.travis/common-exclusion.list --exclude-from=qb64/.travis/lnx-exclusion.list qb64
7z a -xr@qb64/.travis/common-exclusion.list -xr@qb64/.travis/win-exclusion.list ${filebase}_win.7z qb64/ > /dev/null
#7z a -xr@qb64/.travis/common-exclusion.list -xr@qb64/.travis/win-exclusion.list ${filebase}_win.7z qb64/ > /dev/null
# Send to server
scp ${filebase}_* m6rosupy1q2t@qb64.org:autobuilds/${TRAVIS_BRANCH}/
# Sometimes the connection can be a bit flakey, so try multiple times on error
for i in `seq 1 10`
do scp ${filebase}_* m6rosupy1q2t@qb64.org:autobuilds/${TRAVIS_BRANCH}/
if [ "$?" -eq 0 ]
then exit 0
fi
echo scp failed
done

BIN
.travis/qb64.org_rsa.enc Normal file

Binary file not shown.

View file

@ -1,3 +1,4 @@
setup_lnx.sh
setup_osx.command
qb64_start_osx.command
secure-file

14
appveyor.yml Normal file
View file

@ -0,0 +1,14 @@
version: 1.2.{build}
image: Visual Studio 2017
clone_depth: 1
environment:
sshkey:
secure: BiD9D+ye4Q+R8yBsThsfG0K+SFL5gRx6gNfxxSTR8ge3lp98cwZ3y7T3bq7tmgE7
build_script:
- cmd: .travis\appveyor.bat
install:
- nuget install secure-file -ExcludeVersion
- cmd: secure-file\tools\secure-file -decrypt .travis\qb64.org_rsa.enc -secret %sshkey% -out %userprofile%\.ssh\id_rsa
deploy_script:
- ps: .travis\appveyor-deploy.ps1
test: off

View file

@ -22,23 +22,16 @@
#define QB64_GL1
#define QB64_GLUT
#ifdef QB64_LINUX
#ifndef QB64_MACOSX
#define QB64_X11
#endif
#endif
#ifdef DEPENDENCY_CONSOLE_ONLY
#undef QB64_GLUT
#else
#define QB64_GUI
#endif
#define NO_S_D_L
//core
#ifdef QB64_GUI
#ifdef QB64_GLUT
//This file only contains header stuff
#include "parts/core/src.c"
#endif
#endif
@ -51,7 +44,6 @@
#define int64 __int64
#endif
//#include <Shlobj.h>
#include <shfolder.h>
#include <float.h>
@ -132,33 +124,6 @@ struct qbs{
qbs_field *field;
};
//substitute functionality
#ifdef QB64_WINDOWS
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
Sleep(milliseconds);
}
#else
inline void SDL_Delay(uint32 milliseconds){//redefine SDL_Delay to call Sleep
static uint64 sec,nsec;
sec=milliseconds/1000;
nsec=(milliseconds%1000)*1000000;
static timespec ts;
ts.tv_sec = sec;
ts.tv_nsec = nsec;
nanosleep (&ts, NULL);
}
inline void Sleep(uint32 milliseconds){
SDL_Delay(milliseconds);
}
inline uint32 _lrotl(uint32 word,uint32 shift){
return (word << shift) | (word >> (32 - shift));
}
inline void ZeroMemory(void *ptr,int64 bytes){
memset(ptr,0,bytes);
}
#endif
struct img_struct{
void *lock_offset;
int64 lock_id;
@ -205,125 +170,6 @@ struct img_struct{
#define IMG_SCREEN 2 //img is linked to other screen pages
#define IMG_FREEMEM 4 //if set, it means memory must be freed
#ifdef QB64_NOT_X86
inline int64 qbr(long double f){
int64 i; int temp=0;
if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
if (f<0) i=f-0.5f; else i=f+0.5f;
if (temp) return i|0x8000000000000000;//+9223372036854775808;
return i;
}
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_double_to_long(double f){if (f<0) return(f-0.5f); else return(f+0.5f);}
#else
//QBASIC compatible rounding via FPU:
#ifdef QB64_MICROSOFT
inline int64 qbr(long double f){
int64 i; int temp=0;
if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
__asm{
fld f
fistp i
}
if (temp) return i|0x8000000000000000;//+9223372036854775808;
return i;
}
inline uint64 qbr_longdouble_to_uint64(long double f){
uint64 i;
__asm{
fld f
fistp i
}
return i;
}
inline int32 qbr_float_to_long(float f){
int32 i;
__asm{
fld f
fistp i
}
return i;
}
inline int32 qbr_double_to_long(double f){
int32 i;
__asm{
fld f
fistp i
}
return i;
}
#else
//FLDS=load single
//FLDL=load double
//FLDT=load long double
inline int64 qbr(long double f){
int64 i; int temp=0;
if (f>9223372036854775807) {temp=1;f=f-9223372036854775808u;} //if it's too large for a signed int64, make it an unsigned int64 and return that value if possible.
__asm__ (
"fldt %1;"
"fistpll %0;"
:"=m" (i)
:"m" (f)
);
if (temp) return i|0x8000000000000000;// if it's an unsigned int64, manually set the bit flag
return i;
}
inline uint64 qbr_longdouble_to_uint64(long double f){
uint64 i;
__asm__ (
"fldt %1;"
"fistpll %0;"
:"=m" (i)
:"m" (f)
);
return i;
}
inline int32 qbr_float_to_long(float f){
int32 i;
__asm__ (
"flds %1;"
"fistpl %0;"
:"=m" (i)
:"m" (f)
);
return i;
}
inline int32 qbr_double_to_long(double f){
int32 i;
__asm__ (
"fldl %1;"
"fistpl %0;"
:"=m" (i)
:"m" (f)
);
return i;
}
#endif
#endif //x86 support
//bit-array access functions (note: used to be included through 'bit.cpp')
static int64 bmask;
static uint64 *bptr64;
static int64 bval64;
inline uint64 getubits(uint32 bsize,uint8 *base,ptrszint i){
bmask=~(-(((int64)1)<<bsize));
i*=bsize;
return ((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
}
inline int64 getbits(uint32 bsize,uint8 *base,ptrszint i){
bmask=~(-(((int64)1)<<bsize));
i*=bsize;
bval64=((*(uint64*)(base+(i>>3)))>>(i&7))&bmask;
if (bval64&(((int64)1)<<(bsize-1))) return bval64|(~bmask);
return bval64;
}
inline void setbits(uint32 bsize,uint8 *base,ptrszint i,int64 val){
bmask=(((uint64)1)<<bsize)-1;
i*=bsize;
bptr64=(uint64*)(base+(i>>3));
*bptr64=(*bptr64&( ( (bmask<<(i&7)) ^-1) )) | ((val&bmask)<<(i&7));
}
//QB64 internal variable type flags (internally referenced by some C functions)
#define ISSTRING 1073741824
@ -409,17 +255,6 @@ struct device_struct{
#define DEVICETYPE_KEYBOARD 2
#define DEVICETYPE_MOUSE 3
struct mem_block{
ptrszint offset;
ptrszint size;

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
#ifndef INC_LIBQB_H
#define INC_LIBQB_H
#include "common.cpp"
#include "common.h"
void error(int32 error_number);
extern uint32 new_error;

View file

@ -1,11 +1,14 @@
/* Provide some OS/compiler macros. Note that a Mac has QB64_LINUX too
/* Provide some OS/compiler macros.
* QB64_WINDOWS: Is this a Windows system?
* QB64_LINUX: Is this a Linux system?
* QB64_MACOSX: Is this MacOSX, or MacOS or whatever Apple calls it now?
* QB64_UNIX: Is this a Unix-flavoured system?
*
* QB64_BACKSLASH_FILESYSTEM: Does this system use \ for file paths (as opposed to /)?
* QB64_MICROSOFT: Are we compiling with Visual Studio?
* QB64_GCC: Are we compiling with gcc?
* QB64_MINGW: Are we compiling with MinGW, specifically? (Set in addition to QB64_GCC)
* QB64_LINUX: Is this a Unix system? (really should be QB64_UNIX)
* QB64_MACOSX: Is this MacOSX, or MacOS or whatever Apple calls it now?
*
* QB64_32: A 32bit system (the default)
* QB64_64: A 64bit system (assumes all Macs are 64 bit)
*/
@ -13,18 +16,22 @@
#define QB64_WINDOWS
#define QB64_BACKSLASH_FILESYSTEM
#ifdef _MSC_VER
//Do we even support non-mingw compilers on Windows?
//Do we even support non-mingw compilers on Windows?
#define QB64_MICROSOFT
#else
#define QB64_GCC
#define QB64_MINGW
#endif
#else
#define QB64_LINUX
#elif defined(__APPLE__)
#define QB64_MACOSX
#define QB64_UNIX
#define QB64_GCC
#ifdef __APPLE__
#define QB64_MACOSX
#endif
#elif defined(__linux__)
#define QB64_LINUX
#define QB64_UNIX
#define QB64_GCC
#else
#error "Unknown system; refusing to build. Edit os.h if needed"
#endif
#if defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined(QB64_MACOSX)

View file

@ -2,12 +2,6 @@
#include "glew/include/GL/glew.h"
#endif
#ifdef QB64_ANDROID
#include <EGL/egl.h>
#include <GLES/gl.h>
#include <GLES/glext.h>
#endif
#ifdef QB64_MACOSX
//note: MacOSX uses Apple's GLUT not FreeGLUT
#include <OpenGL/gl.h>
@ -16,14 +10,5 @@
#include <GLUT/glut.h>
#else
#define CORE_FREEGLUT
#ifdef QB64_ANDROID
#include "android_core/include/GL/freeglut.h"
#include "glues/src/glues.h"
#else
#ifdef QB64_BACKSLASH_FILESYSTEM
#include "src\\freeglut.h"
#else
#include "src/freeglut.h"
#endif
#endif
#include "src/freeglut.h"
#endif

View file

@ -105,29 +105,6 @@ if (isHardware){
}
return i;
#ifndef NO_S_D_L
static qbs *tqbs=NULL,*nullt=NULL;
static int32 i;
if (new_error) return 0;
//validate bpp
if (passed){
if ((bpp!=32)&&(bpp!=256)){error(5); return 0;}
}else{
if (write_page->text){error(5); return 0;}
bpp=-1;
}
if (!f->len) return -1;//return invalid handle if null length string
if (!tqbs) tqbs=qbs_new(0,0);
if (!nullt){nullt=qbs_new(1,0); nullt->chr[0]=0;}
qbs_set(tqbs,qbs_add(f,nullt));
i=imgload(fixdir(tqbs),bpp);
if (!i) return -1;//failed
return -i;
return -1;
#endif //NO_S_D_L
}
#endif

View file

@ -1,4 +1,4 @@
#include "common.cpp"
#include "common.h"
#ifdef QB64_MACOSX
#include <ApplicationServices/ApplicationServices.h>
@ -604,8 +604,18 @@ extern uint64 string2ui64(qbs*str);
extern float string2s(qbs*str);
extern double string2d(qbs*str);
extern long double string2f(qbs*str);
#ifndef QB64_WINDOWS
extern void Sleep(uint32 milliseconds);
extern void ZeroMemory(void *ptr,int64 bytes);
#endif
extern int64 qbr(long double f);
extern uint64 qbr_longdouble_to_uint64(long double f);
extern int32 qbr_float_to_long(float f);
extern int32 qbr_double_to_long(double f);
extern uint64 getubits(uint32 bsize,uint8 *base,ptrszint i);
extern int64 getbits(uint32 bsize,uint8 *base,ptrszint i);
extern void setbits(uint32 bsize,uint8 *base,ptrszint i,int64 val);
@ -1011,7 +1021,6 @@ sub_close(NULL,NULL);//closes all open files
//free images
freeallimages();
//stop & free sounds (note: QB also stops any sound from the PLAY command)
//NO_S_D_L//sndcloseall();
//invalidate RETURN location(s)
next_return_point=0;
//reset error goto location to 'unhandled'

View file

@ -4,5 +4,5 @@ DIM SHARED AutoBuildMsg AS STRING
Version$ = "1.2"
'BuildNum format is YYYYMMDD/id, where id is a ever-increasing
'integer. If you make a change, update the date and increase the id!
BuildNum$ = "20180102/84"
BuildNum$ = "20180202/85"

View file

@ -9515,7 +9515,6 @@ DO
IF a3$ = "" THEN a3$ = a2$ ELSE a3$ = a3$ + sp + a2$
NEXT
PRINT #12, "skip" + u$ + ":"
PRINT #12, "revert_input_check();"
IF stringprocessinghappened THEN PRINT #12, cleanupstringprocessingcall$ + "0);"
layoutdone = 1: IF LEN(layout$) THEN layout$ = layout$ + sp + l$ ELSE layout$ = l$
GOTO finishedline
@ -10798,7 +10797,9 @@ DO
END IF
x = lhscontrollevel: IF controllevel < lhscontrollevel THEN x = controllevel
IF definingtype = 2 THEN x = x + 1
IF definingtype > 0 THEN definingtype = 2
IF declaringlibrary = 2 THEN x = x + 1
IF declaringlibrary > 0 THEN declaringlibrary = 2
layout$ = SPACE$(x) + layout$
IF linecontinuation THEN layout$ = ""
@ -12669,7 +12670,7 @@ FOR i = 1 TO _COMMANDCOUNT
token$ = COMMAND$(i)
IF LCASE$(token$) = "-help" OR LCASE$(token$) = "/help" THEN token$ = "-?"
SELECT CASE LCASE$(LEFT$(token$, 2))
CASE "-?", "/?" 'Command-line help
CASE "-?" 'Command-line help
_DEST _CONSOLE
PRINT "QB64 COMPILER V" + Version$
PRINT
@ -12690,7 +12691,7 @@ FOR i = 1 TO _COMMANDCOUNT
PRINT " -l:<line number> Starts the IDE at the specified line number"
PRINT
SYSTEM
CASE "-p", "/p" 'Purge
CASE "-p" 'Purge
IF os$ = "WIN" THEN
CHDIR "internal\c"
SHELL _HIDE "cmd /c purge_all_precompiled_content_win.bat"
@ -12706,7 +12707,7 @@ FOR i = 1 TO _COMMANDCOUNT
END IF
CHDIR "../.."
END IF
CASE "-s", "/s" 'Settings
CASE "-s" 'Settings
_DEST _CONSOLE
PRINT "QB64 COMPILER V" + Version$
SELECT CASE LCASE$(MID$(token$, 3))
@ -12782,20 +12783,20 @@ FOR i = 1 TO _COMMANDCOUNT
PRINT " -s:exewithsource=true/false (Save .EXE in the source folder)"
SYSTEM
END SELECT
CASE "-e", "/e" 'Option Explicit
CASE "-e" 'Option Explicit
optionexplicit_cmd = -1
CASE "-z", "/z" 'Not compiling C code
CASE "-z" 'Not compiling C code
No_C_Compile_Mode = 1
ConsoleMode = 1 'Implies -x
NoIDEMode = 1 'Implies -c
CASE "-x", "/x" 'Use the console
CASE "-x" 'Use the console
ConsoleMode = 1
NoIDEMode = 1 'Implies -c
CASE "-c", "/c" 'Compile instead of edit
CASE "-c" 'Compile instead of edit
NoIDEMode = 1
CASE "-o", "/o" 'Specify an output file
CASE "-o" 'Specify an output file
IF LEN(COMMAND$(i + 1)) > 0 THEN outputfile_cmd$ = COMMAND$(i + 1): i = i + 1
CASE "-l", "/l" 'goto line (ide mode only); -l:<line number>
CASE "-l" 'goto line (ide mode only); -l:<line number>
IF MID$(token$, 3, 1) = ":" THEN ideStartAtLine = VAL(MID$(token$, 4))
CASE ELSE 'Something we don't recognise, assume it's a filename
IF PassedFileName$ = "" THEN PassedFileName$ = token$
@ -21865,25 +21866,6 @@ END FUNCTION
SUB xend
'1. locate bottomline,1
'PRINT #12, "display_page->cursor_y=print_holding_cursor=0; qbg_cursor_x=1; qbg_cursor_y=qbg_height_in_characters;"
'2. print a message in the screen's width
'PRINT #12, "if (qbg_width_in_characters==80){"
'PRINT #12, "qbs_print(qbs_new_txt(" + CHR$(34) + "Press any key to continue" + SPACE$(80 - 25) + CHR$(34) + "),0);"
'PRINT #12, "}else{"
'PRINT #12, "qbs_print(qbs_new_txt(" + CHR$(34) + "Press any key to continue" + SPACE$(40 - 25) + CHR$(34) + "),0);"
'PRINT #12, "}"
'3. wait for a key to be pressed
'PRINT #12, "do{"
'PRINT #12, "SDL_Delay(0);"
'PRINT #12, "if (stop_program) end();"
'PRINT #12, "}while(qbs_cleanup(qbs_tmp_base,qbs_equal(qbs_inkey(),
' qbs_new_txt(" + CHR$(34) + CHR$(34) + "))));"
'4. quit
'PRINT #12, "close_program=1;"
'PRINT #12, "end();"
PRINT #12, "sub_end();"
END SUB