2018-05-10 08:12:47 +00:00
|
|
|
/*
|
|
|
|
* Miscellaneous helpers for common operations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(FCODER_HELPER_H)
|
|
|
|
#define FCODER_HELPER_H
|
|
|
|
|
|
|
|
struct Bind_Helper{
|
|
|
|
Binding_Unit *cursor, *start, *end;
|
|
|
|
Binding_Unit *header, *group;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 write_total;
|
|
|
|
i32 error;
|
2018-05-10 08:12:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define BH_ERR_NONE 0
|
|
|
|
#define BH_ERR_MISSING_END 1
|
|
|
|
#define BH_ERR_MISSING_BEGIN 2
|
|
|
|
#define BH_ERR_OUT_OF_MEMORY 3
|
|
|
|
|
|
|
|
struct Bind_Buffer{
|
|
|
|
void *data;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 size;
|
2018-05-10 08:12:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////
|
|
|
|
|
2018-05-19 22:05:31 +00:00
|
|
|
struct File_Name_Data{
|
2019-06-01 23:58:28 +00:00
|
|
|
String_Const_u8 file_name;
|
|
|
|
Data data;
|
2018-08-10 21:52:57 +00:00
|
|
|
};
|
2018-05-19 22:05:31 +00:00
|
|
|
|
|
|
|
////////////////////////////////
|
2018-05-10 08:12:47 +00:00
|
|
|
|
|
|
|
struct Stream_Chunk{
|
|
|
|
Application_Links *app;
|
2019-04-01 02:41:39 +00:00
|
|
|
Buffer_ID buffer_id;
|
2018-05-10 08:12:47 +00:00
|
|
|
|
|
|
|
char *base_data;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 start;
|
|
|
|
i32 end;
|
|
|
|
i32 min_start;
|
|
|
|
i32 max_end;
|
|
|
|
b32 add_null;
|
|
|
|
u32 data_size;
|
2018-05-10 08:12:47 +00:00
|
|
|
|
|
|
|
char *data;
|
|
|
|
};
|
|
|
|
|
2019-02-02 00:58:44 +00:00
|
|
|
// NOTE(allen|4.0.31): Stream_Tokens has been deprecated in favor of the Token_Iterator below.
|
|
|
|
// For examples of usage: 4coder_function_list.cpp 4coder_scope_commands.cpp
|
|
|
|
// If you want to keep your code working easily uncomment the typedef for Stream_Tokens.
|
2019-02-01 22:50:33 +00:00
|
|
|
struct Stream_Tokens_DEP{
|
2018-05-10 08:12:47 +00:00
|
|
|
Application_Links *app;
|
2019-04-01 02:41:39 +00:00
|
|
|
Buffer_ID buffer_id;
|
2018-05-10 08:12:47 +00:00
|
|
|
|
|
|
|
Cpp_Token *base_tokens;
|
|
|
|
Cpp_Token *tokens;
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 start;
|
|
|
|
i32 end;
|
|
|
|
i32 count;
|
|
|
|
i32 token_count;
|
2019-02-01 22:50:33 +00:00
|
|
|
};
|
2019-02-02 00:23:48 +00:00
|
|
|
//typedef Stream_Tokens_DEP Stream_Tokens;
|
2019-02-01 22:50:33 +00:00
|
|
|
|
|
|
|
struct Token_Range{
|
|
|
|
Cpp_Token *first;
|
|
|
|
Cpp_Token *one_past_last;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Token_Iterator{
|
2019-02-24 07:22:16 +00:00
|
|
|
// TODO(allen): source buffer
|
2019-02-01 22:50:33 +00:00
|
|
|
Cpp_Token *token;
|
|
|
|
Token_Range range;
|
2018-05-10 08:12:47 +00:00
|
|
|
};
|
|
|
|
|
2018-08-18 08:16:52 +00:00
|
|
|
////////////////////////////////
|
|
|
|
|
|
|
|
struct Sort_Pair_i32{
|
2019-02-26 23:08:42 +00:00
|
|
|
i32 index;
|
|
|
|
i32 key;
|
2018-08-18 08:16:52 +00:00
|
|
|
};
|
|
|
|
|
2019-06-01 23:58:28 +00:00
|
|
|
////////////////////////////////
|
|
|
|
|
|
|
|
struct History_Group{
|
|
|
|
Application_Links *app;
|
|
|
|
Buffer_ID buffer;
|
|
|
|
History_Record_Index first;
|
|
|
|
};
|
|
|
|
|
2018-05-10 08:12:47 +00:00
|
|
|
#endif
|
|
|
|
|
2019-02-02 00:58:44 +00:00
|
|
|
// BOTTOM
|