mirror of
https://github.com/Ed94/refactor.git
synced 2025-04-18 23:15:25 -07:00
Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
50033cc819 | |||
22f74f3dc6 | |||
6395d022f1 | |||
4d5cbd3e8d | |||
b21e1bf603 | |||
12779449a4 | |||
5efd14322e | |||
c4efd1890d | |||
063a3a972c | |||
e301b400ba | |||
6bc4346652 | |||
6e91555a20 | |||
1b0c5d176c | |||
ea09b27b3b | |||
d344043c44 |
10
.github/workflows/main.yml
vendored
10
.github/workflows/main.yml
vendored
@ -16,11 +16,13 @@ on:
|
||||
inputs:
|
||||
type:
|
||||
description: 'Meson buildtype (release, debug, etc.)'
|
||||
default: release
|
||||
required: false
|
||||
|
||||
test:
|
||||
description: 'Run tests (test)'
|
||||
required: false
|
||||
default: test
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@ -81,7 +83,7 @@ jobs:
|
||||
if (-not [string]::IsNullOrEmpty($type)) { $args += $type }
|
||||
if (-not [string]::IsNullOrEmpty($test)) { $args += $test }
|
||||
|
||||
& .\scripts\build.ci.ps1 debug test
|
||||
Invoke-Expression "& .\scripts\build.ci.ps1 $args"
|
||||
|
||||
- name: Get Short Commit SHA
|
||||
shell: pwsh
|
||||
@ -96,13 +98,13 @@ jobs:
|
||||
New-Item -ItemType Directory -Path "./artifact"
|
||||
Copy-Item "./build/refactor.exe" -Destination "./artifact/refactor.exe"
|
||||
|
||||
Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/refactor-${env:SHORT_SHA}.zip"
|
||||
Compress-Archive -Path "./artifact/*" -DestinationPath "./artifact/refactor-$($env:SHORT_SHA).zip"
|
||||
|
||||
- name: Upload Release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
tag: Release
|
||||
artifacts: ./artifact/refactor-${env:SHORT_SHA}.zip
|
||||
artifacts: ./artifact/refactor-${{ env.SHORT_SHA }}.zip
|
||||
omitBody: true
|
||||
# bodyFile: "body.md"
|
||||
allowUpdates: true
|
||||
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@ -47,10 +47,10 @@
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/refactor.exe",
|
||||
"args": [
|
||||
"-source=./refactor.cpp",
|
||||
"-destination=./Test/refactor.cpp",
|
||||
"-src=./project/refactor.cpp",
|
||||
"-dst=./Test/refactor.cpp",
|
||||
|
||||
"-specification=./Test/zpl.refactor"
|
||||
"-spec=./Test/zpl.refactor"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceRoot}",
|
||||
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2023, Ed_
|
||||
Copyright (c) 2023, Edward R. Gonzalez
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
72
Readme.md
72
Readme.md
@ -2,48 +2,88 @@
|
||||
|
||||
Refactor c/c++ files (and problably others) with ease.
|
||||
|
||||
## Parameters :
|
||||
## Parameters
|
||||
|
||||
* `-num` : Used if more than one source file is provided (if used, number of destination files provided MUST MATCH).
|
||||
* `-src` : Source file to refactor
|
||||
* `-dst` : Destination file after the refactor (omit to use the same as source)
|
||||
* `-spec` : Specification containing rules to use for the refactor.
|
||||
* `-debug` : Use only if on debug build and desire to attach to process.
|
||||
* `-debug` : Use if on debug build and desire to attach to process, or to get a more verbose log.
|
||||
|
||||
## Syntax :
|
||||
## Syntax
|
||||
|
||||
* `not` Omit word or namespace.
|
||||
* `include` Preprocessor include <file> related identifiers.
|
||||
* `not` Omit an a signature. (Modifies include, word, namespace, etc)
|
||||
* `include` Preprocessor include `<file path>` related identifiers.
|
||||
* `word` Fixed sized identifier.
|
||||
* `namespace` Variable sized identifiers, mainly intended to redefine c-namespace of an identifier.
|
||||
* `,` is used to delimit arguments (if doing a find and replace).
|
||||
* `L-Value` is the signature to modify.
|
||||
* `R-Value` is the substitute ( only available if rule does not use `not` keyword )
|
||||
|
||||
The only keyword here excluisve to c/c++ is the `include` as it does search specifically for `#include <L-Value>`.
|
||||
The only keyword here excluisve to c/c++ is the `include` as it does search specifically for `#include <L-Value>`.
|
||||
However, the rest of the categorical keywords (word, namespace), can really be used for any langauge.
|
||||
|
||||
There is no semantic awareness this is truely just a simple find and replace, but with some filters specifiable, and
|
||||
There is no semantic awareness this is truely just a simple find and replace, but with some filters specifiable, and
|
||||
words/namespaces only being restricted to the rules for C/C++ identifiers (alphanumeric or underscores only)
|
||||
|
||||
The main benefit for using this over alts is its problably more ergonomic and performant for large refactors on libraries you may want to have automated in a script.
|
||||
|
||||
There are other programs more robust for doing that sort of thing but I was not able to find something this simple.
|
||||
|
||||
### Note
|
||||
### Example scripts
|
||||
|
||||
* Building for debug provides some nice output with context on a per-line basis.
|
||||
* Release will only show errors for asserts (that will kill the refactor early).
|
||||
See `scripts/template_reafactor.ps1` and the `test/*.refactor` related scripts on intended usage.
|
||||
|
||||
This app is not very nice to use directly from CLI. Instead run from a script after gathering the arguments.
|
||||
|
||||
There is a desire also to get this setup as a single-header library and also alternative with a minimalist GUI for simple refactors.
|
||||
|
||||
### Notes
|
||||
|
||||
* Building for debug provides some nice output with context on a per-line basis.
|
||||
* Release will only show errors for asserts (that will kill the refactor early).
|
||||
* If the refactor crashes, the files previously written to will retain their changes.
|
||||
Make sure to have the code backed up on a VCS or in some other way.
|
||||
* This was compiled using meson with ninja and clang on windows 11. The ZPL library used however should work fine on the other major os platforms and compiler venders.
|
||||
* Make sure to have the code backed up on a VCS or in some other way.
|
||||
* The scripts used for building and otherwise are in the scripts directory and are all in powershell (with exception to the meson.build). Techncially there should be a powershell package available on other platorms but worst case it should be pretty easy to port these scripts to w/e shell script you'd perfer.
|
||||
|
||||
TODO:
|
||||
## Building
|
||||
|
||||
The project has all build configuration in the `scripts` directory.
|
||||
|
||||
* `build.ci.ps1` is intended for a continuous intergration setup (GH-worfklow for now).
|
||||
* `build.ps1` is just a wrap of build.ci that just calls cls.
|
||||
* `clean.ps1` will clean the workspace of all generated files.
|
||||
* `get_sources.ps1` is used to gather sources since meson devs refuse to add dynamic retrival of sources for a build.
|
||||
|
||||
The project uses [meson](https://github.com/mesonbuild/meson) as the build tool.
|
||||
Compiler : clang
|
||||
OS: Windows 11 (windows-latest for github actions)
|
||||
|
||||
There should theoretically not be anything stopping it from building on other plaforms.
|
||||
The library's main dependency is [zpl](https://github.com/zpl-c) which seems to support all major platforms.
|
||||
|
||||
## Testing
|
||||
|
||||
If the `test` parameter is provided to the build scripts, the project and thirdparty code will be refactored based on the specificiation files `*.refactor` residing in `test`.
|
||||
|
||||
With the refactors applied a meson configuraiton is setup (`meson.build` in test) and run to build. So long as it compiles, the feature set of the current version should work fine.
|
||||
|
||||
* There is an extra file `stb_image` that is parsed but unused during compilation.
|
||||
* Planned for use in the namespace addition todo.
|
||||
|
||||
## TODO:
|
||||
|
||||
* Possibly come up with a better name.
|
||||
* Test to see how much needs to be ported for other platforms (if at all)
|
||||
* Provide binaries in the release page for github. (debug and release builds)
|
||||
* Directive to ignore comments (with a way to specify the comment signature). Right now comments that meet the signature of words or namespaces are refactored.
|
||||
* Ability to run and not emit any changes to files unless all files sucessfully are refactored.
|
||||
* Would fix issue where a refactor overwrites files but failed to complete
|
||||
* Can have a heavy memory cost, so most likely do not want on by default.
|
||||
* Make comments ignored by default, and just have ability to specify custom comments.
|
||||
* Would need a directive to add refactors to comments.
|
||||
* Provide a GUI build.
|
||||
* Provide as a single-header library.
|
||||
* Could add a test case where this library is refactored into pure C (most likely c99 or c11).
|
||||
* Better tests:
|
||||
* Automatically pull the zpl repo, refactor and format the library, and package the single header before using it in testing.
|
||||
* Use gencpp editor/scanner functionality to give it more rich context refactors.
|
||||
* Port to other platforms.
|
||||
* Ability to change the naming convention of a signature (snake_case to PascalCase, etc)
|
||||
|
@ -4,7 +4,7 @@ __VERSION 1
|
||||
// include : #includes
|
||||
// word : Alphanumeric or underscore
|
||||
// namespace : Prefix search and replace (c-namspaces).
|
||||
// regex : Unavailable in __VERSION 1.
|
||||
// regex : Unavailable in __VERSION 1.
|
||||
|
||||
// Precedence (highest to lowest):
|
||||
// word, namespace, regex
|
||||
@ -21,21 +21,168 @@ include IO.cpp, IO.refactored.cpp
|
||||
include Spec.hpp, Spec.refactored.hpp
|
||||
include Spec.cpp, Spec.refactored.cpp
|
||||
|
||||
// Remove the zpl namespace.
|
||||
// Removes the namespace.
|
||||
namespace zpl_
|
||||
|
||||
// Don't expose zpl internals
|
||||
not namespace zpl__
|
||||
namespace zpl_re_, regex_
|
||||
namespace zpl_random_, rng_
|
||||
namespace zpl_pr, process_
|
||||
namespace zpl__, __
|
||||
namespace ZPL_ADT_, EADT
|
||||
namespace ZPL_ALLOCATION_, EAllocation
|
||||
namespace ZPL_CSV_ERROR, ECSV_Error
|
||||
namespace ZPL_FILE_MODE_, EFileMode_
|
||||
namespace ZPL_FILE_ERROR_, EFileError_
|
||||
namespace ZPL_SEEK_WHENCE_, ESeekWhence_
|
||||
namespace ZPL_FILE_STANDARD_, EFileStandard_
|
||||
namespace ZPL_FILE_STREAM_, EFileStream_
|
||||
namespace ZPL_JSON_ERROR_, EJSON_Error_
|
||||
namespace ZPL_RE_ERROR_, ERegexError_
|
||||
namespace ZPL_OPTS_, EOpts_
|
||||
namespace ZPL_OPTS_ERR, EOptsError_
|
||||
namespace ZPL_PR_OPTS_, EProcessOpts_
|
||||
|
||||
// Macro exposure
|
||||
//namespace ZPL_
|
||||
//not word ZPL_IMPLEMENTATION
|
||||
|
||||
// Name conflicts
|
||||
word opts, options
|
||||
// Type Renames
|
||||
word zpl_aabb2, AABB2
|
||||
word zpl_aabb3, AABB3
|
||||
word zpl_adt_assign_style, ADT_AssignStyle
|
||||
word zpl_adt_delim_style, ADT_DelimStyle
|
||||
word zpl_adt_error, ADT_Error
|
||||
word zpl_adt_naming_style, ADT_NamingStyle
|
||||
word zpl_adt_node, ADT_Node
|
||||
word zpl_adt_props, ADT_Props
|
||||
word zpl_adt_type, ADT_Type
|
||||
word zpl_affinity, Affinity
|
||||
word zpl_allocation_header_event, AllocationHeaderEvent
|
||||
word zpl_allocator, AllocatorInfo
|
||||
word zpl_allocator_proc, AllocatorProc
|
||||
word zpl_alloc_flags, AllocFlags
|
||||
word zpl_alloc_type, AllocType
|
||||
word zpl_arena, Arena
|
||||
word zpl_arena_snapshot, ArenaSnapshot
|
||||
word zpl_array, Array
|
||||
word zpl_array_header, ArrayHeader
|
||||
word zpl_buffer, Buffer
|
||||
word zpl_buffer_header, BufferHeader
|
||||
word zpl_compare_proc, CompareProc
|
||||
word zpl_csv_error, CSV_Error
|
||||
word zpl_csv_object, CSV_Object
|
||||
word zpl_dll_handle, DLLHandle
|
||||
word zpl_dll_proc, DLLProc
|
||||
word zpl_dir_type, DirType
|
||||
word zpl_dir_entry, DirEntry
|
||||
word zpl_dir_info, DirInfo
|
||||
word zpl_file_contents, FileContents
|
||||
word zpl_file_descriptor, FileDescriptor
|
||||
word zpl_file_error, FileError
|
||||
word zpl_file, FileInfo
|
||||
word zpl_file_mode, FileMode
|
||||
word zpl_file_mode_flag, FileModeFlag
|
||||
word zpl_file_operations, FileOperations
|
||||
word zpl_file_close_proc, FileCloseProc
|
||||
word zpl_file_read_proc, FileReadProc
|
||||
word zpl_file_seek_proc, FileSeekProc
|
||||
word zpl_file_write_proc, FileWriteProc
|
||||
word zpl_file_standard_type, FileStandardType
|
||||
word zpl_file_stream_flags, FileStreamFlags
|
||||
word zpl_float2, Float2
|
||||
word zpl_float3, Float3
|
||||
word zpl_float4, Float4
|
||||
word zpl_frustum, Frustum
|
||||
word zpl_half, Half
|
||||
word zpl_jobs_priority, JobsPriority
|
||||
word zpl_jobs_status, JobsStatus
|
||||
word zpl_jobs_system, JobsSystem
|
||||
word zpl_json_error, JSON_Error
|
||||
word zpl_json_object, JSON_Object
|
||||
word zpl_list, List
|
||||
word zpl_mat2, Mat2
|
||||
word zpl_mat3, Mat3
|
||||
word zpl_mat4, Mat4
|
||||
word zpl_mutex, Mutex
|
||||
word zpl_plane, Plane
|
||||
word zpl_pool, Pool
|
||||
word zpl_pr, Process
|
||||
word zpl_pr_si, ProcessStartupInfo
|
||||
word zpl_quat, Quat
|
||||
word zpl_rect2, Rect2
|
||||
word zpl_rect3, Rect3
|
||||
word zpl_re, Regex
|
||||
word zpl_re_capture, RegexCapture
|
||||
word zpl_regex_error, RegexError
|
||||
wrod zpl_random, RNG
|
||||
word zpl_rune, Rune
|
||||
word zpl_scratch_memory, ScratchMemory
|
||||
word zpl_seek_whence_type, SeekWhenceType
|
||||
word zpl_semaphore, Semaphore
|
||||
word zpl_string, String
|
||||
word zpl_string_header, StringHeader
|
||||
word zpl_sync, Sync
|
||||
word zpl_opts, Opts
|
||||
word zpl_opts_entry, OptsEntry
|
||||
word zpl_opts_err, OptsError
|
||||
word zpl_opts_err_type, OptsErrorType
|
||||
word zpl_opts_types, OptsTypes
|
||||
word zpl_tar_errors, TarErrors
|
||||
word zpl_tar_file_type, TarFileType
|
||||
word zpl_tar_record, TarRecord
|
||||
word zpl_tar_unpack_proc, TarUnpackProc
|
||||
word zpl_thread, Thread
|
||||
word zpl_thread_job, ThreadJob
|
||||
word zpl_thread_proc, ThreadProc
|
||||
word zpl_thread_queue, ThreadQueue
|
||||
word zpl_thread_worker, ThreadWorker
|
||||
word zpl_vec2, Vec2
|
||||
word zpl_vec3, Vec3
|
||||
word zpl_vec4, Vec4
|
||||
word zpl_virtual_memory, VirtualMemory
|
||||
|
||||
word zpl_strncmp, str_compare
|
||||
word zpl_strcmp, str_compare
|
||||
// Function Renames
|
||||
word zpl_lfence, fence_load
|
||||
word zpl_mfence, fence_memory
|
||||
word zpl_sfence, fence_store
|
||||
word zpl_memchr, mem_find
|
||||
word zpl_memcopy, mem_copy
|
||||
word zpl_memmove, mem_move
|
||||
word zpl_memset, mem_set
|
||||
word zpl_memswap, mem_swap
|
||||
word zpl_exit, process_exit
|
||||
word zpl_rdtsc, read_cpu_time_stamp_counter
|
||||
word zpl_strcmp, str_compare
|
||||
word zpl_strncmp, str_compare
|
||||
word zpl_strcat, str_concat
|
||||
word zpl_strcpy, str_copy
|
||||
word zpl_strncpy, str_copy
|
||||
word zpl_strlcpy, str_copy_nulpad
|
||||
word zpl_strdup, str_dup
|
||||
word zpl_strchr, str_find
|
||||
word zpl_strrchr, str_find_last
|
||||
word zpl_strstr, str_find_substr
|
||||
word zpl_snprintf, str_fmt
|
||||
word zpl_snprintf_va, str_fmt_va
|
||||
word zpl_asprintf, str_fmt_alloc
|
||||
word zpl_asprintf_va, str_fmt_alloc_va
|
||||
word zpl_bprintf, str_fmt_buf
|
||||
word zpl_bprintf_va, str_fmt_buf_va
|
||||
word zpl_printf, str_fmt_out
|
||||
word zpl_printf_va, str_fmt_out_va
|
||||
word zpl_printf_err, str_fmt_out_err
|
||||
word zpl_printf_err_va, str_fmt_out_err_va
|
||||
word zpl_fprintf, str_fmt_file
|
||||
word zpl_fprintf_va, str_fmt_file_va
|
||||
word zpl_strlen, str_len
|
||||
word zpl_strnlen, str_len
|
||||
word zpl_strrev, str_reverse
|
||||
word zpl_strtok, str_tok
|
||||
word zpl_strtok_r, str_tok_reentrant
|
||||
word zpl_sleep, thread_sleep
|
||||
word zpl_sleep_ms, thread_sleep_ms
|
||||
word zpl_yield_thread, thread_yield
|
||||
word zpl_utf8_strlen, utf8_len
|
||||
word zpl_utf8_strnlen, utf8_len
|
||||
|
||||
// Undesired typedefs
|
||||
word zpl_i8, s8
|
||||
@ -51,21 +198,7 @@ word zpl_uintptr, uptr
|
||||
word zpl_usize, uw
|
||||
word zpl_isize, sw
|
||||
|
||||
// Conflicts with std. (Uncomment if using c externs)
|
||||
not word zpl_memchr
|
||||
not word zpl_memmove
|
||||
not word zpl_memset
|
||||
not word zpl_memswap
|
||||
not word zpl_memcopy
|
||||
not word zpl_printf
|
||||
not word zpl_printf_va
|
||||
not word zpl_printf_err
|
||||
not word zpl_printf_err_va
|
||||
not word zpl_fprintf
|
||||
not word zpl_fprintf_va
|
||||
not word zpl_snprintf
|
||||
not word zpl_snprintf_va
|
||||
not word zpl_strchr
|
||||
not word zpl_strlen
|
||||
not word zpl_strnlen
|
||||
not word zpl_exit
|
||||
// Undesired exposures.
|
||||
word cast, zpl_cast
|
||||
|
||||
not word zpl_thread_local
|
||||
|
6
Test/stb_image.refactor
Normal file
6
Test/stb_image.refactor
Normal file
@ -0,0 +1,6 @@
|
||||
__VERSION 1
|
||||
|
||||
not comments
|
||||
|
||||
namespace stbi_
|
||||
not namepsace stbi__
|
@ -4,11 +4,14 @@ __VERSION 1
|
||||
// include : #includes
|
||||
// word : Alphanumeric or underscore
|
||||
// namespace : Prefix search and replace (c-namspaces).
|
||||
// regex : Unavailable in __VERSION 1.
|
||||
// regex : Unavailable in __VERSION 1.
|
||||
|
||||
// Precedence (highest to lowest):
|
||||
// word, namespace, regex
|
||||
|
||||
// This is a cpp refactor specification for zpl.h
|
||||
// Its intended that the content will be within a cpp namesapce
|
||||
|
||||
// Comments
|
||||
not comments
|
||||
|
||||
@ -20,22 +23,172 @@ not include header/essentials/collections/array.h
|
||||
not include header/essentials/collections/list.h
|
||||
not include header/core/file.h
|
||||
not include header/opts.h
|
||||
not include header/regex.h
|
||||
not include source/core/file.c
|
||||
not include source/opts.c
|
||||
|
||||
// Removes the namespace.
|
||||
namespace zpl_
|
||||
|
||||
// Don't expose internals
|
||||
not namespace zpl__
|
||||
namespace zpl_re_, regex_
|
||||
namespace zpl_random_, rng_
|
||||
namespace zpl_pr, process_
|
||||
namespace zpl__, __
|
||||
namespace ZPL_ADT_, EADT
|
||||
namespace ZPL_ALLOCATION_, EAllocation_
|
||||
namespace ZPL_CSV_ERROR, ECSV_Error_
|
||||
namespace ZPL_FILE_MODE_, EFileMode_
|
||||
namespace ZPL_FILE_ERROR_, EFileError_
|
||||
namespace ZPL_SEEK_WHENCE_, ESeekWhence_
|
||||
namespace ZPL_FILE_STANDARD_, EFileStandard_
|
||||
namespace ZPL_FILE_STREAM_, EFileStream_
|
||||
namespace ZPL_JSON_ERROR_, EJSON_Error_
|
||||
namespace ZPL_RE_ERROR_, ERegexError_
|
||||
namespace ZPL_OPTS_, EOpts_
|
||||
namespace ZPL_OPTS_ERR, EOptsError_
|
||||
namespace ZPL_PR_OPTS_, EProcessOpts_
|
||||
|
||||
// Macro exposure
|
||||
//namespace ZPL_
|
||||
//not word ZPL_IMPLEMENTATION
|
||||
|
||||
word cast, zpl_cast
|
||||
word zpl_strncmp, str_compare
|
||||
word zpl_strcmp, str_compare
|
||||
// Type Renames
|
||||
word zpl_aabb2, AABB2
|
||||
word zpl_aabb3, AABB3
|
||||
word zpl_adt_assign_style, ADT_AssignStyle
|
||||
word zpl_adt_delim_style, ADT_DelimStyle
|
||||
word zpl_adt_error, ADT_Error
|
||||
word zpl_adt_naming_style, ADT_NamingStyle
|
||||
word zpl_adt_node, ADT_Node
|
||||
word zpl_adt_props, ADT_Props
|
||||
word zpl_adt_type, ADT_Type
|
||||
word zpl_affinity, Affinity
|
||||
word zpl_allocation_header_event, AllocationHeaderEvent
|
||||
word zpl_allocator, AllocatorInfo
|
||||
word zpl_allocator_proc, AllocatorProc
|
||||
word zpl_alloc_flags, AllocFlags
|
||||
word zpl_alloc_type, AllocType
|
||||
word zpl_arena, Arena
|
||||
word zpl_arena_snapshot, ArenaSnapshot
|
||||
word zpl_array, Array
|
||||
word zpl_array_header, ArrayHeader
|
||||
word zpl_buffer, Buffer
|
||||
word zpl_buffer_header, BufferHeader
|
||||
word zpl_compare_proc, CompareProc
|
||||
word zpl_csv_error, CSV_Error
|
||||
word zpl_csv_object, CSV_Object
|
||||
word zpl_dll_handle, DLLHandle
|
||||
word zpl_dll_proc, DLLProc
|
||||
word zpl_dir_type, DirType
|
||||
word zpl_dir_entry, DirEntry
|
||||
word zpl_dir_info, DirInfo
|
||||
word zpl_file_contents, FileContents
|
||||
word zpl_file_descriptor, FileDescriptor
|
||||
word zpl_file_error, FileError
|
||||
word zpl_file, FileInfo
|
||||
word zpl_file_mode, FileMode
|
||||
word zpl_file_mode_flag, FileModeFlag
|
||||
word zpl_file_operations, FileOperations
|
||||
word zpl_file_close_proc, FileCloseProc
|
||||
word zpl_file_read_proc, FileReadProc
|
||||
word zpl_file_seek_proc, FileSeekProc
|
||||
word zpl_file_write_proc, FileWriteProc
|
||||
word zpl_file_standard_type, FileStandardType
|
||||
word zpl_file_stream_flags, FileStreamFlags
|
||||
word zpl_float2, Float2
|
||||
word zpl_float3, Float3
|
||||
word zpl_float4, Float4
|
||||
word zpl_frustum, Frustum
|
||||
word zpl_half, Half
|
||||
word zpl_jobs_priority, JobsPriority
|
||||
word zpl_jobs_status, JobsStatus
|
||||
word zpl_jobs_system, JobsSystem
|
||||
word zpl_json_error, JSON_Error
|
||||
word zpl_json_object, JSON_Object
|
||||
word zpl_list, List
|
||||
word zpl_mat2, Mat2
|
||||
word zpl_mat3, Mat3
|
||||
word zpl_mat4, Mat4
|
||||
word zpl_mutex, Mutex
|
||||
word zpl_plane, Plane
|
||||
word zpl_pool, Pool
|
||||
word zpl_pr, Process
|
||||
word zpl_pr_si, ProcessStartupInfo
|
||||
word zpl_quat, Quat
|
||||
word zpl_rect2, Rect2
|
||||
word zpl_rect3, Rect3
|
||||
word zpl_re, Regex
|
||||
word zpl_re_capture, RegexCapture
|
||||
word zpl_regex_error, RegexError
|
||||
wrod zpl_random, RNG
|
||||
word zpl_rune, Rune
|
||||
word zpl_scratch_memory, ScratchMemory
|
||||
word zpl_seek_whence_type, SeekWhenceType
|
||||
word zpl_semaphore, Semaphore
|
||||
word zpl_string, String
|
||||
word zpl_string_header, StringHeader
|
||||
word zpl_sync, Sync
|
||||
word zpl_opts, Opts
|
||||
word zpl_opts_entry, OptsEntry
|
||||
word zpl_opts_err, OptsError
|
||||
word zpl_opts_err_type, OptsErrorType
|
||||
word zpl_opts_types, OptsTypes
|
||||
word zpl_tar_errors, TarErrors
|
||||
word zpl_tar_file_type, TarFileType
|
||||
word zpl_tar_record, TarRecord
|
||||
word zpl_tar_unpack_proc, TarUnpackProc
|
||||
word zpl_thread, Thread
|
||||
word zpl_thread_job, ThreadJob
|
||||
word zpl_thread_proc, ThreadProc
|
||||
word zpl_thread_queue, ThreadQueue
|
||||
word zpl_thread_worker, ThreadWorker
|
||||
word zpl_vec2, Vec2
|
||||
word zpl_vec3, Vec3
|
||||
word zpl_vec4, Vec4
|
||||
word zpl_virtual_memory, VirtualMemory
|
||||
|
||||
// Function Renames
|
||||
word zpl_lfence, fence_load
|
||||
word zpl_mfence, fence_memory
|
||||
word zpl_sfence, fence_store
|
||||
word zpl_memchr, mem_find
|
||||
word zpl_memcopy, mem_copy
|
||||
word zpl_memmove, mem_move
|
||||
word zpl_memset, mem_set
|
||||
word zpl_memswap, mem_swap
|
||||
word zpl_exit, process_exit
|
||||
word zpl_rdtsc, read_cpu_time_stamp_counter
|
||||
word zpl_strcmp, str_compare
|
||||
word zpl_strncmp, str_compare
|
||||
word zpl_strcat, str_concat
|
||||
word zpl_strcpy, str_copy
|
||||
word zpl_strncpy, str_copy
|
||||
word zpl_strlcpy, str_copy_nulpad
|
||||
word zpl_strdup, str_dup
|
||||
word zpl_strchr, str_find
|
||||
word zpl_strrchr, str_find_last
|
||||
word zpl_strstr, str_find_substr
|
||||
word zpl_snprintf, str_fmt
|
||||
word zpl_snprintf_va, str_fmt_va
|
||||
word zpl_asprintf, str_fmt_alloc
|
||||
word zpl_asprintf_va, str_fmt_alloc_va
|
||||
word zpl_bprintf, str_fmt_buf
|
||||
word zpl_bprintf_va, str_fmt_buf_va
|
||||
word zpl_printf, str_fmt_out
|
||||
word zpl_printf_va, str_fmt_out_va
|
||||
word zpl_printf_err, str_fmt_out_err
|
||||
word zpl_printf_err_va, str_fmt_out_err_va
|
||||
word zpl_fprintf, str_fmt_file
|
||||
word zpl_fprintf_va, str_fmt_file_va
|
||||
word zpl_strlen, str_len
|
||||
word zpl_strnlen, str_len
|
||||
word zpl_strrev, str_reverse
|
||||
word zpl_strtok, str_tok
|
||||
word zpl_strtok_r, str_tok_reentrant
|
||||
word zpl_sleep, thread_sleep
|
||||
word zpl_sleep_ms, thread_sleep_ms
|
||||
word zpl_yield_thread, thread_yield
|
||||
word zpl_utf8_strlen, utf8_len
|
||||
word zpl_utf8_strnlen, utf8_len
|
||||
|
||||
// Undesired typedefs
|
||||
word zpl_i8, s8
|
||||
@ -52,39 +205,10 @@ word zpl_usize, uw
|
||||
word zpl_isize, sw
|
||||
|
||||
// Undesired exposures.
|
||||
//not word zpl_allocator
|
||||
//not word zpl_arena
|
||||
//not word zpl_array
|
||||
//not word zpl_file
|
||||
//not word zpl_list
|
||||
//not word zpl_pool
|
||||
//not word zpl_opts
|
||||
word cast, zpl_cast
|
||||
|
||||
// Conflicts with refactor
|
||||
word arena, a_arena
|
||||
word array, a_array
|
||||
word alloc, a_allocator
|
||||
word file, a_file
|
||||
not word zpl_thread_local
|
||||
|
||||
// Name Conflicts
|
||||
word file_size, fsize
|
||||
word list, a_list
|
||||
word opts, a_opts
|
||||
word pool, a_pool
|
||||
|
||||
// Conflicts with std. (Uncomment if using c externs)
|
||||
not word zpl_memchr
|
||||
not word zpl_memmove
|
||||
not word zpl_memset
|
||||
not word zpl_memswap
|
||||
not word zpl_memcopy
|
||||
not word zpl_printf
|
||||
not word zpl_printf_va
|
||||
not word zpl_printf_err
|
||||
not word zpl_printf_err_va
|
||||
not word zpl_fprintf
|
||||
not word zpl_fprintf_va
|
||||
not word zpl_snprintf
|
||||
not word zpl_snprintf_va
|
||||
not word zpl_strchr
|
||||
not word zpl_strlen
|
||||
not word zpl_strnlen
|
||||
not word zpl_exit
|
||||
word alloc, allocator
|
||||
|
@ -9,7 +9,7 @@ namespace Global
|
||||
namespace Memory
|
||||
{
|
||||
zpl_arena Global_Arena {};
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
zpl_arena_init_from_allocator( & Global_Arena, zpl_heap(), Initial_Reserve );
|
||||
@ -19,16 +19,16 @@ namespace Memory
|
||||
zpl_assert_crash( "Failed to reserve memory for Tests:: Global_Arena" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void resize( uw new_size )
|
||||
{
|
||||
void* new_memory = zpl_resize( zpl_heap(), Global_Arena.physical_start, Global_Arena.total_size, new_size );
|
||||
|
||||
void* new_memory = zpl_resize( zpl_heap(), Global_Arena.physical_start, Global_Arena.total_size, new_size );
|
||||
|
||||
if ( new_memory == nullptr )
|
||||
{
|
||||
fatal("Failed to resize global arena!");
|
||||
}
|
||||
|
||||
|
||||
Global_Arena.physical_start = new_memory;
|
||||
Global_Arena.total_size = new_size;
|
||||
}
|
||||
@ -36,7 +36,7 @@ namespace Memory
|
||||
void cleanup()
|
||||
{
|
||||
zpl_arena_free( & Global_Arena);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ bool opts_custom_add(zpl_opts* opts, zpl_opts_entry *t, char* b)
|
||||
{
|
||||
if (t->type != ZPL_OPTS_STRING)
|
||||
{
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
t->text = zpl_string_append_length(t->text, " ", 1);
|
||||
@ -53,23 +53,23 @@ bool opts_custom_add(zpl_opts* opts, zpl_opts_entry *t, char* b)
|
||||
return true;
|
||||
}
|
||||
|
||||
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
{
|
||||
zpl_b32 had_errors = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
char* arg = argv[i];
|
||||
|
||||
if (*arg)
|
||||
|
||||
if (*arg)
|
||||
{
|
||||
arg = (char*)zpl_str_trim(arg, false);
|
||||
|
||||
if (*arg == '-')
|
||||
if (*arg == '-')
|
||||
{
|
||||
zpl_opts_entry* entry = 0;
|
||||
zpl_b32 checkln = false;
|
||||
if ( *(arg + 1) == '-')
|
||||
if ( *(arg + 1) == '-')
|
||||
{
|
||||
checkln = true;
|
||||
++arg;
|
||||
@ -83,15 +83,15 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
|
||||
entry = zpl__opts_find(opts, b, (e - b), checkln);
|
||||
|
||||
if (entry)
|
||||
if (entry)
|
||||
{
|
||||
char *ob = b;
|
||||
b = e;
|
||||
|
||||
/**/
|
||||
if (*e == '=')
|
||||
/**/
|
||||
if (*e == '=')
|
||||
{
|
||||
if (entry->type == ZPL_OPTS_FLAG)
|
||||
if (entry->type == ZPL_OPTS_FLAG)
|
||||
{
|
||||
*e = '\0';
|
||||
zpl__opts_push_error(opts, ob, ZPL_OPTS_ERR_EXTRA_VALUE);
|
||||
@ -101,14 +101,14 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
}
|
||||
|
||||
b = e = e + 1;
|
||||
}
|
||||
else if (*e == '\0')
|
||||
}
|
||||
else if (*e == '\0')
|
||||
{
|
||||
char *sp = argv[i+1];
|
||||
|
||||
if (sp && *sp != '-' && (zpl_array_count(opts->positioned) < 1 || entry->type != ZPL_OPTS_FLAG))
|
||||
if (sp && *sp != '-' && (zpl_array_count(opts->positioned) < 1 || entry->type != ZPL_OPTS_FLAG))
|
||||
{
|
||||
if (entry->type == ZPL_OPTS_FLAG)
|
||||
if (entry->type == ZPL_OPTS_FLAG)
|
||||
{
|
||||
zpl__opts_push_error(opts, b, ZPL_OPTS_ERR_EXTRA_VALUE);
|
||||
had_errors = true;
|
||||
@ -119,10 +119,10 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
arg = sp;
|
||||
b = e = sp;
|
||||
++i;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if (entry->type != ZPL_OPTS_FLAG)
|
||||
if (entry->type != ZPL_OPTS_FLAG)
|
||||
{
|
||||
zpl__opts_push_error(opts, ob, ZPL_OPTS_ERR_MISSING_VALUE);
|
||||
had_errors = true;
|
||||
@ -145,20 +145,20 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv)
|
||||
opts_custom_add(opts, entry, b );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
zpl__opts_push_error(opts, b, ZPL_OPTS_ERR_OPTION);
|
||||
had_errors = true;
|
||||
}
|
||||
}
|
||||
else if (zpl_array_count(opts->positioned))
|
||||
}
|
||||
else if (zpl_array_count(opts->positioned))
|
||||
{
|
||||
zpl_opts_entry *l = zpl_array_back(opts->positioned);
|
||||
zpl_array_pop(opts->positioned);
|
||||
zpl__opts_set_value(opts, l, arg);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
zpl__opts_push_error(opts, arg, ZPL_OPTS_ERR_VALUE);
|
||||
had_errors = true;
|
||||
|
@ -2,7 +2,7 @@
|
||||
BLOAT.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#ifdef BLOAT_IMPL
|
||||
# define ZPL_IMPLEMENTATION
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#pragma region ZPL INCLUDE
|
||||
#if __clang__
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wmissing-braces"
|
||||
# pragma clang diagnostic ignored "-Wbraced-scalar-init"
|
||||
#endif
|
||||
@ -55,8 +55,8 @@
|
||||
#define gen( ... ) template< __VA_ARGS__ >
|
||||
#define forceinline ZPL_ALWAYS_INLINE
|
||||
#define print_nl( _) zpl_printf("\n")
|
||||
#define scast( Type_, Value_ ) static_cast< Type_ >( Value_ )
|
||||
#define rcast( Type_, Value_ ) reinterpret_cast< Type_ >( Value_ )
|
||||
#define scast( Type_, Value_ ) static_cast< Type_ >( Value_ )
|
||||
#define rcast( Type_, Value_ ) reinterpret_cast< Type_ >( Value_ )
|
||||
#define pcast( Type_, Value_ ) ( * (Type_*)( & Value_ ) )
|
||||
|
||||
#define do_once() \
|
||||
@ -111,25 +111,25 @@ b32 opts_custom_compile(zpl_opts *opts, int argc, char **argv);
|
||||
|
||||
|
||||
inline
|
||||
sw log_fmt(char const *fmt, ...)
|
||||
sw log_fmt(char const *fmt, ...)
|
||||
{
|
||||
if ( Global::ShouldShowDebug == false )
|
||||
return 0;
|
||||
|
||||
sw res;
|
||||
va_list va;
|
||||
|
||||
|
||||
va_start(va, fmt);
|
||||
res = zpl_printf_va(fmt, va);
|
||||
va_end(va);
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
inline
|
||||
void fatal(char const *fmt, ...)
|
||||
void fatal(char const *fmt, ...)
|
||||
{
|
||||
zpl_local_persist zpl_thread_local
|
||||
zpl_local_persist zpl_thread_local
|
||||
char buf[ZPL_PRINTF_MAXLEN] = { 0 };
|
||||
|
||||
va_list va;
|
||||
|
@ -4,13 +4,13 @@
|
||||
namespace IO
|
||||
{
|
||||
using array_string = zpl_array( zpl_string );
|
||||
|
||||
|
||||
namespace StaticData
|
||||
{
|
||||
array_string Sources = nullptr;
|
||||
array_string Destinations = nullptr;
|
||||
zpl_string Specification = nullptr;
|
||||
|
||||
|
||||
// Current source and destination index.
|
||||
// Used to keep track of which file get_next_source or write refer to.
|
||||
sw Current = -1;
|
||||
@ -22,12 +22,12 @@ namespace IO
|
||||
zpl_arena MemSrc;
|
||||
}
|
||||
using namespace StaticData;
|
||||
|
||||
|
||||
|
||||
|
||||
void prepare()
|
||||
{
|
||||
const sw num_srcs = zpl_array_count( Sources );
|
||||
|
||||
|
||||
// Determine the largest content size.
|
||||
sw left = num_srcs;
|
||||
zpl_string* path = Sources;
|
||||
@ -35,14 +35,14 @@ namespace IO
|
||||
{
|
||||
zpl_file src = {};
|
||||
zpl_file_error error = zpl_file_open( & src, *path );
|
||||
|
||||
|
||||
if ( error != ZPL_FILE_ERROR_NONE )
|
||||
{
|
||||
fatal("IO::Prepare - Could not open source file: %s", *path );
|
||||
}
|
||||
|
||||
|
||||
const sw fsize = zpl_file_size( & src );
|
||||
|
||||
|
||||
if ( fsize > Largest_Src_Size )
|
||||
{
|
||||
Largest_Src_Size = fsize;
|
||||
@ -50,13 +50,13 @@ namespace IO
|
||||
|
||||
zpl_file_close( & src );
|
||||
}
|
||||
while ( path++, left--, left > 1 );
|
||||
|
||||
while ( path++, left--, left > 0 );
|
||||
|
||||
uw persist_size = Largest_Src_Size * 2 + 8;
|
||||
|
||||
|
||||
zpl_arena_init_from_allocator( & MemSrc, zpl_heap(), persist_size );
|
||||
}
|
||||
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
zpl_arena_free( & MemSpec );
|
||||
|
@ -10,16 +10,16 @@ namespace IO
|
||||
// Preps the IO by loading all the files and checking to see what the largest size is.
|
||||
// The file with the largest size is used to determine the size of the persistent memory.
|
||||
void prepare();
|
||||
|
||||
|
||||
// Frees the persistent and transient memory arenas.
|
||||
void cleanup();
|
||||
void cleanup();
|
||||
|
||||
// Provides the content of the specification.
|
||||
Array_Line get_specification();
|
||||
|
||||
|
||||
// Provides the content of the next source, broken up as a series of lines.
|
||||
char* get_next_source();
|
||||
|
||||
// Writes the refactored content ot the current corresponding destination.
|
||||
void write( zpl_string refactored );
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ The program execution is pretty much outlined quite clearly in `int main()`.
|
||||
There are constraints for specific variables;
|
||||
|
||||
* `Path_Size_Largest` : Longest path size is set to 1 KB of characters.
|
||||
* `Token_Max_Length` : Set to 1 KB characters as well.
|
||||
* `Token_Max_Length` : Set to 128 KB.
|
||||
* `Array_Reserve_Num` : Is set to 4 KB.
|
||||
* Initial Global arena size : Set to 2 megabytes.
|
||||
|
||||
The `Path_Size_Largest` and `Token_Max_Length` are compile-time constraints that the runtime will not have a fallback for, if 1 KB is not enough it will need to be changed for your use case.
|
||||
The `Path_Size_Largest` and `Token_Max_Length` are compile-time constraints that the runtime will not have a fallback for, if current size is not enough it will need to be changed for your use case.
|
||||
|
||||
`Array_Reserve_Num` is used to dictate the assumed amount of tokens will be held in total for any of spec's arrays holding ignores and refactor entries. If any of the array's exceed 4 KB they will grow triggering a resize which will bog down the speed of the refactor. Adjust if you think you can increase or lower for use case.
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
namespace Spec
|
||||
{
|
||||
ct uw Array_Reserve_Num = zpl_kilobytes(4);
|
||||
ct uw Token_Max_Length = zpl_kilobytes(1);
|
||||
ct uw Token_Max_Length = 128;
|
||||
|
||||
namespace StaticData
|
||||
{
|
||||
@ -195,7 +195,7 @@ namespace Spec
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
find_next_token( type, token, line, length );
|
||||
|
||||
// First argument is signature.
|
||||
@ -211,7 +211,7 @@ namespace Spec
|
||||
case Tok::Word:
|
||||
if ( ignore)
|
||||
zpl_array_append( Ignore_Words, entry );
|
||||
|
||||
|
||||
else
|
||||
zpl_array_append( Words, entry );
|
||||
break;
|
||||
@ -248,7 +248,7 @@ namespace Spec
|
||||
{
|
||||
case Tok::Word:
|
||||
zpl_array_append( Words, entry );
|
||||
break;
|
||||
break;
|
||||
|
||||
case Tok::Namespace:
|
||||
zpl_array_append( Namespaces, entry );
|
||||
@ -288,7 +288,7 @@ namespace Spec
|
||||
{
|
||||
case Tok::Word:
|
||||
zpl_array_append( Words, entry );
|
||||
break;
|
||||
break;
|
||||
|
||||
case Tok::Namespace:
|
||||
zpl_array_append( Namespaces, entry );
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Spec
|
||||
{
|
||||
enum Tok
|
||||
enum Tok
|
||||
{
|
||||
Not,
|
||||
Comment,
|
||||
@ -19,7 +19,7 @@ namespace Spec
|
||||
char const* str_tok( Tok tok )
|
||||
{
|
||||
static
|
||||
char const* tok_to_str[ Tok::Num_Tok ] =
|
||||
char const* tok_to_str[ Tok::Num_Tok ] =
|
||||
{
|
||||
"not",
|
||||
"comments",
|
||||
@ -35,7 +35,7 @@ namespace Spec
|
||||
char strlen_tok( Tok tok )
|
||||
{
|
||||
static
|
||||
const u8 tok_to_len[ Tok::Num_Tok ] =
|
||||
const u8 tok_to_len[ Tok::Num_Tok ] =
|
||||
{
|
||||
3,
|
||||
8,
|
||||
|
@ -2,8 +2,6 @@
|
||||
#include "IO.cpp"
|
||||
#include "Spec.cpp"
|
||||
|
||||
|
||||
|
||||
void parse_options( int num, char** arguments )
|
||||
{
|
||||
zpl_opts opts;
|
||||
@ -28,32 +26,32 @@ void parse_options( int num, char** arguments )
|
||||
|
||||
Global::ShouldShowDebug = true;
|
||||
}
|
||||
|
||||
|
||||
if ( zpl_opts_has_arg( & opts, "num" ) )
|
||||
{
|
||||
num = zpl_opts_integer( & opts, "num", -1 );
|
||||
uw global_reserve = num * sizeof(zpl_string) * IO::Path_Size_Largest * 2 + 8;
|
||||
|
||||
|
||||
if ( global_reserve > zpl_megabytes(1) )
|
||||
{
|
||||
Memory::resize( global_reserve + zpl_megabytes(2) );
|
||||
}
|
||||
|
||||
|
||||
zpl_array_init_reserve( IO::Sources, g_allocator, num );
|
||||
zpl_array_init_reserve( IO::Destinations, g_allocator, num );
|
||||
zpl_array_init_reserve( IO::Destinations, g_allocator, num );
|
||||
}
|
||||
else
|
||||
{
|
||||
num = 1;
|
||||
|
||||
zpl_array_init_reserve( IO::Sources, g_allocator, 1 );
|
||||
zpl_array_init_reserve( IO::Destinations, g_allocator, 1 );
|
||||
zpl_array_init_reserve( IO::Destinations, g_allocator, 1 );
|
||||
}
|
||||
|
||||
if ( zpl_opts_has_arg( & opts, "src" ) )
|
||||
{
|
||||
zpl_string opt = zpl_opts_string( & opts, "src", "INVALID SRC ARGUMENT" );
|
||||
|
||||
|
||||
if ( num == 1 )
|
||||
{
|
||||
zpl_string path = zpl_string_make_length( g_allocator, opt, zpl_string_length( opt ));
|
||||
@ -66,20 +64,20 @@ void parse_options( int num, char** arguments )
|
||||
uw left = num;
|
||||
do
|
||||
{
|
||||
char* path = buffer;
|
||||
sw length = 0;
|
||||
char* path = buffer;
|
||||
sw length = 0;
|
||||
|
||||
do
|
||||
{
|
||||
path[length] = *opt;
|
||||
}
|
||||
}
|
||||
while ( length++, opt++, *opt != ' ' && *opt != '\0' );
|
||||
|
||||
|
||||
zpl_string path_string = zpl_string_make_length( g_allocator, path, length );
|
||||
zpl_array_append( IO::Sources, path_string );
|
||||
|
||||
opt++;
|
||||
}
|
||||
}
|
||||
while ( --left );
|
||||
}
|
||||
}
|
||||
@ -110,14 +108,14 @@ void parse_options( int num, char** arguments )
|
||||
do
|
||||
{
|
||||
path[length] = *opt;
|
||||
}
|
||||
}
|
||||
while ( length++, opt++, *opt != ' ' && *opt != '\0' );
|
||||
|
||||
|
||||
zpl_string path_string = zpl_string_make_length( g_allocator, path, length );
|
||||
zpl_array_append( IO::Destinations, path_string );
|
||||
|
||||
opt++;
|
||||
}
|
||||
}
|
||||
while ( --left );
|
||||
|
||||
if ( zpl_array_count(IO::Destinations) != zpl_array_count( IO::Sources ) )
|
||||
@ -132,7 +130,7 @@ void parse_options( int num, char** arguments )
|
||||
do
|
||||
{
|
||||
zpl_array_append( IO::Destinations, IO::Sources[num - left] );
|
||||
}
|
||||
}
|
||||
while ( --left );
|
||||
}
|
||||
|
||||
@ -162,12 +160,17 @@ void parse_options( int num, char** arguments )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Refactor will problably have the execution and arg parsing (main and opts)
|
||||
moved to a separate file.
|
||||
*/
|
||||
|
||||
zpl_arena Refactor_Buffer;
|
||||
|
||||
void refactor()
|
||||
{
|
||||
ct static char const* include_sig = "include";
|
||||
|
||||
|
||||
struct Token
|
||||
{
|
||||
u32 Start;
|
||||
@ -211,21 +214,37 @@ void refactor()
|
||||
|
||||
#define pos (IO::Current_Size - left)
|
||||
|
||||
#define move_forward( Amount_ ) \
|
||||
if ( left - Amount_ <= 0 ) \
|
||||
goto End_Search; \
|
||||
\
|
||||
left -= Amount_; \
|
||||
col += Amount_; \
|
||||
src += Amount_ \
|
||||
struct Snapshot
|
||||
{
|
||||
char const* Src;
|
||||
sw Left;
|
||||
uw Col;
|
||||
uw Line;
|
||||
};
|
||||
|
||||
#define move_back( Amount_ ) \
|
||||
left += Amount_; \
|
||||
col -= Amount_; \
|
||||
src -= Amount_ \
|
||||
#define move_forward( Amount_ ) \
|
||||
do { \
|
||||
if ( left - Amount_ <= 0 ) \
|
||||
goto End_Search; \
|
||||
\
|
||||
const sw end = Amount_ - 1; \
|
||||
\
|
||||
line += src[end] == '\n'; \
|
||||
left -= Amount_; \
|
||||
col = (col + Amount_) * src[end] != '\n'; \
|
||||
src += Amount_; \
|
||||
} \
|
||||
while (0) \
|
||||
|
||||
#define restore( Snapshot_ ) \
|
||||
src = Snapshot_.Src; \
|
||||
left = Snapshot_.Left; \
|
||||
col = Snapshot_.Col; \
|
||||
line = Snapshot_.Line \
|
||||
|
||||
do
|
||||
{
|
||||
// Check for comments if ignoring.
|
||||
if ( Spec::Ignore_Comments && src[0] == '/' && left - 2 > 0 )
|
||||
{
|
||||
if ( src[1] == '/' )
|
||||
@ -259,37 +278,33 @@ void refactor()
|
||||
{
|
||||
Spec::Entry* ignore = Spec::Ignore_Includes;
|
||||
sw ignores_left = zpl_array_count( Spec::Ignore_Includes);
|
||||
sw rewind = 0;
|
||||
Snapshot backup = { src, left, col, line };
|
||||
|
||||
if ( '#' != src[0] )
|
||||
break;
|
||||
|
||||
move_forward( 1 );
|
||||
rewind++;
|
||||
|
||||
// Ignore whitespace
|
||||
while ( zpl_char_is_space( src[0] ) )
|
||||
{
|
||||
move_forward( 1 );
|
||||
rewind++;
|
||||
}
|
||||
|
||||
if ( zpl_strncmp( include_sig, src, sizeof(include_sig) - 1 ) != 0 )
|
||||
{
|
||||
move_back( rewind );
|
||||
restore( backup );
|
||||
break;
|
||||
}
|
||||
|
||||
const u32 sig_size = sizeof(include_sig) - 1;
|
||||
|
||||
move_forward( sig_size );
|
||||
rewind += sig_size;
|
||||
|
||||
// Ignore whitespace
|
||||
while ( zpl_char_is_space( src[0] ) || src[0] == '\"' || src[0] == '<' )
|
||||
{
|
||||
move_forward(1);
|
||||
rewind++;
|
||||
}
|
||||
|
||||
for ( ; ignores_left; ignores_left--, ignore++ )
|
||||
@ -318,121 +333,42 @@ void refactor()
|
||||
}
|
||||
}
|
||||
|
||||
move_back( rewind );
|
||||
}
|
||||
restore( backup );
|
||||
}
|
||||
while (false);
|
||||
|
||||
// Word Ignores
|
||||
{
|
||||
Spec::Entry* ignore = Spec::Ignore_Words;
|
||||
sw ignores_left = zpl_array_count( Spec::Ignore_Words);
|
||||
|
||||
for ( ; ignores_left; ignores_left--, ignore++ )
|
||||
{
|
||||
if ( ignore->Sig[0] != src[0] )
|
||||
continue;
|
||||
|
||||
zpl_string_clear( current );
|
||||
|
||||
u32 sig_length = zpl_string_length( ignore->Sig );
|
||||
current = zpl_string_append_length( current, src, sig_length );
|
||||
|
||||
if ( zpl_string_are_equal( ignore->Sig, current ) )
|
||||
{
|
||||
char before = src[-1];
|
||||
char after = src[sig_length];
|
||||
|
||||
if ( zpl_char_is_alphanumeric( before ) || before == '_'
|
||||
|| zpl_char_is_alphanumeric( after ) || after == '_' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
log_fmt("\nIgnored %-81s line %d, col %d", current, line, col );
|
||||
|
||||
move_forward( sig_length );
|
||||
goto Skip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace Ignores
|
||||
{
|
||||
Spec::Entry* ignore = Spec::Ignore_Namespaces;
|
||||
sw ignores_left = zpl_array_count( Spec::Ignore_Namespaces);
|
||||
|
||||
for ( ; ignores_left; ignores_left--, ignore++ )
|
||||
{
|
||||
if ( ignore->Sig[0] != src[0] )
|
||||
{
|
||||
ignore++;
|
||||
continue;
|
||||
}
|
||||
|
||||
zpl_string_clear( current );
|
||||
|
||||
u32 sig_length = zpl_string_length( ignore->Sig );
|
||||
current = zpl_string_append_length( current, src, sig_length );
|
||||
|
||||
if ( zpl_string_are_equal( ignore->Sig, current ) )
|
||||
{
|
||||
u32 length = sig_length;
|
||||
char const* ns_content = src + sig_length;
|
||||
|
||||
while ( zpl_char_is_alphanumeric( ns_content[0] ) || ns_content[0] == '_' )
|
||||
{
|
||||
length++;
|
||||
ns_content++;
|
||||
}
|
||||
|
||||
#if Build_Debug
|
||||
zpl_string_clear( preview );
|
||||
preview = zpl_string_append_length( preview, src, length );
|
||||
log_fmt("\nIgnored %-40s %-40s line %d, column %d", preview, ignore->Sig, line, col );
|
||||
#endif
|
||||
|
||||
move_forward( length );
|
||||
goto Skip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Includes to match
|
||||
do
|
||||
{
|
||||
Spec::Entry* include = Spec::Includes;
|
||||
sw includes_left = zpl_array_count ( Spec::Includes);
|
||||
sw rewind = 0;
|
||||
Snapshot backup = { src, left, col, line };
|
||||
|
||||
if ( '#' != src[0] )
|
||||
break;
|
||||
|
||||
move_forward( 1 );
|
||||
rewind++;
|
||||
|
||||
// Ignore whitespace
|
||||
while ( zpl_char_is_space( src[0] ) )
|
||||
{
|
||||
move_forward( 1 );
|
||||
rewind++;
|
||||
}
|
||||
|
||||
if ( zpl_strncmp( include_sig, src, sizeof(include_sig) - 1 ) != 0 )
|
||||
{
|
||||
move_back( rewind );
|
||||
restore( backup );
|
||||
break;
|
||||
}
|
||||
|
||||
const u32 sig_size = sizeof(include_sig) - 1;
|
||||
|
||||
move_forward( sig_size );
|
||||
rewind += sig_size;
|
||||
|
||||
// Ignore whitespace
|
||||
while ( zpl_char_is_space( src[0] ) || src[0] == '\"' || src[0] == '<' )
|
||||
{
|
||||
move_forward( 1 );
|
||||
rewind++;
|
||||
}
|
||||
|
||||
for ( ; includes_left; includes_left--, include++ )
|
||||
@ -473,10 +409,44 @@ void refactor()
|
||||
}
|
||||
}
|
||||
|
||||
move_back( rewind );
|
||||
}
|
||||
restore( backup );
|
||||
}
|
||||
while (false);
|
||||
|
||||
// Word Ignores
|
||||
{
|
||||
Spec::Entry* ignore = Spec::Ignore_Words;
|
||||
sw ignores_left = zpl_array_count( Spec::Ignore_Words);
|
||||
|
||||
for ( ; ignores_left; ignores_left--, ignore++ )
|
||||
{
|
||||
if ( ignore->Sig[0] != src[0] )
|
||||
continue;
|
||||
|
||||
zpl_string_clear( current );
|
||||
|
||||
u32 sig_length = zpl_string_length( ignore->Sig );
|
||||
current = zpl_string_append_length( current, src, sig_length );
|
||||
|
||||
if ( zpl_string_are_equal( ignore->Sig, current ) )
|
||||
{
|
||||
char before = src[-1];
|
||||
char after = src[sig_length];
|
||||
|
||||
if ( zpl_char_is_alphanumeric( before ) || before == '_'
|
||||
|| zpl_char_is_alphanumeric( after ) || after == '_' )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
log_fmt("\nIgnored %-81s line %d, col %d", current, line, col );
|
||||
|
||||
move_forward( sig_length );
|
||||
goto Skip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Words to match
|
||||
{
|
||||
Spec::Entry* word = Spec::Words;
|
||||
@ -525,6 +495,53 @@ void refactor()
|
||||
}
|
||||
}
|
||||
|
||||
// Namespace Ignores
|
||||
{
|
||||
Spec::Entry* ignore = Spec::Ignore_Namespaces;
|
||||
sw ignores_left = zpl_array_count( Spec::Ignore_Namespaces);
|
||||
|
||||
for ( ; ignores_left; ignores_left--, ignore++ )
|
||||
{
|
||||
if ( ignore->Sig[0] != src[0] )
|
||||
{
|
||||
ignore++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (( zpl_char_is_alphanumeric( src[-1] ) || src[-1] == '_') )
|
||||
{
|
||||
ignore++;
|
||||
continue;
|
||||
}
|
||||
|
||||
zpl_string_clear( current );
|
||||
|
||||
u32 sig_length = zpl_string_length( ignore->Sig );
|
||||
current = zpl_string_append_length( current, src, sig_length );
|
||||
|
||||
if ( zpl_string_are_equal( ignore->Sig, current ) )
|
||||
{
|
||||
u32 length = sig_length;
|
||||
char const* ns_content = src + sig_length;
|
||||
|
||||
while ( zpl_char_is_alphanumeric( ns_content[0] ) || ns_content[0] == '_' )
|
||||
{
|
||||
length++;
|
||||
ns_content++;
|
||||
}
|
||||
|
||||
#if Build_Debug
|
||||
zpl_string_clear( preview );
|
||||
preview = zpl_string_append_length( preview, src, length );
|
||||
log_fmt("\nIgnored %-40s %-40s line %d, column %d", preview, ignore->Sig, line, col );
|
||||
#endif
|
||||
|
||||
move_forward( length );
|
||||
goto Skip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Namespaces to match
|
||||
{
|
||||
Spec::Entry* nspace = Spec::Namespaces;
|
||||
@ -536,6 +553,9 @@ void refactor()
|
||||
if ( nspace->Sig[0] != src[0] )
|
||||
continue;
|
||||
|
||||
if (( zpl_char_is_alphanumeric( src[-1] ) || src[-1] == '_') )
|
||||
continue;
|
||||
|
||||
zpl_string_clear( current );
|
||||
|
||||
u32 sig_length = zpl_string_length( nspace->Sig );
|
||||
@ -555,7 +575,7 @@ void refactor()
|
||||
Token entry {};
|
||||
|
||||
entry.Start = pos;
|
||||
entry.End = pos + length;
|
||||
entry.End = pos + sig_length;
|
||||
entry.Sig = nspace->Sig;
|
||||
|
||||
buffer_size += sig_length;
|
||||
@ -563,7 +583,7 @@ void refactor()
|
||||
if ( nspace->Sub != nullptr )
|
||||
{
|
||||
entry.Sub = nspace->Sub;
|
||||
buffer_size += zpl_string_length( entry.Sub ) - length;
|
||||
buffer_size += zpl_string_length( entry.Sub ) - sig_length;
|
||||
}
|
||||
|
||||
zpl_array_append( tokens, entry );
|
||||
@ -581,14 +601,8 @@ void refactor()
|
||||
}
|
||||
|
||||
Skip:
|
||||
if ( src[0] == '\n' )
|
||||
{
|
||||
line++;
|
||||
col = 0;
|
||||
}
|
||||
|
||||
move_forward( 1 );
|
||||
}
|
||||
}
|
||||
while ( left );
|
||||
End_Search:
|
||||
|
||||
@ -600,7 +614,7 @@ End_Search:
|
||||
// Prep data for building the content
|
||||
left = zpl_array_count( tokens);
|
||||
|
||||
char* content = IO::Current_Content;
|
||||
char* content = IO::Current_Content;
|
||||
|
||||
zpl_string refactored = zpl_string_make_reserve( zpl_arena_allocator( & Refactor_Buffer ), buffer_size );
|
||||
|
||||
@ -636,7 +650,7 @@ End_Search:
|
||||
|
||||
entry--;
|
||||
|
||||
if ( entry->End < IO::Current_Size )
|
||||
if ( entry->End < IO::Current_Size )
|
||||
{
|
||||
refactored = zpl_string_append_length( refactored, content, IO::Current_Size - 1 - entry->End );
|
||||
}
|
||||
@ -653,7 +667,7 @@ End_Search:
|
||||
int main( int num, char** arguments )
|
||||
{
|
||||
Memory::setup();
|
||||
|
||||
|
||||
parse_options( num, arguments);
|
||||
|
||||
IO::prepare();
|
||||
@ -669,7 +683,7 @@ int main( int num, char** arguments )
|
||||
refactor();
|
||||
|
||||
zpl_printf("\nRefactored: %s", IO::Sources[IO::Current]);
|
||||
}
|
||||
}
|
||||
while ( --left );
|
||||
|
||||
zpl_arena_free( & Refactor_Buffer );
|
||||
|
@ -29,7 +29,10 @@ if ( -not( Test-Path $path_build ) )
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_build
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
Push-Location $path_scripts
|
||||
Invoke-Expression "& meson $args_meson"
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ( $type )
|
||||
@ -39,14 +42,19 @@ if ( $type )
|
||||
$args_meson += $path_build
|
||||
$args_meson += "--buildtype $($type)"
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
# Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_scripts
|
||||
Push-Location $path_scripts
|
||||
Invoke-Expression "& meson $args_meson"
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_build
|
||||
|
||||
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
||||
Push-Location $path_root
|
||||
ninja $args_ninja
|
||||
Pop-Location
|
||||
#endregion Regular Build
|
||||
|
||||
|
||||
@ -56,7 +64,8 @@ if ( $test -eq $true )
|
||||
write-host "`n`nBuilding Test`n"
|
||||
|
||||
# Refactor thirdparty libraries
|
||||
& (Join-Path $PSScriptRoot 'refactor_and_format.ps1')
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'refactor_and_format.ps1') $args"
|
||||
|
||||
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_test_build = Join-Path $path_test build
|
||||
@ -67,15 +76,17 @@ if ( $test -eq $true )
|
||||
$args_meson += "setup"
|
||||
$args_meson += $path_test_build
|
||||
|
||||
Start-Process meson $args_meson -NoNewWindow -Wait -WorkingDirectory $path_test
|
||||
Push-Location $path_test
|
||||
& meson $args_meson
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
$args_ninja = @()
|
||||
$args_ninja += "-C"
|
||||
$args_ninja += $path_test_build
|
||||
|
||||
write-host $args_ninja
|
||||
|
||||
Start-Process ninja $args_ninja -Wait -NoNewWindow -WorkingDirectory $path_root
|
||||
Push-Location $path_root
|
||||
ninja $args_ninja
|
||||
Pop-Location
|
||||
#endregion Test Build
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
cls
|
||||
& (Join-Path $PSScriptRoot 'build.ci.ps1')
|
||||
Invoke-Expression "& $(Join-Path $PSScriptRoot 'build.ci.ps1') $args"
|
||||
|
@ -8,7 +8,6 @@ $path_project = Join-Path $path_root project
|
||||
$path_test = Join-Path $path_root test
|
||||
$path_thirdparty = Join-Path $path_root thirdparty
|
||||
|
||||
$file_spec = Join-Path $path_test zpl.refactor
|
||||
$refactor = Join-Path $path_build refactor.exe
|
||||
|
||||
# Gather the files to be formatted.
|
||||
@ -25,48 +24,44 @@ foreach ( $file in $targetFiles )
|
||||
}
|
||||
|
||||
|
||||
write-host "Beginning thirdpary refactor...`n"
|
||||
write-host "Beginning thirdpary refactor..."
|
||||
|
||||
$refactors = @(@())
|
||||
$file_spec = Join-Path $path_test zpl.refactor
|
||||
|
||||
if ( $false ){
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
|
||||
$refactorParams = @(
|
||||
"-src=$($file)",
|
||||
"-dst=$($destination)"
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
$refactorParams = @(
|
||||
"-src=$(Join-Path $path_thirdparty "zpl.h")",
|
||||
"-dst=$(Join-Path $path_test "zpl.refactored.h")",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
$refactors += (Start-Process $refactor $refactorParams -NoNewWindow -PassThru)
|
||||
}
|
||||
}
|
||||
else {
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
}
|
||||
|
||||
foreach ( $process in $refactors )
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
if ( $process )
|
||||
{
|
||||
$process.WaitForExit()
|
||||
}
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
||||
write-host "`zpl refactor: " $refactorParams
|
||||
& $refactor $refactorParams
|
||||
|
||||
write-host "Beginning project refactor...`n"
|
||||
$file_spec = Join-Path $path_test "stb_image.refactor"
|
||||
|
||||
$refactorParams = @(
|
||||
"-src=$(Join-Path $path_thirdparty "stb_image.h")",
|
||||
"-dst=$(Join-Path $path_test "stb_image.refactored.h")",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
|
||||
write-host "`n`nstb_image refactor: " $refactorParams
|
||||
& $refactor $refactorParams
|
||||
|
||||
Write-Host "`nRefactoring complete`n"
|
||||
|
||||
|
||||
write-host "Beginning project refactor..."
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_project -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
@ -74,8 +69,6 @@ $refactoredFiles = @()
|
||||
|
||||
$file_spec = Join-Path $path_test project.refactor
|
||||
|
||||
write-host "FILE SPEC:" $file_spec
|
||||
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_test (Split-Path $file -leaf)
|
||||
@ -86,16 +79,20 @@ foreach ( $file in $targetFiles )
|
||||
}
|
||||
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
Start-Process $refactor $refactorParams -NoNewWindow -PassThru -Wait
|
||||
if ( $args.Contains( "debug" ) )
|
||||
{
|
||||
$refactorParams += "-debug"
|
||||
}
|
||||
|
||||
write-host "`nRefactoring complete`n`n"
|
||||
& $refactor $refactorParams
|
||||
|
||||
write-host "`nRefactoring complete`n"
|
||||
|
||||
|
||||
# Can't format zpl library... (It hangs clang format)
|
||||
@ -115,3 +112,4 @@ clang-format $formatParams $targetFiles
|
||||
|
||||
Write-Host "`nFormatting complete"
|
||||
}
|
||||
|
||||
|
38
scripts/template_reafactor.ps1
Normal file
38
scripts/template_reafactor.ps1
Normal file
@ -0,0 +1,38 @@
|
||||
[string[]] $include = '*.h', '*.hh', '*.hpp', '*.c', '*.cc', '*.cpp'
|
||||
[string[]] $exclude = '*.g.*', '*.refactor'
|
||||
|
||||
# Change this to your root directory if needed.
|
||||
$path_root = $PSScriptRoot
|
||||
|
||||
# Change this to your desired destination
|
||||
$path_dest = $path_root
|
||||
|
||||
# Gather the files to be formatted.
|
||||
$targetFiles = @(Get-ChildItem -Recurse -Path $path_root -Include $include -Exclude $exclude | Select-Object -ExpandProperty FullName)
|
||||
$refactoredFiles = @()
|
||||
|
||||
foreach ( $file in $targetFiles )
|
||||
{
|
||||
$destination = Join-Path $path_dest (Split-Path $file -leaf)
|
||||
$destination = $destination.Replace( '.h', '.refactored.h' )
|
||||
$destination = $destination.Replace( '.c', '.refactored.c' )
|
||||
|
||||
$refactoredFiles += $destination
|
||||
}
|
||||
|
||||
|
||||
write-host "Beginning refactor...`n"
|
||||
|
||||
$refactors = @(@())
|
||||
|
||||
$refactorParams = @(
|
||||
# "-debug",
|
||||
"-num=$($targetFiles.Count)"
|
||||
"-src=$($targetFiles)",
|
||||
"-dst=$($refactoredFiles)",
|
||||
"-spec=$($file_spec)"
|
||||
)
|
||||
|
||||
& $refactor $refactorParams
|
||||
|
||||
Write-Host "`nRefactoring complete`n`n"
|
7987
thirdparty/stb_image.h
vendored
Normal file
7987
thirdparty/stb_image.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
35417
thirdparty/zpl.h
vendored
35417
thirdparty/zpl.h
vendored
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user