git.y1.nz

lwl

Less with links.
download: http://git.y1.nz/archives/lwl.tar.gz
README | Files | Log | Refs

text.h

      1 #include <stdio.h> /* for FILE */
      2 
      3 #define COLOR_BLACK  0
      4 #define COLOR_RED  1
      5 #define COLOR_GREEN  2
      6 #define COLOR_YELLOW  3
      7 #define COLOR_BLUE  4
      8 #define COLOR_MAGENTA  5
      9 #define COLOR_CYAN  6
     10 #define COLOR_WHITE  7
     11 
     12 #define STYLE_U  0
     13 #define STYLE_I  1
     14 #define STYLE_B  2
     15 
     16 typedef struct _markup {
     17 	int start, width; /* where */
     18 	int color; /* visual style */
     19 	char *data; /* a string associated with this chunk of text */
     20 	
     21 	int active; /* whether to invert/highlight this chunk */
     22 } Markup;
     23 
     24 typedef struct _fc {
     25 	/* the input, loaded into memory */
     26 	char *buffer;
     27 
     28 	/* indices in buffer */
     29 	int *lines;
     30 	int line_count;
     31 
     32 	Markup **highlights;
     33 	int highlight_count;
     34 
     35 	Markup **links;
     36 	int link_count;
     37 } FileContents;
     38 
     39 typedef struct _wrap {
     40 	int *lines;
     41 	int line_count;
     42 	int width, height;
     43 } Wrap;
     44 
     45 Markup *create_markup(int start, int width, int color);
     46 void free_markup(Markup *markup);
     47 
     48 FileContents *read_contents(FILE *fin);
     49 Wrap *wrap_to(FileContents *contents, int width, int height);

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.