[Ecls-list] Upcoming

Juan Jose Garcia-Ripoll juanjose.garciaripoll at gmail.com
Wed Jul 3 15:10:31 UTC 2013


On Tue, Jul 2, 2013 at 12:16 PM, Juan Jose Garcia-Ripoll <
juanjose.garciaripoll at gmail.com> wrote:

> * Declaration of C variables
>
> (let ((a (cos 1.0))
>   (declare (:double a))
>   ...)
>
> * Direct references to C variables
>
> (ffi:c-inline (a b) (:double :double) :void
>    "#0 = cos(#1)")
>
> * Embed imperative lisp in C (syntax not yet decided)
>
>
Already working (beware of the dangers of improper use!)

> (disassemble '(lambda (i)
  (declare (optimize (speed 3) (safety 0)))
  (let* ((limit i)
   (iterator 0))
    (declare (:int limit iterator))
    (ffi:c-progn (limit iterator)
      "for (#1 = 0; #1 < #0; #1++) {"
      (print iterator)
      "}"))))

;;; Compiling (DEFUN C::GAZONK ...).
;;; Emitting code for C::GAZONK.
/* function definition for GAZONK                                */
/* optimize speed 3, debug 0, space 0, safety 0                  */
static cl_object L1c__gazonk(cl_object v1i)
{
 const cl_env_ptr cl_env_copy = ecl_process_env();
 cl_object value0;
TTL:
 {
  int v2limit;
  int v3iterator;
  v2limit = ecl_fixnum(v1i);
  v3iterator = (int)(0);
  for (v3iterator = 0; v3iterator < v2limit; v3iterator++) {
  ecl_print(ecl_make_int(v3iterator),ECL_NIL);
  }
  value0 = ECL_NIL;
  cl_env_copy->nvalues = 1;
  return value0;
 }
}



-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130703/9430a619/attachment.html>


More information about the ecl-devel mailing list