예제 #1
0
파일: Surface.cpp 프로젝트: edeforas/Astree
Surface& Surface::operator=(const Surface& rSurf)
{
    _pMaterialNext=0;
    _pMaterialPrev=0;

    set_type(rSurf.type());
    set_conic(rSurf.conic());
    set_radius_curvature(rSurf.radius_curvature());

    set_R4(rSurf.R4());
    set_R6(rSurf.R6());
    set_R8(rSurf.R8());
    set_R10(rSurf.R10());

    set_comment(rSurf.comment());

    set_x(rSurf.x());
    set_y(rSurf.y());
    set_z(rSurf.z());

    set_diameter(rSurf.diameter());
    set_auto_diameter(rSurf.get_auto_diameter());

    set_inner_diameter(rSurf.inner_diameter());
    set_auto_inner_diameter(rSurf.get_auto_inner_diameter());

    return *this;
}
예제 #2
0
MuContacts*
mu_contacts_new (const gchar *path)
{
	MuContacts *self;

	g_return_val_if_fail (path, NULL);
	self = g_new0 (MuContacts, 1);

	self->_path = g_strdup (path);
	self->_hash = g_hash_table_new_full
		(g_str_hash, g_str_equal, g_free,
		 (GDestroyNotify)contact_info_destroy);

	self->_ccache  = load_key_file (path);
	if (!self->_ccache || !set_comment (self->_ccache)) {
		mu_contacts_destroy (self);
		return NULL;
	}
	deserialize_cache (self);
	MU_WRITE_LOG("deserialized contacts from cache %s",
		     path);

	self->_dirty = FALSE;
	return self;
}
예제 #3
0
파일: cell.cpp 프로젝트: fhaoquan/xlnt
XLNT_FUNCTION void cell::set_value(cell c)
{
    d_->type_ = c.d_->type_;
    d_->value_numeric_ = c.d_->value_numeric_;
    d_->value_string_ = c.d_->value_string_;
    d_->hyperlink_ = c.d_->hyperlink_;
    d_->has_hyperlink_ = c.d_->has_hyperlink_;
    d_->formula_ = c.d_->formula_;
    d_->style_id_ = c.d_->style_id_;
    set_comment(c.get_comment());
}
예제 #4
0
nl_convert_eagle_t::tokenizer::tokenizer(nl_convert_eagle_t &convert, plib::putf8_reader &strm)
	: plib::ptokenizer(strm)
	, m_convert(convert)
{
	set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-");
	set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers
	set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13));
	/* FIXME: gnetlist doesn't print comments */
	set_comment("/*", "*/", "//");
	set_string_char('\'');
	m_tok_ADD = register_token("ADD");
	m_tok_VALUE = register_token("VALUE");
	m_tok_SIGNAL = register_token("SIGNAL");
	m_tok_SEMICOLON = register_token(";");
	/* currently not used, but required for parsing */
	register_token(")");
	register_token("(");
}
예제 #5
0
nl_convert_rinf_t::tokenizer::tokenizer(nl_convert_rinf_t &convert, plib::putf8_reader &strm)
	: plib::ptokenizer(strm)
	, m_convert(convert)
{
	set_identifier_chars(".abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_-");
	set_number_chars("0123456789", "0123456789eE-."); //FIXME: processing of numbers
	set_whitespace(pstring("").cat(' ').cat(9).cat(10).cat(13));
	/* FIXME: gnetlist doesn't print comments */
	set_comment("","","//"); // FIXME:needs to be confirmed
	set_string_char('"');
	m_tok_HEA = register_token(".HEA");
	m_tok_APP = register_token(".APP");
	m_tok_TIM = register_token(".TIM");
	m_tok_TYP = register_token(".TYP");
	m_tok_ADDC = register_token(".ADD_COM");
	m_tok_ATTC = register_token(".ATT_COM");
	m_tok_NET = register_token(".ADD_TER");
	m_tok_TER = register_token(".TER");
	m_tok_END = register_token(".END");
}
예제 #6
0
파일: Surface.cpp 프로젝트: edeforas/Astree
bool Surface::set_type(string sType)
{
    assert(sType!="");
    if ( (sType!="reflect") && (sType!="stop") && (sType!="image") && (sType!="image_infinite") && (sType!="transmit") && (sType!="void") && (sType!="perfect_lens") && (sType!="perfect_mirror") )
    {
        //test if glass exist
        bool bExist=GlassManager::singleton().exist(sType);
        if(!bExist)
            set_comment("Glass "+sType+" doesn't exist in catalog!");

        GlassManager::singleton().destroy(_pMaterial);
        _pMaterial=GlassManager::singleton().create(sType);
    }
    else
        _pMaterial=0;

    _sType=sType;
    _bIsPerfect = ((sType=="perfect_lens") || (sType=="perfect_mirror"));

    return true;
}
예제 #7
0
BOOL CKInputDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	TCHAR* date_format=_T("yyyy'-'MM'-'dd");

	init_var();

	m_ngay.SetFormat(date_format);
	m_ngayKT.SetFormat(date_format);

	create_flags();
	//an cac ctrl ko dung va set label cho các edit
	hideCtrl();
	set_comment();
	//set total row va tao col cho list view
	create_list_cols();
	m_resList.SetExtendedStyle(m_resList.GetExtendedStyle() 
		| LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES);
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}
예제 #8
0
파일: m16cvec.cpp 프로젝트: Ashatta/tools
/*
 * M30262F8FG(OAKS16 MINI)のベクトルを設定する
 */
