/** * Adds a line to the fragment shader code which modifies the color by * the specified color filter. */ static void addColorFilter(GrStringBuilder* fsCode, const char * outputVar, SkXfermode::Coeff uniformCoeff, SkXfermode::Coeff colorCoeff, const char* inColor) { GrStringBuilder colorStr, constStr; blendTermString(&colorStr, colorCoeff, COL_FILTER_UNI_NAME, inColor, inColor); blendTermString(&constStr, uniformCoeff, COL_FILTER_UNI_NAME, inColor, COL_FILTER_UNI_NAME); add_helper(outputVar, colorStr.c_str(), constStr.c_str(), fsCode); }
bool zmq::mtrie_t::add (unsigned char *prefix_, size_t size_, pipe_t *pipe_) { return add_helper (prefix_, size_, pipe_); }
void load_helpers (void) { FILE *fp; char b[STRING_LONG], *user_host, *greetz, *numb_join, *chan, *w_level, *pass; long num_join = 0, i = 0, level = 0; if ((fp = fopen (HELPER_LIST, "r")) == NULL) { printf ("Unable to open %s! Aborting connection.\n", HELPER_LIST); printf ("Please run ./configure to setup your darkbot.\n"); exit (0); } #ifndef WIN32 printf ("Loading %s file ", HELPER_LIST); #endif while (fgets (b, STRING_LONG, fp)) { if (b == NULL) continue; stripline (b); if (*b == '/') continue; i++; printf ("."); fflush (stdout); chan = strtok (b, " "); if (chan == NULL) continue; user_host = strtok (NULL, " "); if (user_host == NULL) continue; w_level = strtok (NULL, " "); if (w_level == NULL) continue; numb_join = strtok (NULL, " "); if (numb_join == NULL) continue; pass = strtok (NULL, " "); if (pass == NULL) { pass = "******"; /* duh */ } greetz = strtok (NULL, ""); if (greetz == NULL) greetz = "I haven't used \2SETINFO\2 yet!"; if (w_level != NULL) level = atoi (w_level); else level = 1; if (numb_join != NULL) num_join = atoi (numb_join); else num_join = 0; if (strlen (pass) > 25) pass[25] = '\0'; if (DebuG == 1) printf ("loading helperlist: %s %s l:%d j:%d %s\n", chan, user_host, (int) level, (int) num_join, greetz); add_helper (chan, user_host, level, num_join, greetz, pass, 1); } printf ("done(%d), ", (int) i); fclose (fp); save_changes (); if (DebuG == 1) db_sleep (2); }
bool zmq::generic_mtrie_t<T>::add (prefix_t prefix_, size_t size_, value_t *pipe_) { return add_helper (prefix_, size_, pipe_); }
void state_held_history_prompt(User *usr, char c) { StringList *sl; PList *pl, *pl_next; BufferedMsg *m; int printed, n, remaining; char num_buf1[MAX_NUMBER], num_buf2[MAX_NUMBER]; if (usr == NULL) return; Enter(state_held_history_prompt); /* spit out any received one-shot messages it is not as elegant, but you have to deal with them some time */ printed = 0; for(pl = usr->held_msgs; pl != NULL; pl = pl_next) { pl_next = pl->next; m = (BufferedMsg *)pl->p; if ((m->flags & BUFMSG_TYPE) == BUFMSG_ONESHOT) { /* one shot message */ display_text(usr, m->msg); printed++; remove_BufferedMsg(&usr->held_msgs, m); destroy_BufferedMsg(m); /* one-shots are not remembered */ } } if (printed) Put(usr, "<white>"); /* do color correction */ switch(c) { case INIT_PROMPT: if (usr->held_msgp == NULL) { usr->runtime_flags &= ~RTF_BUSY; RET(usr); Return; } generic_print_history(usr, (BufferedMsg *)usr->held_msgp->p); usr->runtime_flags |= RTF_BUSY; break; case INIT_STATE: usr->runtime_flags |= RTF_BUSY; break; case 'b': case 'B': case KEY_BS: Put(usr, "Back\n"); if (usr->held_msgp == NULL) { Perror(usr, "Your held messages buffer is gone"); goto Exit_Held_History; } usr->held_msgp = usr->held_msgp->prev; if (usr->held_msgp == NULL) goto Exit_Held_History; generic_print_history(usr, (BufferedMsg *)usr->held_msgp->p); break; case 'n': case 'N': case ' ': Put(usr, "Next\n"); if (usr->held_msgp == NULL) { Perror(usr, "Your held messages buffer is gone"); goto Exit_Held_History; } usr->held_msgp = usr->held_msgp->next; if (usr->held_msgp == NULL) goto Exit_Held_History; generic_print_history(usr, (BufferedMsg *)usr->held_msgp->p); break; case 'a': case 'A': Put(usr, "Again"); case KEY_CTRL('L'): Put(usr, "\n"); if (usr->held_msgp == NULL) { Perror(usr, "Your history buffer is gone"); usr->runtime_flags &= ~RTF_BUSY; RET(usr); Return; } generic_print_history(usr, (BufferedMsg *)usr->held_msgp->p); break; case '-': case '_': Put(usr, "<white>Read last\n"); CALL(usr, STATE_HELD_MINUS); Return; case '+': case '=': Put(usr, "<white>Skip forward\n"); CALL(usr, STATE_HELD_PLUS); Return; case '#': Put(usr, "<white>Message number\n"); CALL(usr, STATE_HELD_MSG_NUMBER); Return; case 'r': case 'v': Put(usr, "Reply\n"); goto Held_History_Reply; case 'R': case KEY_CTRL('R'): case 'V': Put(usr, "Reply to All\n"); Held_History_Reply: if (usr->runtime_flags & RTF_HOLD) { /* this would normally never happen ... */ Put(usr, "<magenta>You have put messages on hold\n"); break; } if (usr->held_msgp == NULL) { Put(usr, "<red>No message to reply to\n"); goto Exit_Held_History; } m = (BufferedMsg *)usr->held_msgp->p; deinit_StringQueue(usr->recipients); if (c == 'R' || c == 'V' || c == 'A' || c == 'a') { if (concat_StringQueue(usr->recipients, copy_StringList(m->to)) == NULL) { Perror(usr, "Out of memory"); deinit_StringQueue(usr->recipients); } } if ((sl = in_StringQueue(usr->recipients, m->from)) == NULL) { if ((sl = new_StringList(m->from)) == NULL) { Perror(usr, "Out of memory"); } else (void)add_StringQueue(usr->recipients, sl); } check_recipients(usr); if (count_Queue(usr->recipients) <= 0) break; do_reply_x(usr, m->flags); Return; case 'l': case 'L': Put(usr, "List recipients\n"); if (usr->held_msgp == NULL) { Perror(usr, "Your held messages buffer is gone"); goto Exit_Held_History; } m = (BufferedMsg *)usr->held_msgp->p; if (m->to != NULL && m->to->next != NULL) Put(usr, "<magenta>Recipients are <yellow>"); else Put(usr, "<magenta>The recipient is <yellow>"); for(sl = m->to; sl != NULL; sl = sl->next) { if (sl->next == NULL) Print(usr, "%s\n", sl->str); else Print(usr, "%s, ", sl->str); } break; case 's': case 'S': case 'q': case 'Q': case KEY_ESC: case KEY_CTRL('C'): case KEY_CTRL('D'): if (c == 'q' || c == 'Q') Put(usr, "Quit\n"); else Put(usr, "Stop\n"); Exit_Held_History: (void)rewind_PList(usr->held_msgs); usr->msg_seq_recv += count_List(usr->held_msgs); concat_BufferedMsg(&usr->history, usr->held_msgs); usr->held_msgs = usr->held_msgp = NULL; /* hold when busy doesn't set RTF_HOLD explicit hold with Ctrl-B does set RTF_HOLD */ if (usr->runtime_flags & RTF_HOLD) notify_unhold(usr); /* wake up friends */ usr->runtime_flags &= ~(RTF_BUSY|RTF_HOLD); Free(usr->away); usr->away = NULL; if (usr->runtime_flags & RTF_WAS_HH) { usr->runtime_flags &= ~RTF_WAS_HH; usr->flags |= USR_HELPING_HAND; add_helper(usr); } RET(usr); Return; default: if (fun_common(usr, c)) { /* Note: may reset RTF_BUSY flag(!) */ Return; } } if (usr->held_msgp == NULL) { usr->runtime_flags &= ~RTF_BUSY; RET(usr); Return; } usr->runtime_flags |= RTF_BUSY; n = 1; for(pl = rewind_BufferedMsg(usr->held_msgs); pl != NULL; pl = pl->next) { if (pl == usr->held_msgp) break; n++; } remaining = 0; while(pl != NULL) { pl = pl->next; remaining++; } if (remaining > 0) remaining--; Print(usr, "<yellow>\n[Held Messages]<magenta> msg #%s (%s remaining) %c<white> ", print_number(n, num_buf1, sizeof(num_buf1)), print_number(remaining, num_buf2, sizeof(num_buf2)), (usr->runtime_flags & RTF_SYSOP) ? '#' : '>' ); Return; }