slweb

Једноставни генератор статичких веб страна
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување e39fde5791fedffae5551cb252f381f756a45c94
родитељ d43fd9ca1e76eb19672c1ea836afa6b2c0d45221
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Mon, 18 Jan 2021 21:11:31 +0100

Adjusted the source so it can be compled with tcc

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Mdefault.o.do | 2+-
Mdefs.h | 60++++++++++++++++++++++++++++++------------------------------
Mindex.html | 21++++++++++++++++-----
Mindex.slw | 19+++++++++++++++----
Arebuild.do | 3+++
Mslweb.do | 2+-
измењених датотека: 6, додавања: 66(+), брисања: 41(-)

diff --git a/default.o.do b/default.o.do @@ -1,3 +1,3 @@ redo-ifchange $2.c -cc -g -Wall -std=c99 -o $3 -c $2.c +${SLWEB_CC:-gcc} -g -Wall -std=c99 -o $3 -c $2.c diff --git a/defs.h b/defs.h @@ -45,8 +45,8 @@ #define KEYSIZE 256 #define DATEBUFSIZE 12 -const char timestamp_format[] = "d.m.y"; -const char timestamp_output_ext[] = ".html"; +static const char timestamp_format[] = "d.m.y"; +static const char timestamp_output_ext[] = ".html"; typedef enum { @@ -76,36 +76,36 @@ typedef struct #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-const-variable" -const UBYTE MAX_HEADING_LEVEL = 4; -const UBYTE MAX_CSV_REGISTERS = 9; +#define MAX_HEADING_LEVEL 4 +#define MAX_CSV_REGISTERS 9 -const ULONG ST_NONE = 0; -const ULONG ST_YAML = 1; -const ULONG ST_YAML_VAL = 1 << 1; -const ULONG ST_PARA_OPEN = 1 << 2; -const ULONG ST_TAG = 1 << 3; -const ULONG ST_HEADING = 1 << 4; -const ULONG ST_BOLD = 1 << 5; -const ULONG ST_ITALIC = 1 << 6; -const ULONG ST_PRE = 1 << 7; -const ULONG ST_CODE = 1 << 8; -const ULONG ST_BLOCKQUOTE = 1 << 9; -const ULONG ST_LINK = 1 << 10; -const ULONG ST_LINK_SECOND_ARG = 1 << 11; -const ULONG ST_LINK_SPAN = 1 << 12; -const ULONG ST_LINK_MACRO = 1 << 13; -const ULONG ST_IMAGE = 1 << 14; -const ULONG ST_IMAGE_SECOND_ARG = 1 << 15; -const ULONG ST_MACRO_BODY = 1 << 16; -const ULONG ST_CSV_BODY = 1 << 17; -const ULONG ST_HTML_TAG = 1 << 18; -const ULONG ST_KBD = 1 << 19; -const ULONG ST_LIST = 1 << 20; +#define ST_NONE 0 +#define ST_YAML 1 +#define ST_YAML_VAL (1 << 1) +#define ST_PARA_OPEN (1 << 2) +#define ST_TAG (1 << 3) +#define ST_HEADING (1 << 4) +#define ST_BOLD (1 << 5) +#define ST_ITALIC (1 << 6) +#define ST_PRE (1 << 7) +#define ST_CODE (1 << 8) +#define ST_BLOCKQUOTE (1 << 9) +#define ST_LINK (1 << 10) +#define ST_LINK_SECOND_ARG (1 << 11) +#define ST_LINK_SPAN (1 << 12) +#define ST_LINK_MACRO (1 << 13) +#define ST_IMAGE (1 << 14) +#define ST_IMAGE_SECOND_ARG (1 << 15) +#define ST_MACRO_BODY (1 << 16) +#define ST_CSV_BODY (1 << 17) +#define ST_HTML_TAG (1 << 18) +#define ST_KBD (1 << 19) +#define ST_LIST (1 << 20) -const UBYTE ST_CS_NONE = 0; -const UBYTE ST_CS_HEADER = 1; -const UBYTE ST_CS_REGISTER = 1 << 2; -const UBYTE ST_CS_QUOTE = 1 << 3; +#define ST_CS_NONE 0 +#define ST_CS_HEADER 1 +#define ST_CS_REGISTER (1 << 2) +#define ST_CS_QUOTE (1 << 3) #pragma GCC diagnostic pop #endif /* __DEFS_H */ diff --git a/index.html b/index.html @@ -18,10 +18,10 @@ transforms custom Markdown-like syntax into HTML.</p> <h2>Prerequisites</h2> -<p>Aside from the obvious (<strong>GCC</strong>), slweb requires <strong>realpath</strong>(1) to determine -paths in local links and <strong>groff</strong>(1) and <strong>gzip</strong>(1) to create and compress -documentation. <strong>git</strong>(1) is, aside from cloning the repository, required to use -the directive <code>{git-log}</code>.</p> +<p>Aside from the obvious (a C compiler, by default <strong>GNU C</strong>), slweb requires +<strong>realpath</strong>(1) to determine paths in local links and <strong>groff</strong>(1) and +<strong>gzip</strong>(1) to create and compress documentation. <strong>git</strong>(1) is, aside from +cloning the repository, required to use the directive <code>{git-log}</code>.</p> <h2>Install</h2> @@ -43,6 +43,17 @@ $ su # ./do install </pre> +<p>You can specify any compiler which uses <code>-Wall</code>, <code>-c</code>, <code>-g</code> and <code>-o</code> like GNU C, +most notably <strong>tcc</strong>(1), by setting the <code>SLWEB_CC</code> environment variable. For +example:</p> + +<pre> +$ SLWEB_CC=tcc redo -j10 +</pre> + +<p>In the case of <strong>tcc</strong>, the tradeoff is that the debug information is limited +compared to <strong>gcc</strong>, but the compilation time is significantly shorter.</p> + <h2>Examples</h2> <p>See the <a href="https://github.com/Strahinja/slweb/tree/master/examples"><code>examples/</code></a> directory in this repository.</p> @@ -123,7 +134,7 @@ this program. If not, see &lt;<a href="https://www.gnu.org/licenses">https://www <div id="git-log"> Previous commit: -index.slw fda452c 2021-01-16 23:53:23 +0100 (Страхиња Радић) (HEAD -> master, tag: v0.3.5, origin/master, origin/HEAD) +index.slw 95fd070 2021-01-18 21:11:31 +0100 (Страхиња Радић) (HEAD -> master) </div><!--git-log--> diff --git a/index.slw b/index.slw @@ -12,10 +12,10 @@ transforms custom Markdown-like syntax into HTML. ## Prerequisites -Aside from the obvious (**GCC**), slweb requires **realpath**(1) to determine -paths in local links and **groff**(1) and **gzip**(1) to create and compress -documentation. **git**(1) is, aside from cloning the repository, required to use -the directive `{git-log}`. +Aside from the obvious (a C compiler, by default **GNU C**), slweb requires +**realpath**(1) to determine paths in local links and **groff**(1) and +**gzip**(1) to create and compress documentation. **git**(1) is, aside from +cloning the repository, required to use the directive `{git-log}`. ## Install @@ -37,6 +37,17 @@ if you don't: # ./do install ``` +You can specify any compiler which uses `-Wall`, `-c`, `-g` and `-o` like GNU C, +most notably **tcc**(1), by setting the `SLWEB_CC` environment variable. For +example: + +``` +$ SLWEB_CC=tcc redo -j10 +``` + +In the case of **tcc**, the tradeoff is that the debug information is limited +compared to **gcc**, but the compilation time is significantly shorter. + ## Examples See the [`examples/`][1] directory in this repository. diff --git a/rebuild.do b/rebuild.do @@ -0,0 +1,3 @@ +redo clean +redo all + diff --git a/slweb.do b/slweb.do @@ -1,3 +1,3 @@ redo-ifchange slweb.o slweb.c defs.h -cc -g -Wall -std=c99 -o $3 slweb.o -lunistring +${SLWEB_CC:-gcc} -g -Wall -std=c99 -o $3 slweb.o -lunistring