Exemplo n.º 1
0
EXPORT void
wire_model(void) {
	int   reader, upsamp, midear, gamma, haircell, tts, writer;


  /* START TEST CONFIG */
  reader = lookup_module("Reader");
  writer = lookup_module("Writer");
  wire_module(reader, 1, writer, 1);
  return;
  /* END TEST CONFIG */

	upsamp   = lookup_module("UpSample");
	midear   = lookup_module("MidEar");
	gamma    = lookup_module("Gamma");
	haircell = lookup_module("Haircell");
	tts      = lookup_module("TTS");
	writer   = lookup_module("Writer");

	wire_module(reader, 1, upsamp, 1);
	wire_module(upsamp, 1, midear, 1);
	wire_module(midear, 1, gamma,  1);
	wire_module(gamma,  1, writer, 1);

}
Exemplo n.º 2
0
EXPORT void
set_parameters_model(void) {
	int   reader, upsamp, midear, gamma, haircell, tts, writer;

	reader   = lookup_module("Reader");
	set_parameters_module(reader, "sine_120dB.txt");

  WaitModuleReady();

  /* START TEST CONFIG */
  writer = lookup_module("Writer");
  set_parameters_module(writer, "writer.par");

  WaitModuleReady();

  /* END TEST CONFIG */
#ifdef REAL_CONFIG
	upsamp   = lookup_module("UpSample");
	midear   = lookup_module("MidEar");
	gamma    = lookup_module("Gamma");
	haircell = lookup_module("Haircell");
	tts      = lookup_module("TTS");
	writer   = lookup_module("Writer");

	set_parameters_module(upsamp,    "upamp.par");
	set_parameters_module(midear,    "midear.par");
	set_parameters_module(gamma,     "gamma.par");
	set_parameters_module(haircell,  "haircell.par");
	set_parameters_module(tts,       "tts.par");
	set_parameters_module(writer,    "whale.out");
#endif

}
Exemplo n.º 3
0
/**
 * gwy_module_get_description:
 * @name: Module name.
 *
 * Obtains the description of a registered module.
 *
 * Returns: The description as a string owned by the module.
 **/
const gchar*
gwy_module_get_description(const gchar *name)
{
    ModuleInfo *modinfo = lookup_module(name, TRUE, FALSE);
    // FIXME: Translate here or later?
    return modinfo ? modinfo->module_info->description : NULL;
}
Exemplo n.º 4
0
// path in module specific load
oql_rc_t oqlDatabase::LoadSdlModule()
{
	// for shore, scan a module
#ifndef NO_SDL
	Ref<sdlModule> m;
	// the name can be 1: an sdl module
	// 2: a registered, sdl object
	// 3: a directory.
	// get a ref.
	m = lookup_module(_name);
	if (m==0)
	{
		errstream() << "couldn't find module" << _name;
	   return OQL_OK;
	}
	Ref<sdlDeclaration> bpt;
	for (bpt = m->decl_list; bpt != 0; bpt = bpt->next)
	// insert types in db.
	{
		Type *nt;
		if(bpt->kind==TypeName)
		{
			nt = AddShoreType(bpt->type);
			if (nt!=0)
			{
				if (nt->isObject()) {
					// Add to the list of extents
					extents.add(bpt->name, new SetType(nt));  
				}
			}
			else
				errstream()<< "create_Type faied for " 
					<< bpt->name.string() << "in module " << _name;
		}
	}

#endif
   // Assume that the _cat is open. Assume that the 
   // mutex has been taken
#ifdef NO_SDL
   AutoMutex myMutex(*(_cat->mutex));
   W_COERCE(myMutex.acquire());

   uint4 numExtents = _cat->dbCache.extentCnt;
   uint4 i;
   
   if (numExtents) assert(t_array = new Type*[numExtents]);

   // Now go thru each extent...
   for (i = 0; i < numExtents; i++)
      Do(_cat->extentCache[i], t_array[i]);

   // That's it...
   if (t_array) delete [] t_array;
#endif

   return OQL_OK;
}
Exemplo n.º 5
0
/*
 * Attempt to load a TUX application module.
 * This is the slow path, we cache ('link') the module's
 * API vector to the inode.
 * The module loading path is serialized, and we handshake
 * with the loaded module and fetch its API vector.
 */
