repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Akshat69/SFML-RPG
SFML-RPG/TileMap.h
<gh_stars>0 #pragma once #include "Tile.h" #include "stdafx.h" class TileMap { unsigned gridSizeU, gridSizeF, layers; sf::Vector2u maxSize; std::vector<std::vector<std::vector<Tile>>> tilemap; public: TileMap(); ~TileMap(); void Update(const float& DeltaTime); void Render(sf::RenderTarget* target); };
Akshat69/SFML-RPG
SFML-RPG/MovementComponent.h
<gh_stars>0 #pragma once #include "stdafx.h" class MovementComponent { private: sf::Sprite& sprite; float maxVelocity; float acceleration; float deceleration; sf::Vector2f initialVelocity = sf::Vector2f(0.0f, 0.0f); sf::Vector2f Velocity; //Initializer Functions public: bool isEnabled = true; Movement...
Akshat69/SFML-RPG
SFML-RPG/AudioComponent.h
#pragma once #include "stdafx.h" class AudioComponent { private: sf::Music music; std::map<std::string, std::string> audios; public: void Play(bool looping = false); void Stop(); void initVariables(); AudioComponent(const std::string& audioFile); ~AudioComponent(); };
Akshat69/SFML-RPG
SFML-RPG/stdafx.h
<reponame>Akshat69/SFML-RPG<filename>SFML-RPG/stdafx.h<gh_stars>0 //Core #include <algorithm> #include <deque> #include <iostream> #include <map> #include <memory> #include <set> #include <thread> #include <utility> #include <vector> #include <list> #include <stack> #include <string> #include <sstream> #include <fstrea...
Akshat69/SFML-RPG
SFML-RPG/Entity.h
<gh_stars>0 #pragma once #include "HitboxComponent.h" #include "MovementComponent.h" #include "AnimationComponent.h" class Entity { private: protected: sf::Sprite sprite; MovementComponent* movementComponent; AnimationComponent* animationComponent; HitboxComponent* hitboxComponent; float movementSpeed = 100.0...
github188/catlib
test/testshell.c
<filename>test/testshell.c<gh_stars>1-10 /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <cat/shell.h> #include <cat/stduse.h> #include <cat/str.h> int func(struct shell_env *env, int nargs, char *args[], struct shell_value *r); struct shell...
github188/catlib
attic/mcache.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/mcache.h> void mc_init(struct mcache *mc, int pglen, memctl_f mctl) { Assert(mc); Assert(slabsize > sizeof(union mc_pool_u) || (!slabsize && !mctl)); l_init(&mc->types); l_init(&mc->pages); mc->pglen = pglen; mc->mctl =...
github188/catlib
include/cat/dbgmem.h
<gh_stars>1-10 /* * dbgmem.h -- Memory management API instrumented for debugging. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __dbgmem_h #define __dbgmem_h #include <cat/cat.h> #include <cat/mem.h> void *dbg_mem_get(struct memmgr *mm, size_t amt); void *dbg_mem_resize(struct m...
github188/catlib
src/heap.c
/* * heap.c -- Array-based heap implementation * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_HEAP_DO_DECL #define CAT_USE_INLINE 0 #define CAT_HEAP_DO_DECL 1 #include <cat/heap.h>
github188/catlib
utils/vernam.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <ctype.h> #include <cat/stduse.h> #define MAXLINE 256 void decode(char *c1, char *c2, int add, int off) { char out[MAXLINE], *op = out; int i, v1, v2, outc; while ( *c1 != '\0' && *c2 != '\0' ) { while ( *c1...
github188/catlib
test/testcrypto.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <cat/crypto.h> #include <cat/time.h> #define NITER 100000 #define DLEN 256 uchar rand_data[DLEN]; byte_t sipkey[16]; void init_data() { const char seed[] = "Hi world!"; struct arc4ctx ar...
github188/catlib
test/testavl.c
<gh_stars>1-10 /* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <cat/avl.h> #include <cat/stduse.h> #include <cat/emalloc.h> #include <sys/time.h> #define NUMSTR 4 #define NA 200 /* in case strdup() doesn't exist */ int vr...
github188/catlib
test/testrb.c
/* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <cat/rbtree.h> #include <cat/stduse.h> #include <cat/emalloc.h> #include <sys/time.h> #define NUMSTR 4 #define NA 200 int vrfy(struct rbnode *n) { int l, r; if ( ! n )...
github188/catlib
test/testheap.c
<reponame>github188/catlib /* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <stdio.h> #include <stdlib.h> #include <cat/aux.h> #include <cat/heap.h> #include <cat/err.h> #include <cat/stduse.h> int my_cmp_int(const void *a, const void *b) { return ptr2int(a) - ptr2int(b); } in...
github188/catlib
attic/ex.h
/* * cat/ex.h -- Exceptions via longjmp * * by <NAME> * * Copyright 2003, See accompanying license * */ #ifndef __CAT_EX_H #define __CAT_EX_H #include <cat/cat.h> #if defined(CAT_USE_STDLIB) && CAT_USE_STDLIB #include <setjmp.h> #ifndef MAXEXSTK #define MAXEXSTK 64 #endif /* MAXEXSTK */ struct ex_ent { jm...
github188/catlib
src/list.c
<reponame>github188/catlib<gh_stars>1-10 /* * list.c -- circular doubly linked list implementation * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_LIST_DO_DECL #define CAT_USE_INLINE 0 #define CAT_LIST_DO_DECL 1 #include <cat/list.h>
github188/catlib
include/cc/stddef.h
/* * stddef.h -- C stddef.h header file * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __catstddef_h #define __catstddef_h /* * These are best guesses that you can substitute on your own machine if * need be. */ typedef ulong size_t; typedef long ptrdiff_t; typedef ushort wc...
github188/catlib
test/pegs/peg-calc.c
#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> int stack[256]; int tos = 0; void push(int val) { if ( tos >= array_length(stack) ) err("Stack overflow\n"); stack[tos++] = val; } int pop(vo...
github188/catlib
src/cat.c
/* * cat.c -- generic universal catlib functions * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #include <cat/cat.h> #include <stdio.h> #include <stdlib.h> void cat_abort(const char *fn, unsigned ln, const char *expr) { fprintf(stderr, "%s:%u -- check failed: %s\n", fn, ln, expr); abort...
github188/catlib
include/cat/splay.h
/* * cat/splay.h -- Splay tree implementation * * by <NAME> * * Copyright 2006-2017 -- See accompanying license * */ #ifndef __cat_splay_h #define __cat_splay_h #include <cat/cat.h> #include <cat/aux.h> /* Structure for a splay tree node: to be embedded in other structures */ struct stnode { struct stnode * ...
github188/catlib
include/cat/optparse.h
/* * cat/optparse.h -- Command-line option parsing * * by <NAME> * * Copyright 2009-2012 -- See accompanying license * */ #ifndef __cat_optparse_h #define __cat_optparse_h #include <cat/cat.h> #define CLOPT_NOARG 0 #define CLOPT_STRING 1 #define CLOPT_INT 2 #define CLOPT_UINT 3 #define CLOPT_DOUBLE 4 #define...
github188/catlib
include/cat/raw.h
/* * cat/raw.h -- raw blob manipulation functions * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #ifndef __CAT_RAW_H #define __CAT_RAW_H #include <cat/cat.h> int raw_cmp(void *r1, void *r2); struct raw * str_to_raw(struct raw *r, char *s, int terminate); #endif /* __CAT_RAW_H *...
github188/catlib
attic/regex.c
<gh_stars>1-10 /* * regex.c -- simplified UNIX regular expressions * * by <NAME> * * Copyright 2003, See accompanying license * */ #include <cat/cat.h> #if defined(CAT_USE_STDLIB) && CAT_USE_STDLIB #include <cat/raw.h> #include <cat/regex.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int re_...
github188/catlib
attic/time.c
/* * time.c -- timing functions * * by <NAME> * * Copyright 2003, See accompanying license * */ #include <cat/time.h> #include <time.h> static void tm_fixup(struct cat_time *t) { Assert(t); if ( t->sec > 0 ) { if ( t->nsec < 0 ) { t->nsec += 1000000000L; t->sec--; } } else if ( t->...
github188/catlib
attic/dlist.c
/* * dlist.c -- delta list implementation * * by <NAME> * * Copyright 2003, See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_DLIST_DO_DECL #define CAT_USE_INLINE 0 #define CAT_DLIST_DO_DECL 1 #include <cat/dlist.h>
github188/catlib
src/csv.c
<filename>src/csv.c<gh_stars>1-10 /* * csv.c -- functions to manipulated comma-separated value files. * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #include <cat/cat.h> #include <cat/csv.h> #include <cat/grow.h> #include <string.h> void csv_init(struct csv_state *csv, getchar_f gc, void...
github188/catlib
include/cat/err.h
/* * cat/err.h -- error reporting and debugging * * <NAME> * * Copyright 1999-2012 -- See accompanying license * */ #ifndef __CAT_ERR_H #define __CAT_ERR_H #include <cat/cat.h> #include <cat/emit.h> #include <stdio.h> typedef void (*log_close_f)(struct emitter *); void err(char *fmt, ...); void errsys(ch...
github188/catlib
include/cat/emalloc.h
<reponame>github188/catlib /* * emalloc.h -- error aborting memory management operations. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_emalloc_h #define __cat_emalloc_h #include <cat/cat.h> typedef void (*emalloc_abort_f)(char *s, void *omem, size_t size, size_t nmem, ...
github188/catlib
test/testpool.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <cat/aux.h> #include <cat/mem.h> #include <cat/pool.h> #include <cat/stduse.h> #define NCONS 100000 struct pool Pool; int main(int argc, char *argv[]) { int i, j, na, ...
github188/catlib
test/testregex.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <cat/raw.h> #include <cat/stduse.h> #include <cat/match.h> #include <cat/mem.h> struct rex_match_loc locs[16]; void tmatch(char *pat, char *str) { struct rex_pat rp; struct raw r; int rv, e...
github188/catlib
src/lex.c
<gh_stars>1-10 /* * lex.c -- Dumb lexical analysis. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/lex.h> #include <cat/raw.h> #include <string.h> #include <stdlib.h> #define node_to_lexent(node) container((node), struct lexer_entry, entry) struct lexer *lex_new(struct m...
github188/catlib
src/err.c
/* * err.c -- Error handling and debugging * * <NAME> * * Copyright 2005-2012 -- See accompanying license * */ #include <cat/cat.h> #include <cat/err.h> #include <cat/emit.h> #include <cat/stdclio.h> #include <cat/str.h> #include <stdio.h> #include <stdarg.h> #include <string.h> #include <stdlib.h> #if C...
github188/catlib
include/cat/match.h
/* * match.h -- fast string matching algorithms. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __match_h #define __match_h #include <cat/cat.h> #include <cat/mem.h> #include <cat/hash.h> /* Knuth-Morris-Pratt String matching */ struct kmppat { ulong * skips; struct raw pat; ...
github188/catlib
test/testdynmem.c
<reponame>github188/catlib<gh_stars>1-10 /* * by <NAME> * * Copyright 2003-2012 -- 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 #def...
github188/catlib
attic/teststr.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/cat.h> #include <cat/str.h> #include <cat/aux.h> #include <cat/err.h> #include <cat/mem.h> #include <string.h> int main(int argc, char *argv[]) { struct cstring *s1, *s2, *s3, *s4, *s5, *s6, *s7; const char *foo = "howdy there...
github188/catlib
include/cat/dynmem.h
<reponame>github188/catlib /* * dynmem.h -- Dynamic memory managers. * * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #ifndef __cat_dynmem_h #define __cat_dynmem_h #include <cat/cat.h> #include <cat/list.h> /* core alignment type */ union align_u { void * p; long l; size_t sz; doubl...
github188/catlib
attic/mcache.h
<reponame>github188/catlib /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __mcache_h #define __mcache_h #include <cat/pool2.h> #define MC_MAXOHEAD sizeof(struct list) struct mc_page { struct list te; /* type entry */ struct list ce; /* cache entry */ struct mc_type * type...
github188/catlib
attic/mem.h
<filename>attic/mem.h /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_mem_h #define __cat_mem_h #include <cat/cat.h> #include <cat/aux.h> struct memsys; typedef void *(*alloc_f)(struct memsys *msys, unsigned size); typedef void *(*resize_f)(struct memsys *msys, void *old, uns...
github188/catlib
attic/dlist.h
/* * cat/dlist.h -- Delta list header file for catlib2 * * by <NAME> * * Copyright 2003, See accompanying license * */ #ifndef __CAT_DLIST_H #define __CAT_DLIST_H #ifdef CAT_DLIST_DO_DECL #define SAVE_INLINE CAT_USE_INLINE #undef CAT_USE_INLINE #define CAT_USE_INLINE 1 #endif /* CAT_DLIST_DO_DECL */ #include ...
github188/catlib
include/std/string.h
/* * string.h -- C standard string manipulation routines. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_string_h #define __cat_string_h #include <cat/cat.h> #include <stdarg.h> #if !CAT_USE_STDLIB /* string.h */ int memcmp(const void *b1p, const void *b2p, size_t len); v...
github188/catlib
test/testmem.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <sys/time.h> #include <stdio.h> #include <stdlib.h> #include <cat/mem.h> #include <cat/stduse.h> #define NREPS 50000 #define NMEM 100 unsigned nreps = NREPS; #define TEST(op) \ { \ struct timeval start, stop; \ double us...
github188/catlib
include/cat/heap.h
<filename>include/cat/heap.h /* * cat/heap.h -- Array-based heap implementation * * by <NAME> * * Copyright 2003-2017 -- See accompanying license * */ #ifndef __cat_heap_h #define __cat_heap_h #include <cat/cat.h> #include <cat/mem.h> #if defined(CAT_USE_INLINE) && CAT_USE_INLINE #define DECL static inline #d...
github188/catlib
src/crypto.c
<reponame>github188/catlib /* * crypto.c -- Cryptographic algorithm implementations * * by <NAME> * * Copyright 2009-2015 See accompanying license * */ #include <cat/crypto.h> #include <string.h> void arc4_init(struct arc4ctx *arc4, const void *key, ulong len) { int i, j; byte_t b; const byte_t *keyp = key...
github188/catlib
test/testbitset.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <sys/time.h> #include <cat/stduse.h> #define S0LEN 1024 #define NT 100000000 int main(int argc, char *argv[]) { struct timeval tv, tv2; double usec; struct safebitset *set1, *set2; unsigned i, bit; DECLARE_BI...
github188/catlib
test/testsplay.c
/* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <cat/splay.h> #include <cat/stduse.h> #include <cat/emalloc.h> #include <sys/time.h> #define NUMSTR 4 #define NA 200 void printst(struct stnode *n, int d) { int i; struc...
github188/catlib
include/cat/aux.h
/* * cat/aux.h -- Auxiliary functions * * by <NAME> * * Copyright 2007-2014 -- See accompanying license * */ #ifndef __cat_aux_h #define __cat_aux_h #include <cat/cat.h> /* These NEED to be extern so that function pointers can point to them */ extern int cmp_ptr(const void *, const void *); extern int cmp_str...
github188/catlib
include/cat/io.h
<filename>include/cat/io.h<gh_stars>1-10 /* * cat/io.h -- Input/Output functions * * <NAME> * * Copyright 1999-2012 -- see accompanying license * */ #ifndef __cat_io_h #define __cat_io_h #include <cat/cat.h> #if CAT_HAS_POSIX #include <unistd.h> /* I/O functions */ /* * read 'len' bytes from 'fd'. Kee...
github188/catlib
test/testcatstr.c
<reponame>github188/catlib /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <cat/catstr.h> const char *foo() { CS_DECLARE_Q(static, str1, 32); CS_DECLARE(str2, 16); cs_set_cstr(&str2, "hello world"); cs_format_d(&str1, "%s: %d\n", cs_to_cstr(&str2), 5); retu...
github188/catlib
src/time.c
/* * time.c -- time manipulation functions * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_TIME_DO_DECL #define CAT_USE_INLINE 0 #define CAT_TIME_DO_DECL 1 #include <cat/time.h>
github188/catlib
include/cat/rbtree.h
/* * cat/rbtree.h -- Red-Black tree implementation * * by <NAME> * * Copyright 2004-2017 -- See accompanying license * */ #ifndef __cat_rbtree_h #define __cat_rbtree_h #include <cat/cat.h> #include <cat/aux.h> /* Structure for a Red-Black tree node: to be embedded in other structures */ struct rbnode { struc...
github188/catlib
include/cat/ring.h
/* * cat/ring.h -- Ring Buffer * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_ring_h #define __cat_ring_h #include <cat/cat.h> /* N.B. First two fields match struct raw */ struct ring { size_t alloc; byte_t * data; size_t start; size_t len; } ; #define ring_a...
github188/catlib
include/cat/archops.h
/* * include/cat/archops.h -- Operations accelerated on native platform * * Include bitops.h to get these functions. * * by <NAME> * * Copyright 2008-2015 -- See accompanying license * */ #ifndef __cat_archops_h #define __cat_archops_h #include <cat/cat.h> extern char num_bits_array[]; extern char num_leading...
github188/catlib
include/std/ctype.h
<gh_stars>1-10 /* * ctype.h -- C standard ctype.h library. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_ctype_h #define __cat_ctype_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_STDLIB /...
github188/catlib
test/testdl.c
/* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <cat/dlist.h> #include <cat/stduse.h> #include <stdio.h> int main(int argc, char *argv[]) { struct dlist *node, list, *trav; struct list list2; cat_time_t ct; int arr1[] = { 10, 15, 5, 7, 12, 2, 7 }, arr2[] = { 9, 1, ...
github188/catlib
include/cat/shell.h
<gh_stars>1-10 /* * shell.h -- Dumb program shell. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __shell_h #define __shell_h #include <cat/cat.h> #include <cat/mem.h> #define CAT_MAX_CMD_ARGS 32 #define CAT_MAX_VARS 32 #define CAT_MAX_VARNLEN 32 struct shell_env; enum { S...
github188/catlib
test/markov2.c
/* * by <NAME> * * Copyright 2003-2015 -- See accompanying license * */ #include <cat/cat.h> #include <cat/mem.h> #include <cat/grow.h> #include <cat/hash.h> #include <cat/list.h> #include <cat/err.h> #include <sys/time.h> #include <cat/stduse.h> #include <cat/cds.h> #include <stdio.h> #include <string.h> #define...
github188/catlib
src/crc.c
/* * crc.c -- Cyclic Redundancy Check implementation * * by <NAME> * * Copyright 2015 See accompanying license * */ #include <cat/crc.h> static byte_t rev8(byte_t x) { x = ((x >> 4) & 0x0F) | (x << 4); x = ((x >> 2) & 0x33) | ((x << 2) & 0xCC); x = ((x >> 1) & 0x55) | ((x << 1) & 0xAA); return x; } stat...
github188/catlib
attic/dict.h
/* * cat/dict.h -- Abstract dictionary interface * * by <NAME> * * Copyright 2005 See accompanying license * */ #ifndef __cat_dict_h #define __cat_dict_h #include <cat/cat.h> #include <cat/aux.h> /* dictionary types */ #include <cat/list.h> #include <cat/avl.h> #include <cat/hash.h> #include <cat/rbtree.h> ...
github188/catlib
src/optparse.c
/* * optparse.c -- Command line option parsing * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/optparse.h> #include <string.h> #include <ctype.h> #include <stdlib.h> #include <stdio.h> int optparse_reset(struct clopt_parser *clp, int argc, char *argv[]) { size_t n; struct...
github188/catlib
src/avl.c
/* * cat/avl.c -- AVL tree implementation * * by <NAME> * * Copyright 2003 - 2012 See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_AVL_DO_DECL #define CAT_USE_INLINE 0 #define CAT_AVL_DO_DECL 1 #include <cat/avl.h>
github188/catlib
include/cat/inport.h
/* * inport.c -- generic input API. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_inport_h #define __cat_inport_h #include <cat/cat.h> struct inport; /* len must be >= 0 or returns error */ /* returns: -1 on error, 0 on EOF, > 0 == # of bytes */ typedef int (*inp_read_f)(...
github188/catlib
include/cat/pool.h
/* * pool.h -- fixed size element memory pools. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __pool_h #define __pool_h #include <cat/cat.h> #include <cat/list.h> #define IMAX ((int)(((unsigned)~0) >> 1)) typedef union { cat_align_t align; struct list list; } cat_pitem_t; ...
github188/catlib
attic/ex.c
/* * ex.c -- Exception handling via longjmp() * * by <NAME> * * Copyright 2003, See accompanying license * */ #include <cat/cat.h> #if defined(CAT_USE_STDLIB) && CAT_USE_STDLIB #include <stdlib.h> #include <cat/ex.h> #include <cat/err.h> #if defined(CAT_USE_PTHREADS) && CAT_USE_PTHREADS #include <pthread.h...
github188/catlib
src/emit.c
/* * emit.c -- generic interface to output stream. * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #include <cat/emit.h> #include <limits.h> #include <string.h> int emit_char(struct emitter *em, char ch) { abort_unless(em && em->emit_func); if ( em->emit_state != EMIT_OK ) return -1; ...
github188/catlib
include/cat/pcache.h
/* * pcache.h -- dynamically resizing memory pools. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __pcache_h #define __pcache_h #include <cat/cat.h> #include <cat/mem.h> #include <cat/pool.h> #ifndef PC_DEF_SIZE #define PC_DEF_SIZE 65536 #endif /* PC_DEF_SIZE */ struct pcache...
github188/catlib
attic/mem2.h
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __mem2_h #define __mem2_h #include <cat/cat.h> #include <cat/aux.h> #include <cat/pool.h> #include <cat/pcache.h> #include <cat/hash.h> #include <cat/avl.h> #include <cat/rbtree.h> void pl_memsys(struct pool *p, struct memsys *m); voi...
github188/catlib
test/testsiphash.c
<reponame>github188/catlib /* * by <NAME> * * Copyright 2015 -- See accompanying license * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <cat/hash.h> #include <cat/crypto.h> #include <cat/stduse.h> #define NUMSTR 4 #define NOPS 65536 #define NITER (128 * NOPS) vo...
github188/catlib
test/testpspawn.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <unistd.h> #include <cat/cat.h> #include <cat/pspawn.h> #include <cat/err.h> #define DBG fprintf(stderr, "DBG:%s:%d\n", __FILE__, __LINE__); extern char **environ; void test1(char *file) { struct pspawn *ps; st...
github188/catlib
src/sort.c
/* * sort.c -- Sorting routines. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/sort.h> #include <string.h> #define PTRSWAP 0 #define BULKLONG 1 #define BULKBYTE 2 #define SWAPTYPE(a, size) \ (((size) == sizeof(void *)) && \ (((byte_t *)(a) - (byte_t...
github188/catlib
src/socks5.c
/* * socks5.c -- SOCKS5 protocol routines. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/socks5.h> #if CAT_HAS_POSIX #include <stdlib.h> #include <string.h> #include <errno.h> #include <cat/pack.h> #include <cat/netinc.h> #include <cat/io.h> void socks5_sa_to_s5a(struc...
github188/catlib
src/pspawn.c
<filename>src/pspawn.c /* * pspawn.c -- intelligent (co-)process spawing API * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/cat.h> #if CAT_HAS_POSIX #define DBG fprintf(stderr, "DBG:%s:%d\n", __FILE__, __LINE__); #ifndef CAT_PS_MAXFDS #define CAT_PS_MAXFDS 1024 #endif #i...
github188/catlib
include/cat/dlist.h
<reponame>github188/catlib<gh_stars>1-10 /* * cat/dlist.h -- Delta list header file for catlib2 * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __CAT_DLIST_H #define __CAT_DLIST_H #include <cat/cat.h> #include <cat/list.h> #include <cat/time.h> #if defined(CAT_USE_INLINE) && CAT...
github188/catlib
test/testpack.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <string.h> #include <assert.h> #include <cat/pack.h> #include <cat/raw.h> int main(int argc, char *argv[]) { unsigned char buffer[5000]; struct raw r1, r2; char c = -1; unsigned char uc = 1; short s = -2...
github188/catlib
include/cat/uevent.h
/* * uevent.h -- UNIX event dispatch routines. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __cat_uevent_h #define __cat_uevent_h #include <cat/cat.h> #if CAT_HAS_POSIX #include <cat/mem.h> #include <cat/list.h> #include <cat/dlist.h> #include <cat/avl.h> #include <cat/cb.h> #...
github188/catlib
test/teststr.c
<filename>test/teststr.c<gh_stars>1-10 /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/str.h> #include <cat/err.h> #include <cat/stduse.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> int allrandom = 0; void print_raw_hex(void *dprm, size_t l...
github188/catlib
include/cat/net.h
/* * cat/net.h -- Network functions * * <NAME> * * Copyright 1999-2012 -- see accompanying license * */ #ifndef __cat_net_h #define __cat_net_h #include <cat/cat.h> #if CAT_HAS_POSIX #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #define SA struct sockaddr ...
github188/catlib
include/cat/bitset.h
/* * bitset.h -- Bitmap routines * * by <NAME> * * Copyright 2003-2017 -- See accompanying license * */ #ifndef __bitset_h #define __bitset_h #include <cat/cat.h> #if defined(CAT_USE_INLINE) && CAT_USE_INLINE #define DECL static inline #define CAT_BITSET_DO_DECL 1 #else /* CAT_USE_INLINE */ #define DECL #endi...
github188/catlib
src/stdcsv.c
/* * stdcsv.c -- nicer way to interface with CSV files built on csv.c * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/cat.h> #if CAT_HAS_POSIX #include <cat/stdcsv.h> #include <cat/stduse.h> #include <cat/grow.h> #include <string.h> #include <limits.h> #include <stdio.h> #i...
github188/catlib
attic/mem2.c
<gh_stars>1-10 /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/cat.h> #include <cat/mem.h> #include <cat/mem2.h> #if defined(CAT_USE_STDLIB) && CAT_USE_STDLIB #include <string.h> #else #include <cat/catstdlib.h> #endif static struct hnode *nf_htnew(void *key, void *data, un...
github188/catlib
test/testudpc.c
<reponame>github188/catlib<filename>test/testudpc.c /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <cat/err.h> #include <cat/net.h> int main(int argc, ch...
github188/catlib
attic/testreplace.c
<filename>attic/testreplace.c /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <stdlib.h> #include <cat/regex.h> void hurl() { printf("usage: testreplace search pattern replace\n"); exit(-1); } int main(int argc, char *argv[]) { char *new; if ( argc...
github188/catlib
include/cat/grow.h
/* * grow.h -- Routines to grow dynamically allocated memory sensibly. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __grow_h #define __grow_h #include <cat/cat.h> #include <cat/mem.h> #ifndef CAT_MAXGROW #define CAT_MAXGROW ((size_t)~0) #endif #ifndef CAT_MINGROW #define CAT_...
github188/catlib
test/testoptparse.c
<reponame>github188/catlib<filename>test/testoptparse.c /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/optparse.h> #include <cat/err.h> #include <stdio.h> #include <ctype.h> struct clopt g_optarr[] = { CLOPT_INIT(CLOPT_NOARG, 'a', "--opt-a", "option A (no arg)"), CLOPT_IN...
github188/catlib
include/cat/catstr.h
/* * catstr.h -- application level strings * * by <NAME> * * Copyright 2007-2012 -- See accompanying license * */ #ifndef __cat_catstr_h #define __cat_catstr_h #include <cat/cat.h> #include <cat/mem.h> #include <stdio.h> struct catstr { size_t cs_size; size_t cs_dlen; char cs_dynamic; char * cs_data...
github188/catlib
src/catlibc.c
/* * catlibc.c -- local implementation of standard libc functions. * * by <NAME> * * Copyright 2003-2014 See accompanying license * */ #include <cat/cat.h> #include <cat/catlibc.h> /* We use several functions even if we don't use the standard library */ #if !CAT_USE_STDLIB #include <stdarg.h> #include <limits....
github188/catlib
src/graph.c
/* * graph.c -- generic graph data structure representation. * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #include <cat/graph.h> #define CAT_GRAPH_INIT_EDGE_LEN 16 static void del_edge_help(struct gr_edge *edge, struct gr_node *node, int fromout); static int add_edge_help(st...
github188/catlib
src/stdclio.c
/* * stdclio.c -- standard IO implementation of emtter API. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/cat.h> #include <cat/stdclio.h> #include <stdio.h> int file_emit_func(struct emitter *em, const void *buf, size_t len) { struct file_emitter *fe = (struct file_emitt...
github188/catlib
src/peg.c
<filename>src/peg.c #include <cat/cat.h> #include <cat/aux.h> #include <cat/str.h> #include <cat/peg.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <ctype.h> /* * This is the PEG grammar format in PEG format: * * # Hierarchical syntax * Grammar <- Spacing Definition+ EndOfFile * Definitio...
github188/catlib
src/splay.c
<filename>src/splay.c /* * splay.c -- Splay tree implementation * * by <NAME> * * Copyright 2006-2012 See accompanying license * */ #undef CAT_USE_INLINE #undef CAT_SPLAY_DO_DECL #define CAT_USE_INLINE 0 #define CAT_SP_DO_DECL 1 #include <cat/splay.h>
github188/catlib
attic/lcut.h
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ void l_cut(struct list *first, struct list *last, struct list *out) { struct list *before, *after; Assert(first); Assert(last); Assert(out); before = first->prev; after = last->next; out->next = first; out->prev = ...
github188/catlib
include/cat/peg.h
#ifndef __peg_h #define __peg_h #include <cat/cat.h> #include <stdio.h> struct peg_node; struct peg_grammar; typedef int (*peg_action_f)(int, struct raw *, void *); struct peg_node { int pn_type; struct raw pn_str; int pn_next; int pn_subnode; uint pn_line; ushort pn_status; uchar pn_flag1; uchar pn_flag2; ...
github188/catlib
src/emit_format.c
<gh_stars>1-10 /* * emit_format.c -- formatted output through emit API. * * by <NAME> * * Copyright 2003-2014 See accompanying license * */ #include <stdlib.h> #include <ctype.h> #include <string.h> #include <stdarg.h> #include <limits.h> #include <cat/cat.h> #include <cat/aux.h> #include <cat/emit.h> #include...
github188/catlib
src/pcache.c
<filename>src/pcache.c /* * pcache.c -- Pool cache for fast allocation. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/pcache.h> void pc_init(struct pcache *pc, size_t asiz, size_t pgsiz, uint hiwat, uint maxpools, struct memmgr *mm) { abort_unless(pc); abort_unles...
github188/catlib
test/testtcps.c
/* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <cat/err.h> #include <cat/net.h> #include <cat/io.h> int main(int argc, char *argv[]) { int lfd, fd, n=1; struct sockaddr_s...
github188/catlib
include/cat/pspawn.h
/* * spawn.h -- Co-process spawning and management. * * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #ifndef __spawn_h #define __spawn_h #include <cat/cat.h> #ifdef CAT_HAS_POSIX #include <stdio.h> #include <signal.h> #include <sys/types.h> #include <cat/list.h> /* rules: - if type is '...
github188/catlib
src/raw.c
<filename>src/raw.c /* * raw.c -- raw data blob manipulation functions * * by <NAME> * * Copyright 2004-2012 -- See accompanying license * */ #include <cat/cat.h> #include <cat/raw.h> int raw_cmp(void *r1p, void *r2p) { int rv = 0; size_t len; struct raw *r1 = r1p, *r2 = r2p; byte_t *p1, *p2; abort_unle...
github188/catlib
include/cat/catlibc.h
/* * catlibc.h -- local implementation of standard libc functions. * * by <NAME> * * Copyright 2003-2014 See accompanying license * */ #ifndef __cat_catlibc_h #define __cat_catlibc_h #include <cat/cat.h> struct catlibc_cfg { ulong *heap_base; ulong heap_sz; char *stdin_buf; ulong stdin_bufsz; char *stdo...
github188/catlib
test/testgraph.c
<reponame>github188/catlib /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cat/graph.h> #include <cat/str.h> #include <cat/stduse.h> #include <cat/shell.h> int gnew(struct shell_env *env, int na, char *args[], struct she...
github188/catlib
test/testsort.c
<filename>test/testsort.c /* * by <NAME> * * Copyright 2003-2012 -- See accompanying license * */ #include <cat/sort.h> #include <cat/time.h> #include <cat/aux.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* #define ASIZE 256 */ #define ASIZE 10000 int arr1[ASIZE], arr2[ASIZE], all[ASIZE]; unsign...
github188/catlib
src/cb.c
/* * cb.c -- Event dispatch * * by <NAME> * * Copyright 2003-2012 See accompanying license * */ #include <cat/cb.h> void cb_init(struct callback *cb, callback_f f, void *ctx) { abort_unless(cb); abort_unless(f); l_init(&cb->entry); cb->ctx = ctx; cb->func = f; } int cb_call(struct callback *cb, void *...