예제 #1
0
파일: mysem.cpp 프로젝트: haobi/haobiCode
/*
 * 占用指定锁的资源的数量
 * 参数:
 * no : 锁的位置
 * count : 占用的资源的数目
 * */
bool TSem::sem_lock(int no,int count) {

	if ( no < 0 || count < 1 )
		RS_NO_ERROR;
//	return set_op(-1 * count,no,SEM_UNDO);
	return set_op(-1 * count,no,count == 0 ? 0 : SEM_UNDO);
}
예제 #2
0
void	channelwin::enable(void)
{
	set_op(false);
	topic_enable();
	output->configure("-foreground black");
	info->configure("-foreground black");
	// reset inputentries and checkbuttons
	topicentry->del();
	keyentry->del();
	limitentry->del();
}
예제 #3
0
binary_adag_node::binary_adag_node(coeff_t c, bool is_targ, reg_t reg, sp_t sp, 
				   adag_node *src1, adag_node *src2) 
    : adag_node(c, is_targ, reg) {
    src.resize(2); scales.resize(2);
    src[0] = src1; scales[0] = sp.first;
    src[1] = src2; scales[1] = sp.second;
    depth = 1 + max(src1->depth, src2->depth);
    src[0]->add_parent(this); src[1]->add_parent(this);
    rsh = compute_shr(compute_sp(src1->c, src2->c, sp));
    verify(); set_op(); 
    output(cout);
}
예제 #4
0
/* Removes value(s) from the option (-= operator).  Returns non-zero on
 * success. */
