/* qlam.h
:w | !gcc %<.c -o %< -Wall
!./%<

(C) 2023 by marnout à free pt fr  Released under the GPL
*/
#ifndef _MRD_QLAM_H_
#define _MRD_QLAM_H_

#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdbool.h>
#include <assert.h>

#define Tsize 8
#define Wsize 16
#define Ssize 128
#define Lsize 2048

#define QLM_TH 1
#define QLM_TD 2
#define QLM_CODE 4
#define QLM_PRE 8

#define ALPHA "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"

#define eq(s1, s2) (!strcmp((s1), (s2)))

typedef char tiny_t[Tsize];
typedef char wrd_t[Wsize];
typedef char str_t[Ssize];
typedef char lstr_t[Lsize];

str_t path;


void mkstr(FILE *html, char *line, int len);

int mkhtml(char *dest, char *src);

// check if s starts with w
char *qtag(char *s, char *w);

void mktable(FILE *html, FILE *qlm);

void mkpre(FILE *html, FILE *qlm, char *lang);

/* dict */
typedef struct token
{
	char *data;
	struct token *next;
} token_t;

typedef token_t * dict_t[27];

void mkdict(dict_t dict, char *name);

void freedict(dict_t dict);

int indict(char *w, dict_t dict);

dict_t hdict;;

#endif

