├── .gitignore ├── LICENSE ├── README.md └── src └── k.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 /dev/arina 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # altc 2 | scaffolding for my c projects 3 | -------------------------------------------------------------------------------- /src/k.h: -------------------------------------------------------------------------------- 1 | //! \file k.h \brief less is more 2 | #pragma once 3 | 4 | #define _GNU_SOURCE 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | //! arthur way 11 | typedef char C; 12 | typedef char* S; 13 | typedef int I; 14 | typedef short H; 15 | typedef void V; 16 | typedef float E; 17 | typedef double F; 18 | typedef long J; 19 | typedef unsigned long UJ; 20 | typedef unsigned int UI; 21 | typedef unsigned short UH; 22 | typedef unsigned char G; 23 | 24 | //! no stinking loops 25 | #define DO(n,x) {UJ i=0,_i=(n);for(;i<_i;++i){x;}} 26 | #define W(x) while((x)) 27 | 28 | //! unclutter 29 | #define R return 30 | #define Z static 31 | #define O printf 32 | #define PC putchar 33 | #define SZ sizeof 34 | #define ZV Z V 35 | #define ZI Z I 36 | #define ZC Z C 37 | #define ZH Z H 38 | #define ZS Z S 39 | #define ZE Z E 40 | #define ZF Z F 41 | #define ZJ Z J 42 | #define R0 R 0 43 | #define R1 R 1 44 | 45 | //! safer switch 46 | #define SW switch 47 | #define CD default 48 | #define CS(n,x) case n:;x;break; 49 | 50 | //! fail fast 51 | #define P(x,y) {if(x)R(y);} //< panic 52 | #define X(x,y,z) {if(x){(y);R(z);}} //< clean+panic 53 | 54 | //! easy math 55 | #define ABS(x) (((x)>0)?(x):-(x)) 56 | #define MIN(x,y) ((y)>(x)?(x):(y)) 57 | #define MAX(x,y) ((y)>(x)?(y):(x)) 58 | #define IN(l,x,r) ((l)<=(x)&&(x)<=(r)) 59 | 60 | //! usual suspects 61 | #define scnt(x) (UJ)strlen((S)(x)) 62 | #define scmp(x,y) strcmp((S)(x),(S)(y)) 63 | #define sstr(h,n) strstr((S)(h),(S)(n)) 64 | #define schr(h,n) (S)strchr((S)(h),n) 65 | #define rchr(h,n) (S)strrchr((S)(h),n) 66 | #define mcpy(d,s,n) memcpy((d),(s),n) 67 | #define mcmp(d,s,n) memcmp((d),(s),n) 68 | #define scpy(d,s,n) (S)mcpy((S)d,(S)s,1+MIN(scnt((S)s),n)) 69 | #define lcse(s,n) {DO(n,s[i]=tolower(s[i]))} 70 | 71 | //:~ 72 | --------------------------------------------------------------------------------