예제 #1
0
파일: node.c 프로젝트: thenewwazoo/erl_poc
void process_msg(ErlMessage* emsg, int erl_fd)
{
    switch (emsg->type)
    {
    case (ERL_SEND):
    case (ERL_REG_SEND):
        TRACE(("msg type is ERL_[REG_]SEND"));
        process_send(emsg, erl_fd);
        break;
    case (ERL_LINK):
        TRACE(("msg type is ERL_LINK"));
        process_link(emsg);
        break;
    case (ERL_UNLINK):
        TRACE(("msg type is ERL_UNLINK"));
        process_unlink(emsg);
        break;
    case (ERL_EXIT):
    default:
        TRACE(("msg type is ERL_EXIT"));
        process_exit(emsg);
        break;
    }

    TRACE(("leaving process_msg"));
}
예제 #2
0
void events(ldp_connection_t *conn, pn_collector_t *coll) {
    pn_event_t *event;
    while((event = pn_collector_peek(coll))) {
        switch (pn_event_type(event)) {
        case PN_EVENT_NONE:
            break;
        case PN_CONNECTION_REMOTE_STATE:
        case PN_CONNECTION_LOCAL_STATE:
            process_connection(conn, event);
            break;
        case PN_SESSION_REMOTE_STATE:
        case PN_SESSION_LOCAL_STATE:
            process_session(conn, event);
            break;
        case PN_LINK_REMOTE_STATE:
        case PN_LINK_LOCAL_STATE:
            process_link(conn, event);
            break;
        case PN_LINK_FLOW:
            process_flow(conn, event);
            break;
        case PN_DELIVERY:
            process_delivery(conn, event);
            break;
        case PN_TRANSPORT:
            process_transport(conn, event);
            break;

        }
        pn_collector_pop(coll);
    }
}
  /// /////////////////////////////////////////////////////////////////////////////
  /// @brief load URDF model description from string and create search operations data structures
  void URDFRenderer::loadURDFModel
    (urdf::Model &model)
  {
    typedef std::vector<boost::shared_ptr<urdf::Link> > V_Link;
    V_Link links;
    model.getLinks(links);

    V_Link::iterator it = links.begin();
    V_Link::iterator end = links.end();

    for (; it != end; ++it)
      process_link (*it);
  }
예제 #4
0
void TopologyController::process(const GstDebugger::TopologyInfo& topology)
{
	lock_topology();

	switch (topology.topology_type_case())
	{
	case GstDebugger::TopologyInfo::kElement:
		process_element(topology.element(), topology.action());
		break;
	case GstDebugger::TopologyInfo::kPad:
		process_pad(topology.pad(), topology.action());
		break;
	case GstDebugger::TopologyInfo::kLink:
		process_link(topology.link(), topology.action());
		break;
	default:
		break;
	}

	unlock_topology();
}
예제 #5
0
파일: main.C 프로젝트: glycerine/shore-mt
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;
}