Exemplo n.º 1
0
void test_module_deps(){
	spm oo = make_module("OO");
	spm ad1 = make_module("AD1");
	ad1->add(oo);
	ASSERT(!ad1->is_ready());
	ad1->done_with(oo);
	ASSERT(ad1->is_ready());
}
Exemplo n.º 2
0
void test_deep_name_comare(){
	spm l=make_module("AA");
	spm r=make_module("BB");
	deep_name_compare cmp{};
	ASSERT(cmp(l,r));
	ASSERT(!cmp(r,l));
	ASSERT(!cmp(l,l));
	ASSERT(cmp(nullptr,l));
	ASSERT(!cmp(l,nullptr));
	ASSERT(!cmp(nullptr,nullptr));
}
TEST(api_module, global_syx_ref__refer_exported_symbol_of_imported_module__restrictive)
{
  ScmObj sym = SCM_OBJ_INIT, syx = SCM_OBJ_INIT, actual = SCM_OBJ_INIT;

  SCM_REFSTK_INIT_REG(&sym, &syx, &actual);

  sym = scm_make_symbol_from_cstr("var", SCM_ENC_ASCII);
  syx = SCM_EOF_OBJ;

  make_module("imp");
  make_module("test");
  import_module("imp", true);
  find_module("imp");

  TEST_ASSERT_EQUAL_INT(0, scm_capi_define_global_syx(module, sym, syx, true));

  find_module("test");

  TEST_ASSERT_EQUAL_INT(0, scm_capi_refer_global_syx(module,
                                                     sym, SCM_CSETTER_L(actual)));
  TEST_ASSERT_SCM_EQ(syx, actual);
}
TEST(api_module, global_syx_ref__unbound)
{
  ScmObj sym = SCM_OBJ_INIT, actual = SCM_OBJ_INIT;

  SCM_REFSTK_INIT_REG(&sym, &actual);

  sym = scm_make_symbol_from_cstr("var", SCM_ENC_ASCII);

  make_module("test");

  TEST_ASSERT_EQUAL_INT(0, scm_capi_refer_global_syx(module,
                                                     sym, SCM_CSETTER_L(actual)));
  TEST_ASSERT_SCM_NULL(actual);
}
Exemplo n.º 5
0
static orte_rml_base_module_t* open_conduit(opal_list_t *attributes)
{
    char *comp_attrib = NULL;
    char **comps;
    int i;
    orte_attribute_t *attr;

    opal_output_verbose(20,orte_rml_base_framework.framework_output,
                    "%s - Entering rml_oob_open_conduit()",
                    ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));

    /* someone may require this specific component, so look for "oob" */
    if (orte_get_attribute(attributes, ORTE_RML_INCLUDE_COMP_ATTRIB, (void**)&comp_attrib, OPAL_STRING) &&
        NULL != comp_attrib) {
        /* they specified specific components - could be multiple */
        comps = opal_argv_split(comp_attrib, ',');
        for (i=0; NULL != comps[i]; i++) {
            if (0 == strcmp(comps[i], "oob")) {
                /* we are a candidate */
                opal_argv_free(comps);
                return make_module();
            }
        }
        /* we are not a candidate */
        opal_argv_free(comps);
        return NULL;
    } else if (orte_get_attribute(attributes, ORTE_RML_EXCLUDE_COMP_ATTRIB, (void**)&comp_attrib, OPAL_STRING) &&
               NULL != comp_attrib) {
        /* see if we are on the list */
        comps = opal_argv_split(comp_attrib, ',');
        for (i=0; NULL != comps[i]; i++) {
            if (0 == strcmp(comps[i], "oob")) {
                /* we cannot be a candidate */
                opal_argv_free(comps);
                return NULL;
            }
        }
    }

    /* Alternatively, check the attributes to see if we qualify - we only handle
     * "routed", "Ethernet", and "TCP" */
    OPAL_LIST_FOREACH(attr, attributes, orte_attribute_t) {

    }

    /* if we get here, we cannot handle it */
    return NULL;
}
TEST(api_module, define_global_syx)
{
  ScmObj sym = SCM_OBJ_INIT, syx = SCM_OBJ_INIT, actual = SCM_OBJ_INIT;

  SCM_REFSTK_INIT_REG(&sym, &syx, &actual);

  sym = scm_make_symbol_from_cstr("var", SCM_ENC_ASCII);
  syx = SCM_EOF_OBJ;

  make_module("test");

  TEST_ASSERT_EQUAL_INT(0, scm_capi_define_global_syx(module, sym, syx, false));
  TEST_ASSERT_EQUAL_INT(0, scm_capi_refer_global_syx(module,
                                                     sym, SCM_CSETTER_L(actual)));
  TEST_ASSERT_SCM_EQ(syx, actual);
}
Exemplo n.º 7
0
int main(int argc, char **argv){
	char *module_type;
	if(argc < 2 ){
		printf("Usage : ./ngx_tool <module_name>\n");
		return 1;	
	}

	if(argc >= 3){
		module_type = argv[2];	
	} else {
		module_type = "handler";
	}

	printf("\n^_^  Hello. Begin make module %s \n\n",argv[1]);
	make_module(argv[1],argv[2]);
	return 0;
}
Exemplo n.º 8
0
/* read_symbols -- read symbol table */
static void read_symbols(int dseg) {
     int kind; char *name; uchar *addr;
     int chksum, nlines;
     int nm = 0, np = 0, i;
     const char *kname;
	  
     modtab = (module *) scratch_alloc(nmods * sizeof(module), FALSE);
     proctab = (proc *) scratch_alloc(nprocs * sizeof(proc), FALSE);

     for (i = 0; i < nsyms; i++) {
	  kind = read_int();
	  name = read_string(); 

	  switch (kind) {
	  case X_MODULE:
	       kname = "Module";
	       addr = dmem + read_int(); 
	       chksum = read_int();
	       nlines = read_int();
	       modtab[nm++] = make_module(name, addr, chksum, nlines);
	       break;

	  case X_PROC:
	       kname = "Proc";
	       addr = dmem + read_int(); 
	       proctab[np++] = make_proc(name, addr);
	       break;
		    
	  case X_DATA:
	       kname = "Data";
	       addr = dmem + read_int(); 
	       make_symbol("data", name, addr);
	       break;

	  case X_LINE:
	       kname = "Line";
	       addr = imem + read_int();
	       make_symbol("line", name, addr);
	       break;

	  default:
	       kname = "Unknown"; addr = NULL;
	       panic("*bad symbol %s", name);
	  }

#ifdef DEBUG
	  if (dflag) printf("%s %s = %p\n", kname, name, addr);
#endif
     }

     if (nm != nmods || np != nprocs)
	  panic("*symbol counts don't match (mods %d/%d, procs %d/%d)\n",
		nm, nmods, np, nprocs);

     /* Calculate module lengths */
     addr = dmem + dseg;
     for (i = nmods-1; i >= 0; i--) {
	  modtab[i]->m_length = addr - modtab[i]->m_addr;
	  addr = modtab[i]->m_addr;
#ifdef DEBUG
	  if (dflag)
	       printf("Module %s has size %d\n", 
		      modtab[i]->m_name, modtab[i]->m_length);
#endif
     }
}