Esempio n. 1
0
ret_code_t ctrl_block(void)
{
	SaHpiRdrT		rdr_entry;
	SaHpiResourceIdT	rptid;
	SaHpiInstrumentIdT	rdrnum;
	SaHpiRdrTypeT		type;
	SaErrorT		rv;
	char			buf[256];
	ret_code_t		ret;
	term_def_t		*term;
	int			res;

	ret = ask_rpt(&rptid);
	if (ret != HPI_SHELL_OK) return(ret);
	type = SAHPI_CTRL_RDR;
	ret = ask_rdr(rptid, type, &rdrnum);
	if (ret != HPI_SHELL_OK) return(ret);
	rv = saHpiRdrGetByInstrumentId(Domain->sessionId, rptid, type, rdrnum,
		&rdr_entry);
	if (rv != SA_OK) {
		printf("saHpiRdrGetByInstrumentId error %s\n", oh_lookup_error(rv));
		printf("ERROR!!! Can not get rdr: ResourceId=%d RdrType=%d RdrNum=%d\n",
			rptid, type, rdrnum);
		return(HPI_SHELL_CMD_ERROR);
	};
	show_control(Domain->sessionId, rptid, rdrnum, ui_print);
	for (;;) {
		block_type = CTRL_COM;
		res = get_new_command("control block ==> ");
		if (res == 2) {
			unget_term();
			return HPI_SHELL_OK;
		};
		term = get_next_term();
		if (term == NULL) continue;
		snprintf(buf, 256, "%s", term->term);
		if ((strcmp(buf, "q") == 0) || (strcmp(buf, "quit") == 0)) break;
		if (strcmp(buf, "state") == 0) {
			show_control_state(Domain->sessionId, rptid, rdrnum, ui_print);
			continue;
		};
		if (strcmp(buf, "setstate") == 0) {
			set_control_state(Domain->sessionId, rptid, rdrnum);
			continue;
		};
		if (strcmp(buf, "show") == 0) {
			show_control(Domain->sessionId, rptid, rdrnum, ui_print);
			continue;
		}
	};
	block_type = MAIN_COM;
	return SA_OK;
}
Esempio n. 2
0
void cmd_shell(void)
{
	help(0);
	for (;;) {
		if (debug_flag) printf("cmd_shell:\n");
		shell_error = HPI_SHELL_OK;
		get_new_command((char *)NULL);
		if ((shell_error != HPI_SHELL_OK) && read_file) {
			go_to_dialog();
		}
	}
}
Esempio n. 3
0
ret_code_t fumi_block( void )
{
    SaErrorT           rv;
    ret_code_t         ret;
    SaHpiResourceIdT   rptid;
    SaHpiInstrumentIdT rdrnum;
    SaHpiRdrT          rdr;

    ret = ask_rpt( &rptid );
    if ( ret != HPI_SHELL_OK ) {
        return ret;
    };
    ret = ask_rdr( rptid, SAHPI_FUMI_RDR, &rdrnum );
    if ( ret != HPI_SHELL_OK ) {
        return ret;
    }
    rv = saHpiRdrGetByInstrumentId( Domain->sessionId, rptid, SAHPI_FUMI_RDR, rdrnum, &rdr );
    if ( rv != SA_OK ) {
        printf( "ERROR!!! saHpiRdrGetByInstrumentId"
                "(Rpt=%d RdrType=%d Rdr=%d): %s\n",
                rptid, SAHPI_FUMI_RDR, rdrnum,
                oh_lookup_error( rv )
              );
        return HPI_SHELL_CMD_ERROR;
    };

    fumi_block_env.rptid   = rptid;
    fumi_block_env.fuminum = rdr.RdrTypeUnion.FumiRec.Num;

    block_type = FUMI_COM;
    for ( ;; ) {
        int res;
        term_def_t * term ;
        char buf[256];

        res = get_new_command( "FUMI block ==> " );
        if ( res == 2 ) {
            unget_term();
            break;
        };
        term = get_next_term();
        if ( term == NULL ) continue;
        snprintf( buf, 256, "%s", term->term );
        if ( ( strcmp( buf, "q" ) == 0) || ( strcmp( buf, "quit" ) == 0 ) ) {
            break;
        }
    }
    block_type = MAIN_COM;
    return HPI_SHELL_OK;
}
Esempio n. 4
0
void cmd_shell(void)
{
    *Title = 0;
    init_history();
    help(0);
    domain_proc();
    for (;;) {
        if (debug_flag) printf("cmd_shell:\n");
        shell_error = HPI_SHELL_OK;
        get_new_command((char *)NULL);
        if ((shell_error != HPI_SHELL_OK) && read_file) {
            go_to_dialog();
        }
    }
}
Esempio n. 5
0
ret_code_t ann_block(void)
{
	SaHpiResourceIdT	rptid;
	SaHpiInstrumentIdT	rdrnum;
	SaHpiRdrTypeT		type;
	SaErrorT		rv;
	char			buf[256];
	ret_code_t		ret;
	term_def_t		*term;
	int			res;

	ret = ask_rpt(&rptid);
	if (ret != HPI_SHELL_OK) return(ret);
	type = SAHPI_ANNUNCIATOR_RDR;
	ret = ask_rdr(rptid, type, &rdrnum);
	if (ret != HPI_SHELL_OK) return(ret);
	rv = saHpiRdrGetByInstrumentId(Domain->sessionId, rptid, type, rdrnum,
		&(ann_block_env.rdr_entry));
	if (rv != SA_OK) {
		printf("saHpiRdrGetByInstrumentId error %s\n", oh_lookup_error(rv));
		printf("ERROR!!! Can not get rdr: ResourceId=%d RdrType=%d RdrNum=%d\n",
			rptid, type, rdrnum);
		return(HPI_SHELL_CMD_ERROR);
	};
	ann_block_env.rptid = rptid;
	ann_block_env.rdrnum = rdrnum;
	show_rdr_attrs(&(ann_block_env.rdr_entry));
	for (;;) {
		block_type = ANN_COM;
		res = get_new_command("annunciator block ==> ");
		if (res == 2) {
			unget_term();
			block_type = MAIN_COM;
			return HPI_SHELL_OK;
		};
		term = get_next_term();
		if (term == NULL) continue;
		snprintf(buf, 256, "%s", term->term);
		if ((strcmp(buf, "q") == 0) || (strcmp(buf, "quit") == 0)) break;
	};
	block_type = MAIN_COM;
	return HPI_SHELL_OK;
}
// Implements \newcolumntype{C}[opt]{body}
// as \newcommand\cmd[opt]{body}
// Here \cmd is some internal name, stored in nct_tok[C]
void Parser::T_newcolumn_type()
{
  TokenList L = mac_arg();
  uint c = 0; 
  if(L.empty()) parse_error("Empty argument to \\newcolumntype");
  else if(L.size() != 1)
    parse_error("More than one token in argument to \\newcolumntype");
  else {
    if(L.front().is_a_char())
      c = L.front().char_val().get_value();
    if(!(c>0 && c<nb_newcolumn)) {
      parse_error("Argument to \\newcolumntype is not a 7bit character");
      c= 0;
    }
  }
  Buffer& B = hash_table.my_buffer();
  B.reset();
  B.push_back("newcolumtype@");
  B.push_back(uchar(c)); // special hack if c=0 !
  cur_tok = hash_table.locate(B);
  new_array_object.add_a_type(c,cur_tok);
  back_input();
  get_new_command(rd_always,false); // definition is local
}
Esempio n. 7
0
ret_code_t ann_block(void)
{
	SaHpiRdrT		rdr_entry;
	SaHpiResourceIdT	rptid;
	SaHpiInstrumentIdT	rdrnum;
	SaHpiAnnunciatorModeT	mode;
	SaHpiRdrTypeT		type;
	SaErrorT		rv;
	char			buf[256];
	char			*str;
	ret_code_t		ret;
	term_def_t		*term;
	int			res, val;

	ret = ask_rpt(&rptid);
	if (ret != HPI_SHELL_OK) return(ret);
	type = SAHPI_ANNUNCIATOR_RDR;
	ret = ask_rdr(rptid, type, &rdrnum);
	if (ret != HPI_SHELL_OK) return(ret);
	rv = saHpiRdrGetByInstrumentId(Domain->sessionId, rptid, type, rdrnum,
		&rdr_entry);
	if (rv != SA_OK) {
		printf("saHpiRdrGetByInstrumentId error %s\n", oh_lookup_error(rv));
		printf("ERROR!!! Can not get rdr: ResourceId=%d RdrType=%d RdrNum=%d\n",
			rptid, type, rdrnum);
		return(HPI_SHELL_CMD_ERROR);
	};
	show_rdr_attrs(&rdr_entry);
	for (;;) {
		block_type = ANN_COM;
		res = get_new_command("annunciator block ==> ");
		if (res == 2) {
			unget_term();
			block_type = MAIN_COM;
			return HPI_SHELL_OK;
		};
		term = get_next_term();
		if (term == NULL) continue;
		snprintf(buf, 256, "%s", term->term);
		if ((strcmp(buf, "q") == 0) || (strcmp(buf, "quit") == 0)) break;
		if (strcmp(buf, "acknow") == 0) {
			set_acknowledge(rptid, rdrnum);
			continue;
		};
		if (strcmp(buf, "list") == 0) {
			list_cond(rptid, rdrnum);
			continue;
		};
		if (strcmp(buf, "add") == 0) {
			add_announ(rptid, rdrnum);
			continue;
		};
		if (strcmp(buf, "delete") == 0) {
			delete_announ(rptid, rdrnum);
			continue;
		};
		if (strcmp(buf, "modeget") == 0) {
			rv = saHpiAnnunciatorModeGet(Domain->sessionId, rptid,
				rdrnum, &mode);
			if (rv != SA_OK) {
				printf("saHpiAnnunciatorModeGet error %s\n",
					oh_lookup_error(rv));
				continue;
			};
			switch (mode) {
				case SAHPI_ANNUNCIATOR_MODE_AUTO:
					str = "AUTO"; break;
				case SAHPI_ANNUNCIATOR_MODE_USER:
					str = "USER"; break;
				case SAHPI_ANNUNCIATOR_MODE_SHARED:
					str = "SHARED"; break;
				default: str = "Unknown"; break;
			};
			printf("Annunciator Mode: %s\n", str);
			continue;
		};
		if (strcmp(buf, "modeset") == 0) {
			res = get_string_param("Mode(auto|user|shared): ",
				buf, 10);
			if (res != 0) {
				printf("Invalid mode: %s\n", buf);
				continue;
			};
			if (strcmp(buf, "auto") == 0)
				mode = SAHPI_ANNUNCIATOR_MODE_AUTO;
			else if (strcmp(buf, "user") == 0)
				mode = SAHPI_ANNUNCIATOR_MODE_USER;
			else if (strcmp(buf, "shared") == 0)
				mode = SAHPI_ANNUNCIATOR_MODE_SHARED;
			else {
				printf("Invalid mode: %s\n", buf);
				continue;
			};
			rv = saHpiAnnunciatorModeSet(Domain->sessionId, rptid,
				rdrnum, mode);
			if (rv != SA_OK) {
				printf("saHpiAnnunciatorModeSet error %s\n",
					oh_lookup_error(rv));
			};
			continue;
		};
		if (strcmp(buf, "show") == 0) {
			term = get_next_term();
			if (term == NULL) {
				show_rdr_attrs(&rdr_entry);
				continue;
			};
			unget_term();
			res = get_int_param(" ", &val);
			if (res != 1) unget_term();
			else show_cond(rptid, rdrnum, val);
			continue;
		}
	};
	block_type = MAIN_COM;
	return SA_OK;
}