X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=visor;a=blobdiff_plain;f=libvisor%2Finclude%2Fvisor.h;h=a9b3ec78f9e3035249d0f892534a3848a3bd057d;hp=73fb7dc5aa956af80c5478770f91ab2bf3c4aa06;hb=a4536cf08230dba14f221b661abd7804fcc1ebbc;hpb=2e3cec9f53a10e7c71da4a0d999a00bddae2935c diff --git a/libvisor/include/visor.h b/libvisor/include/visor.h index 73fb7dc..a9b3ec7 100644 --- a/libvisor/include/visor.h +++ b/libvisor/include/visor.h @@ -69,8 +69,14 @@ struct vi_alloc { void *(*realloc)(void*, unsigned long); /* can be null, will use malloc/free */ }; +/* open flags (same as POSIX O_*) */ +enum { VI_RDONLY, VI_WRONLY, VI_RDWR, VI_CREAT = 0x100 }; +/* seek origin (same as C SEEK_*) */ +enum { VI_SEEK_SET, VI_SEEK_CUR, VI_SEEK_END }; + + struct vi_fileops { - vi_file *(*open)(const char *path); + vi_file *(*open)(const char *path, unsigned int flags); long (*size)(vi_file *file); void (*close)(vi_file *file); void *(*map)(vi_file *file); @@ -138,6 +144,7 @@ long vi_buf_size(struct vi_buffer *vb); /* find the span which corresponds to the specified text position */ struct vi_span *vi_buf_find_span(struct vi_buffer *vb, vi_addr at); +const char *vi_buf_span_text(struct vi_buffer *vb, struct vi_span *span); void vi_buf_ins_begin(struct vi_buffer *vb, vi_motion mot); void vi_buf_insert(struct vi_buffer *vb, char *s);