Ticket #88: cairo.diff

File cairo.diff, 3.6 KB (added by Christian Kellermann, 14 years ago)
  • test-cairo.scm

     
    22; Michael Bridgen <mikeb@squaremobius.net>
    33; Tony Garnock-Jones <tonyg@kcbbs.gen.nz>
    44
    5 (require 'posix)
    6 (require 'sdl)
    7 (require 'cairo)
     5(use posix)
     6(use sdl)
     7(use cairo)
     8(import chicken scheme foreign)
    89
     10(declare
     11 (foreign-declare "#include <SDL.h>\n")
     12 (run-time-macros)
     13)
     14(foreign-code "SDL_Init(SDL_INIT_EVERYTHING);")
     15
     16
     17
    918(sdl-init SDL_INIT_EVERYTHING)
    1019
    1120(define maxx 640)
  • cairo.setup

     
    1 (run (make extension))
    2 (install-extension 'cairo '("cairo.so"))
     1(let ((pkg-cflags (with-input-from-pipe "pkg-config --cflags cairo" read-line))
     2      (pkg-lflags (with-input-from-pipe "pkg-config --libs cairo" read-line)))
     3      (compile -s -O2 cairo.scm -j cairo -lcairo ,pkg-cflags ,pkg-lflags)
     4      (compile -c -O2 cairo.scm -unit cairo ,pkg-cflags ,pkg-lflags)
     5      (compile -s -O2 cairo.import.scm ,pkg-cflags ,pkg-lflags))
     6
     7(install-extension 'cairo '("cairo.so" "cairo.import.so" "cairo.o") '(version "v0.1.3-alpha"))
     8
  • cairo.scm

     
    2020
    2121; --------------------------------------------------
    2222
    23 (declare
    24  (usual-integrations)
     23(module cairo
     24 *
     25 (import chicken scheme foreign)
    2526
     27 (use srfi-1)
     28 (use srfi-4)
     29 (use srfi-13)
     30 (use lolevel)
     31
     32 (import-for-syntax srfi-1)
     33 (import-for-syntax srfi-13)
     34
    2635 (foreign-declare #<<EOF
    2736
    2837#include "cairo.h"
    2938
    3039EOF
    31 ))
     40)
    3241
    33 (require 'srfi-1)
    34 (require 'srfi-13)
    35 (require 'lolevel)
    36 
    37 (require-for-syntax 'srfi-1)
    38 (require-for-syntax 'srfi-13)
    39 
    4042;; Define a list of DEFINEs or enums at once.
    41 (define-macro (--cairo-flags . strs)
    42   `(begin
    43      ,@(append-map (lambda (str)
    44                      (let* ((sym (string->symbol str))
    45                             (psym (string->symbol (string-append "-" (symbol->string sym)))))
    46                        `((define-foreign-variable ,psym unsigned-integer ,str)
    47                          (define ,sym ,psym))))
    48                    strs)))
     43(define-syntax --cairo-flags
     44  (lambda (e r c)
     45    (let ((strs (cdr e)))
     46      `(begin
     47         ,@(append-map (lambda (str)
     48                         (let* ((sym (string->symbol str))
     49                                (psym (string->symbol (string-append "-" (symbol->string sym)))))
     50                           `((,(r 'define-foreign-variable) ,psym unsigned-integer ,str)
     51                             (,(r 'define) ,sym ,psym))))
     52                       strs)))))
    4953
    5054(define *cairo-egg-version* '(0 1 3 alpha))
    5155
     
    299303(define-record cairo-text-extents-type buffer)
    300304(let ((maker make-cairo-text-extents-type))
    301305  (set! make-cairo-text-extents-type
    302     (lambda () (maker (make-byte-vector sizeof-cairo-text-extents)))))
     306    (lambda () (maker (make-u8vector sizeof-cairo-text-extents)))))
    303307
    304308(define-record-printer (cairo-text-extents-type te out)
    305309  (for-each (lambda (x) (display x out)
     
    337341(define-record cairo-font-extents-type buffer)
    338342(let ((maker make-cairo-font-extents-type))
    339343  (set! make-cairo-font-extents-type
    340     (lambda () (maker (make-byte-vector sizeof-cairo-font-extents)))))
     344    (lambda () (maker (make-u8vector sizeof-cairo-font-extents)))))
    341345
    342346(define-record-printer (cairo-font-extents-type e out)
    343347  (for-each (lambda (x) (display x out)
     
    595599                                            "cairo_surface_flush"
    596600                                            cairo_surface_t
    597601                                            ))
     602)