static void set_M30262F8FG(FILE* pfo, int no, int m)
{
	int i;

	set_comment(pfo, int_vec);
	fputs("\t.section\tvector", pfo);
	fputs(lf, pfo);
	set_org(pfo, "VECTOR_ADR");
	fputs(";", pfo);
	fputs(lf, pfo);
	set_vector(pfo, INT_STATE, 0);
	set_org(pfo, "(VECTOR_ADR+44)");
	fputs(lf, pfo);
	for(i = 11 ; i < 15 ; i++)
		set_vector(pfo, INT_STATE, i);
	set_org(pfo, "(VECTOR_ADR+68)");
	fputs(lf, pfo);
	if(m < MAX_INT)
		m = MAX_INT;
	for(i = 17 ; i < m ; i++)
		set_vector(pfo, INT_STATE, i);
}
예제 #9
0
/*
 * Inititialise input stacks, and quote/comment characters.
 */
void
input_init (void)
{
  current_file = "NONE";
  current_line = 0;

  obstack_init (&token_stack);
  obstack_init (&input_stack);
  obstack_init (&wrapup_stack);

  current_input = &input_stack;

  obstack_1grow (&token_stack, '\0');
  token_bottom = obstack_finish (&token_stack);

  isp = NULL;
  wsp = NULL;
  next = NULL;

  start_of_input_line = FALSE;

  set_quotes (NULL, NULL);
  set_comment (NULL, NULL);
}
예제 #10
0
파일: m16cvec.cpp 프로젝트: Ashatta/tools
/*
 * set_M30620FCAFP(OAKS16)用のベクトルを設定する
 */
