stacinhtml

Static C in HTML - simple static site generator
git clone git://git.kocotian.pl/stacinhtml.git
Log | Files | Refs | README | LICENSE

libstac.h (702B)


      1 #ifndef _LIBSTAC_H
      2 #define _LIBSTAC_H
      3 
      4 #include <stdarg.h>
      5 #include <stdio.h>
      6 #include <unistd.h>
      7 
      8 #include "../str.h"
      9 #include "../util.h"
     10 
     11 /* Macros */
     12 #define $(VARNAME) getVariableValue(#VARNAME)
     13 #define $$(VARNAME) write(fd, $(VARNAME).data, $(VARNAME).len);
     14 #define DECLVAR(VARNAME, VALUE) \
     15 	(vs[vss].name.len = strlen(vs[vss].name.data = #VARNAME), \
     16 	 vs[vss].value.len = strlen(vs[vss].value.data = VALUE == NULL ? "<null>" : VALUE), \
     17 	 ++vss)
     18 #define fd 1 /* stdout */
     19 
     20 #define echo(STRING) write(fd, (STRING), sizeof(STRING) - 1)
     21 #define PERCENT write(fd, "\x25", 1);
     22 #define MODULO %
     23 
     24 ssize_t print(char *what);
     25 ssize_t nprint(char *what, size_t n);
     26 int lsprintf(char *fmt, ...);
     27 
     28 #endif