libk  Diff

Differences From Artifact [694c1d32cc]:

To Artifact [2981fff8c9]:


     1      1   dnl kcore/def.h.m → <k/def.h>
     2      2   dnl ~ lexi hale <lexi@hale.su>
     3      3   dnl this file gathers information on the environment it's
     4      4   dnl being compiled in, setting macros that other headers
     5      5   dnl need. it will be emitted as <k/def.h>.
     6         -dnl vim: ft=c
            6  +dnl vim: ft=m4
     7      7   #ifndef KIdef
     8      8   #define KIdef
     9         -define(`def',`#define $1 $2')
            9  +define(`_atom',0)dnl
           10  +define(`def',`#define $1 $2')dnl
           11  +define(`defatom',`def($1,$2$3)')dnl
           12  +define(`newatom',`def($1,_atom)
           13  +	define(`_atom',incr(_atom))')dnl
    10     14   
    11     15   ifdef(`atom_target_bits',`
    12     16   	define(`target',`atom_target_arch.atom_target_os.atom_target_bits')
    13     17   	def(KVbits,atom_target_bits)',`
    14     18   	define(`target',atom_target_arch.atom_target_os)')
    15     19   
    16         -def(KVtarget,target)
    17         -def(KVos,atom_target_os)
    18         -def(KVarch,atom_target_arch)
           20  +newatom(KA_os_lin)dnl
           21  +newatom(KA_os_fbsd)dnl
           22  +newatom(KA_os_obsd)dnl
           23  +newatom(KA_os_nbsd)dnl
           24  +newatom(KA_os_dar)dnl
           25  +newatom(KA_os_osx)dnl
           26  +newatom(KA_os_and)dnl
           27  +newatom(KA_os_hai)dnl
           28  +newatom(KA_os_win)dnl
           29  +
           30  +newatom(KA_arch_x86)dnl
           31  +newatom(KA_arch_arm)dnl
           32  +newatom(KA_arch_ppc)dnl
           33  +newatom(KA_arch_mips)dnl
           34  +newatom(KA_arch_itan)dnl
           35  +
           36  +defatom(KVos,KA_os_,atom_target_os)
           37  +defatom(KVarch,KA_arch_,atom_target_arch)
    19     38   
    20     39   ifelse(target_unix,`yes',
    21     40   		`def(`KFenv_unix',)
    22     41   		def(`KFenv_posix',)',`
    23     42   		ifelse(target_posix,`yes',
    24     43   			`def(KFenv_posix)')')
    25     44   
    26     45   #define Kpragma(p) _Pragma(#p)
    27     46   #if defined(__GNUC__) || defined(__clang__)
    28     47   #   define Kerror(msg) Kpragma(GCC error #msg) 
    29     48   #else
    30     49   #   define Kerror(msg) Kpragma(message #msg)
    31     50   #endif
    32         -#define Knoimpl(fn) Kerror(no implementation of fn for platform [target])
           51  +def(`Knoimpl(fn)', Kerror(no implementation of fn for platform target))
    33     52   
    34     53   #endif