本文整理汇总了C++中set_input函数的典型用法代码示例。如果您正苦于以下问题:C++ set_input函数的具体用法?C++ set_input怎么用?C++ set_input使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_input函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ignore_last_nick
void ignore_last_nick(char dumb, char *dumber)
{
NickTab *nick;
char *tmp1;
if ((nick = gettabkey(1, NULL))) {
set_input(empty_str);
tmp1 = m_sprintf("%sig %s", get_string_var(CMDCHARS_VAR), nick->nick);
set_input(tmp1);
new_free(&tmp1);
}
update_input(UPDATE_ALL);
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:13,代码来源:input.c
示例2: for_loop_fix_state_input
void for_loop_fix_state_input(Branch* contents)
{
// This function will look at the state access inside for-loop contents.
// If there's state, the default building functions will have created
// terms that look like this:
//
// input() :state -> unpack_state -> pack_state -> output() :state
//
// We want each loop iteration to have its own state container. So we'll
// insert pack/unpack_state_list_n terms so that each iteration accesses
// state from a list. The result will look like:
//
// input() :state -> unpack_state_list_n(index) -> unpack_state -> pack_state
// -> pack_state_list_n(index) -> output() :state
// First insert the unpack_state_list_n call
Term* stateInput = find_state_input(contents);
// Nothing to do if there's no state input
if (stateInput == NULL)
return;
// Nothing to do if unpack_state_list_n term already exists
if (find_user_with_function(stateInput, FUNCS.unpack_state_list_n) != NULL)
return;
Term* unpackState = find_user_with_function(stateInput, FUNCS.unpack_state);
ca_assert(unpackState != NULL);
Term* index = for_loop_find_index(contents);
Term* unpackStateList = apply(contents, FUNCS.unpack_state_list_n,
TermList(stateInput, index));
transfer_users(stateInput, unpackStateList);
move_before(unpackStateList, unpackState);
set_input(unpackState, 0, unpackStateList);
// Now insert the pack_state_list_n call
Term* stateResult = find_open_state_result(contents, contents->length());
Term* packStateList = apply(contents, FUNCS.pack_state_list_n,
TermList(stateInput, stateResult, index));
packStateList->setBoolProp("final", true);
move_after(packStateList, stateResult);
// Make sure the state output uses this result
Term* stateOutput = append_state_output(contents);
set_input(stateOutput, 0, packStateList);
}
开发者ID:mokerjoke,项目名称:circa,代码行数:49,代码来源:loops.cpp
示例3: modify_branch_so_that_state_access_is_indexed
void modify_branch_so_that_state_access_is_indexed(Branch* branch, int index)
{
Term* stateInput = find_state_input(branch);
if (stateInput == NULL)
return;
// If the state output is connected directly to state input, then do nothing.
Term* stateOutput = find_state_output(branch);
if (stateOutput->input(0) == stateInput)
return;
Term* unpackList = apply(branch, FUNCS.unpack_state_from_list, TermList(stateInput));
unpackList->setIntProp("index", index);
move_after_inputs(unpackList);
for (int i=0; i < stateInput->users.length(); i++) {
Term* term = stateInput->users[i];
if (term == unpackList)
continue;
remap_pointers_quick(term, stateInput, unpackList);
}
Term* stateResult = stateOutput->input(0);
ca_assert(stateResult != NULL);
Term* packList = apply(branch, FUNCS.pack_state_to_list,
TermList(stateInput, stateResult));
packList->setIntProp("index", index);
packList->setBoolProp("final", true);
set_input(stateOutput, 0, packList);
move_after(packList, stateResult);
}
开发者ID:levelplane,项目名称:circa,代码行数:33,代码来源:if_block.cpp
示例4: if_block_create_input_placeholders_for_outer_pointers
void if_block_create_input_placeholders_for_outer_pointers(Term* ifCall)
{
Branch* contents = nested_contents(ifCall);
TermList outerTerms;
// Find outer pointers across each case
for (CaseIterator it(contents); it.unfinished(); it.advance()) {
list_outer_pointers(nested_contents(it.current()), &outerTerms);
}
ca_assert(ifCall->numInputs() == 0);
// Create input placeholders and add inputs for all outer pointers
for (int i=0; i < outerTerms.length(); i++) {
Term* outer = outerTerms[i];
set_input(ifCall, i, outer);
Term* placeholder = append_input_placeholder(nested_contents(ifCall));
rename(placeholder, outer->name);
// Go through each case and repoint to this new placeholder
for (CaseIterator it(contents); it.unfinished(); it.advance()) {
remap_pointers_quick(nested_contents(it.current()), outer, placeholder);
}
}
}
开发者ID:levelplane,项目名称:circa,代码行数:26,代码来源:if_block.cpp
示例5: tun_start
static ErlDrvData tun_start(ErlDrvPort port, char *args)
{
struct tun_state *state;
int fd;
int mode;
char dev_name[IFNAMSIZ];
state = (struct tun_state*) sys_alloc(sizeof(struct tun_state));
if (state == NULL) {
errno = ENOMEM; /* appropriate to set errno? */
return ERL_DRV_ERROR_ERRNO;
}
if (!parse_args(args, &mode, state->dev, IFNAMSIZ - 1)) {
return ERL_DRV_ERROR_BADARG;
}
fd = make_if(mode, state->dev);
if (fd < 0) {
return ERL_DRV_ERROR_GENERAL;
}
state->port = port;
state->fd = fd;
state->active = ACTIVE_FALSE;
set_input(state, 0);
return (ErlDrvData)state;
}
开发者ID:XinliNiu,项目名称:jungerl,代码行数:29,代码来源:tun_drv.c
示例6: tun_stop
static void tun_stop(ErlDrvData data)
{
struct tun_state *state = (struct tun_state *)data;
set_input(state, 0);
close(state->fd);
sys_free(state);
}
开发者ID:XinliNiu,项目名称:jungerl,代码行数:7,代码来源:tun_drv.c
示例7: compile_file
/* Compile an entire file of output from cpp, named NAME.
Write a file of assembly output and various debugging dumps. */
static void compile_file(char *name)
{
FILE *ifile;
#if !USE_CPPLIB
/* Open input file. */
if (name == 0 || !strcmp (name, "-"))
{
ifile = stdin;
name = "stdin";
}
else
ifile = fopen (name, "r");
if (ifile == 0)
pfatal_with_name (name);
#ifdef IO_BUFFER_SIZE
setvbuf(ifile, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
#endif
#endif /* !USE_CPPLIB */
set_nomem_handler(outofmemory);
set_input(ifile, name);
init_lex(); /* needs to go before init_semantics, since inits
dummy_location */
init_semantics();
if (yyparse () != 0)
{
if (errorcount == 0)
fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
}
fclose (ifile);
if (errorcount == 0)
{
/*if (flag_parse_only)
{
fprintf(stderr, "\nDONE. Unparsing............\n\n");
unparse(stdout, the_program);
}
else
exit(exec_cc1(the_program));*/
if (the_program)
{
parsed_file pf;
pf = ralloc(parse_region, struct parsed_file);
pf->name = name;
pf->program = the_program;
dd_add_last(parse_region, parsed_files, pf);
analyze(the_program);
}
}
}
开发者ID:ashwinraghav,项目名称:Cqual,代码行数:62,代码来源:main.c
示例8: set_input
bool hts_engine_call::execute()
{
set_input();
set_output();
engine_impl->synthesize();
return !output.is_stopped();
}
开发者ID:A-L-E-X,项目名称:RHVoice,代码行数:7,代码来源:hts_engine_call.cpp
示例9: insert_looped_placeholders
void insert_looped_placeholders(Block* contents)
{
Value names;
list_names_that_must_be_looped(contents, &names);
for (ListIterator it(&names); it; ++it) {
Term* inputPlaceholder = append_input_placeholder(contents);
Value* name = it.value();
rename(inputPlaceholder, name);
Value owningTermVal;
owningTermVal.set_term(contents->owningTerm);
Term* outsideTerm = find_name_at(&owningTermVal, name);
Term* innerResult = find_local_name(contents, name);
Term* outputPlaceholder = append_output_placeholder(contents, innerResult);
rename(outputPlaceholder, name);
set_inputs(inputPlaceholder, TermList(outsideTerm, outputPlaceholder));
for (BlockInputIterator it(contents); it; ++it) {
Term* term = it.currentTerm();
if (it.currentInput() == outsideTerm && term != inputPlaceholder)
set_input(term, it.currentInputIndex(), inputPlaceholder);
}
}
}
开发者ID:andyfischer,项目名称:circa,代码行数:25,代码来源:loops.cpp
示例10: nick_completion
void nick_completion(char dumb, char *dumber)
{
char *q, *line;
int i = -1;
char *nick = NULL, *tmp;
q = line = m_strdup(¤t_screen->input_buffer[MIN_POS]);
if (in_completion == STATE_NORMAL) {
i = word_count(line);
nick = extract_words(line, i - 1, i);
}
if (nick)
line[strlen(line) - strlen(nick)] = 0;
else
*line = 0;
if ((tmp = getchannick(input_lastmsg, nick && *nick ? nick : NULL))) {
malloc_strcat(&q, tmp);
set_input(q);
update_input(UPDATE_ALL);
malloc_strcpy(&input_lastmsg, tmp);
in_completion = STATE_COMPLETE;
}
new_free(&q);
new_free(&nick);
}
开发者ID:Nicholas-S,项目名称:xaric,代码行数:25,代码来源:input.c
示例11: set_input
void CNeuralNetworkTest::process(u32 learn)
{
u32 j;
set_input();
set_required_output();
neural_network->process(input);
if (learn != 0)
neural_network->learn(required_output);
for (j = 0; j < output.size(); j++)
output[j] = neural_network->get()[j];
error_now = 0.0;
for (j = 0; j < output.size(); j++)
{
float tmp = (required_output[j] - output[j]);
if (tmp < 0.0)
tmp = -tmp;
error_now+= tmp;
}
float k = 0.98;
error_filtered = k*error_filtered + (1.0 - k)*error_now;
error_total+= error_now;
}
开发者ID:richese,项目名称:aeris,代码行数:31,代码来源:neural_network_test.cpp
示例12: repoint_terms_to_use_input_placeholders
void repoint_terms_to_use_input_placeholders(Branch* contents)
{
// Visit every term
for (int i=0; i < contents->length(); i++) {
Term* term = contents->get(i);
// Visit every input
for (int inputIndex=0; inputIndex < term->numInputs(); inputIndex++) {
Term* input = term->input(inputIndex);
if (input == NULL)
continue;
// If the input is outside this branch, then see if we have a named
// input that could be used instead.
if (input->owningBranch == contents || input->name == "")
continue;
Term* replacement = find_input_placeholder_with_name(contents, input->name.c_str());
if (replacement == NULL)
continue;
set_input(term, inputIndex, replacement);
}
}
}
开发者ID:levelplane,项目名称:circa,代码行数:25,代码来源:loops.cpp
示例13: Token
Token :: Token(char input, Category category, double actual_value, int precedence)
{
set_input(input);
set_category(category);
set_actual_value(actual_value);
set_precedence(precedence);
}
开发者ID:aelsay,项目名称:xgraph,代码行数:7,代码来源:token.cpp
示例14: main
// Main entry to the interpret. No tests will be launched, only
// pure interpret will be compiled
int main(int argc, char *argv[]) {
int result;
if ((result = check_params(argc, argv))) {
return result;
}
// naalokujeme sdilenou datovou strukturu
make_data_structure();
// otevrem soubor
set_input(argv[1]);
#ifdef LEX_TEST
do {
get_token();
} while (d->token->type != EOF);
#else
// parse
parser_prepare(d);
d = parser_run();
if (d->error != CODE_OK) {
return 2;
}
InterpretInit(d->tree->d.list);
// interpret the list
InterpretRun();
#endif
return 0;
}
开发者ID:gelidus,项目名称:IFJ15,代码行数:34,代码来源:main.c
示例15: change_function
void
Term::setDependency(int index, Term* term)
{
if (index == 0)
change_function(this, term);
else
set_input(this, index - 1, term);
}
开发者ID:levelplane,项目名称:circa,代码行数:8,代码来源:term.cpp
示例16: toggle_console
void toggle_console(void* cp)
{
console c = cp;
(void)c;
if (main_console->active == 1)
{
hide_window(main_console->win);
main_console->active = 0;
set_input(NULL, 0);
}
else
{
show_window(main_console->win);
main_console->active = 1;
set_input(main_console->tb_in->data, 1000);
}
}
开发者ID:Potent-Code,项目名称:vektor,代码行数:18,代码来源:console.c
示例17: init_ports
/* Configura as portas como inputs e outputs */
void init_ports (void){
/*Define as portas como saída*/
set_output(DDRB, PB1); //OC1A e PWM_B
set_output(DDRB, PB2); //OC1B e PWM_A
set_output(DDRB, PB5); //SCK e (RESET_AB)'
set_output(DDRB, PB7); //(RESET_CD)'
set_output(DDRD, PD5); //PWM_C
set_output(DDRD, PD6); //PWM_D
/*Define as portas como entrada*/
set_input(DDRB, PB3); //MOSI e (FALUT)'
set_input(DDRB, PB4); //MISO e (OTW)'
set_input(DDRC, PC6); //(RESET)'
set_input(DDRD, PD2); //INT0 e CH1
set_input(DDRD, PD3); //INT1 e CH0
/*Portas PC0-PC3 podem ser usadas como sensores. Não foram implementadas*/
}
开发者ID:Equipe-Phoenix-Unicamp,项目名称:Beetle,代码行数:19,代码来源:bug.c
示例18: tun_ctl
static int tun_ctl(ErlDrvData data,
unsigned int cmd,
char *buf,
int len,
char **rbuf,
int rsize)
{
struct tun_state *state = (struct tun_state *)data;
int read_len;
switch (cmd) {
case REQUEST_GET_DEVICE:
return ctl_reply(REPLY_OK, state->dev, strlen(state->dev), rbuf, rsize);
case REQUEST_ACTIVE:
state->active = (int)*buf;
switch (state->active) {
case ACTIVE_FALSE:
set_input(state, 0);
break;
case ACTIVE_TRUE:
set_input(state, 1);
break;
case ACTIVE_ONCE:
/* optimization: try to read a packet immediately if it
exists, to avoid going back to select() */
read_len = read(state->fd, state->buf, TUNNEL_BUF_SIZE);
if (read_len > 0) {
/* got a packet */
driver_output(state->port, state->buf, read_len);
state->active = ACTIVE_FALSE;
set_input(state, 0);
} else {
/* no packet available yet */
set_input(state, 1);
}
break;
default:
assert(0);
}
return ctl_reply(REPLY_OK, "", 0, rbuf, rsize);
default:
return ctl_reply(REPLY_ERROR, "", 0, rbuf, rsize);
}
}
开发者ID:XinliNiu,项目名称:jungerl,代码行数:43,代码来源:tun_drv.c
示例19: loop_update_continue_inputs
void loop_update_continue_inputs(Branch* branch, Term* continueTerm)
{
for (int i=0;; i++) {
Term* output = get_output_placeholder(branch, i);
if (output == NULL)
break;
set_input(continueTerm, i,
find_intermediate_result_for_output(continueTerm, output));
}
}
开发者ID:levelplane,项目名称:circa,代码行数:10,代码来源:loops.cpp
示例20: main
int main()
{
integ x = new_integ(sine);
sleep(2);
set_input(x, 0);
usleep(500000);
printf("%g\n", x->v);
return 0;
}
开发者ID:Anatolt,项目名称:RosettaCodeData,代码行数:10,代码来源:active-object.c
注:本文中的set_input函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论