tcapi_template_t * lookup_tuxmodule (const char *filename)
{
	tcapi_template_t *tcapi;

	spin_lock(&tuxmodules_lock);
	tcapi = lookup_module(filename);
	if (!tcapi)
		Dprintk("did not find module vfs:{%s}\n", filename);
	spin_unlock(&tuxmodules_lock);
	return tcapi;
}
Exemplo n.º 6
0
static void include_modules(VALUE module, VALUE included_modules)
{
  long j;
  VALUE v;
  VALUE name;

  rb_check_type(included_modules, T_ARRAY);
  for(j = 0; j < RARRAY_LEN(included_modules); ++j)
  {
    name = RARRAY_PTR(included_modules)[j];
    v = lookup_module(name);
    rb_funcall(module, rb_intern("include"), 1, v);
  }
}
Exemplo n.º 7
0
EXPORT void
init_model(void) {
	float samplerate;
	int   inputsamples, samples, channels;
	int   id;

	whale_init(&samplerate, &inputsamples, &samples, &channels);

	printf("Sample rate %.3f: input samples %d, samples %d, channels %d\n",
		samplerate, inputsamples, samples, channels);

	/* Set runtime sizes in module i/o descriptors */

	/* Reader */
	id = lookup_module("Reader");
	config_module_output(id, 1, inputsamples, 1, 1, 1);


  /***********************/
  /* START TEST CONFIG **/
  id = lookup_module("Writer");
  config_module_input(id, 1, inputsamples, 1, 1, 1);
  return;
  /* END TEST CONFIG    */
  /**********************/

	/* Up Sample */
	id = lookup_module("UpSample");
	config_module_input(id, 1, inputsamples, 1, 1, 1);
	config_module_output(id, 1, samples, 1, 1, 1);


	/* Midear */
	id = lookup_module("MidEar");
	config_module_input(id, 1, samples, 1, 1, 1);
	config_module_output(id, 1, samples, 1, 1, 1);

	/* Gamma */
	id = lookup_module("Gamma");
	config_module_input(id, 1, samples, 1, 1, 1);
	config_module_output(id, 1, samples, channels, 1, 1);

	/* Haircell */
	id = lookup_module("Haircell");
	config_module_input(id, 1, samples, channels, 1, 1);
	config_module_output(id, 1, samples, channels, 1, 1);

	/* Writer */
	id = lookup_module("Writer");
	config_module_input(id, 1, samples, channels, 1, 1);
}
Exemplo n.º 8
0
tcapi_template_t * unregister_tuxmodule (char *vfs_name)
{
	tcapi_template_t *tcapi;
	int err = 0;

	spin_lock(&tuxmodules_lock);
	tcapi = lookup_module(vfs_name);
	if (!tcapi) {
		Dprintk("huh, module %s not registered??\n", vfs_name);
		err = -1;
	} else {
		list_del(&tcapi->modules);
		Dprintk("TUX module %s unregistered.\n", vfs_name);
	}
	spin_unlock(&tuxmodules_lock);

	return tcapi;
}
Exemplo n.º 9
0
int register_tuxmodule (tcapi_template_t *tcapi)
{
	int ret = -EEXIST;

	spin_lock(&tuxmodules_lock);

	if (lookup_module(tcapi->vfs_name)) {
		Dprintk("module with VFS binding '%s' already registered!\n",
						 tcapi->vfs_name);
		goto out;
	}

	list_add(&tcapi->modules, &tuxmodules_list);
	ret = 0;
	Dprintk("TUX module %s registered.\n", tcapi->vfs_name);
out:
	spin_unlock(&tuxmodules_lock);

	return ret;
}
Exemplo n.º 10
0
static int
process_bind(char *lname)
{
	Ref<sdlModule> bmod;
	Set<Ref<sdlModule> > omods;
	// first, [re]open stdout for appropriate name.
	// do this outside of a transaction..
	W_COERCE(Shore::begin_transaction(3));
	bmod = lookup_module(lname);
	if (bmod == 0) // null value
	{
		cerr << "couldn't find module " <<  lname << endl;
		return -1;
	}
	omods.add(bmod);
	if (open_output_file(lname)==0)
		print_cxx_binding(omods);
	// this should be a readonly transaction, so never commit.
	SH_DO(SH_COMMIT_TRANSACTION);
	return 0;
}
Exemplo n.º 11
0
static int
process_link(char *lname)
// process the string as the name of an sdl module object.
{
	Ref<sdlModule> lmod;
	int errcount;
	W_COERCE(Shore::begin_transaction(3));
	lmod = lookup_module(lname);
	sdl_linking = 1;
	if (lmod!= 0)
	{
		lmod.update()->resolve_types();
		if (sdl_errors)
		{
			cerr << sdl_errors << " found linking module " << lname << endl;
			Shore::abort_transaction();
			return sdl_errors;
		}
	}
	SH_DO(SH_COMMIT_TRANSACTION);
	return 0;
}
Exemplo n.º 12
0
/**
 * gwy_module_get_copyright:
 * @name: Module name.
 *
 * Obtains the copyright holder of a registered module.
 *
 * Returns: The copyright holder as a string owned by the module.
 **/
