ING_DB
This commit is contained in:
parent
b51ff19095
commit
f4d49cdc07
|
|
@ -0,0 +1,128 @@
|
||||||
|
# include <stdio.h>
|
||||||
|
# include "cursor.h"
|
||||||
|
|
||||||
|
static int blinking_on;
|
||||||
|
static int revers_on;
|
||||||
|
static int underline_on;
|
||||||
|
static int bold_on;
|
||||||
|
static int cursor_on;
|
||||||
|
|
||||||
|
|
||||||
|
on_blinking()
|
||||||
|
{
|
||||||
|
if (blinking_on++)
|
||||||
|
return;
|
||||||
|
printf(ON_BLINKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_blinking()
|
||||||
|
{
|
||||||
|
if (--blinking_on)
|
||||||
|
return;
|
||||||
|
printf(OFF_BLINKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
on_revers()
|
||||||
|
{
|
||||||
|
if (revers_on++)
|
||||||
|
return;
|
||||||
|
printf(ON_REVERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_revers()
|
||||||
|
{
|
||||||
|
if (--revers_on)
|
||||||
|
return;
|
||||||
|
printf(OFF_REVERS);
|
||||||
|
}
|
||||||
|
|
||||||
|
on_underline()
|
||||||
|
{
|
||||||
|
if (underline_on++)
|
||||||
|
return;
|
||||||
|
printf(ON_UNDERLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_underline()
|
||||||
|
{
|
||||||
|
if (--underline_on)
|
||||||
|
return;
|
||||||
|
printf(OFF_UNDERLINE);
|
||||||
|
}
|
||||||
|
|
||||||
|
on_bold()
|
||||||
|
{
|
||||||
|
if (bold_on++)
|
||||||
|
return;
|
||||||
|
printf(ON_BOLD);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_bold()
|
||||||
|
{
|
||||||
|
if (--bold_on)
|
||||||
|
return;
|
||||||
|
printf(OFF_BOLD);
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor(line, col)
|
||||||
|
register int line;
|
||||||
|
register int col;
|
||||||
|
{
|
||||||
|
printf(CURSOR, line, col);
|
||||||
|
}
|
||||||
|
|
||||||
|
on_cursor()
|
||||||
|
{
|
||||||
|
if (cursor_on++)
|
||||||
|
return;
|
||||||
|
printf(ON_CURSOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
off_cursor()
|
||||||
|
{
|
||||||
|
if (--cursor_on)
|
||||||
|
return;
|
||||||
|
printf(OFF_CURSOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
cls(line1, col1, line2, col2)
|
||||||
|
register int line1;
|
||||||
|
register int col1;
|
||||||
|
register int line2;
|
||||||
|
register int col2;
|
||||||
|
{
|
||||||
|
printf(CLS, line1, col1, line2, col2);
|
||||||
|
}
|
||||||
|
|
||||||
|
box(line1, col1, line2, col2)
|
||||||
|
int line1;
|
||||||
|
int col1;
|
||||||
|
int line2;
|
||||||
|
int col2;
|
||||||
|
{
|
||||||
|
register int l;
|
||||||
|
register int c;
|
||||||
|
|
||||||
|
cls(line1, col1, line2, col2);
|
||||||
|
off_cursor();
|
||||||
|
on_revers();
|
||||||
|
on_blinking();
|
||||||
|
|
||||||
|
for (l = line1; l <= line2; l++)
|
||||||
|
{
|
||||||
|
cursor(l, col1);
|
||||||
|
if (l == line1 || l == line2)
|
||||||
|
for (c = col1; c <= col2; c++)
|
||||||
|
putchar(' ');
|
||||||
|
else
|
||||||
|
{
|
||||||
|
putchar(' ');
|
||||||
|
cursor(l, col2);
|
||||||
|
putchar(' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
off_blinking();
|
||||||
|
off_revers();
|
||||||
|
on_cursor();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,61 @@
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
# define PR_BGN 15
|
||||||
|
# define PR_END 25
|
||||||
|
|
||||||
|
static int print;
|
||||||
|
static int abort;
|
||||||
|
|
||||||
|
pr_init()
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
abort = 0;
|
||||||
|
for (i = PR_BGN; i < PR_END; i++)
|
||||||
|
cls(i, 1, i, 47);
|
||||||
|
cursor(print = PR_BGN, 1);
|
||||||
|
on_bold();
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_line()
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
|
||||||
|
if (print == PR_END)
|
||||||
|
{
|
||||||
|
print = PR_BGN;
|
||||||
|
if (go_on())
|
||||||
|
{
|
||||||
|
abort = 1;
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
for (i = PR_BGN; i < PR_END; i++)
|
||||||
|
cls(i, 1, i, 47);
|
||||||
|
}
|
||||||
|
cursor(print, 1);
|
||||||
|
print++;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
pr_end()
|
||||||
|
{
|
||||||
|
if (!abort)
|
||||||
|
go_on();
|
||||||
|
off_bold();
|
||||||
|
cls(24, 48, 24, 80);
|
||||||
|
}
|
||||||
|
|
||||||
|
static go_on()
|
||||||
|
{
|
||||||
|
register int c;
|
||||||
|
|
||||||
|
cursor(24, 48);
|
||||||
|
on_revers();
|
||||||
|
printf("continue<eof>/abort<enter>");
|
||||||
|
off_revers();
|
||||||
|
printf(" ");
|
||||||
|
fflush(stdout);
|
||||||
|
while ((c = getchar()) > 0 && c != '\n')
|
||||||
|
continue;
|
||||||
|
return (c > 0);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,204 @@
|
||||||
|
# include <stdio.h>
|
||||||
|
|
||||||
|
struct cmd
|
||||||
|
{
|
||||||
|
char *cmd_msg;
|
||||||
|
int (*cmd_func)();
|
||||||
|
};
|
||||||
|
|
||||||
|
extern int relclose();
|
||||||
|
extern int new_name();
|
||||||
|
extern int new_vorname();
|
||||||
|
extern int new_ort();
|
||||||
|
extern int new_str();
|
||||||
|
extern int new_bank();
|
||||||
|
extern int new_kunde();
|
||||||
|
extern int new_konto();
|
||||||
|
extern int new_grund();
|
||||||
|
extern int new_buchung();
|
||||||
|
extern int auszug();
|
||||||
|
extern int auszuege();
|
||||||
|
extern int mahnung();
|
||||||
|
|
||||||
|
struct cmd Cmd[] =
|
||||||
|
{
|
||||||
|
"Ende", relclose,
|
||||||
|
"Eingabe Vorname", new_vorname,
|
||||||
|
"Eingabe Name", new_name,
|
||||||
|
"Eingabe Strasse", new_str,
|
||||||
|
"Eingabe Ort", new_ort,
|
||||||
|
"Eingabe Grund", new_grund,
|
||||||
|
"Eingabe Bank", new_bank,
|
||||||
|
"Eingabe Kunde", new_kunde,
|
||||||
|
"Eingabe Konto", new_konto,
|
||||||
|
"Eingabe Buchung", new_buchung,
|
||||||
|
"Ausgabe Kontoauszug", auszug,
|
||||||
|
"Ausgabe Kontoauszuege", auszuege,
|
||||||
|
"Mahnungen", mahnung,
|
||||||
|
};
|
||||||
|
int Cmds = sizeof Cmd / sizeof (struct cmd);
|
||||||
|
|
||||||
|
|
||||||
|
menue()
|
||||||
|
{
|
||||||
|
register struct cmd *c;
|
||||||
|
register int i;
|
||||||
|
char buf[36];
|
||||||
|
|
||||||
|
try_again:
|
||||||
|
cls(1, 1, 24, 80);
|
||||||
|
box(1, 48, Cmds + 4, 80);
|
||||||
|
on_underline();
|
||||||
|
cursor(2, 54);
|
||||||
|
printf(" ");
|
||||||
|
off_underline();
|
||||||
|
for (i = 0, c = Cmd; i < Cmds; i++, c++)
|
||||||
|
{
|
||||||
|
cursor(i + 3, 50);
|
||||||
|
on_revers();
|
||||||
|
printf("%2d", i);
|
||||||
|
off_revers();
|
||||||
|
printf(" ");
|
||||||
|
on_underline();
|
||||||
|
printf(" %-23s", c->cmd_msg);
|
||||||
|
off_underline();
|
||||||
|
}
|
||||||
|
|
||||||
|
cursor(1, 1);
|
||||||
|
on_revers();
|
||||||
|
printf(" \n");
|
||||||
|
printf(" Auswahl \n");
|
||||||
|
printf(" Vorname \n");
|
||||||
|
printf(" Name \n");
|
||||||
|
printf(" Strasse \n");
|
||||||
|
printf(" Ort \n");
|
||||||
|
printf(" PLZ \n");
|
||||||
|
printf(" Grund \n");
|
||||||
|
printf(" Plus \n");
|
||||||
|
printf(" Bank \n");
|
||||||
|
printf(" Konto \n");
|
||||||
|
printf(" Betrag \n");
|
||||||
|
printf(" ");
|
||||||
|
off_revers();
|
||||||
|
input(2, buf);
|
||||||
|
if ((i = atoi(buf)) >= Cmds)
|
||||||
|
{
|
||||||
|
error("ungueltige Auswahl");
|
||||||
|
goto try_again;
|
||||||
|
}
|
||||||
|
cls(25, 1, 25, 80);
|
||||||
|
c = &Cmd[i];
|
||||||
|
on_revers();
|
||||||
|
on_blinking();
|
||||||
|
cursor(i + 3, 50);
|
||||||
|
printf("%2d", i);
|
||||||
|
off_blinking();
|
||||||
|
off_revers();
|
||||||
|
(*c->cmd_func)();
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
cls(1, 1, 25, 80);
|
||||||
|
cursor(1, 1);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
new_datum()
|
||||||
|
{
|
||||||
|
extern long datum;
|
||||||
|
extern long time();
|
||||||
|
|
||||||
|
time(&datum);
|
||||||
|
}
|
||||||
|
|
||||||
|
input(line, buf)
|
||||||
|
int line;
|
||||||
|
char *buf;
|
||||||
|
{
|
||||||
|
register int len;
|
||||||
|
register int c;
|
||||||
|
register char *p;
|
||||||
|
|
||||||
|
cursor(line, 1);
|
||||||
|
on_revers();
|
||||||
|
on_blinking();
|
||||||
|
putchar(' ');
|
||||||
|
cursor(line, 11);
|
||||||
|
putchar(' ');
|
||||||
|
off_blinking();
|
||||||
|
off_revers();
|
||||||
|
cls(line, 13, line, 47);
|
||||||
|
cursor(line, 13);
|
||||||
|
on_cursor();
|
||||||
|
fflush(stdout);
|
||||||
|
p = buf;
|
||||||
|
len = 36;
|
||||||
|
while (--len)
|
||||||
|
{
|
||||||
|
if ((c = getchar()) <= 0 || c == '\n')
|
||||||
|
break;
|
||||||
|
*p++ = c;
|
||||||
|
}
|
||||||
|
*p = 0;
|
||||||
|
if (c > 0 && c != '\n')
|
||||||
|
{
|
||||||
|
cls(24, 1, 24, 80);
|
||||||
|
cursor(24, 1);
|
||||||
|
while ((c = getchar()) > 0 && c != '\n')
|
||||||
|
continue;
|
||||||
|
cls(24, 1, 24, 80);
|
||||||
|
}
|
||||||
|
off_cursor();
|
||||||
|
cursor(line, 1);
|
||||||
|
on_revers();
|
||||||
|
putchar(' ');
|
||||||
|
cursor(line, 11);
|
||||||
|
putchar(' ');
|
||||||
|
off_revers();
|
||||||
|
return (p - buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
error(msg)
|
||||||
|
register char *msg;
|
||||||
|
{
|
||||||
|
register int i;
|
||||||
|
extern short Batch;
|
||||||
|
|
||||||
|
on_revers();
|
||||||
|
on_blinking();
|
||||||
|
if (!Batch)
|
||||||
|
{
|
||||||
|
cursor(25, 1);
|
||||||
|
for (i = 1; i <= 79; i++)
|
||||||
|
putchar(' ');
|
||||||
|
cursor(25, 15);
|
||||||
|
}
|
||||||
|
printf("%s", msg);
|
||||||
|
if (Batch)
|
||||||
|
putchar('\n');
|
||||||
|
off_blinking();
|
||||||
|
off_revers();
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct byte
|
||||||
|
{
|
||||||
|
char byte0;
|
||||||
|
char byte1;
|
||||||
|
char byte2;
|
||||||
|
char byte3;
|
||||||
|
};
|
||||||
|
|
||||||
|
hash_konto(konto)
|
||||||
|
register struct byte *konto;
|
||||||
|
{
|
||||||
|
char b0;
|
||||||
|
char b1;
|
||||||
|
|
||||||
|
b0 = konto->byte0;
|
||||||
|
b1 = konto->byte1;
|
||||||
|
konto->byte0 = konto->byte3;
|
||||||
|
konto->byte1 = konto->byte2;
|
||||||
|
konto->byte2 = b1;
|
||||||
|
konto->byte3 = b0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue