Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kehengzhong authored Jun 18, 2021
1 parent 4322325 commit e248713
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
8 changes: 7 additions & 1 deletion include/fileop.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int64 file_seek (FILE * fp, int64 pos, int whence);
int file_valid (FILE * fp);

int64 file_size (char * file);
int file_stat (char * file, struct stat * pfs);
int file_stat (char * file, void * pfs);
int file_exist (char * file);
int file_is_regular (char * file);
int file_is_dir (char * file);
Expand Down Expand Up @@ -66,6 +66,12 @@ void * file_mmap (void * addr, int fd, off_t offset, size_t length, int prot, in
int file_munmap (void * pmap, size_t maplen);
#endif

#ifdef _WIN32
void * file_mmap (void * addr, HANDLE hfile, int64 offset, int64 length, char * mapname,
HANDLE * phmap, void ** ppmap, int64 * pmaplen, int64 * pmapoff)
int file_munmap (HANDLE hmap, void * pmap)
#endif

void * fbuf_init (char * fname, int pagecount);
void fbuf_free (void * vfb);

Expand Down
34 changes: 23 additions & 11 deletions include/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,33 @@ int json_mget (void * vobj, void * key, int keylen, void * val, int * val
int json_mgetP (void * vobj, void * key, int keylen, void ** pval, int * vallen);
int json_mget_obj (void * vobj, void * key, int keylen, void ** pobj);

int json_mget_int8 (void * vobj, void * key, int keylen, int8 * val);
int json_mget_uint8 (void * vobj, void * key, int keylen, uint8 * val);
int json_mget_int16 (void * vobj, void * key, int keylen, int16 * val);
int json_mget_uint16 (void * vobj, void * key, int keylen, uint16 * val);
int json_mget_int (void * vobj, void * key, int keylen, int * val);
int json_mget_uint32 (void * vobj, void * key, int keylen, uint32 * val);
int json_mget_long (void * vobj, void * key, int keylen, long * val);
int json_mget_ulong (void * vobj, void * key, int keylen, ulong * val);
int json_mget_int64 (void * vobj, void * key, int keylen, int64 * val);
int json_mget_uint64 (void * vobj, void * key, int keylen, uint64 * val);
int json_mget_double (void * vobj, void * key, int keylen, double * val);

int json_get (void * vobj, void * key, int keylen, int ind, void * val, int vallen);
int json_getP (void * vobj, void * key, int keylen, int ind, void * pval, int * vallen);
int json_get_obj (void * vobj, void * key, int keylen, int ind, void ** pobj);

int json_get_int8 (void * vobj, void * key, int keylen, int8 * val);
int json_get_uint8 (void * vobj, void * key, int keylen, uint8 * val);
int json_get_int16 (void * vobj, void * key, int keylen, int16 * val);
int json_get_uint16 (void * vobj, void * key, int keylen, uint16 * val);
int json_get_int (void * vobj, void * key, int keylen, int * val);
int json_get_uint32 (void * vobj, void * key, int keylen, uint32 * val);
int json_get_long (void * vobj, void * key, int keylen, long * val);
int json_get_ulong (void * vobj, void * key, int keylen, ulong * val);
int json_get_int64 (void * vobj, void * key, int keylen, int64 * val);
int json_get_uint64 (void * vobj, void * key, int keylen, uint64 * val);
int json_get_double (void * vobj, void * key, int keylen, double * val);
int json_get_int8 (void * vobj, void * key, int keylen, int ind, int8 * val);
int json_get_uint8 (void * vobj, void * key, int keylen, int ind, uint8 * val);
int json_get_int16 (void * vobj, void * key, int keylen, int ind, int16 * val);
int json_get_uint16 (void * vobj, void * key, int keylen, int ind, uint16 * val);
int json_get_int (void * vobj, void * key, int keylen, int ind, int * val);
int json_get_uint32 (void * vobj, void * key, int keylen, int ind, uint32 * val);
int json_get_long (void * vobj, void * key, int keylen, int ind, long * val);
int json_get_ulong (void * vobj, void * key, int keylen, int ind, ulong * val);
int json_get_int64 (void * vobj, void * key, int keylen, int ind, int64 * val);
int json_get_uint64 (void * vobj, void * key, int keylen, int ind, uint64 * val);
int json_get_double (void * vobj, void * key, int keylen, int ind, double * val);

/* if key exists, it's value will be appended the new content */
int json_append (void * vobj, void * key, int keylen, void * val, int vallen, uint8 strip);
Expand Down
5 changes: 5 additions & 0 deletions include/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ extern "C" {

void kmem_print();

void * kosmalloc (size_t size);
void * kosrealloc (void * ptr, size_t size);
void kosfree (void * ptr);

void * kalloc_dbg (size_t size, char * file, int line);
void * kzalloc_dbg (size_t size, char * file, int line);
void * krealloc_dbg (void * ptr, size_t size, char * file, int line);
Expand Down Expand Up @@ -62,6 +66,7 @@ int mupool_scan (void * vpool);

void mupool_print (FILE * fp, void * vpool);


#ifdef __cplusplus
}
#endif
Expand Down
2 changes: 2 additions & 0 deletions include/wordlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ int word_lib_clean (void * vwlib);

int word_lib_loadfile (void * vwlib, char * file);

int word_lib_getword (void * vwlib, void * pbyte, int bytelen, int * word);

int word_lib_add (void * vlib, void * pbyte, int bytelen, void * varpara, void * varfree);
int word_lib_get (void * vlib, void * pbyte, int bytelen, void ** pvar);
int word_lib_del (void * vlib, void * pbyte, int bytelen);
Expand Down

0 comments on commit e248713

Please sign in to comment.