gearsix
gearsix/ec zamanında buf buraya push yaptı
- 24c616241a tarted working on logic for read file caching
The read file is going to be cached by creating a hard link,
then when the file is re-opened this hard link will be checked
against the next read file to check if it's the same (despite having
the same name). Hopefully this will avoid issues with the input file
being different (even if it has the same name).
The loadcache function needs to be tidied up next, with the read
file cache check it's gotten a little messy.
- added skeleton for initcache
- loadcache loads a cached read file and checks if it matches the
input file given (by calling SameFile on a Stat of both).
- loadcache requires *all* cache files be loaded for a cache to be
valid.
- some minor compilation bugfixes (mostly typos, etc).
- ed5db690c2 Define the *Table Data Format* and implemented Buffer.Reload()
The *Table Data Format* could just be JSON but this is much more
efficient and easier to write a parser for (although everything has a
library for parsing JSON anyway I guess).
The format contains a line for each piece, where each line contains
(in regex: `[ >][ra] \d+ \d+`. The first character indicates if it's
the Buffer.pos, the next indicates if the piece `f` value is
read/append, the next is a number of the `off` value and then the number
for the `siz` value.
- renamed `piece.len` -> `piece.siz` (avoid nameclash with len())
- added comment doc at the top of *buf.go* defining the Table Data
Format.
- added a comment noting that the read file should be cached with a link
- renamed `(*Buffer).recover()` -> `(*Buffer).readcache` to avoid
nameclash with recover()
- 02d1ddbde5 started work on buf.go
buf.go implements the text buffering system that this program will use.
It implements a Piece Table (see file header comment for details), which
is originally the reason I started prototyping this tool.
Using Golang has made it easy enough for me to use files for a nice
caching system of the piece table runtime data, so this commit has added
cfg.go as well. This file provides a basic config struct and
initialisation for now (data files are cached in the user's CacheDir).
The buffer will attempt to load any files from the cache that exist for
a given filename. If these files do not exist, it will create them, if
they do it loads them and reloads the buffer data from them.
**Reminder:** The runtime should clear any cached files upon a clean
exit.
- cf5ea34f5a Started Search/Substitute implementation
Squashed commit of the following:
commit ca61676229e12a02969c1b4181b1f60aabba4b39
Author: gearsix <gearsix@tuta.io>
Date: Sat Mar 23 11:45:07 2024 +0000
began implementing srchSubstitute
commit 377b80e568e788432f8de7eace11261141ff0233
Author: gearsix <gearsix@tuta.io>
Date: Sat Mar 23 11:43:22 2024 +0000
draft impl of flagTokCur
commit c099ff43e63c9c01dc3360c3ab38eb74228652b3
Author: gearsix <gearsix@tuta.io>
Date: Sun Mar 17 01:34:52 2024 +0000
finished SrchSearch tests
Turns out the srchSearch didn't work because the regexp.ReaderFindIndex
function eats bytes from the Reader after ReaderFindIndex is done,
which messed up the absolute indexes given by the function (returned
values were relative to the previous finding).
The only way to deal with this was to create a new Reader from the new
offset (the end of the previously found value) every time.
commit 0dcf32dc02ac266e8a48905bc5296c8fed81f2fe
Author: gearsix <gearsix@tuta.io>
Date: Sun Mar 17 01:31:59 2024 +0000
All File and Addr references use int64 references now (not uint64).
This was just to make it easier to work with the golang stdlib.
I would have preferred to keep uint64,
since a file index can't be less than 0.
if I change it again,
I'm making a dedicated type for the Idx.i value,
so that I can flip flop on it easier.
- Added NewAddrIndex
- (a *Addr).Stringify returns "<nil>" if a is nil
commit 262aa1c5154ed043a813f9e18aa37bd8dc3df1a5
Author: gearsix <gearsix@tuta.io>
Date: Fri Mar 15 13:21:44 2024 +0000
started working on TestSrchSearch
Also refactored TestSrchParseArg to use "type input", "type output"
style of testing (easier when working with structs).
commit 0dd93caf1a2fe6b2f70c957b024bbaae191521b3
Author: gearsix <gearsix@tuta.io>
Date: Sat Mar 9 23:41:36 2024 +0000
Further developments in srch.go
Started adding tests in srch_test.go as well
- Added errSrchNoFile
- Added SrchCmd returns
- Added argument parsing for Srch (srchParseArg)
- Added srchSearch
commit fbec2c9a59c8ae77824a38f39ea9ac499fdf4c3a
Author: gearsix <gearsix@tuta.io>
Date: Sat Mar 9 23:38:52 2024 +0000
addr updates
- (*Idx).GetFileIndex -> (*Idx).FileIndex
- (*Idx).FileIndex, AddrCur is now default index init value
- (*Idx).GetIndex -> (*Idx).line
- (*Idx).GetCol -> (*Idx).col
- Added (*Addr).Size
commit 3af2edcfe7e2b734d94d645bfe8b3d32a82783ff
Author: gearsix <gearsix@tuta.io>
Date: Fri Mar 1 15:34:55 2024 +0000
scaffolding for SrchCmd
commit d5bc43e6de5b26012a1cdb3e39aabedd009926f8
Author: gearsix <gearsix@tuta.io>
Date: Fri Mar 1 15:34:42 2024 +0000
spec: reviewed and amended ;s (search)
- 02f6edd685 Implemented (*Addr).GetFileIndex; added GetTok
8 ay önce