示例#1
0
文件: izc.c 项目: kenhys/gauche-izc
void Scm_Init_gauche__izc(void)
{
    ScmModule *mod;

    /* Register this DSO to Gauche */
    SCM_INIT_EXTENSION(izc);

    /* Create the module if it doesn't exist yet. */
    mod = SCM_MODULE(SCM_FIND_MODULE("izc", TRUE));

  /* Create the foreign pointer class <mqueue-cpp>.
       The flag SCM_FOREIGN_POINTER_KEEP_IDENTITY makes Gauche to keep
       one-to-one mapping between the foreign object pointer (MQueue*)
       and its wrapping ScmObj.  With this flag, you can assume that
       when mqueue_cleanup is called, no other ScmForeignPointer object
       is pointing to the same MQueue*, thus you can delete it safely. */
    CSintClass =
        Scm_MakeForeignPointerClass(mod, "<csint>",
                                    csint_print,
                                    csint_cleanup,
                                    SCM_FOREIGN_POINTER_KEEP_IDENTITY|SCM_FOREIGN_POINTER_MAP_NULL);

    CSintArrayClass =
        Scm_MakeForeignPointerClass(mod, "<csint-array>",
                                    csint_array_print,
                                    csint_array_cleanup,
                                    SCM_FOREIGN_POINTER_KEEP_IDENTITY|SCM_FOREIGN_POINTER_MAP_NULL);
    /* Register stub-generated procedures */
    Scm_Init_izclib(mod);
}
示例#2
0
/*================================================================
 * Initialization
 */
void Scm_Init_libgauche_glut(void)
{
    ScmModule *mod;
    SCM_INIT_EXTENSION(libgauche_glut);
    mod = SCM_MODULE(SCM_FIND_MODULE("gl.glut", TRUE));
    Scm_Init_glut_lib(mod);

    /* Callback table */
    ScmGlutCallbackTable = Scm_MakeHashTableSimple(SCM_HASH_EQV, 0);
    
    /* Glut built-in fonts */
#define DEFFONT(name) Scm_DefineConst(mod, SCM_SYMBOL(SCM_INTERN(#name)), makeGlutFont(name))
    /* Stroke font constants (use these in GLUT program). */
    DEFFONT(GLUT_STROKE_ROMAN);
    DEFFONT(GLUT_STROKE_MONO_ROMAN);

    /* Bitmap font constants (use these in GLUT program). */
    DEFFONT(GLUT_BITMAP_9_BY_15);
    DEFFONT(GLUT_BITMAP_8_BY_13);
    DEFFONT(GLUT_BITMAP_TIMES_ROMAN_10);
    DEFFONT(GLUT_BITMAP_TIMES_ROMAN_24);
#if (GLUT_API_VERSION >= 3)
    DEFFONT(GLUT_BITMAP_HELVETICA_10);
    DEFFONT(GLUT_BITMAP_HELVETICA_12);
    DEFFONT(GLUT_BITMAP_HELVETICA_18);
#endif
}
示例#3
0
void Scm_Init_gauche_sdl_collide(void)
{
   ScmModule *mod;
   SCM_INIT_EXTENSION(gauche_sdl_collide);
   mod = SCM_MODULE(SCM_FIND_MODULE("sdl.collide", TRUE));
   Scm_Init_sdl_collidelib(mod);
   Scm_Init_collide_type(mod);
}
示例#4
0
void Scm_Init_gauche_rsvg(void)
{
   ScmModule *mod;
   SCM_INIT_EXTENSION(gauche_rsvg);
   mod = SCM_MODULE(SCM_FIND_MODULE("cairo.rsvg", TRUE));
   Scm_Init_rsvglib(mod);
   Scm_Init_rsvg_type(mod);
}
示例#5
0
文件: init.c 项目: abbrous/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_os__windows(void)
{
    ScmModule *mod;

    SCM_INIT_EXTENSION(os__windows);
    mod = SCM_FIND_MODULE("os.windows", SCM_FIND_MODULE_CREATE);
    Scm_Init_windows(mod);
    Scm_Init_console(mod);
}
示例#6
0
文件: fcntl.c 项目: Z-Shang/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_gauche__fcntl(void)
{
    SCM_INIT_EXTENSION(gauche__fcntl);
    ScmModule *mod = SCM_FIND_MODULE("gauche.fcntl", SCM_FIND_MODULE_CREATE);
    Scm_InitStaticClass(&Scm_SysFlockClass, "<sys-flock>",
                        mod, flock_slots, 0);
    Scm_Init_fcntlib(mod);

#ifndef GAUCHE_WINDOWS
    Scm_AddFeature("gauche.sys.fcntl", NULL);
#endif
}
示例#7
0
void Scm_Init_nnvector(void)
{
  ScmModule *mod; 

  /* Register this DSO to Gauche */ 
  SCM_INIT_EXTENSION(gauche_nnvector); 
  /* Create the module if it doesn't exist yet. */
  mod = SCM_MODULE(SCM_FIND_MODULE("nnvector", TRUE));
 
  /* Register stub-generated procedures */
  Scm_Init_nnvector_lib(mod);
  Scm_Init_nnvector_type(mod);
}
void Scm_Init_gauche_clipboard(void)
{
    ScmModule *mod;

    /* Register this DSO to Gauche */
    SCM_INIT_EXTENSION(gauche_clipboard);

    /* Create the module if it doesn't exist yet. */
    mod = SCM_MODULE(SCM_FIND_MODULE("clipboard", TRUE));

    /* Register stub-generated procedures */
    Scm_Init_gauche_clipboardlib(mod);
}
示例#9
0
ScmObj Scm_Init_qnb(void)
{
    ScmModule *mod;

    /* Register this DSO to Gauche */
    SCM_INIT_EXTENSION(qnb);

    /* Create the module if it doesn't exist yet. */
    mod = SCM_MODULE(SCM_FIND_MODULE("qnb", TRUE));

    /* Register stub-generated procedures */
    Scm_Init_qnblib(mod);
}
示例#10
0
void Scm_Init_gauche_cv_objdetect(void)
{
				ScmModule *mod;

				/* Register this DSO to Gauche */
				SCM_INIT_EXTENSION(gauche_cv_objdetect);

				/* Create the module if it doesn't exist yet. */
				mod = SCM_MODULE(SCM_FIND_MODULE("cv.objdetect", TRUE));
				
				/* Register stub-generated procedures */
				Scm_Init_cv_objdetectlib(mod);
				Scm_Init_objdetect_type(mod);
}
示例#11
0
/*==========================================================
 * Initialization
 */
