remove implicit extern declarations -- thanks to adc! - gramscii - A simple editor for ASCII box-and-arrow charts DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 46f92bb4c29351797740e7fc0f3518a29950dc2d DIR parent 864ec4a6c5ef86273653af4eaab9315bd1b7bbca HTML Author: KatolaZ <katolaz@freaknet.org> Date: Mon, 27 Sep 2021 12:36:27 +0100 remove implicit extern declarations -- thanks to adc! Diffstat: M draw.c | 43 ++++++++++++++++++++++++++++++- M files.c | 10 ++++++++++ M gramscii.c | 55 +++++++++++++++++++++++++++++++ M gramscii.h | 53 ------------------------------ M lineset.c | 16 ++++++++++++++++ M screen.c | 49 +++++++++++++++++++++++++++++++ 6 files changed, 172 insertions(+), 54 deletions(-) --- DIR diff --git a/draw.c b/draw.c @@ -6,6 +6,46 @@ #include "gramscii.h" #include "config.h" +/** Extern declarations **/ + +extern int WIDTH, HEIGHT; +extern lineset_t screen; /* what is visualised */ +extern lineset_t cutbuf; /* cut/paste buffer */ +extern lineset_t *undo; /* undo list */ + +extern int undo_cur;/* undo position */ +extern int undo_lst;/* last valid undo position */ + + +extern int mode;/* mode */ +extern int dir;/* line direction */ +extern int step;/* current step */ +extern int x; +extern int y; +extern char corner; +extern char modified; /* set to 1 if screen modified since last save */ + +/* line and arrow markers */ +extern int cur_hl, cur_vl, cur_corn, cur_start, cur_end; +extern char line_h; +extern char line_v; +extern char mark_st; +extern char mark_end; + +/* number of available markers for each type */ +extern int hlines_sz; +extern int vlines_sz; +extern int corners_sz; +extern int stmarks_sz; +extern int endmarks_sz; + + +extern char autoend; /* set to 1 in auto-arrow mode */ + +/* Used by draw_arrow to identify the bounding box */ +extern int a_miny; +extern int a_maxy; + /*** drawing-related functions ***/ /*** Lines and markers ***/ @@ -680,6 +720,7 @@ void redo_change(){ void get_comment(FILE *fc){ char c; redraw(); - while((c = fgetc(fc)) != EOF && c != '\n'); + while((c = fgetc(fc)) != EOF && c != '\n'); mode = MOVE; } + DIR diff --git a/files.c b/files.c @@ -5,6 +5,16 @@ #include "gramscii.h" +/** extern declarations **/ + +extern lineset_t screen; /* what is visualised */ + +extern int WIDTH, HEIGHT; + +extern int force_new; +extern char modified; /* set to 1 if screen modified since last save */ +extern char fname[256]; + /*** File management ***/ void write_file(FILE *fc){ DIR diff --git a/gramscii.c b/gramscii.c @@ -29,6 +29,61 @@ #include "arg.h" #include "gramscii.h" +/** global variables **/ + +lineset_t screen; /* what is visualised */ +lineset_t cutbuf; /* cut/paste buffer */ +lineset_t *undo; /* undo list */ + +pos_t marks[26]; /* position marks */ +char mark_map[26]; /* marks map */ + +int undo_sz;/* allocated size of undo list*/ +int undo_cur;/* undo position */ +int undo_lst;/* last valid undo position */ + +int WIDTH, HEIGHT; + +int mode;/* mode */ +int dir;/* line direction */ +int x; +int y; +int step;/* current step */ +int mult;/* current multiplier */ +int force_new; +char corner; + +/* number of available markers for each type */ +int hlines_sz; +int vlines_sz; +int corners_sz; +int stmarks_sz; +int endmarks_sz; +/**/ + +/* line and arrow markers */ +int cur_hl, cur_vl, cur_corn, cur_start, cur_end; +char line_h; +char line_v; +char mark_st; +char mark_end; +/**/ + +char modified; /* set to 1 if screen modified since last save */ +char fname[256]; + + +char script; /* set to 1 in script-mode */ +char autoend; /* set to 1 in auto-arrow mode */ + +/* Used by draw_arrow to identify the bounding box */ +int a_miny; +int a_maxy; +/**/ + +struct termios t1, t2, t3; + +/** End of global variables **/ char *argv0; DIR diff --git a/gramscii.h b/gramscii.h @@ -121,59 +121,6 @@ typedef struct{ #define progr_x(d) ((d) == DIR_L ? -1 : (d) == DIR_R ? 1 : 0) #define progr_y(d) ((d) == DIR_U ? -1 : (d) == DIR_D ? 1 : 0) -/** global variables **/ - -lineset_t screen; /* what is visualised */ -lineset_t cutbuf; /* cut/paste buffer */ -lineset_t *undo; /* undo list */ - -pos_t marks[26]; /* position marks */ -char mark_map[26]; /* marks map */ - -int undo_sz;/* allocated size of undo list*/ -int undo_cur;/* undo position */ -int undo_lst;/* last valid undo position */ - -int WIDTH, HEIGHT; - -int mode;/* mode */ -int dir;/* line direction */ -int x; -int y; -int step;/* current step */ -int mult;/* current multiplier */ -int force_new; -char corner; - -/* number of available markers for each type */ -int hlines_sz; -int vlines_sz; -int corners_sz; -int stmarks_sz; -int endmarks_sz; -/**/ - -/* line and arrow markers */ -int cur_hl, cur_vl, cur_corn, cur_start, cur_end; -char line_h; -char line_v; -char mark_st; -char mark_end; -/**/ - -char modified; /* set to 1 if screen modified since last save */ -char fname[256]; - - -char script; /* set to 1 in script-mode */ -char autoend; /* set to 1 in auto-arrow mode */ - -/* Used by draw_arrow to identify the bounding box */ -int a_miny; -int a_maxy; -/**/ - -struct termios t1, t2, t3; /** screen-related functions **/ void reset_styles(); DIR diff --git a/lineset.c b/lineset.c @@ -5,6 +5,22 @@ #include <string.h> #include "gramscii.h" +/** extern declarations **/ + +extern lineset_t screen; /* what is visualised */ +extern lineset_t cutbuf; /* cut/paste buffer */ +extern lineset_t *undo; /* undo list */ + +extern int undo_sz;/* allocated size of undo list*/ +extern int undo_cur;/* undo position */ +extern int undo_lst;/* last valid undo position */ + +extern int WIDTH, HEIGHT; + +extern char modified; /* set to 1 if screen modified since last save */ + +/****/ + static int LONG_STEP; /* line_t and lineset_t management */ DIR diff --git a/screen.c b/screen.c @@ -10,6 +10,55 @@ #include "gramscii.h" #include "config.h" +/** extern declarations **/ + +extern lineset_t screen; /* what is visualised */ +extern lineset_t cutbuf; /* cut/paste buffer */ +extern lineset_t *undo; /* undo list */ + +extern pos_t marks[26]; /* position marks */ +extern char mark_map[26]; /* marks map */ + +extern int undo_sz;/* allocated size of undo list*/ +extern int undo_cur;/* undo position */ +extern int undo_lst;/* last valid undo position */ + +extern int WIDTH, HEIGHT; + +extern int mode;/* mode */ +extern int dir;/* line direction */ +extern int x; +extern int y; +extern int step;/* current step */ +extern int mult;/* current multiplier */ + +extern char corner; + +/* number of available markers for each type */ +extern int hlines_sz; +extern int vlines_sz; +extern int corners_sz; +extern int stmarks_sz; +extern int endmarks_sz; +/**/ + +/* line and arrow markers */ +extern int cur_hl, cur_vl, cur_corn, cur_start, cur_end; +extern char line_h; +extern char line_v; +extern char mark_st; +extern char mark_end; +/**/ + +extern char modified; /* set to 1 if screen modified since last save */ +extern char fname[256]; + + +extern char script; /* set to 1 in script-mode */ + +extern struct termios t2, t3; + + /*** screen management functions ***/ /*** _isblank ***/