]> Pileus Git - lackey/commitdiff
Rename stuff
authorAndy Spencer <andy753421@gmail.com>
Sun, 21 Oct 2012 07:20:43 +0000 (07:20 +0000)
committerAndy Spencer <andy753421@gmail.com>
Sun, 21 Oct 2012 22:50:13 +0000 (22:50 +0000)
19 files changed:
cals/dummy.c [moved from cal/dummy.c with 93% similarity]
cals/ical.c [moved from cal/ical.c with 98% similarity]
makefile
src/cal.c [moved from src/event.c with 79% similarity]
src/cal.h [moved from src/event.h with 76% similarity]
src/main.c
src/test.c
src/util.c
src/view.c [moved from src/screen.c with 93% similarity]
src/view.h [moved from src/screen.h with 93% similarity]
views/day.c [moved from view/day.c with 99% similarity]
views/events.c [moved from view/events.c with 98% similarity]
views/help.c [moved from view/help.c with 100% similarity]
views/mkview.sh [moved from view/mkview.sh with 100% similarity]
views/month.c [moved from view/month.c with 99% similarity]
views/settings.c [moved from view/settings.c with 100% similarity]
views/todo.c [moved from view/todo.c with 100% similarity]
views/week.c [moved from view/week.c with 99% similarity]
views/year.c [moved from view/year.c with 98% similarity]

