int MFdfs(int u, int t, int f) { if (u == t) return f; for(int &i = curAdj[u]; i < SZ(adj[u]); ++i) { int ar = adj[u][i], v = dest[ar]; if (d[v] != d[u]+1 || capres(ar) == 0) continue; int tmpF = MFdfs(v, t, min(f, capres(ar))); if (tmpF) { flow[ar] += tmpF; flow[inv(ar)] -= tmpF; return tmpF; } } return 0; }
void *qalloc(qarena_t *arena, unsigned size) { void *p = arena+1; void *end = (char *)arena + arena->size; void *n = NULL; size = RNDSZ(size); while (p && p < end) { if (!ISFREE(p) || BSZ(p) < size) { p = NX(p); continue; } if (BSZ(p) > size) { n = (char*)p + size; SZ(n) = SZ(p) - size; SZ(p) = size; } ALLOC(p); return UPTR(p); } return NULL; }
/***************************************************************************** DestroySession *****************************************************************************/ APIERR DestroySession( const TCHAR * pszServer ) { APIERR err; TCHAR szShare[MAX_PATH]; strcpyf( szShare, pszServer ); strcatf( szShare, SZ("\\IPC$") ); err = NetUseDel( NULL, (LPTSTR)szShare, USE_NOFORCE ); return err; } // DestroySession
/********************************************************************* * * Function : create_pattern_spec * * Description : Creates a "pattern_spec" structure from a string. * When finished, free with free_pattern_spec(). * * Parameters : * 1 : pattern = Target pattern_spec to be filled in. * Will be zeroed before use. * 2 : buf = Source pattern, null terminated. NOTE: The * contents of this buffer are destroyed by this * function. If this function succeeds, the * buffer is copied to pattern->spec. If this * function fails, the contents of the buffer * are lost forever. * * Returns : JB_ERR_OK - Success * JB_ERR_PARSE - Cannot parse regex (Detailed message * written to system log) * *********************************************************************/ jb_err create_pattern_spec(struct pattern_spec *pattern, char *buf) { static const struct { /** The tag pattern prefix to match */ const char *prefix; /** The length of the prefix to match */ const size_t prefix_length; /** The pattern flag */ const unsigned flag; } tag_pattern[] = { { "TAG:", 4, PATTERN_SPEC_TAG_PATTERN}, { "NO-REQUEST-TAG:", 15, PATTERN_SPEC_NO_REQUEST_TAG_PATTERN}, { "NO-RESPONSE-TAG:", 16, PATTERN_SPEC_NO_RESPONSE_TAG_PATTERN} }; int i; assert(pattern); assert(buf); memset(pattern, '\0', sizeof(*pattern)); /* Remember the original specification for the CGI pages. */ pattern->spec = strdup_or_die(buf); /* Check if it's a tag pattern */ for (i = 0; i < SZ(tag_pattern); i++) { if (0 == strncmpic(pattern->spec, tag_pattern[i].prefix, tag_pattern[i].prefix_length)) { /* The regex starts after the prefix */ const char *tag_regex = buf + tag_pattern[i].prefix_length; pattern->flags |= tag_pattern[i].flag; return compile_pattern(tag_regex, NO_ANCHORING, pattern, &pattern->pattern.tag_regex); } } /* If it isn't a tag pattern it must be an URL pattern. */ pattern->flags |= PATTERN_SPEC_URL_PATTERN; return compile_url_pattern(pattern, buf); }
void get_prime() { V.clear(); memset(flag, 0, sizeof(flag)); for (int i = 2; i < n; ++ i) { if (! flag[i]) V.push_back(i); for (int k = 0; k < SZ(V) && i * V[k] < n; ++ k) { flag[i * V[k]] = 1; if (i % V[k] == 0) break; } } }
void step(int x){ VPII pom; //znajdujemy widoczne sciany REP(i,SZ(v)){ POINT3D normal=((p[v[i].t[1]]-p[v[i].t[0]])^(p[v[i].t[2]]-p[v[i].t[0]])); LL il=(normal*(p[x]-p[v[i].t[0]])); vis[i]=0; if (il>0) vis[i]=1; else if (il==0){ if ((normal*((p[v[i].t[1]]-p[v[i].t[0]])^(p[x]-p[v[i].t[0]]))>=0 && normal*((p[v[i].t[2]]-p[v[i].t[1]])^(p[x]-p[v[i].t[1]]))>=0 && normal*((p[v[i].t[0]]-p[v[i].t[2]])^(p[x]-p[v[i].t[2]]))>=0)) return; /*ODKOMENTUJ*/ vis[i]=1; } }
/********************************************************************* * * Function : unknown_method * * Description : Checks whether a method is unknown. * * Parameters : * 1 : method = points to a http method * * Returns : TRUE if it's unknown, FALSE otherwise. * *********************************************************************/ static int unknown_method(const char *method) { static const char * const known_http_methods[] = { /* Basic HTTP request type */ "GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS", "TRACE", "CONNECT", /* webDAV extensions (RFC2518) */ "PROPFIND", "PROPPATCH", "MOVE", "COPY", "MKCOL", "LOCK", "UNLOCK", /* * Microsoft webDAV extension for Exchange 2000. See: * http://lists.w3.org/Archives/Public/w3c-dist-auth/2002JanMar/0001.html * http://msdn.microsoft.com/library/en-us/wss/wss/_webdav_methods.asp */ "BCOPY", "BMOVE", "BDELETE", "BPROPFIND", "BPROPPATCH", /* * Another Microsoft webDAV extension for Exchange 2000. See: * http://systems.cs.colorado.edu/grunwald/MobileComputing/Papers/draft-cohen-gena-p-base-00.txt * http://lists.w3.org/Archives/Public/w3c-dist-auth/2002JanMar/0001.html * http://msdn.microsoft.com/library/en-us/wss/wss/_webdav_methods.asp */ "SUBSCRIBE", "UNSUBSCRIBE", "NOTIFY", "POLL", /* * Yet another WebDAV extension, this time for * Web Distributed Authoring and Versioning (RFC3253) */ "VERSION-CONTROL", "REPORT", "CHECKOUT", "CHECKIN", "UNCHECKOUT", "MKWORKSPACE", "UPDATE", "LABEL", "MERGE", "BASELINE-CONTROL", "MKACTIVITY", /* * The PATCH method is defined by RFC5789, the format of the * actual patch in the body depends on the application, but from * Privoxy's point of view it doesn't matter. */ "PATCH", }; int i; for (i = 0; i < SZ(known_http_methods); i++) { if (0 == strcmpic(method, known_http_methods[i])) { return FALSE; } } return TRUE; }
int MST() { int i,u,v;int cnt=0; for(i=1;i<=N;i++) Make_set(i); for(i=0;i<SZ(node);i++) { u=node[i].sc.fs; v=node[i].sc.sc; if(Find_set(u)!=Find_set(v)) { Link(u,v); E_count++; cnt+=node[i].fs; } } return cnt; }
/***************************************************************************** SetupNormalSession *****************************************************************************/ APIERR SetupNormalSession( const TCHAR * pszServer ) { APIERR err; TCHAR szShare[MAX_PATH]; USE_INFO_1 ui1; strcpyf( szShare, pszServer ); strcatf( szShare, SZ("\\IPC$") ); ui1.ui1_local = NULL; ui1.ui1_remote = (LPTSTR)szShare; ui1.ui1_password = NULL; ui1.ui1_asg_type = USE_IPC; err = NetUseAdd( NULL, 1, (LPBYTE)&ui1, NULL ); return err; } // SetupNormalSession
struct url_spec dsplit(char *domain) { struct url_spec ret[1]; char *v[BUFSIZ]; int size; char *p; memset(ret, '\0', sizeof(*ret)); if((p = strrchr(domain, '.'))) { if(*(++p) == '\0') { ret->toplevel = 1; } } ret->dbuf = strdup(domain); /* map to lower case */ for(p = ret->dbuf; *p ; p++) *p = tolower(*p); /* split the domain name into components */ ret->dcnt = ssplit(ret->dbuf, ".", v, SZ(v), 1, 1); if(ret->dcnt <= 0) { memset(ret, '\0', sizeof(ret)); return(*ret); } /* save a copy of the pointers in dvec */ size = ret->dcnt * sizeof(*ret->dvec); if((ret->dvec = malloc(size))) { memcpy(ret->dvec, v, size); } return(*ret); }
/********************************************************************* * * Function : init_domain_components * * Description : Splits the domain name so we can compare it * against wildcards. It used to be part of * parse_http_url, but was separated because the * same code is required in chat in case of * intercepted requests. * * Parameters : * 1 : http = pointer to the http structure to hold elements. * * Returns : JB_ERR_OK on success * JB_ERR_PARSE on malformed command/URL * or >100 domains deep. * *********************************************************************/ jb_err init_domain_components(struct http_request *http) { char *vec[BUFFER_SIZE]; size_t size; char *p; http->dbuffer = strdup_or_die(http->host); /* map to lower case */ for (p = http->dbuffer; *p ; p++) { *p = (char)privoxy_tolower(*p); } /* split the domain name into components */ http->dcount = ssplit(http->dbuffer, ".", vec, SZ(vec)); if (http->dcount <= 0) { /* * Error: More than SZ(vec) components in domain * or: no components in domain */ log_error(LOG_LEVEL_ERROR, "More than SZ(vec) components in domain or none at all."); return JB_ERR_PARSE; } /* save a copy of the pointers in dvec */ size = (size_t)http->dcount * sizeof(*http->dvec); http->dvec = malloc_or_die(size); memcpy(http->dvec, vec, size); return JB_ERR_OK; }
/***************************************************************************** SetupNullSession *****************************************************************************/ APIERR SetupNullSession( const TCHAR * pszServer ) { APIERR err; TCHAR szShare[MAX_PATH]; USE_INFO_2 ui2; strcpyf( szShare, pszServer ); strcatf( szShare, SZ("\\IPC$") ); ui2.ui2_local = NULL; ui2.ui2_remote = (LPTSTR)szShare; ui2.ui2_password = (LPTSTR)L""; ui2.ui2_asg_type = USE_IPC; ui2.ui2_username = (LPTSTR)L""; ui2.ui2_domainname = (LPTSTR)L""; err = NetUseAdd( NULL, 2, (LPBYTE)&ui2, NULL ); return err; } // SetupNullSession
void maktab(void) /* define the tab stops of the table */ { int icol, ilin, tsep, k, ik, vforml, il, s, text; char *ss; for (icol = 0; icol < ncol; icol++) { doubled[icol] = acase[icol] = 0; Bprint(&tabout, ".nr %2s 0\n", reg(icol, CRIGHT)); for (text = 0; text < 2; text++) { if (text) Bprint(&tabout, ".%2s\n.rm %2s\n", reg(icol, CRIGHT), reg(icol, CRIGHT)); for (ilin = 0; ilin < nlin; ilin++) { if (instead[ilin] || fullbot[ilin]) continue; vforml = ilin; for (il = prev(ilin); il >= 0 && vspen(table[il][icol].col); il = prev(il)) vforml = il; if (fspan(vforml, icol)) continue; if (filler(table[ilin][icol].col)) continue; if ((flags[icol][stynum[ilin]] & ZEROW) != 0) continue; switch (ctype(vforml, icol)) { case 'a': acase[icol] = 1; ss = table[ilin][icol].col; s = (int)(uintptr)ss; if (s > 0 && s < 128 && text) { if (doubled[icol] == 0) Bprint(&tabout, ".nr %d 0\n.nr %d 0\n", S1, S2); doubled[icol] = 1; Bprint(&tabout, ".if \\n(%c->\\n(%d .nr %d \\n(%c-\n", s, S2, S2, (int)s); } case 'n': if (table[ilin][icol].rcol != 0) { if (doubled[icol] == 0 && text == 0) Bprint(&tabout, ".nr %d 0\n.nr %d 0\n", S1, S2); doubled[icol] = 1; if (real(ss = table[ilin][icol].col) && !vspen(ss)) { s = (int)(uintptr)ss; if (tx(s) != text) continue; Bprint(&tabout, ".nr %d ", TMP); wide(ss, FN(vforml, icol), SZ(vforml, icol)); Bprint(&tabout, "\n"); Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S1, TMP, S1, TMP); } if (text == 0 && real(ss = table[ilin][icol].rcol) && !vspen(ss) && !barent(ss)) { Bprint(&tabout, ".nr %d \\w%c%s%c\n", TMP, F1, ss, F1); Bprint(&tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S2, TMP, S2, TMP); } continue; } case 'r': case 'c': case 'l': if (real(ss = table[ilin][icol].col) && !vspen(ss)) { s = (int)(uintptr)ss; if (tx(s) != text) continue; Bprint(&tabout, ".nr %d ", TMP); wide(ss, FN(vforml, icol), SZ(vforml, icol)); Bprint(&tabout, "\n"); Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP); } } } } if (acase[icol]) { Bprint(&tabout, ".if \\n(%d>=\\n(%2s .nr %2s \\n(%du+2n\n", S2, reg(icol, CRIGHT), reg(icol, CRIGHT), S2); } if (doubled[icol]) { Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CMID), S1); Bprint(&tabout, ".nr %d \\n(%2s+\\n(%d\n", TMP, reg(icol, CMID), S2); Bprint(&tabout, ".if \\n(%d>\\n(%2s .nr %2s \\n(%d\n", TMP, reg(icol, CRIGHT), reg(icol, CRIGHT), TMP); Bprint(&tabout, ".if \\n(%d<\\n(%2s .nr %2s +(\\n(%2s-\\n(%d)/2\n", TMP, reg(icol, CRIGHT), reg(icol, CMID), reg(icol, CRIGHT), TMP); } if (cll[icol][0]) { Bprint(&tabout, ".nr %d %sn\n", TMP, cll[icol]); Bprint(&tabout, ".if \\n(%2s<\\n(%d .nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP, reg(icol, CRIGHT), TMP); } for (ilin = 0; ilin < nlin; ilin++) if (k = lspan(ilin, icol)) { ss = table[ilin][icol-k].col; if (!real(ss) || barent(ss) || vspen(ss) ) continue; Bprint(&tabout, ".nr %d ", TMP); wide(table[ilin][icol-k].col, FN(ilin, icol - k), SZ(ilin, icol - k)); for (ik = k; ik >= 0; ik--) { Bprint(&tabout, "-\\n(%2s", reg(icol - ik, CRIGHT)); if (!expflg && ik > 0) Bprint(&tabout, "-%dn", sep[icol-ik]); } Bprint(&tabout, "\n"); Bprint(&tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP, TMP, TMP, k); Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP); for (ik = 1; ik <= k; ik++) { if (doubled[icol-k+ik]) Bprint(&tabout, ".nr %2s +\\n(%d/2\n", reg(icol - k + ik, CMID), TMP); Bprint(&tabout, ".nr %2s +\\n(%d\n", reg(icol - k + ik, CRIGHT), TMP); } } } if (textflg) untext(); /* if even requested, make all columns widest width */ if (evenflg) { Bprint(&tabout, ".nr %d 0\n", TMP); for (icol = 0; icol < ncol; icol++) { if (evenup[icol] == 0) continue; Bprint(&tabout, ".if \\n(%2s>\\n(%d .nr %d \\n(%2s\n", reg(icol, CRIGHT), TMP, TMP, reg(icol, CRIGHT)); } for (icol = 0; icol < ncol; icol++) { if (evenup[icol] == 0) /* if column not evened just retain old interval */ continue; if (doubled[icol]) Bprint(&tabout, ".nr %2s (100*\\n(%2s/\\n(%2s)*\\n(%d/100\n", reg(icol, CMID), reg(icol, CMID), reg(icol, CRIGHT), TMP); /* that nonsense with the 100's and parens tries to avoid overflow while proportionally shifting the middle of the number */ Bprint(&tabout, ".nr %2s \\n(%d\n", reg(icol, CRIGHT), TMP); } } /* now adjust for total table width */ for (tsep = icol = 0; icol < ncol; icol++) tsep += sep[icol]; if (expflg) { Bprint(&tabout, ".nr %d 0", TMP); for (icol = 0; icol < ncol; icol++) Bprint(&tabout, "+\\n(%2s", reg(icol, CRIGHT)); Bprint(&tabout, "\n"); Bprint(&tabout, ".nr %d \\n(.l-\\n(%d\n", TMP, TMP); if (boxflg || dboxflg || allflg) /* tsep += 1; */ {} else tsep -= sep[ncol-1]; Bprint(&tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep); Bprint(&tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP); } else Bprint(&tabout, ".nr %d 1n\n", TMP); Bprint(&tabout, ".nr %2s 0\n", reg(-1, CRIGHT)); tsep = (boxflg || allflg || dboxflg || left1flg) ? 2 : 0; if (sep[-1] >= 0) tsep = sep[-1]; for (icol = 0; icol < ncol; icol++) { Bprint(&tabout, ".nr %2s \\n(%2s+((%d*\\n(%d)/2)\n", reg(icol, CLEFT), reg(icol - 1, CRIGHT), tsep, TMP); Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CRIGHT), reg(icol, CLEFT)); if (doubled[icol]) { /* the next line is last-ditch effort to avoid zero field width */ /*Bprint(&tabout, ".if \\n(%2s=0 .nr %2s 1\n",reg(icol,CMID), reg(icol,CMID));*/ Bprint(&tabout, ".nr %2s +\\n(%2s\n", reg(icol, CMID), reg(icol, CLEFT)); /* Bprint(&tabout, ".if n .if \\n(%s%%24>0 .nr %s +12u\n",reg(icol,CMID), reg(icol,CMID)); */ } tsep = sep[icol] * 2; } if (rightl) Bprint(&tabout, ".nr %s (\\n(%s+\\n(%s)/2\n", reg(ncol - 1, CRIGHT), reg(ncol - 1, CLEFT), reg(ncol - 2, CRIGHT)); Bprint(&tabout, ".nr TW \\n(%2s\n", reg(ncol - 1, CRIGHT)); tsep = sep[ncol-1]; if (boxflg || allflg || dboxflg) Bprint(&tabout, ".nr TW +((%d*\\n(%d)/2)\n", tsep, TMP); Bprint(&tabout, ".if t .if (\\n(TW>\\n(.l .tm Table at line %d file %s is too wide - \\n(TW units\n", iline - 1, ifile); /* * Used to be: ".if t .if (\\n(TW+\\n(.o)>7.65i .tm Table at line %d file %s is too wide - \\n(TW units\n", iline - 1, ifile); * but that gives warnings where none are necessary (or desired) [sape] */ }
static void source_fetch_file(const char *fil, const char *filname) { FILE *f; char buf[16 * 1024], *dir = NULL; long sz; size_t tmp; ssize_t dir_len = 0; SrcFile *sf; f = fopen(fil, "rb"); if (!f) { ERR("Cannot open file '%s'", fil); exit(-1); } fseek(f, 0, SEEK_END); sz = ftell(f); fseek(f, 0, SEEK_SET); sf = mem_alloc(SZ(SrcFile)); sf->name = mem_strdup(filname); sf->file = mem_alloc(sz + 1); if (sz > 0) { tmp = fread(sf->file, sz, 1, f); if (tmp != 1) { ERR("file length for (%s) doesn't match!", filname); exit(-1); } } sf->file[sz] = '\0'; fseek(f, 0, SEEK_SET); srcfiles.list = eina_list_append(srcfiles.list, sf); while (fgets(buf, sizeof(buf), f)) { char *p, *pp; int got_hash = 0; int forgetit = 0; int haveinclude = 0; char *file = NULL, *fname = NULL; p = buf; while ((!forgetit) && (*p)) { if (!got_hash) { if (!isspace(*p)) { if (*p == '#') got_hash = 1; else forgetit = 1; } p++; } if (!haveinclude) { if (!isspace(*p)) { if (!strncmp(p, "include", 7)) { haveinclude = 1; p += 7; } /* HACK! the logic above should be fixed so * preprocessor statements don't have to begin * in column 0. * otoh, edje_cc should print a warning in that case, * since according to the standard, preprocessor * statements need to be put in column 0. */ else if (!strncmp(p, "#include", 8)) { haveinclude = 1; p += 8; } else forgetit = 1; } } else { if (!isspace(*p)) { char end = '\0'; if (*p == '"') end = '"'; else if (*p == '<') end = '>'; if (end) { pp = strchr(p + 1, end); if (!pp) forgetit = 1; else { char *slash; ssize_t l = 0; /* get the directory of the current file * if we haven't already done so */ if ((!dir) && (strrchr(fil, '/'))) { dir = mem_strdup(fil); slash = strrchr(dir, '/'); *slash = '\0'; dir_len = strlen(dir); } l = pp - p + dir_len + 1; file = mem_alloc(l); if (!dir_len) { snprintf(file, l - 1, "%s", p + 1); file[l - 2] = 0; } else { snprintf(file, l, "%s/%s", dir, p + 1); file[l - 1] = 0; } fname = strdup(p + 1); pp = strrchr(fname, end); if (pp) *pp = 0; forgetit = 1; } } else forgetit = 1; } else p++; } got_hash = 0; } if ((file) && (fname)) { source_fetch_file(file, fname); free(file); free(fname); } } free(dir); fclose(f); }
{0x6D865ECD, 0, "sceUsbstorBootGetDataSize"}, {0xA1119F0D, 0, "sceUsbstorBootSetStatus"}, {0x1F080078, 0, "sceUsbstorBootRegisterNotify"}, {0xA55C9E16, 0, "sceUsbstorBootUnregisterNotify"}, }; const HLEFunction sceOpenPSID[] = { {0xc69bebce, 0, "sceOpenPSID_c69bebce"}, }; const HLEModule moduleList[] = { {"FakeSysCalls", SZ(FakeSysCalls), FakeSysCalls}, {"sceOpenPSID", SZ(sceOpenPSID), sceOpenPSID}, {"UtilsForUser",SZ(UtilsForUser),UtilsForUser}, {"KDebugForKernel",SZ(KDebugForKernel),KDebugForKernel}, {"sceParseUri"}, {"sceRtc",SZ(sceRtc),sceRtc}, {"sceSAScore"}, {"sceUsbstor",SZ(sceUsbstor),sceUsbstor}, {"sceUsbstorBoot",SZ(sceUsbstorBoot),sceUsbstorBoot}, {"sceUsb", SZ(sceUsb), sceUsb}, {"SceBase64_Library"}, {"sceCert_Loader"}, {"SceFont_Library"}, {"sceLibFont",SZ(sceLibFont),sceLibFont}, {"sceNetApctl"}, {"sceOpenPSID"},
/*************************************************************************** * GL-ELLIPSE-2D-ADD-ON ***************************************************************************/ GlEllipseAddOn::GlEllipseAddOn() : inherited(SZI[SZI_arp], GL_ELLIPSE_KEY, SZ(SZ_Shapes), SZ(SZ_Ellipse), 1, 0) { mX = AddParamType(new GlPointParamType('x_pt', SZ(SZ_X), SZ(SZ_Rel), SZ(SZ_Abs), BPoint(-10, -1000), BPoint(10, 1000), BPoint(DEF_REL_X, DEF_ABS_X), 0.1f)); mY = AddParamType(new GlPointParamType('y_pt', SZ(SZ_Y), SZ(SZ_Rel), SZ(SZ_Abs), BPoint(-10, -1000), BPoint(10, 1000), BPoint(DEF_REL_Y, DEF_ABS_Y), 0.1f)); mW = AddParamType(new GlPointParamType('w_pt', SZ(SZ_W), SZ(SZ_Rel), SZ(SZ_Abs), BPoint(-10, -1000), BPoint(10, 1000), BPoint(DEF_REL_W, DEF_ABS_W), 0.1f)); mH = AddParamType(new GlPointParamType('h_pt', SZ(SZ_H), SZ(SZ_Rel), SZ(SZ_Abs), BPoint(-10, -1000), BPoint(10, 1000), BPoint(DEF_REL_H, DEF_ABS_H), 0.1f)); }
/********************************************************************* * * Function : parse_http_request * * Description : Parse out the host and port from the URL. Find the * hostname & path, port (if ':'), and/or password (if '@') * * Parameters : * 1 : req = HTTP request line to break down * 2 : http = pointer to the http structure to hold elements * * Returns : JB_ERR_OK on success * JB_ERR_CGI_PARAMS on malformed command/URL * or >100 domains deep. * *********************************************************************/ jb_err parse_http_request(const char *req, struct http_request *http) { char *buf; char *v[3]; int n; jb_err err; memset(http, '\0', sizeof(*http)); buf = strdup_or_die(req); n = ssplit(buf, " \r\n", v, SZ(v)); if (n != 3) { freez(buf); return JB_ERR_PARSE; } /* * Fail in case of unknown methods * which we might not handle correctly. * * XXX: There should be a config option * to forward requests with unknown methods * anyway. Most of them don't need special * steps. */ if (unknown_method(v[0])) { log_error(LOG_LEVEL_ERROR, "Unknown HTTP method detected: %s", v[0]); freez(buf); return JB_ERR_PARSE; } if (JB_ERR_OK != normalize_http_version(v[2])) { freez(buf); return JB_ERR_PARSE; } http->ssl = !strcmpic(v[0], "CONNECT"); err = parse_http_url(v[1], http, !http->ssl); if (err) { freez(buf); return err; } /* * Copy the details into the structure */ http->cmd = strdup_or_die(req); http->gpc = strdup_or_die(v[0]); http->ver = strdup_or_die(v[2]); http->ocmd = strdup_or_die(http->cmd); freez(buf); return JB_ERR_OK; }
unsigned size; } MemBlk; typedef struct { unsigned userBytes; Header *h; } MAP; #define SZ(x) (sizeof(Header)*x) #define RND(n) (((n-1) / sizeof(Header)) + 1) * sizeof(Header); static MAP Map[] = { {SZ(1)}, {SZ(2)}, {SZ(4)}, {SZ(8)}, {SZ(16)}, {SZ(32)}, {SZ(64)}, {SZ(128)}, {SZ(256)}, {SZ(512)}, {SZ(1024)}, {SZ(2048)}, {0} };
static void pthreads_plot(void) { struct thread_info *tinfo; const char *sep = ""; size_t length = 0; param_t parms; uint8_t *u8; size_t tn; size_t y; size_t x; int n; memset(&parms, 0, sizeof(parms)); parms.UL_re = upper_left_re; parms.UL_im = upper_left_im; parms.LR_re = lower_right_re; parms.LR_im = lower_right_im; parms.d_re = (lower_right_re - upper_left_re) / x_res; parms.d_im = (upper_left_im - lower_right_im) / y_res; parms.x_res = x_res; parms.y_res = y_res; parms.shades = 255; parms.x0 = 0; parms.x1 = x_res; #ifndef SZ #define SZ(x) sizeof(x) #endif if ((parms.bitmap = u8 = malloc(SZ(uint8_t) * x_res * y_res)) == 0) { fprintf(stderr, "cannot allocate memory.\n"); exit(1); } if ((tinfo = malloc(SZ(struct thread_info) * nthreads)) == NULL) { fprintf(stderr, "cannot allocate memory.\n"); exit(1); } size_t x0 = 0; size_t xd = x_res / nthreads; for (tn = 0; tn < nthreads; ++tn) { memcpy(&tinfo[tn].parms, &parms, SZ(parms)); tinfo[tn].parms.x0 = x0; tinfo[tn].parms.x1 = (tn < (nthreads - 1)) ? (x0 = x0 + xd) : (x_res); if (pthread_create(&tinfo[tn].tid, NULL, (void *)plot, &tinfo[tn].parms) != 0) { fprintf(stderr, "cannot create thread.\n"); exit(1); } } for (tn = 0; tn < nthreads; ++tn) { if (pthread_join(tinfo[tn].tid, NULL) != 0) { fprintf(stderr, "cannot join thread.\n"); exit(1); } } /* Header PGM. */ fprintf(output, "P2\n"); fprintf(output, "%u\n", (unsigned)parms.x_res); fprintf(output, "%u\n", (unsigned)parms.y_res); fprintf(output, "%u\n", (unsigned)parms.shades); for (y = 0; y < parms.y_res; ++y) for (x = 0; x < parms.x_res; ++x) { /* * XXX Write this pixel. Try to detect stream errors as * soon as possible. Stick with the PGM recommendation * against lines longer than 70 chars. */ if ((n = fprintf(output, "%s%u", sep, (unsigned) *u8++)) < 0) { fprintf(stderr, "i/o error.\n"); exit(1); } if ((length += n) >= 65) { ASSERT(length < 70); if (fprintf(output, "\n") < 0) { fprintf(stderr, "i/o error.\n"); exit(1); } length = 0; sep = ""; } else { sep = " "; } } /* Flush any buffered information before quit. */ if (fflush(output) != 0) { fprintf(stderr, "cannot flush output file.\n"); exit(1); } /* Deallocate memory. */ if (parms.bitmap != NULL) free(parms.bitmap), parms.bitmap = NULL; }
static ZZ fact(int n) { while(factorial.size() <= n) factorial.push_back(factorial.back() * SZ(factorial)); return factorial.at(n); }
{0xA126F497, 0, "KDebugForKernel_A126F497"}, {0xB7251823, 0, "sceKernelAcceptMbogoSig"}, }; #define SZ(a) sizeof(a)/sizeof(HLEFunction) const HLEFunction pspeDebug[] = { {0xDEADBEAF, 0, "pspeDebugWrite"}, }; const HLEModule moduleList[] = { {"FakeSysCalls", SZ(FakeSysCalls), FakeSysCalls}, {"UtilsForUser",SZ(UtilsForUser),UtilsForUser}, {"KDebugForKernel",SZ(KDebugForKernel),KDebugForKernel}, {"sceSAScore"}, {"SceBase64_Library"}, {"sceCert_Loader"}, {"SceFont_Library"}, {"sceNetApctl"}, {"sceSIRCS_IrDA_Driver"}, {"Pspnet_Scan"}, {"Pspnet_Show_MacAddr"}, {"pspeDebug", SZ(pspeDebug), pspeDebug}, {"StdioForKernel", SZ(StdioForKernel), StdioForKernel}, {"LoadCoreForKernel", SZ(LoadCoreForKernel), LoadCoreForKernel}, {"IoFileMgrForKernel", SZ(IoFileMgrForKernel), IoFileMgrForKernel}, };
/*************************************************************************** * GL-REPLICATE ***************************************************************************/ GlReplicate::GlReplicate(const GlReplicateAddOn* addon, const BMessage* config) : inherited(addon, config), mAddOn(addon) { VerifyChain(new GlChain(_MAP_KEY, GL_1D_IO, SZ(SZ_Map), this)); }
default: if(isdigit(*fmt)) { const char *fw = fmt; while(*fmt && isdigit(*fmt)) fmt++; fwidth = atoi(fw); continue; } } fmt++; } } else { bwrite(BUF(buf), SZ(sz), (char*)fmt++, 1); cnum++; } } return 0; } /* bwrite is called by intern_printf to transparently handle writing into a * buffer (if buf is non-null) or to the terminal (if buf is null). */ static void bwrite(char *buf, size_t buf_sz, char *str, int sz) { if(buf) { if(buf_sz && buf_sz <= sz) sz = buf_sz - 1;
static int intern_printf(char *buf, size_t sz, const char *fmt, va_list ap) { char conv_buf[32]; char *str; int i, slen; const char *fstart = 0; /* state */ int cnum = 0; int base = 10; int alt = 0; int fwidth = 0; int padc = ' '; int sign = 0; int left_align = 0; /* not implemented yet */ int hex_caps = 0; int unsig = 0; while(*fmt) { if(*fmt == '%') { fstart = fmt++; continue; } if(fstart) { if(IS_CONV(*fmt)) { switch(*fmt) { case 'X': hex_caps = 1; case 'x': case 'p': base = 16; if(alt) { bwrite(BUF(buf), SZ(sz), "0x", 2); } case 'u': unsig = 1; if(0) { case 'o': base = 8; if(alt) { bwrite(BUF(buf), SZ(sz), "0", 1); } } case 'd': case 'i': if(unsig) { utoa(va_arg(ap, unsigned int), conv_buf, base); } else { itoa(va_arg(ap, int), conv_buf, base); } if(hex_caps) { for(i=0; conv_buf[i]; i++) { conv_buf[i] = toupper(conv_buf[i]); } } slen = strlen(conv_buf); for(i=slen; i<fwidth; i++) { bwrite(BUF(buf), SZ(sz), (char*)&padc, 1); cnum++; } bwrite(BUF(buf), SZ(sz), conv_buf, strlen(conv_buf)); cnum += slen; break; case 'c': { char c = va_arg(ap, int); bwrite(BUF(buf), SZ(sz), &c, 1); cnum++; } break; case 's': str = va_arg(ap, char*); slen = strlen(str); for(i=slen; i<fwidth; i++) { bwrite(BUF(buf), SZ(sz), (char*)&padc, 1); cnum++; } bwrite(BUF(buf), SZ(sz), str, slen); cnum += slen; break; case 'n': *va_arg(ap, int*) = cnum; break; default: break; } /* restore default conversion state */ base = 10; alt = 0; fwidth = 0; padc = ' '; hex_caps = 0; fstart = 0; fmt++; } else { switch(*fmt) { case '#': alt = 1; break; case '+': sign = 1; break; case '-': left_align = 1; break; case 'l': case 'L': break; case '0': padc = '0'; break; default: if(isdigit(*fmt)) { const char *fw = fmt; while(*fmt && isdigit(*fmt)) fmt++; fwidth = atoi(fw); continue; } } fmt++; } } else {
const field_t agf_hfld[] = { { "", FLDT_AGF, OI(0), C1, 0, TYP_NONE }, { NULL } }; #define OFF(f) bitize(offsetof(xfs_agf_t, agf_ ## f)) #define SZ(f) bitszof(xfs_agf_t, agf_ ## f) const field_t agf_flds[] = { { "magicnum", FLDT_UINT32X, OI(OFF(magicnum)), C1, 0, TYP_NONE }, { "versionnum", FLDT_UINT32D, OI(OFF(versionnum)), C1, 0, TYP_NONE }, { "seqno", FLDT_AGNUMBER, OI(OFF(seqno)), C1, 0, TYP_NONE }, { "length", FLDT_AGBLOCK, OI(OFF(length)), C1, 0, TYP_NONE }, { "roots", FLDT_AGBLOCK, OI(OFF(roots)), CI(XFS_BTNUM_AGF), FLD_ARRAY|FLD_SKIPALL, TYP_NONE }, { "bnoroot", FLDT_AGBLOCK, OI(OFF(roots) + XFS_BTNUM_BNO * SZ(roots[XFS_BTNUM_BNO])), C1, 0, TYP_BNOBT }, { "cntroot", FLDT_AGBLOCK, OI(OFF(roots) + XFS_BTNUM_CNT * SZ(roots[XFS_BTNUM_CNT])), C1, 0, TYP_CNTBT }, { "levels", FLDT_UINT32D, OI(OFF(levels)), CI(XFS_BTNUM_AGF), FLD_ARRAY|FLD_SKIPALL, TYP_NONE }, { "bnolevel", FLDT_UINT32D, OI(OFF(levels) + XFS_BTNUM_BNO * SZ(levels[XFS_BTNUM_BNO])), C1, 0, TYP_NONE }, { "cntlevel", FLDT_UINT32D, OI(OFF(levels) + XFS_BTNUM_CNT * SZ(levels[XFS_BTNUM_CNT])), C1, 0, TYP_NONE }, { "flfirst", FLDT_UINT32D, OI(OFF(flfirst)), C1, 0, TYP_NONE }, { "fllast", FLDT_UINT32D, OI(OFF(fllast)), C1, 0, TYP_NONE }, { "flcount", FLDT_UINT32D, OI(OFF(flcount)), C1, 0, TYP_NONE },
void cf_configuration::handle_config_cmd(char *cmd, const uint32_t &cmd_hash, char *arg, char *buf, const unsigned long &linenum) { char tmp[BUFFER_SIZE]; int vec_count; char *vec[4]; int port; std::vector<std::string> elts; std::string host, path, address, port_str; switch (cmd_hash) { case hash_domain_name_weight: _domain_name_weight = atof(arg); configuration_spec::html_table_row(_config_args,cmd,arg, "Weight given to the domain names in the simple filter"); break; case hash_record_cache_timeout: _record_cache_timeout = atoi(arg); configuration_spec::html_table_row(_config_args,cmd,arg, "Timeout on cached remote records, in seconds"); break; case hash_cf_peer: strlcpy(tmp,arg,sizeof(tmp)); vec_count = miscutil::ssplit(tmp," \t",vec,SZ(vec),1,1); div_t divresult; divresult = div(vec_count,2); if (divresult.rem != 0) { errlog::log_error(LOG_LEVEL_ERROR,"Wrong number of parameter when specifying static collaborative filtering peer"); break; } address = vec[0]; urlmatch::parse_url_host_and_path(address,host,path); miscutil::tokenize(host,elts,":"); port = -1; if (elts.size()>1) { host = elts.at(0); port = atoi(elts.at(1).c_str()); } port_str = (port != -1) ? ":" + miscutil::to_string(port) : ""; errlog::log_error(LOG_LEVEL_DEBUG,"adding peer %s%s%s with resource %s", host.c_str(),port_str.c_str(),path.c_str(),vec[1]); _pl->add(host,port,path,std::string(vec[1])); configuration_spec::html_table_row(_config_args,cmd,arg, "Remote peer address for collaborative filtering"); break; case hash_dead_peer_check: _dead_peer_check = atoi(arg); configuration_spec::html_table_row(_config_args,cmd,arg, "Interval of time between two dead peer checks"); break; case hash_dead_peer_retries: _dead_peer_retries = atoi(arg); configuration_spec::html_table_row(_config_args,cmd,arg, "Number of retries before marking a peer as dead"); break; case hash_post_url_check: _post_url_check = static_cast<bool>(atoi(arg)); configuration_spec::html_table_row(_config_args,cmd,arg, "Whether to ping and check on posted URLs"); break; case hash_post_radius: _post_radius = static_cast<bool>(atoi(arg)); configuration_spec::html_table_row(_config_args,cmd,arg, "Query similarity impact radius of posted URLs"); break; case hash_post_ua: _post_url_ua = std::string(arg); configuration_spec::html_table_row(_config_args,cmd,arg, "default 'user-agent' header used to retrieve posted URLs"); break; case hash_stop_words_filtering: _stop_words_filtering = static_cast<bool>(atoi(arg)); configuration_spec::html_table_row(_config_args,cmd,arg, "Whether to filter similar queries with stop words"); break; default: break; } }
void maktab(void) { # define FN(i,c) font[stynum[i]][c] # define SZ(i,c) csize[stynum[i]][c] /* define the tab stops of the table */ int icol, ilin, tsep, k, ik, vforml, il, text; int doubled[MAXCOL], acase[MAXCOL]; char *s; char space[40]; for(icol=0; icol <ncol; icol++) { doubled[icol] = acase[icol] = 0; fprintf(tabout, ".nr %d 0\n", icol+CRIGHT); for(text=0; text<2; text++) { if (text) { warnoff(); fprintf(tabout, ".%02d\n.rm %02d\n", icol+80, icol+80); warnon(); } for(ilin=0; ilin<nlin; ilin++) { if (instead[ilin]|| fullbot[ilin]) continue; vforml=ilin; for(il=prev(ilin); il>=0 && vspen(table[il][icol].col); il=prev(il)) vforml=il; if (fspan(vforml,icol)) continue; if (filler(table[ilin][icol].col)) continue; switch(ctype(vforml,icol)) { case 'a': acase[icol]=1; s = table[ilin][icol].col; if (tx(s) && text) { if (doubled[icol]==0) fprintf(tabout, ".nr %d 0\n.nr %d 0\n",S1,S2); doubled[icol]=1; nreg(space, sizeof(space), s, '-'); fprintf(tabout, ".if %s>\\n(%d .nr %d %s\n",space,S2,S2,space); } case 'n': if (table[ilin][icol].rcol!=0) { if (doubled[icol]==0 && text==0) fprintf(tabout, ".nr %d 0\n.nr %d 0\n", S1, S2); doubled[icol]=1; if (real(s=table[ilin][icol].col) && !vspen(s)) { if (tx(s) != text) continue; fprintf(tabout, ".nr %d ", TMP); wide(s, FN(vforml,icol), SZ(vforml,icol)); fprintf(tabout, "\n"); fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", S1, TMP, S1, TMP); } if (text==0 && real(s=table[ilin][icol].rcol) && !vspen(s) && !barent(s)) { fprintf(tabout, ".nr %d \\w%c%s%c\n",TMP, F1, s, F1); fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",S2,TMP,S2,TMP); } continue; } case 'r': case 'c': case 'l': if (real(s=table[ilin][icol].col) && !vspen(s)) { if (tx(s) != text) continue; fprintf(tabout, ".nr %d ", TMP); wide(s, FN(vforml,icol), SZ(vforml,icol)); fprintf(tabout, "\n"); fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n", icol+CRIGHT, TMP, icol+CRIGHT, TMP); } } } } if (acase[icol]) { fprintf(tabout, ".if \\n(%d>=\\n(%d .nr %d \\n(%du+2n\n",S2,icol+CRIGHT,icol+CRIGHT,S2); } if (doubled[icol]) { fprintf(tabout, ".nr %d \\n(%d\n", icol+CMID, S1); fprintf(tabout, ".nr %d \\n(%d+\\n(%d\n",TMP,icol+CMID,S2); fprintf(tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n",TMP,icol+CRIGHT,icol+CRIGHT,TMP); fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d +(\\n(%d-\\n(%d)/2\n",TMP,icol+CRIGHT,icol+CMID,icol+CRIGHT,TMP); } if (cll[icol][0]) { fprintf(tabout, ".nr %d %sn\n", TMP, cll[icol]); fprintf(tabout, ".if \\n(%d<\\n(%d .nr %d \\n(%d\n",icol+CRIGHT, TMP, icol+CRIGHT, TMP); } for(ilin=0; ilin<nlin; ilin++) if ((k=lspan(ilin, icol))) { s=table[ilin][icol-k].col; if (!real(s) || barent(s) || vspen(s) ) continue; fprintf(tabout, ".nr %d ", TMP); wide(table[ilin][icol-k].col, FN(ilin,icol-k), SZ(ilin,icol-k)); for(ik=k; ik>=0; ik--) { fprintf(tabout, "-\\n(%d",CRIGHT+icol-ik); if (!expflg && ik>0) fprintf(tabout, "-%dn", sep[icol-ik]); } fprintf(tabout, "\n"); fprintf(tabout, ".if \\n(%d>0 .nr %d \\n(%d/%d\n", TMP, TMP, TMP, k); fprintf(tabout, ".if \\n(%d<0 .nr %d 0\n", TMP, TMP); for(ik=0; ik<k; ik++) { if (doubled[icol-k+ik]) fprintf(tabout, ".nr %d +\\n(%d/2\n", icol-k+ik+CMID, TMP); fprintf(tabout, ".nr %d +\\n(%d\n", icol-k+ik+CRIGHT, TMP); } } } if (textflg) untext(); /* if even requested, make all columns widest width */ # define TMP1 S1 # define TMP2 S2 if (evenflg) { fprintf(tabout, ".nr %d 0\n", TMP); for(icol=0; icol<ncol; icol++) { if (evenup[icol]==0) continue; fprintf(tabout, ".if \\n(%d>\\n(%d .nr %d \\n(%d\n", icol+CRIGHT, TMP, TMP, icol+CRIGHT); } for(icol=0; icol<ncol; icol++) { if (evenup[icol]==0) /* if column not evened just retain old interval */ continue; if (doubled[icol]) fprintf(tabout, ".nr %d (100*\\n(%d/\\n(%d)*\\n(%d/100\n", icol+CMID, icol+CMID, icol+CRIGHT, TMP); /* that nonsense with the 100's and parens tries to avoid overflow while proportionally shifting the middle of the number */ fprintf(tabout, ".nr %d \\n(%d\n", icol+CRIGHT, TMP); } } /* now adjust for total table width */ for(tsep=icol=0; icol<ncol; icol++) tsep+= sep[icol]; if (expflg) { fprintf(tabout, ".nr %d 0", TMP); for(icol=0; icol<ncol; icol++) fprintf(tabout, "+\\n(%d", icol+CRIGHT); fprintf(tabout, "\n"); fprintf(tabout, ".nr %d \\n(.l-\\n(.i-\\n(%d%s\n", TMP, TMP, (utf8 || tlp) && (boxflg || dboxflg || allflg) ? "-1n" : ""); if (boxflg || dboxflg || allflg) tsep += 1; else tsep -= sep[ncol-1]; fprintf(tabout, ".nr %d \\n(%d/%d\n", TMP, TMP, tsep); fprintf(tabout, ".if \\n(%d<1n .nr %d 1n\n", TMP, TMP); } else if (xcolflg) { fprintf(tabout, ".nr %d 0", TMP); for(icol=0; icol<ncol; icol++) fprintf(tabout, "+\\n(%d", icol+CRIGHT); fprintf(tabout, "\n"); fprintf(tabout, ".nr %d \\n(.l-\\n(.i-\\n(%d-%dn/%d\n", TMP, TMP, tsep + ((boxflg || dboxflg || allflg) ? (utf8 || tlp) ? 2 : 1 : -1), xcolflg); for(icol=0; icol<ncol; icol++) { if (!xcol[icol]) continue; fprintf(tabout, ".nr %d +\\n(%d\n", icol+CRIGHT, TMP); } fprintf(tabout, ".nr %d 1n\n", TMP); } else fprintf(tabout, ".nr %d 1n\n", TMP); fprintf(tabout, ".nr %d 0\n",CRIGHT-1); tsep= (boxflg || allflg || dboxflg || left1flg) ? 1 : 0; for(icol=0; icol<ncol; icol++) { fprintf(tabout, ".nr %d \\n(%d+(%d*\\n(%d)\n",icol+CLEFT, icol+CRIGHT-1, tsep, TMP); fprintf(tabout, ".nr %d +\\n(%d\n",icol+CRIGHT, icol+CLEFT); if (doubled[icol]) { /* the next line is last-ditch effort to avoid zero field width */ /*fprintf(tabout, ".if \\n(%d=0 .nr %d 1\n",icol+CMID, icol+CMID);*/ fprintf(tabout, ".nr %d +\\n(%d\n", icol+CMID, icol+CLEFT); /* fprintf(tabout, ".if n .if \\n(%d%%24>0 .nr %d +12u\n",icol+CMID, icol+CMID); */ } tsep=sep[icol]; } if (rightl) fprintf(tabout, ".nr %d (\\n(%d+\\n(%d)/2\n",ncol+CRIGHT-1, ncol+CLEFT-1, ncol+CRIGHT-2); fprintf(tabout, ".nr TW \\n(%d\n", ncol+CRIGHT-1); if (boxflg || allflg || dboxflg) fprintf(tabout, ".nr TW +%d*\\n(%d\n", sep[ncol-1], TMP); fprintf(tabout, ".if t .if \\n(TW>\\n(.l .tm Table at line %d file %s is too wide - \\n(TW units\n", iline-1, ifile); return; }
int main(int argc, char **argv) { int i; struct stat st; #ifdef HAVE_REALPATH char rpath[PATH_MAX], rpath2[PATH_MAX]; #endif setlocale(LC_NUMERIC, "C"); ecore_app_no_system_modules(); if (!eina_init()) return -1; _edje_cc_log_dom = eina_log_domain_register ("edje_cc", EDJE_CC_DEFAULT_LOG_COLOR); if (_edje_cc_log_dom < 0) { EINA_LOG_ERR("Enable to create a log domain."); exit(-1); } if (!eina_log_domain_level_check(_edje_cc_log_dom, EINA_LOG_LEVEL_WARN)) eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_WARN); progname = ecore_file_file_get(argv[0]); eina_log_print_cb_set(_edje_cc_log_cb, NULL); tmp_dir = getenv("TMPDIR"); img_dirs = eina_list_append(img_dirs, "."); /* add defines to epp so edc files can detect edje_cc version */ defines = eina_list_append(defines, mem_strdup("-DEDJE_VERSION_12=12")); for (i = 1; i < argc; i++) { if (!strcmp(argv[i], "-h")) { main_help(); exit(0); } else if ((!strcmp(argv[i], "-V")) || (!strcmp(argv[i], "--version"))) { printf("Version: %s\n", PACKAGE_VERSION); exit(0); } else if (!strcmp(argv[i], "-v")) { eina_log_domain_level_set("edje_cc", EINA_LOG_LEVEL_INFO); } else if (!strcmp(argv[i], "-no-lossy")) { no_lossy = 1; } else if (!strcmp(argv[i], "-no-comp")) { no_comp = 1; } else if (!strcmp(argv[i], "-no-raw")) { no_raw = 1; } else if (!strcmp(argv[i], "-no-etc1")) { no_etc1 = 1; } else if (!strcmp(argv[i], "-no-etc2")) { no_etc2 = 1; } else if (!strcmp(argv[i], "-no-save")) { no_save = 1; } else if ((!strcmp(argv[i], "-id") || !strcmp(argv[i], "--image_dir")) && (i < (argc - 1))) { i++; img_dirs = eina_list_append(img_dirs, argv[i]); } else if ((!strcmp(argv[i], "-fd") || !strcmp(argv[i], "--font_dir")) && (i < (argc - 1))) { i++; fnt_dirs = eina_list_append(fnt_dirs, argv[i]); } else if ((!strcmp(argv[i], "-sd") || !strcmp(argv[i], "--sound_dir")) && (i < (argc - 1))) { i++; snd_dirs = eina_list_append(snd_dirs, argv[i]); } else if ((!strcmp(argv[i], "-md") || !strcmp(argv[i], "--mo_dir")) && (i < (argc - 1))) { i++; mo_dirs = eina_list_append(mo_dirs, argv[i]); } else if ((!strcmp(argv[i], "-vd") || !strcmp(argv[i], "--vibration_dir")) && (i < (argc - 1))) { i++; vibration_dirs = eina_list_append(vibration_dirs, argv[i]); } else if ((!strcmp(argv[i], "-dd") || !strcmp(argv[i], "--data_dir")) && (i < (argc - 1))) { i++; data_dirs = eina_list_append(data_dirs, argv[i]); } else if ((!strcmp(argv[i], "-td") || !strcmp(argv[i], "--tmp_dir")) && (i < (argc - 1))) { i++; if (!tmp_dir) tmp_dir = argv[i]; } else if ((!strcmp(argv[i], "-l") || !strcmp(argv[i], "--license")) && (i < (argc - 1))) { i++; if (!license) license = argv[i]; else licenses = eina_list_append(licenses, argv[i]); } else if ((!strcmp(argv[i], "-a") || !strcmp(argv[i], "--authors")) && (i < (argc - 1))) { i++; if (!authors) authors = argv[i]; } else if ((!strcmp(argv[i], "-min-quality")) && (i < (argc - 1))) { i++; min_quality = atoi(argv[i]); if (min_quality < 0) min_quality = 0; if (min_quality > 100) min_quality = 100; } else if ((!strcmp(argv[i], "-max-quality")) && (i < (argc - 1))) { i++; max_quality = atoi(argv[i]); if (max_quality < 0) max_quality = 0; if (max_quality > 100) max_quality = 100; } else if (!strcmp(argv[i], "-fastcomp")) { compress_mode = EET_COMPRESSION_SUPERFAST; } else if (!strcmp(argv[i], "-fastdecomp")) { compress_mode = EET_COMPRESSION_VERYFAST; } else if (!strcmp(argv[i], "-threads")) { threads = 1; } else if (!strcmp(argv[i], "-nothreads")) { threads = 0; } else if (!strncmp(argv[i], "-D", 2)) { defines = eina_list_append(defines, mem_strdup(argv[i])); } else if ((!strcmp(argv[i], "-o")) && (i < (argc - 1))) { i++; file_out = argv[i]; } else if ((!strcmp(argv[i], "-w")) && (i < (argc - 1))) { i++; watchfile = argv[i]; unlink(watchfile); } else if (!strcmp(argv[i], "-annotate")) { annotate = 1; } else if ((!strcmp(argv[i], "-deps")) && (i < (argc - 1))) { i++; depfile = argv[i]; unlink(depfile); } else if (!file_in) file_in = argv[i]; else if (!file_out) file_out = argv[i]; } if (!file_in) { ERR("no input file specified."); main_help(); exit(-1); } pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */ main, /* an optional symbol to check path of */ "EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */ "edje", /* dir to add after "share" (PREFIX/share/DIRNAME) */ "include/edje.inc", /* a magic file to check for in PREFIX/share/DIRNAME for success */ PACKAGE_BIN_DIR, /* package bin dir @ compile time */ PACKAGE_LIB_DIR, /* package lib dir @ compile time */ PACKAGE_DATA_DIR, /* package data dir @ compile time */ PACKAGE_DATA_DIR /* if locale needed use LOCALE_DIR */ ); /* check whether file_in exists */ #ifdef HAVE_REALPATH if (!realpath(file_in, rpath) || stat(rpath, &st) || !S_ISREG(st.st_mode)) #else if (stat(file_in, &st) || !S_ISREG(st.st_mode)) #endif { ERR("file not found: %s.", file_in); main_help(); exit(-1); } if (!file_out) { char *suffix; if ((suffix = strstr(file_in,".edc")) && (suffix[4] == 0)) { file_out = strdup(file_in); if (file_out) { suffix = strstr(file_out,".edc"); strcpy(suffix,".edj"); } } } if (!file_out) { ERR("no output file specified."); main_help(); exit(-1); } #ifdef HAVE_REALPATH if (realpath(file_out, rpath2) && !strcmp (rpath, rpath2)) #else if (!strcmp (file_in, file_out)) #endif { ERR("input file equals output file."); main_help(); exit(-1); } using_file(file_in, 'E'); if (annotate) using_file(file_out, 'O'); if (!edje_init()) exit(-1); edje_file = mem_alloc(SZ(Edje_File)); edje_file->compiler = strdup("edje_cc"); edje_file->version = EDJE_FILE_VERSION; edje_file->minor = EDJE_FILE_MINOR; edje_file->feature_ver = 1; /* increment this every time we add a field * or feature to the edje file format that * does not load nicely as a NULL or 0 value * and needs a special fallback initialization */ edje_file->base_scale = FROM_INT(1); source_edd(); source_fetch(); data_setup(); compile(); reorder_parts(); data_process_scripts(); data_process_lookups(); data_process_script_lookups(); data_write(); eina_prefix_free(pfx); pfx = NULL; edje_shutdown(); eina_log_domain_unregister(_edje_cc_log_dom); eina_shutdown(); return 0; }
F(monsterinfo.idle_time), I(monsterinfo.linkcount), I(monsterinfo.power_armor_type), I(monsterinfo.power_armor_power), {0} #undef _OFS }; static const save_field_t levelfields[] = { #define _OFS LLOFS I(framenum), F(time), SZ(level_name, MAX_QPATH), SZ(mapname, MAX_QPATH), SZ(nextmap, MAX_QPATH), F(intermissiontime), L(changemap), I(exitintermission), V(intermission_origin), V(intermission_angle), E(sight_client), E(sight_entity), I(sight_entity_framenum), E(sound_entity), I(sound_entity_framenum),
static int init_graph_vga(int width, int height,int chain4) { const uint8_t *w; const uint8_t *h; uint8_t val; int a; switch (width) { case 256: w = g_width_256; val = R_COM + R_W256; break; case 320: w = g_width_320; val = R_COM + R_W320; break; case 360: w = g_width_360; val = R_COM + R_W360; break; case 376: w = g_width_376; val = R_COM + R_W376; break; case 400: w = g_width_400; val = R_COM + R_W400; break; default: return -1; /* fail */ } switch (height) { case 200: h = height_200; val |= R_H200; break; case 224: h = height_224; val |= R_H224; break; case 240: h = height_240; val |= R_H240; break; case 256: h = height_256; val |= R_H256; break; case 270: h = height_270; val |= R_H270; break; case 300: h = height_300; val |= R_H300; break; case 360: h = height_360; val |= R_H360; break; case 400: h = height_400; val |= R_H400; break; case 480: h = height_480; val |= R_H480; break; case 564: h = height_564; val |= R_H564; break; case 600: h = height_600; val |= R_H600; break; default: return -2; /* fail */ } /* chain4 not available if mode takes over 64k */ /* if(chain4 && (long)width*(long)height>65536L) return -3; */ /* here goes the actual modeswitch */ outb(val, 0x3c2); outw(0x0e11, 0x3d4); /* enable regs 0-7 */ for(a = 0; a < SZ(g_hor_regs); ++a) { outw((uint16_t)((w[a] << 8) + g_hor_regs[a]), 0x3d4); } for(a = 0; a < SZ(g_ver_regs); ++a) { outw((uint16_t)((h[a] << 8) + g_ver_regs[a]), 0x3d4); } outw(0x0008, 0x3d4); /* vert.panning = 0 */ if(chain4) { outw(0x4014, 0x3d4); outw(0xa317, 0x3d4); outw(0x0e04, 0x3c4); } else { outw(0x0014, 0x3d4); outw(0xe317, 0x3d4); outw(0x0604, 0x3c4); } outw(0x0101, 0x3c4); outw(0x0f02, 0x3c4); /* Enable writing to all planes */ outw(0x4005, 0x3ce); /* 256 color mode */ outw(0x0106, 0x3ce); /* Extend graph mode & a000-bfff */ inb(0x3da); outb(0x30, 0x3c0); outb(0x41, 0x3c0); outb(0x33, 0x3c0); outb(0x00, 0x3c0); for(a = 0; a < 16; a++) /* ega pal */ { outb((uint8_t)a, 0x3c0); outb((uint8_t)a, 0x3c0); } outb( 0x20, 0x3c0); /* enable video */ return 0; }