improve readability
This commit is contained in:
parent
cea99d03df
commit
89683645da
|
@ -5,7 +5,7 @@
|
|||
|
||||
#include "msg.h"
|
||||
#include "display.h"
|
||||
|
||||
#include "ger.h"
|
||||
|
||||
void setup_display() {
|
||||
initscr(); // ncurses initialization
|
||||
|
@ -23,26 +23,26 @@ void cleanup_display() {
|
|||
uint32_t height; // normally 25, may vary
|
||||
char *image; // dimension is width x height
|
||||
*/
|
||||
static void print_current_image(const struct message* msg, int start, int end) {
|
||||
statisch nichts print_current_image(konstant struktur message* msg, zahl start, zahl end) {
|
||||
end = 80; // end is ignored and 80 is used, should be handled properly later
|
||||
|
||||
//move(0,0); // start in the upper left corner
|
||||
char *pic = msg->image; // get a ptr to the actual image
|
||||
zeichen *pic = msg->image; // get a ptr to the actual image
|
||||
|
||||
for (int row=0; row < 25; row++) { // iterate over rows
|
||||
char *original_line = pic + row * msg->width; // pointer to the start of the line to print
|
||||
char *line = (char*) malloc(end-start+1); // allocate a line because we modify it
|
||||
fuer (zahl row=0; row < 25; row++) { // iterate over rows
|
||||
zeichen *original_line = pic + row * msg->width; // pointer to the start of the line to print
|
||||
zeichen *line = (zeichen*) reserviere(end-start+1); // allocate a line because we modify it
|
||||
strcpy(line, original_line + start); // get a line from the right start
|
||||
line[end-start] = '\0'; // terminate it
|
||||
|
||||
mvprintw(row, 0, "%s", line); // print it
|
||||
free(line); // free it
|
||||
befreie(line); // free it
|
||||
}
|
||||
|
||||
refresh(); // refresh the screen
|
||||
|
||||
}
|
||||
|
||||
|
||||
void prntscreen(const struct message *msg, const struct prog_info *pinfo);
|
||||
|
||||
void callback(const struct message *msg, const struct prog_info *pinfo) {
|
||||
|
|
35
src/ger.h
Normal file
35
src/ger.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
#ifndef __GER
|
||||
#define __GER
|
||||
|
||||
#define wenn if
|
||||
#define sonst else
|
||||
#define fuer for
|
||||
#define waehrend while
|
||||
#define tue do
|
||||
|
||||
#define statisch static
|
||||
#define konstant const
|
||||
#define struktur struct
|
||||
|
||||
#define nichts void
|
||||
#define wahrheitswert bool
|
||||
#define zeichen char
|
||||
#define kurz short
|
||||
#define zahl int
|
||||
#define lang long
|
||||
#define fliess float
|
||||
#define doppel double
|
||||
|
||||
#define wahr true
|
||||
#define falsch false
|
||||
|
||||
#define zurueckliefern return
|
||||
#define haupt main
|
||||
#define druckenf printf
|
||||
#define schlaf sleep
|
||||
#define uschlaf usleep
|
||||
#define reserviere malloc
|
||||
#define befreie free
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user