Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nyuichi/xrope
rope data structure
https://github.com/nyuichi/xrope
Last synced: 20 days ago
JSON representation
rope data structure
- Host: GitHub
- URL: https://github.com/nyuichi/xrope
- Owner: nyuichi
- Created: 2014-02-27T07:56:58.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-27T08:22:13.000Z (over 10 years ago)
- Last Synced: 2024-10-16T03:48:12.659Z (2 months ago)
- Language: C
- Size: 228 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# xrope [![Build Status](https://travis-ci.org/wasabiz/xrope.png)](https://travis-ci.org/wasabiz/xrope)
rope data structre
## Usage
Just include "xrope.h" anywhere you want to use xrope!
## API
```c
typedef struct xrope xrope;/**
* | name | frees buffer? | end with NULL? | complexity | misc
* | ---- | ---- | ---- | ---- | ---
* | xr_new_cstr | no | yes | O(1) | xr_new(_lit)
* | xr_new_imbed | no | no | O(1) |
* | xr_new_move | yes | yes | O(1) |
* | xr_new_copy | yes | no | O(n) |
*/#define xr_new(cstr) xr_new_cstr(cstr, strlen(cstr))
#define xr_new_lit(cstr) xr_new_cstr(cstr, sizeof(cstr) - 1)
static inline xrope *xr_new_cstr(const char *, size_t);
static inline xrope *xr_new_imbed(const char *, size_t);
static inline xrope *xr_new_move(const char *, size_t);
static inline xrope *xr_new_copy(const char *, size_t);static inline void XROPE_INCREF(xrope *);
static inline void XROPE_DECREF(xrope *);static inline size_t xr_len(xrope *);
static inline char xr_at(xrope *, size_t);
static inline xrope *xr_cat(xrope *, xrope *);
static inline xrope *xr_sub(xrope *, size_t, size_t);
static inline const char *xr_cstr(xrope *); /* returns NULL-terminated string */
```## TODO
- self-balancing
- unicode support?
- custom allocator
- more test cases## Author
Yuichi Nishiwaki ([email protected])