mplisp

miniPicoLisp with FFI and modules for Buddy BDD library, OpenGL, Gtk and GMP
git clone https://logand.com/git/mplisp.git/
Log | Files | Refs

buddy.ffi (4951B)


      1 # -*- picolisp -*-
      2 
      3 (load "@src/mod/ffi.l")
      4 
      5 (module 'buddy)
      6 #(module 'buddy '((X) (pack "buddy:" (cddddr (chop X)))))
      7 
      8 (include "bdd.h")
      9 
     10 (put 'cwrap 'BDD (get 'cwrap 'int))
     11 (put 'cwrap 'bddPair* (get 'cwrap 'void*))
     12 
     13 (put 'cbody 'BDD (get 'cbody 'int))
     14 (put 'cbody 'bddPair* (get 'cbody 'void*))
     15 
     16 #typedef void (*bddinthandler)(int);
     17 #typedef void (*bddgbchandler)(int,bddGbcStat*);
     18 #typedef void (*bdd2inthandler)(int,int);
     19 #typedef int  (*bddsizehandler)(void);
     20 #typedef void (*bddfilehandler)(FILE *, int);
     21 #typedef void (*bddallsathandler)(char*, int);
     22    
     23 #extern bddinthandler  bdd_error_hook(bddinthandler);
     24 #extern bddgbchandler  bdd_gbc_hook(bddgbchandler);
     25 #extern bdd2inthandler bdd_resize_hook(bdd2inthandler);
     26 #extern bddinthandler  bdd_reorder_hook(bddinthandler);
     27 #extern bddfilehandler bdd_file_hook(bddfilehandler);
     28 
     29 (cfun int      bdd_init int int)
     30 (cfun void     bdd_done)
     31 (cfun int      bdd_setvarnum int)
     32 (cfun int      bdd_extvarnum int)
     33 (cfun int      bdd_isrunning)
     34 (cfun int      bdd_setmaxnodenum int)
     35 (cfun int      bdd_setmaxincrease int)
     36 (cfun int      bdd_setminfreenodes int)
     37 (cfun int      bdd_getnodenum)
     38 (cfun int      bdd_getallocnum)
     39 (cfun cstr     bdd_versionstr)
     40 (cfun int      bdd_versionnum)
     41 #(cfun void     bdd_stats(bddStat*)
     42 #(cfun void     bdd_cachestats(bddCacheStat*)
     43 #(cfun void     bdd_fprintstat(FILE*)
     44 (cfun void     bdd_printstat)
     45 #(cfun void     bdd_default_gbchandler int bddGbcStat*)
     46 (cfun void     bdd_default_errhandler int)
     47 (cfun cstr     bdd_errstring int)
     48 (cfun void     bdd_clear_error)
     49 (cfun int      bdd_true)
     50 (cfun int      bdd_false)
     51 (cfun int      bdd_varnum)
     52 (cfun BDD      bdd_ithvar int)
     53 (cfun BDD      bdd_nithvar int)
     54 (cfun int      bdd_var BDD)
     55 (cfun BDD      bdd_low BDD)
     56 (cfun BDD      bdd_high BDD)
     57 (cfun BDD      bdd_addref BDD)
     58 (cfun BDD      bdd_delref BDD)
     59 (cfun void     bdd_gbc)
     60 #(cfun int      bdd_scanset BDD int** int*)
     61 #(cfun BDD      bdd_makeset int* int)
     62 (cfun bddPair* bdd_newpair)
     63 (cfun int      bdd_setpair bddPair* int int)
     64 #(cfun int      bdd_setpairs(bddPair* int* int* int)
     65 (cfun int      bdd_setbddpair bddPair* int BDD)
     66 #(cfun int      bdd_setbddpairs(bddPair* int* BDD* int)
     67 (cfun void     bdd_resetpair bddPair*)
     68 (cfun void     bdd_freepair bddPair*)
     69 
     70 (cfun int      bdd_setcacheratio int)
     71 #(cfun BDD      bdd_buildcube int int BDD*)
     72 #(cfun BDD      bdd_ibuildcube int int int*)
     73 (cfun BDD      bdd_not BDD)
     74 (cfun BDD      bdd_apply BDD BDD int)
     75 (cfun BDD      bdd_and BDD BDD)
     76 (cfun BDD      bdd_or BDD BDD)
     77 (cfun BDD      bdd_xor BDD BDD)
     78 (cfun BDD      bdd_imp BDD BDD)
     79 (cfun BDD      bdd_biimp BDD BDD)
     80 (cfun BDD      bdd_ite BDD BDD BDD)
     81 (cfun BDD      bdd_restrict BDD BDD)
     82 (cfun BDD      bdd_constrain BDD BDD)
     83 (cfun BDD      bdd_replace BDD bddPair*)
     84 (cfun BDD      bdd_compose BDD BDD BDD)
     85 (cfun BDD      bdd_veccompose BDD bddPair*)
     86 (cfun BDD      bdd_simplify BDD BDD)
     87 (cfun BDD      bdd_exist BDD BDD)
     88 (cfun BDD      bdd_forall BDD BDD)
     89 (cfun BDD      bdd_unique BDD BDD)
     90 (cfun BDD      bdd_appex BDD BDD int BDD)
     91 (cfun BDD      bdd_appall BDD BDD int BDD)
     92 (cfun BDD      bdd_appuni BDD BDD int BDD)
     93 (cfun BDD      bdd_support BDD)
     94 (cfun BDD      bdd_satone BDD)
     95 (cfun BDD      bdd_satoneset BDD BDD BDD)
     96 (cfun BDD      bdd_fullsatone BDD)
     97 #(cfun void     bdd_allsat BDD r bddallsathandler handler)
     98 #(cfun double   bdd_satcount BDD)
     99 #(cfun double   bdd_satcountset BDD BDD)
    100 #(cfun double   bdd_satcountln BDD)
    101 #(cfun double   bdd_satcountlnset BDD BDD)
    102 (cfun int      bdd_nodecount BDD)
    103 #(cfun int      bdd_anodecount BDD* int)
    104 #(cfun int*     bdd_varprofile BDD)
    105 #(cfun double   bdd_pathcount BDD)
    106 
    107 (cfun void     bdd_printall)
    108 #(cfun void     bdd_fprintall(FILE*)
    109 #(cfun void     bdd_fprinttable(FILE*, BDD)
    110 (cfun void     bdd_printtable BDD)
    111 #(cfun void     bdd_fprintset(FILE*, BDD)
    112 (cfun void     bdd_printset BDD)
    113 (cfun int      bdd_fnprintdot cstr BDD)
    114 #(cfun void     bdd_fprintdot(FILE*, BDD)
    115 (cfun void     bdd_printdot BDD)
    116 (cfun int      bdd_fnsave cstr BDD)
    117 #(cfun int      bdd_save(FILE*, BDD)
    118 #(cfun int      bdd_fnload cstr BDD*)
    119 #(cfun int      bdd_load(FILE*ifile, BDD*)
    120 
    121 (cfun int      bdd_swapvar int int)
    122 (cfun void     bdd_default_reohandler int)
    123 (cfun void     bdd_reorder int)
    124 (cfun int      bdd_reorder_gain)
    125 #cfun bddsizehandler bdd_reorder_probe(bddsizehandler)
    126 (cfun void     bdd_clrvarblocks)
    127 (cfun int      bdd_addvarblock BDD int)
    128 (cfun int      bdd_intaddvarblock int int int)
    129 (cfun void     bdd_varblockall)
    130 #cfun bddfilehandler bdd_blockfile_hook(bddfilehandler)
    131 (cfun int      bdd_autoreorder int)
    132 (cfun int      bdd_autoreorder_times int int)
    133 (cfun int      bdd_var2level int)
    134 (cfun int      bdd_level2var int)
    135 (cfun int      bdd_getreorder_times)
    136 (cfun int      bdd_getreorder_method)
    137 (cfun void     bdd_enable_reorder)
    138 (cfun void     bdd_disable_reorder)
    139 (cfun int      bdd_reorder_verbose int)
    140 #(cfun void     bdd_setvarorder int*)
    141 (cfun void     bdd_printorder)
    142 #(cfun void     bdd_fprintorder(FILE*)