mailund / cstr Goto Github PK
View Code? Open in Web Editor NEWSimple C implementations of string algorithms (simpler than stralg). For teaching purposes
License: GNU General Public License v3.0
Simple C implementations of string algorithms (simpler than stralg). For teaching purposes
License: GNU General Public License v3.0
What I have now is a mess I hacked up in an afternoon as an example to a student. It isn't fit to work as example code, and I need to clean it up.
Add tests that check that all exact marchers find the same matches
The alphabet always adds the sentinel to inter slices but never to string slices and it assumes that the slice it builds the alphabet from doesn't contain the sentinel. This needs to be more consistent to be easy to use.
Right now, it is pretty difficult to dispatch correctly on them. I would need a copy of each type.
The current wrapper
struct cstr_exact_matcher
{
exact_next_fn next;
exact_free_fn free;
cstr_sslice x, p;
};
with polymorphism works for searches where we have x
and p
up front, but not as well for cases where we preprocess x
, such as suffix trees and suffix arrays. A uniform interface would be better.
Just get the O(m log n) version done for now. The O(m + log n) can come after all the GSA exercises.
I need a way of recognising that a character isn't in the map, but I don't want to use zero, since we will have needs for that for sentinels.
With code such as
#define CSTR_SLICE_STRING(STR) \
_Generic((STR), \
char * \
: CSTR_SLICE((uint8_t *)STR, (long long)cstr_strlen(STR)), \
const char * \
: CSTR_SLICE((const uint8_t *)STR, (long long)cstr_strlen(STR)))
the issue is that if STR
is const char *
, it won't be cast to a non-const, but the type checker will still complain that it would be in the first branch.
Once I figure out how to use attributes to properly track resources in the static analyser (and once linters can understand C23), I want to get them back again. Right now, I have to leave the code annotation free. There is too much hassle, and I can't get it to work 80% of the time anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.