const gchar*
gwy_module_get_copyright(const gchar *name)
{
    ModuleInfo *modinfo = lookup_module(name, TRUE, FALSE);
    return modinfo ? modinfo->module_info->copyright : NULL;
}
Exemplo n.º 13
0
/**
 * gwy_module_get_date:
 * @name: Module name.
 *
 * Obtains the date of a registered module.
 *
 * Returns: The date as a string owned by the module.
 **/
const gchar*
gwy_module_get_date(const gchar *name)
{
    ModuleInfo *modinfo = lookup_module(name, TRUE, FALSE);
    return modinfo ? modinfo->module_info->date : NULL;
}
Exemplo n.º 14
0
static void
set_param(char *lvalue, char *rvalue, int param_level)
{
    int param_index;
    char module[255], variable[255];
    int num_items;

    param_index = lookup_name(lvalue);
    if (param_index == -1)
    {
        num_items = sscanf(lvalue, "%[^_]_%s", module, variable);
        if (num_items != 2) {
            carmen_warn("Ill-formed parameter name %s%s%s. Could not find "
                        "module and variable name.\n"
                        "Not setting this parameter.\n", carmen_red_code,
                        lvalue, carmen_normal_code);
            return;
        }

        check_param_space();
        param_index = num_params;
        num_params++;
        param_list[param_index].lvalue = (char *)calloc
                                         (strlen(lvalue)+1, sizeof(char));
        carmen_test_alloc(param_list[param_index].lvalue);
        strcpy(param_list[param_index].lvalue, lvalue);

        param_list[param_index].module_name = (char *)calloc
                                              (strlen(module)+1, sizeof(char));
        carmen_test_alloc(param_list[param_index].module_name);
        strcpy(param_list[param_index].module_name, module);

        if (lookup_module(module) == -1)
            add_module(module);

        param_list[param_index].variable_name = (char *)calloc
                                                (strlen(variable)+1, sizeof(char));
        carmen_test_alloc(param_list[param_index].variable_name);
        strcpy(param_list[param_index].variable_name, variable);

        if (param_level == PARAM_LEVEL_NOCHANGE)
            param_level = PARAM_LEVEL_BASIC;
    }
    else
    {
        free(param_list[param_index].rvalue);
    }

    param_list[param_index].rvalue = (char *)calloc
                                     (strlen(rvalue)+1, sizeof(char));
    carmen_test_alloc(param_list[param_index].rvalue);

    strcpy(param_list[param_index].rvalue, rvalue);

    if (param_level != PARAM_LEVEL_NOCHANGE)
        param_list[param_index].expert = param_level;

    carmen_verbose("Added %s %s%s: %s = %s \n",
                   param_list[param_index].module_name,
                   param_list[param_index].variable_name,
                   param_list[param_index].expert ? " (expert)" : "",
                   param_list[param_index].lvalue,
                   param_list[param_index].rvalue);

    publish_new_param(param_index);
}
Exemplo n.º 15
0
errval_t spawn_xcore_monitor(coreid_t coreid, int hwid,
                             enum cpu_type cpu_type,
                             const char *cmdline,
                             struct frame_identity urpc_frame_id,
                             struct capref kcb)
{
    uint64_t start = 0;
    const char *monitorname = NULL, *cpuname = NULL;
    genpaddr_t arch_page_size;
    errval_t err;

