&syntax
};
+
+void
+log_todo(Board* board)
+{
+ for (int i = 0; i < board->todolist_count; i++) {
+ TodoList* todolist;
+ printf("List =-=-=-=-=-==-=-=-=-=-=-\n");
+ todolist = board->todolist_list[i];
+ printf("List name: %s\n", todolist->list_name);
+ printf("Num of items: %d\n", todolist->item_count);
+
+ for (int j = 0; j < todolist->item_count; j++) {
+ TodoItem* todoitem;
+ printf("Item =-=-=-=-=-\n");
+ todoitem = todolist->item_list[j];
+ printf("Item name: %s\n", todoitem->item_name);
+ printf("Description: %s\n", todoitem->description);
+ printf("Num of subtasks: %d\n", todoitem->subtask_count);
+
+ for (int k = 0; k < todoitem->subtask_count; k++) {
+ SubTask* subtask;
+ int done;
+
+ subtask = todoitem->subtask_list[k];
+ printf("Subtask: %s, %d\n", subtask->subtask_name, subtask->done);
+ }
+ }
+ }
+}
+
+Board*
+begin_parse(char* board_path)
+{
+ const char* input_buffer;
+ long input_size;
+ State state;
+ Board* new_board;
+
+ /* read entire file */
+ input_buffer = read_file(board_path, &input_size);
+
+ /* setup state */
+ state.cur_todolist = NULL;
+ state.cur_todoitem = NULL;
+
+ new_board = malloc(sizeof(Board));
+ new_board->todolist_list = malloc(0);
+ new_board->todolist_count = 0;
+ state.board = new_board;
+
+ md_parse(input_buffer, input_size, &parser, &state);
+
+ /* finish calls */
+ exit_todolist(&state);
+
+ free((char*)input_buffer);
+
+ return state.board;
+}
+
char*
read_file(char* file_name, long* size)
{ // apparently using seek isnt the greatest, may change to chunk reading later
return output;
}
-Board*
-begin_parse(char* board_path)
-{
- const char* input_buffer;
- long input_size;
- State state;
- Board* new_board;
-
- /* read entire file */
- input_buffer = read_file(board_path, &input_size);
-
- /* setup state */
- state.cur_todolist = NULL;
- state.cur_todoitem = NULL;
-
- new_board = malloc(sizeof(Board));
- new_board->todolist_list = malloc(0);
- new_board->todolist_count = 0;
- state.board = new_board;
-
- md_parse(input_buffer, input_size, &parser, &state);
-
- /* finish calls */
- exit_todolist(&state);
-
- free((char*)input_buffer);
-
- return state.board;
-}
-
void
enter_todolist(State* state, char* list_name)
{
--- /dev/null
+
+#include "headers/render.h"
+#include "config.h"
+
+int init_tscolors(void);
+
+int create_todowin(void);
+
+/* init stuff */
+int
+init_tscurses(void)
+{
+ initscr();
+ cbreak();
+ noecho();
+ curs_set(0);
+ keypad(stdscr, TRUE);
+
+ /* need to error check this */
+ if (has_colors() == FALSE) {
+ fprintf(stderr, "Your terminal does not support color.\n");
+
+ /* maybe just return 1 */
+ /* exit_tscurses(); */
+ /* exit(1); */
+ return 1;
+ }
+ start_color();
+ init_tscolors();
+
+ return 0;
+}
+
+int
+exit_tscurses(void)
+{
+ endwin();
+
+ return 0;
+}
+
+int
+init_tscolors(void)
+{
+ init_pair(TS_SELECTED, selected_color, COLOR_BLACK);
+ init_pair(TS_NONSELECTED, non_selected_color, COLOR_BLACK);
+
+ return 0;
+}
+
+/* wins */
+int
+create_todowin(void)
+{
+
+
+
+ return 0;
+}
+
+
#include "headers/parser.h"
+#include "headers/render.h"
int
main(int argc, char** argv)
{
- Board* board;
-
- board = begin_parse("test_board.md");
-
- for (int i = 0; i < board->todolist_count; i++) {
- TodoList* todolist;
- printf("List =-=-=-=-=-==-=-=-=-=-=-\n");
- todolist = board->todolist_list[i];
- printf("List name: %s\n", todolist->list_name);
- printf("Num of items: %d\n", todolist->item_count);
+ /* Board* board; */
+ /* board = begin_parse("test_board.md"); */
+ /* log_todo(board); */
- for (int j = 0; j < todolist->item_count; j++) {
- TodoItem* todoitem;
- printf("Item =-=-=-=-=-\n");
- todoitem = todolist->item_list[j];
- printf("Item name: %s\n", todoitem->item_name);
- printf("Description: %s\n", todoitem->description);
- printf("Num of subtasks: %d\n", todoitem->subtask_count);
+ /* init curses */
+ init_tscurses();
- for (int k = 0; k < todoitem->subtask_count; k++) {
- SubTask* subtask;
- int done;
+ getch();
- subtask = todoitem->subtask_list[k];
- printf("Subtask: %s, %d\n", subtask->subtask_name, subtask->done);
- }
- }
-
- }
- /* printf("%d\n", board->todolist_count); */
- /* printf("%s\n", board->todolist_list[1]->list_name); */
+ exit_tscurses();
return 0;
}
+