/** \fn configure */ bool addBorders::configure(void) { uint32_t width,height; #define MAKEME(x) uint32_t x=param.x; while(1) { MAKEME(left); MAKEME(right); MAKEME(top); MAKEME(bottom); width=previousFilter->getInfo()->width; height=previousFilter->getInfo()->height; diaElemUInteger dleft(&left,QT_TRANSLATE_NOOP("addBorder", "_Left border:"), 0,width); diaElemUInteger dright(&right,QT_TRANSLATE_NOOP("addBorder", "_Right border:"), 0,width); diaElemUInteger dtop(&(top),QT_TRANSLATE_NOOP("addBorder", "_Top border:"), 0,height); diaElemUInteger dbottom(&(bottom),QT_TRANSLATE_NOOP("addBorder", "_Bottom border:"), 0,height); diaElem *elems[4]={&dleft,&dright,&dtop,&dbottom}; if(diaFactoryRun(QT_TRANSLATE_NOOP("addBorder", "Add Borders"),4,elems)) { if((left&1) || (right&1)|| (top&1) || (bottom&1)) { GUI_Error_HIG(QT_TRANSLATE_NOOP("addBorder", "Incorrect parameters"),QT_TRANSLATE_NOOP("addBorder", "All parameters must be even and within range.")); continue; } else { #undef MAKEME #define MAKEME(x) param.x=x; MAKEME(left); MAKEME(right); MAKEME(top); MAKEME(bottom); info.width=width+left+right; info.height=height+top+bottom; return 1; } } return 0; } }
void dijsktra(int i, int j){ visited[i][j] = 1; int dist; if(i+1 < M && !visited[i+1][j]){ dist = ddown(i,j); dist += D[i][j]; if(D[i+1][j] > dist){ D[i+1][j] = dist; decrease_key(pointers[i+1][j]); } } if(j+1 < N && !visited[i][j+1]){ dist = dright(i,j); dist += D[i][j]; if(D[i][j+1] > dist){ D[i][j+1] = dist; decrease_key(pointers[i][j+1]); } } if(i-1 >= 0 && !visited[i-1][j]){ dist = dtop(i,j); dist += D[i][j]; if(D[i-1][j] > dist){ D[i-1][j] = dist; decrease_key(pointers[i-1][j]); } } if(j-1 >= 0 && !visited[i][j-1]){ dist = dleft(i,j); dist += D[i][j]; if(D[i][j-1] > dist){ D[i][j-1] = dist; decrease_key(pointers[i][j-1]); } } }
int main(int argc, char *args[]) { int cn = 0, srank = 0; query = getenv("QUERY_STRING"); if (query && !strncmp(query, "cn=", 3)) { cn = atoi(query + 3); } if (query && !strncmp(query, "rank=", 5)) { srank = atoi(query + 5); } chdir("/home/merc"); printf("Content-Type: text/html\n\n"); printf("<html><head><title>Server Info</title></head>\n"); printf("<BODY TEXT=#D7D700 BGCOLOR=#264A9F LINK=#FFFFBB VLINK=#CCCC00 ALINK=#FFFF9D background=/gfx/back4.gif>"); printf("<center>"); printf("<table width=\"100%%\"><tr>"); printf( " <table width=\"100%%\">" " <tr>" " <td align=\"center\"><a href=\"http://www.astonia.com/\"><img src=\"/gfx/logo.gif\" width=\"100\" height=\"60\" border=\"0\"></a></td>" " <td align=\"center\">" " <a href=\"/\">Home</a>" " <a href=\"/manual.html\">Manual</a>" " <a href=\"/terms.html\">Terms</a>" " <a href=\"/download.html\">Download</a>" " <a href=\"/contact.html\">Contact</a>" " <a href=\"/cgi-bin/info.cgi\">Server Status</a>" " <a href=\"/cgi-bin/who.cgi\">Who's Online</a>" " <a href=\"/bugs.html\">Bugs</a>" " <a href=\"/changes.html\">Changes</a>" " <a href=\"/creators.html\">Creators</a>" " <a href=\"/links.html\">Links</a>" " <a href=\"/privacy.html\">Privacy</a>" " </td>" " <td align=\"center\"><a href=\"http://www.astonia.com/\"><img src=\"/gfx/logo.gif\" width=\"100\" height=\"60\" border=\"0\"></a></td>" " </tr>" " </table>"); printf("</td></tr></table>"); printf("<img src=/gfx/barsmall.gif border=0 align=left alt=---- width=100%% height=5><br>"); printf("<table width=60%%><tr><td>\n"); if (load()) { printf("<b>Cannot access server data. Exiting... (%s)</b></td></tr></table>", strerror(errno)); exit(0); } if (args[0]) { if (strcmp(args[0], "who.cgi")==0) { who(); } else if (strcmp(args[0], "top.cgi")==0) { top(); } else if (strcmp(args[0], "info.cgi")==0) { info(cn); } else if (strcmp(args[0], "hog.cgi")==0) { hog(); } else if (strcmp(args[0], "gods.cgi")==0) { gods(); } else if (strcmp(args[0], "staff.cgi")==0) { staff(); } else if (strcmp(args[0], "effects.cgi")==0) { effects(); } else if (strcmp(args[0], "xtop.cgi")==0) { xtop(srank); } else if (strcmp(args[0], "dtop.cgi")==0) { dtop(srank); } else { printf("Internal error... (%s)\n", args[0]); } } else { printf("Internal error..."); } unload(); printf("</td></tr></table><br>"); printf( "<img src=\"/gfx/barsmall.gif\" border=0 align=\"left\" alt=\"----\" width=\"100%%\" height=5><br>" "<table width=\"100%%\" cellpadding=0 cellspacing=0 border=0><tr>" "<td width=\"33%%\" align=center><a href=/devel.html>Back to main page</a></td>" "<td width=\"33%%\" align=center> </td>" "<td width=\"33%%\" align=center><font size=-1>All material on this server is copyright " "<a href=mailto:[email protected]>D.Brockhaus</a></font></td>" "</tr></table>" "</center><br><br>" "</body></html>"); return(0); }
static float btop(int p,bxy*b){ return dtop(p,b->x,b->y); }
uforth_stat exec(CELL wd_idx, char toplevelprim,uint8_t last_exec_rdix) { while(1) { if (wd_idx == 0) { uforth_abort_request(ABORT_ILLEGAL); uforth_abort(); /* bad instruction */ return E_NOT_A_WORD; } cmd = uforth_dict[wd_idx++]; switch (cmd) { case 0: uforth_abort_request(ABORT_ILLEGAL); uforth_abort(); /* bad instruction */ return E_NOT_A_WORD; case ABORT: uforth_abort_request(ABORT_WORD); break; case IMMEDIATE: make_immediate(); break; case IRAM_FETCH: r1 = dpop(); dpush(((DCELL*)uforth_iram)[r1]); break; case URAM_BASE_ADDR: dpush((RAM_START_IDX + (sizeof(struct uforth_iram))) + curtask_idx); break; case SKIP_IF_ZERO: r1 = dpop(); r2 = dpop(); if (r2 == 0) wd_idx += r1; break; case DROP: dpop(); break; case JMP: wd_idx = dpop(); break; case JMP_IF_ZERO: r1 = dpop(); r2 = dpop(); if (r2 == 0) wd_idx = r1; break; case HERE: dpush(dict_here()); break; case INCR_HERE: dict_incr_here(1); break; case LIT: dpush(uforth_dict[wd_idx++]); break; case DLIT: dpush((((uint32_t)uforth_dict[wd_idx])<<16) | (uint16_t)uforth_dict[wd_idx+1]); wd_idx+=2; break; case LESS_THAN: r1 = dpop(); r2 = dpop(); dpush(r2 < r1); break; case ABS: r1 = dpop(); dpush(abs32(r1)); break; case ADD: r1 = dpop(); r2 = dtop(); dtop() = r1+r2; break; case SUB: r1 = dpop(); r2 = dtop(); dtop() = r2-r1; break; case AND: r1 = dpop(); r2 = dtop(); dtop() = r1&r2; break; case LSHIFT: r1 = dpop(); r2 = dtop(); dtop() = r2<<r1; break; case RSHIFT: r1 = dpop(); r2 = dtop(); dtop() = r2>>r1; break; case OR: r1 = dpop(); r2 = dtop(); dtop() = r1|r2; break; case XOR: r1 = dpop(); r2 = dtop(); dtop() = r1^r2; break; case INVERT: dtop() = ~dtop(); break; case MULT: r1 = dpop(); r2 = dtop(); dtop() = r1*r2; break; case DIV : r1 = dpop(); r2 = dtop(); dtop() = r2/r1; break; case SWAP: r1 = dpop(); r2 = dpop(); dpush(r1); dpush(r2); break; case RPICK: r1 = dpop(); r2 = rpick(r1); dpush(r2); break; case PICK: r1 = dpop(); r2 = dpick(r1); dpush(r2); break; case EQ_ZERO: dtop() = (dtop() == 0); break; case RPUSH: rpush(dpop()); break; case RPOP: dpush(rpop()); break; case FETCH: r1 = dpop(); if (r1 >= RAM_START_IDX) { dpush(uforth_ram[r1-RAM_START_IDX]); } else { dpush(uforth_dict[r1]); } break; case STORE: r1 = dpop(); r2 = dpop(); if (r1 >= RAM_START_IDX) { uforth_ram[r1-RAM_START_IDX] = r2; } else { dict_write(r1,r2); } break; case EXEC: r1 = dpop(); rpush(wd_idx); wd_idx = r1; break; case EXIT: if (uforth_uram->ridx > last_exec_rdix) return OK; wd_idx = rpop(); break; case CNEXT: b = next_char(); dpush(b); break; case STR_STORE: r1 = dpop(); r2 = uforth_ram[(r1-RAM_START_IDX)]; str1 =(char*)&uforth_ram[(r1-RAM_START_IDX)+1]; str1+=r2; b = dpop(); *str1 = b; uforth_ram[(r1-RAM_START_IDX)]++; break; case NEXT: str2 = PAD_STR; str1 = uforth_next_word(); memcpy(str2,str1, uforth_iram->currwordlen); PAD_STRLEN = uforth_iram->currwordlen; /* length */ dpush(PAD_ADDR+RAM_START_IDX); break; case COMMA_STRING: if (uforth_iram->compiling > 0) { dict_append(LIT); dict_append(dict_here()+4); /* address of counted string */ dict_append(LIT); rpush(dict_here()); /* address holding adress */ dict_incr_here(1); /* place holder for jump address */ dict_append(JMP); } rpush(dict_here()); dict_incr_here(1); /* place holder for count*/ r1 = 0; b = next_char(); /* eat space */ while (b != 0 && b!= '"') { r2 = 0; b = next_char(); if (b == 0 || b == '"') break; r2 |= BYTEPACK_FIRST(b); ++r1; b = next_char(); if (b != 0 && b != '"') { ++r1; r2 |= BYTEPACK_SECOND(b); } dict_append(r2); } dict_write(rpop(),r1); if (uforth_iram->compiling > 0) { dict_write(rpop(),dict_here()); /* jump over string */ } break; case CALLC: r1 = c_handle(); if (r1 != OK) return (uforth_stat)r1; break; case VAR_ALLOT: dpush(VAR_ALLOT_1()); break; case DEF: uforth_iram->compiling = 1; case _CREATE: dict_start_def(); uforth_next_word(); make_word(uforth_iram->currword,uforth_iram->currwordlen); if (cmd == _CREATE) { dict_end_def(); } else { defining_word = dict_here(); } break; case COMMA: dict_append(dpop()); break; case DCOMMA: r1 = dpop(); dict_append((uint32_t)r1>>16); dict_append(r1); break; case PARSE_NUM: r1 = dpop(); str1=uforth_count_str((CELL)r1,(CELL*)&r1); str1[r1] = '\0'; dpush(parse_num(str1,uforth_uram->base)); break; case PARSE_FNUM: r1 = dpop(); str1=uforth_count_str((CELL)r1,(CELL*)&r1); str1[r1] = '.'; str1[r1+1] = '\0'; dpush(parse_num(str1,uforth_uram->base)); break; case FIND: case FIND_ADDR: r1 = dpop(); str1=uforth_count_str((CELL)r1,(CELL*)&r1); r1 = find_word(str1, r1, &r2, 0, &b); if (r1 > 0) { if (b) r1 = uforth_dict[r1]; } if (cmd == FIND) { dpush(r1); } else { dpush(r2); } break; case POSTPONE: str1 = uforth_next_word(); r1 = find_word(str1, uforth_iram->currwordlen, 0, 0, &b); if (r1 == 0) { uforth_abort_request(ABORT_NAW); uforth_abort(); return E_NOT_A_WORD; } if (b) { dict_append(uforth_dict[r1]); } else { dict_append(r1); } break; case MOVE: r1 = dpop(); /* count */ rpush(r1); r1 = dpop(); /* dest */ r2 = dpop(); /* source */ if (r1 < RAM_START_IDX) { (void)rpop(); uforth_abort_request(ABORT_ILLEGAL); uforth_abort(); /* can't cmove into dictionary */ return E_ABORT; } str1 =(char*)&uforth_ram[(r1-RAM_START_IDX)]; if (r2 > RAM_START_IDX) { str2 =(char*)&uforth_ram[(r2-RAM_START_IDX)]; } else { str2 = (char*)&uforth_dict[r2]; } memcpy(str1, str2, rpop()); break; case MAKE_TASK: r1 = dpop(); r2 = dpop(); r3 = dpop(); r4 = dpop(); uforth_make_task(r1-RAM_START_IDX, r2, r3, r4); dpush(r1-RAM_START_IDX); break; case SELECT_TASK: uforth_select_task(dpop()); break; default: /* Execute user word by calling until we reach primitives */ rpush(wd_idx); wd_idx = uforth_dict[wd_idx-1]; /* wd_idx-1 is current word */ break; } if (uforth_aborting()) { uforth_abort(); return E_ABORT; } if (toplevelprim) return OK; } /* while(1) */ }