    err = get_architecture_config(cpu_type, &arch_page_size,
                                  &monitorname, &cpuname);
    assert(err_is_ok(err));

    DEBUG("loading kernel: %s\n", cpuname);
    DEBUG("loading 1st app: %s\n", monitorname);

    // compute size of frame needed and allocate it
    DEBUG("%s:%s:%d: urpc_frame_id.base=%"PRIxGENPADDR"\n",
           __FILE__, __FUNCTION__, __LINE__, urpc_frame_id.base);
    DEBUG("%s:%s:%d: urpc_frame_id.size=%d\n",
           __FILE__, __FUNCTION__, __LINE__, urpc_frame_id.bits);

    if (benchmark_flag) {
        start = bench_tsc();
    }
    static size_t cpu_binary_size;
    static lvaddr_t cpu_binary = 0;
    static genpaddr_t cpu_binary_phys;
    static const char* cached_cpuname = NULL;
    if (cpu_binary == 0) {
        cached_cpuname = cpuname;
        // XXX: Caching these for now, until we have unmap
        err = lookup_module(cpuname, &cpu_binary, &cpu_binary_phys,
                            &cpu_binary_size);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "Can not lookup module");
            return err;
        }
    }
    // Ensure caching actually works and we're
    // always loading same binary. If this starts to fail, get rid of caching.
    assert (strcmp(cached_cpuname, cpuname) == 0);

    static size_t monitor_binary_size;
    static lvaddr_t monitor_binary = 0;
    static genpaddr_t monitor_binary_phys;
    static const char* cached_monitorname = NULL;
    if (monitor_binary == 0) {
        cached_monitorname = monitorname;
        // XXX: Caching these for now, until we have unmap
        err = lookup_module(monitorname, &monitor_binary,
                            &monitor_binary_phys, &monitor_binary_size);
        if (err_is_fail(err)) {
            DEBUG_ERR(err, "Can not lookup module");
            return err;
        }
    }
    // Again, ensure caching actually worked (see above)
    assert (strcmp(cached_monitorname, monitorname) == 0);

    if (benchmark_flag) {
        bench_data->load = bench_tsc() - start;
        start = bench_tsc();
    }

    struct capref cpu_memory_cap;
    struct frame_identity frameid;
    size_t cpu_memory;
    err = allocate_kernel_memory(cpu_binary, arch_page_size,
                                 &cpu_memory_cap, &cpu_memory, &frameid);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Can not allocate space for new app kernel.");
        return err;
    }

    err = cap_mark_remote(cpu_memory_cap);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Can not mark cap remote.");
        return err;
    }

    void *cpu_buf_memory;
    err = vspace_map_one_frame(&cpu_buf_memory, cpu_memory, cpu_memory_cap,
                               NULL, NULL);
    if (err_is_fail(err)) {
        return err_push(err, LIB_ERR_VSPACE_MAP);
    }
    if (benchmark_flag) {
        bench_data->alloc_cpu = bench_tsc() - start;
        start = bench_tsc();
    }

    /* Chunk of memory to load monitor on the app core */
    struct capref spawn_memory_cap;
    struct frame_identity spawn_memory_identity;

    err = frame_alloc_identify(&spawn_memory_cap,
                               X86_CORE_DATA_PAGES * arch_page_size,
                               NULL, &spawn_memory_identity);
    if (err_is_fail(err)) {
        return err_push(err, LIB_ERR_FRAME_ALLOC);
    }

    err = cap_mark_remote(spawn_memory_cap);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Can not mark cap remote.");
        return err;
    }
    if (benchmark_flag) {
        bench_data->alloc_mon = bench_tsc() - start;
        start = bench_tsc();
    }

    /* Load cpu */
    struct elf_allocate_state state;
    state.vbase = (char *)cpu_buf_memory + arch_page_size;
    assert(sizeof(struct x86_core_data) <= arch_page_size);
    state.elfbase = elf_virtual_base(cpu_binary);

    struct Elf64_Ehdr *cpu_head = (struct Elf64_Ehdr *)cpu_binary;
    genvaddr_t cpu_entry;

    err = elf_load(cpu_head->e_machine, elfload_allocate, &state,
                   cpu_binary, cpu_binary_size, &cpu_entry);
    if (err_is_fail(err)) {
        return err;
    }
    if (benchmark_flag) {
        bench_data->elf_load = bench_tsc() - start;
        start = bench_tsc();
    }

    err = relocate_cpu_binary(cpu_binary, cpu_head, state, frameid, arch_page_size);
    if (err_is_fail(err)) {
        DEBUG_ERR(err, "Can not relocate new kernel.");
        return err;
    }
    if (benchmark_flag) {
        bench_data->elf_reloc = bench_tsc() - start;
    }

    genvaddr_t cpu_reloc_entry = cpu_entry - state.elfbase
                                 + frameid.base + arch_page_size;
    /* Compute entry point in the foreign address space */
    forvaddr_t foreign_cpu_reloc_entry = (forvaddr_t)cpu_reloc_entry;

    /* Setup the core_data struct in the new kernel */
    struct x86_core_data *core_data = (struct x86_core_data *)cpu_buf_memory;
    switch (cpu_head->e_machine) {
    case EM_X86_64:
    case EM_K1OM:
        core_data->elf.size = sizeof(struct Elf64_Shdr);
        core_data->elf.addr = cpu_binary_phys + (uintptr_t)cpu_head->e_shoff;
        core_data->elf.num  = cpu_head->e_shnum;
        break;
    case EM_386:
        core_data->elf.size = sizeof(struct Elf32_Shdr);
        struct Elf32_Ehdr *head32 = (struct Elf32_Ehdr *)cpu_binary;
        core_data->elf.addr = cpu_binary_phys + (uintptr_t)head32->e_shoff;
        core_data->elf.num  = head32->e_shnum;
        break;
    default:
        return SPAWN_ERR_UNKNOWN_TARGET_ARCH;
    }
    core_data->module_start = cpu_binary_phys;
    core_data->module_end   = cpu_binary_phys + cpu_binary_size;
    core_data->urpc_frame_base = urpc_frame_id.base;
    core_data->urpc_frame_bits = urpc_frame_id.bits;
    core_data->monitor_binary   = monitor_binary_phys;
    core_data->monitor_binary_size = monitor_binary_size;
    core_data->memory_base_start = spawn_memory_identity.base;
    core_data->memory_bits       = spawn_memory_identity.bits;
    core_data->src_core_id       = disp_get_core_id();
    core_data->src_arch_id       = my_arch_id;
    core_data->dst_core_id       = coreid;


    struct frame_identity fid;
    err = invoke_frame_identify(kcb, &fid);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "Invoke frame identity for KCB failed. "
                            "Did you add the syscall handler for that architecture?");
    }
    DEBUG("%s:%s:%d: fid.base is 0x%"PRIxGENPADDR"\n",
           __FILE__, __FUNCTION__, __LINE__, fid.base);
    core_data->kcb = (genpaddr_t) fid.base;