void
Scm_Init_gauche_glgd(void)
{
    ScmModule   *mod;
    
    SCM_INIT_EXTENSION(gauche_glgd);
    mod = SCM_MODULE(SCM_FIND_MODULE("gtk.glgd", TRUE));
    Scm_InitBuiltinClass(SCM_CLASS_GLGD_NODE, "<glgd-node>", NULL,
                         sizeof(Scm_GLGDNode), mod);
    Scm_InitBuiltinClass(SCM_CLASS_GLGD_LINK, "<glgd-link>", NULL,
                         sizeof(Scm_GLGDLink), mod);
    Scm_InitBuiltinClass(SCM_CLASS_GLGD_GRAPH, "<glgd-graph>", NULL,
                         sizeof(Scm_GLGDGraph), mod);
    Scm_Init_glgdlib(mod);
}
示例#12
0
ScmObj
Scm_Init_graphics_gd(void)
{
  const char *module_name = "graphics.gd";
  ScmModule *mod;

  SCM_INIT_EXTENSION(graphics_gd);

  mod = SCM_MODULE(SCM_FIND_MODULE(module_name, TRUE));

  GraphicsGdImageClass =
	Scm_MakeForeignPointerClass(mod, "<gd-image>",
								NULL, graphicsGdImageCleanUp, SCM_FOREIGN_POINTER_KEEP_IDENTITY|SCM_FOREIGN_POINTER_MAP_NULL);
  GraphicsGdFontClass =
	Scm_MakeForeignPointerClass(mod, "<gd-font>",
								NULL, graphicsGdFontCleanUp, SCM_FOREIGN_POINTER_KEEP_IDENTITY|SCM_FOREIGN_POINTER_MAP_NULL);

  sym_destroyed = SCM_INTERN("destroyed?");

  Scm_Init_graphics_gdlib(mod);

  /* the following feature identifiers are available *after* loading. */
#ifdef GD_XPM
  Scm_AddFeature("gauche.ext.graphics.gd.xpm", module_name);
#endif /* GD_XPM */
#ifdef GD_PNG
  Scm_AddFeature("gauche.ext.graphics.gd.png", module_name);
#endif /* GD_PNG */
#ifdef GD_JPEG
  Scm_AddFeature("gauche.ext.graphics.gd.jpeg", module_name);
#endif /* GD_JPEG */
#ifdef GD_GIF
  Scm_AddFeature("gauche.ext.graphics.gd.gif", module_name);
#endif /* GD_GIF */
#ifdef GD_FREETYPE
  Scm_AddFeature("gauche.ext.graphics.gd.freetype", module_name);
#endif /* GD_FREETYPE */
#ifdef GD_FONTCONFIG
  Scm_AddFeature("gauche.ext.graphics.gd.fontconfig", module_name);
#endif /* GD_FONTCONFIG */
}
示例#13
0
文件: uvinit.c 项目: Z-Shang/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_libgauche_uvector(void)
{
    SCM_INIT_EXTENSION(uvector);
    ScmModule *m = SCM_FIND_MODULE("gauche.uvector", SCM_FIND_MODULE_CREATE);
    Scm_InitStaticClassWithMeta(&Scm_UVectorClass,   "<uvector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_S8VectorClass,  "<s8vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_U8VectorClass,  "<u8vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_S16VectorClass, "<s16vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_U16VectorClass, "<u16vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_S32VectorClass, "<s32vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_U32VectorClass, "<u32vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_S64VectorClass, "<s64vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_U64VectorClass, "<u64vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_F16VectorClass, "<f16vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_F32VectorClass, "<f32vector>", m, NULL, SCM_NIL, NULL, 0);
    Scm_InitStaticClassWithMeta(&Scm_F64VectorClass, "<f64vector>", m, NULL, SCM_NIL, NULL, 0);

    Scm_Init_uvlib(m);
    Scm_Init_uvutil();
    Scm__InstallReadUvectorHook(read_uvector);
}
示例#14
0
文件: charconv.c 项目: Z-Shang/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_gauche__charconv(void)
{
    SCM_INIT_EXTENSION(gauche__charconv);
    ScmModule *mod = SCM_FIND_MODULE("gauche.charconv", SCM_FIND_MODULE_CREATE);
    guess.procs = NULL;
    (void)SCM_INTERNAL_MUTEX_INIT(guess.mutex);
#if   defined(GAUCHE_CHAR_ENCODING_UTF_8)
    ucsconv.ucs2char = ucsconv.char2ucs = NULL;
#elif defined(GAUCHE_CHAR_ENCODING_EUC_JP)
    ucsconv.ucs2char = jconv_open("EUCJP", "UTF-8");
    ucsconv.char2ucs = jconv_open("UTF-8", "EUCJP");
#elif defined(GAUCHE_CHAR_ENCODING_SJIS)
    ucsconv.ucs2char = jconv_open("SJIS", "UTF-8");
    ucsconv.char2ucs = jconv_open("UTF-8", "SJIS");
#else
    ucsconv.ucs2char = ucsconv.char2ucs = NULL;
#endif
    (void)SCM_INTERNAL_MUTEX_INIT(ucsconv.mutex);
    Scm_Init_convguess();
    Scm_Init_convaux();
    Scm__InstallCharconvHooks(ucstochar, chartoucs);
    Scm__InstallCodingAwarePortHook(coding_aware_conv);
}
示例#15
0
void Scm_Init_ggcnumextra()
{
  ScmModule *module = SCM_MODULE(SCM_FIND_MODULE("ggc.numerical.extra", TRUE));
  Scm_Init_ggc_numerical_extra(module);
}
示例#16
0
文件: binary.c 项目: aharisu/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_binary__io(void)
{
    ScmModule *mod_io = SCM_FIND_MODULE("binary.io", SCM_FIND_MODULE_CREATE);
    SCM_INIT_EXTENSION(binary__io);
    Scm_Init_binarylib(mod_io);
}
示例#17
0
文件: termios.c 项目: aharisu/Gauche
SCM_EXTENSION_ENTRY void Scm_Init_gauche__termios(void)
{
    ScmModule *mod;
    SCM_INIT_EXTENSION(gauche__termios);
    mod = SCM_FIND_MODULE("gauche.termios", SCM_FIND_MODULE_CREATE);
    Scm_Init_termiolib(mod);

#if !defined(GAUCHE_WINDOWS)
    Scm_InitStaticClass(&Scm_SysTermiosClass, "<sys-termios>", mod,
                        termios_slots, 0);

    /* Constants for termios.  Non-POSIX symbols are guarded by #ifdef's */
#define DEFSYM(sym) \
    SCM_DEFINE(mod, #sym, Scm_MakeIntegerFromUI(sym))

    /* c_iflag masks */
    DEFSYM(IGNBRK);
    DEFSYM(BRKINT);
    DEFSYM(IGNPAR);
    DEFSYM(PARMRK);
    DEFSYM(INPCK);
    DEFSYM(ISTRIP);
    DEFSYM(INLCR);
    DEFSYM(IGNCR);
    DEFSYM(ICRNL);
    DEFSYM(IXON);
    DEFSYM(IXOFF);
#ifdef IXANY
    DEFSYM(IXANY);
#endif
#ifdef IUCLC
    DEFSYM(IUCLC);
#endif
#ifdef IMAXBEL
    DEFSYM(IMAXBEL);
#endif

    /* c_oflag masks */
    DEFSYM(OPOST);
#ifdef OLCUC
    DEFSYM(OLCUC);
#endif
#ifdef ONLCR
    DEFSYM(ONLCR);
#endif
#ifdef OCRNL
    DEFSYM(OCRNL);
#endif
#ifdef ONOCR
    DEFSYM(ONOCR);
#endif
#ifdef ONLRET
    DEFSYM(ONLRET);
#endif
#ifdef OFILL
    DEFSYM(OFILL);
#endif
#ifdef OFDEL
    DEFSYM(OFDEL);
#endif
#ifdef NLDLY
    DEFSYM(NLDLY);
#endif
#ifdef NL0
    DEFSYM(NL0);
#endif
#ifdef NL1
    DEFSYM(NL1);
#endif
#ifdef CRDLY
    DEFSYM(CRDLY);
#endif
#ifdef CR0
    DEFSYM(CR0);
#endif
#ifdef CR1
    DEFSYM(CR1);
#endif
#ifdef CR2
    DEFSYM(CR2);
#endif
#ifdef CR3
    DEFSYM(CR3);
#endif
#ifdef BSDLY
    DEFSYM(BSDLY);
#endif
#ifdef BS0
    DEFSYM(BS0);
#endif
#ifdef BS1
    DEFSYM(BS1);
#endif
#ifdef VTDLY
    DEFSYM(VTDLY);
#endif
#ifdef VT0
    DEFSYM(VT0);
#endif
#ifdef VT1
    DEFSYM(VT1);
#endif
#ifdef FFDLY
    DEFSYM(FFDLY);
#endif
#ifdef FF0
    DEFSYM(FF0);
#endif
#ifdef FF1
    DEFSYM(FF1);
#endif

    /* c_cflag masks */
    DEFSYM(CLOCAL);
    DEFSYM(CREAD);
    DEFSYM(CSIZE);
    DEFSYM(CS5);
    DEFSYM(CS6);
    DEFSYM(CS7);
    DEFSYM(CS8);
    DEFSYM(CSTOPB);
    DEFSYM(HUPCL);
    DEFSYM(PARENB);
    DEFSYM(PARODD);
#ifdef CIBAUD
    DEFSYM(CIBAUD);
#endif
#ifdef CRTSCTS
    DEFSYM(CRTSCTS);
#endif

    /* c_lflag masks */
    DEFSYM(ECHO);
    DEFSYM(ECHOE);
    DEFSYM(ECHOK);
    DEFSYM(ECHONL);
    DEFSYM(ICANON);
    DEFSYM(ISIG);
    DEFSYM(NOFLSH);
    DEFSYM(TOSTOP);
    DEFSYM(IEXTEN);
#ifdef XCASE
    DEFSYM(XCASE);
#endif
#ifdef ECHOCTL
    DEFSYM(ECHOCTL);
#endif
#ifdef ECHOPRT
    DEFSYM(ECHOPRT);
#endif
#ifdef ECHOKE
    DEFSYM(ECHOKE);
#endif
#ifdef FLUSH0
    DEFSYM(FLUSH0);
#endif
#ifdef PENDIN
    DEFSYM(PENDIN);
#endif

    /* c_cc size */
    DEFSYM(NCCS);

    /* disable character */
    DEFSYM(_POSIX_VDISABLE);

    /* c_cc subscripts */
    DEFSYM(VEOF);
    DEFSYM(VEOL);
    DEFSYM(VERASE);
    DEFSYM(VINTR);
    DEFSYM(VKILL);
    DEFSYM(VMIN);
    DEFSYM(VQUIT);
    DEFSYM(VSTART);
    DEFSYM(VSTOP);
    DEFSYM(VSUSP);
    DEFSYM(VTIME);
#ifdef VDISCARD
    DEFSYM(VDISCARD);
#endif
#ifdef VDSUSP
    DEFSYM(VDSUSP);
#endif
#ifdef EOL2
    DEFSYM(VEOL2);
#endif
#ifdef LNEXT
    DEFSYM(VLNEXT);
#endif
#ifdef VREPRINT
    DEFSYM(VREPRINT);
#endif
#ifdef VSTATUS
    DEFSYM(VSTATUS);
#endif
#ifdef WERASE
    DEFSYM(VWERASE);
#endif
#ifdef VSWTCH
    DEFSYM(VSWTCH);
#endif
#ifdef VSWTC
    DEFSYM(VSWTC);
#endif

    /* extra baudrates.   <= B38400 is defined in termiolib.stub */
#ifdef B57600
    DEFSYM(B57600);
#endif
#ifdef B115200
    DEFSYM(B115200);
#endif
#ifdef B230400
    DEFSYM(B230400);
#endif

#endif /*!GAUCHE_WINDOWS*/
}
示例#18
0
文件: main.c 项目: h2oota/Gauche
/* Process command-line options that needs to run after Scheme runtime
   is initialized.  CMD_ARGS is an list of (OPTION-CHAR . OPTION-ARG) */
static void process_command_args(ScmObj cmd_args)
{
    ScmEvalPacket epak;
    ScmLoadPacket lpak;
    int standard_given = FALSE;
    ScmObj cp;

    SCM_FOR_EACH(cp, cmd_args) {
        ScmObj p = SCM_CAR(cp);
        ScmObj v = SCM_CDR(p);

        switch (SCM_CHAR_VALUE(SCM_CAR(p))) {
        case 'I':
            Scm_AddLoadPath(Scm_GetStringConst(SCM_STRING(v)), FALSE);
            break;
        case 'A':
            Scm_AddLoadPath(Scm_GetStringConst(SCM_STRING(v)), TRUE);
            break;
        case 'l':
            if (Scm_Load(Scm_GetStringConst(SCM_STRING(v)), 0, &lpak) < 0)
                error_exit(lpak.exception);
            break;
        case 'L':
            if (Scm_Load(Scm_GetStringConst(SCM_STRING(v)), SCM_LOAD_QUIET_NOFILE, &lpak) < 0)
                error_exit(lpak.exception);
            break;
        case 'u':
            if (Scm_Require(Scm_StringJoin(Scm_StringSplitByChar(SCM_STRING(v),
                                                                 '.'),
                                           SCM_STRING(SCM_MAKE_STR("/")),
                                           SCM_STRING_JOIN_INFIX),
                            0, &lpak) < 0) {
                error_exit(lpak.exception);
            }
            Scm_ImportModule(SCM_CURRENT_MODULE(), Scm_Intern(SCM_STRING(v)),
                             SCM_FALSE, 0);
            break;
        case 'e':
            if (Scm_EvalCString(Scm_GetStringConst(SCM_STRING(v)),
                                SCM_OBJ(Scm_UserModule()),
                                &epak) < 0) {
                error_exit(epak.exception);
            }
            break;
        case 'E':
            v = Scm_StringAppend(SCM_LIST3(SCM_MAKE_STR("("),
                                           v,
                                           SCM_MAKE_STR(")")));

            if (Scm_EvalCString(Scm_GetStringConst(SCM_STRING(v)),
                                SCM_OBJ(Scm_UserModule()),
                                &epak) < 0) {
                error_exit(epak.exception);
            }
            break;
        case 'r':
            if (standard_given) {
                Scm_Error("Multiple -r option is specified.");
            } else {
                /* R7RS mode.  Preload r7rs module, set the default toplevel
                   to r7rs.user, and define *r7rs-mode* in user module
                   so that gauche.interactive can do proper setup. */
                const char *std = Scm_GetStringConst(SCM_STRING(v));
                if (strcmp(std, "7") == 0) {
                    if (Scm_Require(SCM_MAKE_STR("r7rs"), 0, &lpak) < 0) {
                        error_exit(lpak.exception);
                    }
                    SCM_DEFINE(Scm_UserModule(), "*r7rs-mode*", SCM_TRUE);
                    default_toplevel_module = SCM_FIND_MODULE("r7rs.user", 0);
                    standard_given = TRUE;
                } else {
                    Scm_Error("Unsupported standard for -r option: %s", std);
                }
            }
        }
    }