runtime: Various changes to isolate QT build from the rest

Being able to isolate parts that actually use QT is important
to build other platforms.
This commit is contained in:
Christophe de Dinechin 2024-03-03 13:57:06 +01:00
parent c62430ce20
commit 4fc7e9c5b3
25 changed files with 71 additions and 56 deletions

View file

@ -104,7 +104,7 @@ DEFINES += SIMULATOR CONFIG_FIXED_BASED_OBJECTS
debug:DEFINES += DEBUG
# For DMCP headers
DEFINES += __packed=
DEFINES += __packed= USE_QT
macx:DEFINES += _WCHAR_T_DEFINED
# COnfigure Intel Decimal Floating Point Library

View file

@ -31,21 +31,23 @@
#include "dmcp_fonts.c"
#include "recorder.h"
#include "sim-rpl.h"
#include "sim-screen.h"
#include "sim-window.h"
#include "target.h"
#include "types.h"
#include <iostream>
#include <QFileDialog>
#include <QSettings>
#include <stdarg.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <target.h>
#ifdef USE_QT
#include "sim-rpl.h"
#include "sim-screen.h"
#include "sim-window.h"
#include <QFileDialog>
#include <QSettings>
#endif // USE_QT
#pragma GCC diagnostic ignored "-Wunused-parameter"
@ -63,6 +65,9 @@ RECORDER(lcd_warning, 64, "Warnings from lcd/display functions");
#undef ppgm_fp
extern volatile uint keysync_sent;
extern volatile uint keysync_done;
volatile int lcd_needsupdate = 0;
int lcd_buf_cleared = 0;
uint8_t lcd_buffer[LCD_SCANLINE * LCD_H / 8];
@ -113,7 +118,9 @@ int create_screenshot(int report_error)
{
record(dmcp_notyet,
"create_screenshot(%d) not implemented", report_error);
#ifdef USE_QT
MainWindow::screenshot();
#endif
return 0;
}
@ -271,7 +278,9 @@ int key_push(int k)
k, keywr, keyrd,
shiftHeld ? altHeld ? "Shift+Alt" : "Shift"
: altHeld ? "Alt" : "None");
#ifdef USE_QT
MainWindow::theMainWindow()->pushKey(k);
#endif
if (keywr - keyrd < nkeys)
keys[keywr++ % nkeys] = k;
else
@ -766,7 +775,9 @@ int sys_free_mem()
void sys_delay(uint32_t ms_delay)
{
#ifdef USE_QT
QThread::msleep(ms_delay);
#endif
}
static struct timer
@ -783,7 +794,9 @@ void sys_sleep()
for (int i = 0; i < 4; i++)
if (timers[i].enabled && int(timers[i].deadline - now) < 0)
return;
#ifdef USE_QT
QThread::msleep(20);
#endif
}
CLR_ST(STAT_SUSPENDED | STAT_OFF | STAT_PGM_END);
}
@ -850,6 +863,7 @@ int file_selection_screen(const char *title,
if (*base_dir == '/' || *base_dir == '\\')
base_dir++;
#ifdef USE_QT
QString path;
bool done = false;
@ -881,6 +895,8 @@ int file_selection_screen(const char *title,
ret = sel_fn(path.toStdString().c_str(),
name.toStdString().c_str(),
data);
#endif
return ret;
}
@ -956,8 +972,10 @@ void disp_disk_info(const char *hdr)
void set_reset_state_file(const char * str)
{
#ifdef USE_QT
QSettings settings;
settings.setValue("state", str);
#endif // USE_QT
record(dmcp, "Setting saved state: %s", str);
}
@ -965,11 +983,13 @@ void set_reset_state_file(const char * str)
char *get_reset_state_file()
{
static char result[256];
result[0] = 0;
#ifdef USE_QT
QSettings settings;
QString file = settings.value("state").toString();
result[0] = 0;
if (!file.isNull())
strncpy(result, file.toStdString().c_str(), sizeof(result));
#endif // USE_QT
record(dmcp, "Saved state: %+s", result);
return result;
}

View file

@ -27,8 +27,8 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#include <dmcp.h>
#include <types.h>
#include "dmcp.h"
#include "types.h"
uint8_t lib_mono_10x17_data[] =
{

View file

@ -28,8 +28,9 @@
// ****************************************************************************
#include "sim-rpl.h"
#include "dmcp.h"
#include "tests.h"
#include <dmcp.h>
extern int key_remaining();

View file

@ -29,10 +29,11 @@
#include "sim-screen.h"
#include "dmcp.h"
#include <QBitmap>
#include <QGraphicsPixmapItem>
#include <QTimer>
#include <dmcp.h>
#include <target.h>

View file

@ -27,23 +27,23 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#include <QtGui>
#include <QtCore>
#include <QFileDialog>
#include <QFile>
#include <QFileInfo>
#include <QMessageBox>
#include <QKeyEvent>
#include <QStandardPaths>
#include <dmcp.h>
#include <target.h>
#include "sim-window.h"
#include "sim-rpl.h"
#include "ui_sim-window.h"
#include "dmcp.h"
#include "recorder.h"
#include "sim-rpl.h"
#include "tests.h"
#include "ui_sim-window.h"
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QKeyEvent>
#include <QMessageBox>
#include <QStandardPaths>
#include <QtCore>
#include <QtGui>
#include <target.h>
RECORDER(sim_keys, 16, "Recorder keys from the simulator");

View file

@ -32,6 +32,7 @@
#include "arithmetic.h"
#include "bignum.h"
#include "decimal.h"
#include "dmcp.h"
#include "fraction.h"
#include "integer.h"
#include "parser.h"
@ -49,7 +50,6 @@
#include "version.h"
#include <ctype.h>
#include <dmcp.h>
#include <stdio.h>
RECORDER(command, 16, "RPL Commands");

View file

@ -31,10 +31,9 @@
#include "algebraic.h"
#include "command.h"
#include "dmcp.h"
#include "types.h"
#include <dmcp.h>
// Convert time and date to their components
bool to_time(object_p time, tm_t &tm, bool error = true);

View file

@ -1,4 +1,4 @@
#define QSPI_DATA_SIZE 223708
#define QSPI_DATA_SIZE 223724
#define QSPI_DATA_CRC 0x000cfed6

View file

@ -1,4 +1,4 @@
#define QSPI_DATA_SIZE 223276
#define QSPI_DATA_SIZE 223292
#define QSPI_DATA_CRC 0x000cfed6

View file

@ -31,9 +31,9 @@
#include "main.h"
#include "blitter.h"
#include "dmcp.h"
#include "expression.h"
#include "font.h"
#include "num.h"
#include "program.h"
#include "recorder.h"
#include "stack.h"
@ -46,13 +46,13 @@
# include "tests.h"
#endif
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <dmcp.h>
using std::max;
using std::min;
@ -383,7 +383,8 @@ extern "C" void program_main()
}
if (key == tests::KEYSYNC)
{
record(main, "Key sync done %u from %u", keysync_sent, keysync_done);
record(main, "Key sync done %u from %u",
keysync_sent, keysync_done);
redraw_lcd(true);
keysync_done = keysync_sent;
key = 0;

View file

@ -29,6 +29,7 @@
#include "sysmenu.h"
#include "dmcp.h"
#include "file.h"
#include "main.h"
#include "object.h"
@ -43,8 +44,6 @@
#include "variables.h"
#include <cstdio>
#include <dmcp.h>
// ============================================================================

View file

@ -32,7 +32,7 @@
#include "types.h"
extern "C" {
#include <dmcp.h>
#include "dmcp.h"
}
enum menu_item

View file

@ -30,7 +30,7 @@
// ****************************************************************************
#include "blitter.h"
#include <dmcp.h>
#include "dmcp.h"
enum target
// ----------------------------------------------------------------------------

View file

@ -29,9 +29,9 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#include "dmcp.h"
#include "types.h"
#include <dmcp.h>
#include <stdio.h>

View file

@ -30,14 +30,13 @@
#include "files.h"
#include "array.h"
#include "dmcp.h"
#include "file.h"
#include "list.h"
#include "program.h"
#include "runtime.h"
#include "settings.h"
#include <dmcp.h>
// ============================================================================
//

View file

@ -29,12 +29,12 @@
#include "font.h"
#include "dmcp.h"
#include "parser.h"
#include "recorder.h"
#include "renderer.h"
#include "runtime.h"
#include <dmcp.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -33,9 +33,7 @@
#include "menu.h"
#include "renderer.h"
#include "target.h"
#include <types.h>
#include "types.h"
struct renderer;

View file

@ -30,8 +30,7 @@
// ****************************************************************************
#include "command.h"
#include <dmcp.h>
#include "dmcp.h"
COMMAND(Dup)
// ----------------------------------------------------------------------------

View file

@ -30,6 +30,7 @@
#include "stack.h"
#include "blitter.h"
#include "dmcp.h"
#include "grob.h"
#include "renderer.h"
#include "runtime.h"
@ -38,8 +39,6 @@
#include "user_interface.h"
#include "utf8.h"
#include <dmcp.h>
stack Stack;

View file

@ -29,13 +29,13 @@
#include "tests.h"
#include "dmcp.h"
#include "recorder.h"
#include "settings.h"
#include "stack.h"
#include "types.h"
#include "user_interface.h"
#include <dmcp.h>
#include <regex.h>
#include <stdio.h>

View file

@ -29,11 +29,11 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// ****************************************************************************
#include "dmcp.h"
#include "object.h"
#include "runtime.h"
#include "target.h"
#include <dmcp.h>
#include <sstream>
#include <string>
#include <vector>

View file

@ -32,6 +32,7 @@
#include "arithmetic.h"
#include "blitter.h"
#include "command.h"
#include "dmcp.h"
#include "functions.h"
#include "list.h"
#include "menu.h"
@ -51,7 +52,6 @@
#endif // SIMULATOR
#include <ctype.h>
#include <dmcp.h>
#include <stdio.h>
#include <unistd.h>
#include <wctype.h>

View file

@ -30,13 +30,13 @@
// ****************************************************************************
#include "blitter.h"
#include "dmcp.h"
#include "file.h"
#include "object.h"
#include "runtime.h"
#include "text.h"
#include "types.h"
#include <dmcp.h>
#include <string>
#include <vector>

View file

@ -29,11 +29,10 @@
#include "util.h"
#include "dmcp.h"
#include "program.h"
#include "settings.h"
#include "target.h"
#include "program.h"
#include <dmcp.h>
void invert_screen()