コード例 #1
0
ファイル: main.c プロジェクト: h2oota/Gauche
/* Cleanup */
void cleanup_main(void *data)
{
    ScmVM *vm = Scm_VM();

    if (profiling_mode) {
        Scm_ProfilerStop();
        Scm_EvalCString("(profiler-show)",
                        SCM_OBJ(Scm_GaucheModule()),
                        NULL); /* ignore errors */
    }

    /* EXPERIMENTAL */
    if (stats_mode) {
        fprintf(stderr, "\n;; Statistics (*: main thread only):\n");
        fprintf(stderr,
                ";;  GC: %zubytes heap, %zubytes allocated\n",
                GC_get_heap_size(), GC_get_total_bytes());
        fprintf(stderr,
                ";;  stack overflow*: %ldtimes, %.2fms total/%.2fms avg\n",
                vm->stat.sovCount,
                vm->stat.sovTime/1000.0,
                (vm->stat.sovCount > 0?
                 (double)(vm->stat.sovTime/vm->stat.sovCount)/1000.0 :
                 0.0));
    }

    /* EXPERIMENTAL */
    if (SCM_VM_RUNTIME_FLAG_IS_SET(vm, SCM_COLLECT_LOAD_STATS)) {
        Scm_Eval(SCM_LIST2(SCM_INTERN("profiler-show-load-stats"),
                           SCM_LIST2(SCM_INTERN("quote"),
                                     vm->stat.loadStat)),
                 SCM_OBJ(Scm_GaucheModule()),
                 NULL);    /* ignore errors */
    }
}
コード例 #2
0
ファイル: mutex.c プロジェクト: qykth-git/Gauche
void Scm_Init_mutex(ScmModule *mod)
{
    sym_not_owned     = SCM_INTERN("not-owned");
    sym_abandoned     = SCM_INTERN("abandoned");
    sym_not_abandoned = SCM_INTERN("not-abandoned");
    Scm_InitStaticClass(&Scm_MutexClass, "<mutex>", mod, mutex_slots, 0);
    Scm_InitStaticClass(&Scm_ConditionVariableClass, "<condition-variable>", mod, cv_slots, 0);
}
コード例 #3
0
ファイル: graphics_gd.c プロジェクト: tabe/Gauche-gd
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 */
}
コード例 #4
0
ファイル: graphics_gd.c プロジェクト: tabe/Gauche-gd
ScmObj
graphicsGdGetFeatures(void)
{
  ScmObj r = (ScmObj)SCM_NIL;
#ifdef GD_XPM
  r = Scm_Cons(SCM_INTERN("xpm"), r);
#endif /* GD_XPM */
#ifdef GD_PNG
  r = Scm_Cons(SCM_INTERN("png"), r);
#endif /* GD_PNG */
#ifdef GD_JPEG
  r = Scm_Cons(SCM_INTERN("jpeg"), r);
#endif /* GD_JPEG */
#ifdef GD_GIF
  r = Scm_Cons(SCM_INTERN("gif"), r);
#endif /* GD_GIF */
#ifdef GD_FREETYPE
  r = Scm_Cons(SCM_INTERN("freetype"), r);
#endif /* GD_FREETYPE */
#ifdef GD_FONTCONFIG
  r = Scm_Cons(SCM_INTERN("fontconfig"), r);
#endif /* GD_FONTCONFIG */
  return r;
}
コード例 #5
0
ファイル: main.c プロジェクト: h2oota/Gauche
void further_options(const char *optarg)
{
    ScmVM *vm = Scm_VM();
    if (strcmp(optarg, "no-inline-globals") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_GLOBALS);
    }
    else if (strcmp(optarg, "no-inline-locals") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_LOCALS);
    }
    else if (strcmp(optarg, "no-inline-constants") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_CONSTS);
    }
    else if (strcmp(optarg, "no-inline") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_GLOBALS);
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_LOCALS);
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOINLINE_CONSTS);
    }
    else if (strcmp(optarg, "no-post-inline-pass") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NO_POST_INLINE_OPT);
    }
    else if (strcmp(optarg, "no-lambda-lifting-pass") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NO_LIFTING);
    }
    else if (strcmp(optarg, "no-source-info") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOSOURCE);
    }
    else if (strcmp(optarg, "load-verbose") == 0) {
        SCM_VM_RUNTIME_FLAG_SET(vm, SCM_LOAD_VERBOSE);
    }
    else if (strcmp(optarg, "include-verbose") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_INCLUDE_VERBOSE);
    }
    else if (strcmp(optarg, "case-fold") == 0) {
        SCM_VM_RUNTIME_FLAG_SET(vm, SCM_CASE_FOLD);
    }
    else if (strcmp(optarg, "warn-legacy-syntax") == 0) {
        Scm_SetReaderLexicalMode(SCM_INTERN("warn-legacy"));
    }
    else if (strcmp(optarg, "test") == 0) {
        test_mode = TRUE;
    }
    /* For development; not for public use */
    else if (strcmp(optarg, "collect-stats") == 0) {
        stats_mode = TRUE;
        SCM_VM_RUNTIME_FLAG_SET(vm, SCM_COLLECT_VM_STATS);
    }
    /* For development; not for public use */
    else if (strcmp(optarg, "no-combine-instructions") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_NOCOMBINE);
    }
    /* For development; not for public use */
    else if (strcmp(optarg, "debug-compiler") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_SHOWRESULT);
    }
    /* Experimental */
    else if (strcmp(optarg, "limit-module-mutation") == 0) {
        SCM_VM_RUNTIME_FLAG_SET(vm, SCM_LIMIT_MODULE_MUTATION);
    }
    /* Experimental */
    else if (strcmp(optarg, "c-expr") == 0) {
        SCM_VM_COMPILER_FLAG_SET(vm, SCM_COMPILE_ENABLE_CEXPR);
    }
    else {
        fprintf(stderr, "unknown -f option: %s\n", optarg);
        fprintf(stderr, "supported options are: -fcase-fold, -fload-verbose, -finclude-verbose, -fno-inline, -fno-inline-globals, -fno-inline-locals, -fno-inline-constants, -fno-source-info, -fno-post-inline-pass, -fno-lambda-lifting-pass, -fwarn-legacy-syntax, or -ftest\n");
        exit(1);
    }
}
コード例 #6
0
ファイル: char.c プロジェクト: abbrous/Gauche
ScmObj Scm_CharEncodingName(void)
{
    return SCM_INTERN(SCM_CHAR_ENCODING_NAME);
}