static void set_M30620FCAFP(FILE* pfo, int no, int m)
{
#ifdef OAKS16_JSP13
	struct VEC *v;
	int x;
#endif /* OAKS16_JSP13 */
	int i;

#ifdef OAKS16_JSP13
	if(no == 2){
		set_global(pfo, in_portid);
		set_global(pfo, out_portid);
		fputs(lf, pfo);
		fputs(func01, pfo);
		fputs(lf, pfo);
		fputs("_", pfo);
		fputs(in_portid, pfo);
		fputs(":", pfo);
		fputs(lf, pfo);
		fputs(func02, pfo);
		fputs(lf, pfo);
		fputs("_", pfo);
		fputs(out_portid, pfo);
		fputs(":", pfo);
		fputs(lf, pfo);
		fputs(func02, pfo);
		fputs(lf, pfo);
		fputs(lf, pfo);
		v = &vec_table[0][0];
		for(i = x = 0 ; i < num_vec[0] ; i++, v++){
			if(v->no >= 17 && v->no < 21){
				x = 1;
				break;
			}
		}
		if(x){
			fputs(func03, pfo);
			fputs(lf, pfo);
			v = &vec_table[0][0];
			for(i = x = 0 ; i < num_vec[0] ; i++, v++){
				if(v->no == 17 || v->no == 19){
					fputs(out_handler, pfo);
					fputs("1:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#1, _", pfo);
					fputs(out_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					fputs(out_handler, pfo);
					fputs("2:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#2, _", pfo);
					fputs(out_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					break;
				}
			}
			v = &vec_table[0][0];
			for(i = x = 0 ; i < num_vec[0] ; i++, v++){
				if(v->no == 18 || v->no == 20){
					fputs(in_handler, pfo);
					fputs("1:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#1, _", pfo);
					fputs(in_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					fputs(in_handler, pfo);
					fputs("2:", pfo);
					fputs(lf, pfo);
					fputs("\tmov.w\t#2, _", pfo);
					fputs(in_portid, pfo);
					fputs(lf, pfo);
					fputs("\tjmp\t_", pfo);
					fputs(v->no_label, pfo);
					fputs(lf, pfo);
					break;
				}
			}
		}
	}
#endif /* OAKS16_JSP13 */

	set_comment(pfo, int_vec);
	fputs("\t.section\tvvector", pfo);
	fputs(lf, pfo);
	set_org(pfo, "VECTOR_ADR");
	for(i = 0 ; i < MAX_INT ; i++){
		if(no == 2){
			if(i >= 17 && i < 21)
				set_vector2(pfo, INT_STATE, i);
			else
				set_vector(pfo, INT_STATE, i);
		}
		else
			set_vector(pfo, INT_STATE, i);
	}
}
예제 #11
0
파일: m16cvec.cpp 프로젝트: Ashatta/tools
int main(int argc, char* argv[])
{
	FILE* pfi;
	FILE* pfo;
	FILE* pfw;
	char  buf[BUF_SIZE];
	struct VEC *v;
	int   i, j, k;
	bool  cnv, dec;
	char* s;
	char* p;
	char* q;
	char  c;

	strcpy(input_file, default_input_file);
	strcpy(output_file, default_output_file);
	strcpy(unused_vec[0], default_unused_int);
	strcpy(unused_vec[1], default_unused_int);
	strcpy(fvector,default_fvector);

	for(i = 1 ; i < argc ; i++){
		s = argv[i];
		if(*s++ == '-'){
			c = *s++;
			skip_space(&s);
			switch(c){
			case 'I':		// インクルードファイルの設定
			case 'i':
				if(num_include < MAX_INCLUDE){
					strcpy(include_file[num_include], s);
					num_include++;
				}
				break;
			case 'F':		// フィックスベクタの定義
			case 'f':
				strcpy(fvector, s);
				break;
			case 'O':		// アウトプットファイルの設定
			case 'o':
				strcpy(output_file, s);
				break;
			case 'R':		// インプットファイルの設定
			case 'r':
				strcpy(input_file, s);
				break;
			case 'M':		// ボードモード
			case 'm':
				board_mode = atoi(s);
				break;
			default:
				printf("m16cvec -R<input_file> -O<output_file> -I<include_file> -M<mode> -F<fixvector>\n");
				break;
			}
		}
	}
	printf("version      = %s\n", version);
	printf("input file   = %s\n", input_file);
	printf("output file  = %s\n", output_file);
	printf("Fix Vector   = %s\n", fvector);
	printf("board mode   = %d : ", board_mode);
	if(board_mode == 1)
		printf("M30262F8FG(OAKS16 MINI)\n");
	else
		printf("M30620FCAFP(OAKS16)\n");
	if((pfi = fopen(input_file, "r")) == NULL){
		fprintf(stderr, "can't open input file !");
		exit(1);
	}
	if((pfo = fopen(output_file, "w")) == NULL){
		fclose(pfi);
		fprintf(stderr, "can't open output file !");
		exit(1);
	}
	for(i = 0 ; i < num_include ; i++){
		printf("include file = %s\n", include_file[i]);
	}
	for(;;){
		if((fgets(buf, BUF_SIZE, pfi)) == NULL)
			break;
		s = buf;
		switch(vec_state){
		case INT_STATE:
		case EXC_STATE:
			if(test_string(&s, ";"))
				vec_state = NORMAL_STATE;
			else if(test_string(&s, "{")){
				v = &vec_table[vec_state][num_vec[vec_state]];
				p = &v->no_name[0];
				if(skip_space(&s))
					continue;
				dec = true;
				while(*s != ','){
					if(*s == 0)
						continue;
					if(*s == '(' || *s == ')' || *s <= ' '){
						s++;
						continue;
					}
					if(*s < '0' || *s > '9')
						dec = false;
					*p++ = *s++;
				}
				s++;
				*p++ = 0;
				if(dec)
					v->no = atoi(v->no_name);
				else{
					v->no = -1;
					num_nodec++;
				}
				p = &v->no_label[0];
				if(skip_char(&s, ','))
					continue;
				test_string(&s, "INT_ENTRY(");
				test_string(&s, "EXC_ENTRY(");
				test_string(&s, "CFG_INT_ENTRY(");
				test_string(&s, "CFG_EXC_ENTRY(");
				test_string(&s, "(FP)");
				if(skip_space(&s))
					continue;
				while(*s != ')' && *s != ',' && *s > ' '){
					*p++ = *s++;
				}
				*p++ = 0;
				num_vec[vec_state]++;
			}
			else
				continue;
			break;
		default:
			if(!test_string(&s, "const"))
				continue;
			if(test_string(&s, "INHINIB"))
				vec_state = INT_STATE;
			else if(test_string(&s, "EXCINIB"))
				vec_state = EXC_STATE;
			break;
		}
	}
	do{
		cnv = false;
		for(i = 0 ; i < num_include ; i++){
			if((pfw = fopen(include_file[i], "r")) != NULL){
				for(;;){
					if((fgets(buf, BUF_SIZE, pfw)) == NULL)
						break;
					s = buf;
					if(!test_string(&s, "#define"))
						continue;
					if(skip_space(&s))
						continue;
					for(k = 0 ; k < 2 ; k++){
						for(j = 0 ; j < num_vec[k] ; j++){
							v = &vec_table[k][j];
							if(v->no < 0){
								p = s;
								dec = true;
								if(test_string(&p, v->no_name)){
									q = &v->no_name[0];
									if(!skip_space(&p)){
										while(*p > ' '){
											if(*p == '(' || *p == ')'){
												p++;
												continue;
											}
											if(*p < '0' || *p > '9')
												dec = false;
											*q++ = *p++;
										}
									}
									*q++ = 0;
								}
								else
									dec = false;
								if(dec){
									v->no = atoi(v->no_name);
									num_nodec--;
								}
							}
						}
					}
				}
				fclose(pfw);
			}
			else
				printf("open error %s !!\n", include_file[i]);
		}
	}while(cnv);

	for(i = 0 ; i < num_vec[EXC_STATE] ; i++){
		v = &vec_table[EXC_STATE][i];
		if(v->no >= 32 && v->no < MAX_INT){
			vec_table[INT_STATE][num_vec[INT_STATE]] = vec_table[EXC_STATE][i];
			num_vec[INT_STATE]++;
			for(j = i ; j < (num_vec[EXC_STATE]-1) ; j++)
				vec_table[EXC_STATE][j] = vec_table[EXC_STATE][j+1];
			num_vec[EXC_STATE]--;
		}
	}
	for(j = 0 ; j < num_vec[INT_STATE] ; j++){
		v = &vec_table[INT_STATE][j];
		if(v->no >= MAX_INT)
			strcpy(unused_vec[INT_STATE], v->no_label);
		else if(max_int < v->no)
			max_int = v->no;
		printf("int %d:%d,%s,%s\n", j, v->no, v->no_name, v->no_label);
	}
	for(j = 0 ; j < num_vec[EXC_STATE] ; j++){
		v = &vec_table[EXC_STATE][j];
		if((v->no >= MAX_EXC && v->no < 32) || v->no >= MAX_INT)
			strcpy(unused_vec[EXC_STATE], v->no_label);
		printf("exc %d:%d,%s,%s\n", j, v->no, v->no_name, v->no_label);
	}
	if(num_nodec > 0)
		printf("%dのエクセプション番号を特定できません!\n", num_nodec);
	else{
		fputs(lf, pfo);
		for(i = 0 ; i < 2 ; i++){
			for(j = 0 ; j < num_vec[i] ; j++)
				set_global(pfo, vec_table[i][j].no_label);
		}
		if(!strcmp(default_unused_int, unused_vec[0]))
			set_global(pfo, unused_vec[0]);
		else if(!strcmp(default_unused_int, unused_vec[1]))
			set_global(pfo, unused_vec[1]);

		switch(board_mode){
		case 1:				// M30262F8FG(OAKS16 MINI)
			set_M30262F8FG(pfo, board_mode, max_int);
			break;
		default:			// M30620FCAFP(OAKS16)
			set_M30620FCAFP(pfo, board_mode, max_int);
			break;
		}

		set_comment(pfo, exc_vec);
		fputs("\t.section\tfvector", pfo);
		fputs(lf, pfo);
		set_org(pfo, fvector);

		for(i = 0 ; i < (MAX_EXC-1) ; i++)
			set_vector(pfo, EXC_STATE, i);
		fputs("\t.lword\t_hardware_start\t\t\t; RESET", pfo);
		fputs(lf, pfo);
	}
	fclose(pfi);
	fclose(pfo);
	return 0;
}
예제 #12
0
Comment::Comment(std::string cmt, address_t addr)
{
	set_address(addr);
	set_comment(cmt);
}
예제 #13
0
파일: nl_parser.c 프로젝트: hstampfl/mame
bool netlist_parser::parse(const char *buf, const pstring nlname)
{
    m_buf = buf;

    reset(buf);
    set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-");
    set_number_chars("01234567890eE-."); //FIXME: processing of numbers
    char ws[5];
    ws[0] = ' ';
    ws[1] = 9;
    ws[2] = 10;
    ws[3] = 13;
    ws[4] = 0;
    set_whitespace(ws);
    set_comment("/*", "*/", "//");
    m_tok_param_left = register_token("(");
    m_tok_param_right = register_token(")");
    m_tok_comma = register_token(",");

    m_tok_ALIAS = register_token("ALIAS");
    m_tok_NET_C = register_token("NET_C");
    m_tok_PARAM = register_token("PARAM");
    m_tok_NET_MODEL = register_token("NET_MODEL");
    m_tok_INCLUDE = register_token("INCLUDE");
    m_tok_SUBMODEL = register_token("SUBMODEL");
    m_tok_NETLIST_START = register_token("NETLIST_START");
    m_tok_NETLIST_END = register_token("NETLIST_END");

    bool in_nl = false;

    while (true)
    {
        token_t token = get_token();

        if (token.is_type(ENDOFFILE))
        {
            return false;
            //error("EOF while searching for <%s>", nlname.cstr());
        }

        if (token.is(m_tok_NETLIST_END))
        {
            require_token(m_tok_param_left);
            if (!in_nl)
                error("Unexpected NETLIST_END");
            else
            {
                in_nl = false;
            }
            require_token(m_tok_param_right);
        }
        else if (token.is(m_tok_NETLIST_START))
        {
            if (in_nl)
                error("Unexpected NETLIST_START");
            require_token(m_tok_param_left);
            token_t name = get_token();
            require_token(m_tok_param_right);
            if (name.str() == nlname || nlname == "")
            {
                parse_netlist(name.str());
                return true;
            } else
                in_nl = true;
        }
    }
}
예제 #14
0
int main(int argc, const char *argv[])
{ 
    tm_cmd_t ipc_cmd;
    char i;
    int fd, opt_idx, c, max_pnl=PNL_NUM;
    char *short_opts = "p:sa:n:e:f:chvC:T:b:i:";
    pid_t pid;

    if(argc == 1)
        tm_test_usage();

    memset((char*)&ipc_cmd, 0, sizeof(tm_cmd_t));

    while ((c = getopt_long(argc, (char* const*)argv, short_opts, long_opts, &opt_idx)) != -1)
    {
        switch(c)
        {
            case 'C':
                memcpy(client_name, optarg, strlen(optarg));
                break;
            case 'T':
                memcpy(target_name, optarg, strlen(optarg));
                break;
            case 'b':
                ttm.arg.bind.set=1;
                memcpy(bind_buf, optarg, strlen(optarg));
                break;
            case 'a':
                ttm.arg.ap.set = 1;
                memcpy(ap_buf, optarg, strlen(optarg));
                break;
            case 'n':
                ttm.set_pnl_num = 1;
                ttm.pnl_num = optarg[0] - '0';
                break;
            case 'e':
                ttm.arg.evt.set = 1;
                memcpy(evt_buf, optarg, strlen(optarg));
                break;
            case 'f':
                ttm.arg.fb.set = 1;
                memcpy(fb_buf, optarg, strlen(optarg));
                break;
            case 'i':
                ttm.arg.pnl_evt.set = 1;
                memcpy(pnl_evt_buf, optarg, strlen(optarg));
                break;
            case 'c':
                ttm.calibrate = 1;
                break;
            case 'p':
                ttm.pnl_arg = optarg[0] - '0';
                break;
            case 's':
                ttm.split = 1;
                break;
            case 'h':
                tm_test_usage();
                break;
            case 'v':
                tm_test_version();
                break;
            default:
                break;
        }
    }

    parse_options();

#if TEST_DEBUG
    show_args_for_debug();
#endif

    if(ttm.calibrate)
    {
        tm_calibrate();
        return 0;
    }

    if(ttm.set_pnl_num)
        max_pnl = ttm.pnl_num;
    
    if(ttm.pnl_arg < 0 || ttm.pnl_arg > max_pnl)
    {
        printf("set panel error\n");
        tm_test_usage();
    }    

    if(!ttm.arg.ap.set)
    {
        printf("no set ap\n");
        return 0;
    }

    signal(SIGSEGV, sig);
    signal(SIGINT, sig);
    signal(SIGTERM, sig);

    ttm.mode =  ttm.arg.ap.num - 1;

    set_ttm();
    set_button_num(ttm.arg.ap.num + 3);
    set_comment();

    // set fb position
    for (i = 0; i < max_pnl; i++) 
    {
        printf("panel %d pan : %s\n",i,ttm.fb[(int)i].pan);
        printf("panel %d fb  : %s\n",i,ttm.fb[(int)i].dev);
        printf("panel %d evt : %s\n",i,ttm.evt[(int)i].dev);
        if((fd=open(ttm.fb[(int)i].pan, O_RDWR))>=0)
        {
            if (write(fd, "0,0", 3)<0) {
                dbg_log("write pan error, pan : %s",ttm.fb[(int)i].pan);
            }
            close(fd);
        }
        else
        {
            printf("open pan error\n");
        }
#if 1      
        pid = fork();
        if (pid == -1) 
        {
            printf("fork %d error \n", i);
        }
        else if (pid == 0)
        {
            ts_test(&ttm.fb[(int)i], &ttm.evt[(int)i]);
            _exit(0);
        }
#endif
    }
  
    if(open_ipc())
        return 0;

//    ipc_cmd.general.hdr=0xd0;
//    ipc_cmd.len=1;
//    ttm.wait_ver=1;
//    send_ipc(&ipc_cmd);
//
//    while(ttm.wait_ver)
//        sleep(1);

    // set ap display
    

    for (i = 0; i < 3; i++) 
    {
        if(ttm.mode == MONO_AP)
        {
            ipc_cmd.stretch.hdr=0xa1;
            ipc_cmd.stretch.panel=i;
            ipc_cmd.stretch.ap=ttm.arg.ap.data[0];
            ipc_cmd.len=3;
            send_ipc(&ipc_cmd);
        }
        else
        {	
            ipc_cmd.clear.hdr=0xa2;
            ipc_cmd.clear.panel=i;
            ipc_cmd.len=2;
            
            send_ipc(&ipc_cmd);
      
            for(int j=0; j<ttm.arg.ap.num; j++)
            {
                ipc_cmd.append.hdr=0xa0;
                ipc_cmd.append.panel=i;
                ipc_cmd.append.ap=ttm.arg.ap.data[j];

                set_pnl_append_cmd(&ipc_cmd.append, j);
                set_ap_append_cmd(&ipc_cmd.append, j);
               
                ipc_cmd.len=11;

                send_ipc(&ipc_cmd);
            }
        }
    }

    if(g_ipc.server)
    {
        lst_close_channel(g_ipc.server);
        g_ipc.server = NULL;
    }

    return 0;
}
예제 #15
0
bool BrowserNode::tool_cmd(ToolCom * com, const char * args) {
  switch ((unsigned char) args[-1]) {
  case applyCmd:
  {
      QLOG_FATAL() << Q_FUNC_INFO << "If this got called then we have a logic flaw going on and BrowserNode needs to have Q_OBJECT in it to properly catch ToolCom::Run execution result";
      Q_ASSERT_X(0, "applyCmd happened", "very bad");
      int runResult = ToolCom::run(args, this, FALSE, FALSE);
      com->write_unsigned(runResult);
      break;
  }
  case createCmd:
    // invalid creation
    com->write_id(0);
    break;
  case parentCmd:
    if (this != BrowserView::get_project())
      ((BrowserNode *) parent())->write_id(com);
    else
      com->write_id(0);
    break;
  case childrenCmd:
    {
      unsigned v = com->api_format();
      unsigned n = 0;
      Q3ListViewItem * child;
      
      for (child = firstChild(); child != 0; child = child->nextSibling())
	if (!((BrowserNode *) child)->deletedp() &&
	    ((BrowserNode *) child)->api_compatible(v))
	  n += 1;
      
      com->write_unsigned(n);
      
      for (child = firstChild(); child != 0; child = child->nextSibling())
	if (!((BrowserNode *) child)->deletedp() &&
	    ((BrowserNode *) child)->api_compatible(v))
	  ((BrowserNode *) child)->write_id(com);
    }
    break;
  case getDefCmd:
  case getUmlDefCmd:
  case getCppDefCmd:
  case getJavaDefCmd:
  case getPhpDefCmd:
  case getPythonDefCmd:
  case getIdlDefCmd:
    get_data()->send_uml_def(com, this, comment);
    break;
  case isWritableCmd:
    com->write_bool(!is_read_only);
    break;
  case supportFileCmd:
    // goes up to the package
    return ((BrowserNode *) parent())->tool_cmd(com, args);
  case isOpenCmd:
    com->write_bool(isOpen());
    break;
  case referencedByCmd:
    {
      BrowserNodeList targetof;
      
      referenced_by(targetof);
      // remove duplicats
      targetof.sort_it();
      
      BrowserNode * bn;
      
      targetof.first();
      while ((bn = targetof.current()) != 0)
	if (bn == targetof.next())
	  targetof.remove();
      
      com->write_unsigned(targetof.count());
      
      for (bn = targetof.first(); bn != 0; bn = targetof.next())
	bn->write_id(com);
    }
    break;
  case setCoupleValueCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      set_value(args, args + strlen(args) + 1);
      package_modified();
      get_data()->modified();
      com->write_ack(TRUE);
    }
    break;
  case setDescriptionCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      set_comment(args);
      package_modified();
      com->write_ack(TRUE);
    }
    break;
  case setNameCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      if (name != args) {
	if (((BrowserNode *) parent())->wrong_child_name(args, get_type(),
							 allow_spaces(),
							 allow_empty())) {
	  com->write_ack(FALSE);
	  return TRUE;
	}
	else {
	  set_name(args);
	  update_stereotype();
	  package_modified();
	  get_data()->modified();
	}
      }
      com->write_ack(TRUE);
    }
    break;
  case setOpenCmd:
    BrowserView::select(this);
    setOpen(*args);
    com->write_ack(TRUE);
    break;
  case setMarkedCmd:
    if (*args) {
      if (this == BrowserView::get_project())
	com->write_ack(FALSE);
      else {
	if (!is_marked)
	  toggle_mark();
	com->write_ack(TRUE);
      }
    }
    else {
      if (is_marked)
	toggle_mark();
      com->write_ack(TRUE);
    }
    break;
  case moveAfterCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      BrowserNode * p = (BrowserNode *) parent();
      BrowserNode * after = (BrowserNode *) com->get_id(args);
      
      if (after == 0) {
	if (p == 0)
	  com->write_ack(FALSE);
	else {
	  p->takeItem(this);
	  p->insertItem(this);
	  com->write_ack(TRUE);
	  p->package_modified();
	}
      }
      else if ((after->parent() != p) ||
	       (after == this)) {
	com->write_ack(FALSE);
      }
      else {
	moveItem(after);
	com->write_ack(TRUE);
	p->package_modified();
      }
    }
    break;
  case moveInCmd:
    // plug-out upgrade, limited checks
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      BrowserNode * newparent = (BrowserNode *) com->get_id(args);
      BrowserNode * oldparent = (BrowserNode *) parent();
      
      if ((newparent == oldparent) || (newparent == this)) {
	com->write_ack(FALSE);
      }
      else {
	oldparent->takeItem(this);
	newparent->insertItem(this);
	com->write_ack(TRUE);
	oldparent->package_modified();
	newparent->package_modified();
      }
    }
    break;
  case old_deleteCmd:
  case deleteCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      delete_it();
      ((BrowserNode *) parent())->get_data()->modified();
      package_modified();
      com->write_ack(TRUE);
    }
    break;
  case applyStereotypeCmd:
    if (is_read_only && !root_permission())
      com->write_ack(FALSE);
    else {
      ProfiledStereotypes::applyStereotype(this); // call package_modified() if needed
      com->write_ack(TRUE);
    }
    break;
  default:
    return FALSE;
  }
      
  return TRUE;
}
예제 #16
0
Destructor& Destructor::operator<<(const CommentSPtr& comment)
{
    return set_comment(comment);
}
예제 #17
0
파일: nl_parser.c 프로젝트: j26w/mame
bool parser_t::parse(const char *buf, const pstring nlname)
{
	ppreprocessor prepro;

	pstring processed = prepro.process(buf);
	m_buf = processed.cstr();

	reset(m_buf);
	set_identifier_chars("abcdefghijklmnopqrstuvwvxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890_.-");
	set_number_chars(".0123456789", "0123456789eE-."); //FIXME: processing of numbers
	char ws[5];
	ws[0] = ' ';
	ws[1] = 9;
	ws[2] = 10;
	ws[3] = 13;
	ws[4] = 0;
	set_whitespace(ws);
	set_comment("/*", "*/", "//");
	m_tok_param_left = register_token("(");
	m_tok_param_right = register_token(")");
	m_tok_comma = register_token(",");

	m_tok_ALIAS = register_token("ALIAS");
	m_tok_DIPPINS = register_token("DIPPINS");
	m_tok_NET_C = register_token("NET_C");
	m_tok_FRONTIER = register_token("OPTIMIZE_FRONTIER");
	m_tok_PARAM = register_token("PARAM");
	m_tok_NET_MODEL = register_token("NET_MODEL");
	m_tok_INCLUDE = register_token("INCLUDE");
	m_tok_LOCAL_SOURCE = register_token("LOCAL_SOURCE");
	m_tok_LOCAL_LIB_ENTRY = register_token("LOCAL_LIB_ENTRY");
	m_tok_SUBMODEL = register_token("SUBMODEL");
	m_tok_NETLIST_START = register_token("NETLIST_START");
	m_tok_NETLIST_END = register_token("NETLIST_END");
	m_tok_TRUTHTABLE_START = register_token("TRUTHTABLE_START");
	m_tok_TRUTHTABLE_END = register_token("TRUTHTABLE_END");
	m_tok_TT_HEAD = register_token("TT_HEAD");
	m_tok_TT_LINE = register_token("TT_LINE");
	m_tok_TT_FAMILY = register_token("TT_FAMILY");

	bool in_nl = false;

	while (true)
	{
		token_t token = get_token();

		if (token.is_type(ENDOFFILE))
		{
			return false;
			//error("EOF while searching for <%s>", nlname.cstr());
		}

		if (token.is(m_tok_NETLIST_END))
		{
			require_token(m_tok_param_left);
			if (!in_nl)
				error("Unexpected NETLIST_END");
			else
			{
				in_nl = false;
			}
			require_token(m_tok_param_right);
		}
		else if (token.is(m_tok_NETLIST_START))
		{
			if (in_nl)
				error("Unexpected NETLIST_START");
			require_token(m_tok_param_left);
			token_t name = get_token();
			require_token(m_tok_param_right);
			if (name.str() == nlname || nlname == "")
			{
				parse_netlist(name.str());
				return true;
			} else
				in_nl = true;
		}
	}
}