static int
set_remove(opt_t *opt, const char value[])
{
	if(opt->type != OPT_INT && opt->type != OPT_SET && opt->type != OPT_STRLIST &&
			opt->type != OPT_CHARSET)
		return -1;

	if(opt->type == OPT_INT)
	{
		char *p;
		int i;

		i = strtol(value, &p, 10);
		if(*p != '\0')
			return -1;
		if(i == 0)
			return 0;

		opt->val.int_val -= i;
		notify_option_update(opt, OP_MODIFIED, opt->val);
	}
	else if(opt->type == OPT_SET)
	{
		if(set_op(opt, value, SO_REMOVE))
		{
			notify_option_update(opt, OP_MODIFIED, opt->val);
		}
	}
	else if(opt->type == OPT_CHARSET)
	{
		if(charset_remove_all(opt, value))
		{
			notify_option_update(opt, OP_MODIFIED, opt->val);
		}
	}
	else if(*value != '\0')
	{
		size_t len = 0;
		if(opt->val.str_val != NULL)
			len = strlen(opt->val.str_val);

		str_remove(opt->val.str_val, value);

		if(opt->val.str_val != NULL && len != strlen(opt->val.str_val))
		{
			notify_option_update(opt, OP_MODIFIED, opt->val);
		}
	}

	return 0;
}
예제 #5
0
파일: expand.c 프로젝트: freecores/marca
void expand_mod(void)
{
  struct op o = get_current_seg()->code[get_current_seg()->pos];

  if ((o.op == MOD) || (o.op == UMOD))
    {
      if (o.args[0].val.regnum != o.args[2].val.regnum)
	{
	  struct seg* seg = get_current_seg();

	  set_op(seg, seg->pos, MOV);
	  set_mode(seg, seg->pos, 0, 'r');
	  set_regnum(seg, seg->pos, 0, o.args[2].val.regnum);
	  set_mode(seg, seg->pos, 1, 'r');
	  set_regnum(seg, seg->pos, 1, o.args[0].val.regnum);
	  set_listing(seg, seg->pos, xsprintf("mov\tr%d, r%d",
					      o.args[2].val.regnum,
					      o.args[0].val.regnum));

	  seg->pos++;
	  adjust_segsize(seg, seg->pos+1);

	  set_op(seg, seg->pos, o.op);
	  set_mode(seg, seg->pos, 0, 'r');
	  set_regnum(seg, seg->pos, 0, o.args[2].val.regnum);
	  set_mode(seg, seg->pos, 1, 'r');
	  set_regnum(seg, seg->pos, 1, o.args[1].val.regnum);
	  set_mode(seg, seg->pos, 2, 'r');
	  set_regnum(seg, seg->pos, 2, 0); /* this should never be used */
	  set_listing(seg, seg->pos, xsprintf("%s\tr%d, r%d, r%d",
					      o.op == MOD ? "mod" : "umod",
					      o.args[2].val.regnum,
					      o.args[1].val.regnum,
					      o.args[2].val.regnum));
	}
    }
}
예제 #6
0
/* Adds value(s) to the option (+= operator).  Returns zero on success. */
static int
set_add(opt_t *opt, const char value[])
{
	if(opt->type != OPT_INT && opt->type != OPT_SET && opt->type != OPT_STRLIST &&
			opt->type != OPT_CHARSET)
		return -1;

	if(opt->type == OPT_INT)
	{
		char *p;
		int i;

		i = strtol(value, &p, 10);
		if(*p != '\0')
			return -1;
		if(i == 0)
			return 0;

		opt->val.int_val += i;
		notify_option_update(opt, OP_MODIFIED, opt->val);
	}
	else if(opt->type == OPT_SET)
	{
		if(set_op(opt, value, SO_ADD))
		{
			notify_option_update(opt, OP_MODIFIED, opt->val);
		}
	}
	else if(opt->type == OPT_CHARSET)
	{
		const size_t valid_len = strspn(value, *opt->vals);
		if(valid_len != strlen(value))
		{
			text_buffer_addf("Illegal character: <%c>", value[valid_len]);
			return -1;
		}
		if(charset_add_all(opt, value))
		{
			notify_option_update(opt, OP_MODIFIED, opt->val);
		}
	}
	else if(*value != '\0')
	{
		opt->val.str_val = str_add(opt->val.str_val, value);
		notify_option_update(opt, OP_MODIFIED, opt->val);
	}

	return 0;
}
예제 #7
0
파일: main.c 프로젝트: OohNahGii/329p3
void lcd_on() {
   // Set the top bits in P1DIR to OUT
   P1DIR |= 0xF0;
   // Sets bottom 3 bits in P2DIR to out
   P2DIR |= 0x07;

   // Set all outputs low
   P1OUT = 0x00;
   P2OUT = 0x00;

   // wait 30 ms
   __delay_cycles(40000);

   // Set Function
   set_op(0x20);
   set_op(0x20);
   set_op(0x80);

   // wait 37 us
   __delay_cycles(1000);

   // Display Set
   set_op(0x00);
   set_op(0xF0);

   // wait 37 us
   __delay_cycles(1000);

   // Display Clear
   set_op(0x00);
   set_op(0x10);

   // wait 1.52 ms
   __delay_cycles(3000);

   // Entry Mode Set
   set_op(0x00);
   set_op(0x40);
}
예제 #8
0
파일: Token.cpp 프로젝트: Arkm4n/Lexer
#include "Token.h"
#include "Lexer.h"

Token::Token() {}
set<string> Token::kws = set_kws();
set<string> Token::ops = set_op();
set<string> Token::seps = set_sep();
ofstream Token::fout;
Token::Token(int line, int column, Types type, string lexeme): line(line),
                                                               column(column),
                                                               type(type),
                                                               lexeme(lexeme)
{ }

