summaryrefslogtreecommitdiffstats
path: root/src/bvr.h
blob: 185b78f7ac3c66088b6452e809d96385c4badb7f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once
#include <strlcpy.c>
#include <stdlib.h>
#include <stdio.h>
#define SUCCESS 0
#define FAILURE -1
#define COPY_BUFFER_SIZE 128
#define BVR_COPY_BUFFER_SIZE COPY_BUFFER_SIZE
#define OPENING_COMMAND_TAG_LENGTH 2
#define OPENING_COMMAND_TAG_CHAR_1 '<'
#define OPENING_COMMAND_TAG_CHAR_2 '@'
#define CLOSING_COMMAND_TAG_CHAR_1 '@'
#define CLOSING_COMMAND_TAG_CHAR_2 '>'
#define BVR_OPENING_COMMAND_TAG_LENGTH OPENING_COMMAND_TAG_LENGTH
#define BVR_OPENING_COMMAND_TAG_CHAR_1 OPENING_COMMAND_TAG_CHAR_1
#define BVR_OPENING_COMMAND_TAG_CHAR_2 OPENING_COMMAND_TAG_CHAR_2
#define BVR_CLOSING_COMMAND_TAG_CHAR_1 CLOSING_COMMAND_TAG_CHAR_1
#define BVR_CLOSING_COMMAND_TAG_CHAR_2 CLOSING_COMMAND_TAG_CHAR_2
#define LINE_COMMENT_CHAR '#'
#define LINE_COMMAND_CHAR '?'
#define WAITING_FOR_COMMAND 8922
#define READING_COMMAND 2343
#define PROCESSING_COMMAND 346 // not needed
#define THE_VOID "/dev/null"

#define BVR_INITIAL_VARIABLES_COUNT 128
#define BVR_UNDEFINED "BVR_UNDEFINED"
#define BVR_ARRAY_INDEX_CHAR '['
#define BVR_ARRAY_AFTER_INDEX "]"

struct bvr_variable {
	char * k; /* ey */
	char * v; /* alue */
	size_t sv; /* _izeof_alue */
	size_t sk; /* _izeof_key */
};
size_t bvr_variables_count = BVR_INITIAL_VARIABLES_COUNT;
struct bvr_variable * bvr_variables;
int bvr_bvrvar_first_time_set = 1;

#define BVR_VER_MAJOR 0
#define BVR_VER_MINOR 3
#define BVR_VER_PATCH 0

#define BVR_PATH_SEPARATOR ' '
#define BVR_INCLUDE_PATH_VAR_NAME "bvr_include_path"
#define BVR_COMMAND_FILE_EXT ".bvr"

#define BVR_CONTINUE 1328
#define BVR_KEEPGOING 132
char BVR_CHARS_TO_BREAK_VALUE[3] = {CLOSING_COMMAND_TAG_CHAR_1, EOF, '\0'}; // 0x00 mora biti na koncu (null terminated array)

#define BVR_VALUE_CHUNK_SIZE 256
int bvr_compose_stream(FILE *, FILE *);
int bvr_command_processor(FILE *, FILE *);

#define BVR_BREAK_STRING_CHAR '"'
#define BVR_ESCAPE_CHAR '\\'

#define BVR_NEWLINE_CHAR '\n'

int init_tape_copy_buffer(char [], int);
int bvr_inline_command_processor(FILE *, FILE *, char []);