Introduce old redir program
[lcapit-junk-code.git] / pet-projects / DLW-1e / das / file.h
blob2f82dd2437b6d5f2de35d74519193ce3eff48e43
1 #ifndef _DAS_FILE_H
2 #define _DAS_FILE_H
4 #include <stdio.h>
6 /* syntax definitions */
8 #define ASM_COMMENT ';'
9 #define ASM_NEWLINE '\n'
10 #define ASM_SPACE ' '
11 #define ASM_TAB '\t'
13 #define ASM_OP_IMM '$'
14 #define ASM_OP_REG '%'
15 #define ASM_OP_SEP ','
17 /* helper macros */
19 #define is_comment(c) (c == ASM_COMMENT)
20 #define is_newline(c) (c == ASM_NEWLINE)
22 /* exported values */
24 #define DEF_LINE_LEN 64
26 /* exported helpers for parsing */
27 char *skip_spaces(char *line, size_t len);
28 void remove_comment(char *line, size_t len);
29 char *get_line_end(char *line, size_t len, int line_nr);
31 /* exported functions */
32 int file_read_line(FILE *file, char *line, size_t len);
33 FILE *file_open(const char *path, const char *mode);
34 FILE *file_open_tmp(char *template);
35 void file_write_bin(const void *ptr, size_t size, FILE *stream);
37 #endif /* _DAS_FILE_H */