1
0
mirror of https://github.com/rricharz/Tek4010.git synced 2026-05-13 18:24:05 +00:00

-wait n argument added

This commit is contained in:
Rene Richarz
2023-10-18 10:15:10 +02:00
parent 656d078fb6
commit 80276bf4d2
5 changed files with 38 additions and 3 deletions

View File

@@ -366,6 +366,9 @@ tek4010 has the following options:
-hidecursor hides the cursor. Do not set while using GIN mode.
-wait n Close window n seconds after completion of "command".
It does not make sense to use -noexit together with -wait.
**APL mode**
If tek4010 is called with the -APL argument, a Tektronix 4013 and Tektronix 4015 is emulated

BIN
tek4010

Binary file not shown.

31
tube.c
View File

@@ -82,6 +82,7 @@ int argAPL = 0;
int argAutoClear = 0;
int argKeepSize = 0;
int argHideCursor = 0;
int argWait = 0;
int refresh_interval; // after this time in msec next refresh is done
@@ -119,6 +120,7 @@ static int currentFontSize = 18;
static int currentCharacterOffset = 0;
long startPaintTime;
long firstWait;
int leftmargin;
@@ -288,7 +290,7 @@ void tube_init(int argc, char* argv[])
char *argv2[20];
size_t bufsize = 127;
int firstArg = 1;
printf("tek4010 version 1.6\n");
printf("tek4010 version 1.7\n");
windowName = "Tektronix 4010/4014 emulator";
if ((argc<2) || (argc>19)) {
printf("Error:number of arguments\n");
@@ -301,7 +303,7 @@ void tube_init(int argc, char* argv[])
argc--;
}
while ((argv[firstArg][0] == '-') && firstArg < argc-1) {
while ((argv[firstArg][0] == '-') && (firstArg < argc-1)) {
if (strcmp(argv[firstArg],"-raw") == 0)
argRaw = 1;
else if (strcmp(argv[firstArg],"-noexit") == 0)
@@ -346,6 +348,17 @@ void tube_init(int argc, char* argv[])
argARDS = 1;
windowName = "ARDS emulator";
}
else if (strcmp(argv[firstArg],"-wait") == 0) {
argWait = 3;
if (firstArg < argc-2) {
if ((argv[firstArg+1][0] >= '0') &&
(argv[firstArg+1][0] <= '9')) {
firstArg++;
argWait = atoi(argv[firstArg]);
}
}
// printf("Waiting %d seconds after end of plot\n", argWait);
}
else {
printf("tek4010: unknown argument %s\n", argv[firstArg]);
exit(1);
@@ -486,7 +499,19 @@ int tube_on_timer_event()
// is child process still running?
int status;
if ((!argNoexit) && (tube_isInput() == 0) && (waitpid(-1, &status, WNOHANG))) {
if (argWait) {
if (firstWait == 0)
firstWait = tube_mSeconds();
else {
if ((int)((tube_mSeconds() - firstWait) / 1000) > argWait) {
tube_quit();
gtk_main_quit();
printf("Process has been terminated after %d seconds\n", argWait);
exit(0);
}
}
}
else if ((!argNoexit) && (tube_isInput() == 0) && (waitpid(-1, &status, WNOHANG))) {
long t = tube_mSeconds();
// printf("Execution time: %0.3f sec\n", (double)t/1000.0);
// if (t > 0) {

1
tube.h
View File

@@ -20,6 +20,7 @@ extern int argAPL;
extern int argAutoClear;
extern int argKeepSize;
extern int argHideCursor;
extern int argWait;
extern int hDotsPerChar;
extern int vDotsPerChar;

View File

@@ -168,3 +168,9 @@ New features:
- Added versions.txt
Bug fixes:
- fixed demo.sh to display dodekagon.plt instead of captured_data
Version 1.7 October 18, 2023
============================
Added -wait n seconds as argument, staying alive n seconds after
completion.