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

gmp.ffi (5717B)


      1 # -*- picolisp -*-
      2 
      3 (load "@src/mod/ffi.l")
      4 
      5 (module 'gmp)
      6 
      7 (include "gmp.h")
      8 
      9 (put 'cwrap 'mpz_ptr (get 'cwrap 'void*))
     10 
     11 (put 'cbody 'mpz_ptr (get 'cbody 'void*))
     12 
     13 (cfun void mpz_init mpz_ptr)
     14 (cfun void mpz_init2 mpz_ptr ulong)
     15 (cfun void mpz_clear mpz_ptr)
     16 (cfun void mpz_realloc2 mpz_ptr ulong)
     17 (cfun void mpz_set mpz_ptr mpz_ptr)
     18 (cfun void mpz_set_ui mpz_ptr ulong)
     19 (cfun void mpz_set_si mpz_ptr long)
     20 #(cfun void mpz_set_d mpz_ptr double)
     21 #(cfun void mpz_set_q mpz_ptr mpq_ptr)
     22 #(cfun void mpz_set_f mpz_ptr mpf_ptr)
     23 #(cfun int mpz_set_str mpz_ptr char* int)
     24 (cfun void mpz_swap mpz_ptr mpz_ptr)
     25 (cfun void mpz_init_set mpz_ptr mpz_ptr)
     26 (cfun void mpz_init_set_ui mpz_ptr ulong)
     27 (cfun void mpz_init_set_si mpz_ptr long)
     28 #(cfun void mpz_init_set_d mpz_ptr double)
     29 #(cfun int mpz_init_set_str mpz_ptr char* int)
     30 (cfun ulong mpz_get_ui mpz_ptr)
     31 (cfun long mpz_get_si mpz_ptr)
     32 #(cfun double mpz_get_d mpz_ptr)
     33 #double mpz_get_d_2exp (signed long int *exp, mpz_ptr op )
     34 #(cfun char* mpz_get_str char* int mpz_ptr)
     35 (cfun void mpz_add mpz_ptr mpz_ptr mpz_ptr)
     36 (cfun void mpz_add_ui mpz_ptr mpz_ptr ulong)
     37 (cfun void mpz_sub mpz_ptr mpz_ptr mpz_ptr)
     38 (cfun void mpz_sub_ui mpz_ptr mpz_ptr ulong)
     39 (cfun void mpz_ui_sub mpz_ptr ulong mpz_ptr)
     40 (cfun void mpz_mul mpz_ptr mpz_ptr mpz_ptr)
     41 (cfun void mpz_mul_si mpz_ptr mpz_ptr long)
     42 (cfun void mpz_mul_ui mpz_ptr mpz_ptr ulong)
     43 (cfun void mpz_addmul mpz_ptr mpz_ptr mpz_ptr)
     44 (cfun void mpz_addmul_ui mpz_ptr mpz_ptr ulong)
     45 (cfun void mpz_submul mpz_ptr mpz_ptr mpz_ptr)
     46 (cfun void mpz_submul_ui mpz_ptr mpz_ptr ulong)
     47 (cfun void mpz_mul_2exp mpz_ptr mpz_ptr ulong)
     48 (cfun void mpz_neg mpz_ptr mpz_ptr)
     49 (cfun void mpz_abs mpz_ptr mpz_ptr)
     50 #(cfun void mpz_cdiv_q (mpz_ptr q, mpz_ptr n, mpz_ptr d )
     51 (cfun void mpz_cdiv_r mpz_ptr mpz_ptr mpz_ptr)
     52 (cfun void mpz_cdiv_qr mpz_ptr mpz_ptr mpz_ptr mpz_ptr)
     53 (cfun ulong mpz_cdiv_q_ui mpz_ptr mpz_ptr ulong)
     54 (cfun ulong mpz_cdiv_r_ui mpz_ptr mpz_ptr ulong)
     55 (cfun ulong mpz_cdiv_qr_ui mpz_ptr mpz_ptr mpz_ptr ulong)
     56 (cfun ulong mpz_cdiv_ui mpz_ptr ulong)
     57 (cfun void mpz_cdiv_q_2exp mpz_ptr mpz_ptr ulong)
     58 (cfun void mpz_cdiv_r_2exp mpz_ptr mpz_ptr ulong)
     59 (cfun void mpz_fdiv_q mpz_ptr mpz_ptr mpz_ptr)
     60 (cfun void mpz_fdiv_r mpz_ptr mpz_ptr mpz_ptr)
     61 (cfun void mpz_fdiv_qr mpz_ptr mpz_ptr mpz_ptr mpz_ptr)
     62 (cfun ulong mpz_fdiv_q_ui mpz_ptr mpz_ptr ulong)
     63 (cfun ulong mpz_fdiv_r_ui mpz_ptr mpz_ptr ulong)
     64 (cfun ulong mpz_fdiv_qr_ui mpz_ptr mpz_ptr mpz_ptr ulong)
     65 (cfun ulong mpz_fdiv_ui mpz_ptr ulong)
     66 (cfun void mpz_fdiv_q_2exp mpz_ptr mpz_ptr ulong)
     67 (cfun void mpz_fdiv_r_2exp mpz_ptr mpz_ptr ulong)
     68 (cfun void mpz_tdiv_q mpz_ptr mpz_ptr mpz_ptr)
     69 (cfun void mpz_tdiv_r mpz_ptr mpz_ptr mpz_ptr)
     70 (cfun void mpz_tdiv_qr mpz_ptr mpz_ptr mpz_ptr mpz_ptr)
     71 (cfun ulong mpz_tdiv_q_ui mpz_ptr mpz_ptr ulong)
     72 (cfun ulong mpz_tdiv_r_ui mpz_ptr mpz_ptr ulong)
     73 (cfun ulong mpz_tdiv_qr_ui mpz_ptr mpz_ptr mpz_ptr ulong)
     74 (cfun ulong mpz_tdiv_ui mpz_ptr ulong)
     75 (cfun void mpz_tdiv_q_2exp mpz_ptr mpz_ptr ulong)
     76 (cfun void mpz_tdiv_r_2exp mpz_ptr mpz_ptr ulong)
     77 (cfun void mpz_mod mpz_ptr mpz_ptr mpz_ptr)
     78 (cfun ulong mpz_mod_ui mpz_ptr mpz_ptr ulong)
     79 (cfun void mpz_divexact mpz_ptr mpz_ptr mpz_ptr)
     80 (cfun void mpz_divexact_ui mpz_ptr mpz_ptr ulong)
     81 (cfun int mpz_divisible_p mpz_ptr mpz_ptr)
     82 (cfun int mpz_divisible_ui_p mpz_ptr ulong)
     83 (cfun int mpz_divisible_2exp_p mpz_ptr ulong)
     84 (cfun int mpz_congruent_p mpz_ptr mpz_ptr mpz_ptr)
     85 (cfun int mpz_congruent_ui_p mpz_ptr ulong ulong)
     86 (cfun int mpz_congruent_2exp_p mpz_ptr mpz_ptr ulong)
     87 (cfun void mpz_powm mpz_ptr mpz_ptr mpz_ptr mpz_ptr)
     88 (cfun void mpz_powm_ui mpz_ptr mpz_ptr ulong mpz_ptr)
     89 (cfun void mpz_pow_ui mpz_ptr mpz_ptr ulong)
     90 (cfun void mpz_ui_pow_ui mpz_ptr ulong ulong)
     91 (cfun int mpz_root mpz_ptr mpz_ptr ulong)
     92 (cfun void mpz_rootrem mpz_ptr mpz_ptr mpz_ptr ulong)
     93 (cfun void mpz_sqrt mpz_ptr mpz_ptr)
     94 (cfun void mpz_sqrtrem mpz_ptr mpz_ptr mpz_ptr)
     95 (cfun int mpz_perfect_power_p mpz_ptr)
     96 (cfun int mpz_perfect_square_p mpz_ptr)
     97 (cfun int mpz_probab_prime_p mpz_ptr int)
     98 (cfun void mpz_nextprime mpz_ptr mpz_ptr)
     99 (cfun void mpz_gcd mpz_ptr mpz_ptr mpz_ptr)
    100 (cfun ulong mpz_gcd_ui mpz_ptr mpz_ptr ulong)
    101 (cfun void mpz_gcdext mpz_ptr mpz_ptr mpz_ptr mpz_ptr mpz_ptr)
    102 (cfun void mpz_lcm mpz_ptr mpz_ptr mpz_ptr)
    103 (cfun void mpz_lcm_ui mpz_ptr mpz_ptr ulong)
    104 (cfun int mpz_invert mpz_ptr mpz_ptr mpz_ptr)
    105 (cfun int mpz_jacobi mpz_ptr mpz_ptr)
    106 (cfun int mpz_legendre mpz_ptr mpz_ptr)
    107 (cfun int mpz_kronecker mpz_ptr mpz_ptr)
    108 (cfun int mpz_kronecker_si mpz_ptr long)
    109 (cfun int mpz_kronecker_ui mpz_ptr ulong)
    110 (cfun int mpz_si_kronecker long mpz_ptr)
    111 (cfun int mpz_ui_kronecker ulong mpz_ptr)
    112 (cfun ulong mpz_remove mpz_ptr mpz_ptr mpz_ptr)
    113 (cfun void mpz_fac_ui mpz_ptr ulong)
    114 (cfun void mpz_bin_ui mpz_ptr mpz_ptr ulong)
    115 (cfun void mpz_bin_uiui mpz_ptr ulong ulong)
    116 (cfun void mpz_fib_ui mpz_ptr ulong)
    117 (cfun void mpz_fib2_ui mpz_ptr mpz_ptr ulong)
    118 (cfun void mpz_lucnum_ui mpz_ptr ulong)
    119 (cfun void mpz_lucnum2_ui mpz_ptr mpz_ptr ulong)
    120 (cfun int mpz_cmp mpz_ptr mpz_ptr)
    121 #(cfun int mpz_cmp_d mpz_ptr double)
    122 (cfun int mpz_cmp_si mpz_ptr long)
    123 (cfun int mpz_cmp_ui mpz_ptr ulong)
    124 (cfun int mpz_cmpabs mpz_ptr mpz_ptr)
    125 #(cfun int mpz_cmpabs_d mpz_ptr double)
    126 (cfun int mpz_cmpabs_ui mpz_ptr ulong)
    127 (cfun int mpz_sgn mpz_ptr)
    128 (cfun void mpz_and mpz_ptr mpz_ptr mpz_ptr)
    129 (cfun void mpz_ior mpz_ptr mpz_ptr mpz_ptr)
    130 (cfun void mpz_xor mpz_ptr mpz_ptr mpz_ptr)
    131 (cfun void mpz_com mpz_ptr mpz_ptr)
    132 (cfun ulong mpz_popcount mpz_ptr)
    133 (cfun ulong mpz_hamdist mpz_ptr mpz_ptr)
    134 (cfun ulong mpz_scan0 mpz_ptr ulong)
    135 (cfun ulong mpz_scan1 mpz_ptr ulong)
    136 (cfun void mpz_setbit mpz_ptr ulong)
    137 (cfun void mpz_clrbit mpz_ptr ulong)
    138 (cfun void mpz_combit mpz_ptr ulong)
    139 (cfun int mpz_tstbit mpz_ptr ulong)