forked from codythegreat/dss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodebase.txt
73 lines (53 loc) · 2.87 KB
/
codebase.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
title="Understanding the codebase of DSS"
{STARTSLIDES}
High Level Map of logic flowCOLOR="yB"
<-------------------------
| |
Entry point --> main.c[1] main.c[4] --> display.c[5]--> <-----------
| | | |
--> parser.c[2]--> --> parsecommand.c[6] -->
| |
--> slides.c/mdlink.c[3]
[1] Parse user inputs, initialize ncurses, set up variables
[2] Begin parsing the input text file into slide/line structs
[3] slides.c provides functions for generating and freeing slide/line structs.
mdlink.c provides functions for generating and freeing mdlink structs.
[4] slides are returned to main.c where they are sent to the displayLoop
function. on return main.c will check to see if a file is to be open.
this logic is in the do while loop at the bottom of main.c
[5] display.c will print the tile, slide(s) and bottom bar, from here the loop
will continuously ckeck user input and perform actions based on that input.
eventually the loop will return to main.c.
[6] parsecommand.c provides logic for building command structs which are used
in the ":" mode
{ENDSLIDE}
main.cCOLOR="yB"
* parsing is handled immediatly, 'v' and 'h' flags used for version and
usage information. Otherwise we'll get the filename here
* setlocale() is used to enable UTF-8 support (also the reason why we
use -lncursesw flag in the Makefile)
* after setting a few variables, we'll attempt to open the file at the
file name given. after this we'll initialize the display.
* We build our slide structs from the opened file by calling parseTXT.
the line structs will also be built for each slide here. pointer to
the first slide is returned. after this the file is closed
* displayLoop is called now. it'll return a code that is used to signal
main to open and parse a new file.
* freeing of lines and slides occurs right at the end of the do while
loop.
* If no file is to be opened, we simply end the loop and return
EXIT_SUCCESS.
{ENDSLIDE}
parser.cCOLOR="yB"
* parseTXT function will first comb the input file for meta information
(title, number of slides, etc)
* File is rewound (this is currently required due to the nature of how
slides are counted.)
* slide/line structs are created (see slides.c), we then begin combing
the file after the STARTSLIDES tag
* if a color tag or link (see mdlink.c) is detected, parse those.
Otherwise assign continuously build up line structs for each slide.
* at ENDSLIDE tag, build the slide and begin parsing lines again for
next slide
* return pointer to first slide
{ENDSLIDE}