similarity index 93%
rename from cal/dummy.c
rename to cals/dummy.c
index fb870639d12f00adc0d9d5ef9f59a84f4b8763ab..62e1dd38c3a9f5ccd1771f115163947e4f56b5b4 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
+#include "cal.h"
 
 /* Test data */
 static cal_t cal = {
@@ -40,7 +40,7 @@ static event_t event = {
 static event_t events[8];
 
 /* Event functions */
-event_t *dummy_get(cal_t *cal, year_t year, month_t month, day_t day, int days)
+event_t *dummy_events(cal_t *cal, year_t year, month_t month, day_t day, int days)
 {
        for (int i = 0; i < N_ELEMENTS(events); i++) {
                date_t *s = &events[i].start;
similarity index 98%
rename from cal/ical.c
rename to cals/ical.c
index 817da8d52650ed7fe98de34b30763490433bb179..b39f901512f58dee046d93ff4f1d20ef7d7ecae9 100644 (file)
@@ -21,7 +21,7 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
+#include "cal.h"
 
 /* Local types */
 typedef struct {
@@ -139,7 +139,7 @@ static void add_events(icalarray *array, icalcomponent *comp,
 }
 
 /* Event functions */
-event_t *ical_get(cal_t *cal, year_t year, month_t month, day_t day, int days)
+event_t *ical_events(cal_t *cal, year_t year, month_t month, day_t day, int days)
 {
        /* Load ical */
        FILE *file = fopen("data/all.ics", "r");
index e3f36381118b90abac4990c83480b1d2456c5e66..be2232c267e1397295971a5556cbbcd129b3b85a 100644 (file)
--- a/makefile
+++ b/makefile
@@ -8,7 +8,7 @@ LDFLAGS  ?= -lncursesw -lical
 
 # Sources
 PROG      = lackey
-PROG_SRC  = main screen date event util 
+PROG_SRC  = main view date cal util 
 TEST      = test
 TEST_SRC  = test date util
 VIEWS     = day week month year events todo settings help
@@ -25,13 +25,13 @@ run-$(TEST): $(TEST)
        ./$<
 
 clean:
-       rm -f src/*.o view/*.o cal/*.o $(PROG) $(TEST) 
+       rm -f src/*.o views/*.o cals/*.o $(PROG) $(TEST) 
 
 # Rules
-$(PROG): $(PROG_SRC:%=src/%.o) $(VIEWS:%=view/%.o) $(CALS:%=cal/%.o)
+$(PROG): $(PROG_SRC:%=src/%.o) $(VIEWS:%=views/%.o) $(CALS:%=cals/%.o)
        $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
 
-$(TEST): $(TEST_SRC:%=src/%.o) $(CALS:%=cal/%.o)
+$(TEST): $(TEST_SRC:%=src/%.o) $(CALS:%=cals/%.o)
        $(CC) $(CFLAGS) -o $@ $+ $(LDFLAGS)
 
 %.o: %.c $(wildcard src/*.h) makefile
similarity index 79%
rename from src/event.c
rename to src/cal.c
index df375492c6a777f7f8c60c738466e5c3b7d598b4..800a7f8b0f7fd00e6f3698f5edd6751c1918e35b 100644 (file)
+++ b/src/cal.c
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
+#include "cal.h"
 
 /* Global data */
 event_t *EVENTS;
 
 /* Initialize */
-void event_init(void)
+void cal_init(void)
 {
-       EVENTS = event_get(2012, JAN, 0, 366);
+       EVENTS = cal_events(2012, JAN, 0, 366);
 
        /* Debug */
        for (event_t *e = EVENTS; e; e = e->next)
@@ -34,9 +34,9 @@ void event_init(void)
                                e->start.hour, e->start.min, e->name, e->desc);
 }
 
-/* Event get */
-event_t *event_get(year_t year, month_t month, day_t day, int days)
+/* Get events */
+event_t *cal_events(year_t year, month_t month, day_t day, int days)
 {
-       return ical_get(0, year, month, day, days)
-           ?: dummy_get(0, year, month, day, days);
+       return ical_events(0, year, month, day, days)
+           ?: dummy_events(0, year, month, day, days);
 }
similarity index 76%
rename from src/event.h
rename to src/cal.h
index 5af341f79a36a6f7d89873792a539c218202bfaa..3191733f24b70451cbdd4638aa8e4763a43dd223 100644 (file)
+++ b/src/cal.h
@@ -22,7 +22,7 @@ typedef struct {
        void *data;
 } cal_t;
 
-/* Event types */
+/* Calendar items */
 typedef struct event_t {
        const cal_t    *cal;
        const char     *name;
@@ -37,13 +37,13 @@ typedef struct event_t {
 /* Global data */
 extern event_t *EVENTS;
 
-/* Event functions */
-void event_init(void);
-event_t *event_get(year_t year, month_t month, day_t day, int days);
+/* Calendar functions */
+void cal_init(void);
+event_t *cal_events(year_t year, month_t month, day_t day, int days);
 
-/* Calendar implementation functions */
-event_t *dummy_get(cal_t *cal, year_t year, month_t month, day_t day, int days);
-event_t *ical_get(cal_t *cal, year_t year, month_t month, day_t day, int days);
+/* Calendar event functions */
+event_t *dummy_events(cal_t *cal, year_t year, month_t month, day_t day, int days);
+event_t *ical_events(cal_t *cal, year_t year, month_t month, day_t day, int days);
 
 /* Test fuctions */
 void ical_test(void);
index 75fb53c6de7ec1c6ff590709cc570c330920e9e9..e02cda019f724d92cabc0a98c530a1007ebcd4a9 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Control-C handler, so we don't hose the therminal */
 static void on_sigint(int signum)
@@ -60,11 +60,11 @@ int main(int argc, char **argv)
        /* Initialize */
        util_init();
        date_init();
-       event_init();
-       screen_init();
+       cal_init();
+       view_init();
 
-       /* Draw initial screen */
-       screen_draw();
+       /* Draw initial view */
+       view_draw();
 
        /* Run */
        while (1) {
@@ -81,16 +81,16 @@ int main(int argc, char **argv)
                        case KEY_RESIZE:
                                endwin();
                                refresh();
-                               screen_resize();
-                               screen_draw();
+                               view_resize();
+                               view_draw();
                                continue;
                        case '\14':
                                clear();
                        case '\7':
-                               screen_draw();
+                               view_draw();
                                continue;
                }
-               if (screen_run(chr, btn.bstate, btn.y, btn.x))
+               if (view_run(chr, btn.bstate, btn.y, btn.x))
                        continue;
                debug("main: Unhandled key - Dec %3d,  Hex %02x,  Oct %03o,  Chr <%c>\n",
                                chr, chr, chr, chr);
index 53822f92eb1b4c5d93f6b7a222e6092eaced6c32..8d6c9afa49050d4615b84df93edd3af1dda9098c 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include "date.h"
-#include "event.h"
+#include "cal.h"
 
 int main(int argc, char **argv)
 {
index 86bc3730701a21d2f5d1d4abc96a6929db769325..24a8f3706f0108d2bcc06e07af1cd34e20774414 100644 (file)
@@ -22,8 +22,8 @@
 #include <ncurses.h>
 
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Static data */
 static FILE *debug_fd = NULL;
similarity index 93%
rename from src/screen.c
rename to src/view.c
index c555e324fdc0c803242641aeef35f64a539a5159..d91dae948057d02145d446c1558e0eed7713e69f 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Types */
 typedef struct {
@@ -125,8 +125,8 @@ void event_line(WINDOW *win, event_t *event, int y, int x, int w, int full)
 }
 
 
-/* Screen init */
-void screen_init(void)
+/* View init */
+void view_init(void)
 {
        for (int i = 0; i < N_ELEMENTS(views); i++) {
                if (views[i].init) {
@@ -136,8 +136,8 @@ void screen_init(void)
        }
 }
 
-/* Screen draw */
-void screen_resize(void)
+/* View draw */
+void view_resize(void)
 {
        for (int i = 0; i < N_ELEMENTS(views); i++) {
                if (views[i].win)
@@ -147,8 +147,8 @@ void screen_resize(void)
        }
 }
 
-/* Screen draw */
-void screen_draw(void)
+/* View draw */
+void view_draw(void)
 {
        draw_header();
        werase(views[active].win);
@@ -156,18 +156,18 @@ void screen_draw(void)
        wrefresh(views[active].win);
 }
 
-/* Screen set */
-int screen_set(int num)
+/* View set */
+int view_set(int num)
 {
        if (active != num) {
                active = num;
-               screen_draw();
+               view_draw();
        }
        return 1;
 }
 
-/* Screen run */
-int screen_run(int key, mmask_t btn, int row, int col)
+/* View run */
+int view_run(int key, mmask_t btn, int row, int col)
 {
        /* Check for mouse events */
        if (key == KEY_MOUSE && row == 0) {
@@ -175,7 +175,7 @@ int screen_run(int key, mmask_t btn, int row, int col)
                for (int i = 0; i < N_ELEMENTS(views); i++) {
                        int end = start + strlen(views[i].name) - 1;
                        if (start <= col && col <= end && views[i].draw)
-                               return screen_set(i);
+                               return view_set(i);
                        start = end + 2;
                }
        }
@@ -186,7 +186,7 @@ int screen_run(int key, mmask_t btn, int row, int col)
                        continue;
                for (int j = 0; j < N_ELEMENTS(views[i].keys); j++)
                        if (views[i].keys[j] == key)
-                               return screen_set(i);
+                               return view_set(i);
        }
 
        /* Shift windows */
@@ -198,7 +198,7 @@ int screen_run(int key, mmask_t btn, int row, int col)
                num += N_ELEMENTS(views);
                num %= N_ELEMENTS(views);
                if (views[num].run)
-                       return screen_set(num);
+                       return view_set(num);
        }
 
        /* Pass key to active view */
similarity index 93%
rename from src/screen.h
rename to src/view.h
index 9f9d4e9892ea3869842bbd91ec3a54e78c65ed26..f263353b7cce78a71c091573f7e304ad888bc603 100644 (file)
 void event_box(WINDOW *win, event_t *event, int y, int x, int h, int w);
 void event_line(WINDOW *win, event_t *event, int y, int x, int w, int full);
 
-/* Screen functions */
-void screen_init(void);
-void screen_resize(void);
-void screen_draw(void);
-int  screen_run(int key, mmask_t btn, int row, int col);
+/* View functions */
+void view_init(void);
+void view_resize(void);
+void view_draw(void);
+int  view_run(int key, mmask_t btn, int row, int col);
 
 /* View init functions */
 void day_init(WINDOW *win);
similarity index 99%
rename from view/day.c
rename to views/day.c
index 4ddc1d31739d3eca67539d7f0cb03216449ca47b..4c21c67817f8111d99797cdec78d971e6fc2b45c 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Static data */
 static int     line;
similarity index 98%
rename from view/events.c
rename to views/events.c
index 8b888cdcdcd51cf7e650d3e08e55f0d45d6b128c..1a8f8b9d777ee3aad4f9e80f09dac75fddfe6f56 100644 (file)
@@ -21,8 +21,8 @@
 
 #include <util.h>
 #include <date.h>
-#include <event.h>
-#include <screen.h>
+#include <cal.h>
+#include <view.h>
 
 /* Static data */
 static WINDOW *win;
similarity index 100%
rename from view/help.c
rename to views/help.c
similarity index 100%
rename from view/mkview.sh
rename to views/mkview.sh
similarity index 99%
rename from view/month.c
rename to views/month.c
index fb1ec8c46cbf3fe87d3ebba87110c9c53c8d5984..c40324fd9a58674d2ed532a2494cc1702a5a5db8 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Static data */
 static WINDOW *win;
similarity index 100%
rename from view/settings.c
rename to views/settings.c
similarity index 100%
rename from view/todo.c
rename to views/todo.c
similarity index 99%
rename from view/week.c
rename to views/week.c
index e9d7c04505435d53736b2a5487bbc78c1bde3eb7..a38ad94a5c0606de91f6bb46c6a0ec50256e629e 100644 (file)
@@ -22,8 +22,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Static data */
 static int     line;
similarity index 98%
rename from view/year.c
rename to views/year.c
index 086c0e8e2f4efb6a47082a542711c852239e7763..5aecc42b67c11242161d085fc24a48b1d6a4c32b 100644 (file)
@@ -20,8 +20,8 @@
 
 #include "util.h"
 #include "date.h"
-#include "event.h"
-#include "screen.h"
+#include "cal.h"
+#include "view.h"
 
 /* Constants */
 #define MW (2*7+6)