void CJSourceParser::AttachComments( spContext& ctx, wxChar* cur ) { if ( !mCommentsOn ) return; MCommentListT& lst = ctx.GetCommentList(); wxChar* prevComEnd = 0; int tmpLnNo; store_line_no( tmpLnNo ); // attach comments which were found before the given context for( int i = 0; i != _gCQSize; ++i ) { spComment* pComment = new spComment(); lst.push_back( pComment ); // find the end of comment wxChar* start = _gCommentsQueue[i]; pComment->mIsMultiline = ( *(start+1) == _T('*') ); // first comment in the queue and multiline // comments are always treated as a begining // of the new paragraph in the comment text if ( i == 0 ) { pComment->mStartsPar = true; } else if ( pComment->mIsMultiline ) { pComment->mStartsPar = true; } else { // find out wheather there is a new-line // between to adjecent comments wxChar* prevLine = start; skip_to_prev_line(prevLine); if ( prevLine >= prevComEnd ) pComment->mStartsPar = true; else pComment->mStartsPar = false; } prevComEnd = set_comment_text( pComment->m_Text, start ); } // attach comments which are at the end of the line // of the given context (if any) if ( skip_to_next_comment_in_the_line( cur ) ) { spComment* pComment = new spComment(); lst.push_back( pComment ); set_comment_text( pComment->m_Text, cur ); pComment->mStartsPar = 1; pComment->mIsMultiline = ( *(cur+1) == _T('*') ); // mark this comment, so that it would not // get in the comments list of the next context _gLastSuppresedComment = cur; } restore_line_no( tmpLnNo ); clear_commets_queue(); }
void msg_received(struct message *input_msg) { /** if (input_msg->sender < 10) return; **/ #if 0 g_print("msg type = %d from %d\n", input_msg->type, input_msg->sender); #endif switch (input_msg->type) { case MSG_NEXT_MATCH: #if 0 /* show ad as a slave */ if (mode == MODE_SLAVE && input_msg->u.next_match.tatami == tatami && input_msg->sender >= 10 && (input_msg->u.next_match.category != last_category || input_msg->u.next_match.match != last_match)) { last_category = input_msg->u.next_match.category; last_match = input_msg->u.next_match.match; display_ad_window(); display_comp_window(input_msg->u.next_match.cat_1, input_msg->u.next_match.blue_1, input_msg->u.next_match.white_1); } #endif if (input_msg->sender < 10 || input_msg->u.next_match.tatami != tatami || mode == MODE_SLAVE) return; if (clock_running() && demo < 2) return; traffic_last_rec_time = time(NULL); show_message(input_msg->u.next_match.cat_1, input_msg->u.next_match.blue_1, input_msg->u.next_match.white_1, input_msg->u.next_match.cat_2, input_msg->u.next_match.blue_2, input_msg->u.next_match.white_2, input_msg->u.next_match.flags); //g_print("minutes=%d auto=%d\n", input_msg->u.next_match.minutes, automatic); if (input_msg->u.next_match.minutes && automatic) reset(GDK_0, &input_msg->u.next_match); if (golden_score) set_comment_text(_("Golden Score")); if (current_category != input_msg->u.next_match.category || current_match != input_msg->u.next_match.match) { /*** g_print("current=%d/%d new=%d/%d\n", current_category, current_match, input_msg->u.next_match.category, input_msg->u.next_match.match); ***/ display_comp_window(saved_cat, saved_last1, saved_last2, saved_first1, saved_first2, saved_country1, saved_country2); struct message msg; memset(&msg, 0, sizeof(msg)); msg.type = MSG_UPDATE_LABEL; msg.u.update_label.label_num = START_COMPETITORS; strncpy(msg.u.update_label.text, input_msg->u.next_match.blue_1, sizeof(msg.u.update_label.text)-1); strncpy(msg.u.update_label.text2, input_msg->u.next_match.white_1, sizeof(msg.u.update_label.text2)-1); strncpy(msg.u.update_label.text3, input_msg->u.next_match.cat_1, sizeof(msg.u.update_label.text3)-1); /*write_tv_logo(&(msg.u.update_label));*/ if (mode != MODE_SLAVE) send_label_msg(&msg); } current_category = input_msg->u.next_match.category; current_match = input_msg->u.next_match.match; if (result_send_time) { if (current_category != msgout.u.next_match.category || current_match != msgout.u.next_match.match) { result_send_time = 0; } else if (time(NULL) - result_send_time > 14) { send_packet(&msgout); result_send_time = time(NULL); /*judotimer_log("Resend result %d:%d", current_category, current_match);*/ g_print("resend result %d:%d\n", current_category, current_match); } } break; case MSG_UPDATE_LABEL: if (mode != MODE_SLAVE /*|| input_msg->sender != tatami*/) return; update_label(&input_msg->u.update_label); break; case MSG_ACK: if (input_msg->sender < 10 || input_msg->u.ack.tatami != tatami) return; break; } }