#define kw(k) case k: return #k;
#define optr(k) case k: return #k;
#define sop(s, k) case k: return #k;
#define sep(s, k) case k: return #k;
string Token::TypeToString (Types type)
{
    switch (type)
    {
        case STRING:    return "string";
        case CHARACTER: return "char";
        case INTEGER:   return "integer";
        case HEX:       return "hex";
        case REAL:      return "real";
        case OP:        return "op";
        case IDENT:     return "ident";
        case SEP:       return "sep";
        case KEYWORD:   return "keyword";
예제 #9
0
파일: cpptype.c 프로젝트: ras52/bootstrap
init_stypes() {
    s_int = new_node('dclt', 3);
    set_op( s_int, 0, new_node('int', 0) );
}
예제 #10
0
/*JNI*/int execute(int argc, char **argv){
/*JNI*/#else
int main(int argc, char **argv){
/*JNI*/#endif
/*JNI*/#ifdef CREATELIB
/*JNI*/		optind = 0;
/*JNI*/		op=0;
/*JNI*/#endif

	char *tun 			= NULL;
	char *iname			= NULL;
	char *rule 			= NULL;
	char *tsa 			= NULL;
	char *dev 			= NULL;
	char *an 			= NULL;
	char *flush			= NULL;
	char *vpn			= NULL;

	unsigned int local_address 		= 0;
	unsigned int local_port 		= 0;
	unsigned int remote_address 	= 0;
	unsigned int remote_port 		= 0;
	unsigned int inat_local_address 	= 0;
	unsigned int inat_remote_address	= 0;
	unsigned int keepAlive_period	= 0;
	unsigned int keepAlive_timeout	= 0;
	int tid 						= -1;
	int rid 						= -1;
	int ifindex 					= -1;
	unsigned int proto				= 0;
	int mark 						= -1;
	int verbose						= -1;
	int keepAlive					= -1;
	int fam							= -1;

	int command 					= -1;
	char staticrule					= 2; // 2 = not static if new rule, don't change if modifying existing rule

	int c;

	while((c = getopt(argc, argv, "G:a:g:x:i:d:l:r:n:p:s:f:h:m:M:eV:S:D:t:k:T:"))!= -1) {
		switch (c) {

			case 'G':
				fam = atoi(optarg);
				if(fam == 0) usage("Invalid option -G");
				break;

			case 'e':
				set_op(C_ECH);
				break;

			case 'V':
				set_op(C_VRB);
				if(strcmp(optarg, "off") == 0) verbose = -1;
				else parse_number(&verbose, optarg);
				break;

			case 'a':
				if(strcmp(optarg, "tun") == 0) 			tun	 = optarg;
				else if(strcmp(optarg, "rule") == 0) 	rule = optarg;
				else if(strcmp(optarg, "tsa") == 0) 	tsa = optarg;
				else if(strcmp(optarg, "dev") == 0) 	dev = optarg;
				else if(strcmp(optarg, "vpn") == 0) 	vpn = optarg;
				else usage("Invalid option -a");
				set_op(C_ADD);
				break;

			case 'f':
				if(strcmp(optarg, "tun") == 0) 			flush = optarg;
				else if(strcmp(optarg, "rule") == 0) 	flush = optarg;
				else if(strcmp(optarg, "tsa") == 0) 	flush = optarg;
				else if(strcmp(optarg, "all") == 0) 	flush = optarg;
				else usage("Invalid option -f");
				set_op(C_FSH);
				break;

			case 'g':
				if(strcmp(optarg, "tun") == 0) 			tun	 = optarg;
				else if(strcmp(optarg, "rule") == 0) 	rule = optarg;
				else usage("Invalid option -g");
				set_op(C_GET);
				break;

			case 'x':
				if(strcmp(optarg, "tun") == 0) 			tun	 = optarg;
				else if(strcmp(optarg, "rule") == 0) 	rule = optarg;
				else if(strcmp(optarg, "tsa") == 0) 	tsa = optarg;
				else if(strcmp(optarg, "dev") == 0) 	dev = optarg;
				else if(strcmp(optarg, "vpn") == 0) 	vpn = optarg;
				else usage("Invalid option -x");
				set_op(C_DEL);
				break;

			case 'm':
				if(strcmp(optarg, "an") == 0) 			an	 = optarg;
				else usage("Invalid option -m");
				break;

			case 'h':
				parse_number(&rid, optarg);
				set_op(C_HAN);
				break;

			case 'l':
				if(strcmp(optarg, "tun") == 0)			{ tun = optarg; 	set_op(C_LST); }
				else if(strcmp(optarg, "rule") == 0)	{ rule = optarg; 	set_op(C_LST); }
				else if(strcmp(optarg, "tsa") == 0)		{ tsa = optarg; 	set_op(C_LST); }
				else if(strcmp(optarg, "dev") == 0)		{ dev = optarg; 	set_op(C_LST); }
				else if(strcmp(optarg, "vpn") == 0)		{ vpn = optarg; 	set_op(C_LST); }
				else{
					local_port = atoi(optarg);
					if(local_port == 0) usage("Invalid option -l");
				}
				break;

			case 'i':
				iname = optarg;
				break;

			case 'd':
				if(inet_pton(AF_INET, optarg, &remote_address) != 1) usage("Invalid option -d");
				break;

			case 'S':
				if(strcmp(optarg, "off") == 0) break;
				if(inet_pton(AF_INET, optarg, &inat_local_address) != 1) usage("Invalid option -S");
				break;

			case 'D':
				if(strcmp(optarg, "off") == 0) break;
				if(inet_pton(AF_INET, optarg, &inat_remote_address) != 1) usage("Invalid option -D");
				break;

			case 'r':
				parse_number(&remote_port, optarg);
				break;

			case 'n':
				if(strcmp(optarg, "default") == 0) ifindex = 1111;
				else parse_number(&tid, optarg);
				break;

			case 'p':
				if(strcmp(optarg, "tcp") == 0) 			proto = 6;
				else if(strcmp(optarg, "udp") == 0) 	proto = 17;
				else usage("Invalid option -p");
				break;

			case 's':
				if(inet_pton(AF_INET, optarg, &local_address) != 1) usage("Invalid option -s");
				break;

			case 'M':
				parse_number(&mark, optarg);
				break;
			
			case 't':
				staticrule = 1;
				break;

			case 'k':
				if(strcmp(optarg, "on") == 0)			keepAlive = 10;
				else if(strcmp(optarg, "off") == 0) 	keepAlive = 0;
				else parse_number(&keepAlive_period, optarg);
				//else usage("-k option --- values: on/off");
				set_op(C_KPA);
				break;

			case 'T':
				parse_number(&keepAlive_timeout, optarg);
				break;

			default:
				usage("Usage Error");
				break;
			}
	}

	struct tun_local tl = {
				.ifindex = -1,
				.port 	 = local_port
	};

	struct tun_remote tr = {
			.addr = remote_address,
			.port = remote_port
	};

	struct upmt_key key = {
			.proto = proto,
			.saddr = local_address,
			.daddr = remote_address,
			.sport = local_port,
			.dport = remote_port
	};

	struct tun_param tp = {
			.tid = tid,
			.tl = {
					.ifindex = ifindex,
					.port = local_port
			},
			.tr = {
					.addr = remote_address,
					.port = remote_port
			},
			.in = {
					.local = inat_local_address,
					.remote = inat_remote_address
			}
	};
예제 #11
0
//{{{ int parse_q(char *q_text, struct gqt_query *q_props)
int parse_q(char *q_text, struct gqt_query *q_props)
{
    int ntoken, vtoken;

    int state = START_OF_EXP;

    q_props->variant_op = -1;
    q_props->op_condition = -1;
    q_props->condition_value = -1;

    memset(q_props->genotype_condition,0,4*sizeof(int));

    char *in = (char *) malloc(100*sizeof(char));
    if (!in)
        err(EX_OSERR, "malloc error");
    strcpy(in, q_text);
    YY_BUFFER_STATE buffer = yy_scan_string(in);

    ntoken = yylex();

    while (ntoken) {
        switch (ntoken) {
            case p_maf:
            case p_count:
            case p_pct:
                if (set_op(ntoken, q_props, &state))
                    return 1;
                int last_ntoken = ntoken;
                ntoken = yylex();
                if (ntoken != p_r_paren) {
                    fprintf(stderr, "SYNTAX ERROR: '(' expected after '%s' ",
                            names[last_ntoken]);
                    return 1;
                }
                state |= OP_SET_START;
                break;
            case p_het:
            case p_homo_ref:
            case p_homo_alt:
            case p_unknown:
                if (set_gt(ntoken, q_props, &state))
                    return 1;
                state |= GT_SET_START;
                break;
            case p_r_paren:
                fprintf(stderr, "SYNTAX ERROR: "
                            "Opperation (count,pct,maf) expected "
                            "prior to '%s' ",
                            names[ntoken]);
                    return 1;
            case p_l_paren:



                if ( ((q_props->variant_op == p_count) ||
                      (q_props->variant_op == p_pct))  &&
                     (state != (OP_SET_START | GT_SET_START) ) ) {
                    fprintf(stderr, "SYNTAX ERROR: "
                            "Opperation (count,pct) and "
                            "genotype (HOM_REF,HET,HOM_ALT,UNKNONW) expected "
                            "prior to '%s' ",
                            names[ntoken]);
                    return 1;
                } else if ( (q_props->variant_op == p_maf) &&
                            (state != OP_SET_START ) ) {
                    fprintf(stderr, "SYNTAX ERROR: "
                            "Opperation (maf) does not expect "
                            "genotype (HOM_REF,HET,HOM_ALT,UNKNONW) "
                            "prior to '%s' ",
                            names[ntoken]);
                    return 1;
                }

                state |= OP_SET_END;
                state |= GT_SET_END;
                break;
            case p_equal:
            case p_not_equal:
            case p_less_than:
            case p_greater_than:
            case p_less_than_equal:
            case p_greater_than_equal:
                if (set_op_cond(ntoken, q_props, &state))
                    return 1;
                break;
            case p_number:
                if (set_cond_value(yytext, q_props, &state))
                    return 1;
                break;
            default:
                printf("Syntax error in line\n");
        }

        ntoken = yylex();
    }
    yy_delete_buffer(buffer);

    if (((state & OP_SET_START) == OP_SET_START) &&
        ((state & OP_SET_END) != OP_SET_END)) {
        fprintf(stderr, "SYNTAX ERROR: Missing ')' ");
        return 1;
    }

    if (((state & COND_SET) == COND_SET) &&
        ((state & COND_VALUE_SET) != COND_VALUE_SET)) {
        fprintf(stderr, "SYNTAX ERROR: Missing condition value "
                "(after ==, <, etc.) ");
        return 1;
    }


    /*
    printf("%d\n", q0.variant_op);
    int i;
    for (i = 0; i < 4; ++i)
        printf("%d", q0.genotype_condition[i]);
    printf("\n");
    printf("%d\n", q0.op_condition);
    printf("%f\n", q0.condition_value);
    */

    //free(in);
    return 0;
}
예제 #12
0
/* Assigns value to an option of all kinds except boolean.  Returns non-zero in
 * case of error. */
static int
set_set(opt_t *opt, const char value[])
{
	if(opt->type == OPT_BOOL)
		return -1;

	if(opt->type == OPT_SET)
	{
		if(set_op(opt, value, SO_SET))
		{
			notify_option_update(opt, OP_SET, opt->val);
		}
	}
	else if(opt->type == OPT_ENUM)
	{
		int i = find_val(opt, value);
		if(i == -1)
			return -1;

		if(opt->val.enum_item != i)
		{
			opt->val.enum_item = i;
			notify_option_update(opt, OP_SET, opt->val);
		}
	}
	else if(opt->type == OPT_STR || opt->type == OPT_STRLIST)
	{
		if(opt->val.str_val == NULL || strcmp(opt->val.str_val, value) != 0)
		{
			(void)replace_string(&opt->val.str_val, value);
			notify_option_update(opt, OP_SET, opt->val);
		}
	}
	else if(opt->type == OPT_INT)
	{
		char *end;
		int int_val = strtoll(value, &end, 10);
		if(opt->val.int_val != int_val)
		{
			opt->val.int_val = int_val;
			notify_option_update(opt, OP_SET, opt->val);
		}
	}
	else if(opt->type == OPT_CHARSET)
	{
		const size_t valid_len = strspn(value, *opt->vals);
		if(valid_len != strlen(value))
		{
			text_buffer_addf("Illegal character: <%c>", value[valid_len]);
			return -1;
		}
		if(charset_set(opt, value))
		{
			notify_option_update(opt, OP_SET, opt->val);
		}
	}
	else
	{
		assert(0 && "Unknown type of option.");
	}

	return 0;
}
예제 #13
0
파일: valuetype.cpp 프로젝트: CCJY/ATCD
int
be_visitor_valuetype::visit_attribute (be_attribute *node)
{
  this->ctx_->node (node);
  this->ctx_->attribute (node);

  be_operation get_op (node->field_type (),
                       AST_Operation::OP_noflags,
                       node->name (),
                       0,
                       0);

  get_op.set_name ((UTL_IdList *) node->name ()->copy ());

  if (this->visit_operation (&get_op) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         "(%N:%l) be_visitor_attribute::"
                         "visit_attribute - "
                         "codegen for get_attribute failed\n"),
                        -1);
    }

  get_op.destroy ();

  if (node->readonly ())
    {
      // Nothing else to do.
      return 0;
    }

  Identifier id ("void");

  UTL_ScopedName sn (&id,
                     0);

  be_predefined_type rt (AST_PredefinedType::PT_void,
                         &sn);

  // Argument type is the same as the attribute type.
  AST_Argument *arg =
    idl_global->gen ()->create_argument (AST_Argument::dir_IN,
                                         node->field_type (),
                                         node->name ());

  arg->set_name ((UTL_IdList *) node->name ()->copy ());

  // Create the operation.
  be_operation set_op (&rt,
                       AST_Operation::OP_noflags,
                       node->name (),
                       0,
                       0);

  set_op.set_name ((UTL_IdList *) node->name ()->copy ());
  set_op.be_add_argument (arg);

 if (this->visit_operation (&set_op) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         "(%N:%l) be_visitor_attribute::"
                         "visit_attribute - "
                         "codegen for set_attribute failed\n"),
                        -1);
    }

  set_op.destroy ();
  rt.destroy ();

  return 0;
}
예제 #14
0
int
be_visitor_attribute::visit_attribute (be_attribute *node)
{
    this->ctx_->node (node);
    this->ctx_->attribute (node);

    UTL_Scope *s = node->defined_in ();
    AST_Decl *d = ScopeAsDecl (s);
    ACE_CString op_name (this->ctx_->port_prefix ());
    op_name += node->local_name ()->get_string ();
    Identifier *op_id = 0;
    ACE_NEW_RETURN (op_id,
                    Identifier (op_name.c_str ()),
                    -1);

    UTL_ScopedName *op_ln = 0;
    ACE_NEW_RETURN (op_ln,
                    UTL_ScopedName (op_id, 0),
                    -1);

    UTL_ScopedName *op_sn =
        static_cast<UTL_ScopedName *> (d->name ()->copy ());
    op_sn->nconc (op_ln);

    // first the "get" operation
    be_operation get_op (node->field_type (),
                         AST_Operation::OP_noflags,
                         0,
                         node->is_local (),
                         node->is_abstract ());

    get_op.set_defined_in (s);
    get_op.set_name (op_sn);
    UTL_ExceptList *get_exceptions = node->get_get_exceptions ();

    if (0 != get_exceptions)
    {
        get_op.be_add_exceptions (get_exceptions->copy ());
    }

    be_visitor_context ctx (*this->ctx_);
    int status = 1;

    switch (this->ctx_->state ())
    {
    // These two cases are the only ones that could involve a strategy.
    case TAO_CodeGen::TAO_ROOT_CH:
    case TAO_CodeGen::TAO_INTERFACE_CH:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CS:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
        be_visitor_operation_cs visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SH:
    {
        be_visitor_operation_sh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IH:
    {
        be_visitor_operation_ih visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SS:
    {
        be_visitor_operation_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IS:
    {
        be_visitor_operation_is visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
    {
        be_visitor_operation_proxy_impl_xh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
    {
        be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
    {
        be_visitor_operation_smart_proxy_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
    {
        be_visitor_operation_smart_proxy_cs visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SH:
    {
        be_visitor_operation_tie_sh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SS:
    {
        be_visitor_operation_tie_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTH:
    case TAO_CodeGen::TAO_ROOT_SVH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTS:
    case TAO_CodeGen::TAO_ROOT_SVS:
    {
        be_visitor_operation_svs visitor (&ctx);
        visitor.scope (this->op_scope_);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXS:
    {
        be_visitor_operation_exs visitor (&ctx);
        visitor.scope (this->op_scope_);
        visitor.class_extension (this->exec_class_extension_.c_str ());
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CNH:
    case TAO_CodeGen::TAO_ROOT_CNS:
        break;
    default:
        get_op.destroy ();
        return 0;
    }

    if (status == -1)
    {
        get_op.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "codegen for get_attribute failed\n"),
                          -1);
    }

    // Do nothing for readonly attributes.
    if (node->readonly ())
    {
        get_op.destroy ();
        return 0;
    }

    status = 1;

    // Create the set method.
    Identifier id ("void");
    UTL_ScopedName sn (&id,
                       0);

    // The return type  is "void".
    be_predefined_type rt (AST_PredefinedType::PT_void,
                           &sn);

    // Argument type is the same as the attribute type.
    AST_Argument *arg =
        idl_global->gen ()->create_argument (AST_Argument::dir_IN,
                node->field_type (),
                node->name ());

    arg->set_name ((UTL_IdList *) node->name ()->copy ());

    // Create the operation.
    be_operation set_op (&rt,
                         AST_Operation::OP_noflags,
                         0,
                         node->is_local (),
                         node->is_abstract ());
    set_op.set_defined_in (node->defined_in ());
    set_op.set_name (static_cast<UTL_ScopedName *> (op_sn->copy ()));
    set_op.be_add_argument (arg);

    UTL_ExceptList *set_exceptions = node->get_set_exceptions ();

    if (0 != set_exceptions)
    {
        set_op.be_add_exceptions (set_exceptions->copy ());
    }

    ctx = *this->ctx_;
    status = 1;

    switch (this->ctx_->state ())
    {
    // These two cases are the only ones that could involved a strategy.
    case TAO_CodeGen::TAO_ROOT_CH:
    case TAO_CodeGen::TAO_INTERFACE_CH:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CS:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
        be_visitor_operation_cs visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SH:
    {
        be_visitor_operation_sh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IH:
    {
        be_visitor_operation_ih visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SS:
    {
        be_visitor_operation_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IS:
    {
        be_visitor_operation_is visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
    {
        be_visitor_operation_proxy_impl_xh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
    {
        be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
    {
        be_visitor_operation_smart_proxy_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CS:
    {
        be_visitor_operation_smart_proxy_cs visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SH:
    {
        be_visitor_operation_tie_sh visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_TIE_SS:
    {
        be_visitor_operation_tie_ss visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTH:
    case TAO_CodeGen::TAO_ROOT_SVH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SVTS:
    case TAO_CodeGen::TAO_ROOT_SVS:
    {
        be_visitor_operation_svs visitor (&ctx);
        visitor.scope (this->op_scope_);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXH:
    {
        be_visitor_operation_ch visitor (&ctx);
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_EXS:
    {
        be_visitor_operation_exs visitor (&ctx);
        visitor.scope (this->op_scope_);
        visitor.class_extension (this->exec_class_extension_.c_str ());
        status = set_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CNH:
    case TAO_CodeGen::TAO_ROOT_CNS:
        break;
    default:
        // Error.
        set_op.destroy ();
        rt.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "bad codegen state\n"),
                          -1);
    }

    if (status == 0)
    {
        get_op.destroy ();
        set_op.destroy ();
        rt.destroy ();
        return 0;
    }
    else if (status == -1)
    {
        get_op.destroy ();
        set_op.destroy ();
        rt.destroy ();
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%N:%l) be_visitor_attribute::"
                           "visit_attribute - "
                           "codegen for get_attribute failed\n"),
                          -1);
    }

    get_op.destroy ();
    set_op.destroy ();
    rt.destroy ();
    return 0;
}