-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathc_library.refactor
540 lines (403 loc) · 14.7 KB
/
c_library.refactor
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
__VERSION 1
// not : Ignore
// include : #includes
// word : Alphanumeric or underscore
// namespace : Prefix search and replace (c-namspaces).
// regex : Unavailable in __VERSION 1.
// Precedence (highest to lowest):
// word, namespace, regex
// Gen Macro namespace
// namespace GEN_, new_namespace_
// c_library.refactor
// Used to prefix all exposed identifiers with the gen_namespace by c_library.cpp using ./gencpp/scripts/helpers/refactor.exe
// Macros
word global, gen_global
word internal, gen_internal
word local_persist, gen_local_persist
word bit, gen_bit
word bitfield_is_set, gen_bitfield_is_set
word cast, gen_cast
word ccast, gen_ccast
word pcast, gen_pcast
word rcast, gen_rcast
word scast, gen_scast
word stringize_va, gen_stringize_va
word stringize, gen_stringize
word do_once, gen_do_once
word do_once_start, gen_do_once_start
word do_once_end, gen_do_once_end
word labeled_scope_start, gen_labeled_scope_start
word labeled_scope_end, gen_labeled_scope_end
word compiler_decorated_func_name, gen_compiler_decorated_func_name
word num_args_impl, gen_num_args_impl
word num_args, gen_num_args
word clamp, gen_clamp
word count_of, gen_count_of
word is_between, gen_is_between
word size_of, gen_size_of
word max, gen_max
word min, gen_min
word offset_of, gen_offset_of
word forceinline, gen_forceinline
word neverinline, gen_neverinline
word static_assert, gen_static_assert
word thread_local, gen_thread_local
word typeof, gen_typeof
word enum_underlying, gen_enum_underlying
word nullptr, gen_nullptr
word struct_init, gen_struct_init
word hash, gen_hash
// Basic Types
word u8, gen_u8
word s8, gen_s8
word u16, gen_u16
word s16, gen_s16
word u32, gen_u32
word s32, gen_s32
word u64, gen_u64
word s64, gen_s64
word usize, gen_usize
word ssize, gen_ssize
word sptr, gen_sptr
word uptr, gen_uptr
word f32, gen_f32
word f64, gen_f64
word b8, gen_b8
word b16, gen_b16
word b32, gen_b32
word mem_ptr, gen_mem_ptr
word mem_ptr_const, gen_mem_ptr_const
word to_uptr, gen_to_uptr
word to_sptr, gen_to_sptr
word to_mem_ptr, gen_to_mem_ptr
word to_mem_ptr_const, gen_to_mem_ptr_const
// Debug
word assert_handler, gen_assert_handler
word assert_crash, gen_assert_crash
word process_exit, gen_process_exit
// Memory
word kilobytes, gen_kilobytes
word megabytes, gen_megabytes
word gigabytes, gen_gigabytes
word terabytes, gen_terabytes
word swap, gen_swap
word is_power_of_two, gen_is_power_of_two
word align_forward, gen_align_forward
word align_forward_by_value, gen_align_forward_by_value
word pointer_add, gen_pointer_add
word pointer_add_const, gen_pointer_add_const
word pointer_diff, gen_pointer_diff
word mem_copy, gen_mem_copy
word mem_find, gen_mem_find
word mem_move, gen_mem_move
word mem_set, gen_mem_set
word zero_size, gen_zero_size
word zero_item, gen_zero_item
word zero_array, gen_zero_array
word AllocType, gen_AllocType
word AllocatorProc, gen_AllocatorProc
word AllocatorInfo, gen_AllocatorInfo
word AllocFlag, gen_AllocFlag
word alloc, gen_alloc
word alloc_align, gen_alloc_align
word allocator_free, gen_allocator_free
word free_all, gen_free_all
word resize, gen_resize
word resize_align, gen_resize_align
word alloc_item, gen_alloc_item
word alloc_array, gen_alloc_array
word heap_stats_init, gen_heap_stats_init
word heap_stats_used_memory, gen_heap_stats_used_memory
word heap_stats_alloc_count, gen_heap_stats_alloc_count
word heap_stats_check, gen_heap_stats_check
word default_resize_align, gen_default_resize_align
word heap_allocator_proc, gen_heap_allocator_proc
word heap, gen_heap
word malloc, gen_malloc
word mfree, gen_mfree
word VirtualMemory, gen_VirtualMemory
word vm_from_memory, gen_vm_from_memory
word vm_alloc, gen_vm_alloc
word vm_free, gen_vm_free
word vm_trim, gen_vm_trim
word vm_purge, gen_vm_purge
word virtual_memory_page_size, gen_virtual_memory_page_size
// Memory: Arena
word Arena, gen_Arena
namespace arena_, gen_arena_
// word arena_allocator_info
// word arena_init_from_memory
// word arena_init_from_allocator
// word arena_init_sub
// word arena_alignment_of
// word arena_check
// word arena_size_remaining
// Memory: FixedArena
namespace FixedArena_, gen_FixedArena_
namespace fixed_arena_, gen_fixed_arena_
// Memory: Pool
word Pool, gen_Pool
namespace pool_, gen_pool_
// Printing
namespace c_str_, gen_c_str_
word PrintF_Buffer, gen_PrintF_Buffer
word Msg_Invalid_Value, gen_Msg_Invalid_Value
word log_fmt, gen_log_fmt
// String Ops
namespace char_, gen_char_
word digit_to_int, gen_digit_to_int
word hex_digit_to_init, gen_hex_digit_to_init
word i64_to_str, gen_i64_to_str
word u64_to_str, gen_u64_to_str
// Containers
namespace GENERIC_SLOT_, GEN_GENERIC_SLOT_
word Array, gen_Array
word Array_ssize, gen_Array_gen_ssize
word ArrayHeader, gen_ArrayHeader
namespace Array_, gen_Array_
namespace array_, gen_array_
word HashTable, gen_HashTable
namespace HashTable_, gen_HashTable_
namespace hashtable_, gen_hashtable_
namespace HT_, gen_HT_
namespace HTE_, gen_HTE_
namespace arr_hte_, gen_arr_hte_
namespace Arr_HTE_, gen_Arr_HTE_
// Hashing
word crc32, gen_crc32
word crc64, gen_crc64
// Strings
word Str, gen_Str
word to_str_from_c_str, gen_to_str_from_c_str
namespace str_, gen_str_
word cast_to_str, gen_cast_to_str
word StrBuilderHeader, gen_StrBuilderHeader
word StrBuilder, gen_StrBuilder
namespace strbuilder_, gen_strbuilder_
word StrCached, gen_StrCached
word StringTable, gen_StringTable
namespace StringTable_, gen_StringTable_
// File Handling
word FileModeFlag, gen_FileModeFlag
word SeekWhenceType, gen_SeekWhenceType
word FileError, gen_FileError
word FileDescriptor, gen_FileDescriptor
word FileMode, gen_FileMode
word FileOperations, gen_FileOperations
word FileOperations, gen_FileOperations
default_file_operations
word FileTime, word FileTime
word DirType, gen_DirType
word DirInfo, gen_DirInfo
word DirEntry, gen_DirEntry
word DirInfo, gen_DirInfo
word FileInfo, gen_FileInfo
word FileStandardType, gen_FileStandardType
namespace file_, gen_file_
word gen_FileContents, gen_FileContents
// Timing
word read_cpu_time_stamp_counter, gen_read_cpu_time_stamp_counter
word time_rel, gen_time_rel
word time_rel_ms, gen_time_rel_ms
// Parsing
// Parsing: ADT
word ADT_Node, gen_ADT_Node
word ADT_Type, gen_ADT_Type
word ADT_Props, gen_ADT_Props
word ADT_NamingStyle, gen_ADT_NamingStyle
word ADT_AssignStyle, gen_ADT_AssignStyle
word ADT_DelimStyle, gen_ADT_DelimStyle
word ADT_Error, gen_ADT_Error
word ADT_Node, gen_ADT_Node
namespace adt_, gen_adt_
word CSV_Error, gen_CSV_Error
word CSV_Object, gen_CSV_Object
namespace csv_, gen_csv_
// Types.hpp
word log_failure, gen_log_failure
word AccessSpec, gen_AccessSpec
word access_spec_to_str, gen_access_spec_to_str
word CodeFlag, gen_CodeFlag
word EnumDecl, gen_EnumDecl
word ModuleFlag, gen_ModuleFlag
word module_flag_to_str, gen_module_flag_to_str
word EPreprocessCond, gen_EPreprocessCOnd
word ETypenameTag, gen_ETypenameTag
word CodeType, gen_CodeType
word codetype_to_str, gen_codetype_to_str
word codetype_to_keyword_str, gen_codetype_to_keyword_str
word Operator, gen_Operator
word operator_to_str, gen_operator_to_str
word Specifier, gen_Specifier
word spec_to_str, gen_spec_to_str
word spec_is_trailing, gen_spec_is_trailing
// word str_to_specifier, gen_str_to_specifier
word MacroType, gen_MacroType
word EMacroFlags, gen_EMacroFlags
word MacroFlags, gen_MacroFlags
word Macro, gen_Macro
namespace macro_, gen_macro_
namespace macrotype, gen_macrotype_
// AST
word AST, gen_AST
namespace AST_, gen_AST_
word Code, gen_Code
word Token, gen_Token
word CodeBody, gen_CodeBody
word CodeAttributes, gen_CodeAttributes
word CodeComment, gen_CodeComment
word CodeClass, gen_CodeClass
word CodeConstructor, gen_CodeConstructor
word CodeDefine, gen_CodeDefine
word CodeDefineParams, gen_CodeDefineParams
word CodeDestructor, gen_CodeDestructor
word CodeEnum, gen_CodeEnum
word CodeExec, gen_CodeExec
word CodeExtern, gen_CodeExtern
word CodeInclude, gen_CodeInclude
word CodeFriend, gen_CodeFriend
word CodeFn, gen_CodeFn
word CodeModule, gen_CodeModule
word CodeNS, gen_CodeNS
word CodeOperator, gen_CodeOperator
word CodeOpCast, gen_CodeOpCast
word CodePragma, gen_CodePragma
word CodeParams, gen_CodeParams
word CodePreprocessCond, gen_CodePreprocessCond
word CodeSpecifiers, gen_CodeSpecifiers
word CodeStruct, gen_CodeStruct
word CodeTemplate, gen_CodeTemplate
word CodeTypename, gen_CodeTypename
word CodeTypedef, gen_CodeTypedef
word CodeUnion, gen_CodeUnion
word CodeUsing, gen_CodeUsing
word CodeVar, gen_CodeVar
// Code Interface
word Context, gen_Context
namespace code_, gen_code_
word Code_Global, gen_Code_Global
word Code_Invalid, gen_Code_Invalid
word Code_POD, gen_Code_POD
word AST_POD_Size, gen_AST_POD_Size
word AST_ArrSpecs_Cap, gen_AST_ArrSpecs_Cap
word InvalidCode, gen_InvalidCode
word NullCode, gen_NullCode
namespace begin_, gen_begin_
namespace end_, gen_end_
namespace next_, gen_next_
namespace body_, gen_body_
namespace class_, gen_class_
namespace params_, gen_params_
namespace specifiers_, gen_specifiers_
namespace struct_, gen_struct_
namespace attributes_, gen_attributes_
namespace comment_, gen_comment_
namespace constructor, gen_constructor_
namespace define_, gen_define_
namespace destructor, gen_destructor_
namespace enum_, gen_enum_
namespace exec_, gen_exec_
namespace extern_, gen_extern_
namespace include_, gen_include_
namespace friend_, gen_friend_
namespace fn_, gen_fn_
namespace module_, gen_module_
namespace code_op, gen_code_op_
namespace opcast_, gen_opcast_
namespace pragma_, gen_pragma_
namespace preprocess_, gen_preprocess_
namespace template_, gen_template_
namespace typename_, gen_typename_
namespace typedef_, gen_typedef_
namesapce union_, gen_union_
namespace using_, gen_using_
namespace var_, gen_var_
// Gen Interface
word _ctx, gen__ctx
word init, gen_init
word deinit, gen_deinit
word reset, gen_reset
word cache_str, gen_cache_str
word make_code, gen_make_code
namespace set_allocator_, gen_set_allocator_
word register_macro, gen_register_macro
word register_macros, gen_register_macros
word register_macros_arr, gen_register_macros_arr
namespace Opts_, gen_Opts_
namespace def_, gen_def_
namespace parse_, gen_parse_
namespace token_, gen_token_
namespace untyped_, gen_untyped_
// Constants
word access_public, gen_access_public
word access_protected, gen_access_protected
word access_private, gen_access_private
word attrib_api_export, gen_attrib_api_export
word attrib_api_import, gen_attrib_api_import
word module_global_fragment, gen_module_global_fragment
word module_private_fragment, gen_module_private_fragment
word fmt_newline, gen_fmt_newline
word pragma_once, gen_pragma_once
word param_varadic, gen_param_varadic
word preprocess_else, gen_preprocess_else
namespace spec_, gen_spec_
namespace t_, gen_t_
// Backend
// Builder
word Builder, gen_Builder
namespace builder_, gen_builder_
// Scanner
word scan_file, gen_scan_file
word CSV_Column, gen_CSV_Column
word CSV_Columns2, gen_CSV_Columns2
// Implementation (prviate)
word _format_info, gen__format_info
namespace _print_, gen__print_
word _heap_stats, gen__heap_stats
word _heap_alloc_info, gen__heap_alloc_info
word _crc32_table, gen__crc32_table
word _crc64_table, gen__crc64_table
word _alloc_utf8_to_ucs2, gen__alloc_utf8_to_ucs2
word _win32_file_seek, gen__win32_file_seek
word _win32_file_read, gen__win32_file_read
word _win32_file_write, gen__win32_file_write
word _win32_file_close, gen__win32_file_close
word _win32_file_open, gen__win32_file_open
word _posix_file_seek, gen__posix_file_seek
word _posix_file_read, gen__posix_file_read
word _posix_file_write, gen__posix_file_write
word _posix_file_close, gen__posix_file_close
word _posix_file_open, gen__posix_file_open
word _dirinfo_free_entry, gen__dirinfo_free_entry
word _std_file_set, gen__std_file_set
word _memory_fd, gen__memory_fd
word _file_stream_fd_make, gen__file_stream_fd_make
word _file_stream_from_fd, gen__file_stream_from_fd
word _memory_file_seek, gen__memory_file_seek
word _memory_file_read, gen__memory_file_read
word _memory_file_write, gen__memory_file_write
word _memory_file_close, gen__memory_file_close
word _unix_gettime, gen__unix_gettime
word _adt_fprintf, gen__adt_fprintf
word _adt_get_value, gen__adt_get_value
word _adt_get_field, gen__adt_get_field
word _csv_write_record, gen__csv_write_record
word _csv_write_header, gen__csv_write_header
word fallback_allocator_proc, gen_Global_Allocator_Proc
word define_constants, gen_define_constants
word operator__validate, gen_operator__validate
word parser_init, gen_parser_init
word parser_deinit, gen_parser_deinit
word TokType, gen_TokType
word toktype_to_str, gen_toktype_to_str
word NullToken, gen_NullToken
namespace tok_, gen_tok_
word TokArray, gen_TokArray
namespace lex_, gen_lex_
namespace Lexer_, gen_Lexer_
word LexContext, gen_LexContext
word lex, gen_lex
word StackNode, gen_StackNode
word ParseContext, gen_ParseContext
// namespace parse_, gen_parse_
namespace parser_, gen_parser_