repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
github188/catlib | include/cat/netinc.h | <gh_stars>1-10
/*
* cat/netinc.h -- standard headers to include in a network application
*
* <NAME>
*
* Copyright 1999-2012 -- See accompanying license
*
*/
#ifndef __CAT_NETINC_H
#define __CAT_NETINC_H
/* Here go all of the include files for the networking code */
#include <sys/types.h>
#include <sys/sock... |
github188/catlib | src/mem.c | /*
* mem.c -- memory management interface
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/mem.h>
#include <stdlib.h>
void *mem_get(struct memmgr *mm, size_t len)
{
if ( !mm || !mm->mm_alloc )
return NULL;
return mm->mm_alloc(mm, len);
}
void *mem... |
github188/catlib | src/dynmem.c | <reponame>github188/catlib
/*
* src/dynmem.c -- Dynamic memory management
*
* by <NAME>
*
* Copyright 2008-2015 See accompanying license
*
*/
#include <cat/dynmem.h>
#include <cat/archops.h>
#include <string.h>
union dynmempool_u {
union align_u u;
struct dynmempool p;
};
#define sizetonu(n) (((size_t)(n) ... |
github188/catlib | src/net.c | /*
* net.c -- Network functions
*
* <NAME>
*
* Copyright 1999-2012 -- see accompanying license
*
*/
#include <cat/cat.h>
#if CAT_HAS_POSIX
#include <cat/net.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/un.h>
#include <errno.h>
#include <fcn... |
github188/catlib | src/io.c | /*
* io.c -- Input/Output functions
*
* <NAME>
*
* Copyright 1999 - 2015 -- see accompanying license
*
*/
#include <cat/cat.h>
#if CAT_HAS_POSIX
#include <cat/io.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <unistd.h>
#include <fcntl.... |
github188/catlib | include/cat/cat.h | /*
* cat/cat.h -- Info needed by most or all modules
*
* by <NAME>
*
* Copyright 2007-2015 -- See accompanying license
*
*/
#ifndef __cat_cat_h
#define __cat_cat_h
#include <stddef.h>
#include <cat/config.h>
#ifndef CAT_USE_STDLIB
#define CAT_USE_STDLIB 1
#endif /* CAT_USE_STDLIB */
#ifndef CAT_HAS_POSIX
#d... |
github188/catlib | test/testhw.c | <reponame>github188/catlib
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <sys/time.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#define NREPS 10000
int nreps = NREPS;
#define TEST(op) \
{ \
struct timeval start... |
github188/catlib | include/cat/str.h | /*
* str.h -- string manipulation routines.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_str_h
#define __cat_str_h
#include <cat/cat.h>
#include <stdarg.h>
uchar chnval(char digit);
size_t str_copy(char *dst, const char *src, size_t dlen);
size_t str_cat(char *dst, con... |
github188/catlib | src/str.c | <gh_stars>1-10
/*
* str.c -- String manipulation routines.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/str.h>
#include <cat/emit_format.h>
#include <stdarg.h>
#include <limits.h>
#include <string.h>
#include <ctype.h>
STATIC_BUG_ON(cat_str_bad_size_c... |
github188/catlib | test/testbitops.c | <filename>test/testbitops.c
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/bitops.h>
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
void print_bits32(uint32_t x) {
int i;
for ( i = 31; i >= 0; i-- ) {
printf("%u", (uint)((x >> i) & 1));
... |
github188/catlib | include/cat/stdclio.h | /*
* stdclio.h -- stdio interface matched to emit API.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_stdclio_h
#define __cat_stdclio_h
#include <cat/cat.h>
#include <cat/emit.h>
#include <cat/inport.h>
#include <stdio.h>
struct file_emitter {
struct emitter fe_emitter;
F... |
github188/catlib | test/testprintf.c | <reponame>github188/catlib<filename>test/testprintf.c
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/emit.h>
#include <cat/emit_format.h>
#include <cat/str.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <sys/time.h>
int ntests = ... |
github188/catlib | include/cat/emit_format.h | <reponame>github188/catlib
/*
* emit_format.h -- Formatted output over the emit interface.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_emit_format_h
#define __cat_emit_format_h
#include <cat/cat.h>
#include <cat/emit.h>
#include <stdarg.h>
int emit_format(struct emitter... |
github188/catlib | include/cat/cds.h | /*
* cat/cds.h -- Container data structure macros.
* Macros for creating simple container nodes for different data types.
*
* by <NAME>
*
* Copyright 2009-2012 -- See accompanying license
*
*/
#ifndef __cat_cds_h
#define __cat_cds_h
#include <cat/cat.h>
#include <stdlib.h>
#define CDS_NEWSTRUCT(_ds, _dt, _... |
github188/catlib | attic/str.c | <gh_stars>1-10
/*
* str.c -- String manipulation functions
*
* by <NAME>
*
* Copyright 2003, See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/mem.h>
#include <cat/grow.h>
#include <cat/str.h>
#if defined(CAT_USE_STDLIB) && CAT_USE_STDLIB
#include <string.h>
#else
#include <cat/catstdlib.h>
#endi... |
github188/catlib | test/testtime.c | /*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/time.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
cat_time_t start, last, delta;
start = last = tm_uget();
printf("sec = %ld, nsec = %ld\n", tm_sec(start), tm_nsec(start));
sleep(1);
delta = tm_mark(&... |
github188/catlib | src/bitops.c | /*
* bitops.c -- bit manipulation operations.
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/bitops.h>
char num_bits_array[256] = {
0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
1,2,2,3,2... |
github188/catlib | include/cat/csv.h | /*
* csv.h -- Routines for manipulating comma separated values files.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_csv_h
#define __cat_csv_h
#include <cat/cat.h>
enum {
CSV_ERR = -1,
CSV_EOF = 0,
CSV_OK = 1,
CSV_FLD = 2,
CSV_REC = 3,
CSV_CNT = 4,
CSV_GETC_EOF = -1... |
github188/catlib | src/dbgmem.c | /*
* dbgmem.c -- memory manager instrumented for debugging.
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/dbgmem.h>
#include <cat/err.h>
#include <cat/hash.h>
/* TODO: Make thread safe */
#include <stdlib.h>
#ifndef CAT_DBGMEM_NBUCKETS
#define CAT_DBG... |
github188/catlib | include/cc/limits.h | <gh_stars>1-10
/*
* limits.h -- C standard limits.h file
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __catlimits_h
#define __catlimits_h
/*
* These are best guesses that you can substitute on your own machine if
* need be.
*/
#define CHAR_BIT 8
#define UCHAR_MAX ((uchar)... |
github188/catlib | include/cat/buffer.h | <reponame>github188/catlib<filename>include/cat/buffer.h
/*
* cat/dynbuf.h -- A generic resizeable byte buffer;
*
* by <NAME>
*
* Copyright 2012, See accompanying license
*
*/
#ifndef __cat_buffer_h
#define __cat_buffer_h
#include <cat/cat.h>
#include <cat/mem.h>
struct dynbuf {
ulong size;
byte_t * data;... |
github188/catlib | test/testtlsf.c | /*
* by <NAME>
*
* Copyright 2003-2015 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/dynmem.h>
#include <cat/err.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define NWORDS (1024 * 1024 * 2)
#define MAXALLOCS 32
#define NITER 128
#define PRINTPERIOD 1
unsigned long Memory[N... |
github188/catlib | include/cat/time.h | /*
* cat/time.h -- Functions for timing events
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_time_h
#define __cat_time_h
#include <cat/cat.h>
#if defined(CAT_USE_INLINE) && CAT_USE_INLINE
#define DECL static inline
#define CAT_TIME_DO_DECL 1
#define LDECL static inline
#e... |
github188/catlib | test/testlist.c | /*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <cat/list.h>
#include <cat/stduse.h>
#include <cat/mem.h>
#define NT 100000000
#define LLEN 100
#define NT2 1000000
int main(int argc, char *argv[])
{
struct list list... |
github188/catlib | test/testudps.c | <gh_stars>1-10
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <unistd.h>
#include <stdio.h>
#include <cat/err.h>
#include <cat/net.h>
int main(int argc, char *argv[])
{
int fd, n=1;
char recvbuf[255], aname[255];
struct sockaddr_storage sas;
socklen_t addrsiz = 255, s... |
github188/catlib | include/std/stdlib.h | <gh_stars>1-10
/*
* stdlib.h -- Standard C library routines.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_stdlib_h
#define __cat_stdlib_h
#include <cat/cat.h>
#include <stdarg.h>
/* We use the mem* functions even if we don't use the standard library */
#if !CAT_USE_STDLI... |
github188/catlib | test/markov.c | /*
* by <NAME>
*
* Copyright 2003-2015 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/mem.h>
#include <cat/ring.h>
#include <cat/hash.h>
#include <cat/list.h>
#include <cat/err.h>
#include <cat/stduse.h>
#include <cat/cds.h>
#include <sys/time.h>
#include <string.h>
#include <stdio.h>
#include... |
github188/catlib | test/testtcpc.c | <reponame>github188/catlib
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <stdio.h>
#include <string.h>
#include <cat/err.h>
#include <cat/net.h>
#include <cat/io.h>
int main(int argc, char *argv[])
{
int fd, n, n2;
char recvbuf[255];
char sendbuf[255];
char ... |
github188/catlib | test/testhash.c | <reponame>github188/catlib<filename>test/testhash.c
/*
* by <NAME>
*
* Copyright 2003-2015 -- See accompanying license
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <cat/hash.h>
#include <cat/stduse.h>
#define NUMSTR 4
#define NOPS 65536
#define NITER (128 * NOPS... |
github188/catlib | src/buffer.c | <filename>src/buffer.c<gh_stars>1-10
/*
* buffer.c -- growable data buffers.
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include "cat/buffer.h"
#include <stdlib.h>
#include <string.h>
#if CAT_USE_INLINE
#define INLINE inline
#else
#define INLINE
#endif
static INLINE void dyb_sanity(s... |
github188/catlib | attic/regex.h | /*
* cat/regex.h -- simplified UNIX regular expressions
*
* by <NAME>
*
* Copyright 2003, See accompanying license
*
*/
#ifndef __CAT_REGEX_H
#define __CAT_REGEX_H
#include <sys/types.h>
#include <cat/cat.h>
#include <regex.h>
int re_find(const char *s, const char *p, regmatch_t *m, int nm);
int re_lastrep(c... |
github188/catlib | src/uevent.c | /*
* cat/uevent.c -- UNIX event dispatch
*
* by <NAME>
*
* Copyright 2008-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#if CAT_HAS_POSIX
#include <sys/types.h>
#include <sys/select.h>
#include <sys/time.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <e... |
github188/catlib | src/bitset.c | <gh_stars>1-10
/*
* bitset.c -- Bit array-based set
*
* by <NAME>
*
* Copyright 2007 - 2012 See accompanying license
*
*/
#undef CAT_USE_INLINE
#undef CAT_BITSET_DO_DECL
#define CAT_USE_INLINE 0
#define CAT_BITSET_DO_DECL 1
#include <cat/bitset.h>
|
github188/catlib | include/cat/hash.h | /*
* cat/hash.h -- Hash table implementation
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_hash_h
#define __cat_hash_h
#include <cat/cat.h>
#include <cat/aux.h>
/* pointer to a hash function: takes a 'key' and context */
typedef uint (*hash_f)(const void *key, void *ctx)... |
github188/catlib | attic/mem.c | <reponame>github188/catlib
/*
* mem.c -- funtions needed by most or all modules
*
* by <NAME>
*
* Copyright 2003, 2004 See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/mem.h>
void *mem_get(struct memsys *m, unsigned long len)
{
if ( !m || !m->ms_alloc )
return NULL;
return m->ms_alloc(m, l... |
github188/catlib | include/cat/emit.h | /*
* emit.h -- generic output stream API
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_emit_h
#define __cat_emit_h
#include <cat/cat.h>
enum {
EMIT_OK = 0,
EMIT_EOS = 1,
EMIT_ERR = -1
};
struct emitter;
typedef int (*emit_f)(struct emitter *ectx, const void *buf, siz... |
github188/catlib | utils/netpipe.c | <gh_stars>1-10
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/net.h>
#include <cat/uevent.h>
#include <cat/io.h>
#include <cat/err.h>
#include <cat/ring.h>
#include <cat/stduse.h>
#include <limits.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib... |
github188/catlib | include/cat/mem.h | <reponame>github188/catlib<filename>include/cat/mem.h
/*
* mem.h -- memory management API
*
* by <NAME>
*
* Copyright 2003-2017 -- See accompanying license
*
*/
#ifndef __cat_mem_h
#define __cat_mem_h
#include <cat/cat.h>
#include <cat/aux.h>
struct memmgr;
typedef void *(*alloc_f)(struct memmgr *mm, size_t siz... |
github188/catlib | utils/pegcc.c | <reponame>github188/catlib
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <cat/cat.h>
#include <cat/emalloc.h>
#include <cat/err.h>
#include <cat/optparse.h>
#include <cat/peg.h>
#include <cat/cpg.h>
#include <cat/str.h>
#define NODE(_peg, _i) (&(_peg)->nodes[_i])
#define NODE_TYPE(_peg, _i) ((_pe... |
github188/catlib | src/ring.c | <gh_stars>1-10
/*
* ring.c -- Ring Buffer Implementation
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/ring.h>
#include <string.h>
#define CKRING(r) \
do { abort_unless(r); \
abort_unless(((r)->alloc > 0) && ((r)->start < ... |
github188/catlib | test/testuemux.c | /*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <sys/time.h>
#include <cat/io.h>
#include <cat/uevent.h>
#include <cat/stduse.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
struct ioctx {
int infd;
int outfd;
int len;
struct ue_ioevent *i... |
github188/catlib | src/pool.c | /*
* pool.c -- static data pool
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#undef CAT_USE_INLINE
#undef CAT_POOL_DO_DECL
#define CAT_USE_INLINE 0
#define CAT_POOL_DO_DECL 1
#include <cat/pool.h>
|
github188/catlib | include/cat/list.h | <filename>include/cat/list.h<gh_stars>1-10
/*
* cat/list.h -- circular doubly linked list
*
* by <NAME>
*
* Copyright 2003-2017 -- See accompanying license
*
*/
#ifndef __cat_list
#define __cat_list
#include <cat/cat.h>
#if defined(CAT_USE_INLINE) && CAT_USE_INLINE
#define DECL static inline
#define CAT_LIST... |
github188/catlib | include/cat/stduse.h | <gh_stars>1-10
/*
* stduse.h -- application level nicities built on the rest of the catlib
*
* by <NAME>
*
* Copyright 2007-2015 -- See accompanying license
*
*/
#ifndef __cat_stduse_h
#define __cat_stduse_h
#include <cat/cat.h>
#include <cat/emalloc.h>
#include <cat/err.h>
/* Memory manager extras */
#includ... |
github188/catlib | src/match.c | /*
* match.c -- Routines to do fast string matching.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/match.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
void kmp_pinit(struct kmppat *kmp, struct raw *pat, ulong *skips)
{
ulong q, k, len... |
github188/catlib | include/std/stdio.h | <filename>include/std/stdio.h<gh_stars>1-10
/*
* stdio.h -- C stdio.h header file.
*
* by <NAME>
*
* Copyright 2003-2014 -- See accompanying license
*
*/
#ifndef __cat_stdio_h
#define __cat_stdio_h
#include <cat/cat.h>
#include <stdarg.h>
#if !CAT_USE_STDLIB
typedef struct {
char * f_buffer;
size_t f_bufle... |
github188/catlib | src/pack.c | <filename>src/pack.c
/*
* pack.c -- Functions to pack values into byte arrays
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/pack.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
typedef unsigned char byte;
typedef unsi... |
github188/catlib | src/grow.c | /*
* grow.c -- funtions to grow dynamically allocated memory
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/aux.h>
#include <cat/mem.h>
#include <cat/grow.h>
#include <stdlib.h>
/*
* Rules:
* - min must be less that CAT_MAXGROW
* - len and ptr must... |
github188/catlib | test/testmatch.c | <reponame>github188/catlib
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <cat/cat.h>
#include <cat/match.h>
#include <cat/err.h>
#include <cat/raw.h>
#include <cat/stduse.h>
void usage(void)
{
err("us... |
github188/catlib | include/cat/crc.h | <filename>include/cat/crc.h
/*
* cat/crc.h -- Cyclic Redundancy Check headers
*
* by <NAME>
*
* Copyright 2015 -- See accompanying license
*
*/
#ifndef __cat_crc32_h
#define __cat_crc32_h
#include <cat/cat.h>
struct crc32tab {
ulong resid[256];
};
#define CAT_CRC32_POLY 0x04C11DB7
#define CAT_CRC32_POLY_R... |
github188/catlib | test/testlex.c | /*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/lex.h>
#include <cat/err.h>
#include <cat/stduse.h>
#include <stdio.h>
#include <string.h>
enum token_e {
WHITESPACE, NEWLINE, NUMBER, PLUS, MINUS, TIMES, DIVIDE, LPAREN,
RPAREN
};
const char *tok2name[] = {
"whitespace", ... |
github188/catlib | src/cpg.c | <gh_stars>1-10
#include <cat/cpg.h>
#include <cat/str.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define STR(_state, _cursor) ((_state)->buf + (_cursor)->i)
#define CHAR(_state, _cursor) ((_state)->buf[(_cursor)->i])
#define CHARI(_state, _cursor, _off) ((_state)->buf[(_cursor)-... |
github188/catlib | include/cat/lex.h | /*
* lex.h -- Simple lexical analyzer using simple regexes
*
* by <NAME>
*
* Copyright 2012 -- See accompanying license
*/
#include <cat/cat.h>
#include <cat/list.h>
#include <cat/match.h>
#include <cat/mem.h>
struct lexer_entry {
struct list entry;
int token;
struct rex_pat pattern;
};
struct lexer { ... |
github188/catlib | include/cat/avl.h | /*
* cat/avl.h -- AVL tree implementation
*
* by <NAME>
*
* Copyright 2003-2017 -- See accompanying license
*
*/
#ifndef __cat_avl_h
#define __cat_avl_h
#include <cat/cat.h>
#include <cat/aux.h>
/* Structure for an AVL-tree node: to be embedded in other structures */
struct anode {
struct anode * p[3];
sign... |
github188/catlib | src/hash.c | /*
* hash.c -- Hash table implementation
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#undef CAT_USE_INLINE
#undef CAT_HASH_DO_DECL
#define CAT_USE_INLINE 0
#define CAT_HASH_DO_DECL 1
#include <cat/hash.h>
|
github188/catlib | test/pegs/peg-print.c | <reponame>github188/catlib
#include <cat/peg.h>
#include <cat/buffer.h>
#include <cat/emalloc.h>
#include <cat/err.h>
#include <stdio.h>
#include <stdlib.h>
char *readfile(const char *filename, uint *fs)
{
FILE *fp;
long fsize;
char *buf;
long nread;
fp = fopen(filename, "r");
if ( fp == NULL )
errsys("openi... |
github188/catlib | include/cat/sort.h | /*
* cat/sort.h -- Sorting arrays
*
* by <NAME>
*
* Copyright 2009-2012 See accompanying license
*
*/
#ifndef __cat_sort_h
#define __cat_sort_h
#include <cat/cat.h>
void isort_array(void *arr, const size_t nelem, const size_t esize, cmp_f cmp);
void ssort_array(void *arr, const size_t nelem, const size_t esi... |
github188/catlib | include/cc/stdarg.h | /*
* stdarg.h -- variable argument macros
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __catstdarg_h
#define __catstdarg_h
/* stdarg.h -- a best guess: works for x86 */
typedef char *va_list;
#define __CAT_ASIZ sizeof(int)
#define __CAT_ROUND(x) ((((x) + __CAT_ASIZ - 1) / __CA... |
github188/catlib | test/pegs/peg-test-parse.c | <gh_stars>1-10
#include <cat/peg.h>
#include <cat/buffer.h>
#include <cat/emalloc.h>
#include <cat/err.h>
#include <cat/cpg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *readfile(const char *filename, uint *fs)
{
FILE *fp;
long fsize;
char *buf;
long nread;
fp = fopen(filename, "r");
if (... |
github188/catlib | include/cat/pack.h | <reponame>github188/catlib<gh_stars>1-10
/*
* cat/pack.h -- functions to pack and unpack values into byte arrays
*
* by <NAME>
*
* Copyright 2003-2017 See accompanying license
*
*/
#ifndef __cat_pack_h
#define __cat_pack_h
#include <cat/cat.h>
/*
"eEbhwjBHWJr"
e - little endian
E - big endian
b - by... |
github188/catlib | src/emalloc.c | <filename>src/emalloc.c<gh_stars>1-10
/*
* emalloc.c -- malloc code that aborts the program when out of memory.
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/emalloc.h>
#include <cat/err.h>
#include <stdlib.h>
#include <string.h>
static void def_emalloc_... |
github188/catlib | src/shell.c | /*
* shell.c -- Dumb shell interpreter.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/shell.h>
#include <cat/str.h>
#include <cat/stduse.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
/*
* Possible TODOs
* Allow quoted strings
*/
... |
github188/catlib | include/cat/cpg.h | #ifndef __cpg_h
#define __cpg_h
#include <cat/peg.h>
struct cpg_cursor {
uint i;
uint line;
};
struct cpg_state {
int debug;
int depth;
void *in;
struct cpg_cursor cur;
uchar *buf;
uint buflen;
uint readidx;
uint eof;
int (*getc)(void *in);
struct peg_grammar *peg;
};
int cpg_init(struct cpg_state *st... |
github188/catlib | src/aux.c | <reponame>github188/catlib
/*
* aux.c -- funtions needed by most or all modules
*
* by <NAME>
*
* Copyright 2003-2014 See accompanying license
*
*/
#include <cat/cat.h>
#include <cat/aux.h>
#include <stdlib.h>
#include <string.h>
int cmp_ptr(const void *k1, const void *k2)
{
return ((char *)k1 - (char *)k2)... |
github188/catlib | src/catstr.c | /*
* catstr.c -- application level strings
*
* by <NAME>
*
* Copyright 2007-2012 See accompanying license
*
*/
#include <cat/catstr.h>
#include <cat/str.h>
#include <cat/grow.h>
#include <cat/match.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#if CAT_HAS_POSIX
#include <errno.h>
#include ... |
github188/catlib | test/testcrc.c | <filename>test/testcrc.c<gh_stars>1-10
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cat/crc.h>
#include <cat/err.h>
const char check_vec[] = "123456789";
#define CRC32_CHECK_VAL 0xCBF43926ul
#define CRC32C_CHECK_VAL 0xE3069283ul
void crc32_file(const char *s)
{
FILE *fp;
char buf[1024];
... |
github188/catlib | src/stduse.c | /*
* stduse.c -- application level nicities built on the rest of the catlib
*
* by <NAME>
*
* Copyright 2007-2015 See accompanying license
*
*/
#include <cat/cat.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cat/err.h>
#include <cat/stduse.h>
#include <cat/grow.h>
#include <cat/bits... |
github188/catlib | src/inport.c | <reponame>github188/catlib<filename>src/inport.c
/*
* inport.c -- generic API for an input stream.
*
* by <NAME>
*
* Copyright 2003-2012 See accompanying license
*
*/
#include <cat/inport.h>
#include <limits.h>
#include <string.h>
/* ------ Core API ------ */
int inp_read(struct inport *in, void *buf, int len)... |
github188/catlib | include/cat/bitops.h | /*
* bitops.h -- Bit manipulation operations.
*
* by <NAME>
*
* Copyright 2003-2015 -- See accompanying license
*
*/
#ifndef __bitops_h
#define __bitops_h
#include <cat/cat.h>
#include <cat/archops.h>
uint32_t rup2_32(uint32_t x, uint lg2p);
uint32_t rdp2_32(uint32_t x, uint lg2p);
uint32_t compress_l32(uint32... |
github188/catlib | test/testcsv.c | <filename>test/testcsv.c
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <stdio.h>
#include <cat/csv.h>
#include <cat/list.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char farr[32] = { 0 };
int i, j;
char buf[20];
int code;
struct csv_state csv;
for ( i = 1 ; ... |
github188/catlib | include/cat/crypto.h | <filename>include/cat/crypto.h<gh_stars>1-10
/*
* cat/crypto.h -- Cryptographic algorithms
*
* by <NAME>
*
* Copyright 2009-2015 -- See accompanying license
*
*/
#ifndef __cat_crypto_h
#define __cat_crypto_h
#include <cat/cat.h>
/* ARC4 Stream Cipher */
struct arc4ctx {
uint i;
uint j;
byte_t s[256];
};... |
github188/catlib | include/cat/graph.h | <reponame>github188/catlib
/*
* graph.h -- Generic graph data structure.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __graph_h
#define __graph_h
#include <cat/cat.h>
#include <cat/mem.h>
#include <cat/list.h>
struct gr_edge_arr {
struct gr_edge ** arr;
uint fill;
uint ... |
github188/catlib | include/cat/socks5.h | /*
* socks5.h -- SOCKS5 protocol library.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __anonsocks_h
#define __anonsocks_h
#include <cat/cat.h>
#if CAT_HAS_POSIX
#include <sys/types.h>
#include <sys/socket.h>
#define SOCKS5_CT_CONNECT 1
#define SOCKS5_CT_BIND 2
#define SOCK... |
github188/catlib | test/testsocks5.c | <reponame>github188/catlib
/*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#include <stdio.h>
#include <string.h>
#include <cat/net.h>
#include <cat/err.h>
#include <cat/socks5.h>
int main(int argc, char *argv[])
{
int fd;
int rv;
char line[256];
FILE *in, *out;
struct socks5addr insa... |
github188/catlib | include/cat/stdcsv.h | /*
* stdcsv.h -- Nicer way to interact with CSV files.
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __stdcsv_h
#define __stdcsv_h
#include <cat/cat.h>
#if CAT_HAS_POSIX
#include <cat/csv.h>
struct csv_record {
ulong cr_nfields;
char ** cr_fields;
};
int csv_fopen(struct ... |
github188/catlib | src/rbtree.c | /*
* cat/rbtree.c -- Red-Black tree implementation
*
* by <NAME>
*
* Copyright 2004-2012 -- See accompanying license
*
*/
#undef CAT_USE_INLINE
#undef CAT_RB_DO_DECL
#define CAT_USE_INLINE 0
#define CAT_RB_DO_DECL 1
#include <cat/rbtree.h>
|
github188/catlib | include/cat/cb.h | <filename>include/cat/cb.h
/*
* cat/cb.h -- Event handling and dispatch
*
* by <NAME>
*
* Copyright 2003-2012 -- See accompanying license
*
*/
#ifndef __cat_cb_h
#define __cat_cb_h
#include <cat/cat.h>
#include <cat/list.h>
struct callback;
typedef int (*callback_f)(void *arg, struct callback *cb);
struct c... |
erpapa/Viry3D | lib/src/graphics/Mesh.h | <reponame>erpapa/Viry3D
/*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requ... |
erpapa/Viry3D | lib/src/graphics/SkinnedMeshRenderer.h | <reponame>erpapa/Viry3D
/*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requ... |
erpapa/Viry3D | lib/src/animation/Animation.h | /*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... |
erpapa/Viry3D | lib/src/graphics/Renderer.h | <filename>lib/src/graphics/Renderer.h
/*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*... |
erpapa/Viry3D | lib/src/math/Vector3.h | <gh_stars>0
/*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by appl... |
erpapa/Viry3D | lib/src/graphics/Shader.h | /*
* Viry3D
* Copyright 2014-2019 by Stack - <EMAIL>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... |
RbBtSn0w/SWMoabCache | RBSMoabCache/RBSMoabCache.h | <reponame>RbBtSn0w/SWMoabCache<gh_stars>1-10
//
// RBSMoabCache.h
//
// Copyright (c) <2014-2017> RbBtSn0w
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, includin... |
RbBtSn0w/SWMoabCache | RBSMoabCacheExample/SWMoabCacheExample/ViewController.h | <reponame>RbBtSn0w/SWMoabCache<gh_stars>1-10
//
// ViewController.h
// RBSMoabCacheExample
//
// Created by <NAME> on 4/15/17.
// Copyright © 2017 RbBtSn0w. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
lzx8589561/X-UI | main/ui/page/start_up/start_up_view.c | #include "start_up_view.h"
#include "../../resource/resource_pool.h"
#include "../../ui_page_manager.h"
#define COLOR_ORANGE lv_color_hex(0xff931e)
void startup_view_create(lv_obj_t* root)
{
lv_obj_remove_style_all(root);
lv_obj_set_size(root, LV_HOR_RES, LV_VER_RES);
lv_obj_t* cont = lv_obj_create(ro... |
lzx8589561/X-UI | components/lvgl_esp32_drivers/lvgl_touch/gt911.h | <filename>components/lvgl_esp32_drivers/lvgl_touch/gt911.h
#ifndef __GT911_H
/*
* Copyright © 2021 Sturnus Inc.
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the “Software”), to deal in the Software
* without restriction, includi... |
lzx8589561/X-UI | main/ui/page/start_up/start_up.h | <gh_stars>1-10
#ifndef __STARTUP_PRESENTER_H
#define __STARTUP_PRESENTER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl/lvgl.h"
/**
* 定义页面单独的一些交互实体
*/
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif
|
lzx8589561/X-UI | lv_sim_visual_studio/LVGL.Simulator/lvgl/src/extra/libs/lv_libs.h | <reponame>lzx8589561/X-UI
/**
* @file lv_libs.h
*
*/
#ifndef LV_LIBS_H
#define LV_LIBS_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "bmp/lv_bmp.h"
#include "fsdrv/lv_fsdrv.h"
#include "png/lv_png.h"
#include "gif/lv_gif.h"
#include "qrcode/lv_qr... |
lzx8589561/X-UI | main/ui/ui_page_manager.h | <gh_stars>1-10
#ifndef UI_PAGE_MANAGER_H
#define UI_PAGE_MANAGER_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl/lvgl.h"
/** --- common --- */
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
/** --- stack ---*/
#define STACK_INIT_SIZE 10
#define STACK_INCREASE_SIZE 15
typedef s... |
lzx8589561/X-UI | main/ui/resource/resource_pool.c | #include "resource_pool.h"
#include "../ui_page_manager.h"
#include <stdlib.h>
static resource_manager_handler font_;
static resource_manager_handler image_;
#define IMPORT_FONT(name) \
do{\
LV_FONT_DECLARE(font_##name)\
rm_add_resource(font_, #name, (void*)&font_##name);\
}while(0)
#define IMPORT_IMG(name) ... |
lzx8589561/X-UI | main/ui/page/dialplate/dialplate_view.c | <reponame>lzx8589561/X-UI
#include "dialplate_view.h"
#include "../../resource/resource_pool.h"
#include "../../ui_page_manager.h"
void dialplate_view_bottom_info_create(lv_obj_t* par);
void dialplate_view_top_info_create(lv_obj_t* par);
void dialplate_view_btn_cont_create(lv_obj_t* par);
void dialplate_view_sub_info_... |
lzx8589561/X-UI | main/ui/page/start_up/start_up_view.h | #ifndef __STARTUP_VIEW_H
#define __STARTUP_VIEW_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl/lvgl.h"
typedef struct startup_view_t *startup_view_handler;
struct startup_view_t{
lv_obj_t *cont;
lv_obj_t *labelLogo;
lv_anim_timeline_t *anim_timeline;
};
void startup_view_create(lv_obj_t *root);... |
lzx8589561/X-UI | main/ui/page/status_bar/status_bar.h | #ifndef __STATUS_BAR_H
#define __STATUS_BAR_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl/lvgl.h"
typedef enum
{
STATUS_BAR_STYLE_TRANSP,
STATUS_BAR_STYLE_BLACK,
STATUS_BAR_STYLE_MAX
} status_bar_style_t;
void status_bar_init(lv_obj_t* par);
void status_bar_set_style(status_bar_style_t style);... |
lzx8589561/X-UI | main/controller/dialplate_controller.h | #ifndef DIALPLATE_CONTROLLER_H
#define DIALPLATE_CONTROLLER_H
void dialplate_controller_init();
#endif //DIALPLATE_CONTROLLER_H
|
lzx8589561/X-UI | main/ui/resource/resource_pool.h | <filename>main/ui/resource/resource_pool.h
#ifndef RESOURCE_POOL_H
#define RESOURCE_POOL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lvgl/lvgl.h"
void resource_pool_init();
lv_font_t* resource_pool_get_font(const char* name);
const void* resource_pool_get_image(const char* name);
#ifdef __cplusplus
} /*exter... |
lzx8589561/X-UI | main/ui/app_entity_def.h | #ifndef APP_ENTITY_DEF_H
#define APP_ENTITY_DEF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* 定义全局实体
*/
/**
* 测试传输消息
*/
typedef enum {
TEST_MSG_TEST_DATA,
TEST_MSG_SYNC_TEST_DATA
}test_msg_t;
/**
* 定义UI所需的数据格式
*/
typedef struct {
int attr1;
int attr2;
int attr3;
}test_data_t;
#ifdef __cp... |
lzx8589561/X-UI | main/ui/page/dialplate/dialplate.c | <filename>main/ui/page/dialplate/dialplate.c
#include <stdio.h>
#include <stdlib.h>
#include "../../ui_page_manager.h"
#include "../status_bar/status_bar.h"
#include "dialplate_view.h"
#include "dialplate.h"
#include "../../app_entity_def.h"
static page_base_handler pb = NULL;
dialplate_view_heandler dialplate_view_ui... |
lzx8589561/X-UI | main/ui/page/status_bar/status_bar.c | <filename>main/ui/page/status_bar/status_bar.c
#include <stdio.h>
#include <stdlib.h>
#include "status_bar.h"
#define BATT_USAGE_HEIGHT (lv_obj_get_style_height(ui.battery.img, 0) - 6)
#define BATT_USAGE_WIDTH (lv_obj_get_style_width(ui.battery.img, 0) - 4)
#define STATUS_BAR_HEIGHT 22
#include "../../resource/reso... |
lzx8589561/X-UI | main/ui/ui_page_manager.c | <reponame>lzx8589561/X-UI
#include <stdio.h>
#include "ui_page_manager.h"
#include <stdlib.h>
/** 是否开启日志 */
#define PAGE_MANAGER_USE_LOG 1
/** --- LOG --- */
#if PAGE_MANAGER_USE_LOG
# define _PM_LOG(format, ...) printf("[PM]"format"\r\n", ##__VA_ARGS__)
# define PM_LOG_INFO(format, ...) _PM_LOG("[Info] "form... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.