File: gauche-gtkgl.c

package info (click to toggle)
gauche-gtk 0.6%2Bgit20160927-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,452 kB
  • sloc: ansic: 7,097; lisp: 5,659; sh: 2,829; makefile: 338
file content (63 lines) | stat: -rw-r--r-- 1,773 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 * gauche-gtkgl.h - Gauche+Gtkglarea extension
 *
 *  Copyright(C) 2002 by Shiro Kawai (shiro@acm.org)
 *
 *  Permission to use, copy, modify, distribute this software and
 *  accompanying documentation for any purpose is hereby granted,
 *  provided that existing copyright notices are retained in all
 *  copies and that this notice is included verbatim in all
 *  distributions.
 *  This software is provided as is, without express or implied
 *  warranty.  In no circumstances the author(s) shall be liable
 *  for any damages arising out of the use of this software.
 *
 *  $Id: gauche-gtkgl.c,v 1.4 2007/01/13 01:36:30 maruska Exp $
 */

#include "gauche-gtkgl.h"

#ifdef HAVE_GTKGL

/*====================================================================
 * Basic data converters
 */

int *Scm_ListToGdkGLAttribList(ScmObj attrib)
{
    int len = Scm_Length(attrib), *alist, i;
    ScmObj ap;
    if (len < 0 || (len % 2) != 0) {
        Scm_Error("attribute list must have even number of elements, but got %S",
                  attrib);
    }
    alist = SCM_NEW_ATOMIC2(int*, sizeof(int)*(len+1));
    i = 0;
    SCM_FOR_EACH(ap, attrib) {
        if (!SCM_EXACTP(SCM_CAR(ap))) {
            Scm_Error("integer expected in attibute list, but got %S",
                      SCM_CAR(ap));
        }
        alist[i++] = Scm_GetInteger(SCM_CAR(ap));
    }
    alist[i] = GDK_GL_ATTRIB_LIST_NONE;
    return alist;
}

/*
 * Initialization
 */

extern void Scm_Init_gdkgllib(ScmModule *);
extern void Scm_Init_gtkgllib(ScmModule *);

void Scm_Init_gauche_gtkgl(void)
{
    ScmModule *mod;
    SCM_INIT_EXTENSION(gauche_gtkgl);
    mod = SCM_MODULE(SCM_FIND_MODULE("gtk.gtkgl", TRUE));
    Scm_Init_gdkgllib(mod);
    Scm_Init_gtkgllib(mod);
}

#endif /*HAVE_GTKGL*/