2022-10-04 21:03:44 +00:00
|
|
|
#include "audio.h"
|
2023-03-18 20:58:05 +00:00
|
|
|
#include "common.h"
|
|
|
|
#include "compression.h"
|
|
|
|
#include "datetime.h"
|
2023-01-08 07:41:54 +00:00
|
|
|
#include "event.h"
|
2023-12-09 19:46:29 +00:00
|
|
|
#include "extended_math.h"
|
|
|
|
#include "filepath.h"
|
|
|
|
#include "filesystem.h"
|
2023-04-04 12:21:17 +00:00
|
|
|
#include "font.h"
|
2023-03-18 20:58:05 +00:00
|
|
|
#include "gui.h"
|
|
|
|
#include "image.h"
|
2023-01-08 07:41:54 +00:00
|
|
|
#include "rounding.h"
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 func__cinp(int32 toggle,
|
|
|
|
int32 passed); // Console INP scan code reader
|
2020-01-02 22:55:58 +00:00
|
|
|
extern int func__capslock();
|
|
|
|
extern int func__scrolllock();
|
|
|
|
extern int func__numlock();
|
|
|
|
extern void sub__capslock(int32 options);
|
|
|
|
extern void sub__scrolllock(int32 options);
|
|
|
|
extern void sub__numlock(int32 options);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__consolefont(qbs *FontName, int FontSize);
|
2020-01-02 22:55:58 +00:00
|
|
|
extern void sub__console_cursor(int32 visible, int32 cursorsize, int32 passed);
|
|
|
|
extern int32 func__getconsoleinput();
|
2021-01-17 12:54:15 +00:00
|
|
|
|
2021-07-22 03:18:34 +00:00
|
|
|
extern void unlockvWatchHandle();
|
|
|
|
extern int32 vWatchHandle();
|
|
|
|
|
2015-08-02 12:12:44 +00:00
|
|
|
#ifdef QB64_MACOSX
|
2022-05-06 04:00:36 +00:00
|
|
|
#include <ApplicationServices/ApplicationServices.h>
|
2015-08-02 12:12:44 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* testing only
|
2018-06-30 15:16:59 +00:00
|
|
|
#ifdef QB64_WINDOWS
|
2022-05-06 04:00:36 +00:00
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
HWND FindMyTopMostWindow()
|
|
|
|
{
|
2015-08-02 12:12:44 +00:00
|
|
|
DWORD dwProcID = GetCurrentProcessId();
|
|
|
|
HWND hWnd = GetTopWindow(GetDesktopWindow());
|
|
|
|
while(hWnd)
|
|
|
|
{
|
2018-06-30 15:16:59 +00:00
|
|
|
DWORD dwWndProcID = 0;
|
|
|
|
GetWindowThreadProcessId(hWnd, &dwWndProcID);
|
|
|
|
if(dwWndProcID == dwProcID)
|
2022-05-06 04:00:36 +00:00
|
|
|
return hWnd;
|
2018-06-30 15:16:59 +00:00
|
|
|
hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
void SetMidiVolume(int32 vol){
|
|
|
|
//DWORD vol = MAKELONG(((volume*65535L)/100), ((volume*65535L)/100));
|
|
|
|
MIDIOUTCAPS midiCaps;
|
|
|
|
midiOutGetDevCaps(0, &midiCaps, sizeof(midiCaps));
|
|
|
|
if (midiCaps.dwSupport & MIDICAPS_VOLUME)
|
2022-05-06 04:00:36 +00:00
|
|
|
midiOutSetVolume(0, vol);
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
#endif
|
2015-08-02 12:12:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
extern int32 sub_gl_called;
|
|
|
|
|
|
|
|
#ifdef QB64_GUI
|
2022-05-06 04:00:36 +00:00
|
|
|
#ifdef DEPENDENCY_GL
|
|
|
|
|
|
|
|
#include "parts/core/gl_header_for_parsing/temp/gl_helper_code.h"
|
|
|
|
|
|
|
|
double pi_as_double = 3.14159265358979;
|
|
|
|
void gluPerspective(double fovy, double aspect, double zNear, double zFar) {
|
|
|
|
double xmin, xmax, ymin, ymax;
|
2023-10-07 06:05:13 +00:00
|
|
|
ymax = zNear * std::tan(fovy * pi_as_double / 360.0);
|
2022-05-06 04:00:36 +00:00
|
|
|
ymin = -ymax;
|
|
|
|
xmin = ymin * aspect;
|
|
|
|
xmax = ymax * aspect;
|
|
|
|
glFrustum(xmin, xmax, ymin, ymax, zNear, zFar);
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// forward references
|
2015-08-02 12:12:44 +00:00
|
|
|
void QBMAIN(void *);
|
2022-11-23 04:36:45 +00:00
|
|
|
void TIMERTHREAD(void *);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2015-10-30 12:18:44 +00:00
|
|
|
extern int32 requestedKeyboardOverlayImage;
|
2022-05-06 04:00:36 +00:00
|
|
|
void requestKeyboardOverlayImage(int32 handle) {
|
|
|
|
requestedKeyboardOverlayImage = handle;
|
2015-10-30 12:18:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// extern functions
|
2015-10-30 12:18:44 +00:00
|
|
|
|
|
|
|
extern int32 func__scaledwidth();
|
|
|
|
extern int32 func__scaledheight();
|
|
|
|
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__fps(double fps, int32 passed);
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__resize(int32 on_off, int32 stretch_smooth);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__resize();
|
|
|
|
extern int32 func__resizewidth();
|
|
|
|
extern int32 func__resizeheight();
|
|
|
|
|
|
|
|
extern void sub__title(qbs *title);
|
2018-06-28 02:51:09 +00:00
|
|
|
extern void sub__echo(qbs *message);
|
2020-01-01 21:20:30 +00:00
|
|
|
extern void sub__assert(int32 expression, qbs *assert_message, int32 passed);
|
2018-07-31 13:24:52 +00:00
|
|
|
extern void sub__finishdrop();
|
2018-08-01 01:23:34 +00:00
|
|
|
extern int32 func__filedrop();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__filedrop(int32 on_off = NULL);
|
2018-07-31 03:23:36 +00:00
|
|
|
extern int32 func__totaldroppedfiles();
|
2018-07-31 13:24:52 +00:00
|
|
|
extern qbs *func__droppedfile(int32 fileIndex, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2023-12-13 23:30:03 +00:00
|
|
|
extern qbs *func__embedded(qbs *handle);
|
|
|
|
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__glrender(int32 method);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__displayorder(int32 method1, int32 method2, int32 method3,
|
|
|
|
int32 method4);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern int64 GetTicks();
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 func__memexists(void *blk);
|
|
|
|
extern void sub__memfill(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
ptrszint soff, ptrszint sbytes);
|
|
|
|
extern void sub__memfill_nochecks(ptrszint doff, ptrszint dbytes, ptrszint soff,
|
|
|
|
ptrszint sbytes);
|
|
|
|
extern void sub__memfill_1(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
int8 val);
|
|
|
|
extern void sub__memfill_nochecks_1(ptrszint doff, ptrszint dbytes, int8 val);
|
|
|
|
extern void sub__memfill_2(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
int16 val);
|
|
|
|
extern void sub__memfill_nochecks_2(ptrszint doff, ptrszint dbytes, int16 val);
|
|
|
|
extern void sub__memfill_4(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
int32 val);
|
|
|
|
extern void sub__memfill_nochecks_4(ptrszint doff, ptrszint dbytes, int32 val);
|
|
|
|
extern void sub__memfill_8(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
int64 val);
|
|
|
|
extern void sub__memfill_nochecks_8(ptrszint doff, ptrszint dbytes, int64 val);
|
|
|
|
extern void sub__memfill_SINGLE(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
float val);
|
|
|
|
extern void sub__memfill_nochecks_SINGLE(ptrszint doff, ptrszint dbytes,
|
|
|
|
float val);
|
|
|
|
extern void sub__memfill_DOUBLE(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
double val);
|
|
|
|
extern void sub__memfill_nochecks_DOUBLE(ptrszint doff, ptrszint dbytes,
|
|
|
|
double val);
|
|
|
|
extern void sub__memfill_FLOAT(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
long double val);
|
|
|
|
extern void sub__memfill_nochecks_FLOAT(ptrszint doff, ptrszint dbytes,
|
|
|
|
long double val);
|
|
|
|
extern void sub__memfill_OFFSET(mem_block *dblk, ptrszint doff, ptrszint dbytes,
|
|
|
|
ptrszint val);
|
|
|
|
extern void sub__memfill_nochecks_OFFSET(ptrszint doff, ptrszint dbytes,
|
|
|
|
ptrszint val);
|
|
|
|
extern void *func__memget(mem_block *blk, ptrszint off, ptrszint bytes);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void new_mem_lock();
|
|
|
|
extern void free_mem_lock(mem_lock *lock);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern mem_block func__mem(ptrszint offset, ptrszint size, int32 type,
|
|
|
|
ptrszint elementsize, mem_lock *lock);
|
|
|
|
extern mem_block func__mem_at_offset(ptrszint offset, ptrszint size);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__memfree(void *);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__memcopy(void *sblk, ptrszint soff, ptrszint bytes, void *dblk,
|
|
|
|
ptrszint doff);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern mem_block func__memnew(ptrszint);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern mem_block func__memimage(int32, int32);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern int64 func__shellhide(qbs *str);
|
|
|
|
extern int64 func_shell(qbs *str);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_shell(qbs *str, int32 passed);
|
|
|
|
extern void sub_shell2(qbs *str, int32 passed);
|
|
|
|
extern void sub_shell3(qbs *str, int32 passed);
|
|
|
|
extern void sub__consoletitle(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__screenshow();
|
|
|
|
extern void sub__screenhide();
|
|
|
|
extern int32 func__screenhide();
|
2017-09-25 11:56:24 +00:00
|
|
|
extern int32 func_windowexists();
|
|
|
|
extern int32 func_screenicon();
|
|
|
|
extern int32 func_screenwidth();
|
|
|
|
extern int32 func_screenheight();
|
|
|
|
extern void sub_screenicon();
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__console(int32);
|
|
|
|
extern int32 func__console();
|
|
|
|
extern void sub__controlchr(int32);
|
2017-09-25 11:56:24 +00:00
|
|
|
extern int32 func__controlchr();
|
2017-08-16 03:11:31 +00:00
|
|
|
extern void sub__blink(int32);
|
2017-08-16 03:40:37 +00:00
|
|
|
extern int32 func__blink();
|
2017-09-24 11:12:13 +00:00
|
|
|
extern int32 func__hasfocus();
|
2021-08-13 02:00:43 +00:00
|
|
|
extern void set_foreground_window(ptrszint i);
|
2017-09-24 11:12:13 +00:00
|
|
|
extern qbs *func__title();
|
|
|
|
extern int32 func__handle();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 func_stick(int32 i, int32 axis_group, int32 passed);
|
|
|
|
extern int32 func_strig(int32 i, int32 controller, int32 passed);
|
|
|
|
extern void sub__maptriangle(int32 cull_options, float sx1, float sy1,
|
|
|
|
float sx2, float sy2, float sx3, float sy3,
|
|
|
|
int32 si, float dx1, float dy1, float dz1,
|
|
|
|
float dx2, float dy2, float dz2, float dx3,
|
|
|
|
float dy3, float dz3, int32 di,
|
|
|
|
int32 smooth_options, int32 passed);
|
|
|
|
extern void sub__depthbuffer(int32 options, int32 dst, int32 passed);
|
|
|
|
extern void sub_paletteusing(void *element, int32 bits);
|
|
|
|
extern int64 func_read_int64(uint8 *data, ptrszint *data_offset,
|
|
|
|
ptrszint data_size);
|
|
|
|
extern int64 func_read_uint64(uint8 *data, ptrszint *data_offset,
|
|
|
|
ptrszint data_size);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void key_on();
|
|
|
|
extern void key_off();
|
|
|
|
extern void key_list();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void key_assign(int32 i, qbs *str);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__screeny();
|
|
|
|
extern int32 func__screenx();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__screenmove(int32 x, int32 y, int32 passed);
|
|
|
|
extern void sub__mousemove(float x, float y);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func__os();
|
|
|
|
extern void sub__mapunicode(int32 unicode_code, int32 ascii_code);
|
|
|
|
extern int32 func__mapunicode(int32 ascii_code);
|
|
|
|
extern void field_new(int32 fileno);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void field_add(qbs *str, int64 size);
|
|
|
|
extern void field_get(int32 fileno, int64 seekpos, int32 passed);
|
|
|
|
extern void field_put(int32 fileno, int64 seekpos, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__keydown(int32 x);
|
|
|
|
extern int32 func__keyhit();
|
|
|
|
extern int32 func_lpos(int32);
|
|
|
|
extern void sub__printimage(int32 i);
|
2015-10-30 12:18:44 +00:00
|
|
|
extern float func__mousemovementx(int32 context, int32 passed);
|
|
|
|
extern float func__mousemovementy(int32 context, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__screenprint(qbs *txt);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__screenclick(int32 x, int32 y, int32 button, int32 passed);
|
|
|
|
extern int32 func__screenimage(int32 x1, int32 y1, int32 x2, int32 y2,
|
|
|
|
int32 passed);
|
|
|
|
extern void sub_lock(int32 i, int64 start, int64 end, int32 passed);
|
|
|
|
extern void sub_unlock(int32 i, int64 start, int64 end, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
void chain_restorescreenstate(int32);
|
|
|
|
void chain_savescreenstate(int32);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__fullscreen(int32 method, int32 passed);
|
|
|
|
extern void sub__allowfullscreen(int32 method, int32 smooth);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__fullscreen();
|
2018-06-30 20:09:29 +00:00
|
|
|
extern int32 func__fullscreensmooth();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__clipboard(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func__clipboard();
|
2017-09-06 14:19:54 +00:00
|
|
|
extern int32 func__clipboardimage();
|
|
|
|
extern void sub__clipboardimage(int32 src);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__exit();
|
|
|
|
extern void revert_input_check();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 func__openhost(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__openconnection(int32);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 func__openclient(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__connected(int32);
|
|
|
|
extern qbs *func__connectionaddress(int32);
|
2021-07-17 15:15:00 +00:00
|
|
|
extern int32 func__environcount();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_environ(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_environ(int32);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_environ(qbs *);
|
|
|
|
extern void sub_draw(qbs *);
|
|
|
|
extern void qbs_maketmp(qbs *);
|
|
|
|
extern void sub_run(qbs *);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub_run_init();
|
|
|
|
extern void freeallimages();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void call_interrupt(int32, void *, void *);
|
|
|
|
extern void call_interruptx(int32, void *, void *);
|
|
|
|
extern void restorepalette(img_struct *im);
|
|
|
|
extern void pset(int32 x, int32 y, uint32 col);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern uint32 newimg();
|
|
|
|
extern int32 freeimg(uint32);
|
|
|
|
extern void imgrevert(int32);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 imgframe(uint8 *o, int32 x, int32 y, int32 bpp);
|
|
|
|
extern int32 imgnew(int32 x, int32 y, int32 bpp);
|
|
|
|
extern void sub__putimage(double f_dx1, double f_dy1, double f_dx2,
|
|
|
|
double f_dy2, int32 src, int32 dst, double f_sx1,
|
|
|
|
double f_sy1, double f_sx2, double f_sy2,
|
|
|
|
int32 passed);
|
|
|
|
extern int32 selectfont(int32 f, img_struct *im);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern uint32 sib();
|
|
|
|
extern uint32 sib_mod0();
|
|
|
|
extern uint8 *rm8();
|
|
|
|
extern uint16 *rm16();
|
|
|
|
extern uint32 *rm32();
|
|
|
|
extern void cpu_call();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int64 build_int64(uint32 val2, uint32 val1);
|
|
|
|
extern uint64 build_uint64(uint32 val2, uint32 val1);
|
2016-03-23 11:29:32 +00:00
|
|
|
extern void fix_error();
|
2015-08-02 12:12:44 +00:00
|
|
|
extern double get_error_erl();
|
|
|
|
extern uint32 get_error_err();
|
2021-01-17 12:54:15 +00:00
|
|
|
extern char *human_error(int32 errorcode);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void end();
|
2021-08-05 00:12:33 +00:00
|
|
|
extern int32 stop_program_state();
|
2015-08-02 12:12:44 +00:00
|
|
|
extern uint8 *mem_static_malloc(uint32 size);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void mem_static_restore(uint8 *restore_point);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern uint8 *cmem_dynamic_malloc(uint32 size);
|
|
|
|
extern void cmem_dynamic_free(uint8 *block);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_defseg(int32 segment, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func_peek(int32 offset);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_poke(int32 offset, int32 value);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void more_return_points();
|
|
|
|
extern qbs *qbs_new_descriptor();
|
|
|
|
extern void qbs_free_descriptor(qbs *str);
|
|
|
|
extern void qbs_free(qbs *str);
|
|
|
|
extern void qbs_cmem_concat_list();
|
|
|
|
extern void qbs_concat_list();
|
|
|
|
extern void qbs_tmp_concat_list();
|
|
|
|
extern void qbs_concat(uint32 bytesrequired);
|
|
|
|
extern void qbs_concat_cmem(uint32 bytesrequired);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *qbs_new_cmem(int32 size, uint8 tmp);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *qbs_new_txt(const char *txt);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *qbs_new_txt_len(const char *txt, int32 len);
|
|
|
|
extern qbs *qbs_new_fixed(uint8 *offset, uint32 size, uint8 tmp);
|
|
|
|
extern qbs *qbs_new(int32 size, uint8 tmp);
|
|
|
|
extern void set_qbs_size(ptrszint *target_qbs, int32 newlength);
|
|
|
|
extern qbs *qbs_set(qbs *deststr, qbs *srcstr);
|
|
|
|
extern qbs *qbs_add(qbs *str1, qbs *str2);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *qbs_ucase(qbs *str);
|
|
|
|
extern qbs *qbs_lcase(qbs *str);
|
|
|
|
extern qbs *func_chr(int32 value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_varptr_helper(uint8 type, uint16 offset);
|
|
|
|
extern qbs *qbs_left(qbs *str, int32 l);
|
|
|
|
extern qbs *qbs_right(qbs *str, int32 l);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_mksmbf(float val);
|
|
|
|
extern qbs *func_mkdmbf(double val);
|
|
|
|
extern float func_cvsmbf(qbs *str);
|
|
|
|
extern double func_cvdmbf(qbs *str);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *bit2string(uint32 bsize, int64 v);
|
|
|
|
extern qbs *ubit2string(uint32 bsize, uint64 v);
|
|
|
|
extern uint64 string2ubit(qbs *str, uint32 bsize);
|
|
|
|
extern int64 string2bit(qbs *str, uint32 bsize);
|
|
|
|
extern void sub_lset(qbs *dest, qbs *source);
|
|
|
|
extern void sub_rset(qbs *dest, qbs *source);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_space(int32 spaces);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_string(int32 characters, int32 asciivalue);
|
|
|
|
extern int32 func_instr(int32 start, qbs *str, qbs *substr, int32 passed);
|
|
|
|
extern int32 func__instrrev(int32 start, qbs *str, qbs *substr, int32 passed);
|
|
|
|
extern void sub_mid(qbs *dest, int32 start, int32 l, qbs *src, int32 passed);
|
|
|
|
extern qbs *func_mid(qbs *str, int32 start, int32 l, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *qbs_ltrim(qbs *str);
|
|
|
|
extern qbs *qbs_rtrim(qbs *str);
|
2018-07-17 05:35:17 +00:00
|
|
|
extern qbs *qbs__trim(qbs *str);
|
2017-09-25 11:56:24 +00:00
|
|
|
extern int32 func__str_nc_compare(qbs *s1, qbs *s2);
|
|
|
|
extern int32 func__str_compare(qbs *s1, qbs *s2);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *qbs_inkey();
|
2017-09-25 13:03:38 +00:00
|
|
|
extern void sub__keyclear(int32 buf, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *qbs_str(int64 value);
|
|
|
|
extern qbs *qbs_str(int32 value);
|
|
|
|
extern qbs *qbs_str(int16 value);
|
|
|
|
extern qbs *qbs_str(int8 value);
|
|
|
|
extern qbs *qbs_str(uint64 value);
|
|
|
|
extern qbs *qbs_str(uint32 value);
|
|
|
|
extern qbs *qbs_str(uint16 value);
|
|
|
|
extern qbs *qbs_str(uint8 value);
|
|
|
|
extern qbs *qbs_str(float value);
|
|
|
|
extern qbs *qbs_str(double value);
|
|
|
|
extern qbs *qbs_str(long double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 qbs_equal(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_notequal(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_greaterthan(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_lessthan(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_lessorequal(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_greaterorequal(qbs *str1, qbs *str2);
|
|
|
|
extern int32 qbs_asc(qbs *);
|
|
|
|
extern int32 qbs_asc(qbs *, uint32);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 qbs_len(qbs *str);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void lineclip(int32 x1, int32 y1, int32 x2, int32 y2, int32 xmin,
|
|
|
|
int32 ymin, int32 xmax, int32 ymax);
|
|
|
|
extern void qbg_palette(uint32 attribute, uint32 col, int32 passed);
|
|
|
|
extern void qbg_sub_color(uint32 col1, uint32 col2, uint32 bordercolor,
|
|
|
|
int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void defaultcolors();
|
|
|
|
extern void validatepage(int32 n);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void qbg_screen(int32 mode, int32 color_switch, int32 active_page,
|
|
|
|
int32 visual_page, int32 refresh, int32 passed);
|
|
|
|
extern void sub_pcopy(int32 src, int32 dst);
|
|
|
|
extern void qbsub_width(int32 option, int32 value1, int32 value2, int32 value3,
|
|
|
|
int32 value4, int32 passed);
|
|
|
|
extern void pset(int32 x, int32 y, uint32 col);
|
|
|
|
extern void pset_and_clip(int32 x, int32 y, uint32 col);
|
|
|
|
extern void qb32_boxfill(float x1f, float y1f, float x2f, float y2f,
|
|
|
|
uint32 col);
|
|
|
|
extern void fast_boxfill(int32 x1, int32 y1, int32 x2, int32 y2, uint32 col);
|
|
|
|
extern void fast_line(int32 x1, int32 y1, int32 x2, int32 y2, uint32 col);
|
|
|
|
extern void qb32_line(float x1f, float y1f, float x2f, float y2f, uint32 col,
|
|
|
|
uint32 style);
|
|
|
|
extern void sub_line(float x1, float y1, float x2, float y2, uint32 col,
|
|
|
|
int32 bf, uint32 style, int32 passed);
|
|
|
|
extern void sub_paint32(float x, float y, uint32 fillcol, uint32 bordercol,
|
|
|
|
int32 passed);
|
|
|
|
extern void sub_paint32x(float x, float y, uint32 fillcol, uint32 bordercol,
|
|
|
|
int32 passed);
|
|
|
|
extern void sub_paint(float x, float y, uint32 fillcol, uint32 bordercol,
|
|
|
|
qbs *backgroundstr, int32 passed);
|
|
|
|
extern void sub_paint(float x, float y, qbs *fillstr, uint32 bordercol,
|
|
|
|
qbs *backgroundstr, int32 passed);
|
|
|
|
extern void sub_circle(double x, double y, double r, uint32 col, double start,
|
|
|
|
double end, double aspect, int32 passed);
|
|
|
|
extern uint32 point(int32 x, int32 y);
|
|
|
|
extern double func_point(float x, float y, int32 passed);
|
|
|
|
extern void sub_pset(float x, float y, uint32 col, int32 passed);
|
|
|
|
extern void sub_preset(float x, float y, uint32 col, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void printchr(int32 character);
|
2023-04-20 03:53:13 +00:00
|
|
|
extern int32_t chrwidth(uint32_t character);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void newline();
|
|
|
|
extern void makefit(qbs *text);
|
|
|
|
extern void lprint_makefit(qbs *text);
|
|
|
|
extern void tab();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void qbs_print(qbs *str, int32 finish_on_new_line);
|
|
|
|
extern void qbs_lprint(qbs *str, int32 finish_on_new_line);
|
|
|
|
extern void qbg_sub_window(float x1, float y1, float x2, float y2,
|
|
|
|
int32 passed);
|
|
|
|
extern void qbg_sub_view_print(int32 topline, int32 bottomline, int32 passed);
|
|
|
|
extern void qbg_sub_view(int32 x1, int32 y1, int32 x2, int32 y2,
|
|
|
|
int32 fillcolor, int32 bordercolor, int32 passed);
|
2023-10-18 12:01:12 +00:00
|
|
|
extern void sub_clsDest(int32 method, uint32 use_color, int32 dest, int32 passed);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_cls(int32 method, uint32 use_color, int32 passed);
|
|
|
|
extern void qbg_sub_locate(int32 row, int32 column, int32 cursor, int32 start,
|
|
|
|
int32 stop, int32 passed);
|
|
|
|
extern int32 hexoct2uint64(qbs *h);
|
|
|
|
extern void qbs_input(int32 numvariables, uint8 newline);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern long double func_val(qbs *s);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_out(int32 port, int32 data);
|
|
|
|
extern void sub_randomize(double seed, int32 passed);
|
|
|
|
extern float func_rnd(float n, int32 passed);
|
|
|
|
// following are declared below to allow for inlining
|
|
|
|
// extern double func_abs(double d);
|
|
|
|
// extern long double func_abs(long double d);
|
|
|
|
// extern float func_abs(float d);
|
|
|
|
|
|
|
|
// extern void sub_open(qbs *name,int32 type,int32 access,int32 sharing,int32
|
|
|
|
// i,int32 record_length,int32 passed);
|
|
|
|
extern void sub_open(qbs *name, int32 type, int32 access, int32 sharing,
|
|
|
|
int32 i, int64 record_length, int32 passed);
|
|
|
|
extern void sub_open_gwbasic(qbs *typestr, int32 i, qbs *name,
|
|
|
|
int64 record_length, int32 passed);
|
|
|
|
|
|
|
|
extern void sub_close(int32 i2, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 file_input_chr(int32 i);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void file_input_nextitem(int32 i, int32 lastc);
|
|
|
|
extern void sub_file_print(int32 i, qbs *str, int32 extraspace, int32 tab,
|
|
|
|
int32 newline);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 n_roundincrement();
|
|
|
|
extern int32 n_float();
|
|
|
|
extern int32 n_int64();
|
|
|
|
extern int32 n_uint64();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 n_inputnumberfromdata(uint8 *data, ptrszint *data_offset,
|
|
|
|
ptrszint data_size);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 n_inputnumberfromfile(int32 fileno);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_file_line_input_string(int32 fileno, qbs *deststr);
|
|
|
|
extern void sub_file_input_string(int32 fileno, qbs *deststr);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int64 func_file_input_int64(int32 fileno);
|
|
|
|
extern uint64 func_file_input_uint64(int32 fileno);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_read_string(uint8 *data, ptrszint *data_offset,
|
|
|
|
ptrszint data_size, qbs *deststr);
|
|
|
|
extern long double func_read_float(uint8 *data, ptrszint *data_offset,
|
|
|
|
ptrszint data_size, int32 typ);
|
|
|
|
extern long double func_file_input_float(int32 fileno, int32 typ);
|
|
|
|
extern void *byte_element(uint64 offset, int32 length);
|
|
|
|
extern void *byte_element(uint64 offset, int32 length,
|
|
|
|
byte_element_struct *info);
|
|
|
|
extern void sub_get(int32 i, int64 offset, void *element, int32 passed);
|
|
|
|
extern void sub_get2(int32 i, int64 offset, qbs *str, int32 passed);
|
|
|
|
|
|
|
|
extern void sub_put(int32 i, int64 offset, void *element, int32 passed);
|
|
|
|
extern void sub_put2(int32 i, int64 offset, void *element, int32 passed);
|
|
|
|
extern void sub_graphics_get(float x1f, float y1f, float x2f, float y2f,
|
|
|
|
void *element, uint32 mask, int32 passed);
|
|
|
|
extern void sub_graphics_put(float x1f, float y1f, void *element, int32 option,
|
|
|
|
uint32 mask, int32 passed);
|
|
|
|
extern void sub_date(qbs *date);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_date();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_time(qbs *str);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_time();
|
|
|
|
extern int32 func_csrlin();
|
|
|
|
extern int32 func_pos(int32 ignore);
|
|
|
|
extern double func_log(double value);
|
|
|
|
extern double func_fix_double(double value);
|
|
|
|
extern long double func_fix_float(long double value);
|
|
|
|
extern double func_exp_single(double value);
|
|
|
|
extern long double func_exp_float(long double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_sleep(int32 seconds, int32 passed);
|
|
|
|
extern qbs *func__bin(int64 value, int32 neg_bits);
|
2021-10-13 22:17:35 +00:00
|
|
|
extern qbs *func__bin_float(long double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_oct(int64 value, int32 neg_bits);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_oct_float(long double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_hex(int64 value, int32 neg_size);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_hex_float(long double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern ptrszint func_lbound(ptrszint *array, int32 index, int32 num_indexes);
|
|
|
|
extern ptrszint func_ubound(ptrszint *array, int32 index, int32 num_indexes);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern int32 func_sgn(uint8 v);
|
|
|
|
extern int32 func_sgn(int8 v);
|
|
|
|
extern int32 func_sgn(uint16 v);
|
|
|
|
extern int32 func_sgn(int16 v);
|
|
|
|
extern int32 func_sgn(uint32 v);
|
|
|
|
extern int32 func_sgn(int32 v);
|
|
|
|
extern int32 func_sgn(uint64 v);
|
|
|
|
extern int32 func_sgn(int64 v);
|
|
|
|
extern int32 func_sgn(float v);
|
|
|
|
extern int32 func_sgn(double v);
|
|
|
|
extern int32 func_sgn(long double v);
|
|
|
|
|
|
|
|
extern int32 func_inp(int32 port);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_wait(int32 port, int32 andexpression, int32 xorexpression,
|
|
|
|
int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *func_tab(int32 pos);
|
|
|
|
extern qbs *func_spc(int32 spaces);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern float func_pmap(float val, int32 option);
|
|
|
|
extern uint32 func_screen(int32 y, int32 x, int32 returncol, int32 passed);
|
|
|
|
extern void sub_bsave(qbs *filename, int32 offset, int32 size);
|
|
|
|
extern void sub_bload(qbs *filename, int32 offset, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern int64 func_lof(int32 i);
|
|
|
|
extern int32 func_eof(int32 i);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub_seek(int32 i, int64 pos);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int64 func_seek(int32 i);
|
|
|
|
extern int64 func_loc(int32 i);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_input(int32 n, int32 i, int32 passed);
|
2022-11-20 09:04:02 +00:00
|
|
|
extern int32 func__statusCode(int32 handle);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern double func_sqr(double value);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern qbs *func_command(int32 index, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func__commandcount();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern long double pow2(long double x, long double y);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 func_freefile();
|
|
|
|
extern void sub__mousehide();
|
|
|
|
extern void sub__mouseshow(qbs *style, int32 passed);
|
2015-10-30 12:18:44 +00:00
|
|
|
extern float func__mousex(int32 context, int32 passed);
|
|
|
|
extern float func__mousey(int32 context, int32 passed);
|
|
|
|
extern int32 func__mouseinput(int32 context, int32 passed);
|
|
|
|
extern int32 func__mousebutton(int32 i, int32 context, int32 passed);
|
|
|
|
extern int32 func__mousewheel(int32 context, int32 passed);
|
|
|
|
|
|
|
|
extern int32 func__mousepipeopen();
|
|
|
|
extern void sub__mouseinputpipe(int32 context);
|
|
|
|
extern void sub__mousepipeclose(int32 context);
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void call_absolute(int32 args, uint16 offset);
|
|
|
|
extern int32 func__newimage(int32 x, int32 y, int32 bpp, int32 passed);
|
|
|
|
extern int32 func__copyimage(int32 i, int32 mode, int32 passed);
|
|
|
|
extern void sub__freeimage(int32 i, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__source(int32 i);
|
|
|
|
extern void sub__dest(int32 i);
|
|
|
|
extern int32 func__source();
|
|
|
|
extern int32 func__dest();
|
|
|
|
extern int32 func__display();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__blend(int32 i, int32 passed);
|
|
|
|
extern void sub__dontblend(int32 i, int32 passed);
|
|
|
|
extern void sub__clearcolor(uint32 c, int32 i, int32 passed);
|
|
|
|
extern void sub__setalpha(int32 a, uint32 c, uint32 c2, int32 i, int32 passed);
|
|
|
|
extern int32 func__width(int32 i, int32 passed);
|
|
|
|
extern int32 func__height(int32 i, int32 passed);
|
|
|
|
extern int32 func__pixelsize(int32 i, int32 passed);
|
|
|
|
extern int32 func__clearcolor(int32 i, int32 passed);
|
|
|
|
extern int32 func__blend(int32 i, int32 passed);
|
|
|
|
extern uint32 func__defaultcolor(int32 i, int32 passed);
|
|
|
|
extern uint32 func__backgroundcolor(int32 i, int32 passed);
|
|
|
|
extern uint32 func__palettecolor(int32 n, int32 i, int32 passed);
|
|
|
|
extern void sub__palettecolor(int32 n, uint32 c, int32 i, int32 passed);
|
|
|
|
extern void sub__copypalette(int32 i, int32 i2, int32 passed);
|
|
|
|
extern void sub__printstring(float x, float y, qbs *text, int32 i,
|
|
|
|
int32 passed);
|
|
|
|
extern int32 func__printwidth(qbs *text, int32 i, int32 passed);
|
2023-04-20 03:53:13 +00:00
|
|
|
extern int32_t func__loadfont(qbs *file_name, int32_t size, qbs *requirements, int32_t font_index, int32_t passed);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__font(int32 f, int32 i, int32 passed);
|
|
|
|
extern int32 func__fontwidth(int32 f, int32 passed);
|
|
|
|
extern int32 func__fontheight(int32 f, int32 passed);
|
|
|
|
extern int32 func__font(int32 i, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub__freefont(int32 f);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void sub__printmode(int32 mode, int32 i, int32 passed);
|
|
|
|
extern int32 func__printmode(int32 i, int32 passed);
|
|
|
|
uint32 func__rgb32(int32 r, int32 g, int32 b, int32 a);
|
|
|
|
uint32 func__rgb32(int32 r, int32 g, int32 b);
|
|
|
|
uint32 func__rgb32(int32 i, int32 a);
|
Makes _RGB32 more flexible and powerful.
Existing syntax:
colour~& = _RGB32(red, green, blue)
New possible uses:
- Instead of passing identical rgb values to achieve a shade of gray, pass only 1 parameter for all color components:
colour~& = _RGB32(51) 'same as _RGB32(51, 51, 51)
- _RGB32 can now take an optional alpha parameter, which makes _RGBA32 obsolete (although it still exists for retrocompatibility):
colour~& = _RGB32(255, 0, 255, 30) 'same as _RGBA32(255, 0, 255, 30)
- If you want a shade of gray and also to specify the alpha level, you can pass just two parameters:
colour~& = _RGB32(51, 30) 'same as _RGBA32(51, 51, 51, 30)
In summary:
- 1 parameter = red, green and blue simultaneously set.
- 2 parameters = red, green and blue simultaneously set plus alpha level.
- 3 parameters = red, green and blue as usual.
- 4 parameters = red, green and blue plus alpha level (same as _RGBA32).
2018-07-02 00:46:08 +00:00
|
|
|
uint32 func__rgb32(int32 i);
|
2022-05-06 04:00:36 +00:00
|
|
|
uint32 func__rgba32(int32 r, int32 g, int32 b, int32 a);
|
Makes _RGB32 more flexible and powerful.
Existing syntax:
colour~& = _RGB32(red, green, blue)
New possible uses:
- Instead of passing identical rgb values to achieve a shade of gray, pass only 1 parameter for all color components:
colour~& = _RGB32(51) 'same as _RGB32(51, 51, 51)
- _RGB32 can now take an optional alpha parameter, which makes _RGBA32 obsolete (although it still exists for retrocompatibility):
colour~& = _RGB32(255, 0, 255, 30) 'same as _RGBA32(255, 0, 255, 30)
- If you want a shade of gray and also to specify the alpha level, you can pass just two parameters:
colour~& = _RGB32(51, 30) 'same as _RGBA32(51, 51, 51, 30)
In summary:
- 1 parameter = red, green and blue simultaneously set.
- 2 parameters = red, green and blue simultaneously set plus alpha level.
- 3 parameters = red, green and blue as usual.
- 4 parameters = red, green and blue plus alpha level (same as _RGBA32).
2018-07-02 00:46:08 +00:00
|
|
|
int32 func__alpha32(uint32 col);
|
|
|
|
int32 func__red32(uint32 col);
|
|
|
|
int32 func__green32(uint32 col);
|
|
|
|
int32 func__blue32(uint32 col);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern uint32 matchcol(int32 r, int32 g, int32 b);
|
|
|
|
extern uint32 matchcol(int32 r, int32 g, int32 b, int32 i);
|
|
|
|
extern uint32 func__rgb(int32 r, int32 g, int32 b, int32 i, int32 passed);
|
|
|
|
extern uint32 func__rgba(int32 r, int32 g, int32 b, int32 a, int32 i,
|
|
|
|
int32 passed);
|
|
|
|
extern int32 func__alpha(uint32 col, int32 i, int32 passed);
|
|
|
|
extern int32 func__red(uint32 col, int32 i, int32 passed);
|
|
|
|
extern int32 func__green(uint32 col, int32 i, int32 passed);
|
|
|
|
extern int32 func__blue(uint32 col, int32 i, int32 passed);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern void sub_end();
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 print_using(qbs *f, int32 s2, qbs *dest, qbs *pu_str);
|
|
|
|
extern int32 print_using_integer64(qbs *format, int64 value, int32 start,
|
|
|
|
qbs *output);
|
|
|
|
extern int32 print_using_uinteger64(qbs *format, uint64 value, int32 start,
|
|
|
|
qbs *output);
|
|
|
|
extern int32 print_using_single(qbs *format, float value, int32 start,
|
|
|
|
qbs *output);
|
|
|
|
extern int32 print_using_double(qbs *format, double value, int32 start,
|
|
|
|
qbs *output);
|
|
|
|
extern int32 print_using_float(qbs *format, long double value, int32 start,
|
|
|
|
qbs *output);
|
2015-08-02 12:12:44 +00:00
|
|
|
extern qbs *b2string(char v);
|
|
|
|
extern qbs *ub2string(char v);
|
|
|
|
extern qbs *i2string(int16 v);
|
|
|
|
extern qbs *ui2string(int16 v);
|
|
|
|
extern qbs *l2string(int32 v);
|
|
|
|
extern qbs *ul2string(uint32 v);
|
|
|
|
extern qbs *i642string(int64 v);
|
|
|
|
extern qbs *ui642string(uint64 v);
|
|
|
|
extern qbs *s2string(float v);
|
|
|
|
extern qbs *d2string(double v);
|
|
|
|
extern qbs *f2string(long double v);
|
2021-07-28 17:26:32 +00:00
|
|
|
extern qbs *o2string(ptrszint v);
|
|
|
|
extern qbs *uo2string(uptrszint v);
|
2022-05-06 04:00:36 +00:00
|
|
|
extern char string2b(qbs *str);
|
|
|
|
extern uint8 string2ub(qbs *str);
|
|
|
|
extern int16 string2i(qbs *str);
|
|
|
|
extern uint16 string2ui(qbs *str);
|
|
|
|
extern int32 string2l(qbs *str);
|
|
|
|
extern uint32 string2ul(qbs *str);
|
|
|
|
extern int64 string2i64(qbs *str);
|
|
|
|
extern uint64 string2ui64(qbs *str);
|
|
|
|
extern float string2s(qbs *str);
|
|
|
|
extern double string2d(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
|
2019-12-05 15:08:31 +00:00
|
|
|
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);
|
2018-01-05 10:22:36 +00:00
|
|
|
#ifndef QB64_WINDOWS
|
2022-05-06 04:00:36 +00:00
|
|
|
extern void ZeroMemory(void *ptr, int64 bytes);
|
2018-01-05 10:22:36 +00:00
|
|
|
#endif
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
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);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// shared global variables
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int32 sleep_break;
|
|
|
|
extern uint64 mem_lock_id;
|
|
|
|
extern mem_lock *mem_lock_tmp;
|
|
|
|
extern int64 exit_code;
|
2022-05-06 04:00:36 +00:00
|
|
|
extern int32 lock_mainloop; // 0=unlocked, 1=lock requested, 2=locked
|
2015-08-02 12:12:44 +00:00
|
|
|
extern int64 device_event_index;
|
|
|
|
extern int32 exit_ok;
|
|
|
|
extern qbs *func_command_str;
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 timer_event_occurred = 0; // inc/dec as each GOSUB to QBMAIN ()
|
|
|
|
// begins/ends
|
|
|
|
int32 timer_event_id = 0;
|
|
|
|
int32 key_event_occurred = 0; // inc/dec as each GOSUB to QBMAIN () begins/ends
|
|
|
|
int32 key_event_id = 0;
|
|
|
|
int32 strig_event_occurred = 0; // inc/dec as each GOSUB to QBMAIN ()
|
|
|
|
// begins/ends
|
|
|
|
int32 strig_event_id = 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
uint32 ercl;
|
2016-03-23 10:45:51 +00:00
|
|
|
uint32 inclercl;
|
2022-05-06 04:00:36 +00:00
|
|
|
char *includedfilename;
|
2015-08-02 12:12:44 +00:00
|
|
|
uint16 call_absolute_offsets[256];
|
|
|
|
uint32 dbgline;
|
2022-05-06 04:00:36 +00:00
|
|
|
uint32 qbs_cmem_sp = 256;
|
|
|
|
uint32 cmem_sp = 65536;
|
|
|
|
ptrszint dblock; // 32bit offset of dblock
|
|
|
|
uint8 close_program = 0;
|
|
|
|
int32 tab_spc_cr_size = 1; // 1=PRINT(default), 2=FILE
|
|
|
|
int32 tab_fileno = 0; // only valid if tab_spc_cr_size=2
|
|
|
|
int32 tab_LPRINT = 0; // 1=dest is LPRINT image
|
|
|
|
|
|
|
|
uint64 *nothingvalue; // a pointer to 8 empty bytes in dblock
|
|
|
|
uint32 error_err = 0;
|
|
|
|
double error_erl = 0;
|
|
|
|
uint32 qbs_tmp_list_nexti = 1;
|
|
|
|
uint32 error_occurred = 0;
|
|
|
|
uint32 new_error = 0;
|
|
|
|
uint32 bkp_new_error = 0;
|
|
|
|
qbs *nothingstring;
|
|
|
|
uint32 qbevent = 0;
|
|
|
|
uint8 suspend_program = 0;
|
|
|
|
uint8 stop_program = 0;
|
|
|
|
uint32 error_retry = 0;
|
|
|
|
uint8 cmem[1114099]; // 16*65535+65535+3 (enough for highest referencable dword
|
|
|
|
// in conv memory)
|
|
|
|
uint8 *cmem_static_pointer = &cmem[0] + 1280 + 65536;
|
|
|
|
uint8 *cmem_dynamic_base = &cmem[0] + 655360;
|
2015-08-02 12:12:44 +00:00
|
|
|
uint8 *mem_static;
|
|
|
|
uint8 *mem_static_pointer;
|
|
|
|
uint8 *mem_static_limit;
|
2022-05-06 04:00:36 +00:00
|
|
|
double last_line = 0;
|
|
|
|
uint32 error_goto_line = 0;
|
|
|
|
uint32 error_handling = 0;
|
|
|
|
uint32 next_return_point = 0;
|
|
|
|
uint32 *return_point = (uint32 *)malloc(4 * 16384);
|
|
|
|
uint32 return_points = 16384;
|
2015-08-02 12:12:44 +00:00
|
|
|
void *qbs_input_variableoffsets[257];
|
|
|
|
int32 qbs_input_variabletypes[257];
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// qbmain specific global variables
|
2015-08-02 12:12:44 +00:00
|
|
|
char g_tmp_char;
|
|
|
|
uint8 g_tmp_uchar;
|
|
|
|
int16 g_tmp_short;
|
|
|
|
uint16 g_tmp_ushort;
|
|
|
|
int32 g_tmp_long;
|
|
|
|
uint32 g_tmp_ulong;
|
|
|
|
|
|
|
|
int8 g_tmp_int8;
|
|
|
|
uint8 g_tmp_uint8;
|
|
|
|
int16 g_tmp_int16;
|
|
|
|
uint16 g_tmp_uint16;
|
|
|
|
int32 g_tmp_int32;
|
|
|
|
uint32 g_tmp_uint32;
|
|
|
|
int64 g_tmp_int64;
|
|
|
|
uint64 g_tmp_uint64;
|
|
|
|
float g_tmp_float;
|
|
|
|
double g_tmp_double;
|
|
|
|
long double g_tmp_longdouble;
|
|
|
|
|
|
|
|
qbs *g_tmp_str;
|
|
|
|
qbs *g_swap_str;
|
|
|
|
qbs *pass_str;
|
2022-05-06 04:00:36 +00:00
|
|
|
ptrszint data_offset = 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// inline functions
|
|
|
|
inline void swap_8(void *a, void *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
uint8 x;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = *(uint8 *)a;
|
|
|
|
*(uint8 *)a = *(uint8 *)b;
|
|
|
|
*(uint8 *)b = x;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline void swap_16(void *a, void *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
uint16 x;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = *(uint16 *)a;
|
|
|
|
*(uint16 *)a = *(uint16 *)b;
|
|
|
|
*(uint16 *)b = x;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline void swap_32(void *a, void *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
uint32 x;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = *(uint32 *)a;
|
|
|
|
*(uint32 *)a = *(uint32 *)b;
|
|
|
|
*(uint32 *)b = x;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline void swap_64(void *a, void *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
uint64 x;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = *(uint64 *)a;
|
|
|
|
*(uint64 *)a = *(uint64 *)b;
|
|
|
|
*(uint64 *)b = x;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline void swap_longdouble(void *a, void *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
long double x;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = *(long double *)a;
|
|
|
|
*(long double *)a = *(long double *)b;
|
|
|
|
*(long double *)b = x;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
void swap_string(qbs *a, qbs *b) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static qbs *c;
|
2022-05-06 04:00:36 +00:00
|
|
|
c = qbs_new(a->len, 0);
|
|
|
|
memcpy(c->chr, a->chr, a->len);
|
|
|
|
qbs_set(a, b);
|
|
|
|
qbs_set(b, c);
|
2018-06-30 15:16:59 +00:00
|
|
|
qbs_free(c);
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
void swap_block(void *a, void *b, uint32 bytes) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static uint32 quads;
|
2022-05-06 04:00:36 +00:00
|
|
|
quads = bytes >> 2;
|
|
|
|
static uint32 *a32, *b32;
|
|
|
|
a32 = (uint32 *)a;
|
|
|
|
b32 = (uint32 *)b;
|
|
|
|
while (quads--) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static uint32 c;
|
2022-05-06 04:00:36 +00:00
|
|
|
c = *a32;
|
|
|
|
*a32++ = *b32;
|
|
|
|
*b32++ = c;
|
|
|
|
}
|
|
|
|
bytes &= 3;
|
|
|
|
static uint8 *a8, *b8;
|
|
|
|
a8 = (uint8 *)a32;
|
|
|
|
b8 = (uint8 *)b32;
|
|
|
|
while (bytes--) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static uint8 c;
|
2022-05-06 04:00:36 +00:00
|
|
|
c = *a8;
|
|
|
|
*a8++ = *b8;
|
|
|
|
*b8++ = c;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2016-08-03 07:18:20 +00:00
|
|
|
extern ptrszint *qbs_tmp_list;
|
2022-05-06 04:00:36 +00:00
|
|
|
template <typename T> static T qbs_cleanup(uint32 base, T passvalue) {
|
|
|
|
while (qbs_tmp_list_nexti > base) {
|
|
|
|
qbs_tmp_list_nexti--;
|
|
|
|
if (qbs_tmp_list[qbs_tmp_list_nexti] != -1)
|
|
|
|
qbs_free((qbs *)qbs_tmp_list[qbs_tmp_list_nexti]);
|
|
|
|
} // clear any temp. strings created
|
2018-06-30 15:16:59 +00:00
|
|
|
return passvalue;
|
2016-08-03 07:18:20 +00:00
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// force abs to return floating point numbers correctly
|
2023-10-07 06:05:13 +00:00
|
|
|
inline double func_abs(double d) { return std::fabs(d); }
|
|
|
|
inline long double func_abs(long double d) { return std::fabs(d); }
|
|
|
|
inline float func_abs(float d) { return std::fabs(d); }
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
inline uint8 func_abs(uint8 d) { return d; }
|
|
|
|
inline uint16 func_abs(uint16 d) { return d; }
|
|
|
|
inline uint32 func_abs(uint32 d) { return d; }
|
|
|
|
inline uint64 func_abs(uint64 d) { return d; }
|
2023-10-07 06:05:13 +00:00
|
|
|
inline int8 func_abs(int8 d) { return std::abs(d); }
|
|
|
|
inline int16 func_abs(int16 d) { return std::abs(d); }
|
|
|
|
inline int32 func_abs(int32 d) { return std::abs(d); }
|
|
|
|
inline int64 func_abs(int64 d) { return std::llabs(d); }
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2021-10-01 01:40:57 +00:00
|
|
|
extern int32 disableEvents;
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
ptrszint check_lbound(ptrszint *array, int32 index, int32 num_indexes) {
|
2021-10-01 01:40:57 +00:00
|
|
|
static ptrszint ret;
|
|
|
|
disableEvents = 1;
|
2022-05-06 04:00:36 +00:00
|
|
|
ret = func_lbound((ptrszint *)(*array), index, num_indexes);
|
|
|
|
new_error = 0;
|
2021-10-01 01:40:57 +00:00
|
|
|
disableEvents = 0;
|
|
|
|
return ret;
|
2021-08-19 22:10:51 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
ptrszint check_ubound(ptrszint *array, int32 index, int32 num_indexes) {
|
2021-10-01 01:40:57 +00:00
|
|
|
static ptrszint ret;
|
|
|
|
disableEvents = 1;
|
2022-05-06 04:00:36 +00:00
|
|
|
ret = func_ubound((ptrszint *)(*array), index, num_indexes);
|
|
|
|
new_error = 0;
|
2021-10-01 01:40:57 +00:00
|
|
|
disableEvents = 0;
|
|
|
|
return ret;
|
2021-08-19 22:10:51 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
uint64 call_getubits(uint32 bsize, ptrszint *array, ptrszint i) {
|
|
|
|
return getubits(bsize, (uint8 *)(*array), i);
|
2021-09-21 01:04:24 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int64 call_getbits(uint32 bsize, ptrszint *array, ptrszint i) {
|
|
|
|
return getbits(bsize, (uint8 *)(*array), i);
|
2021-09-21 01:04:24 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void call_setbits(uint32 bsize, ptrszint *array, ptrszint i, int64 val) {
|
|
|
|
setbits(bsize, (uint8 *)(*array), i, val);
|
2021-09-21 01:04:24 +00:00
|
|
|
}
|
|
|
|
|
2021-09-21 05:54:41 +00:00
|
|
|
int32 logical_drives() {
|
2022-05-06 04:00:36 +00:00
|
|
|
#ifdef QB64_WINDOWS
|
|
|
|
return GetLogicalDrives();
|
|
|
|
#else
|
|
|
|
return 0;
|
|
|
|
#endif
|
2021-09-21 05:54:41 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
inline ptrszint array_check(uptrszint index, uptrszint limit) {
|
|
|
|
// nb. forces signed index into an unsigned variable for quicker comparison
|
|
|
|
if (index < limit)
|
|
|
|
return index;
|
|
|
|
error(9);
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(uint8 v) {
|
|
|
|
if (v)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(int8 v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(uint16 v) {
|
|
|
|
if (v)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(int16 v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(uint32 v) {
|
|
|
|
if (v)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(int32 v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(uint64 v) {
|
|
|
|
if (v)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(int64 v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(float v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(double v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int32 func_sgn(long double v) {
|
|
|
|
if (v)
|
|
|
|
if (v > 0)
|
|
|
|
return 1;
|
|
|
|
else
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-09-01 01:21:06 +00:00
|
|
|
// a740g: ROR & ROL additions start
|
|
|
|
// The rotation functions below are the way they are for a couple of reasons:
|
|
|
|
// 1. They are safer (well folks seem to think so; see https://en.wikipedia.org/wiki/Circular_shift#Implementing_circular_shifts)
|
|
|
|
// 2. We are using C library constants and there is just 1 numeric literal - '1'
|
|
|
|
// 3. GGC recognizes the 'pattern' and will optimize it out to 'roX' and 3 more instructions when using O2
|
|
|
|
inline uint8_t func__rol8(uint8_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value << count) | (value >> (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint8_t func__ror8(uint8_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value >> count) | (value << (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint16_t func__rol16(uint16_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value << count) | (value >> (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint16_t func__ror16(uint16_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value >> count) | (value << (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32_t func__rol32(uint32_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value << count) | (value >> (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32_t func__ror32(uint32_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value >> count) | (value << (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint64_t func__rol64(uint64_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value << count) | (value >> (-count & mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint64_t func__ror64(uint64_t value, unsigned int count) {
|
|
|
|
const unsigned int mask = CHAR_BIT * sizeof(value) - 1;
|
|
|
|
count &= mask;
|
|
|
|
return (value >> count) | (value << (-count & mask));
|
|
|
|
}
|
|
|
|
// a740g: ROR & ROL additions end
|
|
|
|
|
2022-09-01 10:45:42 +00:00
|
|
|
// bit-shifting
|
|
|
|
inline uint64 func__shl(uint64 a1, int b1) { return a1 << b1; }
|
2022-09-01 01:21:06 +00:00
|
|
|
|
2022-09-01 10:45:42 +00:00
|
|
|
inline uint64 func__shr(uint64 a1, int b1) { return a1 >> b1; }
|
Makes _RGB32 more flexible and powerful.
Existing syntax:
colour~& = _RGB32(red, green, blue)
New possible uses:
- Instead of passing identical rgb values to achieve a shade of gray, pass only 1 parameter for all color components:
colour~& = _RGB32(51) 'same as _RGB32(51, 51, 51)
- _RGB32 can now take an optional alpha parameter, which makes _RGBA32 obsolete (although it still exists for retrocompatibility):
colour~& = _RGB32(255, 0, 255, 30) 'same as _RGBA32(255, 0, 255, 30)
- If you want a shade of gray and also to specify the alpha level, you can pass just two parameters:
colour~& = _RGB32(51, 30) 'same as _RGBA32(51, 51, 51, 30)
In summary:
- 1 parameter = red, green and blue simultaneously set.
- 2 parameters = red, green and blue simultaneously set plus alpha level.
- 3 parameters = red, green and blue as usual.
- 4 parameters = red, green and blue plus alpha level (same as _RGBA32).
2018-07-02 00:46:08 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
inline int64 func__readbit(uint64 a1, int b1) {
|
|
|
|
if (a1 & 1ull << b1)
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
inline uint64 func__setbit(uint64 a1, int b1) { return a1 | 1ull << b1; }
|
|
|
|
|
|
|
|
inline uint64 func__resetbit(uint64 a1, int b1) { return a1 & ~(1ull << b1); }
|
|
|
|
|
|
|
|
inline uint64 func__togglebit(uint64 a1, int b1) { return a1 ^ 1ull << b1; }
|
|
|
|
|
|
|
|
// Working with 32bit colors:
|
|
|
|
inline uint32 func__rgb32(int32 r, int32 g, int32 b, int32 a) {
|
|
|
|
if (r < 0)
|
|
|
|
r = 0;
|
|
|
|
if (r > 255)
|
|
|
|
r = 255;
|
|
|
|
if (g < 0)
|
|
|
|
g = 0;
|
|
|
|
if (g > 255)
|
|
|
|
g = 255;
|
|
|
|
if (b < 0)
|
|
|
|
b = 0;
|
|
|
|
if (b > 255)
|
|
|
|
b = 255;
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
return (a << 24) + (r << 16) + (g << 8) + b;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32 func__rgb32(int32 r, int32 g, int32 b) {
|
|
|
|
if (r < 0)
|
|
|
|
r = 0;
|
|
|
|
if (r > 255)
|
|
|
|
r = 255;
|
|
|
|
if (g < 0)
|
|
|
|
g = 0;
|
|
|
|
if (g > 255)
|
|
|
|
g = 255;
|
|
|
|
if (b < 0)
|
|
|
|
b = 0;
|
|
|
|
if (b > 255)
|
|
|
|
b = 255;
|
|
|
|
return (r << 16) + (g << 8) + b | 0xFF000000;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32 func__rgb32(int32 i, int32 a) {
|
|
|
|
if (i < 0)
|
|
|
|
i = 0;
|
|
|
|
if (i > 255)
|
|
|
|
i = 255;
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
return (a << 24) + (i << 16) + (i << 8) + i;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32 func__rgb32(int32 i) {
|
|
|
|
if (i < 0)
|
|
|
|
i = 0;
|
|
|
|
if (i > 255)
|
|
|
|
i = 255;
|
|
|
|
return (i << 16) + (i << 8) + i | 0xFF000000;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline uint32 func__rgba32(int32 r, int32 g, int32 b, int32 a) {
|
|
|
|
if (r < 0)
|
|
|
|
r = 0;
|
|
|
|
if (r > 255)
|
|
|
|
r = 255;
|
|
|
|
if (g < 0)
|
|
|
|
g = 0;
|
|
|
|
if (g > 255)
|
|
|
|
g = 255;
|
|
|
|
if (b < 0)
|
|
|
|
b = 0;
|
|
|
|
if (b > 255)
|
|
|
|
b = 255;
|
|
|
|
if (a < 0)
|
|
|
|
a = 0;
|
|
|
|
if (a > 255)
|
|
|
|
a = 255;
|
|
|
|
return (a << 24) + (r << 16) + (g << 8) + b;
|
|
|
|
}
|
|
|
|
inline int32 func__alpha32(uint32 col) { return col >> 24; }
|
|
|
|
inline int32 func__red32(uint32 col) { return col >> 16 & 0xFF; }
|
|
|
|
inline int32 func__green32(uint32 col) { return col >> 8 & 0xFF; }
|
|
|
|
inline int32 func__blue32(uint32 col) { return col & 0xFF; }
|
|
|
|
|
|
|
|
inline uint16 varptr_dblock_check(uint8 *off) {
|
|
|
|
// note: 66816 is the top of DBLOCK (SEG:80+OFF:65536)
|
|
|
|
if (off < (&cmem[66816])) { // in DBLOCK?
|
|
|
|
return ((uint16)(off - &cmem[1280]));
|
|
|
|
} else {
|
|
|
|
return ((uint32)(off - cmem)) & 15;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
inline uint16 varseg_dblock_check(uint8 *off) {
|
|
|
|
// note: 66816 is the top of DBLOCK (SEG:80+OFF:65536)
|
|
|
|
if (off < (&cmem[66816])) { // in DBLOCK?
|
2018-06-30 15:16:59 +00:00
|
|
|
return 80;
|
2022-05-06 04:00:36 +00:00
|
|
|
} else {
|
|
|
|
return ((uint32)(off - cmem)) / 16;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#include "../temp/global.txt"
|
|
|
|
#include "../temp/regsf.txt"
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
extern int32 ScreenResize;
|
|
|
|
extern int32 ScreenResizeScale;
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// set_dynamic_info is called immediately when
|
|
|
|
// main() begins, to set global, static variables
|
|
|
|
// controlling app init
|
|
|
|
void set_dynamic_info() {
|
|
|
|
#include "../temp/dyninfo.txt"
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void sub_clear(int32 ignore, int32 ignore2, int32 stack, int32 passed) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static ptrszint tmp_long;
|
2022-05-06 04:00:36 +00:00
|
|
|
// note: stack can be ignored
|
|
|
|
#include "../temp/clear.txt"
|
|
|
|
// reset DATA read offset
|
|
|
|
data_offset = 0;
|
|
|
|
// close open files
|
|
|
|
sub_close(NULL, NULL); // closes all open files
|
|
|
|
// free images
|
2018-06-30 15:16:59 +00:00
|
|
|
freeallimages();
|
2022-05-06 04:00:36 +00:00
|
|
|
// stop & free sounds (note: QB also stops any sound from the PLAY command)
|
|
|
|
// invalidate RETURN location(s)
|
|
|
|
next_return_point = 0;
|
|
|
|
// reset error goto location to 'unhandled'
|
|
|
|
error_goto_line = 0;
|
|
|
|
// invalidate RESUME
|
|
|
|
error_handling = 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 run_from_line = 0;
|
|
|
|
// run_from_line's value is an index in a list of possible "run from" locations
|
|
|
|
// when 0, the program runs from the beginning
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
void sub__icon(int32 i, int32 i2, int32 passed);
|
|
|
|
|
|
|
|
void sub__display();
|
|
|
|
void sub__autodisplay();
|
2017-09-25 11:56:24 +00:00
|
|
|
int32 func__autodisplay();
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__errorline() { return ercl; }
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__inclerrorline() { return inclercl; }
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs *func__inclerrorfile() { return qbs_new_txt(includedfilename); }
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs *func__errormessage(int32 errorcode, int32 passed) {
|
2021-01-17 12:54:15 +00:00
|
|
|
if (!passed)
|
|
|
|
errorcode = get_error_err();
|
|
|
|
return qbs_new_txt(human_error(errorcode));
|
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void chain_input() {
|
|
|
|
// note: common data or not, every program must check for chained data,
|
2018-06-30 15:16:59 +00:00
|
|
|
// it could be sharing files or screen state
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// check if command$ contains a tmp chain directive
|
2018-06-30 15:16:59 +00:00
|
|
|
int32 FF;
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
if ((func_command(0, 0))->len >= 32) {
|
|
|
|
if (qbs_equal(qbs_right(func_command(0, 0), 4),
|
|
|
|
qbs_new_txt_len(".tmp", 4))) {
|
|
|
|
if (qbs_equal(func_mid(func_command(0, 0),
|
|
|
|
(func_command(0, 0))->len - 31, 25, 1),
|
|
|
|
qbs_new_txt_len("(unique-tag:=/@*$+-)chain", 25))) {
|
|
|
|
FF = func_freefile();
|
|
|
|
sub_open(func_mid(func_command(0, 0),
|
|
|
|
(func_command(0, 0))->len - 11, 12, 1),
|
|
|
|
2, NULL, NULL, FF, NULL, 0);
|
|
|
|
|
|
|
|
static int32 int32val, int32val2;
|
|
|
|
static int64 int64val, int64val2;
|
|
|
|
static int64 bytes, bytei;
|
2018-06-30 15:16:59 +00:00
|
|
|
static qbs *tqbs;
|
|
|
|
static ptrszint tmp_long;
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// CHDIR directive
|
2018-06-30 15:16:59 +00:00
|
|
|
static uint8 chdir_data[4096];
|
2022-05-06 04:00:36 +00:00
|
|
|
sub_get(FF, NULL, byte_element((uint64)&int32val, 4),
|
|
|
|
0); // assume CHDIR directive 512
|
|
|
|
sub_get(FF, NULL, byte_element((uint64)&int32val, 4),
|
|
|
|
0); // assume len
|
|
|
|
sub_get(FF, NULL, byte_element((uint64)chdir_data, int32val),
|
|
|
|
0); // data
|
|
|
|
chdir_data[int32val] = 0;
|
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
chain_restorescreenstate(FF);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// get first command
|
|
|
|
sub_get(FF, NULL, byte_element((uint64)&int32val, 4), 0);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// read COMMON data
|
|
|
|
#include "../temp/inpchain.txt"
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
sub_close(FF, 1);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
sub_kill(func_mid(func_command(0, 0),
|
|
|
|
(func_command(0, 0))->len - 11, 12, 1));
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
chdir((char *)chdir_data);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// remove chain tag from COMMAND$
|
|
|
|
func_command_str->len -= 32;
|
|
|
|
// remove trailing space (if any)
|
|
|
|
if (func_command_str->len)
|
|
|
|
func_command_str->len--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void sub_chain(qbs *f) {
|
|
|
|
if (new_error)
|
|
|
|
return;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#ifdef QB64_WINDOWS
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// run program
|
|
|
|
static qbs *str = NULL;
|
|
|
|
if (str == NULL)
|
|
|
|
str = qbs_new(0, 0);
|
|
|
|
static qbs *str2 = NULL;
|
|
|
|
if (str2 == NULL)
|
|
|
|
str2 = qbs_new(0, 0);
|
|
|
|
|
|
|
|
static int32 i, i2, x;
|
|
|
|
static qbs *strz = NULL;
|
|
|
|
if (!strz)
|
|
|
|
strz = qbs_new(0, 0);
|
|
|
|
static char *cp;
|
|
|
|
|
|
|
|
if (!f->len) {
|
|
|
|
error(53);
|
|
|
|
return;
|
|
|
|
} // file not found (as in QB)
|
|
|
|
qbs_set(str, f);
|
|
|
|
qbs_set(str2, qbs_ucase(str));
|
|
|
|
|
|
|
|
static qbs *f_exe = NULL;
|
|
|
|
if (!f_exe)
|
|
|
|
f_exe = qbs_new(0, 0);
|
|
|
|
static qbs *f_bas = NULL;
|
|
|
|
if (!f_bas)
|
|
|
|
f_bas = qbs_new(0, 0); // no parameters
|
|
|
|
static qbs *f_path = NULL;
|
|
|
|
if (!f_path)
|
|
|
|
f_path = qbs_new(0, 0);
|
|
|
|
static int32 path_len;
|
|
|
|
static qbs *current_path = NULL;
|
|
|
|
if (!current_path)
|
|
|
|
current_path = qbs_new(0, 0);
|
|
|
|
static qbs *thisexe_path = NULL;
|
|
|
|
if (!thisexe_path)
|
|
|
|
thisexe_path = qbs_new(0, 0);
|
|
|
|
|
|
|
|
// note: supports arguments after filename
|
|
|
|
|
|
|
|
f_bas->len = 0;
|
|
|
|
for (i = 0; i < str->len; i++) {
|
|
|
|
if (str->chr[i] == 46) {
|
|
|
|
//.bas?
|
|
|
|
if ((i + 3) < str->len) {
|
|
|
|
if ((str2->chr[i + 1] == 66) && (str2->chr[i + 2] == 65) &&
|
|
|
|
(str2->chr[i + 3] == 83)) { //"BAS"
|
|
|
|
qbs_set(f_bas, str);
|
|
|
|
f_bas->len = i + 4; // arguments truncated
|
|
|
|
qbs_set(f_exe, str); // change .bas to .exe
|
|
|
|
f_exe->chr[i + 1] = 101;
|
|
|
|
f_exe->chr[i + 2] = 120;
|
|
|
|
f_exe->chr[i + 3] = 101; //"exe"
|
|
|
|
goto extensions_ready;
|
|
|
|
} //"BAS"
|
|
|
|
} // bas
|
|
|
|
//.exe?
|
|
|
|
if ((i + 3) < str->len) {
|
|
|
|
if ((str2->chr[i + 1] == 69) && (str2->chr[i + 2] == 88) &&
|
|
|
|
(str2->chr[i + 3] == 69)) { //"EXE"
|
|
|
|
qbs_set(f_bas, str);
|
|
|
|
f_bas->len =
|
|
|
|
i + 4; // arguments truncated, change .exe to .bas
|
|
|
|
f_bas->chr[i + 1] = 98;
|
|
|
|
f_bas->chr[i + 2] = 97;
|
|
|
|
f_exe->chr[i + 3] = 115; //"bas"
|
|
|
|
qbs_set(f_exe, str); // note: exe kept as is
|
|
|
|
goto extensions_ready;
|
|
|
|
} //"EXE"
|
|
|
|
} // exe
|
|
|
|
break; // no meaningful extension found
|
|
|
|
} //"."
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// no extension given!
|
|
|
|
// note: It is more 'likely' that the user will want to pass arguments than
|
|
|
|
// chain a
|
|
|
|
// filename containing spaces. Therefore, only everything left of
|
|
|
|
// left-most space will be considered the path+filename.
|
|
|
|
i2 = str->len; // last character index of filename
|
|
|
|
for (i = str->len - 1; i; i--) {
|
|
|
|
if (str->chr[i] == 32)
|
|
|
|
i2 = i;
|
|
|
|
}
|
|
|
|
qbs_set(str2, qbs_right(str, str->len - i2)); //[+extension]
|
|
|
|
str->len = i2; //[path+]file
|
|
|
|
qbs_set(f_exe, qbs_add(qbs_add(str, qbs_new_txt(".exe ")), str2));
|
|
|
|
qbs_set(f_bas, qbs_add(str, qbs_new_txt(".bas")));
|
|
|
|
|
|
|
|
extensions_ready:
|
|
|
|
|
|
|
|
// normalize dir slashes
|
2023-12-10 05:45:41 +00:00
|
|
|
filepath_fix_directory(f_exe);
|
|
|
|
filepath_fix_directory(f_bas);
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// get path (strip paths from f_exe & f_bas)
|
|
|
|
f_path->len = 0;
|
|
|
|
for (i = f_bas->len - 1; i >= 0; i--) {
|
|
|
|
if ((f_bas->chr[i] == 92) || (f_bas->chr[i] == 47) ||
|
|
|
|
(f_bas->chr[i] == 58)) {
|
|
|
|
qbs_set(f_path, f_bas);
|
|
|
|
f_path->len = i + 1;
|
|
|
|
if (f_bas->chr[i] == 58) {
|
|
|
|
f_path->chr[i + 1] = 92;
|
|
|
|
f_path->len++;
|
|
|
|
} // add "\" to ":"
|
|
|
|
// strip paths
|
|
|
|
memmove(f_exe->chr, &f_exe->chr[i + 1], f_exe->len - (i + 1));
|
|
|
|
f_exe->len -= (i + 1);
|
|
|
|
memmove(f_bas->chr, &f_bas->chr[i + 1], f_bas->len - (i + 1));
|
|
|
|
f_bas->len -= (i + 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
static uint8 path_data[4096];
|
|
|
|
static int32 defaultpath;
|
|
|
|
|
|
|
|
defaultpath = 0;
|
|
|
|
if (!f_path->len) { // use current path if no path specified
|
|
|
|
defaultpath = 1;
|
|
|
|
// get current path (add \ if necessary)
|
|
|
|
i = GetCurrentDirectory(4096, (char *)path_data);
|
|
|
|
qbs_set(f_path, func_space(i + 1));
|
|
|
|
memcpy(f_path->chr, path_data, i);
|
|
|
|
if ((f_path->chr[i - 1] != 92) && (f_path->chr[i - 1] != 47)) {
|
|
|
|
f_path->chr[i] = 92;
|
|
|
|
} else {
|
|
|
|
f_path->len--;
|
|
|
|
}
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// get current program's exe's path (including "\")
|
|
|
|
GetModuleFileName(NULL, (char *)path_data, 4096);
|
|
|
|
i = strlen((char *)path_data);
|
|
|
|
for (i2 = i - 1; i2 >= 0; i2--) {
|
|
|
|
x = path_data[i2];
|
|
|
|
if ((x == 92) || (x == 47) || (x == 58)) {
|
|
|
|
if (x == 58)
|
|
|
|
i2++;
|
|
|
|
i2++;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
qbs_set(thisexe_path, func_space(i2));
|
|
|
|
memcpy(thisexe_path->chr, path_data, i2);
|
|
|
|
thisexe_path->chr[i2] = 92; //"\"
|
|
|
|
|
|
|
|
// 1. create & open a temporary file to pass information to the chained
|
|
|
|
// program
|
|
|
|
double TD;
|
|
|
|
int32 TL, FF;
|
|
|
|
qbs *TS = NULL;
|
|
|
|
if (TS == NULL)
|
|
|
|
TS = qbs_new(0, 0);
|
|
|
|
qbs *TFS = NULL;
|
|
|
|
if (TFS == NULL)
|
|
|
|
TFS = qbs_new(0, 0);
|
|
|
|
TD = func_timer(0.001E+0, 1);
|
2023-10-07 06:05:13 +00:00
|
|
|
TL = qbr(std::floor(TD));
|
2022-05-06 04:00:36 +00:00
|
|
|
TL = qbr((TD - TL) * 999);
|
|
|
|
if (TL < 100)
|
|
|
|
TL = 100; // ensure value is a 3 digit number
|
|
|
|
qbs_set(TS, qbs_ltrim(qbs_str((int32)(TL))));
|
|
|
|
qbs_set(TFS, qbs_add(qbs_add(qbs_new_txt_len("chain", 5), TS),
|
|
|
|
qbs_new_txt_len(".tmp", 4)));
|
|
|
|
FF = func_freefile();
|
|
|
|
sub_open(TFS, 2, NULL, NULL, FF, NULL, 0); // opened in BINARY mode
|
|
|
|
|
|
|
|
// add common data
|
|
|
|
static int32 int32val, int32val2;
|
|
|
|
static int64 int64val, int64val2;
|
|
|
|
static qbs *tqbs;
|
|
|
|
static int64 bytes, bytei;
|
|
|
|
static ptrszint tmp_long;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// CHDIR directive
|
|
|
|
int32val = 512;
|
|
|
|
sub_put(FF, NULL, byte_element((uint64)&int32val, 4), 0);
|
|
|
|
int32val = f_path->len - 1;
|
|
|
|
sub_put(FF, NULL, byte_element((uint64)&int32val, 4), 0);
|
|
|
|
sub_put(FF, NULL, byte_element((uint64)f_path->chr, f_path->len - 1),
|
|
|
|
0); //-1 removes trailing "\"
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
chain_savescreenstate(FF);
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#include "../temp/chain.txt"
|
|
|
|
// add "end of commands" value
|
|
|
|
int32val = 0;
|
|
|
|
sub_put(FF, NULL, byte_element((uint64)&int32val, 4), 0);
|
|
|
|
|
|
|
|
sub_close(FF, 1);
|
|
|
|
|
|
|
|
// move chain???.tmp file to path
|
|
|
|
if (!defaultpath) {
|
|
|
|
qbs_set(str, qbs_new_txt("move /Y "));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, TFS));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt(" ")));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, f_path));
|
|
|
|
str->len--; // remove trailing "\" of dest path
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(strz, qbs_add(str, qbs_new_txt_len("\0", 1)));
|
|
|
|
WinExec((char *)strz->chr, SW_HIDE);
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
static int32 method;
|
|
|
|
method = 1;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
chain_retry:
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
if (method == 1) {
|
|
|
|
qbs_set(str, qbs_add(f_path, f_exe));
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
if (method == 2) {
|
|
|
|
// move chain???.tmp file to 'thisexe_path' path
|
|
|
|
qbs_set(str, qbs_new_txt("move /Y "));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, f_path));
|
|
|
|
qbs_set(str, qbs_add(str, TFS));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt(" ")));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, thisexe_path));
|
|
|
|
str->len--; // remove trailing "\" of dest path
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(strz, qbs_add(str, qbs_new_txt_len("\0", 1)));
|
|
|
|
sub_shell(str, 1);
|
|
|
|
qbs_set(str, qbs_add(thisexe_path, f_exe));
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
if (method == 3) {
|
|
|
|
// attempt .bas compilation
|
|
|
|
qbs_set(str, qbs_new_txt_len("\x022", 1));
|
|
|
|
qbs_set(str, qbs_add(str, thisexe_path));
|
2022-08-11 16:07:57 +00:00
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt("qb64pe.exe")));
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("\x022", 1)));
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt(" -c ")));
|
|
|
|
qbs_set(str, qbs_add(str, f_path));
|
|
|
|
qbs_set(str, qbs_add(str, f_bas));
|
|
|
|
sub_shell(str, 1);
|
|
|
|
qbs_set(str, qbs_add(thisexe_path, f_exe));
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// add a space
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt(" ")));
|
|
|
|
// add chain tag
|
|
|
|
qbs_set(str, qbs_add(str, qbs_new_txt_len("(unique-tag:=/@*$+-)", 20)));
|
|
|
|
// add chain file name
|
|
|
|
qbs_set(str, qbs_add(str, TFS));
|
|
|
|
// add NULL terminator
|
|
|
|
qbs_set(strz, qbs_add(str, qbs_new_txt_len("\0", 1)));
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#ifdef QB64_WINDOWS
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
if (WinExec((char *)strz->chr, SW_SHOWDEFAULT) > 31) {
|
|
|
|
goto run_exit;
|
|
|
|
} else {
|
|
|
|
goto run_failed;
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#else
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
system((char *)strz->chr);
|
|
|
|
// success?
|
|
|
|
goto run_exit;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
#endif
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// exit this program
|
|
|
|
run_exit:
|
|
|
|
close_program = 1;
|
|
|
|
end();
|
|
|
|
exit(99); //<--this line should never actually be executed
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// failed
|
|
|
|
run_failed:
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
if (method == 1) {
|
|
|
|
method = 2;
|
|
|
|
goto chain_retry;
|
|
|
|
}
|
|
|
|
if (method == 2) {
|
|
|
|
method = 3;
|
|
|
|
goto chain_retry;
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs_set(str, qbs_add(thisexe_path, TFS));
|
|
|
|
sub_kill(str); // remove tmp file (chain specific)
|
|
|
|
error(53);
|
|
|
|
return; // file not found
|
|
|
|
|
|
|
|
#endif
|
2016-03-20 07:56:10 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// note: index 0 is unused
|
|
|
|
int32 device_last = 0; // last used device
|
|
|
|
int32 device_max = 1000; // number of allocated indexes
|
|
|
|
device_struct *devices =
|
|
|
|
(device_struct *)calloc(1000 + 1, sizeof(device_struct));
|
|
|
|
|
|
|
|
// device_struct helper functions
|
|
|
|
uint8 getDeviceEventButtonValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex) {
|
|
|
|
return *(device->events + eventIndex * device->event_size +
|
|
|
|
device->lastaxis * 4 + device->lastwheel * 4 + objectIndex);
|
|
|
|
}
|
|
|
|
void setDeviceEventButtonValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex, uint8 value) {
|
|
|
|
*(device->events + eventIndex * device->event_size + device->lastaxis * 4 +
|
|
|
|
device->lastwheel * 4 + objectIndex) = value;
|
|
|
|
}
|
|
|
|
float getDeviceEventAxisValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex) {
|
|
|
|
return *(float *)(device->events + eventIndex * device->event_size +
|
|
|
|
objectIndex * 4);
|
|
|
|
}
|
|
|
|
void setDeviceEventAxisValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex, float value) {
|
|
|
|
*(float *)(device->events + eventIndex * device->event_size +
|
|
|
|
objectIndex * 4) = value;
|
|
|
|
}
|
|
|
|
float getDeviceEventWheelValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex) {
|
|
|
|
return *(float *)(device->events + eventIndex * device->event_size +
|
|
|
|
device->lastaxis * 4 + objectIndex * 4);
|
|
|
|
}
|
|
|
|
void setDeviceEventWheelValue(device_struct *device, int32 eventIndex,
|
|
|
|
int32 objectIndex, float value) {
|
|
|
|
*(float *)(device->events + eventIndex * device->event_size +
|
|
|
|
device->lastaxis * 4 + objectIndex * 4) = value;
|
|
|
|
}
|
|
|
|
void setupDevice(device_struct *device) {
|
|
|
|
int32 size =
|
|
|
|
device->lastaxis * 4 + device->lastwheel * 4 + device->lastbutton;
|
|
|
|
size += 8; // for appended ordering index
|
|
|
|
size += 7;
|
|
|
|
size = size - (size & 7); // align to closest 8-byte boundary
|
|
|
|
device->event_size = size;
|
|
|
|
device->events = (uint8 *)calloc(
|
|
|
|
2,
|
|
|
|
device->event_size); // create initial 'current' and 'previous' events
|
|
|
|
device->max_events = 2;
|
|
|
|
device->queued_events = 2;
|
|
|
|
device->connected = 1;
|
|
|
|
device->used = 1;
|
|
|
|
}
|
|
|
|
int32 createDeviceEvent(device_struct *device) {
|
|
|
|
uint8 *cp, *cp2;
|
|
|
|
if (device->queued_events ==
|
|
|
|
device->max_events) { // expand/shift event buffer
|
|
|
|
if (device->max_events >= QUEUED_EVENTS_LIMIT) {
|
|
|
|
// discard base message
|
|
|
|
memmove(device->events, device->events + device->event_size,
|
|
|
|
(device->queued_events - 1) * device->event_size);
|
|
|
|
device->queued_events--;
|
|
|
|
} else {
|
|
|
|
cp = (uint8 *)calloc(device->max_events * 2,
|
|
|
|
device->event_size); // create new buffer
|
|
|
|
memcpy(cp, device->events,
|
|
|
|
device->queued_events *
|
|
|
|
device->event_size); // copy events from old buffer into
|
|
|
|
// new buffer
|
|
|
|
cp2 = device->events;
|
|
|
|
device->events = cp;
|
|
|
|
device->max_events *= 2;
|
|
|
|
free(cp2);
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
// copy previous event data into new event
|
|
|
|
memmove(device->events + device->queued_events * device->event_size,
|
|
|
|
device->events + (device->queued_events - 1) * device->event_size,
|
|
|
|
device->event_size);
|
|
|
|
*(int64 *)(device->events + (device->queued_events * device->event_size) +
|
|
|
|
(device->event_size - 8)) =
|
|
|
|
device_event_index++; // set global event index
|
|
|
|
int32 eventIndex = device->queued_events;
|
|
|
|
return eventIndex;
|
2016-03-20 07:56:10 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
void commitDeviceEvent(device_struct *device) { device->queued_events++; }
|
2016-03-20 07:56:10 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__devices() { return device_last; }
|
2016-03-20 07:56:10 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 device_selected = 0;
|
2016-03-20 07:56:10 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs *func__device(int32 i, int32 passed) {
|
|
|
|
if (!passed)
|
|
|
|
i = device_selected;
|
|
|
|
if (i < 1 || i > device_last) {
|
|
|
|
error(5);
|
|
|
|
return qbs_new(0, 1);
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
|
|
|
return qbs_new_txt(devices[i].name);
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__deviceinput(int32 i, int32 passed) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static device_struct *d;
|
|
|
|
static int32 retval;
|
2022-05-06 04:00:36 +00:00
|
|
|
retval = -1;
|
|
|
|
device_selected = -1;
|
|
|
|
|
|
|
|
if (!passed) {
|
|
|
|
// find oldest event across all devices
|
2018-06-30 15:16:59 +00:00
|
|
|
static int32 i2;
|
2022-05-06 04:00:36 +00:00
|
|
|
static int64 index, lowest_index;
|
|
|
|
i2 = -1;
|
|
|
|
for (i = 1; i <= device_last; i++) {
|
|
|
|
d = &devices[i];
|
|
|
|
if (d->queued_events > 2) {
|
|
|
|
index = *(int64 *)((d->events + d->event_size * 2) +
|
|
|
|
(d->event_size - 8));
|
|
|
|
if ((i2 == -1) || (index < lowest_index)) {
|
|
|
|
i2 = i;
|
|
|
|
lowest_index = index;
|
|
|
|
retval = i2;
|
|
|
|
} // first/lower
|
|
|
|
} // queued_events>2
|
|
|
|
} // i
|
|
|
|
if (i2 != -1)
|
|
|
|
i = i2;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i < 1 || i > device_last)
|
|
|
|
error(5);
|
|
|
|
d = &devices[i];
|
|
|
|
|
|
|
|
device_selected = i;
|
|
|
|
|
|
|
|
if (d->queued_events > 2) {
|
|
|
|
memmove(d->events, ((uint8 *)d->events) + d->event_size,
|
|
|
|
(d->queued_events - 1) * d->event_size);
|
2018-06-30 15:16:59 +00:00
|
|
|
d->queued_events--;
|
|
|
|
return retval;
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__button(int32 i, int32 passed) {
|
|
|
|
if (device_selected < 1 || device_selected > device_last) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[device_selected];
|
|
|
|
if (!passed)
|
|
|
|
i = 1;
|
|
|
|
if (i < 1 || i > d->lastbutton) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (getDeviceEventButtonValue(d, 1, i - 1))
|
|
|
|
return -1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__buttonchange(int32 i, int32 passed) {
|
|
|
|
if (device_selected < 1 || device_selected > device_last) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[device_selected];
|
|
|
|
if (!passed)
|
|
|
|
i = 1;
|
|
|
|
if (i < 1 || i > d->lastbutton) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static int32 old_value, value;
|
|
|
|
value = getDeviceEventButtonValue(d, 1, i - 1);
|
|
|
|
old_value = getDeviceEventButtonValue(d, 0, i - 1);
|
|
|
|
if (value > old_value)
|
|
|
|
return -1;
|
|
|
|
if (value < old_value)
|
|
|
|
return 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
return 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
float func__axis(int32 i, int32 passed) {
|
|
|
|
if (device_selected < 1 || device_selected > device_last) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[device_selected];
|
|
|
|
if (!passed)
|
|
|
|
i = 1;
|
|
|
|
if (i < 1 || i > d->lastaxis) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return getDeviceEventAxisValue(d, 1, i - 1);
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
float func__wheel(int32 i, int32 passed) {
|
|
|
|
if (device_selected < 1 || device_selected > device_last) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[device_selected];
|
|
|
|
if (!passed)
|
|
|
|
i = 1;
|
|
|
|
if (i < 1 || i > d->lastwheel) {
|
|
|
|
error(5);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return getDeviceEventWheelValue(d, 1, i - 1);
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__lastbutton(int32 di, int32 passed) {
|
|
|
|
if (!passed)
|
|
|
|
di = device_selected;
|
|
|
|
if (di < 1 || di > device_last)
|
|
|
|
error(5);
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[di];
|
2018-06-30 15:16:59 +00:00
|
|
|
return d->lastbutton;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__lastaxis(int32 di, int32 passed) {
|
|
|
|
if (!passed)
|
|
|
|
di = device_selected;
|
|
|
|
if (di < 1 || di > device_last)
|
|
|
|
error(5);
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[di];
|
2018-06-30 15:16:59 +00:00
|
|
|
return d->lastaxis;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__lastwheel(int32 di, int32 passed) {
|
|
|
|
if (!passed)
|
|
|
|
di = device_selected;
|
|
|
|
if (di < 1 || di > device_last)
|
|
|
|
error(5);
|
|
|
|
static device_struct *d;
|
|
|
|
d = &devices[di];
|
2018-06-30 15:16:59 +00:00
|
|
|
return d->lastwheel;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
onstrig_struct *onstrig = (onstrig_struct *)calloc(
|
|
|
|
65536, sizeof(onstrig_struct)); // note: up to 256 controllers with up to
|
|
|
|
// 256 buttons each supported
|
|
|
|
int32 onstrig_inprogress = 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void onstrig_setup(int32 i, int32 controller, int32 controller_passed,
|
|
|
|
uint32 id, int64 pass) {
|
|
|
|
// note: pass is ignored by ids not requiring a pass value
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
if (i < 0 || i > 65535) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (controller_passed) {
|
|
|
|
if (controller < 1 || controller > 65535) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
controller = 1;
|
|
|
|
if (i & 2) {
|
|
|
|
controller = 2;
|
|
|
|
i -= 2;
|
|
|
|
}
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
|
|
|
static int32 button;
|
2022-05-06 04:00:36 +00:00
|
|
|
button = (i >> 2) + 1;
|
|
|
|
if (i & 1) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
} //'currently down' state cannot be used as an ON STRIG event
|
|
|
|
if (controller > 256 || button > 256)
|
|
|
|
return; // error-less exit for (currently) unsupported ranges
|
|
|
|
i = (controller - 1) * 256 + (button - 1); // reindex
|
|
|
|
onstrig[i].state = 0;
|
|
|
|
onstrig[i].pass = pass;
|
|
|
|
onstrig[i].id = id; // id must be set last because it is the trigger
|
|
|
|
// variable
|
|
|
|
if (device_last == 0)
|
|
|
|
func__devices(); // init device interface (if not already setup)
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_strig(int32 i, int32 controller, int32 option, int32 passed) {
|
|
|
|
// ref: "[(?[,?])]{ON|OFF|STOP}"
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
// Note: QuickBASIC ignores STRIG ON and STRIG OFF statements--the
|
|
|
|
// statements are provided for compatibility with earlier versions,
|
2018-06-30 15:16:59 +00:00
|
|
|
// Reference: http://www.antonis.de/qbebooks/gwbasman/strig.html
|
2022-05-06 04:00:36 +00:00
|
|
|
// QB64 makes STRIG ON/OFF/STOP change the checking status for all
|
|
|
|
// buttons
|
|
|
|
static int32 i1, i2;
|
|
|
|
if (passed > 0) {
|
|
|
|
if (i < 0 || i > 65535) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (passed & 2) {
|
|
|
|
if (controller < 1 || controller > 65535) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
controller = 1;
|
|
|
|
if (i & 2) {
|
|
|
|
controller = 2;
|
|
|
|
i -= 2;
|
|
|
|
}
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
|
|
|
static int32 button;
|
2022-05-06 04:00:36 +00:00
|
|
|
button = (i >> 2) + 1;
|
|
|
|
if (i & 1) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
} //'currently down' state cannot be used as an ON STRIG event
|
|
|
|
if (controller > 256 || button > 256)
|
|
|
|
return; // error-less exit for (currently) unsupported ranges
|
|
|
|
i = (controller - 1) * 256 + (button - 1); // reindex
|
|
|
|
i1 = i;
|
|
|
|
i2 = i;
|
|
|
|
} else {
|
|
|
|
i1 = 0;
|
|
|
|
i2 = 65535;
|
|
|
|
}
|
|
|
|
for (i = i1; i <= i2; i++) {
|
|
|
|
// ref: uint8 active;//0=OFF, 1=ON, 2=STOP
|
|
|
|
if (option == 1) { // ON
|
|
|
|
onstrig[i].active = 1;
|
|
|
|
if (onstrig[i].state)
|
|
|
|
qbevent = 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 2) { // OFF
|
|
|
|
onstrig[i].active = 0;
|
|
|
|
onstrig[i].state = 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 3) { // STOP
|
|
|
|
onstrig[i].active = 2;
|
|
|
|
if (onstrig[i].state)
|
|
|
|
onstrig[i].state = 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
} // i
|
|
|
|
}
|
|
|
|
|
|
|
|
onkey_struct *onkey = (onkey_struct *)calloc(32, sizeof(onkey_struct));
|
|
|
|
int32 onkey_inprogress = 0;
|
|
|
|
|
|
|
|
void onkey_setup(int32 i, uint32 id, int64 pass) {
|
|
|
|
// note: pass is ignored by ids not requiring a pass value
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
if ((i < 1) || (i > 31)) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
onkey[i].state = 0;
|
|
|
|
onkey[i].pass = pass;
|
|
|
|
onkey[i].id = id; // id must be set last because it is the trigger variable
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_key(int32 i, int32 option) {
|
|
|
|
// ref: "(?){ON|OFF|STOP}"
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
if ((i < 0) || (i > 31)) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
static int32 i1, i2;
|
|
|
|
i1 = i;
|
|
|
|
i2 = i;
|
|
|
|
if (!i) {
|
|
|
|
i1 = i;
|
|
|
|
i2 = 31;
|
|
|
|
} // set all keys!
|
|
|
|
for (i = i1; i <= i2; i++) {
|
|
|
|
// ref: uint8 active;//0=OFF, 1=ON, 2=STOP
|
|
|
|
if (option == 1) { // ON
|
|
|
|
onkey[i].active = 1;
|
|
|
|
if (onkey[i].state)
|
|
|
|
qbevent = 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 2) { // OFF
|
|
|
|
onkey[i].active = 0;
|
|
|
|
onkey[i].state = 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 3) { // STOP
|
|
|
|
onkey[i].active = 2;
|
|
|
|
if (onkey[i].state)
|
|
|
|
onkey[i].state = 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
} // i
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 ontimer_nextfree = 1;
|
|
|
|
int32 *ontimer_freelist = (int32 *)malloc(32);
|
|
|
|
uint32 ontimer_freelist_size = 8; // number of elements in the freelist
|
|
|
|
uint32 ontimer_freelist_available = 0; // element (if any) which is available)
|
|
|
|
ontimer_struct *ontimer = (ontimer_struct *)malloc(sizeof(ontimer_struct));
|
|
|
|
// note: index 0 of the above cannot be allocated/freed
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 ontimerthread_lock = 0;
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2021-07-15 04:13:50 +00:00
|
|
|
void stop_timers() {
|
2022-05-06 04:00:36 +00:00
|
|
|
ontimerthread_lock = 1;
|
|
|
|
while (ontimerthread_lock != 2)
|
|
|
|
;
|
2021-07-15 04:13:50 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void start_timers() { ontimerthread_lock = 0; }
|
2021-07-15 04:13:50 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
int32 func__freetimer() {
|
|
|
|
if (new_error)
|
|
|
|
return 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
static int32 i;
|
2022-05-06 04:00:36 +00:00
|
|
|
if (ontimer_freelist_available) {
|
|
|
|
i = ontimer_freelist[ontimer_freelist_available--];
|
|
|
|
} else {
|
|
|
|
ontimerthread_lock = 1;
|
|
|
|
while (ontimerthread_lock == 1)
|
|
|
|
Sleep(0); // mutex
|
|
|
|
ontimer = (ontimer_struct *)realloc(
|
|
|
|
ontimer, sizeof(ontimer_struct) * (ontimer_nextfree + 1));
|
|
|
|
if (!ontimer)
|
|
|
|
error(257); // out of memory
|
|
|
|
ontimerthread_lock = 0; // mutex
|
|
|
|
i = ontimer_nextfree;
|
|
|
|
ontimer[i].state = 0; // state is not set to 0 if reusing an existing
|
|
|
|
// index as event could still be in progress
|
|
|
|
}
|
|
|
|
ontimer[i].active = 0;
|
|
|
|
ontimer[i].id = 0;
|
|
|
|
ontimer[i].allocated = 1;
|
|
|
|
if (i == ontimer_nextfree)
|
|
|
|
ontimer_nextfree++;
|
2018-06-30 15:16:59 +00:00
|
|
|
return i;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void freetimer(int32 i) {
|
|
|
|
ontimer[i].allocated = 0;
|
|
|
|
ontimer[i].id = 0;
|
|
|
|
if (ontimer_freelist_available == ontimer_freelist_size) {
|
|
|
|
ontimer_freelist_size *= 2;
|
|
|
|
ontimer_freelist =
|
|
|
|
(int32 *)realloc(ontimer_freelist, ontimer_freelist_size * 4);
|
|
|
|
}
|
|
|
|
ontimer_freelist[++ontimer_freelist_available] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ontimer_setup(int32 i, double sec, uint32 id, int64 pass) {
|
|
|
|
// note: pass is ignored by ids not requiring a pass value
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
if ((i < 0) || (i >= ontimer_nextfree)) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!ontimer[i].allocated) {
|
|
|
|
error(5);
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (ontimer[i].state == 1)
|
|
|
|
ontimer[i].state = 0; // retract prev event if not in progress
|
|
|
|
ontimer[i].seconds = sec;
|
|
|
|
ontimer[i].pass = pass;
|
|
|
|
ontimer[i].last_time = 0;
|
|
|
|
ontimer[i].id = id; // id must be set last because it is the trigger
|
|
|
|
// variable
|
|
|
|
}
|
|
|
|
|
|
|
|
void sub_timer(int32 i, int32 option, int32 passed) {
|
|
|
|
// ref: "[(?)]{ON|OFF|STOP|FREE}"
|
|
|
|
if (new_error)
|
|
|
|
return;
|
|
|
|
if (!passed)
|
|
|
|
i = 0;
|
|
|
|
if ((i < 0) || (i >= ontimer_nextfree)) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!ontimer[i].allocated) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
// ref: uint8 active;//0=OFF, 1=ON, 2=STOP
|
|
|
|
if (option == 1) { // ON
|
|
|
|
ontimer[i].active = 1;
|
2023-01-15 04:54:33 +00:00
|
|
|
|
|
|
|
// This is necessary so that if a timer triggered while stopped we will run it now.
|
|
|
|
qbevent = 1;
|
2022-05-06 04:00:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (option == 2) { // OFF
|
|
|
|
ontimer[i].active = 0;
|
|
|
|
if (ontimer[i].state == 1)
|
|
|
|
ontimer[i].state = 0; // retract event if not in progress
|
2023-01-09 08:33:23 +00:00
|
|
|
ontimer[i].last_time = 0; // when ON is next used, the timer will start over
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 3) { // STOP
|
|
|
|
ontimer[i].active = 2;
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (option == 4) { // FREE
|
|
|
|
if (i == 0) {
|
|
|
|
error(5);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ontimer[i].active = 0;
|
|
|
|
if (ontimer[i].state == 1)
|
|
|
|
ontimer[i].state = 0; // retract event if not in progress
|
2018-06-30 15:16:59 +00:00
|
|
|
freetimer(i);
|
2022-05-06 04:00:36 +00:00
|
|
|
// note: if an event is still in progress, it will set state to 0 when
|
|
|
|
// it finishes
|
|
|
|
// which may delay the first instance of this index if it is
|
|
|
|
// immediately reused
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-11-23 04:36:45 +00:00
|
|
|
void TIMERTHREAD(void *unused) {
|
2018-06-30 15:16:59 +00:00
|
|
|
static int32 i;
|
2022-05-06 04:00:36 +00:00
|
|
|
static double time_now = 100000;
|
|
|
|
while (1) {
|
|
|
|
quick_lock:
|
|
|
|
if (ontimerthread_lock == 1)
|
|
|
|
ontimerthread_lock = 2; // mutex, verify lock
|
|
|
|
if (!ontimerthread_lock) { // mutex
|
|
|
|
time_now = ((double)GetTicks()) * 0.001;
|
|
|
|
for (i = 0; i < ontimer_nextfree; i++) {
|
2023-01-09 08:33:23 +00:00
|
|
|
if (ontimer[i].allocated && ontimer[i].id && ontimer[i].active && !ontimer[i].state) {
|
|
|
|
if (!ontimer[i].last_time) {
|
|
|
|
ontimer[i].last_time = time_now;
|
|
|
|
} else if (time_now - ontimer[i].last_time > ontimer[i].seconds) {
|
|
|
|
// keep measured time for accurate
|
|
|
|
// number of calls overall
|
|
|
|
ontimer[i].last_time += ontimer[i].seconds;
|
|
|
|
|
|
|
|
// if difference between actual time and
|
|
|
|
// measured time is beyond 'seconds' set
|
|
|
|
// measured to actual
|
2023-10-07 06:05:13 +00:00
|
|
|
if (std::fabs(time_now -
|
2023-01-09 08:33:23 +00:00
|
|
|
ontimer[i].last_time) >=
|
|
|
|
ontimer[i].seconds)
|
|
|
|
ontimer[i].last_time = time_now;
|
|
|
|
ontimer[i].state = 1;
|
|
|
|
qbevent = 1;
|
|
|
|
} // time check
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
if (ontimerthread_lock == 1)
|
|
|
|
goto quick_lock;
|
|
|
|
} // i
|
|
|
|
} // not locked
|
2018-06-30 15:16:59 +00:00
|
|
|
Sleep(1);
|
2022-05-06 04:00:36 +00:00
|
|
|
if (stop_program) {
|
|
|
|
exit_ok |= 2;
|
|
|
|
return;
|
|
|
|
} // close thread #2
|
|
|
|
} // while(1)
|
2018-06-30 15:16:59 +00:00
|
|
|
return;
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void events() {
|
|
|
|
int32 i, x, d, di;
|
2018-06-30 15:16:59 +00:00
|
|
|
int64 i64;
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
// onstrig events
|
|
|
|
onstrig_recheck:
|
|
|
|
if (!error_handling) { // no new calls happen whilst error handling
|
|
|
|
di = 0;
|
|
|
|
for (d = 1; d <= device_last; d++) {
|
|
|
|
if (devices[d].type == 1) {
|
|
|
|
if (di <= 255) {
|
|
|
|
for (i = 0; i <= 255; i++) {
|
|
|
|
if (onstrig[(di << 8) + i].id) {
|
|
|
|
if (onstrig[(di << 8) + i].active ==
|
|
|
|
1) { // if STOPped, event will be postponed
|
|
|
|
if (onstrig[(di << 8) + i].state) {
|
|
|
|
if (!onstrig_inprogress) {
|
|
|
|
onstrig_inprogress = 1;
|
|
|
|
onstrig[(di << 8) + i].state--;
|
|
|
|
x = onstrig[(di << 8) + i].id;
|
|
|
|
i64 = onstrig[(di << 8) + i].pass;
|
|
|
|
switch (x) {
|
|
|
|
#include "../temp/onstrig.txt"
|
|
|
|
// example.....
|
|
|
|
// case 1:
|
|
|
|
//...
|
|
|
|
// break;
|
|
|
|
default:
|
2018-06-30 15:16:59 +00:00
|
|
|
break;
|
2022-05-06 04:00:36 +00:00
|
|
|
} // switch
|
|
|
|
onstrig_inprogress = 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
goto onstrig_recheck;
|
2022-05-06 04:00:36 +00:00
|
|
|
} //! inprogress
|
|
|
|
} // state
|
|
|
|
} // active==1
|
|
|
|
} // id
|
|
|
|
} // i
|
|
|
|
} // di<=255
|
2018-06-30 15:16:59 +00:00
|
|
|
di++;
|
2022-05-06 04:00:36 +00:00
|
|
|
} // type==1
|
|
|
|
} // d
|
|
|
|
} //! error_handling
|
|
|
|
|
|
|
|
// onkey events
|
|
|
|
onkey_recheck:
|
|
|
|
if (!error_handling) { // no new calls happen whilst error handling
|
|
|
|
for (i = 1; i <= 31; i++) {
|
|
|
|
if (onkey[i].id) {
|
|
|
|
if (onkey[i].active ==
|
|
|
|
1) { // if STOPped, event will be postponed
|
|
|
|
if (onkey[i].state) {
|
|
|
|
if (!onkey_inprogress) {
|
|
|
|
onkey_inprogress = 1;
|
2018-06-30 15:16:59 +00:00
|
|
|
onkey[i].state--;
|
2022-05-06 04:00:36 +00:00
|
|
|
x = onkey[i].id;
|
|
|
|
i64 = onkey[i].pass;
|
|
|
|
switch (x) {
|
|
|
|
#include "../temp/onkey.txt"
|
|
|
|
// example.....
|
|
|
|
// case 1:
|
|
|
|
//...
|
|
|
|
// break;
|
|
|
|
default:
|
2018-06-30 15:16:59 +00:00
|
|
|
break;
|
2022-05-06 04:00:36 +00:00
|
|
|
} // switch
|
|
|
|
onkey_inprogress = 0;
|
2018-06-30 15:16:59 +00:00
|
|
|
goto onkey_recheck;
|
2022-05-06 04:00:36 +00:00
|
|
|
} //! inprogress
|
|
|
|
} // state
|
|
|
|
} // active==1
|
|
|
|
} // id
|
|
|
|
} // i
|
|
|
|
} //! error_handling
|
|
|
|
|
|
|
|
// ontimer events
|
|
|
|
if (!error_handling) { // no new on timer calls happen whilst error handling
|
|
|
|
for (i = 0; i < ontimer_nextfree; i++) {
|
|
|
|
if (ontimer[i].allocated) {
|
|
|
|
if (ontimer[i].id) {
|
|
|
|
if (ontimer[i].active ==
|
|
|
|
1) { // if timer STOPped, event will be postponed
|
|
|
|
if (ontimer[i].state == 1) {
|
|
|
|
ontimer[i].state = 2; // event in progress
|
|
|
|
x = ontimer[i].id;
|
|
|
|
i64 = ontimer[i].pass;
|
|
|
|
switch (x) {
|
|
|
|
#include "../temp/ontimer.txt"
|
2022-11-26 23:11:04 +00:00
|
|
|
// example.....
|
|
|
|
// case 1:
|
|
|
|
//...
|
|
|
|
// break;
|
2022-05-06 04:00:36 +00:00
|
|
|
default:
|
2018-06-30 15:16:59 +00:00
|
|
|
break;
|
2022-05-06 04:00:36 +00:00
|
|
|
} // switch
|
|
|
|
ontimer[i].state = 0; // event finished
|
|
|
|
sleep_break = 1;
|
|
|
|
} // state==1
|
|
|
|
} // active==1
|
|
|
|
} // id
|
|
|
|
} // allocated
|
|
|
|
} // i
|
|
|
|
} //! error_handling
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
extern int64 display_lock_request;
|
|
|
|
extern int64 display_lock_confirmed;
|
|
|
|
extern int64 display_lock_released;
|
|
|
|
|
|
|
|
uint32 r;
|
2023-01-08 07:41:54 +00:00
|
|
|
void evnt(uint32 linenumber, uint32 inclinenumber, const char *incfilename) {
|
2022-05-06 04:00:36 +00:00
|
|
|
if (disableEvents)
|
|
|
|
return;
|
|
|
|
|
|
|
|
qbevent = 0;
|
|
|
|
|
|
|
|
if (sub_gl_called == 0) {
|
|
|
|
if (display_lock_request > display_lock_confirmed) {
|
|
|
|
display_lock_confirmed = display_lock_request;
|
|
|
|
while ((display_lock_released < display_lock_confirmed) &&
|
|
|
|
(!close_program) && (!suspend_program) && (!stop_program))
|
|
|
|
Sleep(1);
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
r = 0;
|
|
|
|
|
|
|
|
while (suspend_program || stop_program) {
|
|
|
|
if (stop_program)
|
|
|
|
end();
|
2018-06-30 15:16:59 +00:00
|
|
|
Sleep(10);
|
|
|
|
}
|
2022-05-06 04:00:36 +00:00
|
|
|
|
|
|
|
if (new_error) {
|
|
|
|
ercl = linenumber;
|
|
|
|
inclercl = inclinenumber;
|
|
|
|
includedfilename = (char *)incfilename;
|
2018-06-30 15:16:59 +00:00
|
|
|
fix_error();
|
2022-05-06 04:00:36 +00:00
|
|
|
if (error_retry) {
|
|
|
|
error_retry = 0;
|
|
|
|
r = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sub_gl_called == 0)
|
|
|
|
events();
|
2018-06-30 15:16:59 +00:00
|
|
|
}
|
2015-08-02 12:12:44 +00:00
|
|
|
}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
uint8 *redim_preserve_cmem_buffer =
|
|
|
|
(uint8 *)malloc(65536); // used for temporary storage only (move to libqbx?)
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
#include "myip.cpp"
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void division_by_zero_handler(int ignore) { error(11); }
|
2015-08-02 12:12:44 +00:00
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
// void SIGSEGV_handler(int ignore){
|
2015-08-02 12:12:44 +00:00
|
|
|
// error(256);//assume stack overflow? (the most likely cause)
|
|
|
|
//}
|
|
|
|
|
2022-05-06 04:00:36 +00:00
|
|
|
void QBMAIN(void *unused) {
|
2021-06-17 13:51:08 +00:00
|
|
|
fpu_reinit();
|
2022-05-06 04:00:36 +00:00
|
|
|
#ifdef QB64_WINDOWS
|
|
|
|
signal(SIGFPE, division_by_zero_handler);
|
|
|
|
// signal(SIGSEGV, SIGSEGV_handler);
|
|
|
|
#else
|
|
|
|
struct sigaction sig_act;
|
|
|
|
sig_act.sa_handler = division_by_zero_handler;
|
|
|
|
sigemptyset(&(sig_act.sa_mask));
|
|
|
|
sig_act.sa_flags = 0;
|
|
|
|
sigaction(SIGFPE, &sig_act, NULL);
|
|
|
|
#endif
|
2021-06-17 13:51:08 +00:00
|
|
|
|
2018-06-30 15:16:59 +00:00
|
|
|
ptrszint tmp_long;
|
|
|
|
int32 tmp_fileno;
|
2022-05-06 04:00:36 +00:00
|
|
|
qbs *tqbs;
|
|
|
|
uint32 qbs_tmp_base = qbs_tmp_list_nexti;
|
|
|
|
static mem_lock *sf_mem_lock = NULL;
|
|
|
|
if (!sf_mem_lock) {
|
|
|
|
new_mem_lock();
|
|
|
|
sf_mem_lock = mem_lock_tmp;
|
|
|
|
sf_mem_lock->type = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "../temp/maindata.txt"
|
|
|
|
#include "../temp/mainerr.txt"
|
|
|
|
#include "../temp/runline.txt"
|
|
|
|
if (timer_event_occurred) {
|
|
|
|
timer_event_occurred--;
|
|
|
|
#include "../temp/ontimerj.txt"
|
|
|
|
}
|
|
|
|
if (key_event_occurred) {
|
|
|
|
key_event_occurred--;
|
|
|
|
#include "../temp/onkeyj.txt"
|
|
|
|
}
|
|
|
|
if (strig_event_occurred) {
|
|
|
|
strig_event_occurred--;
|
|
|
|
#include "../temp/onstrigj.txt"
|
|
|
|
}
|
|
|
|
chain_input();
|
|
|
|
#include "../temp/main.txt"
|
|
|
|
|
|
|
|
//} (closed by main.txt)
|