#ifdef CONFIG_FLOUNDER_BACKEND_UMP_IPI
    core_data->chan_id           = chanid;
#endif

    if (cmdline != NULL) {
        // copy as much of command line as will fit
        snprintf(core_data->kernel_cmdline, sizeof(core_data->kernel_cmdline),
                "%s %s", cpuname, cmdline);
        // ensure termination
        core_data->kernel_cmdline[sizeof(core_data->kernel_cmdline) - 1] = '\0';

        DEBUG("%s:%s:%d: %s\n", __FILE__, __FUNCTION__, __LINE__, core_data->kernel_cmdline);
    }

    /* Invoke kernel capability to boot new core */
    if (cpu_type == CPU_X86_64 || cpu_type == CPU_K1OM) {
        start_aps_x86_64_start(hwid, foreign_cpu_reloc_entry);
    }

#ifndef __k1om__
    else if (cpu_type == CPU_X86_32) {
        start_aps_x86_32_start(hwid, foreign_cpu_reloc_entry);
    }
#endif

    /* Clean up */
    // XXX: Should not delete the remote caps?
    err = cap_destroy(spawn_memory_cap);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "cap_destroy failed");
    }
    err = vspace_unmap(cpu_buf_memory);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "vspace unmap CPU driver memory failed");
    }
    err = cap_destroy(cpu_memory_cap);
    if (err_is_fail(err)) {
        USER_PANIC_ERR(err, "cap_destroy failed");
    }

    return SYS_ERR_OK;
}
Exemplo n.º 16
0
int main(int argc, char **argv) {
	GetOpt opt(argc,argv,"8vfcSLBDs:l:b:d:o:r:");
	int c, rc;
	argv0 = argv[0];
	while ((c = opt()) != EOF) {
		switch (c) {
			case '8': // 8 byte serial #; for janet only.
				long_oids = 1;
			break;
			case 'v': // verbose
				verbose_flag = 1;
			break;
			case 'f' : //  overwrite existing module if found.
				overwrite_module = 1;
			break;
			case 'c' : //  syntax check only
				scheck_only = 1;
			break;
			case 'S': // read from standard input
				src_args[src_count++] = "-";
			break;
			case 'B': // print out language binding for all modules processed.
				bind_all = 1;
			break;
			case 'L': // link all modules processed  (from source).
				link_all = 1;
			break;
			case 'D':
				debug++;
			break;
			case 's':
				src_args[src_count++] = opt.optarg;
			break;
			case 'r':
				rm_args[rm_count++] = opt.optarg;
			break;
			case 'l':
				link_args[link_count++] = opt.optarg;
			break;
			case 'b':
				bind_args[bind_count++] = opt.optarg;
			break;
			case 'd':
				dir_args[dir_count++] = opt.optarg;
			break;
			case 'o':
				if (output_arg)	
				{
					cerr << "only one output file name allowed" <<endl;
					usage(argv[0]);
				}
				output_arg = opt.optarg;
			break;
			default:
				usage(argv[0]);
				return 1;
		}
	}
	int i;
	if (debug || verbose_flag) {
		fprintf(stderr,"sdl: command line was\n\t");
		for (i = 0; i < argc; i++)
			fprintf(stderr,"%s ",argv[i]);
		fprintf(stderr,"\n");

		if (src_count>0)
		{
			fprintf(stderr,"compiling sdl source files: ");
			for (i = 0; i<src_count; i++)
				fprintf(stderr,"%s ",src_args[i]);
			fprintf(stderr,"\n");
		}
		if (link_count>0)
		{
			fprintf(stderr,"linking moudles: ");
			for (i = 0; i<link_count; i++)
				fprintf(stderr,"%s ",link_args[i]);
			fprintf(stderr,"\n");
		}
		if (bind_count>0)
		{
			fprintf(stderr,"creating language binding for modules: ");
			for (i = 0; i<bind_count; i++)
				fprintf(stderr,"%s ",bind_args[i]);
			fprintf(stderr,"\n");
		}
		if (dir_count>0)
		{
			fprintf(stderr,"shore directory search path: ");
			for (i = 0; i<dir_count; i++)
				fprintf(stderr,"%s ",dir_args[i]);
			fprintf(stderr,"\n");
		}
		if ( bind_all)
			fprintf(stderr,"-B: printing language binding for all source processed\n");
		if ( link_all)
			fprintf(stderr,"-L: linking modules for all source processed\n");
		if ( overwrite_module)
			fprintf(stderr,"-f: deleting existing modules\n");
		if (scheck_only)
			fprintf(stderr,"-c: syntax check only\n");


	}
	// initialization:
	if (!scheck_only)
		metaobj_init(argc,argv);
	if (src_count)
		insert_rwords();
	if (dir_count)
	{
		w_rc_t crc;
		for (i=0; i<dir_count; i++)
			add_dir(dir_args[i]);
		// also, chdir to 1st dir arg, creating it if necessary.
		W_COERCE(Shore::begin_transaction(3));
		crc = Shore::chdir(dir_args[0]);
		if (crc)
		{
			if (crc.err_num() != SH_NotFound)
				crc.fatal(); //give up
			SH_DO(Shore::mkdir(dir_args[0],0755));
			SH_DO(Shore::chdir(dir_args[0]));
		}
		SH_DO(SH_COMMIT_TRANSACTION);
	}
	// first, remove anything specified by -r
	if (rm_count >0)
		rm_files(rm_count,rm_args);
		
	for (i = 0; i<src_count; i++) {
		if ((rc = process_src( src_args[i])))
			return rc;
		if (sdl_errors)
		{
			fprintf(stderr,"found %d errors processing sdl source file %s\n",
				sdl_errors,src_args[i]);
			return sdl_errors;
		}
	}
	if (src_count && (g_module_list!= 0)) // say what we created
	{
		char * m_dir = dir_count? dir_args[0]: "/types";
		W_COERCE(Shore::begin_transaction(3));
		Ref<sdlDeclaration> lpt;

		for (lpt = g_module_list; lpt != NULL; lpt = lpt->next)
			fprintf(stderr,"created module 	%s/%s\n",m_dir,(char *)lpt->name);
		SH_DO(SH_COMMIT_TRANSACTION);
	}
	if ( scheck_only && (link_count || bind_all || bind_count))
	{
		fprintf(stderr,"cannot link or bind with -c flag\n");
		return sdl_errors;
	}
	if (link_all)
		if (rc = link_all_modules())
			return rc;
	for (i = 0; i < link_count; i++) {
		if ((rc = process_link( link_args[i])))
			return rc;
	}
	if (bind_all) //orint all bindings from src module list
		if (rc = print_all_bindings())
			return rc;
	if (bind_count == 1) // old style binding printout
	{
		if ((rc = process_bind(bind_args[i])))
			return rc;
	}
	else if (bind_count > 0)
	{
		Set<Ref<sdlModule> > omods;
		W_COERCE(Shore::begin_transaction(3));
		
		for (i = 0; i < bind_count; i++) 
		{
			Ref<sdlModule> bmod;
			bmod = lookup_module(bind_args[i]);
			if (bmod == 0) // null value
			{
				cerr << "couldn't find module " <<  bind_args[i] << endl;
				break;
			}
			omods.add(bmod);
		}
		if (omods.get_size()>0 
			&& open_output_file(omods.get_elt(0)->name.string()) == 0)
				print_cxx_binding(omods);
		W_COERCE(SH_COMMIT_TRANSACTION);
	}
	return sdl_errors;
}
Exemplo n.º 17
0
/**
 * gwy_module_get_version:
 * @name: Module name.
 *
 * Obtains the version of a registered module.
 *
 * Returns: The version as a string owned by the module.
 **/
const gchar*
gwy_module_get_version(const gchar *name)
{
    ModuleInfo *modinfo = lookup_module(name, TRUE, FALSE);
    return modinfo ? modinfo->module_info->version : NULL;
}