static void stgopt(char *start,char *end,int (*outputfunc)(char *str)) { char symbols[MAX_OPT_VARS+1][MAX_ALIAS+1]; int seq,match_length,repl_length; int matches; char *debut=start; /* save original start of the buffer */ assert(sequences!=NULL); /* do not match anything if debug-level is maximum */ if (pc_optimize>sOPTIMIZE_NONE && sc_status==statWRITE) { do { matches=0; start=debut; while (start<end) { seq=0; while (sequences[seq].find!=NULL) { assert(seq>=0); if (*sequences[seq].find<sOPTIMIZE_NUMBER) { if (*sequences[seq].find>pc_optimize) break; /* don't look further */ seq++; /* continue with next string */ continue; } /* if */ if (matchsequence(start,end,sequences[seq].find,symbols,&match_length)) { char *replace=replacesequence(sequences[seq].replace,symbols,&repl_length); /* If the replacement is bigger than the original section, we may need * to "grow" the staging buffer. This is quite complex, due to the * re-ordering of expressions that can also happen in the staging * buffer. In addition, it should not happen: the peephole optimizer * must replace sequences with *shorter* sequences, not longer ones. * So, I simply forbid sequences that are longer than the ones they * are meant to replace. */ assert(match_length>=repl_length); if (match_length>=repl_length) { strreplace(start,replace,match_length,repl_length,(int)(end-start)); end-=match_length-repl_length; free(replace); code_idx-=opcodes(sequences[seq].opc)+opargs(sequences[seq].arg); seq=0; /* restart search for matches */ matches++; } else { /* actually, we should never get here (match_length<repl_length) */ assert(0); free(replace); seq++; } /* if */ } else { seq++; } /* if */ } /* while */ assert(sequences[seq].find==NULL || *sequences[seq].find<sOPTIMIZE_NUMBER); start += strlen(start) + 1; /* to next string */ } /* while (start<end) */ } while (matches>0); } /* if (pc_optimize>sOPTIMIZE_NONE && sc_status==statWRITE) */ for (start=debut; start<end; start+=strlen(start)+1) outputfunc(start); }
uint8_t tcpip_output(void) { if(outputfunc != NULL) { return outputfunc(); } UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function"); return 0; }
uint8_t tcpip_output(struct net_buf *buf, const uip_lladdr_t *a) { if(outputfunc != NULL) { return outputfunc(buf, a); } UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function"); return 0; }
u8_t tcpip_output(uip_lladdr_t *a) { if(outputfunc != NULL) { return outputfunc(a); } UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function"); return 0; }
uint8_t tcpip_output(const uip_lladdr_t *a) { int ret; if(outputfunc != NULL) { ret = outputfunc(a); return ret; } UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function"); return 0; }
uint8_t tcpip_output(const uip_lladdr_t *a) { if(outputfunc != NULL) { outputfunc(a); /* printf("pppp o %u tx %u rx %u\n", UIP_IP_BUF->proto, packetbuf_attr(PACKETBUF_ATTR_TRANSMIT_TIME), packetbuf_attr(PACKETBUF_ATTR_LISTEN_TIME));*/ leds_invert(LEDS_GREEN); } return 0; }
uint8_t tcpip_output(const uip_lladdr_t *a) { PRINTF("TCP IP OUTPUT.\n"); int ret; if(outputfunc != NULL) { ret = outputfunc(a); return ret; } PRINTF("TCP IP OUTPUT. NO Func\n"); UIP_LOG("tcpip_output: Use tcpip_set_outputfunc() to set an output function"); return 0; }
/** handles the output of the given message */ static void handleMessage( SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ SCIP_DECL_MESSAGEOUTPUTFUNC(outputfunc), /**< message handler function used for output */ FILE* file1, /**< file stream to print into, or NULL for stdout */ SCIP_Bool usefile1, /**< Should file1 be used? */ FILE* file2, /**< file stream to print into */ SCIP_Bool usefile2, /**< Should file2 be used? */ const char* msg, /**< message to print; NULL to flush the output buffer */ char* buffer, /**< message buffer */ int* bufferlen /**< pointer to the currently used entries in the message buffer */ ) { const char* s; assert( messagehdlr != NULL ); assert( outputfunc != NULL ); assert( !usefile2 || file2 != NULL ); assert( buffer == NULL || bufferlen != NULL ); /* if we do not have a buffer directly output the message */ if ( buffer == NULL ) { /* we do not have a buffer, so it makes no sense to flush it if msg == NULL */ if ( msg != NULL ) { if ( usefile1 ) outputfunc(messagehdlr, file1, msg); if ( usefile2 ) outputfunc(messagehdlr, file2, msg); } return; } assert(bufferlen != NULL); /* should the buffer be flushed? */ if ( msg == NULL ) { assert( *bufferlen < SCIP_MAXSTRLEN ); assert( buffer[*bufferlen] == '\0' ); if ( usefile1 ) outputfunc(messagehdlr, file1, buffer); if ( usefile2 ) outputfunc(messagehdlr, file2, buffer); *bufferlen = 0; buffer[0] = '\0'; return; } assert( msg != NULL && buffer != NULL ); /* if no output is activated, to not copy message into buffer */ if ( ! usefile1 && ! usefile2 ) return; /* determine message length and last newline (if any) */ s = msg; while ( *s != '\0' ) { /* if we reached a newline or the size limit, empty buffer and reset (need possibly space for newline and '\0') */ if ( *s == '\n' || *bufferlen >= SCIP_MAXSTRLEN-2 ) { if ( *s == '\n' ) buffer[(*bufferlen)++] = *(s++); buffer[*bufferlen] = '\0'; if ( usefile1 ) outputfunc(messagehdlr, file1, buffer); if ( usefile2 ) outputfunc(messagehdlr, file2, buffer); *bufferlen = 0; buffer[0] = '\0'; } else buffer[(*bufferlen)++] = *(s++); } buffer[*bufferlen] = '\0'; return; }