rem
stringlengths
0
83.5k
add
stringlengths
0
223k
context
stringlengths
10
471k
meta
stringlengths
120
236
c[0]='B'; c[1]='I';
static char *scan_request(char *c){ // mdoc(7) stuff static bool mandoc_synopsis=false; /* True if we are in the synopsis section */ static bool mandoc_command=false; /* True if this is mdoc(7) page */ static int mandoc_bd_options; /* Only copes with non-nested Bd's */ static int function_argument=0; // Number of function argument (.Fo, .Fa, .Fc) // man(7) stuff static bool ur_ignore=false; // Has .UR a parameter : (for .UE to know if or not to write </a>) int i=0; bool mode=false; char *h=0; const int max_wordlist=100; char *wordlist[max_wordlist]; int words; char *sl; while (*c==' ' || *c=='\t') c++; // Spaces or tabs allowed between control character and request if (c[0]=='\n') return c+1; if (c[0]==escapesym) { /* some pages use .\" .\$1 .\} */ /* .\$1 is too difficult/stuppid */ if (c[1]=='$') { kdDebug(7107) << "Found .\\$" << endl; c=skip_till_newline(c); // ### TODO } else c = scan_escape(c+1); } else { int j; if (c[1]=='\n') j=1; else j=2; // ### TODO: remove, as i is over-written later int nlen = 0; QCString macroName; while (c[nlen] && (c[nlen] != ' ') && (c[nlen] != '\t') && (c[nlen] != '\n') && (c[nlen] != escapesym)) { macroName+=c[nlen]; nlen++; } j = nlen; while (c[j] && c[j]==' ' || c[j]=='\t') j++; /* search macro database of self-defined macros */ QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(macroName); if (it!=s_stringDefinitionMap.end()) { kdDebug(7107) << "CALLING MACRO: " << macroName << endl; const QCString oldDollarZero = s_dollarZero; // Previous value of $0 s_dollarZero = macroName; sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; for (i=1;i<words; i++) wordlist[i][-1]='\0'; for (i=0; i<words; i++) { char *h=NULL; if (mandoc_command) scan_troff_mandoc(wordlist[i],1,&h); else scan_troff(wordlist[i],1,&h); wordlist[i] = qstrdup(h); delete [] h; } for ( i=words; i<max_wordlist; i++ ) wordlist[i]=NULL; if ( !(*it).m_output.isEmpty() ) { //kdDebug(7107) << "Macro content is: " << endl << (*it).m_output << endl; const unsigned int length = (*it).m_output.length(); char* work = new char [length+2]; work[0] = '\n'; // The macro must start after an end of line to allow a request on first line qstrncpy(work+1,(*it).m_output.data(),length+1); const QValueList<char*> oldArgumentList( s_argumentList ); s_argumentList.clear(); for ( i = 0 ; i < max_wordlist; i++ ) { if (!wordlist[i]) break; s_argumentList.push_back( wordlist[i] ); } const int onff=newline_for_fun; if (mandoc_command) scan_troff_mandoc( work + 1, 0, NULL ); else scan_troff( work + 1, 0, NULL); delete[] work; newline_for_fun=onff; s_argumentList = oldArgumentList; } for (i=0; i<words; i++) delete [] wordlist[i]; *sl='\n'; s_dollarZero = oldDollarZero; kdDebug(7107) << "ENDING MACRO: " << macroName << endl; } else { kdDebug(7107) << "REQUEST: " << macroName << endl; switch (int request = get_request(c, nlen)) { case REQ_ab: // groff(7) "ABort" { h=c+j; while (*h && *h !='\n') h++; *h='\0'; if (scaninbuff && buffpos) { buffer[buffpos]='\0'; kdDebug(7107) << "ABORT: " << buffer << endl; } // ### TODO find a way to display it to the user kdDebug(7107) << "Aborting: .ab " << (c+j) << endl; return 0; break; } case REQ_An: // mdoc(7) "Author Name" { c+=j; c=scan_troff_mandoc(c,1,0); break; } case REQ_di: // groff(7) "end current DIversion" { kdDebug(7107) << "Start .di" << endl; c+=j; if (*c=='\n') { ++c; break; } const QCString name ( scan_identifier( c ) ); while (*c && *c!='\n') c++; c++; h=c; while (*c && qstrncmp(c,".di",3)) while (*c && *c++!='\n'); *c='\0'; char* result=0; scan_troff(h,0,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { (*it).m_length=0; (*it).m_output=result; } delete[] result; if (*c) *c='.'; c=skip_till_newline(c); kdDebug(7107) << "end .di" << endl; break; } case REQ_ds: // groff(7) "Define String variable" mode=true; case REQ_as: // groff (7) "Append String variable" { kdDebug(7107) << "start .ds/.as" << endl; int oldcurpos=curpos; c+=j; const QCString name( scan_identifier( c) ); if ( name.isEmpty() ) break; while (*c && isspace(*c)) c++; if (*c && *c=='"') c++; single_escape=true; curpos=0; char* result=0; c=scan_troff(c,1,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=curpos; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { if (mode) { // .ds Defining String (*it).m_length=curpos; (*it).m_output=result; } else { // .as Appending String (*it).m_length+=curpos; (*it).m_output+=result; } } delete[] result; single_escape=false; curpos=oldcurpos; kdDebug(7107) << "end .ds/.as" << endl; break; } case REQ_br: // groff(7) "line BReak" { if (still_dd) out_html("<DD>"); // ### VERIFY (does not look like generating good HTML) else out_html("<BR>\n"); curpos=0; c=c+j; if (c[0]==escapesym) c=scan_escape(c+1); c=skip_till_newline(c); break; } case REQ_c2: // groff(7) "reset non-break Control character" (2 means non-break) { c=c+j; if (*c!='\n') nobreaksym=*c; else nobreaksym='\''; c=skip_till_newline(c); break; } case REQ_cc: // groff(7) "reset Control Character" { c=c+j; if (*c!='\n') controlsym=*c; else controlsym='.'; c=skip_till_newline(c); break; } case REQ_ce: // groff (7) "CEnter" { c=c+j; if (*c=='\n') i=1; else { i=0; while ('0'<=*c && *c<='9') { i=i*10+*c-'0'; c++; } } c=skip_till_newline(c); /* center next i lines */ if (i>0) { out_html("<CENTER>\n"); while (i && *c) { char *line=NULL; c=scan_troff(c,1, &line); if (line && qstrncmp(line, "<BR>", 4)) { out_html(line); out_html("<BR>\n"); delete [] line; i--; } } out_html("</CENTER>\n"); curpos=0; } break; } case REQ_ec: // groff(7) "reset Escape Character" { c=c+j; if (*c!='\n') escapesym=*c; else escapesym='\\'; break; c=skip_till_newline(c); } case REQ_eo: // groff(7) "turn Escape character Off" { escapesym='\0'; c=skip_till_newline(c); break; } case REQ_ex: // groff(7) "EXit" { return 0; break; } case REQ_fc: // groff(7) "set Field and pad Character" { c=c+j; if (*c=='\n') fieldsym=padsym='\0'; else { fieldsym=c[0]; padsym=c[1]; } c=skip_till_newline(c); break; } case REQ_fi: // groff(7) "FIll" { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_ft: // groff(7) "previous FonT" { c=c+j; if (*c=='\n') out_html(set_font("R"));#if 0 else { // ### FIXME if (*c==escapesym) { int fn; c=scan_expression(c, &fn); c--; out_html(set_font(fn)); } else { out_html(set_font(*c)); c++; } }#endif c=skip_till_newline(c); break; } case REQ_el: // groff(7) "ELse" { int ifelseval = s_ifelseval.pop(); /* .el anything : else part of if else */ if (ifelseval) { c=c+j; c[-1]='\n'; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c+j); break; } case REQ_ie: // groff(7) "If with Else" /* .ie c anything : then part of if else */ case REQ_if: // groff(7) "IF" { /* .if c anything * .if !c anything * .if N anything * .if !N anything * .if 'string1'string2' anything * .if !'string1'string2' anything */ c=c+j; c=scan_expression(c, &i); if (request == REQ_ie) { int ifelseval=!i; s_ifelseval.push( ifelseval ); } if (i) { *c='\n'; c++; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c); break; } case REQ_ig: // groff(7) "IGnore" { const char *endwith="..\n"; i=3; c=c+j; if (*c!='\n' && *c != '\\') { /* Not newline or comment */ endwith=c-1;i=1; c[-1]='.'; while (*c && *c!='\n') c++,i++; } c++; while (*c && qstrncmp(c,endwith,i)) while (*c++!='\n'); while (*c && *c++!='\n'); break; } case REQ_nf: // groff(7) "No Filling" { if (fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; c=skip_till_newline(c); break; } case REQ_ps: // groff(7) "previous Point Size" { c=c+j; if (*c=='\n') out_html(change_to_size('0')); else { j=0; i=0; if (*c=='-') { j= -1; c++; } else if (*c=='+') j=1;c++; c=scan_expression(c, &i); if (!j) { j=1; if (i>5) i=i-10; } out_html(change_to_size(i*j)); } c=skip_till_newline(c); break; } case REQ_sp: // groff(7) "SKip one line" { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_so: // groff(7) "Include SOurce file" { char *buf; char *name=NULL; curpos=0; c=c+j; if (*c=='/') h=c; else { h=c-3; h[0]='.'; h[1]='.'; h[2]='/'; } while (*c!='\n') c++; *c='\0'; scan_troff(h,1, &name); if (name[3]=='/') h=name+3; else h=name; /* this works alright, except for section 3 */ buf=read_man_page(h); if (!buf) { kdDebug(7107) << "Unable to open or read file: .so " << (h) << endl; out_html("<BLOCKQUOTE>" "man2html: unable to open or read file.\n"); out_html(h); out_html("</BLOCKQUOTE>\n"); } else scan_troff(buf+1,0,NULL); delete [] buf; delete [] name; *c++='\n'; break; } case REQ_ta: // gorff(7) "set TAbulators" { c=c+j; j=0; while (*c!='\n') { sl=scan_expression(c, &tabstops[j]); if (j>0 && (*c=='-' || *c=='+')) tabstops[j]+=tabstops[j-1]; c=sl; while (*c==' ' || *c=='\t') c++; j++; } maxtstop=j; curpos=0; break; } case REQ_ti: // groff(7) "Temporary Indent" { /*while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else itemdepth--; }*/ out_html("<BR>\n"); c=c+j; c=scan_expression(c, &j); for (i=0; i<j; i++) out_html("&nbsp;"); curpos=j; c=skip_till_newline(c); break; } case REQ_tm: // groff(7) "TerMinal" ### TODO: what are useful uses for it { c=c+j; h=c; while (*c!='\n') c++; *c='\0'; kdDebug(7107) << ".tm " << (h) << endl; *c='\n'; break; } case REQ_B: // man(7) "Bold" mode=1; case REQ_I: // man(7) "Italic" { /* parse one line in a certain font */ out_html( set_font( mode?"B":"I" ) ); fill_words(c, wordlist, &words, false, 0); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fd: // mdoc(7) "Function Definition" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } if (mandoc_synopsis) { out_html(");"); out_html("<br>"); }; out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fn: // mdoc(7) for "Function calls" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); if (!words) { out_html(" ()"); } else { for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } else if (i<words-1) out_html(", "); } out_html(")"); } out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fo: // mdoc(7) "Function definition Opening" { char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); // Normally a .Fo has only one parameter for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } // ### TODO What should happen if there is more than one argument // else if (i<words-1) out_html(", "); } function_argument=1; // Must be > 0 out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fc:// mdoc(7) "Function definition Close" { // .Fc has no parameter c+=j; c=skip_till_newline(c); char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME out_html(set_font(font[i&1])); out_html(")"); out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; function_argument=0; // Reset the count variable break; } case REQ_Fa: // mdoc(7) "Function definition argument" { char font[2] ; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font(font[i&1])); // function_argument==0 means that we had no .Fo before, e.g. in mdoc.samples(7) if (function_argument > 1) { out_html(", "); curpos+=2; function_argument++; } else if (function_argument==1) { // We are only at the first parameter function_argument++; } for (i=0; i<words; i++) { wordlist[i][-1]=' '; scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (!fillout) curpos=0; else curpos++; break; } case REQ_OP: /* groff manpages use this construction */ /* .OP a b : [ <B>a</B> <I>b</I> ] */ mode=true; c[0]='B'; c[1]='I'; out_html(set_font("R")); out_html("["); curpos++; // Do not break! case REQ_Ft: //perhaps "Function return type" case REQ_BR: case REQ_BI: case REQ_IB: case REQ_IR: case REQ_RB: case REQ_RI: { // ### VERIFY bool inFMode=(c[0]=='F'); if (inFMode) { c[0]='B'; c[1]='I'; }; char font[2] ; font[0] = c[0]; font[1] = c[1]; c=c+j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); /* .BR name (section) * indicates a link. It will be added in the output routine. */ for (i=0; i<words; i++) { if ((mode) || (inFMode)) { out_html(" "); curpos++; } wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (mode) { out_html(" ]"); curpos++; } out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_DT: // man(7) "Default Tabulators" { for (j=0;j<20; j++) tabstops[j]=(j+1)*8; maxtstop=20; c=skip_till_newline(c); break; } case REQ_IP: // man(7) "Ident Paragraph" { sl=fill_words(c+j, wordlist, &words, true, &c); if (!dl_set[itemdepth]) { out_html("<DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); if (words) scan_troff(wordlist[0], 1,NULL); out_html("<DD>"); curpos=0; break; } case REQ_TP: // man(7) "hanging Tag Paragraph" { if (!dl_set[itemdepth]) { out_html("<br><br><DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); c=skip_till_newline(c); /* somewhere a definition ends with '.TP' */ if (!*c) still_dd=true; else { c=scan_troff(c,1,NULL); out_html("<DD>"); } curpos=0; break; } case REQ_IX: // "INdex" ### TODO: where is it defined? { /* general index */ c=skip_till_newline(c); break; } case REQ_P: // man(7) "Paragraph" case REQ_LP:// man(7) "Paragraph" case REQ_PP:// man(7) "Paragraph; reset Prevailing indent" { if (dl_set[itemdepth]) { out_html("</DL>\n"); dl_set[itemdepth]=0; } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_HP: // man(7) "Hanging indent Paragraph" { if (!dl_set[itemdepth]) { out_html("<DL>"); dl_set[itemdepth]=1; } out_html("<DT>\n"); still_dd=true; c=skip_till_newline(c); curpos=0; break; } case REQ_PD: // man(7) "Paragraph Distance" { c=skip_till_newline(c); break; } case REQ_Rs: // mdoc(7) "Relative margin Start" case REQ_RS: // man(7) "Relative margin Start" { sl=fill_words(c+j, wordlist, &words, true, 0); j=1; if (words>0) scan_expression(wordlist[0], &j); if (j>=0) { itemdepth++; dl_set[itemdepth]=0; out_html("<DL><DT><DD>"); c=skip_till_newline(c); curpos=0; break; } } case REQ_Re: // mdoc(7) "Relative margin End" case REQ_RE: // man(7) "Relative margin End" { if (itemdepth > 0) { if (dl_set[itemdepth]) out_html("</DL>"); out_html("</DL>\n"); itemdepth--; } c=skip_till_newline(c); curpos=0; break; } case REQ_SB: // man(7) "Small; Bold" { out_html(set_font("B")); out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c+j, 1, NULL); out_html("</small>"); out_html(set_font("R")); break; } case REQ_SM: // man(7) "SMall" { c=c+j; if (*c=='\n') c++; out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c,1,NULL); out_html("</small>"); break; } case REQ_Ss: // mdoc(7) "Sub Section" mandoc_command = 1; case REQ_SS: // mdoc(7) "Sub Section" mode=true; case REQ_Sh: // mdoc(7) "Sub Header" /* hack for fallthru from above */ mandoc_command = !mode || mandoc_command; case REQ_SH: // man(7) "Sub Header" { c=c+j; if (*c=='\n') c++; while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else if (itemdepth > 0) itemdepth--; } out_html(set_font("R")); out_html(change_to_size(0)); if (!fillout) { fillout=1; out_html("</PRE>"); } trans_char(c,'"', '\a'); if (section) { out_html("</div>\n"); section=0; } if (mode) out_html("\n<H3>"); else out_html("\n<H2>"); mandoc_synopsis = qstrncmp(c, "SYNOPSIS", 8) == 0; c = mandoc_command ? scan_troff_mandoc(c,1,NULL) : scan_troff(c,1,NULL); if (mode) out_html("</H3>\n"); else out_html("</H2>\n"); out_html("<div>\n"); section=1; curpos=0; break; } case REQ_Sx: // mdoc(7) { // reference to a section header out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_TS: // ### TODO where is it defined? (tbl?) { c=scan_table(c); break; } case REQ_Dt: /* mdoc(7) */ mandoc_command = true; case REQ_TH: // man(7) "Title Header" { if (!output_possible) { sl = fill_words(c+j, wordlist, &words, true, &c); // ### TODO: the page should be displayed even if it is "anonymous" (words==0) if (words>=1) { for (i=1; i<words; i++) wordlist[i][-1]='\0'; *sl='\0'; for (i=0; i<words; i++) { if (wordlist[i][0] == '\007') wordlist[i]++; if (wordlist[i][qstrlen(wordlist[i])-1] == '\007') wordlist[i][qstrlen(wordlist[i])-1] = 0; } output_possible=true; out_html( DOCTYPE"<HTML>\n<HEAD>\n");#ifdef SIMPLE_MAN2HTML // Most English man pages are in ISO-8859-1 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");#else // kio_man transforms from local to UTF-8 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset="); out_html(QTextCodec::codecForLocale()->mimeName()); out_html("\">\n");#endif out_html("<TITLE>"); out_html(scan_troff(wordlist[0], 0, NULL)); out_html( " Manpage</TITLE>\n"); out_html( "<link rel=\"stylesheet\" href=\""); out_html(htmlPath); out_html("/kde-default.css\" type=\"text/css\">\n" ); out_html( "<meta name=\"ROFF Type\" content=\""); if (mandoc_command) out_html("mdoc"); else out_html("man"); out_html("\">\n"); out_html( "</HEAD>\n\n" ); out_html("<BODY BGCOLOR=\"#FFFFFF\">\n\n" ); out_html("<div style=\"background-image: url("); out_html(cssPath); out_html("/top-middle.png); width: 100%; height: 131pt;\">\n" ); out_html("<div style=\"position: absolute; right: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-right-konqueror.png\" style=\"margin: 0pt\" alt=\"Top right\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; left: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-left.png\" style=\"margin: 0pt\" alt=\"Top left\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; top: 25pt; right: 100pt; text-align: right; font-size: xx-large; font-weight: bold; text-shadow: #fff 0pt 0pt 5pt; color: #444\">\n"); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html("</div>\n"); out_html("</div>\n"); out_html("<div style=\"margin-left: 5em; margin-right: 5em;\">\n"); out_html("<h1>" ); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html( "</h1>\n" ); if (words>1) { out_html("Section: " ); if (!mandoc_command && words>4) out_html(scan_troff(wordlist[4], 0, NULL) ); else out_html(section_name(wordlist[1])); out_html(" ("); out_html(scan_troff(wordlist[1], 0, NULL)); out_html(")\n"); } else { out_html("Section not specified"); } *sl='\n'; } } else { kdWarning(7107) << ".TH found but output not possible" << endl; c=skip_till_newline(c); } curpos=0; break; } case REQ_TX: // mdoc(7) { sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; out_html(set_font("I")); if (words>1) wordlist[1][-1]='\0'; const char *c2=lookup_abbrev(wordlist[0]); curpos+=qstrlen(c2); out_html(c2); out_html(set_font("R")); if (words>1) out_html(wordlist[1]); *sl='\n'; break; } case REQ_rm: // groff(7) "ReMove" /* .rm xx : Remove request, macro or string */ mode=true; case REQ_rn: // groff(7) "ReName" /* .rn xx yy : Rename request, macro or string xx to yy */ { kdDebug(7107) << "start .rm/.rn" << endl; c+=j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } QCString name2; if ( !mode ) { while (*c && isspace(*c) && *c!='\n') ++c; name2 = scan_identifier( c ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to rename: " << endl; break; } } c=skip_till_newline(c); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to rename or remove: " << name << endl; } else { if (mode) { // .rm ReMove s_stringDefinitionMap.remove(name); // ### QT4: removeAll } else { // .rn ReName StringDefinition def=(*it); s_stringDefinitionMap.remove(name); // ### QT4: removeAll s_stringDefinitionMap.insert(name2,def); } } kdDebug(7107) << "end .rm/.rn" << endl; break; } case REQ_nx: // ### TODO in man(7) it is "No filling", not "next file" /* .nx filename : next file. */ case REQ_in: // groff(7) "INdent" { /* .in +-N : Indent */ c=skip_till_newline(c); break; } case REQ_nr: // groff(7) "Number Register" { kdDebug(7107) << "start .nr" << endl; c += j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty name for register variable" << endl; break; } while ( *c && ( *c==' ' || *c=='\t' ) ) c++; int sign = 0; if ( *c && ( *c == '+' || *c == '-' ) ) { if ( *c == '+' ) sign = 1; else if ( *c == '-' ) sign = -1; } int value = 0; int increment = 0; c=scan_expression( c, &value ); if ( *c && *c!='\n') { while ( *c && ( *c==' ' || *c=='\t' ) ) c++; c=scan_expression( c, &increment ); } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { if ( sign < 1 ) value = -value; NumberDefinition def( value, increment ); s_numberDefinitionMap.insert( name, def ); } else { if ( sign > 0 ) (*it).m_value += value; else if ( sign < 0 ) (*it).m_value += - value; else (*it).m_value = value; (*it).m_increment = increment; } kdDebug(7107) << "end .nr" << endl; break; } case REQ_am: // groff(7) "Append Macro" /* .am xx yy : append to a macro. */ /* define or handle as .ig yy */ mode=true; case REQ_de: // groff(7) "DEfine macro" /* .de xx yy : define or redefine macro xx; end at .yy (..) */ /* define or handle as .ig yy */ { kdDebug(7107) << "Start .am/.de" << endl; c+=j; char *next_line; sl = fill_words(c, wordlist, &words, true, &next_line); char *nameStart = wordlist[0]; c = nameStart; while (*c && (*c != ' ') && (*c != '\n')) c++; *c = '\0'; const QCString name(nameStart); QCString endmacro; if (words == 1) { endmacro=".."; } else { endmacro='.'; c = wordlist[1]; while (*c && (*c != ' ') && (*c != '\n')) endmacro+=*c++; } c = next_line; sl=c; const int length=qstrlen(endmacro); while (*c && qstrncmp(c,endmacro,length)) c=skip_till_newline(c); QCString macro; while (sl!=c) { if (sl[0]=='\\' && sl[1]=='\\') { macro+='\\'; sl++; } else macro+=*sl; sl++; } QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=macro; s_stringDefinitionMap.insert(name,def); } else if (mode) { // .am Append Macro (*it).m_length=0; // It could be formerly a string if ((*it).m_output.right(1)!='\n') (*it).m_output+='\n'; (*it).m_output+=macro; } else { // .de DEfine macro (*it).m_length=0; // It could be formerly a string (*it).m_output=macro; } c=skip_till_newline(c); kdDebug(7107) << "End .am/.de" << endl; break; } case REQ_Bl: // mdoc(7) "Begin List" { char list_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (dl_set[itemdepth]) /* These things can nest. */ itemdepth++; if (nl) { /* Parse list options */ strlimitcpy(list_options, c, nl - c, MED_STR_MAX); } if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */ dl_set[itemdepth] = BL_BULLET_LIST; out_html("<UL>\n"); } else if (strstr(list_options, "-enum")) { /* HTML Ordered List */ dl_set[itemdepth] = BL_ENUM_LIST; out_html("<OL>\n"); } else { /* HTML Descriptive List */ dl_set[itemdepth] = BL_DESC_LIST; out_html("<DL>\n"); } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_El: // mdoc(7) "End List" { c=c+j; if (dl_set[itemdepth] & BL_DESC_LIST) out_html("</DL>\n"); else if (dl_set[itemdepth] & BL_BULLET_LIST) out_html("</UL>\n"); else if (dl_set[itemdepth] & BL_ENUM_LIST) out_html("</OL>\n"); dl_set[itemdepth]=0; if (itemdepth > 0) itemdepth--; if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_It: // mdoc(7) "list ITem" { c=c+j; if (qstrncmp(c, "Xo", 2) == 0 && isspace(*(c+2))) c = skip_till_newline(c); if (dl_set[itemdepth] & BL_DESC_LIST) { out_html("<DT>"); out_html(set_font("B")); if (*c=='\n') { /* Don't allow embedded comms after a newline */ c++; c=scan_troff(c,1,NULL); } else { /* Do allow embedded comms on the same line. */ c=scan_troff_mandoc(c,1,NULL); } out_html(set_font("R")); out_html(NEWLINE); out_html("<DD>"); } else if (dl_set[itemdepth] & (BL_BULLET_LIST | BL_ENUM_LIST)) { out_html("<LI>"); c=scan_troff_mandoc(c,1,NULL); out_html(NEWLINE); } if (fillout) curpos++; else curpos=0; break; } case REQ_Bk: /* mdoc(7) */ case REQ_Ek: /* mdoc(7) */ case REQ_Dd: /* mdoc(7) */ case REQ_Os: // mdoc(7) "Operating System" { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Bt: // mdoc(7) "Beta Test" { trans_char(c,'"','\a'); c=c+j; out_html(" is currently in beta test."); if (fillout) curpos++; else curpos=0; break; } case REQ_At: /* mdoc(7) */ case REQ_Fx: /* mdoc(7) */ case REQ_Nx: /* mdoc(7) */ case REQ_Ox: /* mdoc(7) */ case REQ_Bx: /* mdoc(7) */ case REQ_Ux: /* mdoc(7) */ { bool parsable=true; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; if (request==REQ_At) { out_html("AT&amp;T UNIX "); parsable=false; } else if (request==REQ_Fx) { out_html("FreeBSD "); parsable=false; } else if (request==REQ_Nx) out_html("NetBSD "); else if (request==REQ_Ox) out_html("OpenBSD "); else if (request==REQ_Bx) out_html("BSD "); else if (request==REQ_Ux) out_html("UNIX "); if (parsable) c=scan_troff_mandoc(c,1,0); else c=scan_troff(c,1,0); if (fillout) curpos++; else curpos=0; break; } case REQ_Dl: /* mdoc(7) */ { c=c+j; out_html(NEWLINE); out_html("<BLOCKQUOTE>"); if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</BLOCKQUOTE>"); if (fillout) curpos++; else curpos=0; break; } case REQ_Bd: /* mdoc(7) */ { /* Seems like a kind of example/literal mode */ char bd_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (nl) strlimitcpy(bd_options, c, nl - c, MED_STR_MAX); out_html(NEWLINE); mandoc_bd_options = 0; /* Remember options for terminating Bl */ if (strstr(bd_options, "-offset indent")) { mandoc_bd_options |= BD_INDENT; out_html("<BLOCKQUOTE>\n"); } if ( strstr(bd_options, "-literal") || strstr(bd_options, "-unfilled")) { if (fillout) { mandoc_bd_options |= BD_LITERAL; out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; } c=skip_till_newline(c); break; } case REQ_Ed: /* mdoc(7) */ { if (mandoc_bd_options & BD_LITERAL) { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } } if (mandoc_bd_options & BD_INDENT) out_html("</BLOCKQUOTE>\n"); curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_Be: /* mdoc(7) */ { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Xr: /* mdoc(7) */ // ### FIXME: it should issue a <a href="man:somewhere(x)"> directly { /* Translate xyz 1 to xyz(1) * Allow for multiple spaces. Allow the section to be missing. */ char buff[NULL_TERMINATED(MED_STR_MAX)]; char *bufptr; trans_char(c,'"','\a'); bufptr = buff; c = c+j; if (*c == '\n') c++; /* Skip spaces */ while (isspace(*c) && *c != '\n') c++; while (isalnum(*c) || *c == '.' || *c == ':' || *c == '_' || *c == '-') { /* Copy the xyz part */ *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } while (isspace(*c) && *c != '\n') c++; /* Skip spaces */ if (isdigit(*c)) { /* Convert the number if there is one */ *bufptr = '('; bufptr++; if (bufptr < buff + MED_STR_MAX) { while (isalnum(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } if (bufptr < buff + MED_STR_MAX) { *bufptr = ')'; bufptr++; } } } while (*c != '\n') { /* Copy the remainder */ if (!isspace(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; } c++; } *bufptr = '\n'; bufptr[1] = 0; scan_troff_mandoc(buff, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fl: // mdoc(7) "FLags" { trans_char(c,'"','\a'); c+=j; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font("B")); if (!words) { out_html("-"); // stdin or stdout } else { for (i=0;i<words;++i) { if (ispunct(wordlist[i][0]) && wordlist[i][0]!='-') { scan_troff_mandoc(wordlist[i], 1, NULL); } else { if (i>0) out_html(" "); // Put a space between flags out_html("-"); scan_troff_mandoc(wordlist[i], 1, NULL); } } } out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pa: /* mdoc(7) */ case REQ_Pf: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pp: /* mdoc(7) */ { if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Aq: // mdoc(7) "Angle bracket Quote" c=process_quote(c,j,"&lt;","&gt;"); break; case REQ_Bq: // mdoc(7) "Bracket Quote" c=process_quote(c,j,"[","]"); break; case REQ_Dq: // mdoc(7) "Double Quote" c=process_quote(c,j,"&ldquo;","&rdquo;"); break; case REQ_Pq: // mdoc(7) "Parenthese Quote" c=process_quote(c,j,"(",")"); break; case REQ_Qq: // mdoc(7) "straight double Quote" c=process_quote(c,j,"&quot;","&quot;"); break; case REQ_Sq: // mdoc(7) "Single Quote" c=process_quote(c,j,"&lsquo;","&rsquo;"); break; case REQ_Op: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Oo: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); if (fillout) curpos++; else curpos=0; break; } case REQ_Oc: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); if (fillout) curpos++; else curpos=0; break; } case REQ_Ql: /* mdoc(7) */ { /* Single quote first word in the line */ char *sp; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; sp = c; do { /* Find first whitespace after the * first word that isn't a mandoc macro */ while (*sp && isspace(*sp)) sp++; while (*sp && !isspace(*sp)) sp++; } while (*sp && isupper(*(sp-2)) && islower(*(sp-1))); /* Use a newline to mark the end of text to * be quoted */ if (*sp) *sp = '\n'; out_html("`"); /* Quote the text */ c=scan_troff_mandoc(c, 1, NULL); out_html("'"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ar: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') { /* An empty Ar means "file ..." */ out_html("file ..."); } else c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Em: /* mdoc(7) */ { out_html("<em>"); trans_char(c,'"','\a'); c+=j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</em>"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ad: /* mdoc(7) */ case REQ_Va: /* mdoc(7) */ case REQ_Xc: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nd: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(" - "); c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nm: // mdoc(7) "Name Macro" ### FIXME { static char mandoc_name[NULL_TERMINATED(SMALL_STR_MAX)] = ""; // ### TODO Use QCString trans_char(c,'"','\a'); c=c+j; if (mandoc_synopsis && mandoc_name_count) { /* Break lines only in the Synopsis. * The Synopsis section seems to be treated * as a special case - Bummer! */ out_html("<BR>"); } else if (!mandoc_name_count) { const char *nextbreak = strchr(c, '\n'); const char *nextspace = strchr(c, ' '); if (nextspace < nextbreak) nextbreak = nextspace; if (nextbreak) { /* Remember the name for later. */ strlimitcpy(mandoc_name, c, nextbreak - c, SMALL_STR_MAX); } } mandoc_name_count++; out_html(set_font("B")); // ### FIXME: fill_words must be used while (*c == ' '|| *c == '\t') c++; if ((tolower(*c) >= 'a' && tolower(*c) <= 'z' ) || (*c >= '0' && *c <= '9')) { // alphanumeric argument c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); } else { /* If Nm has no argument, use one from an earlier * Nm command that did have one. Hope there aren't * too many commands that do this. */ out_html(mandoc_name); out_html(set_font("R")); } if (fillout) curpos++; else curpos=0; break; } case REQ_Cd: /* mdoc(7) */ case REQ_Cm: /* mdoc(7) */ case REQ_Ic: /* mdoc(7) */ case REQ_Ms: /* mdoc(7) */ case REQ_Or: /* mdoc(7) */ case REQ_Sy: /* mdoc(7) */ { /* parse one line in bold */ out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Dv: /* mdoc(7) */ case REQ_Ev: /* mdoc(7) */ case REQ_Fr: /* mdoc(7) */ case REQ_Li: /* mdoc(7) */ case REQ_No: /* mdoc(7) */ case REQ_Ns: /* mdoc(7) */ case REQ_Tn: /* mdoc(7) */ case REQ_nN: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("B")); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_perc_A: /* mdoc(7) biblio stuff */ case REQ_perc_D: case REQ_perc_N: case REQ_perc_O: case REQ_perc_P: case REQ_perc_Q: case REQ_perc_V: { c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ if (fillout) curpos++; else curpos=0; break; } case REQ_perc_B: case REQ_perc_J: case REQ_perc_R: case REQ_perc_T: { c=c+j; out_html(set_font("I")); if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ out_html(set_font("R")); if (fillout) curpos++; else curpos=0; break; } case REQ_UR: // ### FIXME man(7) "URl" { ignore_links=true; c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; // A parameter : means that we do not want an URL, not here and not until .UE ur_ignore=(!qstrcmp(h,":")); } else { // We cannot find the URL, assume : ur_ignore=true; h=0; } if (!ur_ignore && words>0) { out_html("<a href=\""); out_html(h); out_html("\">"); } c=newc; // Go to next line break; } case REQ_UE: // ### FIXME man(7) "Url End" { c+=j; c = skip_till_newline(c); if (!ur_ignore) { out_html("</a>"); } ur_ignore=false; ignore_links=false; break; } case REQ_UN: // ### FIXME man(7) "Url Named anchor" { c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; out_html("<a name=\">"); out_html(h); out_html("\" id=\""); out_html(h); out_html("\"></a>"); } c=newc; break; } case REQ_nroff: // groff(7) "NROFF mode" mode = true; case REQ_troff: // groff(7) "TROFF mode" { s_nroff = mode; c+=j; c = skip_till_newline(c); } case REQ_als: // groff(7) "ALias String" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rn, the destination is first, origin is second kdDebug(7107) << "start .als" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c=skip_till_newline(c); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination string to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rn) QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name2); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { StringDefinition def=(*it); s_stringDefinitionMap.insert(name,def); } kdDebug(7107) << "end .als" << endl; break; } case REQ_rr: // groff(7) "Remove number Register" { kdDebug(7107) << "start .rr" << endl; c += j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { kdDebug(7107) << "EXCEPTION: trying to remove inexistant number register: " << endl; } else { s_numberDefinitionMap.remove( name ); } kdDebug(7107) << "end .rr" << endl; break; } case REQ_rnn: // groff(7) "ReName Number register" { kdDebug(7107) << "start .rnn" << endl; c+=j; const QCString name ( scan_identifier ( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin to remove/rename number register" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination to rename number register " << endl; break; } c = skip_till_newline( c ); QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find number register to rename: " << name << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.remove(name); // ### QT4: removeAll s_numberDefinitionMap.insert(name2,def); } kdDebug(7107) << "end .rnn" << endl; break; } case REQ_aln: // groff(7) "ALias Number Register" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rnn, the destination is first, origin is second kdDebug(7107) << "start .aln" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination number register to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin number register to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c = skip_till_newline( c ); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination number register to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rnn) QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name2); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.insert(name,def); } kdDebug(7107) << "end .aln" << endl; break; } case REQ_shift: // groff(7) "SHIFT parameter" { c+=j; h=c; while (*h && *h!='\n' && isdigit(*h) ) ++h; const char tempchar = *h; *h = 0; const QCString number = c; *h = tempchar; c = skip_till_newline( h ); unsigned int result = 1; // Numbers of shifts to do if ( !number.isEmpty() ) { bool ok = false; result = number.toUInt(&ok); if ( !ok || result < 1 ) result = 1; } for ( unsigned int num = 0; num < result; ++num ) { if ( !s_argumentList.isEmpty() ) s_argumentList.pop_front(); } break; } case REQ_while: // groff(7) "WHILE loop" { request_while( c, j, mandoc_command ); break; } default: { if (mandoc_command && ((isupper(*c) && islower(*(c+1))) || (islower(*c) && isupper(*(c+1)))) ) { /* Let through any mdoc(7) commands that haven't * been delt with. * I don't want to miss anything out of the text. */ char buf[4]; qstrncpy(buf,c,2); buf[2] = ' '; buf[3] = '\0'; out_html(buf); /* Print the command (it might just be text). */ c=c+j; trans_char(c,'"','\a'); if (*c=='\n') c++; out_html(set_font("R")); c=scan_troff(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; } else c=skip_till_newline(c); break; } } } } if (fillout) { out_html(NEWLINE); curpos++; } return c;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a2a0d621d2afd22ae7cf2ad733a2ce62a96b2010/man2html.cpp/buggy/kioslave/man/man2html.cpp
bool inFMode=(c[0]=='F'); if (inFMode) { c[0]='B'; c[1]='I'; }; char font[2] ; font[0] = c[0]; font[1] = c[1]; c=c+j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); /* .BR name (section) * indicates a link. It will be added in the output routine. */ for (i=0; i<words; i++) { if ((mode) || (inFMode)) { out_html(" "); curpos++; } wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (mode) { out_html(" ]"); curpos++; } out_html(NEWLINE); if (!fillout) curpos=0; else curpos++;
request_mixed_fonts( c, j, "R", "I", false, false );
static char *scan_request(char *c){ // mdoc(7) stuff static bool mandoc_synopsis=false; /* True if we are in the synopsis section */ static bool mandoc_command=false; /* True if this is mdoc(7) page */ static int mandoc_bd_options; /* Only copes with non-nested Bd's */ static int function_argument=0; // Number of function argument (.Fo, .Fa, .Fc) // man(7) stuff static bool ur_ignore=false; // Has .UR a parameter : (for .UE to know if or not to write </a>) int i=0; bool mode=false; char *h=0; const int max_wordlist=100; char *wordlist[max_wordlist]; int words; char *sl; while (*c==' ' || *c=='\t') c++; // Spaces or tabs allowed between control character and request if (c[0]=='\n') return c+1; if (c[0]==escapesym) { /* some pages use .\" .\$1 .\} */ /* .\$1 is too difficult/stuppid */ if (c[1]=='$') { kdDebug(7107) << "Found .\\$" << endl; c=skip_till_newline(c); // ### TODO } else c = scan_escape(c+1); } else { int j; if (c[1]=='\n') j=1; else j=2; // ### TODO: remove, as i is over-written later int nlen = 0; QCString macroName; while (c[nlen] && (c[nlen] != ' ') && (c[nlen] != '\t') && (c[nlen] != '\n') && (c[nlen] != escapesym)) { macroName+=c[nlen]; nlen++; } j = nlen; while (c[j] && c[j]==' ' || c[j]=='\t') j++; /* search macro database of self-defined macros */ QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(macroName); if (it!=s_stringDefinitionMap.end()) { kdDebug(7107) << "CALLING MACRO: " << macroName << endl; const QCString oldDollarZero = s_dollarZero; // Previous value of $0 s_dollarZero = macroName; sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; for (i=1;i<words; i++) wordlist[i][-1]='\0'; for (i=0; i<words; i++) { char *h=NULL; if (mandoc_command) scan_troff_mandoc(wordlist[i],1,&h); else scan_troff(wordlist[i],1,&h); wordlist[i] = qstrdup(h); delete [] h; } for ( i=words; i<max_wordlist; i++ ) wordlist[i]=NULL; if ( !(*it).m_output.isEmpty() ) { //kdDebug(7107) << "Macro content is: " << endl << (*it).m_output << endl; const unsigned int length = (*it).m_output.length(); char* work = new char [length+2]; work[0] = '\n'; // The macro must start after an end of line to allow a request on first line qstrncpy(work+1,(*it).m_output.data(),length+1); const QValueList<char*> oldArgumentList( s_argumentList ); s_argumentList.clear(); for ( i = 0 ; i < max_wordlist; i++ ) { if (!wordlist[i]) break; s_argumentList.push_back( wordlist[i] ); } const int onff=newline_for_fun; if (mandoc_command) scan_troff_mandoc( work + 1, 0, NULL ); else scan_troff( work + 1, 0, NULL); delete[] work; newline_for_fun=onff; s_argumentList = oldArgumentList; } for (i=0; i<words; i++) delete [] wordlist[i]; *sl='\n'; s_dollarZero = oldDollarZero; kdDebug(7107) << "ENDING MACRO: " << macroName << endl; } else { kdDebug(7107) << "REQUEST: " << macroName << endl; switch (int request = get_request(c, nlen)) { case REQ_ab: // groff(7) "ABort" { h=c+j; while (*h && *h !='\n') h++; *h='\0'; if (scaninbuff && buffpos) { buffer[buffpos]='\0'; kdDebug(7107) << "ABORT: " << buffer << endl; } // ### TODO find a way to display it to the user kdDebug(7107) << "Aborting: .ab " << (c+j) << endl; return 0; break; } case REQ_An: // mdoc(7) "Author Name" { c+=j; c=scan_troff_mandoc(c,1,0); break; } case REQ_di: // groff(7) "end current DIversion" { kdDebug(7107) << "Start .di" << endl; c+=j; if (*c=='\n') { ++c; break; } const QCString name ( scan_identifier( c ) ); while (*c && *c!='\n') c++; c++; h=c; while (*c && qstrncmp(c,".di",3)) while (*c && *c++!='\n'); *c='\0'; char* result=0; scan_troff(h,0,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { (*it).m_length=0; (*it).m_output=result; } delete[] result; if (*c) *c='.'; c=skip_till_newline(c); kdDebug(7107) << "end .di" << endl; break; } case REQ_ds: // groff(7) "Define String variable" mode=true; case REQ_as: // groff (7) "Append String variable" { kdDebug(7107) << "start .ds/.as" << endl; int oldcurpos=curpos; c+=j; const QCString name( scan_identifier( c) ); if ( name.isEmpty() ) break; while (*c && isspace(*c)) c++; if (*c && *c=='"') c++; single_escape=true; curpos=0; char* result=0; c=scan_troff(c,1,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=curpos; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { if (mode) { // .ds Defining String (*it).m_length=curpos; (*it).m_output=result; } else { // .as Appending String (*it).m_length+=curpos; (*it).m_output+=result; } } delete[] result; single_escape=false; curpos=oldcurpos; kdDebug(7107) << "end .ds/.as" << endl; break; } case REQ_br: // groff(7) "line BReak" { if (still_dd) out_html("<DD>"); // ### VERIFY (does not look like generating good HTML) else out_html("<BR>\n"); curpos=0; c=c+j; if (c[0]==escapesym) c=scan_escape(c+1); c=skip_till_newline(c); break; } case REQ_c2: // groff(7) "reset non-break Control character" (2 means non-break) { c=c+j; if (*c!='\n') nobreaksym=*c; else nobreaksym='\''; c=skip_till_newline(c); break; } case REQ_cc: // groff(7) "reset Control Character" { c=c+j; if (*c!='\n') controlsym=*c; else controlsym='.'; c=skip_till_newline(c); break; } case REQ_ce: // groff (7) "CEnter" { c=c+j; if (*c=='\n') i=1; else { i=0; while ('0'<=*c && *c<='9') { i=i*10+*c-'0'; c++; } } c=skip_till_newline(c); /* center next i lines */ if (i>0) { out_html("<CENTER>\n"); while (i && *c) { char *line=NULL; c=scan_troff(c,1, &line); if (line && qstrncmp(line, "<BR>", 4)) { out_html(line); out_html("<BR>\n"); delete [] line; i--; } } out_html("</CENTER>\n"); curpos=0; } break; } case REQ_ec: // groff(7) "reset Escape Character" { c=c+j; if (*c!='\n') escapesym=*c; else escapesym='\\'; break; c=skip_till_newline(c); } case REQ_eo: // groff(7) "turn Escape character Off" { escapesym='\0'; c=skip_till_newline(c); break; } case REQ_ex: // groff(7) "EXit" { return 0; break; } case REQ_fc: // groff(7) "set Field and pad Character" { c=c+j; if (*c=='\n') fieldsym=padsym='\0'; else { fieldsym=c[0]; padsym=c[1]; } c=skip_till_newline(c); break; } case REQ_fi: // groff(7) "FIll" { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_ft: // groff(7) "previous FonT" { c=c+j; if (*c=='\n') out_html(set_font("R"));#if 0 else { // ### FIXME if (*c==escapesym) { int fn; c=scan_expression(c, &fn); c--; out_html(set_font(fn)); } else { out_html(set_font(*c)); c++; } }#endif c=skip_till_newline(c); break; } case REQ_el: // groff(7) "ELse" { int ifelseval = s_ifelseval.pop(); /* .el anything : else part of if else */ if (ifelseval) { c=c+j; c[-1]='\n'; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c+j); break; } case REQ_ie: // groff(7) "If with Else" /* .ie c anything : then part of if else */ case REQ_if: // groff(7) "IF" { /* .if c anything * .if !c anything * .if N anything * .if !N anything * .if 'string1'string2' anything * .if !'string1'string2' anything */ c=c+j; c=scan_expression(c, &i); if (request == REQ_ie) { int ifelseval=!i; s_ifelseval.push( ifelseval ); } if (i) { *c='\n'; c++; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c); break; } case REQ_ig: // groff(7) "IGnore" { const char *endwith="..\n"; i=3; c=c+j; if (*c!='\n' && *c != '\\') { /* Not newline or comment */ endwith=c-1;i=1; c[-1]='.'; while (*c && *c!='\n') c++,i++; } c++; while (*c && qstrncmp(c,endwith,i)) while (*c++!='\n'); while (*c && *c++!='\n'); break; } case REQ_nf: // groff(7) "No Filling" { if (fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; c=skip_till_newline(c); break; } case REQ_ps: // groff(7) "previous Point Size" { c=c+j; if (*c=='\n') out_html(change_to_size('0')); else { j=0; i=0; if (*c=='-') { j= -1; c++; } else if (*c=='+') j=1;c++; c=scan_expression(c, &i); if (!j) { j=1; if (i>5) i=i-10; } out_html(change_to_size(i*j)); } c=skip_till_newline(c); break; } case REQ_sp: // groff(7) "SKip one line" { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_so: // groff(7) "Include SOurce file" { char *buf; char *name=NULL; curpos=0; c=c+j; if (*c=='/') h=c; else { h=c-3; h[0]='.'; h[1]='.'; h[2]='/'; } while (*c!='\n') c++; *c='\0'; scan_troff(h,1, &name); if (name[3]=='/') h=name+3; else h=name; /* this works alright, except for section 3 */ buf=read_man_page(h); if (!buf) { kdDebug(7107) << "Unable to open or read file: .so " << (h) << endl; out_html("<BLOCKQUOTE>" "man2html: unable to open or read file.\n"); out_html(h); out_html("</BLOCKQUOTE>\n"); } else scan_troff(buf+1,0,NULL); delete [] buf; delete [] name; *c++='\n'; break; } case REQ_ta: // gorff(7) "set TAbulators" { c=c+j; j=0; while (*c!='\n') { sl=scan_expression(c, &tabstops[j]); if (j>0 && (*c=='-' || *c=='+')) tabstops[j]+=tabstops[j-1]; c=sl; while (*c==' ' || *c=='\t') c++; j++; } maxtstop=j; curpos=0; break; } case REQ_ti: // groff(7) "Temporary Indent" { /*while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else itemdepth--; }*/ out_html("<BR>\n"); c=c+j; c=scan_expression(c, &j); for (i=0; i<j; i++) out_html("&nbsp;"); curpos=j; c=skip_till_newline(c); break; } case REQ_tm: // groff(7) "TerMinal" ### TODO: what are useful uses for it { c=c+j; h=c; while (*c!='\n') c++; *c='\0'; kdDebug(7107) << ".tm " << (h) << endl; *c='\n'; break; } case REQ_B: // man(7) "Bold" mode=1; case REQ_I: // man(7) "Italic" { /* parse one line in a certain font */ out_html( set_font( mode?"B":"I" ) ); fill_words(c, wordlist, &words, false, 0); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fd: // mdoc(7) "Function Definition" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } if (mandoc_synopsis) { out_html(");"); out_html("<br>"); }; out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fn: // mdoc(7) for "Function calls" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); if (!words) { out_html(" ()"); } else { for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } else if (i<words-1) out_html(", "); } out_html(")"); } out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fo: // mdoc(7) "Function definition Opening" { char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); // Normally a .Fo has only one parameter for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } // ### TODO What should happen if there is more than one argument // else if (i<words-1) out_html(", "); } function_argument=1; // Must be > 0 out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fc:// mdoc(7) "Function definition Close" { // .Fc has no parameter c+=j; c=skip_till_newline(c); char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME out_html(set_font(font[i&1])); out_html(")"); out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; function_argument=0; // Reset the count variable break; } case REQ_Fa: // mdoc(7) "Function definition argument" { char font[2] ; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font(font[i&1])); // function_argument==0 means that we had no .Fo before, e.g. in mdoc.samples(7) if (function_argument > 1) { out_html(", "); curpos+=2; function_argument++; } else if (function_argument==1) { // We are only at the first parameter function_argument++; } for (i=0; i<words; i++) { wordlist[i][-1]=' '; scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (!fillout) curpos=0; else curpos++; break; } case REQ_OP: /* groff manpages use this construction */ /* .OP a b : [ <B>a</B> <I>b</I> ] */ mode=true; c[0]='B'; c[1]='I'; out_html(set_font("R")); out_html("["); curpos++; // Do not break! case REQ_Ft: //perhaps "Function return type" case REQ_BR: case REQ_BI: case REQ_IB: case REQ_IR: case REQ_RB: case REQ_RI: { // ### VERIFY bool inFMode=(c[0]=='F'); if (inFMode) { c[0]='B'; c[1]='I'; }; char font[2] ; font[0] = c[0]; font[1] = c[1]; c=c+j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); /* .BR name (section) * indicates a link. It will be added in the output routine. */ for (i=0; i<words; i++) { if ((mode) || (inFMode)) { out_html(" "); curpos++; } wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (mode) { out_html(" ]"); curpos++; } out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_DT: // man(7) "Default Tabulators" { for (j=0;j<20; j++) tabstops[j]=(j+1)*8; maxtstop=20; c=skip_till_newline(c); break; } case REQ_IP: // man(7) "Ident Paragraph" { sl=fill_words(c+j, wordlist, &words, true, &c); if (!dl_set[itemdepth]) { out_html("<DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); if (words) scan_troff(wordlist[0], 1,NULL); out_html("<DD>"); curpos=0; break; } case REQ_TP: // man(7) "hanging Tag Paragraph" { if (!dl_set[itemdepth]) { out_html("<br><br><DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); c=skip_till_newline(c); /* somewhere a definition ends with '.TP' */ if (!*c) still_dd=true; else { c=scan_troff(c,1,NULL); out_html("<DD>"); } curpos=0; break; } case REQ_IX: // "INdex" ### TODO: where is it defined? { /* general index */ c=skip_till_newline(c); break; } case REQ_P: // man(7) "Paragraph" case REQ_LP:// man(7) "Paragraph" case REQ_PP:// man(7) "Paragraph; reset Prevailing indent" { if (dl_set[itemdepth]) { out_html("</DL>\n"); dl_set[itemdepth]=0; } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_HP: // man(7) "Hanging indent Paragraph" { if (!dl_set[itemdepth]) { out_html("<DL>"); dl_set[itemdepth]=1; } out_html("<DT>\n"); still_dd=true; c=skip_till_newline(c); curpos=0; break; } case REQ_PD: // man(7) "Paragraph Distance" { c=skip_till_newline(c); break; } case REQ_Rs: // mdoc(7) "Relative margin Start" case REQ_RS: // man(7) "Relative margin Start" { sl=fill_words(c+j, wordlist, &words, true, 0); j=1; if (words>0) scan_expression(wordlist[0], &j); if (j>=0) { itemdepth++; dl_set[itemdepth]=0; out_html("<DL><DT><DD>"); c=skip_till_newline(c); curpos=0; break; } } case REQ_Re: // mdoc(7) "Relative margin End" case REQ_RE: // man(7) "Relative margin End" { if (itemdepth > 0) { if (dl_set[itemdepth]) out_html("</DL>"); out_html("</DL>\n"); itemdepth--; } c=skip_till_newline(c); curpos=0; break; } case REQ_SB: // man(7) "Small; Bold" { out_html(set_font("B")); out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c+j, 1, NULL); out_html("</small>"); out_html(set_font("R")); break; } case REQ_SM: // man(7) "SMall" { c=c+j; if (*c=='\n') c++; out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c,1,NULL); out_html("</small>"); break; } case REQ_Ss: // mdoc(7) "Sub Section" mandoc_command = 1; case REQ_SS: // mdoc(7) "Sub Section" mode=true; case REQ_Sh: // mdoc(7) "Sub Header" /* hack for fallthru from above */ mandoc_command = !mode || mandoc_command; case REQ_SH: // man(7) "Sub Header" { c=c+j; if (*c=='\n') c++; while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else if (itemdepth > 0) itemdepth--; } out_html(set_font("R")); out_html(change_to_size(0)); if (!fillout) { fillout=1; out_html("</PRE>"); } trans_char(c,'"', '\a'); if (section) { out_html("</div>\n"); section=0; } if (mode) out_html("\n<H3>"); else out_html("\n<H2>"); mandoc_synopsis = qstrncmp(c, "SYNOPSIS", 8) == 0; c = mandoc_command ? scan_troff_mandoc(c,1,NULL) : scan_troff(c,1,NULL); if (mode) out_html("</H3>\n"); else out_html("</H2>\n"); out_html("<div>\n"); section=1; curpos=0; break; } case REQ_Sx: // mdoc(7) { // reference to a section header out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_TS: // ### TODO where is it defined? (tbl?) { c=scan_table(c); break; } case REQ_Dt: /* mdoc(7) */ mandoc_command = true; case REQ_TH: // man(7) "Title Header" { if (!output_possible) { sl = fill_words(c+j, wordlist, &words, true, &c); // ### TODO: the page should be displayed even if it is "anonymous" (words==0) if (words>=1) { for (i=1; i<words; i++) wordlist[i][-1]='\0'; *sl='\0'; for (i=0; i<words; i++) { if (wordlist[i][0] == '\007') wordlist[i]++; if (wordlist[i][qstrlen(wordlist[i])-1] == '\007') wordlist[i][qstrlen(wordlist[i])-1] = 0; } output_possible=true; out_html( DOCTYPE"<HTML>\n<HEAD>\n");#ifdef SIMPLE_MAN2HTML // Most English man pages are in ISO-8859-1 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");#else // kio_man transforms from local to UTF-8 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset="); out_html(QTextCodec::codecForLocale()->mimeName()); out_html("\">\n");#endif out_html("<TITLE>"); out_html(scan_troff(wordlist[0], 0, NULL)); out_html( " Manpage</TITLE>\n"); out_html( "<link rel=\"stylesheet\" href=\""); out_html(htmlPath); out_html("/kde-default.css\" type=\"text/css\">\n" ); out_html( "<meta name=\"ROFF Type\" content=\""); if (mandoc_command) out_html("mdoc"); else out_html("man"); out_html("\">\n"); out_html( "</HEAD>\n\n" ); out_html("<BODY BGCOLOR=\"#FFFFFF\">\n\n" ); out_html("<div style=\"background-image: url("); out_html(cssPath); out_html("/top-middle.png); width: 100%; height: 131pt;\">\n" ); out_html("<div style=\"position: absolute; right: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-right-konqueror.png\" style=\"margin: 0pt\" alt=\"Top right\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; left: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-left.png\" style=\"margin: 0pt\" alt=\"Top left\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; top: 25pt; right: 100pt; text-align: right; font-size: xx-large; font-weight: bold; text-shadow: #fff 0pt 0pt 5pt; color: #444\">\n"); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html("</div>\n"); out_html("</div>\n"); out_html("<div style=\"margin-left: 5em; margin-right: 5em;\">\n"); out_html("<h1>" ); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html( "</h1>\n" ); if (words>1) { out_html("Section: " ); if (!mandoc_command && words>4) out_html(scan_troff(wordlist[4], 0, NULL) ); else out_html(section_name(wordlist[1])); out_html(" ("); out_html(scan_troff(wordlist[1], 0, NULL)); out_html(")\n"); } else { out_html("Section not specified"); } *sl='\n'; } } else { kdWarning(7107) << ".TH found but output not possible" << endl; c=skip_till_newline(c); } curpos=0; break; } case REQ_TX: // mdoc(7) { sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; out_html(set_font("I")); if (words>1) wordlist[1][-1]='\0'; const char *c2=lookup_abbrev(wordlist[0]); curpos+=qstrlen(c2); out_html(c2); out_html(set_font("R")); if (words>1) out_html(wordlist[1]); *sl='\n'; break; } case REQ_rm: // groff(7) "ReMove" /* .rm xx : Remove request, macro or string */ mode=true; case REQ_rn: // groff(7) "ReName" /* .rn xx yy : Rename request, macro or string xx to yy */ { kdDebug(7107) << "start .rm/.rn" << endl; c+=j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } QCString name2; if ( !mode ) { while (*c && isspace(*c) && *c!='\n') ++c; name2 = scan_identifier( c ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to rename: " << endl; break; } } c=skip_till_newline(c); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to rename or remove: " << name << endl; } else { if (mode) { // .rm ReMove s_stringDefinitionMap.remove(name); // ### QT4: removeAll } else { // .rn ReName StringDefinition def=(*it); s_stringDefinitionMap.remove(name); // ### QT4: removeAll s_stringDefinitionMap.insert(name2,def); } } kdDebug(7107) << "end .rm/.rn" << endl; break; } case REQ_nx: // ### TODO in man(7) it is "No filling", not "next file" /* .nx filename : next file. */ case REQ_in: // groff(7) "INdent" { /* .in +-N : Indent */ c=skip_till_newline(c); break; } case REQ_nr: // groff(7) "Number Register" { kdDebug(7107) << "start .nr" << endl; c += j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty name for register variable" << endl; break; } while ( *c && ( *c==' ' || *c=='\t' ) ) c++; int sign = 0; if ( *c && ( *c == '+' || *c == '-' ) ) { if ( *c == '+' ) sign = 1; else if ( *c == '-' ) sign = -1; } int value = 0; int increment = 0; c=scan_expression( c, &value ); if ( *c && *c!='\n') { while ( *c && ( *c==' ' || *c=='\t' ) ) c++; c=scan_expression( c, &increment ); } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { if ( sign < 1 ) value = -value; NumberDefinition def( value, increment ); s_numberDefinitionMap.insert( name, def ); } else { if ( sign > 0 ) (*it).m_value += value; else if ( sign < 0 ) (*it).m_value += - value; else (*it).m_value = value; (*it).m_increment = increment; } kdDebug(7107) << "end .nr" << endl; break; } case REQ_am: // groff(7) "Append Macro" /* .am xx yy : append to a macro. */ /* define or handle as .ig yy */ mode=true; case REQ_de: // groff(7) "DEfine macro" /* .de xx yy : define or redefine macro xx; end at .yy (..) */ /* define or handle as .ig yy */ { kdDebug(7107) << "Start .am/.de" << endl; c+=j; char *next_line; sl = fill_words(c, wordlist, &words, true, &next_line); char *nameStart = wordlist[0]; c = nameStart; while (*c && (*c != ' ') && (*c != '\n')) c++; *c = '\0'; const QCString name(nameStart); QCString endmacro; if (words == 1) { endmacro=".."; } else { endmacro='.'; c = wordlist[1]; while (*c && (*c != ' ') && (*c != '\n')) endmacro+=*c++; } c = next_line; sl=c; const int length=qstrlen(endmacro); while (*c && qstrncmp(c,endmacro,length)) c=skip_till_newline(c); QCString macro; while (sl!=c) { if (sl[0]=='\\' && sl[1]=='\\') { macro+='\\'; sl++; } else macro+=*sl; sl++; } QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=macro; s_stringDefinitionMap.insert(name,def); } else if (mode) { // .am Append Macro (*it).m_length=0; // It could be formerly a string if ((*it).m_output.right(1)!='\n') (*it).m_output+='\n'; (*it).m_output+=macro; } else { // .de DEfine macro (*it).m_length=0; // It could be formerly a string (*it).m_output=macro; } c=skip_till_newline(c); kdDebug(7107) << "End .am/.de" << endl; break; } case REQ_Bl: // mdoc(7) "Begin List" { char list_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (dl_set[itemdepth]) /* These things can nest. */ itemdepth++; if (nl) { /* Parse list options */ strlimitcpy(list_options, c, nl - c, MED_STR_MAX); } if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */ dl_set[itemdepth] = BL_BULLET_LIST; out_html("<UL>\n"); } else if (strstr(list_options, "-enum")) { /* HTML Ordered List */ dl_set[itemdepth] = BL_ENUM_LIST; out_html("<OL>\n"); } else { /* HTML Descriptive List */ dl_set[itemdepth] = BL_DESC_LIST; out_html("<DL>\n"); } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_El: // mdoc(7) "End List" { c=c+j; if (dl_set[itemdepth] & BL_DESC_LIST) out_html("</DL>\n"); else if (dl_set[itemdepth] & BL_BULLET_LIST) out_html("</UL>\n"); else if (dl_set[itemdepth] & BL_ENUM_LIST) out_html("</OL>\n"); dl_set[itemdepth]=0; if (itemdepth > 0) itemdepth--; if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_It: // mdoc(7) "list ITem" { c=c+j; if (qstrncmp(c, "Xo", 2) == 0 && isspace(*(c+2))) c = skip_till_newline(c); if (dl_set[itemdepth] & BL_DESC_LIST) { out_html("<DT>"); out_html(set_font("B")); if (*c=='\n') { /* Don't allow embedded comms after a newline */ c++; c=scan_troff(c,1,NULL); } else { /* Do allow embedded comms on the same line. */ c=scan_troff_mandoc(c,1,NULL); } out_html(set_font("R")); out_html(NEWLINE); out_html("<DD>"); } else if (dl_set[itemdepth] & (BL_BULLET_LIST | BL_ENUM_LIST)) { out_html("<LI>"); c=scan_troff_mandoc(c,1,NULL); out_html(NEWLINE); } if (fillout) curpos++; else curpos=0; break; } case REQ_Bk: /* mdoc(7) */ case REQ_Ek: /* mdoc(7) */ case REQ_Dd: /* mdoc(7) */ case REQ_Os: // mdoc(7) "Operating System" { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Bt: // mdoc(7) "Beta Test" { trans_char(c,'"','\a'); c=c+j; out_html(" is currently in beta test."); if (fillout) curpos++; else curpos=0; break; } case REQ_At: /* mdoc(7) */ case REQ_Fx: /* mdoc(7) */ case REQ_Nx: /* mdoc(7) */ case REQ_Ox: /* mdoc(7) */ case REQ_Bx: /* mdoc(7) */ case REQ_Ux: /* mdoc(7) */ { bool parsable=true; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; if (request==REQ_At) { out_html("AT&amp;T UNIX "); parsable=false; } else if (request==REQ_Fx) { out_html("FreeBSD "); parsable=false; } else if (request==REQ_Nx) out_html("NetBSD "); else if (request==REQ_Ox) out_html("OpenBSD "); else if (request==REQ_Bx) out_html("BSD "); else if (request==REQ_Ux) out_html("UNIX "); if (parsable) c=scan_troff_mandoc(c,1,0); else c=scan_troff(c,1,0); if (fillout) curpos++; else curpos=0; break; } case REQ_Dl: /* mdoc(7) */ { c=c+j; out_html(NEWLINE); out_html("<BLOCKQUOTE>"); if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</BLOCKQUOTE>"); if (fillout) curpos++; else curpos=0; break; } case REQ_Bd: /* mdoc(7) */ { /* Seems like a kind of example/literal mode */ char bd_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (nl) strlimitcpy(bd_options, c, nl - c, MED_STR_MAX); out_html(NEWLINE); mandoc_bd_options = 0; /* Remember options for terminating Bl */ if (strstr(bd_options, "-offset indent")) { mandoc_bd_options |= BD_INDENT; out_html("<BLOCKQUOTE>\n"); } if ( strstr(bd_options, "-literal") || strstr(bd_options, "-unfilled")) { if (fillout) { mandoc_bd_options |= BD_LITERAL; out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; } c=skip_till_newline(c); break; } case REQ_Ed: /* mdoc(7) */ { if (mandoc_bd_options & BD_LITERAL) { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } } if (mandoc_bd_options & BD_INDENT) out_html("</BLOCKQUOTE>\n"); curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_Be: /* mdoc(7) */ { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Xr: /* mdoc(7) */ // ### FIXME: it should issue a <a href="man:somewhere(x)"> directly { /* Translate xyz 1 to xyz(1) * Allow for multiple spaces. Allow the section to be missing. */ char buff[NULL_TERMINATED(MED_STR_MAX)]; char *bufptr; trans_char(c,'"','\a'); bufptr = buff; c = c+j; if (*c == '\n') c++; /* Skip spaces */ while (isspace(*c) && *c != '\n') c++; while (isalnum(*c) || *c == '.' || *c == ':' || *c == '_' || *c == '-') { /* Copy the xyz part */ *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } while (isspace(*c) && *c != '\n') c++; /* Skip spaces */ if (isdigit(*c)) { /* Convert the number if there is one */ *bufptr = '('; bufptr++; if (bufptr < buff + MED_STR_MAX) { while (isalnum(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } if (bufptr < buff + MED_STR_MAX) { *bufptr = ')'; bufptr++; } } } while (*c != '\n') { /* Copy the remainder */ if (!isspace(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; } c++; } *bufptr = '\n'; bufptr[1] = 0; scan_troff_mandoc(buff, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fl: // mdoc(7) "FLags" { trans_char(c,'"','\a'); c+=j; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font("B")); if (!words) { out_html("-"); // stdin or stdout } else { for (i=0;i<words;++i) { if (ispunct(wordlist[i][0]) && wordlist[i][0]!='-') { scan_troff_mandoc(wordlist[i], 1, NULL); } else { if (i>0) out_html(" "); // Put a space between flags out_html("-"); scan_troff_mandoc(wordlist[i], 1, NULL); } } } out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pa: /* mdoc(7) */ case REQ_Pf: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pp: /* mdoc(7) */ { if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Aq: // mdoc(7) "Angle bracket Quote" c=process_quote(c,j,"&lt;","&gt;"); break; case REQ_Bq: // mdoc(7) "Bracket Quote" c=process_quote(c,j,"[","]"); break; case REQ_Dq: // mdoc(7) "Double Quote" c=process_quote(c,j,"&ldquo;","&rdquo;"); break; case REQ_Pq: // mdoc(7) "Parenthese Quote" c=process_quote(c,j,"(",")"); break; case REQ_Qq: // mdoc(7) "straight double Quote" c=process_quote(c,j,"&quot;","&quot;"); break; case REQ_Sq: // mdoc(7) "Single Quote" c=process_quote(c,j,"&lsquo;","&rsquo;"); break; case REQ_Op: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Oo: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); if (fillout) curpos++; else curpos=0; break; } case REQ_Oc: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); if (fillout) curpos++; else curpos=0; break; } case REQ_Ql: /* mdoc(7) */ { /* Single quote first word in the line */ char *sp; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; sp = c; do { /* Find first whitespace after the * first word that isn't a mandoc macro */ while (*sp && isspace(*sp)) sp++; while (*sp && !isspace(*sp)) sp++; } while (*sp && isupper(*(sp-2)) && islower(*(sp-1))); /* Use a newline to mark the end of text to * be quoted */ if (*sp) *sp = '\n'; out_html("`"); /* Quote the text */ c=scan_troff_mandoc(c, 1, NULL); out_html("'"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ar: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') { /* An empty Ar means "file ..." */ out_html("file ..."); } else c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Em: /* mdoc(7) */ { out_html("<em>"); trans_char(c,'"','\a'); c+=j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</em>"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ad: /* mdoc(7) */ case REQ_Va: /* mdoc(7) */ case REQ_Xc: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nd: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(" - "); c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nm: // mdoc(7) "Name Macro" ### FIXME { static char mandoc_name[NULL_TERMINATED(SMALL_STR_MAX)] = ""; // ### TODO Use QCString trans_char(c,'"','\a'); c=c+j; if (mandoc_synopsis && mandoc_name_count) { /* Break lines only in the Synopsis. * The Synopsis section seems to be treated * as a special case - Bummer! */ out_html("<BR>"); } else if (!mandoc_name_count) { const char *nextbreak = strchr(c, '\n'); const char *nextspace = strchr(c, ' '); if (nextspace < nextbreak) nextbreak = nextspace; if (nextbreak) { /* Remember the name for later. */ strlimitcpy(mandoc_name, c, nextbreak - c, SMALL_STR_MAX); } } mandoc_name_count++; out_html(set_font("B")); // ### FIXME: fill_words must be used while (*c == ' '|| *c == '\t') c++; if ((tolower(*c) >= 'a' && tolower(*c) <= 'z' ) || (*c >= '0' && *c <= '9')) { // alphanumeric argument c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); } else { /* If Nm has no argument, use one from an earlier * Nm command that did have one. Hope there aren't * too many commands that do this. */ out_html(mandoc_name); out_html(set_font("R")); } if (fillout) curpos++; else curpos=0; break; } case REQ_Cd: /* mdoc(7) */ case REQ_Cm: /* mdoc(7) */ case REQ_Ic: /* mdoc(7) */ case REQ_Ms: /* mdoc(7) */ case REQ_Or: /* mdoc(7) */ case REQ_Sy: /* mdoc(7) */ { /* parse one line in bold */ out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Dv: /* mdoc(7) */ case REQ_Ev: /* mdoc(7) */ case REQ_Fr: /* mdoc(7) */ case REQ_Li: /* mdoc(7) */ case REQ_No: /* mdoc(7) */ case REQ_Ns: /* mdoc(7) */ case REQ_Tn: /* mdoc(7) */ case REQ_nN: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("B")); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_perc_A: /* mdoc(7) biblio stuff */ case REQ_perc_D: case REQ_perc_N: case REQ_perc_O: case REQ_perc_P: case REQ_perc_Q: case REQ_perc_V: { c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ if (fillout) curpos++; else curpos=0; break; } case REQ_perc_B: case REQ_perc_J: case REQ_perc_R: case REQ_perc_T: { c=c+j; out_html(set_font("I")); if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ out_html(set_font("R")); if (fillout) curpos++; else curpos=0; break; } case REQ_UR: // ### FIXME man(7) "URl" { ignore_links=true; c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; // A parameter : means that we do not want an URL, not here and not until .UE ur_ignore=(!qstrcmp(h,":")); } else { // We cannot find the URL, assume : ur_ignore=true; h=0; } if (!ur_ignore && words>0) { out_html("<a href=\""); out_html(h); out_html("\">"); } c=newc; // Go to next line break; } case REQ_UE: // ### FIXME man(7) "Url End" { c+=j; c = skip_till_newline(c); if (!ur_ignore) { out_html("</a>"); } ur_ignore=false; ignore_links=false; break; } case REQ_UN: // ### FIXME man(7) "Url Named anchor" { c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; out_html("<a name=\">"); out_html(h); out_html("\" id=\""); out_html(h); out_html("\"></a>"); } c=newc; break; } case REQ_nroff: // groff(7) "NROFF mode" mode = true; case REQ_troff: // groff(7) "TROFF mode" { s_nroff = mode; c+=j; c = skip_till_newline(c); } case REQ_als: // groff(7) "ALias String" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rn, the destination is first, origin is second kdDebug(7107) << "start .als" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c=skip_till_newline(c); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination string to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rn) QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name2); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { StringDefinition def=(*it); s_stringDefinitionMap.insert(name,def); } kdDebug(7107) << "end .als" << endl; break; } case REQ_rr: // groff(7) "Remove number Register" { kdDebug(7107) << "start .rr" << endl; c += j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { kdDebug(7107) << "EXCEPTION: trying to remove inexistant number register: " << endl; } else { s_numberDefinitionMap.remove( name ); } kdDebug(7107) << "end .rr" << endl; break; } case REQ_rnn: // groff(7) "ReName Number register" { kdDebug(7107) << "start .rnn" << endl; c+=j; const QCString name ( scan_identifier ( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin to remove/rename number register" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination to rename number register " << endl; break; } c = skip_till_newline( c ); QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find number register to rename: " << name << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.remove(name); // ### QT4: removeAll s_numberDefinitionMap.insert(name2,def); } kdDebug(7107) << "end .rnn" << endl; break; } case REQ_aln: // groff(7) "ALias Number Register" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rnn, the destination is first, origin is second kdDebug(7107) << "start .aln" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination number register to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin number register to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c = skip_till_newline( c ); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination number register to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rnn) QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name2); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.insert(name,def); } kdDebug(7107) << "end .aln" << endl; break; } case REQ_shift: // groff(7) "SHIFT parameter" { c+=j; h=c; while (*h && *h!='\n' && isdigit(*h) ) ++h; const char tempchar = *h; *h = 0; const QCString number = c; *h = tempchar; c = skip_till_newline( h ); unsigned int result = 1; // Numbers of shifts to do if ( !number.isEmpty() ) { bool ok = false; result = number.toUInt(&ok); if ( !ok || result < 1 ) result = 1; } for ( unsigned int num = 0; num < result; ++num ) { if ( !s_argumentList.isEmpty() ) s_argumentList.pop_front(); } break; } case REQ_while: // groff(7) "WHILE loop" { request_while( c, j, mandoc_command ); break; } default: { if (mandoc_command && ((isupper(*c) && islower(*(c+1))) || (islower(*c) && isupper(*(c+1)))) ) { /* Let through any mdoc(7) commands that haven't * been delt with. * I don't want to miss anything out of the text. */ char buf[4]; qstrncpy(buf,c,2); buf[2] = ' '; buf[3] = '\0'; out_html(buf); /* Print the command (it might just be text). */ c=c+j; trans_char(c,'"','\a'); if (*c=='\n') c++; out_html(set_font("R")); c=scan_troff(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; } else c=skip_till_newline(c); break; } } } } if (fillout) { out_html(NEWLINE); curpos++; } return c;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a2a0d621d2afd22ae7cf2ad733a2ce62a96b2010/man2html.cpp/buggy/kioslave/man/man2html.cpp
case REQ_do: { *c = '\n'; c++; *c = '.'; break; }
static char *scan_request(char *c){ // mdoc(7) stuff static bool mandoc_synopsis=false; /* True if we are in the synopsis section */ static bool mandoc_command=false; /* True if this is mdoc(7) page */ static int mandoc_bd_options; /* Only copes with non-nested Bd's */ static int function_argument=0; // Number of function argument (.Fo, .Fa, .Fc) // man(7) stuff static bool ur_ignore=false; // Has .UR a parameter : (for .UE to know if or not to write </a>) int i=0; bool mode=false; char *h=0; const int max_wordlist=100; char *wordlist[max_wordlist]; int words; char *sl; while (*c==' ' || *c=='\t') c++; // Spaces or tabs allowed between control character and request if (c[0]=='\n') return c+1; if (c[0]==escapesym) { /* some pages use .\" .\$1 .\} */ /* .\$1 is too difficult/stuppid */ if (c[1]=='$') { kdDebug(7107) << "Found .\\$" << endl; c=skip_till_newline(c); // ### TODO } else c = scan_escape(c+1); } else { int j; if (c[1]=='\n') j=1; else j=2; // ### TODO: remove, as i is over-written later int nlen = 0; QCString macroName; while (c[nlen] && (c[nlen] != ' ') && (c[nlen] != '\t') && (c[nlen] != '\n') && (c[nlen] != escapesym)) { macroName+=c[nlen]; nlen++; } j = nlen; while (c[j] && c[j]==' ' || c[j]=='\t') j++; /* search macro database of self-defined macros */ QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(macroName); if (it!=s_stringDefinitionMap.end()) { kdDebug(7107) << "CALLING MACRO: " << macroName << endl; const QCString oldDollarZero = s_dollarZero; // Previous value of $0 s_dollarZero = macroName; sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; for (i=1;i<words; i++) wordlist[i][-1]='\0'; for (i=0; i<words; i++) { char *h=NULL; if (mandoc_command) scan_troff_mandoc(wordlist[i],1,&h); else scan_troff(wordlist[i],1,&h); wordlist[i] = qstrdup(h); delete [] h; } for ( i=words; i<max_wordlist; i++ ) wordlist[i]=NULL; if ( !(*it).m_output.isEmpty() ) { //kdDebug(7107) << "Macro content is: " << endl << (*it).m_output << endl; const unsigned int length = (*it).m_output.length(); char* work = new char [length+2]; work[0] = '\n'; // The macro must start after an end of line to allow a request on first line qstrncpy(work+1,(*it).m_output.data(),length+1); const QValueList<char*> oldArgumentList( s_argumentList ); s_argumentList.clear(); for ( i = 0 ; i < max_wordlist; i++ ) { if (!wordlist[i]) break; s_argumentList.push_back( wordlist[i] ); } const int onff=newline_for_fun; if (mandoc_command) scan_troff_mandoc( work + 1, 0, NULL ); else scan_troff( work + 1, 0, NULL); delete[] work; newline_for_fun=onff; s_argumentList = oldArgumentList; } for (i=0; i<words; i++) delete [] wordlist[i]; *sl='\n'; s_dollarZero = oldDollarZero; kdDebug(7107) << "ENDING MACRO: " << macroName << endl; } else { kdDebug(7107) << "REQUEST: " << macroName << endl; switch (int request = get_request(c, nlen)) { case REQ_ab: // groff(7) "ABort" { h=c+j; while (*h && *h !='\n') h++; *h='\0'; if (scaninbuff && buffpos) { buffer[buffpos]='\0'; kdDebug(7107) << "ABORT: " << buffer << endl; } // ### TODO find a way to display it to the user kdDebug(7107) << "Aborting: .ab " << (c+j) << endl; return 0; break; } case REQ_An: // mdoc(7) "Author Name" { c+=j; c=scan_troff_mandoc(c,1,0); break; } case REQ_di: // groff(7) "end current DIversion" { kdDebug(7107) << "Start .di" << endl; c+=j; if (*c=='\n') { ++c; break; } const QCString name ( scan_identifier( c ) ); while (*c && *c!='\n') c++; c++; h=c; while (*c && qstrncmp(c,".di",3)) while (*c && *c++!='\n'); *c='\0'; char* result=0; scan_troff(h,0,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { (*it).m_length=0; (*it).m_output=result; } delete[] result; if (*c) *c='.'; c=skip_till_newline(c); kdDebug(7107) << "end .di" << endl; break; } case REQ_ds: // groff(7) "Define String variable" mode=true; case REQ_as: // groff (7) "Append String variable" { kdDebug(7107) << "start .ds/.as" << endl; int oldcurpos=curpos; c+=j; const QCString name( scan_identifier( c) ); if ( name.isEmpty() ) break; while (*c && isspace(*c)) c++; if (*c && *c=='"') c++; single_escape=true; curpos=0; char* result=0; c=scan_troff(c,1,&result); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=curpos; def.m_output=result; s_stringDefinitionMap.insert(name,def); } else { if (mode) { // .ds Defining String (*it).m_length=curpos; (*it).m_output=result; } else { // .as Appending String (*it).m_length+=curpos; (*it).m_output+=result; } } delete[] result; single_escape=false; curpos=oldcurpos; kdDebug(7107) << "end .ds/.as" << endl; break; } case REQ_br: // groff(7) "line BReak" { if (still_dd) out_html("<DD>"); // ### VERIFY (does not look like generating good HTML) else out_html("<BR>\n"); curpos=0; c=c+j; if (c[0]==escapesym) c=scan_escape(c+1); c=skip_till_newline(c); break; } case REQ_c2: // groff(7) "reset non-break Control character" (2 means non-break) { c=c+j; if (*c!='\n') nobreaksym=*c; else nobreaksym='\''; c=skip_till_newline(c); break; } case REQ_cc: // groff(7) "reset Control Character" { c=c+j; if (*c!='\n') controlsym=*c; else controlsym='.'; c=skip_till_newline(c); break; } case REQ_ce: // groff (7) "CEnter" { c=c+j; if (*c=='\n') i=1; else { i=0; while ('0'<=*c && *c<='9') { i=i*10+*c-'0'; c++; } } c=skip_till_newline(c); /* center next i lines */ if (i>0) { out_html("<CENTER>\n"); while (i && *c) { char *line=NULL; c=scan_troff(c,1, &line); if (line && qstrncmp(line, "<BR>", 4)) { out_html(line); out_html("<BR>\n"); delete [] line; i--; } } out_html("</CENTER>\n"); curpos=0; } break; } case REQ_ec: // groff(7) "reset Escape Character" { c=c+j; if (*c!='\n') escapesym=*c; else escapesym='\\'; break; c=skip_till_newline(c); } case REQ_eo: // groff(7) "turn Escape character Off" { escapesym='\0'; c=skip_till_newline(c); break; } case REQ_ex: // groff(7) "EXit" { return 0; break; } case REQ_fc: // groff(7) "set Field and pad Character" { c=c+j; if (*c=='\n') fieldsym=padsym='\0'; else { fieldsym=c[0]; padsym=c[1]; } c=skip_till_newline(c); break; } case REQ_fi: // groff(7) "FIll" { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_ft: // groff(7) "previous FonT" { c=c+j; if (*c=='\n') out_html(set_font("R"));#if 0 else { // ### FIXME if (*c==escapesym) { int fn; c=scan_expression(c, &fn); c--; out_html(set_font(fn)); } else { out_html(set_font(*c)); c++; } }#endif c=skip_till_newline(c); break; } case REQ_el: // groff(7) "ELse" { int ifelseval = s_ifelseval.pop(); /* .el anything : else part of if else */ if (ifelseval) { c=c+j; c[-1]='\n'; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c+j); break; } case REQ_ie: // groff(7) "If with Else" /* .ie c anything : then part of if else */ case REQ_if: // groff(7) "IF" { /* .if c anything * .if !c anything * .if N anything * .if !N anything * .if 'string1'string2' anything * .if !'string1'string2' anything */ c=c+j; c=scan_expression(c, &i); if (request == REQ_ie) { int ifelseval=!i; s_ifelseval.push( ifelseval ); } if (i) { *c='\n'; c++; c=scan_troff(c,1,NULL); } else c=skip_till_newline(c); break; } case REQ_ig: // groff(7) "IGnore" { const char *endwith="..\n"; i=3; c=c+j; if (*c!='\n' && *c != '\\') { /* Not newline or comment */ endwith=c-1;i=1; c[-1]='.'; while (*c && *c!='\n') c++,i++; } c++; while (*c && qstrncmp(c,endwith,i)) while (*c++!='\n'); while (*c && *c++!='\n'); break; } case REQ_nf: // groff(7) "No Filling" { if (fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; c=skip_till_newline(c); break; } case REQ_ps: // groff(7) "previous Point Size" { c=c+j; if (*c=='\n') out_html(change_to_size('0')); else { j=0; i=0; if (*c=='-') { j= -1; c++; } else if (*c=='+') j=1;c++; c=scan_expression(c, &i); if (!j) { j=1; if (i>5) i=i-10; } out_html(change_to_size(i*j)); } c=skip_till_newline(c); break; } case REQ_sp: // groff(7) "SKip one line" { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_so: // groff(7) "Include SOurce file" { char *buf; char *name=NULL; curpos=0; c=c+j; if (*c=='/') h=c; else { h=c-3; h[0]='.'; h[1]='.'; h[2]='/'; } while (*c!='\n') c++; *c='\0'; scan_troff(h,1, &name); if (name[3]=='/') h=name+3; else h=name; /* this works alright, except for section 3 */ buf=read_man_page(h); if (!buf) { kdDebug(7107) << "Unable to open or read file: .so " << (h) << endl; out_html("<BLOCKQUOTE>" "man2html: unable to open or read file.\n"); out_html(h); out_html("</BLOCKQUOTE>\n"); } else scan_troff(buf+1,0,NULL); delete [] buf; delete [] name; *c++='\n'; break; } case REQ_ta: // gorff(7) "set TAbulators" { c=c+j; j=0; while (*c!='\n') { sl=scan_expression(c, &tabstops[j]); if (j>0 && (*c=='-' || *c=='+')) tabstops[j]+=tabstops[j-1]; c=sl; while (*c==' ' || *c=='\t') c++; j++; } maxtstop=j; curpos=0; break; } case REQ_ti: // groff(7) "Temporary Indent" { /*while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else itemdepth--; }*/ out_html("<BR>\n"); c=c+j; c=scan_expression(c, &j); for (i=0; i<j; i++) out_html("&nbsp;"); curpos=j; c=skip_till_newline(c); break; } case REQ_tm: // groff(7) "TerMinal" ### TODO: what are useful uses for it { c=c+j; h=c; while (*c!='\n') c++; *c='\0'; kdDebug(7107) << ".tm " << (h) << endl; *c='\n'; break; } case REQ_B: // man(7) "Bold" mode=1; case REQ_I: // man(7) "Italic" { /* parse one line in a certain font */ out_html( set_font( mode?"B":"I" ) ); fill_words(c, wordlist, &words, false, 0); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fd: // mdoc(7) "Function Definition" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } if (mandoc_synopsis) { out_html(");"); out_html("<br>"); }; out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fn: // mdoc(7) for "Function calls" ### FIXME { // brackets and commas have to be inserted automatically char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); if (!words) { out_html(" ()"); } else { for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } else if (i<words-1) out_html(", "); } out_html(")"); } out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fo: // mdoc(7) "Function definition Opening" { char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; char *eol=strchr(c,'\n'); char *semicolon=strchr(c,';'); if ((semicolon!=0) && (semicolon<eol)) *semicolon=' '; sl=fill_words(c, wordlist, &words, true, &c); // Normally a .Fo has only one parameter for (i=0; i<words; i++) { wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); if (i==0) { out_html(" ("); } // ### TODO What should happen if there is more than one argument // else if (i<words-1) out_html(", "); } function_argument=1; // Must be > 0 out_html(set_font("R")); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_Fc:// mdoc(7) "Function definition Close" { // .Fc has no parameter c+=j; c=skip_till_newline(c); char font[2]; font[0] = 'B'; font[1] = 'R'; // ### FIXME out_html(set_font(font[i&1])); out_html(")"); out_html(set_font("R")); if (mandoc_synopsis) out_html("<br>"); out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; function_argument=0; // Reset the count variable break; } case REQ_Fa: // mdoc(7) "Function definition argument" { char font[2] ; font[0] = 'B'; font[1] = 'R'; // ### FIXME c+=j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font(font[i&1])); // function_argument==0 means that we had no .Fo before, e.g. in mdoc.samples(7) if (function_argument > 1) { out_html(", "); curpos+=2; function_argument++; } else if (function_argument==1) { // We are only at the first parameter function_argument++; } for (i=0; i<words; i++) { wordlist[i][-1]=' '; scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (!fillout) curpos=0; else curpos++; break; } case REQ_OP: /* groff manpages use this construction */ /* .OP a b : [ <B>a</B> <I>b</I> ] */ mode=true; c[0]='B'; c[1]='I'; out_html(set_font("R")); out_html("["); curpos++; // Do not break! case REQ_Ft: //perhaps "Function return type" case REQ_BR: case REQ_BI: case REQ_IB: case REQ_IR: case REQ_RB: case REQ_RI: { // ### VERIFY bool inFMode=(c[0]=='F'); if (inFMode) { c[0]='B'; c[1]='I'; }; char font[2] ; font[0] = c[0]; font[1] = c[1]; c=c+j; if (*c=='\n') c++; sl=fill_words(c, wordlist, &words, true, &c); /* .BR name (section) * indicates a link. It will be added in the output routine. */ for (i=0; i<words; i++) { if ((mode) || (inFMode)) { out_html(" "); curpos++; } wordlist[i][-1]=' '; out_html(set_font(font[i&1])); scan_troff(wordlist[i],1,NULL); } out_html(set_font("R")); if (mode) { out_html(" ]"); curpos++; } out_html(NEWLINE); if (!fillout) curpos=0; else curpos++; break; } case REQ_DT: // man(7) "Default Tabulators" { for (j=0;j<20; j++) tabstops[j]=(j+1)*8; maxtstop=20; c=skip_till_newline(c); break; } case REQ_IP: // man(7) "Ident Paragraph" { sl=fill_words(c+j, wordlist, &words, true, &c); if (!dl_set[itemdepth]) { out_html("<DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); if (words) scan_troff(wordlist[0], 1,NULL); out_html("<DD>"); curpos=0; break; } case REQ_TP: // man(7) "hanging Tag Paragraph" { if (!dl_set[itemdepth]) { out_html("<br><br><DL>\n"); dl_set[itemdepth]=1; } out_html("<DT>"); c=skip_till_newline(c); /* somewhere a definition ends with '.TP' */ if (!*c) still_dd=true; else { c=scan_troff(c,1,NULL); out_html("<DD>"); } curpos=0; break; } case REQ_IX: // "INdex" ### TODO: where is it defined? { /* general index */ c=skip_till_newline(c); break; } case REQ_P: // man(7) "Paragraph" case REQ_LP:// man(7) "Paragraph" case REQ_PP:// man(7) "Paragraph; reset Prevailing indent" { if (dl_set[itemdepth]) { out_html("</DL>\n"); dl_set[itemdepth]=0; } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_HP: // man(7) "Hanging indent Paragraph" { if (!dl_set[itemdepth]) { out_html("<DL>"); dl_set[itemdepth]=1; } out_html("<DT>\n"); still_dd=true; c=skip_till_newline(c); curpos=0; break; } case REQ_PD: // man(7) "Paragraph Distance" { c=skip_till_newline(c); break; } case REQ_Rs: // mdoc(7) "Relative margin Start" case REQ_RS: // man(7) "Relative margin Start" { sl=fill_words(c+j, wordlist, &words, true, 0); j=1; if (words>0) scan_expression(wordlist[0], &j); if (j>=0) { itemdepth++; dl_set[itemdepth]=0; out_html("<DL><DT><DD>"); c=skip_till_newline(c); curpos=0; break; } } case REQ_Re: // mdoc(7) "Relative margin End" case REQ_RE: // man(7) "Relative margin End" { if (itemdepth > 0) { if (dl_set[itemdepth]) out_html("</DL>"); out_html("</DL>\n"); itemdepth--; } c=skip_till_newline(c); curpos=0; break; } case REQ_SB: // man(7) "Small; Bold" { out_html(set_font("B")); out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c+j, 1, NULL); out_html("</small>"); out_html(set_font("R")); break; } case REQ_SM: // man(7) "SMall" { c=c+j; if (*c=='\n') c++; out_html("<small>"); trans_char(c,'"','\a'); // ### VERIFY c=scan_troff(c,1,NULL); out_html("</small>"); break; } case REQ_Ss: // mdoc(7) "Sub Section" mandoc_command = 1; case REQ_SS: // mdoc(7) "Sub Section" mode=true; case REQ_Sh: // mdoc(7) "Sub Header" /* hack for fallthru from above */ mandoc_command = !mode || mandoc_command; case REQ_SH: // man(7) "Sub Header" { c=c+j; if (*c=='\n') c++; while (itemdepth || dl_set[itemdepth]) { out_html("</DL>\n"); if (dl_set[itemdepth]) dl_set[itemdepth]=0; else if (itemdepth > 0) itemdepth--; } out_html(set_font("R")); out_html(change_to_size(0)); if (!fillout) { fillout=1; out_html("</PRE>"); } trans_char(c,'"', '\a'); if (section) { out_html("</div>\n"); section=0; } if (mode) out_html("\n<H3>"); else out_html("\n<H2>"); mandoc_synopsis = qstrncmp(c, "SYNOPSIS", 8) == 0; c = mandoc_command ? scan_troff_mandoc(c,1,NULL) : scan_troff(c,1,NULL); if (mode) out_html("</H3>\n"); else out_html("</H2>\n"); out_html("<div>\n"); section=1; curpos=0; break; } case REQ_Sx: // mdoc(7) { // reference to a section header out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_TS: // ### TODO where is it defined? (tbl?) { c=scan_table(c); break; } case REQ_Dt: /* mdoc(7) */ mandoc_command = true; case REQ_TH: // man(7) "Title Header" { if (!output_possible) { sl = fill_words(c+j, wordlist, &words, true, &c); // ### TODO: the page should be displayed even if it is "anonymous" (words==0) if (words>=1) { for (i=1; i<words; i++) wordlist[i][-1]='\0'; *sl='\0'; for (i=0; i<words; i++) { if (wordlist[i][0] == '\007') wordlist[i]++; if (wordlist[i][qstrlen(wordlist[i])-1] == '\007') wordlist[i][qstrlen(wordlist[i])-1] = 0; } output_possible=true; out_html( DOCTYPE"<HTML>\n<HEAD>\n");#ifdef SIMPLE_MAN2HTML // Most English man pages are in ISO-8859-1 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");#else // kio_man transforms from local to UTF-8 out_html("<meta http-equiv=\"Content-Type\" content=\"text/html; charset="); out_html(QTextCodec::codecForLocale()->mimeName()); out_html("\">\n");#endif out_html("<TITLE>"); out_html(scan_troff(wordlist[0], 0, NULL)); out_html( " Manpage</TITLE>\n"); out_html( "<link rel=\"stylesheet\" href=\""); out_html(htmlPath); out_html("/kde-default.css\" type=\"text/css\">\n" ); out_html( "<meta name=\"ROFF Type\" content=\""); if (mandoc_command) out_html("mdoc"); else out_html("man"); out_html("\">\n"); out_html( "</HEAD>\n\n" ); out_html("<BODY BGCOLOR=\"#FFFFFF\">\n\n" ); out_html("<div style=\"background-image: url("); out_html(cssPath); out_html("/top-middle.png); width: 100%; height: 131pt;\">\n" ); out_html("<div style=\"position: absolute; right: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-right-konqueror.png\" style=\"margin: 0pt\" alt=\"Top right\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; left: 0pt;\">\n"); out_html("<img src=\""); out_html(htmlPath); out_html("/top-left.png\" style=\"margin: 0pt\" alt=\"Top left\">\n"); out_html("</div>\n"); out_html("<div style=\"position: absolute; top: 25pt; right: 100pt; text-align: right; font-size: xx-large; font-weight: bold; text-shadow: #fff 0pt 0pt 5pt; color: #444\">\n"); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html("</div>\n"); out_html("</div>\n"); out_html("<div style=\"margin-left: 5em; margin-right: 5em;\">\n"); out_html("<h1>" ); out_html( scan_troff(wordlist[0], 0, NULL ) ); out_html( "</h1>\n" ); if (words>1) { out_html("Section: " ); if (!mandoc_command && words>4) out_html(scan_troff(wordlist[4], 0, NULL) ); else out_html(section_name(wordlist[1])); out_html(" ("); out_html(scan_troff(wordlist[1], 0, NULL)); out_html(")\n"); } else { out_html("Section not specified"); } *sl='\n'; } } else { kdWarning(7107) << ".TH found but output not possible" << endl; c=skip_till_newline(c); } curpos=0; break; } case REQ_TX: // mdoc(7) { sl=fill_words(c+j, wordlist, &words, true, &c); *sl='\0'; out_html(set_font("I")); if (words>1) wordlist[1][-1]='\0'; const char *c2=lookup_abbrev(wordlist[0]); curpos+=qstrlen(c2); out_html(c2); out_html(set_font("R")); if (words>1) out_html(wordlist[1]); *sl='\n'; break; } case REQ_rm: // groff(7) "ReMove" /* .rm xx : Remove request, macro or string */ mode=true; case REQ_rn: // groff(7) "ReName" /* .rn xx yy : Rename request, macro or string xx to yy */ { kdDebug(7107) << "start .rm/.rn" << endl; c+=j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } QCString name2; if ( !mode ) { while (*c && isspace(*c) && *c!='\n') ++c; name2 = scan_identifier( c ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to rename: " << endl; break; } } c=skip_till_newline(c); QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to rename or remove: " << name << endl; } else { if (mode) { // .rm ReMove s_stringDefinitionMap.remove(name); // ### QT4: removeAll } else { // .rn ReName StringDefinition def=(*it); s_stringDefinitionMap.remove(name); // ### QT4: removeAll s_stringDefinitionMap.insert(name2,def); } } kdDebug(7107) << "end .rm/.rn" << endl; break; } case REQ_nx: // ### TODO in man(7) it is "No filling", not "next file" /* .nx filename : next file. */ case REQ_in: // groff(7) "INdent" { /* .in +-N : Indent */ c=skip_till_newline(c); break; } case REQ_nr: // groff(7) "Number Register" { kdDebug(7107) << "start .nr" << endl; c += j; const QCString name( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty name for register variable" << endl; break; } while ( *c && ( *c==' ' || *c=='\t' ) ) c++; int sign = 0; if ( *c && ( *c == '+' || *c == '-' ) ) { if ( *c == '+' ) sign = 1; else if ( *c == '-' ) sign = -1; } int value = 0; int increment = 0; c=scan_expression( c, &value ); if ( *c && *c!='\n') { while ( *c && ( *c==' ' || *c=='\t' ) ) c++; c=scan_expression( c, &increment ); } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { if ( sign < 1 ) value = -value; NumberDefinition def( value, increment ); s_numberDefinitionMap.insert( name, def ); } else { if ( sign > 0 ) (*it).m_value += value; else if ( sign < 0 ) (*it).m_value += - value; else (*it).m_value = value; (*it).m_increment = increment; } kdDebug(7107) << "end .nr" << endl; break; } case REQ_am: // groff(7) "Append Macro" /* .am xx yy : append to a macro. */ /* define or handle as .ig yy */ mode=true; case REQ_de: // groff(7) "DEfine macro" /* .de xx yy : define or redefine macro xx; end at .yy (..) */ /* define or handle as .ig yy */ { kdDebug(7107) << "Start .am/.de" << endl; c+=j; char *next_line; sl = fill_words(c, wordlist, &words, true, &next_line); char *nameStart = wordlist[0]; c = nameStart; while (*c && (*c != ' ') && (*c != '\n')) c++; *c = '\0'; const QCString name(nameStart); QCString endmacro; if (words == 1) { endmacro=".."; } else { endmacro='.'; c = wordlist[1]; while (*c && (*c != ' ') && (*c != '\n')) endmacro+=*c++; } c = next_line; sl=c; const int length=qstrlen(endmacro); while (*c && qstrncmp(c,endmacro,length)) c=skip_till_newline(c); QCString macro; while (sl!=c) { if (sl[0]=='\\' && sl[1]=='\\') { macro+='\\'; sl++; } else macro+=*sl; sl++; } QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name); if (it==s_stringDefinitionMap.end()) { StringDefinition def; def.m_length=0; def.m_output=macro; s_stringDefinitionMap.insert(name,def); } else if (mode) { // .am Append Macro (*it).m_length=0; // It could be formerly a string if ((*it).m_output.right(1)!='\n') (*it).m_output+='\n'; (*it).m_output+=macro; } else { // .de DEfine macro (*it).m_length=0; // It could be formerly a string (*it).m_output=macro; } c=skip_till_newline(c); kdDebug(7107) << "End .am/.de" << endl; break; } case REQ_Bl: // mdoc(7) "Begin List" { char list_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (dl_set[itemdepth]) /* These things can nest. */ itemdepth++; if (nl) { /* Parse list options */ strlimitcpy(list_options, c, nl - c, MED_STR_MAX); } if (strstr(list_options, "-bullet")) { /* HTML Unnumbered List */ dl_set[itemdepth] = BL_BULLET_LIST; out_html("<UL>\n"); } else if (strstr(list_options, "-enum")) { /* HTML Ordered List */ dl_set[itemdepth] = BL_ENUM_LIST; out_html("<OL>\n"); } else { /* HTML Descriptive List */ dl_set[itemdepth] = BL_DESC_LIST; out_html("<DL>\n"); } if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_El: // mdoc(7) "End List" { c=c+j; if (dl_set[itemdepth] & BL_DESC_LIST) out_html("</DL>\n"); else if (dl_set[itemdepth] & BL_BULLET_LIST) out_html("</UL>\n"); else if (dl_set[itemdepth] & BL_ENUM_LIST) out_html("</OL>\n"); dl_set[itemdepth]=0; if (itemdepth > 0) itemdepth--; if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_It: // mdoc(7) "list ITem" { c=c+j; if (qstrncmp(c, "Xo", 2) == 0 && isspace(*(c+2))) c = skip_till_newline(c); if (dl_set[itemdepth] & BL_DESC_LIST) { out_html("<DT>"); out_html(set_font("B")); if (*c=='\n') { /* Don't allow embedded comms after a newline */ c++; c=scan_troff(c,1,NULL); } else { /* Do allow embedded comms on the same line. */ c=scan_troff_mandoc(c,1,NULL); } out_html(set_font("R")); out_html(NEWLINE); out_html("<DD>"); } else if (dl_set[itemdepth] & (BL_BULLET_LIST | BL_ENUM_LIST)) { out_html("<LI>"); c=scan_troff_mandoc(c,1,NULL); out_html(NEWLINE); } if (fillout) curpos++; else curpos=0; break; } case REQ_Bk: /* mdoc(7) */ case REQ_Ek: /* mdoc(7) */ case REQ_Dd: /* mdoc(7) */ case REQ_Os: // mdoc(7) "Operating System" { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Bt: // mdoc(7) "Beta Test" { trans_char(c,'"','\a'); c=c+j; out_html(" is currently in beta test."); if (fillout) curpos++; else curpos=0; break; } case REQ_At: /* mdoc(7) */ case REQ_Fx: /* mdoc(7) */ case REQ_Nx: /* mdoc(7) */ case REQ_Ox: /* mdoc(7) */ case REQ_Bx: /* mdoc(7) */ case REQ_Ux: /* mdoc(7) */ { bool parsable=true; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; if (request==REQ_At) { out_html("AT&amp;T UNIX "); parsable=false; } else if (request==REQ_Fx) { out_html("FreeBSD "); parsable=false; } else if (request==REQ_Nx) out_html("NetBSD "); else if (request==REQ_Ox) out_html("OpenBSD "); else if (request==REQ_Bx) out_html("BSD "); else if (request==REQ_Ux) out_html("UNIX "); if (parsable) c=scan_troff_mandoc(c,1,0); else c=scan_troff(c,1,0); if (fillout) curpos++; else curpos=0; break; } case REQ_Dl: /* mdoc(7) */ { c=c+j; out_html(NEWLINE); out_html("<BLOCKQUOTE>"); if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</BLOCKQUOTE>"); if (fillout) curpos++; else curpos=0; break; } case REQ_Bd: /* mdoc(7) */ { /* Seems like a kind of example/literal mode */ char bd_options[NULL_TERMINATED(MED_STR_MAX)]; char *nl = strchr(c,'\n'); c=c+j; if (nl) strlimitcpy(bd_options, c, nl - c, MED_STR_MAX); out_html(NEWLINE); mandoc_bd_options = 0; /* Remember options for terminating Bl */ if (strstr(bd_options, "-offset indent")) { mandoc_bd_options |= BD_INDENT; out_html("<BLOCKQUOTE>\n"); } if ( strstr(bd_options, "-literal") || strstr(bd_options, "-unfilled")) { if (fillout) { mandoc_bd_options |= BD_LITERAL; out_html(set_font("R")); out_html(change_to_size('0')); out_html("<PRE>\n"); } curpos=0; fillout=0; } c=skip_till_newline(c); break; } case REQ_Ed: /* mdoc(7) */ { if (mandoc_bd_options & BD_LITERAL) { if (!fillout) { out_html(set_font("R")); out_html(change_to_size('0')); out_html("</PRE>\n"); } } if (mandoc_bd_options & BD_INDENT) out_html("</BLOCKQUOTE>\n"); curpos=0; fillout=1; c=skip_till_newline(c); break; } case REQ_Be: /* mdoc(7) */ { c=c+j; if (fillout) out_html("<br><br>"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Xr: /* mdoc(7) */ // ### FIXME: it should issue a <a href="man:somewhere(x)"> directly { /* Translate xyz 1 to xyz(1) * Allow for multiple spaces. Allow the section to be missing. */ char buff[NULL_TERMINATED(MED_STR_MAX)]; char *bufptr; trans_char(c,'"','\a'); bufptr = buff; c = c+j; if (*c == '\n') c++; /* Skip spaces */ while (isspace(*c) && *c != '\n') c++; while (isalnum(*c) || *c == '.' || *c == ':' || *c == '_' || *c == '-') { /* Copy the xyz part */ *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } while (isspace(*c) && *c != '\n') c++; /* Skip spaces */ if (isdigit(*c)) { /* Convert the number if there is one */ *bufptr = '('; bufptr++; if (bufptr < buff + MED_STR_MAX) { while (isalnum(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; c++; } if (bufptr < buff + MED_STR_MAX) { *bufptr = ')'; bufptr++; } } } while (*c != '\n') { /* Copy the remainder */ if (!isspace(*c)) { *bufptr = *c; bufptr++; if (bufptr >= buff + MED_STR_MAX) break; } c++; } *bufptr = '\n'; bufptr[1] = 0; scan_troff_mandoc(buff, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Fl: // mdoc(7) "FLags" { trans_char(c,'"','\a'); c+=j; sl=fill_words(c, wordlist, &words, true, &c); out_html(set_font("B")); if (!words) { out_html("-"); // stdin or stdout } else { for (i=0;i<words;++i) { if (ispunct(wordlist[i][0]) && wordlist[i][0]!='-') { scan_troff_mandoc(wordlist[i], 1, NULL); } else { if (i>0) out_html(" "); // Put a space between flags out_html("-"); scan_troff_mandoc(wordlist[i], 1, NULL); } } } out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pa: /* mdoc(7) */ case REQ_Pf: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Pp: /* mdoc(7) */ { if (fillout) out_html("<br><br>\n"); else { out_html(NEWLINE); } curpos=0; c=skip_till_newline(c); break; } case REQ_Aq: // mdoc(7) "Angle bracket Quote" c=process_quote(c,j,"&lt;","&gt;"); break; case REQ_Bq: // mdoc(7) "Bracket Quote" c=process_quote(c,j,"[","]"); break; case REQ_Dq: // mdoc(7) "Double Quote" c=process_quote(c,j,"&ldquo;","&rdquo;"); break; case REQ_Pq: // mdoc(7) "Parenthese Quote" c=process_quote(c,j,"(",")"); break; case REQ_Qq: // mdoc(7) "straight double Quote" c=process_quote(c,j,"&quot;","&quot;"); break; case REQ_Sq: // mdoc(7) "Single Quote" c=process_quote(c,j,"&lsquo;","&rsquo;"); break; case REQ_Op: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Oo: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("R")); out_html("["); c=scan_troff_mandoc(c, 1, NULL); if (fillout) curpos++; else curpos=0; break; } case REQ_Oc: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html("]"); if (fillout) curpos++; else curpos=0; break; } case REQ_Ql: /* mdoc(7) */ { /* Single quote first word in the line */ char *sp; trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; sp = c; do { /* Find first whitespace after the * first word that isn't a mandoc macro */ while (*sp && isspace(*sp)) sp++; while (*sp && !isspace(*sp)) sp++; } while (*sp && isupper(*(sp-2)) && islower(*(sp-1))); /* Use a newline to mark the end of text to * be quoted */ if (*sp) *sp = '\n'; out_html("`"); /* Quote the text */ c=scan_troff_mandoc(c, 1, NULL); out_html("'"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ar: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') { /* An empty Ar means "file ..." */ out_html("file ..."); } else c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Em: /* mdoc(7) */ { out_html("<em>"); trans_char(c,'"','\a'); c+=j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html("</em>"); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Ad: /* mdoc(7) */ case REQ_Va: /* mdoc(7) */ case REQ_Xc: /* mdoc(7) */ { /* parse one line in italics */ out_html(set_font("I")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nd: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(" - "); c=scan_troff_mandoc(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Nm: // mdoc(7) "Name Macro" ### FIXME { static char mandoc_name[NULL_TERMINATED(SMALL_STR_MAX)] = ""; // ### TODO Use QCString trans_char(c,'"','\a'); c=c+j; if (mandoc_synopsis && mandoc_name_count) { /* Break lines only in the Synopsis. * The Synopsis section seems to be treated * as a special case - Bummer! */ out_html("<BR>"); } else if (!mandoc_name_count) { const char *nextbreak = strchr(c, '\n'); const char *nextspace = strchr(c, ' '); if (nextspace < nextbreak) nextbreak = nextspace; if (nextbreak) { /* Remember the name for later. */ strlimitcpy(mandoc_name, c, nextbreak - c, SMALL_STR_MAX); } } mandoc_name_count++; out_html(set_font("B")); // ### FIXME: fill_words must be used while (*c == ' '|| *c == '\t') c++; if ((tolower(*c) >= 'a' && tolower(*c) <= 'z' ) || (*c >= '0' && *c <= '9')) { // alphanumeric argument c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); } else { /* If Nm has no argument, use one from an earlier * Nm command that did have one. Hope there aren't * too many commands that do this. */ out_html(mandoc_name); out_html(set_font("R")); } if (fillout) curpos++; else curpos=0; break; } case REQ_Cd: /* mdoc(7) */ case REQ_Cm: /* mdoc(7) */ case REQ_Ic: /* mdoc(7) */ case REQ_Ms: /* mdoc(7) */ case REQ_Or: /* mdoc(7) */ case REQ_Sy: /* mdoc(7) */ { /* parse one line in bold */ out_html(set_font("B")); trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_Dv: /* mdoc(7) */ case REQ_Ev: /* mdoc(7) */ case REQ_Fr: /* mdoc(7) */ case REQ_Li: /* mdoc(7) */ case REQ_No: /* mdoc(7) */ case REQ_Ns: /* mdoc(7) */ case REQ_Tn: /* mdoc(7) */ case REQ_nN: /* mdoc(7) */ { trans_char(c,'"','\a'); c=c+j; if (*c=='\n') c++; out_html(set_font("B")); c=scan_troff_mandoc(c, 1, NULL); out_html(set_font("R")); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; break; } case REQ_perc_A: /* mdoc(7) biblio stuff */ case REQ_perc_D: case REQ_perc_N: case REQ_perc_O: case REQ_perc_P: case REQ_perc_Q: case REQ_perc_V: { c=c+j; if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ if (fillout) curpos++; else curpos=0; break; } case REQ_perc_B: case REQ_perc_J: case REQ_perc_R: case REQ_perc_T: { c=c+j; out_html(set_font("I")); if (*c=='\n') c++; c=scan_troff(c, 1, NULL); /* Don't allow embedded mandoc coms */ out_html(set_font("R")); if (fillout) curpos++; else curpos=0; break; } case REQ_UR: // ### FIXME man(7) "URl" { ignore_links=true; c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; // A parameter : means that we do not want an URL, not here and not until .UE ur_ignore=(!qstrcmp(h,":")); } else { // We cannot find the URL, assume : ur_ignore=true; h=0; } if (!ur_ignore && words>0) { out_html("<a href=\""); out_html(h); out_html("\">"); } c=newc; // Go to next line break; } case REQ_UE: // ### FIXME man(7) "Url End" { c+=j; c = skip_till_newline(c); if (!ur_ignore) { out_html("</a>"); } ur_ignore=false; ignore_links=false; break; } case REQ_UN: // ### FIXME man(7) "Url Named anchor" { c+=j; char* newc; h=fill_words(c, wordlist, &words, false, &newc); *h=0; if (words>0) { h=wordlist[0]; out_html("<a name=\">"); out_html(h); out_html("\" id=\""); out_html(h); out_html("\"></a>"); } c=newc; break; } case REQ_nroff: // groff(7) "NROFF mode" mode = true; case REQ_troff: // groff(7) "TROFF mode" { s_nroff = mode; c+=j; c = skip_till_newline(c); } case REQ_als: // groff(7) "ALias String" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rn, the destination is first, origin is second kdDebug(7107) << "start .als" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination string to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c=skip_till_newline(c); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination string to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rn) QMap<QCString,StringDefinition>::iterator it=s_stringDefinitionMap.find(name2); if (it==s_stringDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { StringDefinition def=(*it); s_stringDefinitionMap.insert(name,def); } kdDebug(7107) << "end .als" << endl; break; } case REQ_rr: // groff(7) "Remove number Register" { kdDebug(7107) << "start .rr" << endl; c += j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin string to remove/rename: " << endl; break; } c = skip_till_newline( c ); QMap <QCString, NumberDefinition>::iterator it = s_numberDefinitionMap.find( name ); if ( it == s_numberDefinitionMap.end() ) { kdDebug(7107) << "EXCEPTION: trying to remove inexistant number register: " << endl; } else { s_numberDefinitionMap.remove( name ); } kdDebug(7107) << "end .rr" << endl; break; } case REQ_rnn: // groff(7) "ReName Number register" { kdDebug(7107) << "start .rnn" << endl; c+=j; const QCString name ( scan_identifier ( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin to remove/rename number register" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier ( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination to rename number register " << endl; break; } c = skip_till_newline( c ); QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find number register to rename: " << name << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.remove(name); // ### QT4: removeAll s_numberDefinitionMap.insert(name2,def); } kdDebug(7107) << "end .rnn" << endl; break; } case REQ_aln: // groff(7) "ALias Number Register" { /* * Note an alias is supposed to be something like a hard link * However to make it simplier, we only copy the string. */ // Be careful: unlike .rnn, the destination is first, origin is second kdDebug(7107) << "start .aln" << endl; c+=j; const QCString name ( scan_identifier( c ) ); if ( name.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty destination number register to alias" << endl; break; } while (*c && isspace(*c) && *c!='\n') ++c; const QCString name2 ( scan_identifier( c ) ); if ( name2.isEmpty() ) { kdDebug(7107) << "EXCEPTION: empty origin number register to alias" << endl; break; } kdDebug(7107) << "Alias " << name2 << " to " << name << endl; c = skip_till_newline( c ); if ( name == name2 ) { kdDebug(7107) << "EXCEPTION: same origin and destination number register to alias: " << name << endl; break; } // Second parametr is origin (unlike in .rnn) QMap<QCString,NumberDefinition>::iterator it=s_numberDefinitionMap.find(name2); if (it==s_numberDefinitionMap.end()) { kdDebug(7107) << "EXCEPTION: cannot find string to make alias: " << name2 << endl; } else { NumberDefinition def=(*it); s_numberDefinitionMap.insert(name,def); } kdDebug(7107) << "end .aln" << endl; break; } case REQ_shift: // groff(7) "SHIFT parameter" { c+=j; h=c; while (*h && *h!='\n' && isdigit(*h) ) ++h; const char tempchar = *h; *h = 0; const QCString number = c; *h = tempchar; c = skip_till_newline( h ); unsigned int result = 1; // Numbers of shifts to do if ( !number.isEmpty() ) { bool ok = false; result = number.toUInt(&ok); if ( !ok || result < 1 ) result = 1; } for ( unsigned int num = 0; num < result; ++num ) { if ( !s_argumentList.isEmpty() ) s_argumentList.pop_front(); } break; } case REQ_while: // groff(7) "WHILE loop" { request_while( c, j, mandoc_command ); break; } default: { if (mandoc_command && ((isupper(*c) && islower(*(c+1))) || (islower(*c) && isupper(*(c+1)))) ) { /* Let through any mdoc(7) commands that haven't * been delt with. * I don't want to miss anything out of the text. */ char buf[4]; qstrncpy(buf,c,2); buf[2] = ' '; buf[3] = '\0'; out_html(buf); /* Print the command (it might just be text). */ c=c+j; trans_char(c,'"','\a'); if (*c=='\n') c++; out_html(set_font("R")); c=scan_troff(c, 1, NULL); out_html(NEWLINE); if (fillout) curpos++; else curpos=0; } else c=skip_till_newline(c); break; } } } } if (fillout) { out_html(NEWLINE); curpos++; } return c;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/a2a0d621d2afd22ae7cf2ad733a2ce62a96b2010/man2html.cpp/buggy/kioslave/man/man2html.cpp
QWidget* allocate_kstyle_config(QWidget* parent)
KDE_EXPORT QWidget* allocate_kstyle_config(QWidget* parent)
QWidget* allocate_kstyle_config(QWidget* parent) { return new KeramikStyleConfig(parent); }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/853e13234ed605e43da1cfbd48a5669fc9e10cc0/keramikconf.cpp/clean/kcontrol/style/keramik/keramikconf.cpp
cout << (*modules.at(i)).local8Bit(); cout << verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit(); cout << " - "; cout << (*descriptions.at(i)).local8Bit(); cout << endl;
fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data());
int main(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), "2.0", I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2000, The KDE Developers"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); KApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { cout << (*modules.at(i)).local8Bit(); cout << verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit(); cout << " - "; cout << (*descriptions.at(i)).local8Bit(); cout << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { QString path = locateModule(args->arg(0)); if (path.isEmpty()) return 0; // load the module ModuleInfo info(path); KCModule *module = ModuleLoader::loadModule(info, false); if (module) { // create the dialog KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true); dlg->setCaption(info.name()); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) QXEmbed::embedClientIntoWindow(dlg, id); } // run the dialog int ret = dlg->exec(); delete dlg; ModuleLoader::unloadModule(info); return ret; } KMessageBox::error(0, i18n("There was an error loading the module.\nThe diagnostics is:\n%1") .arg(KLibLoader::self()->lastErrorMessage())); return 0; } // multiple control modules QStringList modules; for (int i = 0; i < args->count(); i++) { QString path = locateModule(args->arg(i)); if(!path.isEmpty()) modules.append(path); } if (modules.count() < 1) return -1; // create the dialog KExtendedCDialog * dlg = new KExtendedCDialog(0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (QStringList::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(*it, false); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) QXEmbed::embedClientIntoWindow(dlg, id); } // run the dialog int ret = dlg->exec(); delete dlg; return ret;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/2d5af787364c03f4492f36846c5bb4bbfa590189/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
if (path.isEmpty())
if (path.isEmpty())
int main(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), "2.0", I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2000, The KDE Developers"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); KApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { cout << (*modules.at(i)).local8Bit(); cout << verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit(); cout << " - "; cout << (*descriptions.at(i)).local8Bit(); cout << endl; } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { QString path = locateModule(args->arg(0)); if (path.isEmpty()) return 0; // load the module ModuleInfo info(path); KCModule *module = ModuleLoader::loadModule(info, false); if (module) { // create the dialog KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true); dlg->setCaption(info.name()); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) QXEmbed::embedClientIntoWindow(dlg, id); } // run the dialog int ret = dlg->exec(); delete dlg; ModuleLoader::unloadModule(info); return ret; } KMessageBox::error(0, i18n("There was an error loading the module.\nThe diagnostics is:\n%1") .arg(KLibLoader::self()->lastErrorMessage())); return 0; } // multiple control modules QStringList modules; for (int i = 0; i < args->count(); i++) { QString path = locateModule(args->arg(i)); if(!path.isEmpty()) modules.append(path); } if (modules.count() < 1) return -1; // create the dialog KExtendedCDialog * dlg = new KExtendedCDialog(0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (QStringList::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(*it, false); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) QXEmbed::embedClientIntoWindow(dlg, id); } // run the dialog int ret = dlg->exec(); delete dlg; return ret;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/2d5af787364c03f4492f36846c5bb4bbfa590189/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
virtual void select(QgsRect *, bool lock)
virtual void select(QgsRect *, bool )
virtual void select(QgsRect *, bool lock) { };
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/43f8a11054ec8b8e4192b832188751a9f0aac2fd/qgsmaplayer.h/clean/src/qgsmaplayer.h
bh->bc->flushing_buffers.insert(bh);
C_Client_FlushFinish(Bufferhead *bh) { this->bh = bh; }
2690 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2690/5759e597c054e3dab1e5d84e232b5137b1a09a4d/Client.cc/buggy/ceph/client/Client.cc
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_CopyBits(JNIEnv *env, jclass zz, jint srcBits, jint dstBits, jshortArray srcRect, jshortArray dstRect, jshort mode, jint maskRgn) {
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_CopyBits(JNIEnv *env, jclass zz, jint srcBits, jint dstBits, jshortArray srcRect, jshortArray dstRect, jshort mode, jint maskRgn) {
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_CopyBits(JNIEnv *env, jclass zz, jint srcBits, jint dstBits, jshortArray srcRect, jshortArray dstRect, jshort mode, jint maskRgn) { jshort *sa= (*env)->GetShortArrayElements(env, srcRect, 0); jshort *sb= (*env)->GetShortArrayElements(env, dstRect, 0); CopyBits((BitMap*)srcBits, (BitMap*)dstBits, (Rect*) sa, (Rect*) sb, mode, (RgnHandle) maskRgn); (*env)->ReleaseShortArrayElements(env, srcRect, sa, 0); (*env)->ReleaseShortArrayElements(env, dstRect, sb, 0);}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/9d55940214dd65b869b66fbd78328ac944c2a750/swt.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/swt.c
CopyBits((BitMap*)srcBits, (BitMap*)dstBits, (Rect*) sa, (Rect*) sb, mode, (RgnHandle) maskRgn); (*env)->ReleaseShortArrayElements(env, srcRect, sa, 0);
CopyBits((BitMap*)srcBits, (BitMap*)dstBits, (Rect*)sa, (Rect*)sb, mode, (RgnHandle) maskRgn); (*env)->ReleaseShortArrayElements(env, srcRect, sa, 0);
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_CopyBits(JNIEnv *env, jclass zz, jint srcBits, jint dstBits, jshortArray srcRect, jshortArray dstRect, jshort mode, jint maskRgn) { jshort *sa= (*env)->GetShortArrayElements(env, srcRect, 0); jshort *sb= (*env)->GetShortArrayElements(env, dstRect, 0); CopyBits((BitMap*)srcBits, (BitMap*)dstBits, (Rect*) sa, (Rect*) sb, mode, (RgnHandle) maskRgn); (*env)->ReleaseShortArrayElements(env, srcRect, sa, 0); (*env)->ReleaseShortArrayElements(env, dstRect, sb, 0);}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/9d55940214dd65b869b66fbd78328ac944c2a750/swt.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/swt.c
if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
JNIEXPORT jint JNICALL OS_NATIVE(CreateNewWindow) (JNIEnv *env, jclass that, jint arg0, jint arg1, jobject arg2, jintArray arg3){ Rect _arg2, *lparg2=NULL; jint *lparg3=NULL; jint rc; NATIVE_ENTER(env, that, "CreateNewWindow\n") if (arg2) lparg2 = getRectFields(env, arg2, &_arg2); if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); rc = (jint)CreateNewWindow((WindowClass)arg0, (WindowAttributes)arg1, (const Rect *)lparg2, (WindowRef *)lparg3); if (arg2) setRectFields(env, arg2, lparg2); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); NATIVE_EXIT(env, that, "CreateNewWindow\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
JNIEXPORT jint JNICALL OS_NATIVE(CreateStandardAlert) (JNIEnv *env, jclass that, jshort arg0, jint arg1, jint arg2, jobject arg3, jintArray arg4){ AlertStdCFStringAlertParamRec _arg3, *lparg3=NULL; jint *lparg4=NULL; jint rc; NATIVE_ENTER(env, that, "CreateStandardAlert\n") if (arg3) lparg3 = getAlertStdCFStringAlertParamRecFields(env, arg3, &_arg3); if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); rc = (jint)CreateStandardAlert((AlertType)arg0, (CFStringRef)arg1, (CFStringRef)arg2, (const AlertStdCFStringAlertParamRec *)lparg3, (DialogRef *)lparg4); if (arg3) setAlertStdCFStringAlertParamRecFields(env, arg3, lparg3); if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); NATIVE_EXIT(env, that, "CreateStandardAlert\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
JNIEXPORT jint JNICALL OS_NATIVE(CreateUserPaneControl) (JNIEnv *env, jclass that, jint arg0, jobject arg1, jint arg2, jintArray arg3){ Rect _arg1, *lparg1=NULL; jint *lparg3=NULL; jint rc; NATIVE_ENTER(env, that, "CreateUserPaneControl\n") if (arg1) lparg1 = getRectFields(env, arg1, &_arg1); if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); rc = (jint)CreateUserPaneControl((WindowRef)arg0, lparg1, arg2, (ControlRef *)lparg3); if (arg1) setRectFields(env, arg1, lparg1); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); NATIVE_EXIT(env, that, "CreateUserPaneControl\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
JNIEXPORT jshort JNICALL OS_NATIVE(FindWindow) (JNIEnv *env, jclass that, jobject arg0, jintArray arg1){ Point _arg0, *lparg0=NULL; jint *lparg1=NULL; jshort rc; NATIVE_ENTER(env, that, "FindWindow\n") if (arg0) lparg0 = getPointFields(env, arg0, &_arg0); if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL); rc = (jshort)FindWindow(*(Point *)lparg0, (WindowRef *)lparg1); if (arg0) setPointFields(env, arg0, lparg0); if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); NATIVE_EXIT(env, that, "FindWindow\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0); if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0);
JNIEXPORT jint JNICALL OS_NATIVE(GetThemeFont) (JNIEnv *env, jclass that, jshort arg0, jshort arg1, jbyteArray arg2, jshortArray arg3, jbyteArray arg4){ jbyte *lparg2=NULL; jshort *lparg3=NULL; jbyte *lparg4=NULL; jint rc; NATIVE_ENTER(env, that, "GetThemeFont\n") if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); if (arg3) lparg3 = (*env)->GetShortArrayElements(env, arg3, NULL); if (arg4) lparg4 = (*env)->GetByteArrayElements(env, arg4, NULL); rc = (jint)GetThemeFont((ThemeFontID)arg0, (ScriptCode)arg1, (char *)lparg2, (SInt16 *)lparg3, (Style *)lparg4); if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); if (arg3) (*env)->ReleaseShortArrayElements(env, arg3, lparg3, 0); if (arg4) (*env)->ReleaseByteArrayElements(env, arg4, lparg4, 0); NATIVE_EXIT(env, that, "GetThemeFont\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_SetPort(JNIEnv *env, jclass zz, jint portHandle) {
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_SetPort(JNIEnv *env, jclass zz, jint portHandle) {
JNIEXPORT void JNICALL Java_org_eclipse_swt_internal_carbon_OS_SetPort(JNIEnv *env, jclass zz, jint portHandle) { SetPort((GrafPtr) portHandle);}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/9d55940214dd65b869b66fbd78328ac944c2a750/swt.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/swt.c
if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
JNIEXPORT void JNICALL OS_NATIVE(TXNGetSelection) (JNIEnv *env, jclass that, jint arg0, jintArray arg1, jintArray arg2){ jint *lparg1=NULL; jint *lparg2=NULL; NATIVE_ENTER(env, that, "TXNGetSelection\n") if (arg1) lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL); if (arg2) lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL); TXNGetSelection((TXNObject)arg0, (TXNOffset *)lparg1, (TXNOffset *)lparg2); if (arg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0); if (arg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0); NATIVE_EXIT(env, that, "TXNGetSelection\n")}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL);
if (arg0) lparg0 = (*env)->GetPrimitiveArrayCritical(env, arg0, NULL);
JNIEXPORT void JNICALL OS_NATIVE(memcpy___3BII) (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1, jint arg2){ jbyte *lparg0=NULL; NATIVE_ENTER(env, that, "memcpy___3BII\n") if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); memcpy((void *)lparg0, (const void *)arg1, (size_t)arg2); if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); NATIVE_EXIT(env, that, "memcpy___3BII\n")}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
if (arg0) (*env)->ReleasePrimitiveArrayCritical(env, arg0, lparg0, 0);
JNIEXPORT void JNICALL OS_NATIVE(memcpy___3BII) (JNIEnv *env, jclass that, jbyteArray arg0, jint arg1, jint arg2){ jbyte *lparg0=NULL; NATIVE_ENTER(env, that, "memcpy___3BII\n") if (arg0) lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL); memcpy((void *)lparg0, (const void *)arg1, (size_t)arg2); if (arg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0); NATIVE_EXIT(env, that, "memcpy___3BII\n")}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/clean/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
int main(int argc, char **argv){ KLocale::setMainCatalog("kdelibs"); const char *description = I18N_NOOP("KDE Menu query tool.\n" "This tool can be used to find in which menu a specific application is shown.\n" "The --highlight option can be used to visually indicate to the user where\n" "in the KDE menu a specific application is located."); KAboutData d(appName, I18N_NOOP("kde-menu"), appVersion, description, KAboutData::License_GPL, "(c) 2003 Waldo Bastian"); d.addAuthor("Waldo Bastian", I18N_NOOP("Author"), "[email protected]"); KCmdLineArgs::init(argc, argv, &d); KCmdLineArgs::addCmdLineOptions(options);// KApplication k(false, false); KApplication k(false); k.disableSessionManagement(); // this program is in kdelibs so it uses kdelibs as catalog KLocale::setMainCatalog("kdelibs"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() != 1) KCmdLineArgs::usage(i18n("You must specify an application-id such as 'kde-konsole.desktop'")); utf8 = args->isSet("utf8"); bPrintMenuId = args->isSet("print-menu-id"); bPrintMenuName = args->isSet("print-menu-name"); bHighlight = args->isSet("highlight"); if (!bPrintMenuId && !bPrintMenuName && !bHighlight) KCmdLineArgs::usage(i18n("You must specify at least one of --print-menu-id, --print-menu-name or --highlight")); if (args->isSet("cache-update")) { QStringList args; args.append("--incremental"); args.append("--checkstamps"); QString command = "kbuildsycoca"; QByteArray _launcher = KApplication::launcher(); if (!DCOPRef(_launcher, _launcher).call("kdeinit_exec_wait", command, args).isValid()) { qWarning("Can't talk to klauncher!"); command = KGlobal::dirs()->findExe(command); command += " " + args.join(" "); system(command.toLocal8Bit()); } } QString menuId = QFile::decodeName(args->arg(0)); KService::Ptr s = KService::serviceByMenuId(menuId); if (!s) error(1, i18n("No menu item '%1'.").arg(menuId)); findMenuEntry(KServiceGroup::root(), "", menuId); error(2, i18n("Menu item '%1' not found in menu.").arg(menuId)); return 2;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5b44ee5fa9fbc5e85bc110e8e84d4b816a1fc36d/kde-menu.cpp/buggy/kde-menu/kde-menu.cpp
int main(int argc, char **argv){ KLocale::setMainCatalog("kdelibs"); const char *description = I18N_NOOP("KDE Menu query tool.\n" "This tool can be used to find in which menu a specific application is shown.\n" "The --highlight option can be used to visually indicate to the user where\n" "in the KDE menu a specific application is located."); KAboutData d(appName, I18N_NOOP("kde-menu"), appVersion, description, KAboutData::License_GPL, "(c) 2003 Waldo Bastian"); d.addAuthor("Waldo Bastian", I18N_NOOP("Author"), "[email protected]"); KCmdLineArgs::init(argc, argv, &d); KCmdLineArgs::addCmdLineOptions(options);// KApplication k(false, false); KApplication k(false); k.disableSessionManagement(); // this program is in kdelibs so it uses kdelibs as catalog KLocale::setMainCatalog("kdelibs"); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); if (args->count() != 1) KCmdLineArgs::usage(i18n("You must specify an application-id such as 'kde-konsole.desktop'")); utf8 = args->isSet("utf8"); bPrintMenuId = args->isSet("print-menu-id"); bPrintMenuName = args->isSet("print-menu-name"); bHighlight = args->isSet("highlight"); if (!bPrintMenuId && !bPrintMenuName && !bHighlight) KCmdLineArgs::usage(i18n("You must specify at least one of --print-menu-id, --print-menu-name or --highlight")); if (args->isSet("cache-update")) { QStringList args; args.append("--incremental"); args.append("--checkstamps"); QString command = "kbuildsycoca"; QByteArray _launcher = KApplication::launcher(); if (!DCOPRef(_launcher, _launcher).call("kdeinit_exec_wait", command, args).isValid()) { qWarning("Can't talk to klauncher!"); command = KGlobal::dirs()->findExe(command); command += " " + args.join(" "); system(command.toLocal8Bit()); } } QString menuId = QFile::decodeName(args->arg(0)); KService::Ptr s = KService::serviceByMenuId(menuId); if (!s) error(1, i18n("No menu item '%1'.").arg(menuId)); findMenuEntry(KServiceGroup::root(), "", menuId); error(2, i18n("Menu item '%1' not found in menu.").arg(menuId)); return 2;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/5b44ee5fa9fbc5e85bc110e8e84d4b816a1fc36d/kde-menu.cpp/buggy/kde-menu/kde-menu.cpp
QString whatToDoText() const { return m_whatToDoText; }
virtual QString whatToDoText() const { return m_whatToDoText; }
QString whatToDoText() const { return m_whatToDoText; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/612dc0026206300c21fba1aa7c7f0071ba588598/krashconf.h/buggy/drkonqi/krashconf.h
int pid() const { return m_pid; };
virtual int pid() const { return m_pid; };
int pid() const { return m_pid; };
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/612dc0026206300c21fba1aa7c7f0071ba588598/krashconf.h/clean/drkonqi/krashconf.h
KDEsuDialog *dlg = new KDEsuDialog(user, auth_user, keep && !terminal); dlg->addLine(i18n("Command:"), command); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); dlg->addLine(i18n("Priority:"), prio); } int ret = dlg->exec(); if (ret == KDEsuDialog::Rejected) exit(0); if (ret == KDEsuDialog::AsUser) change_uid = false; QCString password = dlg->password(); int k = dlg->keep(); delete dlg;
SuProcess proc; proc.setUser(auth_user); int needpw = proc.checkNeedPassword(); if (needpw < 0) { QString err = i18n("Su returned with an error!\n"); KMessageBox::error(0L, err); exit(1); } if (needpw == 0) { keep = 0; kdDebug() << "Don't need password!!\n"; } QCString password; if (needpw) { KDEsuDialog *dlg = new KDEsuDialog(user, auth_user, keep && !terminal); dlg->addLine(i18n("Command:"), command); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); dlg->addLine(i18n("Priority:"), prio); } int ret = dlg->exec(); if (ret == KDEsuDialog::Rejected) exit(0); if (ret == KDEsuDialog::AsUser) change_uid = false; password = dlg->password(); keep = dlg->keep(); delete dlg; }
int main(int argc, char *argv[]){ KAboutData aboutData("kdesu", I18N_NOOP("KDE su"), Version, I18N_NOOP("Runs a program with elevated privileges."), KAboutData::License_Artistic, "Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Maintainer"), "[email protected]", "http://www.stack.nl/~geertj/"); aboutData.addAuthor("Pietro Iglio", I18N_NOOP("Original author"), "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KApplication *app = new KApplication; // Stop daemon and exit? if (args->isSet("s")) { KDEsuClient client; if (client.ping() == -1) { kdError(1206) << "Daemon not running -- nothing to stop\n"; exit(1); } if (client.stopServer() != -1) { kdDebug(1206) << "Daemon stopped\n"; exit(0); } kdError(1206) << "Could not stop daemon\n"; exit(1); } // Get target uid QCString user = args->getOption("u"); QCString auth_user = user; struct passwd *pw = getpwnam(user); if (pw == 0L) { kdError(1206) << "User " << user << " does not exist\n"; exit(1); } bool change_uid = (getuid() != pw->pw_uid); // If file is writeable, do not change uid QString file = QFile::decodeName(args->getOption("f")); if (change_uid && !file.isEmpty()) { if (file.at(0) != '/') { KStandardDirs dirs; dirs.addKDEDefaults(); file = dirs.findResource("config", file); if (file.isEmpty()) { kdError(1206) << "Config file not found: " << file << "\n"; exit(1); } } QFileInfo fi(file); if (!fi.exists()) { kdError(1206) << "File does not exist: " << file << "\n"; exit(1); } change_uid = !fi.isWritable(); } // Get priority/scheduler QCString tmp = args->getOption("p"); bool ok; int priority = tmp.toInt(&ok); if (!ok || (priority < 0) || (priority > 100)) { KCmdLineArgs::usage(i18n("Illegal priority: %1").arg(tmp)); exit(1); } int scheduler = SuProcess::SchedNormal; if (args->isSet("r")) scheduler = SuProcess::SchedRealtime; if ((priority > 50) || (scheduler != SuProcess::SchedNormal)) { change_uid = true; auth_user = "root"; } // Get command if (args->isSet("c")) { command = args->getOption("c"); for (int i=0; i<args->count(); i++) { command += " "; command += args->arg(i); } } else { if( args->count() == 0 ) { KCmdLineArgs::usage(i18n("No command specified!")); exit(1); } command = args->arg(0); for (int i=1; i<args->count(); i++) { command += " "; command += args->arg(i); }}// CJM - Test lines remove when working// kdWarning(1206) << args->count();// kdWarning(1206) << command; // Don't change uid if we're don't need to. if (!change_uid) return system(command); // Check for daemon and start if necessary bool just_started = false; bool have_daemon = true; KDEsuClient client; if (!client.isServerSGID()) { kdWarning(1206) << "Daemon not safe (not sgid), not using it.\n"; have_daemon = false; } else if (client.ping() == -1) { if (client.startServer() == -1) { kdWarning(1206) << "Could not start daemon, reduced functionality.\n"; have_daemon = false; } just_started = true; } // Try to exec the command with kdesud. bool keep = !args->isSet("n") && have_daemon; bool terminal = args->isSet("t"); if (keep && !terminal && !just_started) { client.setPriority(priority); client.setScheduler(scheduler); if (client.exec(command, user) != -1) return 0; } // Set core dump size to 0 because we will have // root's password in memory. struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim)) { kdError(1206) << "rlimit(): " << ERR << "\n"; exit(1); } // Read configuration KConfig *config = KGlobal::config(); config->setGroup("Passwords"); int timeout = config->readNumEntry("Timeout", defTimeout); // Start the dialog KDEsuDialog *dlg = new KDEsuDialog(user, auth_user, keep && !terminal); dlg->addLine(i18n("Command:"), command); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); dlg->addLine(i18n("Priority:"), prio); } int ret = dlg->exec(); if (ret == KDEsuDialog::Rejected) exit(0); if (ret == KDEsuDialog::AsUser) change_uid = false; QCString password = dlg->password(); int k = dlg->keep(); delete dlg; // Some events may need to be handled (like a button animation) app->processEvents(); if (!change_uid) return system(command); // Run command if (k && have_daemon) { client.setPass(password, timeout); client.setPriority(priority); client.setScheduler(scheduler); return client.exec(command, user); } else { SuProcess proc; proc.setTerminal(terminal); proc.setErase(true); proc.setUser(user); proc.setPriority(priority); proc.setScheduler(scheduler); proc.setCommand(command); return proc.exec(password); }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/81f73844a4b0ae5e781a97766572fed72da7b6c2/kdesu.cpp/buggy/kdesu/kdesu/kdesu.cpp
if (k && have_daemon)
if (keep && have_daemon)
int main(int argc, char *argv[]){ KAboutData aboutData("kdesu", I18N_NOOP("KDE su"), Version, I18N_NOOP("Runs a program with elevated privileges."), KAboutData::License_Artistic, "Copyright (c) 1998-2000 Geert Jansen, Pietro Iglio"); aboutData.addAuthor("Geert Jansen", I18N_NOOP("Maintainer"), "[email protected]", "http://www.stack.nl/~geertj/"); aboutData.addAuthor("Pietro Iglio", I18N_NOOP("Original author"), "[email protected]"); KCmdLineArgs::init(argc, argv, &aboutData); KCmdLineArgs::addCmdLineOptions(options); KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KApplication *app = new KApplication; // Stop daemon and exit? if (args->isSet("s")) { KDEsuClient client; if (client.ping() == -1) { kdError(1206) << "Daemon not running -- nothing to stop\n"; exit(1); } if (client.stopServer() != -1) { kdDebug(1206) << "Daemon stopped\n"; exit(0); } kdError(1206) << "Could not stop daemon\n"; exit(1); } // Get target uid QCString user = args->getOption("u"); QCString auth_user = user; struct passwd *pw = getpwnam(user); if (pw == 0L) { kdError(1206) << "User " << user << " does not exist\n"; exit(1); } bool change_uid = (getuid() != pw->pw_uid); // If file is writeable, do not change uid QString file = QFile::decodeName(args->getOption("f")); if (change_uid && !file.isEmpty()) { if (file.at(0) != '/') { KStandardDirs dirs; dirs.addKDEDefaults(); file = dirs.findResource("config", file); if (file.isEmpty()) { kdError(1206) << "Config file not found: " << file << "\n"; exit(1); } } QFileInfo fi(file); if (!fi.exists()) { kdError(1206) << "File does not exist: " << file << "\n"; exit(1); } change_uid = !fi.isWritable(); } // Get priority/scheduler QCString tmp = args->getOption("p"); bool ok; int priority = tmp.toInt(&ok); if (!ok || (priority < 0) || (priority > 100)) { KCmdLineArgs::usage(i18n("Illegal priority: %1").arg(tmp)); exit(1); } int scheduler = SuProcess::SchedNormal; if (args->isSet("r")) scheduler = SuProcess::SchedRealtime; if ((priority > 50) || (scheduler != SuProcess::SchedNormal)) { change_uid = true; auth_user = "root"; } // Get command if (args->isSet("c")) { command = args->getOption("c"); for (int i=0; i<args->count(); i++) { command += " "; command += args->arg(i); } } else { if( args->count() == 0 ) { KCmdLineArgs::usage(i18n("No command specified!")); exit(1); } command = args->arg(0); for (int i=1; i<args->count(); i++) { command += " "; command += args->arg(i); }}// CJM - Test lines remove when working// kdWarning(1206) << args->count();// kdWarning(1206) << command; // Don't change uid if we're don't need to. if (!change_uid) return system(command); // Check for daemon and start if necessary bool just_started = false; bool have_daemon = true; KDEsuClient client; if (!client.isServerSGID()) { kdWarning(1206) << "Daemon not safe (not sgid), not using it.\n"; have_daemon = false; } else if (client.ping() == -1) { if (client.startServer() == -1) { kdWarning(1206) << "Could not start daemon, reduced functionality.\n"; have_daemon = false; } just_started = true; } // Try to exec the command with kdesud. bool keep = !args->isSet("n") && have_daemon; bool terminal = args->isSet("t"); if (keep && !terminal && !just_started) { client.setPriority(priority); client.setScheduler(scheduler); if (client.exec(command, user) != -1) return 0; } // Set core dump size to 0 because we will have // root's password in memory. struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; if (setrlimit(RLIMIT_CORE, &rlim)) { kdError(1206) << "rlimit(): " << ERR << "\n"; exit(1); } // Read configuration KConfig *config = KGlobal::config(); config->setGroup("Passwords"); int timeout = config->readNumEntry("Timeout", defTimeout); // Start the dialog KDEsuDialog *dlg = new KDEsuDialog(user, auth_user, keep && !terminal); dlg->addLine(i18n("Command:"), command); if ((priority != 50) || (scheduler != SuProcess::SchedNormal)) { QString prio; if (scheduler == SuProcess::SchedRealtime) prio += i18n("realtime: "); prio += QString("%1/100").arg(priority); dlg->addLine(i18n("Priority:"), prio); } int ret = dlg->exec(); if (ret == KDEsuDialog::Rejected) exit(0); if (ret == KDEsuDialog::AsUser) change_uid = false; QCString password = dlg->password(); int k = dlg->keep(); delete dlg; // Some events may need to be handled (like a button animation) app->processEvents(); if (!change_uid) return system(command); // Run command if (k && have_daemon) { client.setPass(password, timeout); client.setPriority(priority); client.setScheduler(scheduler); return client.exec(command, user); } else { SuProcess proc; proc.setTerminal(terminal); proc.setErase(true); proc.setUser(user); proc.setPriority(priority); proc.setScheduler(scheduler); proc.setCommand(command); return proc.exec(password); }}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/81f73844a4b0ae5e781a97766572fed72da7b6c2/kdesu.cpp/buggy/kdesu/kdesu/kdesu.cpp
QString errorDescriptionText() const { return m_errorDescriptionText; };
virtual QString errorDescriptionText() const { return m_errorDescriptionText; };
QString errorDescriptionText() const { return m_errorDescriptionText; };
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/612dc0026206300c21fba1aa7c7f0071ba588598/krashconf.h/buggy/drkonqi/krashconf.h
QString signalText() const { return m_signalText; };
virtual QString signalText() const { return m_signalText; };
QString signalText() const { return m_signalText; };
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/612dc0026206300c21fba1aa7c7f0071ba588598/krashconf.h/buggy/drkonqi/krashconf.h
bool startedByKdeinit() const { return m_startedByKdeinit; };
virtual bool startedByKdeinit() const { return m_startedByKdeinit; };
bool startedByKdeinit() const { return m_startedByKdeinit; };
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/612dc0026206300c21fba1aa7c7f0071ba588598/krashconf.h/clean/drkonqi/krashconf.h
curr_scope_node.nodeName() );
(const char*)curr_scope_node.nodeName().utf8() );
_getProperties( QDomDocument const & doc, QMap< QString, PropertyKey > & project_properties ){ QDomNodeList properties = doc.elementsByTagName("properties"); if ( properties.count() > 1 ) { qDebug( "there appears to be more than one ``properties'' XML tag ... bailing" ); return; } else if ( properties.count() < 1 ) // no properties found, so we're done { return; } size_t i = 0; QDomNodeList scopes = properties.item(0).childNodes(); // item(0) because there should only be ONE // "properties" node if ( scopes.count() < 1 ) { qDebug( "empty ``properties'' XML tag ... bailing" ); return; } while ( i < scopes.count() ) { QDomNode curr_scope_node = scopes.item( i ); qDebug( "found %d property node(s) for scope %s", curr_scope_node.childNodes().count(), curr_scope_node.nodeName() ); // DEPRECATED _getScopeProperties( curr_scope_node, project_properties ); if ( ! project_properties[curr_scope_node.nodeName()].readXML( curr_scope_node ) ) { qDebug ("%s:%d unable to read XML for property %s", __FILE__, __LINE__, curr_scope_node.nodeName() ); } ++i; }} // _getProperties
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/67f279f0227b40aec9d7c21507f474002767db3c/qgsproject.cpp/buggy/src/qgsproject.cpp
__FILE__, __LINE__, curr_scope_node.nodeName() );
__FILE__, __LINE__, (const char*)curr_scope_node.nodeName().utf8() );
_getProperties( QDomDocument const & doc, QMap< QString, PropertyKey > & project_properties ){ QDomNodeList properties = doc.elementsByTagName("properties"); if ( properties.count() > 1 ) { qDebug( "there appears to be more than one ``properties'' XML tag ... bailing" ); return; } else if ( properties.count() < 1 ) // no properties found, so we're done { return; } size_t i = 0; QDomNodeList scopes = properties.item(0).childNodes(); // item(0) because there should only be ONE // "properties" node if ( scopes.count() < 1 ) { qDebug( "empty ``properties'' XML tag ... bailing" ); return; } while ( i < scopes.count() ) { QDomNode curr_scope_node = scopes.item( i ); qDebug( "found %d property node(s) for scope %s", curr_scope_node.childNodes().count(), curr_scope_node.nodeName() ); // DEPRECATED _getScopeProperties( curr_scope_node, project_properties ); if ( ! project_properties[curr_scope_node.nodeName()].readXML( curr_scope_node ) ) { qDebug ("%s:%d unable to read XML for property %s", __FILE__, __LINE__, curr_scope_node.nodeName() ); } ++i; }} // _getProperties
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/67f279f0227b40aec9d7c21507f474002767db3c/qgsproject.cpp/buggy/src/qgsproject.cpp
assert(nl.count() != 0);
if ( 0 == nl.count() ) { return false; }
_getMapLayers( QDomDocument const & doc ){ // Layer order is implicit in the order they are stored in the project file QDomNodeList nl = doc.elementsByTagName("maplayer"); // XXX what is this used for? QString layerCount( QString::number(nl.count()) ); QString wk; // process the map layer nodes assert(nl.count() != 0); for (size_t i = 0; i < nl.count(); i++) { QDomNode node = nl.item(i); QDomElement element = node.toElement(); QString type = element.attribute("type"); QgsMapLayer * mapLayer;#ifdef QGISDEBUG std::cerr << "type is " << type << std::endl; #endif if (type == "vector") { mapLayer = new QgsVectorLayer; } else if (type == "raster") { mapLayer = new QgsRasterLayer; } Q_CHECK_PTR( mapLayer ); if ( ! mapLayer ) {#ifdef QGISDEBUG std::cerr << __FILE__ << " : " << __LINE__ << " unable to create layer\n";#endif return false; } // have the layer restore state that is stored in DOM node mapLayer->readXML( node ); mapLayer = QgsMapLayerRegistry::instance()->addMapLayer( mapLayer ); // XXX kludge for ensuring that overview canvas updates happen correctly; // XXX eventually this should be replaced by mechanism whereby overview // XXX canvas implicitly knows about all new layers// if ( mapLayer ) // if successfully added to registry// {// // find canonical Qgis application object// QgisApp * qgisApp = _findQgisApp();// // make connection// if ( qgisApp )// { // QObject::connect(mapLayer, // SIGNAL(showInOverview(QString,bool)), // qgisApp, // SLOT(setLayerOverviewStatus(QString,bool)));// }// } } return true;} // _getMapLayers
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/67f279f0227b40aec9d7c21507f474002767db3c/qgsproject.cpp/buggy/src/qgsproject.cpp
cerr << "fakesyn starting" << endl;
off_t a = 2 << 30; cerr << "fakesyn starting: " << a << " " << a * 60ULL << endl;
int main(int argc, char **argv) { cerr << "fakesyn starting" << endl; vector<char*> args; argv_to_vec(argc, argv, args); parse_config_options(args); int start = 0; parse_syn_options(args); vector<char*> nargs; int mkfs = 0; for (unsigned i=0; i<args.size(); i++) { if (strcmp(args[i], "--fastmkfs") == 0) { mkfs = MDS_MKFS_FAST; } else if (strcmp(args[i], "--fullmkfs") == 0) { mkfs = MDS_MKFS_FULL; } else { // unknown arg, pass it on. cerr << " stray arg " << args[i] << endl; nargs.push_back(args[i]); } } assert(nargs.empty()); MDCluster *mdc = new MDCluster(NUMMDS, NUMOSD); char hostname[100]; gethostname(hostname,100); //int pid = getpid(); // create mds MDS *mds[NUMMDS]; for (int i=0; i<NUMMDS; i++) { //cerr << "mds" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; mds[i] = new MDS(mdc, i, new FakeMessenger(MSG_ADDR_MDS(i))); start++; } // create osd OSD *osd[NUMOSD]; for (int i=0; i<NUMOSD; i++) { //cerr << "osd" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; osd[i] = new OSD(i, new FakeMessenger(MSG_ADDR_OSD(i))); start++; } // create client Client *client[NUMCLIENT]; SyntheticClient *syn[NUMCLIENT]; for (int i=0; i<NUMCLIENT; i++) { //cerr << "client" << i << " on rank " << myrank << " " << hostname << "." << pid << endl; client[i] = new Client(new FakeMessenger(MSG_ADDR_CLIENT(i))); start++; } // start message loop fakemessenger_startthread(); // init for (int i=0; i<NUMMDS; i++) { mds[i]->init(); } for (int i=0; i<NUMOSD; i++) { osd[i]->init(); } // create client for (int i=0; i<NUMCLIENT; i++) { client[i]->init(); // use my argc, argv (make sure you pass a mount point!) //cout << "mounting" << endl; client[i]->mount(mkfs); //cout << "starting synthetic client " << endl; syn[i] = new SyntheticClient(client[i]); syn[i]->start_thread(); } for (int i=0; i<NUMCLIENT; i++) { cout << "waiting for synthetic client " << i << " to finish" << endl; syn[i]->join_thread(); delete syn[i]; client[i]->unmount(); //cout << "unmounted" << endl; client[i]->shutdown(); } // wait for it to finish fakemessenger_wait(); // cleanup for (int i=0; i<NUMMDS; i++) { delete mds[i]; } for (int i=0; i<NUMOSD; i++) { delete osd[i]; } for (int i=0; i<NUMCLIENT; i++) { delete client[i]; } delete mdc; cout << "fakesyn done" << endl; return 0;}
2690 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2690/98d20ecf3abc9fcecac9169f9ccc60f8d1d235dd/fakesyn.cc/clean/ceph/fakesyn.cc
if (arg4) setRectFields(env, arg4, lparg4); if (arg5) setRectFields(env, arg5, lparg5);
JNIEXPORT void JNICALL OS_NATIVE(CopyDeepMask) (JNIEnv *env, jclass that, jint arg0, jint arg1, jint arg2, jobject arg3, jobject arg4, jobject arg5, jshort arg6, jint arg7){ Rect _arg3, *lparg3=NULL; Rect _arg4, *lparg4=NULL; Rect _arg5, *lparg5=NULL; NATIVE_ENTER(env, that, "CopyDeepMask\n") if (arg3) lparg3 = getRectFields(env, arg3, &_arg3); if (arg4) lparg4 = getRectFields(env, arg4, &_arg4); if (arg5) lparg5 = getRectFields(env, arg5, &_arg5); CopyDeepMask((const BitMap *)arg0, (const BitMap *)arg1, (const BitMap *)arg2, (const Rect *)lparg3, (const Rect *)lparg4, (const Rect *)lparg5, (short)arg6, (RgnHandle)arg7); if (arg3) setRectFields(env, arg3, lparg3); if (arg4) setRectFields(env, arg4, lparg4); if (arg5) setRectFields(env, arg5, lparg5); NATIVE_EXIT(env, that, "CopyDeepMask\n")}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg2) (*env)->ReleaseShortArrayElements(env, arg2, lparg2, 0);
JNIEXPORT jint JNICALL OS_NATIVE(GetMenuFont) (JNIEnv *env, jclass that, jint arg0, jshortArray arg1, jshortArray arg2){ jshort *lparg1=NULL; jshort *lparg2=NULL; jint rc; NATIVE_ENTER(env, that, "GetMenuFont\n") if (arg1) lparg1 = (*env)->GetShortArrayElements(env, arg1, NULL); if (arg2) lparg2 = (*env)->GetShortArrayElements(env, arg2, NULL); rc = (jint)GetMenuFont((MenuRef)arg0, (SInt16 *)lparg1, (UInt16 *)lparg2); if (arg1) (*env)->ReleaseShortArrayElements(env, arg1, lparg1, 0); if (arg2) (*env)->ReleaseShortArrayElements(env, arg2, lparg2, 0); NATIVE_EXIT(env, that, "GetMenuFont\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0);
JNIEXPORT jint JNICALL OS_NATIVE(NewControl) (JNIEnv *env, jclass that, jint arg0, jobject arg1, jbyteArray arg2, jboolean arg3, jshort arg4, jshort arg5, jshort arg6, jshort arg7, jint arg8){ Rect _arg1, *lparg1=NULL; jbyte *lparg2=NULL; jint rc; NATIVE_ENTER(env, that, "NewControl\n") if (arg1) lparg1 = getRectFields(env, arg1, &_arg1); if (arg2) lparg2 = (*env)->GetByteArrayElements(env, arg2, NULL); rc = (jint)NewControl((WindowRef)arg0, (const Rect *)lparg1, (ConstStr255Param)lparg2, (Boolean)arg3, (SInt16)arg4, (SInt16)arg5, (SInt16)arg6, (SInt16)arg7, (SInt32)arg8); if (arg1) setRectFields(env, arg1, lparg1); if (arg2) (*env)->ReleaseByteArrayElements(env, arg2, lparg2, 0); NATIVE_EXIT(env, that, "NewControl\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
JNIEXPORT jint JNICALL OS_NATIVE(TXNSetTXNObjectControls) (JNIEnv *env, jclass that, jint arg0, jboolean arg1, jint arg2, jintArray arg3, jintArray arg4){ jint *lparg3=NULL; jint *lparg4=NULL; jint rc; NATIVE_ENTER(env, that, "TXNSetTXNObjectControls\n") if (arg3) lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL); if (arg4) lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL); rc = (jint)TXNSetTXNObjectControls((TXNObject)arg0, (Boolean)arg1, (ItemCount)arg2, (const TXNControlTag *)lparg3, (const TXNControlData *)lparg4); if (arg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0); if (arg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0); NATIVE_EXIT(env, that, "TXNSetTXNObjectControls\n") return rc;}
11867 /local/tlutelli/issta_data/temp/c/2005_temp/2005/11867/94da855f41fcf4c3984df28bc19cafb1b6fdb530/os.c/buggy/bundles/org.eclipse.swt/Eclipse SWT PI/carbon/library/os.c
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
QStringList kdeAdded =
QStringList kdeAdded =
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
QString libPathKey =
QString libPathKey =
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
path.truncate(path.length()-1); pathDb[path]=false;
path.truncate(path.length()-1); pathDb[path]=false;
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
path.truncate(path.length()-1);
path.truncate(path.length()-1);
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
path.truncate(path.length()-1); pathDb[path]=true;
path.truncate(path.length()-1); pathDb[path]=true;
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
static void applyQtSettings( KSimpleConfig& kglobals, QSettings& settings ){ /* export kde's plugin library path to qtrc */ QMap <QString, bool> pathDb; // OK, this isn't fun at all. // KApp adds paths ending with /, QApp those without slash, and if // one gives it something that is other way around, it will complain and scare // users. So we need to know whether a path being added is from KApp, and in this case // end it with.. So keep a QMap to bool, specifying whether the path is KDE-specified.. QStringList kdeAdded = settings.readListEntry("/qt/KDE/kdeAddedLibraryPaths"); QString libPathKey = QString("/qt/%1.%2/libraryPath").arg( QT_VERSION >> 16 ).arg( (QT_VERSION & 0xff00 ) >> 8 ); //Read qt library path.. QStringList plugins = settings.readListEntry(libPathKey, ':'); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=false; } //Get rid of old KDE-added ones... for (QStringList::ConstIterator it = kdeAdded.begin(); it != kdeAdded.end(); ++it) { //Normalize.. QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); //Remove.. pathDb.remove(path); } kdeAdded.clear(); //Merge in KDE ones.. plugins = KGlobal::dirs()->resourceDirs( "qtplugins" ); for (QStringList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { QString path = *it; if (path.endsWith("/")) path.truncate(path.length()-1); pathDb[path]=true; } QStringList paths; for (QMap <QString, bool>::ConstIterator it = pathDb.begin(); it != pathDb.end(); it++) { QString path = it.key(); bool fromKDE = it.data(); char new_path[PATH_MAX+1]; if (realpath(QFile::encodeName(path), new_path)) path = QFile::decodeName(new_path); if (fromKDE) { if (!path.endsWith("/")) path += "/"; kdeAdded.push_back(path); //Add for the new list -- do it here to have it in the right form.. } paths.append(path); } //Write the list out.. settings.writeEntry("/qt/KDE/kdeAddedLibraryPaths", kdeAdded); settings.writeEntry(libPathKey, paths, ':'); /* export widget style */ kglobals.setGroup("General"); QString style = kglobals.readEntry("widgetStyle", KStyle::defaultStyle() ); if (!style.isEmpty()) settings.writeEntry("/qt/style", style); /* export font settings */ settings.writeEntry("/qt/font", KGlobalSettings::generalFont().toString()); /* ##### looks like kcmfonts skips this, so we don't do this here *//*bool usexft = kglobals.readBoolEntry("AntiAliasing", false); kconfig.setGroup("General"); settings.writeEntry("/qt/enableXft", usexft); settings.writeEntry("/qt/useXft", usexft); */ /* export effects settings */ kglobals.setGroup("KDE"); bool effectsEnabled = kglobals.readBoolEntry("EffectsEnabled", false); bool fadeMenus = kglobals.readBoolEntry("EffectFadeMenu", false); bool fadeTooltips = kglobals.readBoolEntry("EffectFadeTooltip", false); bool animateCombobox = kglobals.readBoolEntry("EffectAnimateCombo", false); QStringList guieffects; if (effectsEnabled) { guieffects << QString("general"); if (fadeMenus) guieffects << QString("fademenu"); if (animateCombobox) guieffects << QString("animatecombo"); if (fadeTooltips) guieffects << QString("fadetooltip"); } else guieffects << QString("none"); settings.writeEntry("/qt/GUIEffects", guieffects);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/9b0409a82e280f7de907254c857761292f8cfcff/krdb.cpp/buggy/kcontrol/krdb/krdb.cpp
KGlobal::locale()->setLanguage(args->getOption("lang"));
KGlobal::locale()->setLanguage(args->getOption("lang"));
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) {
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8);
cout << i18n("The following modules are available:").local8Bit() << endl;
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); }
ConfigModuleList modules; modules.readDesktopEntries(); ConfigModule *module = 0; int maxLen=0; for (module=modules.first(); module != 0; module=modules.next()) { int len = stripPath(module->fileName()).length(); if (len > maxLen) maxLen = len;
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
QByteArray vl; vl.fill(' ', 80); QString verylong = vl;
for (module=modules.first(); module != 0; module=modules.next()) {
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(),
QString entry("%1 - %2");
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
(*descriptions.at(i)).local8Bit().data());
entry = entry.arg(stripPath(module->fileName()).leftJustify(maxLen, ' ')); entry = entry.arg(!module->comment().isEmpty() ? module->comment() : i18n("No description available")); cout << entry.local8Bit() << endl;
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
extern "C" int kdemain(int _argc, char *_argv[]){ KAboutData aboutData( "kcmshell", I18N_NOOP("KDE Control Module"), KCONTROL_VERSION, I18N_NOOP("A tool to start single KDE control modules"), KAboutData::License_GPL, "(c) 1999-2002, The KDE Developers"); aboutData.addAuthor("Daniel Molkentin", I18N_NOOP("Current Maintainer"), "[email protected]"); aboutData.addAuthor("Matthias Hoelzer-Kluepfel",0, "[email protected]"); aboutData.addAuthor("Matthias Elter",0, "[email protected]"); aboutData.addAuthor("Matthias Ettrich",0, "[email protected]"); aboutData.addAuthor("Waldo Bastian",0, "[email protected]"); KCmdLineArgs::init(_argc, _argv, &aboutData); KCmdLineArgs::addCmdLineOptions( options ); // Add our own options. KLocale::setMainCatalogue("kcontrol"); kcmApplication app; KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); KGlobal::iconLoader()->addAppDir( "kcontrol" ); KGlobal::locale()->setLanguage(args->getOption("lang")); if (args->isSet("list")) { QStringList files; KGlobal::dirs()->findAllResources("apps", KCGlobal::baseGroup() + "*.desktop", true, true, files); QStringList modules; QStringList descriptions; uint maxwidth = 0; for (QStringList::ConstIterator it = files.begin(); it != files.end(); it++) { if (KDesktopFile::isDesktopFile(*it)) { KDesktopFile file(*it, true); if (file.readEntry("Hidden") == "true") continue; QString module = *it; if (module.startsWith(KCGlobal::baseGroup())) module = module.mid(KCGlobal::baseGroup().length()); if (module.right(8) == ".desktop") module.truncate(module.length() - 8); modules.append(module); if (module.length() > maxwidth) maxwidth = module.length(); descriptions.append(QString("%2 (%3)").arg(file.readName()).arg(file.readComment())); } } QByteArray vl; vl.fill(' ', 80); QString verylong = vl; for (uint i = 0; i < modules.count(); i++) { fprintf(stdout, "%s%s - %s\n", (*modules.at(i)).local8Bit().data(), verylong.left(maxwidth - (*modules.at(i)).length()).local8Bit().data(), (*descriptions.at(i)).local8Bit().data()); } return 0; } if (args->count() < 1) { args->usage(); return -1; } if (args->count() == 1) { app.setDCOPName(args->arg(0)); if (app.isRunning()) { app.waitForExit(); return 0; } KService::Ptr service = locateModule(args->arg(0)); if (!service) return 1; // error // load the module KCModuleInfo info(service); KCModule *module = KCModuleLoader::loadModule(info, false); if (module) { // create the dialog QCString embedStr = args->getOption("embed"); bool embed = false; int id = -1; if (!embedStr.isEmpty()) id = embedStr.toInt(&embed); if (!args->isSet("silent")) { if (!embed) { KCDialog * dlg = new KCDialog(module, module->buttons(), info.docPath(), 0, 0, true ); QString caption = (kapp->caption() != i18n("KDE Control Module")) ? kapp->caption() : info.moduleName(); dlg->setPlainCaption(i18n("Configure - %1").arg(caption)); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // run the dialog dlg->exec(); delete dlg; } // if we are going to be embedded, embed else { QWidget *dlg = new ProxyWidget(module, info.moduleName(), "kcmshell", false); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); QXEmbed::embedClientIntoWindow(dlg, id); kapp->exec(); delete dlg; } } else { //Silent kapp->exec(); } KCModuleLoader::unloadModule(info); return 0; } KCModuleLoader::showLastLoaderError(0L); return 0; } // multiple control modules KService::List modules; for (int i = 0; i < args->count(); i++) { KService::Ptr service = locateModule(args->arg(i)); if(service) modules.append(service); } if (modules.count() < 1) return -1; // create the dialog KCMultiDialog * dlg = new KCMultiDialog(KCGlobal::baseGroup(), 0, 0, true); // Needed for modules that use d'n'd (not really the right // solution for this though, I guess) dlg->setAcceptDrops(true); // add modules for (KService::List::ConstIterator it = modules.begin(); it != modules.end(); ++it) dlg->addModule(KCModuleInfo(*it)); // if we are going to be embedded, embed QCString embed = args->getOption("embed"); if (!embed.isEmpty()) { bool ok; int id = embed.toInt(&ok); if (ok) { // NOTE: This has to be changed for QT 3.0. See above! QXEmbed::embedClientIntoWindow(dlg, id); delete dlg; return 0; } } dlg->setPlainCaption(i18n("Configure - %1").arg(kapp->caption())); // run the dialog dlg->exec(); delete dlg; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/48fadaf6ecca7c38e9605e3739457009721d14da/kcmshell.cpp/clean/kcontrol/kcontrol/kcmshell.cpp
KCModule *create_filetypes(QWidget *parent, const char *)
KDE_EXPORT KCModule *create_filetypes(QWidget *parent, const char *)
KCModule *create_filetypes(QWidget *parent, const char *) { return new FileTypesView(parent, "filetypes"); }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/49b474739f2eb8c7a461ac121b9b8503306ad3e6/control.cpp/buggy/keditfiletype/control.cpp
QString url="devices:/"+(*it);
QString url="devices:/"+KURL::encode_string_no_slash(*it);
void DevicesProtocol::listRoot(){ KIO::UDSEntry entry; uint count; QStringList list=deviceList(); count=0; for ( QStringList::Iterator it = list.begin(); it != list.end(); ++it ) { if ((*it)=="!!!ERROR!!!") { error(KIO::ERR_SLAVE_DEFINED,i18n("The KDE mountwatcher is not running. Please activate it in Control Center->KDE Components->Service Manager, if you want to use the devices:/ protocol")); return; }// FIXME: look for the real ending ++it; QString url="devices:/"+(*it); //++it; QString name=*it; ++it; ++it; ++it; QString type=*it; ++it; ++it; createFileEntry(entry,name,url,type); listEntry(entry,false); count++; } totalSize(count); listEntry(entry, true); // Jobs entry // finish finished();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/36dae6866f774b935c3e7f3d4a3bce894d3c69c8/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
kdDebug()<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" );
kdDebug()<<"kdemain for settings kioslave"<<endl; KInstance instance( "kio_settings" );
int kdemain( int, char **argv ) { kdDebug()<<"kdemain for devices"<<endl; KInstance instance( "kio_devices" ); SettingsProtocol slave(argv[1], argv[2], argv[3]); slave.dispatchLoop(); return 0; }
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/97f6a67eb5e90bb5c8b85c65895beb600dc0f936/kio_settings.cc/clean/kioslave/settings/kio_settings.cc
addAtom(entry, KIO::UDS_CREATION_TIME,0);
addAtom(entry, KIO::UDS_CREATION_TIME,1);
static void createFileEntry(KIO::UDSEntry& entry, const QString& name, const QString& url, const QString& mime){ entry.clear(); addAtom(entry, KIO::UDS_NAME, 0, name); addAtom(entry, KIO::UDS_FILE_TYPE, S_IFDIR);//REG); addAtom(entry, KIO::UDS_URL, 0, url); addAtom(entry, KIO::UDS_ACCESS, 0500); addAtom(entry, KIO::UDS_MIME_TYPE, 0, mime); addAtom(entry, KIO::UDS_SIZE, 0); addAtom(entry, KIO::UDS_GUESSED_MIME_TYPE, 0, "inode/directory"); addAtom(entry, KIO::UDS_CREATION_TIME,0); addAtom(entry, KIO::UDS_MODIFICATION_TIME,time(0));}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/936f9482a9c9deb5714f2f1523a1f290699588c0/kio_devices.cc/clean/kioslave/devices/kio_devices.cc
But only, if the other thread is searching already */
But only, if the other thread is not searching already */
find_domain (const char *domain, ypbind_resp *result){ int i, second; pthread_rdwr_rlock_np (&domainlock); second = 0; /* Try only once to find a new server for a unbounded domain */ i = 0; while (i < max_domains) { if (strcmp (domainlist[i].domain, domain) == 0) { if (domainlist[i].active >= 0) { result->ypbind_status = YPBIND_SUCC_VAL; memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, &domainlist[i].server[domainlist[i].active].addr, sizeof (struct in_addr)); memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, &domainlist[i].server[domainlist[i].active].port, sizeof (unsigned short int)); if (debug_flag) log_msg (LOG_DEBUG, "YPBINDPROC_DOMAIN: server '%s', port %d", inet_ntoa(domainlist[i].server[domainlist[i].active].addr), ntohs(domainlist[i].server[domainlist[i].active].port)); break; } else if (domainlist[i].active == -2) { result->ypbind_status = YPBIND_SUCC_VAL; memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, &domainlist[i].ypset.addr, sizeof (struct in_addr)); memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, &domainlist[i].ypset.port, sizeof (unsigned short int)); if (debug_flag) log_msg (LOG_DEBUG, "YPBINDPROC_DOMAIN: server '%s', port %d", inet_ntoa(domainlist[i].ypset.addr), ntohs(domainlist[i].ypset.port)); break; } else { if (second) { second = 0; break; } /* Look, if we could find a new server for this domain. But only, if the other thread is searching already */ pthread_rdwr_runlock_np (&domainlock); if (pthread_mutex_trylock (&search_lock) == 0) { if (debug_flag) log_msg (LOG_DEBUG, "trylock = success"); if (domainlist[i].use_broadcast) do_broadcast (&domainlist[i]); else ping_all (&domainlist[i]); pthread_mutex_unlock (&search_lock); ++second; continue; } else return; pthread_rdwr_rlock_np (&domainlock); } } ++i; } pthread_rdwr_runlock_np (&domainlock); return;}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/41b5b0392e9b51b927c03aaa19d54636a93ed057/serv_list.c/clean/src/serv_list.c
/* Get the read lock again for next run. */ pthread_rdwr_rlock_np (&domainlock);
find_domain (const char *domain, ypbind_resp *result){ int i, second; pthread_rdwr_rlock_np (&domainlock); second = 0; /* Try only once to find a new server for a unbounded domain */ i = 0; while (i < max_domains) { if (strcmp (domainlist[i].domain, domain) == 0) { if (domainlist[i].active >= 0) { result->ypbind_status = YPBIND_SUCC_VAL; memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, &domainlist[i].server[domainlist[i].active].addr, sizeof (struct in_addr)); memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, &domainlist[i].server[domainlist[i].active].port, sizeof (unsigned short int)); if (debug_flag) log_msg (LOG_DEBUG, "YPBINDPROC_DOMAIN: server '%s', port %d", inet_ntoa(domainlist[i].server[domainlist[i].active].addr), ntohs(domainlist[i].server[domainlist[i].active].port)); break; } else if (domainlist[i].active == -2) { result->ypbind_status = YPBIND_SUCC_VAL; memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr, &domainlist[i].ypset.addr, sizeof (struct in_addr)); memcpy (&result->ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port, &domainlist[i].ypset.port, sizeof (unsigned short int)); if (debug_flag) log_msg (LOG_DEBUG, "YPBINDPROC_DOMAIN: server '%s', port %d", inet_ntoa(domainlist[i].ypset.addr), ntohs(domainlist[i].ypset.port)); break; } else { if (second) { second = 0; break; } /* Look, if we could find a new server for this domain. But only, if the other thread is searching already */ pthread_rdwr_runlock_np (&domainlock); if (pthread_mutex_trylock (&search_lock) == 0) { if (debug_flag) log_msg (LOG_DEBUG, "trylock = success"); if (domainlist[i].use_broadcast) do_broadcast (&domainlist[i]); else ping_all (&domainlist[i]); pthread_mutex_unlock (&search_lock); ++second; continue; } else return; pthread_rdwr_rlock_np (&domainlock); } } ++i; } pthread_rdwr_runlock_np (&domainlock); return;}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/41b5b0392e9b51b927c03aaa19d54636a93ed057/serv_list.c/clean/src/serv_list.c
int main(int argc, char *argv[]){ KApplication::disableAutoDcopRegistration(); //KApplication app(argc,argv,"testtrash"); KCmdLineArgs::init(argc,argv,"testtrash", 0, 0, 0, 0); KApplication app; TestTrash test; test.runAll();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/206ffe12d60f1ffe8e148f66f22364320ada6f93/testtrash.cpp/clean/kioslave/trash/testtrash.cpp
kdDebug() << "All tests OK." << endl; return 0;
int main(int argc, char *argv[]){ KApplication::disableAutoDcopRegistration(); //KApplication app(argc,argv,"testtrash"); KCmdLineArgs::init(argc,argv,"testtrash", 0, 0, 0, 0); KApplication app; TestTrash test; test.runAll();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/206ffe12d60f1ffe8e148f66f22364320ada6f93/testtrash.cpp/clean/kioslave/trash/testtrash.cpp
assert((!(former_age > 30)) || (age > 0));
time_t get_age() { time_t age; if (_dbufs.empty()) { age = 0; } else { age = time(NULL) - _dbufs.begin()->second->dirty_since; } dout(10) << "former age: " << former_age << " age: " << age << endl; assert((!(former_age > 30)) || (age > 0)); former_age = age; return age; }
2690 /local/tlutelli/issta_data/temp/c/2005_temp/2005/2690/c64cf759da6324c62222ce6aff1e12bf18ce13b6/Buffercache.h/buggy/ceph/client/Buffercache.h
close_bindingfile(list->domain);
remove_bindingfile(list->domain);
do_broadcast (struct binding *list){ char *domain = list->domain; bool_t out; enum clnt_stat status; pthread_rdwr_wlock_np (&domainlock); list->active = -1; pthread_rdwr_wunlock_np (&domainlock); in_use = list; /* global variable for eachresult */ status = clnt_broadcast (YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, (xdrproc_t) ypbind_xdr_domainname, (void *)&domain, (xdrproc_t) xdr_bool, (void *)&out, (resultproc_t) eachresult); if (status != RPC_SUCCESS) { close_bindingfile(list->domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno(status)); } else { pthread_rdwr_rlock_np (&domainlock); update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock); }}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/41b5b0392e9b51b927c03aaa19d54636a93ed057/serv_list.c/buggy/src/serv_list.c
int main(int argc, char **argv)
int main(int , char **)
int main(int argc, char **argv){ signal(SIGCHLD, sigchld_handler); signal(SIGSEGV, sigsegv_handler); Connection parent( 0, 1 ); TARProtocol tar( &parent ); tar.dispatchLoop();}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd884f5ccde26ca363e9ebd3da6b8cbb9217cd51/tar.cc/buggy/kioslave/tar/tar.cc
if (dragon[m][n].status == DEAD)
if (dragon[m][n].matcher_status == DEAD)
atari_atari(int color, int *i, int *j, int save_verbose){ int m, n; int fi, fj; int aa_val; int other = OTHER_COLOR(color); /* Collect worm statuses of opponent's worms. We need to * know this because we only want to report unexpected * results. For example, we do not want to report success * if we find we can kill a worm which is already dead. * The worm status of empty points is set to UNKNOWN to signal * that stones added along the way need special attention. */ if (aa_depth < 2) return 0; memset(forbidden, 0, sizeof(forbidden)); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == other) { if (dragon[m][n].status == DEAD) aa_status[m][n] = DEAD; else if (worm[m][n].attack_code != 0) { if (worm[m][n].defend_code != 0) aa_status[m][n] = CRITICAL; else aa_status[m][n] = DEAD; } else aa_status[m][n] = ALIVE; } else aa_status[m][n] = UNKNOWN; } /* reclassify a worm with 2 liberties as INSUBSTANTIAL if capturing * it does not result in a live group. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (p[m][n] == other && worm[m][n].origini == m && worm[m][n].originj == n && worm[m][n].liberties == 2 && aa_status[m][n] != DEAD && !owl_substantial(m, n)) { int ti, tj; for (ti = 0; ti < board_size; ti++) for (tj = 0; tj < board_size; tj++) if (is_worm_origin(ti, tj, m, n)) aa_status[ti][tj] = INSUBSTANTIAL; } if (debug & DEBUG_ATARI_ATARI) { gprintf("atari_atari for %C\n", color); gprintf("aa_status: (ALIVE worms not listed)\n"); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == other && is_worm_origin(m, n, m, n)) { const char *status = "UNKNOWN (shouldn't happen)"; if (aa_status[m][n] == DEAD) status = "DEAD"; else if (aa_status[m][n] == CRITICAL) status = "CRITICAL"; else if (aa_status[m][n] == INSUBSTANTIAL) status = "INSUBSTANTIAL"; if (aa_status[m][n] != ALIVE) gprintf("%M: %s\n", m, n, status); } } } aa_val = do_atari_atari(color, &fi, &fj, NULL, NULL, -1, -1, save_verbose, 0); if (aa_val == 0) return 0; /* We try excluding the first atari found and see if the * combination still works. Repeat until failure. */ while (1) { int new_aa_val; forbidden[fi][fj] = 1; new_aa_val = do_atari_atari(color, &fi, &fj, NULL, NULL, -1, -1, save_verbose, aa_val); /* The last do_atari_atari call fails. When do_atari_atari fails, * it does not change the value of (fi, fj), so these correspond * to a move that works and is necessary. */ if (new_aa_val == 0) { if (i) *i = fi; if (j) *j = fj; return aa_val; } aa_val = new_aa_val; } /* We'll never get here, but the compiler may be more happy if it * looks like we're returning something. */ return 0;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/2a5a6dbb2a697083e7683965c1293f04fe090706/reading.c/clean/engine/reading.c
* into (*i, *j).
* into (defendi, defendj).
atari_atari_confirm_safety(int color, int ti, int tj, int *i, int *j, int minsize){ int m, n; int fi, fj; int defendi, defendj; int aa_val; int other = OTHER_COLOR(color); /* If aa_depth is too small, we can't see any combination attacks, * so in this respect the move is safe enough. */ if (aa_depth < 2) return 1; /* Collect worm statuses of opponent's worms. We need to * know this because we only want to report unexpected * results. For example, we do not want to report success * if we find we can kill a worm which is already dead. * The worm status of empty points is set to UNKNOWN to signal * that stones added along the way need special attention. */ memset(forbidden, 0, sizeof(forbidden)); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color) { if (dragon[m][n].matcher_status == DEAD) aa_status[m][n] = DEAD; else if (worm[m][n].attack_code != 0) { if (worm[m][n].defend_code != 0) aa_status[m][n] = CRITICAL; else aa_status[m][n] = DEAD; } else aa_status[m][n] = ALIVE; } else aa_status[m][n] = UNKNOWN; } /* reclassify a worm with 2 liberties as INSUBSTANTIAL if capturing * it does not result in a live group. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (p[m][n] == color && worm[m][n].origini == m && worm[m][n].originj == n && worm[m][n].liberties == 2 && aa_status[m][n] == ALIVE && !owl_substantial(m, n)) { int ui, uj; for (ui = 0; ui < board_size; ui++) for (uj = 0; uj < board_size; uj++) if (is_worm_origin(ui, uj, m, n)) aa_status[ui][uj] = INSUBSTANTIAL; } if (debug & DEBUG_ATARI_ATARI) { gprintf("atari_atari for %C\n", other); gprintf("aa_status: (ALIVE worms not listed)\n"); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color && is_worm_origin(m, n, m, n)) { const char *status = "UNKNOWN (shouldn't happen)"; if (aa_status[m][n] == DEAD) status = "DEAD"; else if (aa_status[m][n] == CRITICAL) status = "CRITICAL"; else if (aa_status[m][n] == INSUBSTANTIAL) status = "INSUBSTANTIAL"; if (aa_status[m][n] != ALIVE) gprintf("%M: %s\n", m, n, status); } } } /* Accept illegal ko capture here. */ if (!tryko(ti, tj, color, NULL, EMPTY, -1, -1)) /* Really shouldn't happen. */ abortgo(__FILE__, __LINE__, "trymove", ti, tj); aa_val = do_atari_atari(other, &fi, &fj, &defendi, &defendj, -1, -1, 0, minsize); if (aa_val == 0 || defendi == -1) { /* No sufficiently large combination attack, so the move is safe from * this danger. * * On rare occasions do_atari_atari might find a combination * but no defense. In this case we assume that the combination * is illusory. */ popgo(); return 1; } while (aa_val > 0) { /* Try dropping moves from the combination and see if it still * works. What we really want is to get the proper defense move * into (*i, *j). */ forbidden[fi][fj] = 1; aa_val = do_atari_atari(other, &fi, &fj, i, j, -1, -1, 0, aa_val); } popgo(); /* We know that a combination exists, but we don't know if * the original move at (ai, aj) was really relevant. So we * try omitting it and see if a combination is still found. */ if (do_atari_atari(other, NULL, NULL, NULL, NULL, -1, -1, 0, minsize) >= aa_val) return 1; else return 0;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/0c63869ea74eacc2258bb4d4a8995bc921355976/reading.c/clean/engine/reading.c
aa_val = do_atari_atari(other, &fi, &fj, i, j, -1, -1, 0, aa_val);
aa_val = do_atari_atari(other, &fi, &fj, &defendi, &defendj, -1, -1, 0, aa_val);
atari_atari_confirm_safety(int color, int ti, int tj, int *i, int *j, int minsize){ int m, n; int fi, fj; int defendi, defendj; int aa_val; int other = OTHER_COLOR(color); /* If aa_depth is too small, we can't see any combination attacks, * so in this respect the move is safe enough. */ if (aa_depth < 2) return 1; /* Collect worm statuses of opponent's worms. We need to * know this because we only want to report unexpected * results. For example, we do not want to report success * if we find we can kill a worm which is already dead. * The worm status of empty points is set to UNKNOWN to signal * that stones added along the way need special attention. */ memset(forbidden, 0, sizeof(forbidden)); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color) { if (dragon[m][n].matcher_status == DEAD) aa_status[m][n] = DEAD; else if (worm[m][n].attack_code != 0) { if (worm[m][n].defend_code != 0) aa_status[m][n] = CRITICAL; else aa_status[m][n] = DEAD; } else aa_status[m][n] = ALIVE; } else aa_status[m][n] = UNKNOWN; } /* reclassify a worm with 2 liberties as INSUBSTANTIAL if capturing * it does not result in a live group. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (p[m][n] == color && worm[m][n].origini == m && worm[m][n].originj == n && worm[m][n].liberties == 2 && aa_status[m][n] == ALIVE && !owl_substantial(m, n)) { int ui, uj; for (ui = 0; ui < board_size; ui++) for (uj = 0; uj < board_size; uj++) if (is_worm_origin(ui, uj, m, n)) aa_status[ui][uj] = INSUBSTANTIAL; } if (debug & DEBUG_ATARI_ATARI) { gprintf("atari_atari for %C\n", other); gprintf("aa_status: (ALIVE worms not listed)\n"); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color && is_worm_origin(m, n, m, n)) { const char *status = "UNKNOWN (shouldn't happen)"; if (aa_status[m][n] == DEAD) status = "DEAD"; else if (aa_status[m][n] == CRITICAL) status = "CRITICAL"; else if (aa_status[m][n] == INSUBSTANTIAL) status = "INSUBSTANTIAL"; if (aa_status[m][n] != ALIVE) gprintf("%M: %s\n", m, n, status); } } } /* Accept illegal ko capture here. */ if (!tryko(ti, tj, color, NULL, EMPTY, -1, -1)) /* Really shouldn't happen. */ abortgo(__FILE__, __LINE__, "trymove", ti, tj); aa_val = do_atari_atari(other, &fi, &fj, &defendi, &defendj, -1, -1, 0, minsize); if (aa_val == 0 || defendi == -1) { /* No sufficiently large combination attack, so the move is safe from * this danger. * * On rare occasions do_atari_atari might find a combination * but no defense. In this case we assume that the combination * is illusory. */ popgo(); return 1; } while (aa_val > 0) { /* Try dropping moves from the combination and see if it still * works. What we really want is to get the proper defense move * into (*i, *j). */ forbidden[fi][fj] = 1; aa_val = do_atari_atari(other, &fi, &fj, i, j, -1, -1, 0, aa_val); } popgo(); /* We know that a combination exists, but we don't know if * the original move at (ai, aj) was really relevant. So we * try omitting it and see if a combination is still found. */ if (do_atari_atari(other, NULL, NULL, NULL, NULL, -1, -1, 0, minsize) >= aa_val) return 1; else return 0;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/0c63869ea74eacc2258bb4d4a8995bc921355976/reading.c/clean/engine/reading.c
-1, -1, 0, minsize) >= aa_val)
-1, -1, 0, minsize) >= aa_val) return 0; else
atari_atari_confirm_safety(int color, int ti, int tj, int *i, int *j, int minsize){ int m, n; int fi, fj; int defendi, defendj; int aa_val; int other = OTHER_COLOR(color); /* If aa_depth is too small, we can't see any combination attacks, * so in this respect the move is safe enough. */ if (aa_depth < 2) return 1; /* Collect worm statuses of opponent's worms. We need to * know this because we only want to report unexpected * results. For example, we do not want to report success * if we find we can kill a worm which is already dead. * The worm status of empty points is set to UNKNOWN to signal * that stones added along the way need special attention. */ memset(forbidden, 0, sizeof(forbidden)); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color) { if (dragon[m][n].matcher_status == DEAD) aa_status[m][n] = DEAD; else if (worm[m][n].attack_code != 0) { if (worm[m][n].defend_code != 0) aa_status[m][n] = CRITICAL; else aa_status[m][n] = DEAD; } else aa_status[m][n] = ALIVE; } else aa_status[m][n] = UNKNOWN; } /* reclassify a worm with 2 liberties as INSUBSTANTIAL if capturing * it does not result in a live group. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (p[m][n] == color && worm[m][n].origini == m && worm[m][n].originj == n && worm[m][n].liberties == 2 && aa_status[m][n] == ALIVE && !owl_substantial(m, n)) { int ui, uj; for (ui = 0; ui < board_size; ui++) for (uj = 0; uj < board_size; uj++) if (is_worm_origin(ui, uj, m, n)) aa_status[ui][uj] = INSUBSTANTIAL; } if (debug & DEBUG_ATARI_ATARI) { gprintf("atari_atari for %C\n", other); gprintf("aa_status: (ALIVE worms not listed)\n"); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color && is_worm_origin(m, n, m, n)) { const char *status = "UNKNOWN (shouldn't happen)"; if (aa_status[m][n] == DEAD) status = "DEAD"; else if (aa_status[m][n] == CRITICAL) status = "CRITICAL"; else if (aa_status[m][n] == INSUBSTANTIAL) status = "INSUBSTANTIAL"; if (aa_status[m][n] != ALIVE) gprintf("%M: %s\n", m, n, status); } } } /* Accept illegal ko capture here. */ if (!tryko(ti, tj, color, NULL, EMPTY, -1, -1)) /* Really shouldn't happen. */ abortgo(__FILE__, __LINE__, "trymove", ti, tj); aa_val = do_atari_atari(other, &fi, &fj, &defendi, &defendj, -1, -1, 0, minsize); if (aa_val == 0 || defendi == -1) { /* No sufficiently large combination attack, so the move is safe from * this danger. * * On rare occasions do_atari_atari might find a combination * but no defense. In this case we assume that the combination * is illusory. */ popgo(); return 1; } while (aa_val > 0) { /* Try dropping moves from the combination and see if it still * works. What we really want is to get the proper defense move * into (*i, *j). */ forbidden[fi][fj] = 1; aa_val = do_atari_atari(other, &fi, &fj, i, j, -1, -1, 0, aa_val); } popgo(); /* We know that a combination exists, but we don't know if * the original move at (ai, aj) was really relevant. So we * try omitting it and see if a combination is still found. */ if (do_atari_atari(other, NULL, NULL, NULL, NULL, -1, -1, 0, minsize) >= aa_val) return 1; else return 0;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/0c63869ea74eacc2258bb4d4a8995bc921355976/reading.c/clean/engine/reading.c
else return 0;
atari_atari_confirm_safety(int color, int ti, int tj, int *i, int *j, int minsize){ int m, n; int fi, fj; int defendi, defendj; int aa_val; int other = OTHER_COLOR(color); /* If aa_depth is too small, we can't see any combination attacks, * so in this respect the move is safe enough. */ if (aa_depth < 2) return 1; /* Collect worm statuses of opponent's worms. We need to * know this because we only want to report unexpected * results. For example, we do not want to report success * if we find we can kill a worm which is already dead. * The worm status of empty points is set to UNKNOWN to signal * that stones added along the way need special attention. */ memset(forbidden, 0, sizeof(forbidden)); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color) { if (dragon[m][n].matcher_status == DEAD) aa_status[m][n] = DEAD; else if (worm[m][n].attack_code != 0) { if (worm[m][n].defend_code != 0) aa_status[m][n] = CRITICAL; else aa_status[m][n] = DEAD; } else aa_status[m][n] = ALIVE; } else aa_status[m][n] = UNKNOWN; } /* reclassify a worm with 2 liberties as INSUBSTANTIAL if capturing * it does not result in a live group. */ for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) if (p[m][n] == color && worm[m][n].origini == m && worm[m][n].originj == n && worm[m][n].liberties == 2 && aa_status[m][n] == ALIVE && !owl_substantial(m, n)) { int ui, uj; for (ui = 0; ui < board_size; ui++) for (uj = 0; uj < board_size; uj++) if (is_worm_origin(ui, uj, m, n)) aa_status[ui][uj] = INSUBSTANTIAL; } if (debug & DEBUG_ATARI_ATARI) { gprintf("atari_atari for %C\n", other); gprintf("aa_status: (ALIVE worms not listed)\n"); for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { if (p[m][n] == color && is_worm_origin(m, n, m, n)) { const char *status = "UNKNOWN (shouldn't happen)"; if (aa_status[m][n] == DEAD) status = "DEAD"; else if (aa_status[m][n] == CRITICAL) status = "CRITICAL"; else if (aa_status[m][n] == INSUBSTANTIAL) status = "INSUBSTANTIAL"; if (aa_status[m][n] != ALIVE) gprintf("%M: %s\n", m, n, status); } } } /* Accept illegal ko capture here. */ if (!tryko(ti, tj, color, NULL, EMPTY, -1, -1)) /* Really shouldn't happen. */ abortgo(__FILE__, __LINE__, "trymove", ti, tj); aa_val = do_atari_atari(other, &fi, &fj, &defendi, &defendj, -1, -1, 0, minsize); if (aa_val == 0 || defendi == -1) { /* No sufficiently large combination attack, so the move is safe from * this danger. * * On rare occasions do_atari_atari might find a combination * but no defense. In this case we assume that the combination * is illusory. */ popgo(); return 1; } while (aa_val > 0) { /* Try dropping moves from the combination and see if it still * works. What we really want is to get the proper defense move * into (*i, *j). */ forbidden[fi][fj] = 1; aa_val = do_atari_atari(other, &fi, &fj, i, j, -1, -1, 0, aa_val); } popgo(); /* We know that a combination exists, but we don't know if * the original move at (ai, aj) was really relevant. So we * try omitting it and see if a combination is still found. */ if (do_atari_atari(other, NULL, NULL, NULL, NULL, -1, -1, 0, minsize) >= aa_val) return 1; else return 0;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/0c63869ea74eacc2258bb4d4a8995bc921355976/reading.c/clean/engine/reading.c
induce_secondary_move_reasons(int color){ int m; int n; int pos; int k; int i; int aa; int dd = NO_MOVE; int biggest; for (m = 0; m < board_size; m++) for (n = 0; n < board_size; n++) { pos = POS(m, n); for (k = 0; k < MAX_REASONS; k++) { int r = move[pos].reason[k]; if (r < 0) break; if (move_reasons[r].type != ATTACK_MOVE && move_reasons[r].type != DEFEND_MOVE) continue; aa = worms[move_reasons[r].what]; if (( (move_reasons[r].type == ATTACK_MOVE) && (board[aa] == color)) || ((move_reasons[r].type == DEFEND_MOVE) && (board[aa] != color))) continue; /* Only a move for the opponent. */ if (worm[I(aa)][J(aa)].defend_code == 0) continue; /* No defense. */ /* Don't care about inessential dragons. */ if (DRAGON2(I(aa), J(aa)).safety == INESSENTIAL) continue; /* * If this is a defense move and the defense is futile for * strategical reasons, we shouldn't induce a cutting move * reason. */ if (move_reasons[r].type == DEFEND_MOVE && !strategically_sound_defense(aa, pos)) continue; /* * Find the biggest of the surrounding dragons and say that * all other dragons are connected or cut with respect to that * one. We might want to use some other property than size, or * still better induce cuts/connections for all combinations. */ biggest = 0; /* A tactically unstable worm should never be amalgamated into * a larger dragon. Occasionally this does still happen and in * that case we need a workaround. Eventually this workaround * should become unnecessary. */ if (dragon[I(aa)][J(aa)].size == worm[I(aa)][J(aa)].size) { for (i = 0; i < DRAGON2(I(aa), J(aa)).neighbors; i++) { int d = DRAGON2(I(aa), J(aa)).adjacent[i]; if (DRAGON(d).color == dragon[I(aa)][J(aa)].color) continue; if (DRAGON(d).size > biggest) { dd = DRAGON(d).origin; biggest = DRAGON(d).size; } } if (biggest == 0) continue; for (i = 0; i < DRAGON2(I(aa), J(aa)).neighbors; i++) { int d = DRAGON2(I(aa), J(aa)).adjacent[i]; int ee = DRAGON(d).origin; if (DRAGON(d).color == dragon[I(aa)][J(aa)].color) continue; if (dd != ee) { if (move_reasons[r].type == ATTACK_MOVE) { /* Exclude the case when (aa) is dead and both * (dd) and (ee) are strongly alive or * better. Then the move would only be losing * points. */ if (dragon[I(aa)][J(aa)].matcher_status != DEAD || (DRAGON2(I(dd), J(dd)).safety != STRONGLY_ALIVE && DRAGON2(I(dd), J(dd)).safety != INVINCIBLE) || (DRAGON2(I(ee), J(ee)).safety != STRONGLY_ALIVE && DRAGON2(I(ee), J(ee)).safety != INVINCIBLE)) add_connection_move(I(pos), J(pos), I(dd), J(dd), I(ee), J(ee)); } else add_cut_move(I(pos), J(pos), I(dd), J(dd), I(ee), J(ee)); } } } else { /* Workaround. If the unstable worm has been amalgamated * with stable worms, it would be incorrect to add * cut/connect move reasons for all neighbors of this * dragon. Instead we fall back to using chainlinks() to * find the neighbors of the worm. The shortcoming of this * is that it only counts neighbors in direct contact with * the worm, which is not always sufficient. */ int num_adj, adjs[MAXCHAIN]; num_adj = chainlinks(aa, adjs); for (i = 0; i < num_adj; i++) { int adj = adjs[i]; if (dragon[I(adj)][J(adj)].color == dragon[I(aa)][J(aa)].color) continue; if (dragon[I(adj)][J(adj)].size > biggest) { dd = dragon[I(adj)][J(adj)].origin; biggest = dragon[I(adj)][J(adj)].size; } } if (biggest == 0) continue; for (i = 0; i < num_adj; i++) { int adj = adjs[i]; int ee = dragon[I(adj)][J(adj)].origin; if (dragon[I(adj)][J(adj)].color == dragon[I(aa)][J(aa)].color) continue; if (dd != ee) { if (move_reasons[r].type == ATTACK_MOVE) { /* Exclude the case when (aa) is dead and both * (dd) and (ee) are strongly alive or * better. Then the move would only be losing * points. */ if (dragon[I(aa)][J(aa)].matcher_status != DEAD || (DRAGON2(I(dd), J(dd)).safety != STRONGLY_ALIVE && DRAGON2(I(dd), J(dd)).safety != INVINCIBLE) || (DRAGON2(I(ee), J(ee)).safety != STRONGLY_ALIVE && DRAGON2(I(ee), J(ee)).safety != INVINCIBLE)) add_connection_move(I(pos), J(pos), I(dd), J(dd), I(ee), J(ee)); } else add_cut_move(I(pos), J(pos), I(dd), J(dd), I(ee), J(ee)); } } } } }}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/7305d0ec63a021f1a105cfbef2e4a2bb4a7e8b76/move_reasons.c/buggy/engine/move_reasons.c
char *domain = list->domain;
char *domain;
do_broadcast (struct binding *list){ char *domain = list->domain; bool_t out; enum clnt_stat status; if (debug_flag) log_msg (LOG_DEBUG, _("do_broadcast() for domain '%s' is called"), domain); pthread_rdwr_wlock_np (&domainlock); list->active = -1; pthread_rdwr_wunlock_np (&domainlock); in_use = list; /* global variable for eachresult */ status = clnt_broadcast (YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, (xdrproc_t) ypbind_xdr_domainname, (void *)&domain, (xdrproc_t) xdr_bool, (void *)&out, (resultproc_t) eachresult); if (status != RPC_SUCCESS) { remove_bindingfile(list->domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno(status)); } else { pthread_rdwr_rlock_np (&domainlock); update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock); } if (debug_flag) log_msg (LOG_DEBUG, _("leave do_broadcast() for domain '%s'"), domain);}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/effd3797e12f0f4f972fe2b0da83d2b69f045a81/serv_list.c/clean/src/serv_list.c
remove_bindingfile(list->domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno(status));
remove_bindingfile (domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno (status));
do_broadcast (struct binding *list){ char *domain = list->domain; bool_t out; enum clnt_stat status; if (debug_flag) log_msg (LOG_DEBUG, _("do_broadcast() for domain '%s' is called"), domain); pthread_rdwr_wlock_np (&domainlock); list->active = -1; pthread_rdwr_wunlock_np (&domainlock); in_use = list; /* global variable for eachresult */ status = clnt_broadcast (YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, (xdrproc_t) ypbind_xdr_domainname, (void *)&domain, (xdrproc_t) xdr_bool, (void *)&out, (resultproc_t) eachresult); if (status != RPC_SUCCESS) { remove_bindingfile(list->domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno(status)); } else { pthread_rdwr_rlock_np (&domainlock); update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock); } if (debug_flag) log_msg (LOG_DEBUG, _("leave do_broadcast() for domain '%s'"), domain);}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/effd3797e12f0f4f972fe2b0da83d2b69f045a81/serv_list.c/clean/src/serv_list.c
{ pthread_rdwr_rlock_np (&domainlock); update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock); }
update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock);
do_broadcast (struct binding *list){ char *domain = list->domain; bool_t out; enum clnt_stat status; if (debug_flag) log_msg (LOG_DEBUG, _("do_broadcast() for domain '%s' is called"), domain); pthread_rdwr_wlock_np (&domainlock); list->active = -1; pthread_rdwr_wunlock_np (&domainlock); in_use = list; /* global variable for eachresult */ status = clnt_broadcast (YPPROG, YPVERS, YPPROC_DOMAIN_NONACK, (xdrproc_t) ypbind_xdr_domainname, (void *)&domain, (xdrproc_t) xdr_bool, (void *)&out, (resultproc_t) eachresult); if (status != RPC_SUCCESS) { remove_bindingfile(list->domain); log_msg (LOG_ERR, "broadcast: %s.", clnt_sperrno(status)); } else { pthread_rdwr_rlock_np (&domainlock); update_bindingfile (list); pthread_rdwr_runlock_np (&domainlock); } if (debug_flag) log_msg (LOG_DEBUG, _("leave do_broadcast() for domain '%s'"), domain);}
5799 /local/tlutelli/issta_data/temp/c/2005_temp/2005/5799/effd3797e12f0f4f972fe2b0da83d2b69f045a81/serv_list.c/clean/src/serv_list.c
2 * dragon[I(dragons[k])][J(dragons[k])].effective_size);
2 * dragon[I(dragons[k])] [J(dragons[k])].effective_size);
estimate_strategical_value(int pos, int color, float score){ int k; int l; int aa = NO_MOVE; int bb = NO_MOVE; int d1 = -1; int d2 = -1; int worm1 = -1; int worm2 = -1; int ecolor = 0; float this_value = 0.0; float tot_value = 0.0; /* Strategical value of connecting or cutting dragons. */ static float dragon_value[MAX_DRAGONS]; for (k = 0; k < next_dragon; k++) dragon_value[k] = 0.0; for (k = 0; k < MAX_REASONS; k++) { int r = move[pos].reason[k]; if (r < 0) break; this_value = 0.0; switch (move_reasons[r].type) { case ATTACK_MOVE: case DEFEND_MOVE: worm1 = move_reasons[r].what; aa = worms[worm1]; /* Attack on our stones. */ if (move_reasons[r].type == ATTACK_MOVE && board[aa] == color) break; /* Defense of enemy stones. */ if (move_reasons[r].type == DEFEND_MOVE && board[aa] != color) break; /* Defenseless stone */ if (worm[I(aa)][J(aa)].defend_code == 0) break; /* Require the defense to be strategically viable. */ if (move_reasons[r].type == DEFEND_MOVE && !strategically_sound_defense(aa, pos)) break; /* Do the same for attack moves. */ if (move_reasons[r].type == ATTACK_MOVE && !move[pos].move_safety) break; /* This is totally ad hoc, just guessing the value of * potential cutting points. */ if (worm[I(aa)][J(aa)].cutstone2 > 1) { this_value = 10.0 * (worm[I(aa)][J(aa)].cutstone2 - 1); TRACE(" %1m: %f - %1m cutstone\n", pos, this_value, aa); } tot_value += this_value; /* If the string is a lunch for a weak dragon, the attack or * defense has a strategical value. This can be valued along * the same lines as strategic_attack/strategic_defend. * * No points are awarded if the lunch is an inessential dragon * or worm. */ if (DRAGON2(I(aa), J(aa)).safety == INESSENTIAL || worm[I(aa)][J(aa)].inessential) break; /* Can't use k in this loop too. */ for (l = 0; l < next_lunch; l++) if (lunch_worm[l] == worm1) { d1 = lunch_dragon[l]; bb = dragons[d1]; /* FIXME: This value cannot be computed without some measurement of how the actual move affects the dragon. The dragon safety alone is not enough. The question is whether the dragon is threatened by the move or not. */ this_value = (dragon[I(bb)][J(bb)].effective_size * (1.0 - dragon_safety(bb, 0))); /* If this dragon consists of only one worm and that worm * can be tactically captured or defended by this move, we * have already counted the points as territorial value, * unless it's assumed to be dead. */ if (dragon[I(bb)][J(bb)].matcher_status != DEAD && dragon[I(bb)][J(bb)].size == worm[I(bb)][J(bb)].size && (move_reason_known(pos, ATTACK_MOVE, find_worm(bb)) || move_reason_known(pos, DEFEND_MOVE, find_worm(bb)))) this_value = 0.0; if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; } break; case ATTACK_THREAT_MOVE: case DEFEND_THREAT_MOVE: break; case ATTACK_EITHER_MOVE: case DEFEND_BOTH_MOVE: /* This is complete nonsense, but still better than nothing. * FIXME: Do this in a reasonable way. */ worm1 = worm_pair1[move_reasons[r].what]; worm2 = worm_pair2[move_reasons[r].what]; aa = worms[worm1]; bb = worms[worm2]; /* If both worms are dead, this move reason has no value. */ if (dragon[I(aa)][J(aa)].matcher_status == DEAD && dragon[I(bb)][J(bb)].matcher_status == DEAD) break; /* If we already have unconditional attack or defense of * either worm, this move reason has no additional value. */ if (move_reasons[r].type == ATTACK_EITHER_MOVE && (move_reason_known(pos, ATTACK_MOVE, worm1) || move_reason_known(pos, ATTACK_MOVE, worm2))) break; if (move_reasons[r].type == DEFEND_BOTH_MOVE && (move_reason_known(pos, DEFEND_MOVE, worm1) || move_reason_known(pos, DEFEND_MOVE, worm2))) break; /* Also if there is a combination attack, we assume it covers * the same thing. */ if (move_reasons[r].type == ATTACK_EITHER_MOVE && move_reason_known(pos, MY_ATARI_ATARI_MOVE, -1)) break; if (move_reasons[r].type == DEFEND_BOTH_MOVE && move_reason_known(pos, YOUR_ATARI_ATARI_MOVE, -1)) break; this_value = 2 * gg_min(worm[I(aa)][J(aa)].effective_size, worm[I(bb)][J(bb)].effective_size); if (move_reasons[r].type == ATTACK_EITHER_MOVE) TRACE(" %1m: %f - attacks either %1m or %1m\n", pos, this_value, aa, bb); else TRACE(" %1m: %f - defends both %1m and %1m\n", pos, this_value, aa, bb); tot_value += this_value; break; case CONNECT_MOVE: if (!move[pos].move_safety) break; /* Otherwise fall through. */ case CUT_MOVE: if (doing_scoring && !move[pos].move_safety) break; d1 = conn_dragon1[move_reasons[r].what]; d2 = conn_dragon2[move_reasons[r].what]; aa = dragons[d1]; bb = dragons[d2]; /* If we are ahead by more than 20, value connections more strongly */ if ((color == WHITE && score > 20.0) || (color == BLACK && score < -20.0)) this_value = connection_value(aa, bb, pos, gg_abs(score)); else this_value = connection_value(aa, bb, pos, 0); if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; if ((color == WHITE && score > 20.0) || (color == BLACK && score < -20.0)) this_value = connection_value(bb, aa, pos, gg_abs(score)); else this_value = connection_value(bb, aa, pos, 0); if (this_value > dragon_value[d2]) dragon_value[d2] = this_value; break; case SEMEAI_MOVE: /* * The strategical value of winning a semeai is * own dragons (usually) becomes fully secure, while adjoining * enemy dragons do not. * * FIXME: Valuation not implemented at all yet. */ break; case VITAL_EYE_MOVE: /* * The value of the threatened group itself has already been * accounted for in territorial_value. Now we need to determine * the effect this has on surrounding groups. * * FIXME: Valuation not implemented. */ aa = eyes[move_reasons[r].what]; ecolor = eyecolor[move_reasons[r].what]; if (ecolor == WHITE) bb = white_eye[I(aa)][J(aa)].dragon; else bb = black_eye[I(aa)][J(aa)].dragon; if (bb == NO_MOVE) /* Maybe we should assert this not to happen. */ break; /* If there is an owl attack/defend move reason for this location, * we don't care about it, since otherwise we would count the * points twice. */ if (move_reason_known(pos, OWL_DEFEND_MOVE, find_dragon(bb)) || move_reason_known(pos, OWL_ATTACK_MOVE, find_dragon(bb))) { DEBUG(DEBUG_MOVE_REASONS, " %1m: 0.0 - vital for %1m: owl attack/defense as well\n", pos, bb); break; }#if 0 if (dragon[bi][bj].status == CRITICAL) { this_value = ??? TRACE(" %m: %f - vital for %m\n", m, n, this_value, bi, bj); tot_value += this_value; }#endif break; case STRATEGIC_ATTACK_MOVE: case STRATEGIC_DEFEND_MOVE: /* The right way to do this is to estimate the safety of the * dragon before and after the move. Unfortunately we are * missing good ways to do this currently. * * Temporary solution is to only look at an ad hoc measure of * the dragon safety and ignoring the effectiveness of the * move. * * FIXME: Improve the implementation. */ d1 = move_reasons[r].what; aa = dragons[d1]; /* FIXME: This value cannot be computed without some measurement of how the actual move affects the dragon. The dragon safety alone is not enough. The question is whether the dragon is threatened by the move or not. */ this_value = (dragon[I(aa)][J(aa)].effective_size * (1.0 - dragon_safety(aa, 1))); /* To prefer good connections and cuts, we lower this value * somewhat. */ this_value *= 0.75; if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; break; } } for (k = 0; k < next_dragon; k++) { if (dragon_value[k] == 0.0) continue; aa = dragons[k]; /* If this dragon consists of only one worm and that worm can * be tactically captured or defended by this move, we have * already counted the points as territorial value, unless * it's assumed to be dead. */ if (dragon[I(aa)][J(aa)].matcher_status != DEAD && dragon[I(aa)][J(aa)].size == worm[I(aa)][J(aa)].size && (move_reason_known(pos, ATTACK_MOVE, find_worm(aa)) || move_reason_known(pos, DEFEND_MOVE, find_worm(aa)))) continue; /* If the dragon has been owl captured, owl defended, or involved * in a semeai, we have likewise already counted the points as * territorial value. */ if (move_reason_known(pos, OWL_ATTACK_MOVE, k) || move_reason_known(pos, OWL_DEFEND_MOVE, k) || move_reason_known(pos, SEMEAI_MOVE, k)) { /* But if the strategical value was larger than the territorial * value (e.g. because connecting to strong dragon) we award the * excess value as a bonus. */ float excess_value = (dragon_value[k] - 2 * dragon[I(dragons[k])][J(dragons[k])].effective_size); if (excess_value > 0.0) { TRACE(" %1m: %f - strategic bonus for %1m\n", pos, excess_value, dragons[k]); tot_value += excess_value; } continue; } TRACE(" %1m: %f - strategic effect on %1m\n", pos, dragon_value[k], dragon[k]); tot_value += dragon_value[k]; } move[pos].strategical_value = tot_value;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/7305d0ec63a021f1a105cfbef2e4a2bb4a7e8b76/move_reasons.c/buggy/engine/move_reasons.c
pos, dragon_value[k], dragon[k]);
pos, dragon_value[k], dragons[k]);
estimate_strategical_value(int pos, int color, float score){ int k; int l; int aa = NO_MOVE; int bb = NO_MOVE; int d1 = -1; int d2 = -1; int worm1 = -1; int worm2 = -1; int ecolor = 0; float this_value = 0.0; float tot_value = 0.0; /* Strategical value of connecting or cutting dragons. */ static float dragon_value[MAX_DRAGONS]; for (k = 0; k < next_dragon; k++) dragon_value[k] = 0.0; for (k = 0; k < MAX_REASONS; k++) { int r = move[pos].reason[k]; if (r < 0) break; this_value = 0.0; switch (move_reasons[r].type) { case ATTACK_MOVE: case DEFEND_MOVE: worm1 = move_reasons[r].what; aa = worms[worm1]; /* Attack on our stones. */ if (move_reasons[r].type == ATTACK_MOVE && board[aa] == color) break; /* Defense of enemy stones. */ if (move_reasons[r].type == DEFEND_MOVE && board[aa] != color) break; /* Defenseless stone */ if (worm[I(aa)][J(aa)].defend_code == 0) break; /* Require the defense to be strategically viable. */ if (move_reasons[r].type == DEFEND_MOVE && !strategically_sound_defense(aa, pos)) break; /* Do the same for attack moves. */ if (move_reasons[r].type == ATTACK_MOVE && !move[pos].move_safety) break; /* This is totally ad hoc, just guessing the value of * potential cutting points. */ if (worm[I(aa)][J(aa)].cutstone2 > 1) { this_value = 10.0 * (worm[I(aa)][J(aa)].cutstone2 - 1); TRACE(" %1m: %f - %1m cutstone\n", pos, this_value, aa); } tot_value += this_value; /* If the string is a lunch for a weak dragon, the attack or * defense has a strategical value. This can be valued along * the same lines as strategic_attack/strategic_defend. * * No points are awarded if the lunch is an inessential dragon * or worm. */ if (DRAGON2(I(aa), J(aa)).safety == INESSENTIAL || worm[I(aa)][J(aa)].inessential) break; /* Can't use k in this loop too. */ for (l = 0; l < next_lunch; l++) if (lunch_worm[l] == worm1) { d1 = lunch_dragon[l]; bb = dragons[d1]; /* FIXME: This value cannot be computed without some measurement of how the actual move affects the dragon. The dragon safety alone is not enough. The question is whether the dragon is threatened by the move or not. */ this_value = (dragon[I(bb)][J(bb)].effective_size * (1.0 - dragon_safety(bb, 0))); /* If this dragon consists of only one worm and that worm * can be tactically captured or defended by this move, we * have already counted the points as territorial value, * unless it's assumed to be dead. */ if (dragon[I(bb)][J(bb)].matcher_status != DEAD && dragon[I(bb)][J(bb)].size == worm[I(bb)][J(bb)].size && (move_reason_known(pos, ATTACK_MOVE, find_worm(bb)) || move_reason_known(pos, DEFEND_MOVE, find_worm(bb)))) this_value = 0.0; if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; } break; case ATTACK_THREAT_MOVE: case DEFEND_THREAT_MOVE: break; case ATTACK_EITHER_MOVE: case DEFEND_BOTH_MOVE: /* This is complete nonsense, but still better than nothing. * FIXME: Do this in a reasonable way. */ worm1 = worm_pair1[move_reasons[r].what]; worm2 = worm_pair2[move_reasons[r].what]; aa = worms[worm1]; bb = worms[worm2]; /* If both worms are dead, this move reason has no value. */ if (dragon[I(aa)][J(aa)].matcher_status == DEAD && dragon[I(bb)][J(bb)].matcher_status == DEAD) break; /* If we already have unconditional attack or defense of * either worm, this move reason has no additional value. */ if (move_reasons[r].type == ATTACK_EITHER_MOVE && (move_reason_known(pos, ATTACK_MOVE, worm1) || move_reason_known(pos, ATTACK_MOVE, worm2))) break; if (move_reasons[r].type == DEFEND_BOTH_MOVE && (move_reason_known(pos, DEFEND_MOVE, worm1) || move_reason_known(pos, DEFEND_MOVE, worm2))) break; /* Also if there is a combination attack, we assume it covers * the same thing. */ if (move_reasons[r].type == ATTACK_EITHER_MOVE && move_reason_known(pos, MY_ATARI_ATARI_MOVE, -1)) break; if (move_reasons[r].type == DEFEND_BOTH_MOVE && move_reason_known(pos, YOUR_ATARI_ATARI_MOVE, -1)) break; this_value = 2 * gg_min(worm[I(aa)][J(aa)].effective_size, worm[I(bb)][J(bb)].effective_size); if (move_reasons[r].type == ATTACK_EITHER_MOVE) TRACE(" %1m: %f - attacks either %1m or %1m\n", pos, this_value, aa, bb); else TRACE(" %1m: %f - defends both %1m and %1m\n", pos, this_value, aa, bb); tot_value += this_value; break; case CONNECT_MOVE: if (!move[pos].move_safety) break; /* Otherwise fall through. */ case CUT_MOVE: if (doing_scoring && !move[pos].move_safety) break; d1 = conn_dragon1[move_reasons[r].what]; d2 = conn_dragon2[move_reasons[r].what]; aa = dragons[d1]; bb = dragons[d2]; /* If we are ahead by more than 20, value connections more strongly */ if ((color == WHITE && score > 20.0) || (color == BLACK && score < -20.0)) this_value = connection_value(aa, bb, pos, gg_abs(score)); else this_value = connection_value(aa, bb, pos, 0); if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; if ((color == WHITE && score > 20.0) || (color == BLACK && score < -20.0)) this_value = connection_value(bb, aa, pos, gg_abs(score)); else this_value = connection_value(bb, aa, pos, 0); if (this_value > dragon_value[d2]) dragon_value[d2] = this_value; break; case SEMEAI_MOVE: /* * The strategical value of winning a semeai is * own dragons (usually) becomes fully secure, while adjoining * enemy dragons do not. * * FIXME: Valuation not implemented at all yet. */ break; case VITAL_EYE_MOVE: /* * The value of the threatened group itself has already been * accounted for in territorial_value. Now we need to determine * the effect this has on surrounding groups. * * FIXME: Valuation not implemented. */ aa = eyes[move_reasons[r].what]; ecolor = eyecolor[move_reasons[r].what]; if (ecolor == WHITE) bb = white_eye[I(aa)][J(aa)].dragon; else bb = black_eye[I(aa)][J(aa)].dragon; if (bb == NO_MOVE) /* Maybe we should assert this not to happen. */ break; /* If there is an owl attack/defend move reason for this location, * we don't care about it, since otherwise we would count the * points twice. */ if (move_reason_known(pos, OWL_DEFEND_MOVE, find_dragon(bb)) || move_reason_known(pos, OWL_ATTACK_MOVE, find_dragon(bb))) { DEBUG(DEBUG_MOVE_REASONS, " %1m: 0.0 - vital for %1m: owl attack/defense as well\n", pos, bb); break; }#if 0 if (dragon[bi][bj].status == CRITICAL) { this_value = ??? TRACE(" %m: %f - vital for %m\n", m, n, this_value, bi, bj); tot_value += this_value; }#endif break; case STRATEGIC_ATTACK_MOVE: case STRATEGIC_DEFEND_MOVE: /* The right way to do this is to estimate the safety of the * dragon before and after the move. Unfortunately we are * missing good ways to do this currently. * * Temporary solution is to only look at an ad hoc measure of * the dragon safety and ignoring the effectiveness of the * move. * * FIXME: Improve the implementation. */ d1 = move_reasons[r].what; aa = dragons[d1]; /* FIXME: This value cannot be computed without some measurement of how the actual move affects the dragon. The dragon safety alone is not enough. The question is whether the dragon is threatened by the move or not. */ this_value = (dragon[I(aa)][J(aa)].effective_size * (1.0 - dragon_safety(aa, 1))); /* To prefer good connections and cuts, we lower this value * somewhat. */ this_value *= 0.75; if (this_value > dragon_value[d1]) dragon_value[d1] = this_value; break; } } for (k = 0; k < next_dragon; k++) { if (dragon_value[k] == 0.0) continue; aa = dragons[k]; /* If this dragon consists of only one worm and that worm can * be tactically captured or defended by this move, we have * already counted the points as territorial value, unless * it's assumed to be dead. */ if (dragon[I(aa)][J(aa)].matcher_status != DEAD && dragon[I(aa)][J(aa)].size == worm[I(aa)][J(aa)].size && (move_reason_known(pos, ATTACK_MOVE, find_worm(aa)) || move_reason_known(pos, DEFEND_MOVE, find_worm(aa)))) continue; /* If the dragon has been owl captured, owl defended, or involved * in a semeai, we have likewise already counted the points as * territorial value. */ if (move_reason_known(pos, OWL_ATTACK_MOVE, k) || move_reason_known(pos, OWL_DEFEND_MOVE, k) || move_reason_known(pos, SEMEAI_MOVE, k)) { /* But if the strategical value was larger than the territorial * value (e.g. because connecting to strong dragon) we award the * excess value as a bonus. */ float excess_value = (dragon_value[k] - 2 * dragon[I(dragons[k])][J(dragons[k])].effective_size); if (excess_value > 0.0) { TRACE(" %1m: %f - strategic bonus for %1m\n", pos, excess_value, dragons[k]); tot_value += excess_value; } continue; } TRACE(" %1m: %f - strategic effect on %1m\n", pos, dragon_value[k], dragon[k]); tot_value += dragon_value[k]; } move[pos].strategical_value = tot_value;}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/7305d0ec63a021f1a105cfbef2e4a2bb4a7e8b76/move_reasons.c/buggy/engine/move_reasons.c
#else CLEAR_STACKS(); #endif
remove_stone(int i, int j){ ASSERT(stackp == 0, i, j); ASSERT_ON_BOARD(i, j); ASSERT(p[i][j] != EMPTY, i, j); do_remove_stone(i, j); new_position();}
6496 /local/tlutelli/issta_data/temp/c/2005_temp/2005/6496/2a5a6dbb2a697083e7683965c1293f04fe090706/board.c/buggy/engine/board.c
else { if (KStandardDirs::exists( QDir::currentDirPath() + "/" + URL ) ) file = QDir::currentDirPath() + "/" + URL; ret = xmlNewInputFromFile(ctxt, file.latin1()); }
xmlParserInputPtr meinExternalEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt) { xmlParserInputPtr ret = NULL; // fprintf(stderr, "loading %s %s %s\n", URL, ID, ctxt->directory); if (URL == NULL) { if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) ctxt->sax->warning(ctxt, "failed to load external entity \"%s\"\n", ID); return(NULL); } if (!strcmp(ID, "-//OASIS//DTD DocBook XML V4.1.2//EN")) URL = "docbook/xml-dtd-4.1.2/docbookx.dtd"; if (!strcmp(ID, "-//OASIS//DTD XML DocBook V4.1.2//EN")) URL = "docbook/xml-dtd-4.1.2/docbookx.dtd"; if (!strcmp(ID, "-//KDE//DTD DocBook XML V4.1-Based Variant V1.0//EN")) URL = "customization/dtd/kdex.dtd"; if (!strcmp(ID, "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.0//EN")) URL = "customization/dtd/kdex.dtd"; QString file = locate("dtd", URL); if (!file.isEmpty()) ret = xmlNewInputFromFile(ctxt, file.latin1()); if (ret == NULL) { if ((ctxt->sax != NULL) && (ctxt->sax->warning != NULL)) ctxt->sax->warning(ctxt, "failed to load external entity \"%s\"\n", URL); } return(ret);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fefac5bd4e697d00c0d918c5d37bf04e4b605188/xslt.cpp/buggy/kioslave/help/xslt.cpp
if (ctxt->xinclude != 0) { #ifdef LIBXML_XINCLUDE_ENABLED xmlXIncludeProcess(doc); #else xsltGenericError(xsltGenericErrorContext, "xsltLoadDocument(%s) : XInclude processing not compiled in\n", URI); #endif }
xsltLoadDocument(xsltTransformContextPtr ctxt, const xmlChar *URI) { xsltDocumentPtr ret; xmlDocPtr doc; if ((ctxt == NULL) || (URI == NULL)) return(NULL); /* * Walk the context list to find the document if preparsed */ ret = ctxt->docList; while (ret != NULL) { if ((ret->doc != NULL) && (ret->doc->URL != NULL) && (xmlStrEqual(ret->doc->URL, URI))) return(ret); ret = ret->next; } doc = xmlParseFile((const char *) URI); if (doc == NULL) return(NULL); ret = xsltNewDocument(ctxt, doc); return(ret);}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/fd8a7f1b51439bbcf01b819d7cc964127181d210/documents.c/buggy/kioslave/help/libxslt/documents.c
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b)
inline bool QgsClipper::inside(const double x, const double y, boundary b)
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b){ switch (b) { case Xmax: // x < maxX is inside if (pa[p].x() < maxX) return true; break; case Xmin: // x > minX is inside if (pa[p].x() > minX) return true; break; case Ymax: // y < maxY is inside if (pa[p].y() < maxY) return true; break; case Ymin: // y > minY is inside if (pa[p].y() > minY) return true; break; } return false;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
if (pa[p].x() < maxX)
if (x < maxX)
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b){ switch (b) { case Xmax: // x < maxX is inside if (pa[p].x() < maxX) return true; break; case Xmin: // x > minX is inside if (pa[p].x() > minX) return true; break; case Ymax: // y < maxY is inside if (pa[p].y() < maxY) return true; break; case Ymin: // y > minY is inside if (pa[p].y() > minY) return true; break; } return false;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
if (pa[p].x() > minX)
if (x > minX)
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b){ switch (b) { case Xmax: // x < maxX is inside if (pa[p].x() < maxX) return true; break; case Xmin: // x > minX is inside if (pa[p].x() > minX) return true; break; case Ymax: // y < maxY is inside if (pa[p].y() < maxY) return true; break; case Ymin: // y > minY is inside if (pa[p].y() > minY) return true; break; } return false;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
if (pa[p].y() < maxY)
if (y < maxY)
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b){ switch (b) { case Xmax: // x < maxX is inside if (pa[p].x() < maxX) return true; break; case Xmin: // x > minX is inside if (pa[p].x() > minX) return true; break; case Ymax: // y < maxY is inside if (pa[p].y() < maxY) return true; break; case Ymin: // y > minY is inside if (pa[p].y() > minY) return true; break; } return false;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
if (pa[p].y() > minY)
if (y > minY)
inline bool QgsClipper::inside(const std::vector<QgsPoint>& pa, int p, boundary b){ switch (b) { case Xmax: // x < maxX is inside if (pa[p].x() < maxX) return true; break; case Xmin: // x > minX is inside if (pa[p].x() > minX) return true; break; case Ymax: // y < maxY is inside if (pa[p].y() < maxY) return true; break; case Ymin: // y > minY is inside if (pa[p].y() > minY) return true; break; } return false;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b)
inline QgsPoint QgsClipper::intersect(const double x1, const double y1, const double x2, const double y2, boundary b)
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2];
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY);
r_n = -(x1 - maxX) * (maxY - minY); r_d = (x2 - x1) * (maxY - minY);
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY);
r_n = -(x1 - minX) * (maxY - minY); r_d = (x2 - x1) * (maxY - minY);
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX);
r_n = (y1 - maxY) * (maxX - minX); r_d = -(y2 - y1) * (maxX - minX);
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX);
r_n = (y1 - minY) * (maxX - minX); r_d = -(y2 - y1) * (maxX - minX);
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y()));
p.set(x1 + r*(x2 - x1), y1 + r*(y2 - y1));
inline QgsPoint QgsClipper::intersect(const std::vector<QgsPoint>& pa, int i1, int i2, boundary b){ // This function assumes that the two given points cross the given // boundary. Making this assumption allows some optimisations. QgsPoint p1 = pa[i1]; QgsPoint p2 = pa[i2]; double r_n, r_d; switch (b) { case Xmax: // x = maxX boundary r_n = -(p1.x() - maxX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Xmin: // x = minX boundary r_n = -(p1.x() - minX) * (maxY - minY); r_d = (p2.x() - p1.x()) * (maxY - minY); break; case Ymax: // y = maxY boundary r_n = (p1.y() - maxY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; case Ymin: // y = minY boundary r_n = (p1.y() - minY) * (maxX - minX); r_d = - (p2.y() - p1.y()) * (maxX - minX); break; } QgsPoint p; if (std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM) { // they cross double r = r_n / r_d; p.set(p1.x() + r*(p2.x() - p1.x()), p1.y() + r*(p2.y() - p1.y())); } else { // Should never get here, but if we do for some reason, cause a // clunk because something else is wrong if we do. Q_ASSERT(std::abs(r_d) > SMALL_NUM && std::abs(r_n) > SMALL_NUM); } return p;}
1753 /local/tlutelli/issta_data/temp/c/2005_temp/2005/1753/3f9cc5d3e7d195e63fb4a17d66b1b7e4ee8da7cb/qgsclipper.h/buggy/src/qgsclipper.h
HTMLPage += "<dt><A HREF=man:";
HTMLPage += "<dt><A HREF=man:/";
int MakeDirectory( QString &HTMLPage ){ char text[80]; char page[80]; HTMLPage = "<H1>"; HTMLPage += i18n("Online Manuals"); HTMLPage += "</H1>"; HTMLPage += "<dl>"; for (int i = 0; i < numSections; i++) { sprintf(text, i18n("Section %s"), sections[i]->GetName()); sprintf(page, "(%s)", sections[i]->GetName()); HTMLPage += "<dt><A HREF=man:"; HTMLPage += page; HTMLPage += ">"; HTMLPage += QString( text ); HTMLPage += "</A><dd>"; HTMLPage += sections[i]->GetDesc(); } HTMLPage += "</dl>"; return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/7aa6deba2eef647c3b5afb7599c13ebbb2ee49ee/man.cpp/clean/khelpcenter/helpcenter/man.cpp
KInstance instance("fish");
KInstance instance("fish");
int kdemain( int argc, char **argv ){ KInstance instance("fish"); myDebug( << "*** Starting fish " << endl); if (argc != 4) { myDebug( << "Usage: fish protocol domain-socket1 domain-socket2" << endl); exit(-1); } fishProtocol slave(argv[2], argv[3]); slave.dispatchLoop(); myDebug( << "*** fish Done" << endl); return 0;}
3322 /local/tlutelli/issta_data/temp/c/2005_temp/2005/3322/11afbb378913175f7b3f19457b921df3efab59dc/fish.cpp/buggy/kioslave/fish/fish.cpp