mirror of
https://github.com/livingcomputermuseum/UniBone.git
synced 2026-01-27 20:37:36 +00:00
Reworked inputline()
This commit is contained in:
@@ -58,8 +58,8 @@ using namespace std;
|
||||
#include "logger.hpp"
|
||||
|
||||
#include "getopt2.hpp"
|
||||
#include "inputline.h"
|
||||
#include "kbhit.h"
|
||||
#include "inputline.hpp"
|
||||
#include "pru.hpp"
|
||||
#include "mailbox.h"
|
||||
#include "gpios.hpp"
|
||||
@@ -72,6 +72,10 @@ using namespace std;
|
||||
#include "logger.hpp"
|
||||
#include "application.hpp" // own
|
||||
|
||||
// Singleton
|
||||
application_c *app;
|
||||
|
||||
|
||||
application_c::application_c() {
|
||||
log_label = "APP";
|
||||
}
|
||||
@@ -287,10 +291,10 @@ int application_c::run(int argc, char *argv[]) {
|
||||
FATAL("%s must be run as root to use prussdrv\n", argv[0]);
|
||||
}
|
||||
|
||||
inputline_init();
|
||||
inputline.init();
|
||||
if (!opt_cmdfilename.empty()) {
|
||||
// read commands from file
|
||||
if (!inputline_fopen((char*) opt_cmdfilename.c_str())) {
|
||||
if (!inputline.openfile((char*) opt_cmdfilename.c_str())) {
|
||||
printf("%s\n",
|
||||
fileErrorText("Could not open command file \"%s\"",
|
||||
opt_cmdfilename.c_str()));
|
||||
@@ -316,8 +320,6 @@ int application_c::run(int argc, char *argv[]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Singleton
|
||||
application_c *app;
|
||||
|
||||
/* construct all singletons in proper order
|
||||
*/
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
|
||||
#include "logsource.hpp"
|
||||
#include "getopt2.hpp"
|
||||
#include "inputline.hpp"
|
||||
#include "pru.hpp"
|
||||
#include "parameter.hpp"
|
||||
#include "unibus.h"
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
unsigned opt_linewidth = 80;
|
||||
string opt_cmdfilename;
|
||||
getopt_c getopt_parser;
|
||||
inputline_c inputline ;
|
||||
void help(void);
|
||||
void commandline_error(void);
|
||||
void commandline_option_error(char *errtext, ...);
|
||||
@@ -110,5 +112,8 @@ public:
|
||||
|
||||
};
|
||||
|
||||
extern application_c *app; // Singleton
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -287,7 +287,7 @@ $(OBJDIR)/stringgrid.o : $(COMMON_SRC_DIR)/stringgrid.cpp $(COMMON_SRC_DIR)/str
|
||||
$(OBJDIR)/mcout.o : $(COMMON_SRC_DIR)/mcout.c $(COMMON_SRC_DIR)/mcout.h
|
||||
$(CC) $(CCFLAGS) -xc++ $< -o $@
|
||||
|
||||
$(OBJDIR)/inputline.o : $(COMMON_SRC_DIR)/inputline.c $(COMMON_SRC_DIR)/inputline.h
|
||||
$(OBJDIR)/inputline.o : $(COMMON_SRC_DIR)/inputline.cpp $(COMMON_SRC_DIR)/inputline.hpp
|
||||
$(CC) $(CCFLAGS) -xc++ $< -o $@
|
||||
|
||||
$(OBJDIR)/kbhit.o : $(COMMON_SRC_DIR)/kbhit.c $(COMMON_SRC_DIR)/kbhit.h
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
#include "pru.hpp"
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
#include "stringgrid.hpp"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <linux/limits.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
|
||||
#include "application.hpp" // own
|
||||
@@ -503,7 +503,7 @@ void application_c::menu_devices(bool with_CPU) {
|
||||
}
|
||||
if (!str_decode_escapes(buff, sizeof(buff), s)) {
|
||||
printf("Error in escape sequences.\n");
|
||||
inputline_init();
|
||||
inputline.init();
|
||||
continue;
|
||||
}
|
||||
timeout.wait_ms(wait_ms);
|
||||
@@ -521,7 +521,7 @@ void application_c::menu_devices(bool with_CPU) {
|
||||
char buff[256];
|
||||
if (!str_decode_escapes(buff, sizeof(buff), s_param[2])) {
|
||||
printf("Error in escape sequences.\n");
|
||||
inputline_init();
|
||||
inputline.init();
|
||||
continue;
|
||||
}
|
||||
// while waiting echo to stdout, for diag
|
||||
@@ -536,7 +536,7 @@ void application_c::menu_devices(bool with_CPU) {
|
||||
printf(
|
||||
"\nPDP-11 did not xmt \"%s\" over DL11 within %u ms, aborting script\n",
|
||||
s_param[2], ms);
|
||||
inputline_init();
|
||||
inputline.init();
|
||||
}
|
||||
} else {
|
||||
printf("Unknown DL11 command \"%s\"!\n", s_choice);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "application.hpp" // own
|
||||
#include "pru.hpp"
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <unistd.h>
|
||||
#include <limits.h> // PATH_MAX
|
||||
|
||||
#include "inputline.h"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
|
||||
@@ -150,7 +149,7 @@ void application_c::menu_masterslave(enum unibus_c::arbitration_mode_enum arbitr
|
||||
if (!strcasecmp(s_opcode, "q")) {
|
||||
ready = true;
|
||||
} else if (!strcasecmp(s_opcode, "<")) {
|
||||
if (inputline_fopen(s_param[0]))
|
||||
if (inputline.openfile(s_param[0]))
|
||||
printf("Now executing command from file \"%s\"\n", s_param[0]);
|
||||
else
|
||||
printf("%s\n", fileErrorText("Error opening command file \"%s\"!", s_param[0]));
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "utils.hpp"
|
||||
#include "inputline.h"
|
||||
#include "mcout.h"
|
||||
#include "application.hpp" // own
|
||||
#include "pru.hpp"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "inputline.h"
|
||||
#include "inputline.hpp"
|
||||
#include "stringgrid.hpp"
|
||||
|
||||
#include "unibus.h"
|
||||
@@ -138,7 +138,7 @@ char *application_c::getchoice(void) {
|
||||
|
||||
do {
|
||||
printf("\n");
|
||||
inputline(s_choice, (int) sizeof(s_choice), ">>>");
|
||||
inputline.readline(s_choice, (int) sizeof(s_choice), ">>>");
|
||||
//char *s;
|
||||
// do {
|
||||
// s_choice[0] = '\0'; // empty buffer.
|
||||
|
||||
Reference in New Issue
Block a user