* acl1Tiny -(by [[K]], 2024.09.02) ** (0) -2024年に[[K]]が使う定番のライブラリをまとめたものです。 ** (1) ver.1.01 [2024.09.13] (34行) ** (1) ver.1.10 [2024.09.20] (42行) -このライブラリでは、関数名やマクロ名をできるだけaかAで始めるように統一しています。 -こうすれば、実際の開発ではaやAから始まる名前を使わないようにすることで、名前の衝突を回避できます。 -AStatic: 関数宣言の前に付けます。関数にstatic属性がつけば、「利用されない関数は消してもよい」(=他からリンクされることに備えなくてよい)とコンパイラに知らせることができます。これで宣言はしたが利用されない関数がバイナリに残ることを防ぎます。しかし一方で書いた関数が確実に残っていてほしい場合もあり(主にデバッグ時)、その場合はAStaticを;などに#defineしてコンパイルします。 -AInlineStatic: これも存在意義はAStaticと同じです。 -AClass: structとtypedefを一緒にやってくれるマクロです。 -AInt: intptr_tの別名です。使用頻度が高いのに8文字なのは長いと思って、4文字のAIntをあてました。 -標準関数のinclude: 毎回includeを書くのが面倒だったので、よく使うものを一通り入れました。 -ACat()~ACat8(): トークン結合マクロです。たまに使いたくなるので入れています。 #if (!defined(AStatic)) #define AStatic static #endif #if (!defined(AInlineStatic)) #define AInlineStatic inline static #endif #define AClass(nam) typedef struct nam ## _ nam; struct nam ## _ #if (!defined(ADbgLv)) #define ADbgLv 0 #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdarg.h> #include <stdint.h> #include <math.h> #include <time.h> #include <stddef.h> #include "aErrExit.c" typedef intptr_t AInt; #define ACat_Helper(x, y) x##y #define ACat(x, y) ACat_Helper(x, y) #define ACat3(x, y, z) ACat(ACat(x, y), z) #define ACat4(a, b, c, d) ACat(ACat(a, b), ACat(c, d)) #define ACat5(a, b, c, d, e) ACat(ACat3(a, b, c), ACat(d, e)) #define ACat6(a, b, c, d, e, f) ACat(ACat3(a, b, c), ACat3(d, e, f)) #define ACat7(a, b, c, d, e, f, g) ACat(ACat4(a, b, c, d), ACat3(e, f, g)) #define ACat8(a, b, c, d, e, f, g, h) ACat(ACat4(a, b, c, d), ACat4(e, f, g, h)) #include "aErrExit.c" #include "AMemMan.c" #include "AMap11.c" #include "AMapSim11.c" #include "AMemFile.c" #include "aOsFunc.c" #include "aFnv.c" #include "aXorShift32.c"