labwc/include/theme/xbm/tokenize.h

41 lines
677 B
C
Raw Normal View History

2020-06-29 19:27:59 +01:00
/*
* XBM file tokenizer
*
* Copyright Johan Malm 2020
*/
2020-06-22 19:03:02 +01:00
2020-06-29 19:27:59 +01:00
#ifndef TOKENIZE_H
#define TOKENIZE_H
2020-06-22 19:03:02 +01:00
enum token_type {
TOKEN_NONE = 0,
TOKEN_IDENT,
TOKEN_INT,
TOKEN_SPECIAL,
TOKEN_OTHER,
};
#define MAX_TOKEN_SIZE (256)
struct token {
char name[MAX_TOKEN_SIZE];
int value;
2020-06-22 19:03:02 +01:00
size_t pos;
enum token_type type;
};
/**
* tokenize - tokenize xbm file
* @buffer: buffer containing xbm file
2020-06-23 07:17:07 +01:00
* return token vector
*/
struct token *xbm_tokenize(char *buffer);
/**
* xbm_read_file - read file into buffer (as it's easier to tokenize that way)
* @filename: file to be read
* return allocated memory
2020-06-22 19:03:02 +01:00
*/
2020-06-23 07:17:07 +01:00
char *xbm_read_file(const char *filename);
2020-06-22 19:03:02 +01:00
2020-06-29 19:27:59 +01:00
#endif /* TOKENIZE_H */