From: Bruno Deferrari Date: Sat, 13 Jun 2009 04:41:15 +0000 (-0300) Subject: tokyo.alien: Add tcfdb X-Git-Tag: 0.97~6105^2^2~15 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=12ac159f6d009c230afcf66d06fe348570d9a692 tokyo.alien: Add tcfdb --- diff --git a/extra/tokyo/alien/tcfdb/authors.txt b/extra/tokyo/alien/tcfdb/authors.txt new file mode 100644 index 0000000000..f4a8cb1dc2 --- /dev/null +++ b/extra/tokyo/alien/tcfdb/authors.txt @@ -0,0 +1 @@ +Bruno Deferrari diff --git a/extra/tokyo/alien/tcfdb/tcfdb.factor b/extra/tokyo/alien/tcfdb/tcfdb.factor new file mode 100644 index 0000000000..c624f86f40 --- /dev/null +++ b/extra/tokyo/alien/tcfdb/tcfdb.factor @@ -0,0 +1,94 @@ +! Copyright (C) 2009 Bruno Deferrari +! See http://factorcode.org/license.txt for BSD license. +USING: alien alien.c-types alien.libraries alien.syntax +combinators kernel tokyo.alien.tcutil ; +IN: tokyo.alien.tcfdb + +TYPEDEF: void* TCFDB + +CONSTANT: FDBFOPEN 1 +CONSTANT: FDBFFATAL 2 + +CONSTANT: FDBOREADER 1 +CONSTANT: FDBOWRITER 2 +CONSTANT: FDBOCREAT 4 +CONSTANT: FDBOTRUNC 8 +CONSTANT: FDBONOLCK 16 +CONSTANT: FDBOLCKNB 32 +CONSTANT: FDBOTSYNC 64 + +CONSTANT: FDBIDMIN -1 +CONSTANT: FDBIDPREV -2 +CONSTANT: FDBIDMAX -3 +CONSTANT: FDBIDNEXT -4 + +FUNCTION: char* tcfdberrmsg ( int ecode ) ; +FUNCTION: TCFDB* tcfdbnew ( ) ; +FUNCTION: void tcfdbdel ( TCFDB* fdb ) ; +FUNCTION: int tcfdbecode ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbsetmutex ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbtune ( TCFDB* fdb, int width, longlong limsiz ) ; +FUNCTION: bool tcfdbopen ( TCFDB* fdb, char* path, int omode ) ; +FUNCTION: bool tcfdbclose ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbput ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbput2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbput3 ( TCFDB* fdb, char* kstr, void* vstr ) ; +FUNCTION: bool tcfdbputkeep ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbputkeep2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbputkeep3 ( TCFDB* fdb, char* kstr, void* vstr ) ; +FUNCTION: bool tcfdbputcat ( TCFDB* fdb, longlong id, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbputcat2 ( TCFDB* fdb, void* kbuf, int ksiz, void* vbuf, int vsiz ) ; +FUNCTION: bool tcfdbputcat3 ( TCFDB* fdb, char* kstr, void* vstr ) ; +FUNCTION: bool tcfdbout ( TCFDB* fdb, longlong id ) ; +FUNCTION: bool tcfdbout2 ( TCFDB* fdb, void* kbuf, int ksiz ) ; +FUNCTION: bool tcfdbout3 ( TCFDB* fdb, char* kstr ) ; +FUNCTION: void* tcfdbget ( TCFDB* fdb, longlong id, int* sp ) ; +FUNCTION: void* tcfdbget2 ( TCFDB* fdb, void* kbuf, int ksiz, int* sp ) ; +FUNCTION: char* tcfdbget3 ( TCFDB* fdb, char* kstr ) ; +FUNCTION: int tcfdbget4 ( TCFDB* fdb, longlong id, void* vbuf, int max ) ; +FUNCTION: int tcfdbvsiz ( TCFDB* fdb, longlong id ) ; +FUNCTION: int tcfdbvsiz2 ( TCFDB* fdb, void* kbuf, int ksiz ) ; +FUNCTION: int tcfdbvsiz3 ( TCFDB* fdb, char* kstr ) ; +FUNCTION: bool tcfdbiterinit ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdbiternext ( TCFDB* fdb ) ; +FUNCTION: void* tcfdbiternext2 ( TCFDB* fdb, int* sp ) ; +FUNCTION: char* tcfdbiternext3 ( TCFDB* fdb ) ; +FUNCTION: ulonglong* tcfdbrange ( TCFDB* fdb, longlong lower, longlong upper, int max, int* np ) ; +FUNCTION: TCLIST* tcfdbrange2 ( TCFDB* fdb, void* lbuf, int lsiz, void* ubuf, int usiz, int max ) ; +FUNCTION: TCLIST* tcfdbrange3 ( TCFDB* fdb, char* lstr, char* ustr, int max ) ; +FUNCTION: TCLIST* tcfdbrange4 ( TCFDB* fdb, void* ibuf, int isiz, int max ) ; +FUNCTION: TCLIST* tcfdbrange5 ( TCFDB* fdb, void* istr, int max ) ; +FUNCTION: int tcfdbaddint ( TCFDB* fdb, longlong id, int num ) ; +FUNCTION: double tcfdbadddouble ( TCFDB* fdb, longlong id, double num ) ; +FUNCTION: bool tcfdbsync ( TCFDB* fdb ) ; +FUNCTION: bool tcfdboptimize ( TCFDB* fdb, int width, longlong limsiz ) ; +FUNCTION: bool tcfdbvanish ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbcopy ( TCFDB* fdb, char* path ) ; +FUNCTION: bool tcfdbtranbegin ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbtrancommit ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbtranabort ( TCFDB* fdb ) ; +FUNCTION: char* tcfdbpath ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdbrnum ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdbfsiz ( TCFDB* fdb ) ; + +! -------- + +FUNCTION: void tcfdbsetecode ( TCFDB* fdb, int ecode, char* filename, int line, char* func ) ; +FUNCTION: void tcfdbsetdbgfd ( TCFDB* fdb, int fd ) ; +FUNCTION: int tcfdbdbgfd ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbhasmutex ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbmemsync ( TCFDB* fdb, bool phys ) ; +FUNCTION: ulonglong tcfdbmin ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdbmax ( TCFDB* fdb ) ; +FUNCTION: uint tcfdbwidth ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdblimsiz ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdblimid ( TCFDB* fdb ) ; +FUNCTION: ulonglong tcfdbinode ( TCFDB* fdb ) ; +FUNCTION: time_t tcfdbmtime ( TCFDB* fdb ) ; +FUNCTION: int tcfdbomode ( TCFDB* fdb ) ; +FUNCTION: uchar tcfdbtype ( TCFDB* fdb ) ; +FUNCTION: uchar tcfdbflags ( TCFDB* fdb ) ; +FUNCTION: char* tcfdbopaque ( TCFDB* fdb ) ; +FUNCTION: bool tcfdbputproc ( TCFDB* fdb, longlong id, void* vbuf, int vsiz, TCPDPROC proc, void* op ) ; +FUNCTION: bool tcfdbforeach ( TCFDB* fdb, TCITER iter, void* op ) ; +FUNCTION: longlong tcfdbkeytoid ( char* kbuf, int ksiz ) ;