/* setopt wrapper for enum types */ CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, const NameValue *nvlist, long lval) { CURLcode ret = CURLE_OK; bool skip = FALSE; ret = curl_easy_setopt(curl, tag, lval); if(!lval) skip = TRUE; if(config->libcurl && !skip && !ret) { /* we only use this for real if --libcurl was used */ const NameValue *nv = NULL; for(nv=nvlist; nv->name; nv++) { if(nv->value == lval) break; /* found it */ } if(! nv->name) { /* If no definition was found, output an explicit value. * This could happen if new values are defined and used * but the NameValue list is not updated. */ CODE2("curl_easy_setopt(hnd, %s, %ldL);", name, lval); } else { CODE2("curl_easy_setopt(hnd, %s, (long)%s);", name, nv->name); } } nomem: return ret; }
/* setopt wrapper for bitmasks */ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, const NameValueUnsigned *nvlist, long lval) { CURLcode ret = CURLE_OK; bool skip = FALSE; ret = curl_easy_setopt(curl, tag, lval); if(!lval) skip = TRUE; if(config->libcurl && !skip && !ret) { /* we only use this for real if --libcurl was used */ char preamble[80]; unsigned long rest = (unsigned long)lval; const NameValueUnsigned *nv = NULL; snprintf(preamble, sizeof(preamble), "curl_easy_setopt(hnd, %s, ", name); for(nv=nvlist; nv->name; nv++) { if((nv->value & ~ rest) == 0) { /* all value flags contained in rest */ rest &= ~ nv->value; /* remove bits handled here */ CODE3("%s(long)%s%s", preamble, nv->name, rest ? " |" : ");"); if(!rest) break; /* handled them all */ /* replace with all spaces for continuation line */ snprintf(preamble, sizeof(preamble), "%*s", strlen(preamble), ""); } } /* If any bits have no definition, output an explicit value. * This could happen if new bits are defined and used * but the NameValue list is not updated. */ if(rest) CODE2("%s%luUL);", preamble, rest); } nomem: return ret; }
/* setopt wrapper for curl_slist options */ CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, struct curl_slist *list) { CURLcode ret = CURLE_OK; char *escaped = NULL; bool skip = FALSE; ret = curl_easy_setopt(curl, tag, list); if(!list) skip = TRUE; if(config->libcurl && !skip && !ret) { struct curl_slist *s; int i; /* May need several slist variables, so invent name */ i = ++ easysrc_slist_count; DECL1("struct curl_slist *slist%d;", i); DATA1("slist%d = NULL;", i); CLEAN1("curl_slist_free_all(slist%d);", i); CLEAN1("slist%d = NULL;", i); for(s=list; s; s=s->next) { Curl_safefree(escaped); escaped = c_escape(s->data); if(!escaped) { ret = CURLE_OUT_OF_MEMORY; goto nomem; } DATA3("slist%d = curl_slist_append(slist%d, \"%s\");", i, i, escaped); } CODE2("curl_easy_setopt(hnd, %s, slist%d);", name, i); } nomem: Curl_safefree(escaped); return ret; }
/* setopt wrapper for CURLOPT_HTTPPOST */ CURLcode tool_setopt_httppost(CURL *curl, struct GlobalConfig *config, const char *name, CURLoption tag, struct curl_httppost *post) { CURLcode ret = CURLE_OK; char *escaped = NULL; bool skip = FALSE; ret = curl_easy_setopt(curl, tag, post); if(!post) skip = TRUE; if(config->libcurl && !skip && !ret) { struct curl_httppost *pp, *p; int i; /* May use several httppost lists, if multiple POST actions */ i = ++ easysrc_form_count; DECL1("struct curl_httppost *post%d;", i); DATA1("post%d = NULL;", i); CLEAN1("curl_formfree(post%d);", i); CLEAN1("post%d = NULL;", i); if(i == 1) DECL0("struct curl_httppost *postend;"); DATA0("postend = NULL;"); for(p=post; p; p=p->next) { DATA1("curl_formadd(&post%d, &postend,", i); DATA1(" CURLFORM_COPYNAME, \"%s\",", p->name); for(pp=p; pp; pp=pp->more) { /* May be several files uploaded for one name; * these are linked through the 'more' pointer */ Curl_safefree(escaped); escaped = c_escape(pp->contents); if(!escaped) { ret = CURLE_OUT_OF_MEMORY; goto nomem; } if(pp->flags & CURL_HTTPPOST_FILENAME) { /* file upload as for -F @filename */ DATA1(" CURLFORM_FILE, \"%s\",", escaped); } else if(pp->flags & CURL_HTTPPOST_READFILE) { /* content from file as for -F <filename */ DATA1(" CURLFORM_FILECONTENT, \"%s\",", escaped); } else DATA1(" CURLFORM_COPYCONTENTS, \"%s\",", escaped); if(pp->showfilename) { Curl_safefree(escaped); escaped = c_escape(pp->showfilename); if(!escaped) { ret = CURLE_OUT_OF_MEMORY; goto nomem; } DATA1(" CURLFORM_FILENAME, \"%s\",", escaped); } if(pp->contenttype) { Curl_safefree(escaped); escaped = c_escape(pp->contenttype); if(!escaped) { ret = CURLE_OUT_OF_MEMORY; goto nomem; } DATA1(" CURLFORM_CONTENTTYPE, \"%s\",", escaped); } } DATA0(" CURLFORM_END);"); } CODE2("curl_easy_setopt(hnd, %s, post%d);", name, i); } nomem: Curl_safefree(escaped); return ret; }
5 1110xxxxx 11110 -31..-16,16..31 6 11110xxxxxx 111110 -63..-32,32..63 7 111110 1111110 -127..-64,64..127 8 1111110 11111110 -255..-128,128..255 7+8 8+8 */ /* This table based on MPEG2DEC by MPEG Software Simulation Group */ /* Table B-14, DCT coefficients table zero, * codes 0100 ... 1xxx (used for all other coefficients) */ static const u_long VLCtabnext[12*2] = { CODE(0,2,4), CODE(2,1,4), CODE2(1,1,3), CODE2(1,-1,3), CODE0(63,512,2), CODE0(63,512,2), CODE0(63,512,2), CODE0(63,512,2), /*EOB*/ CODE2(0,1,2), CODE2(0,1,2), CODE2(0,-1,2), CODE2(0,-1,2) }; /* Table B-14, DCT coefficients table zero, * codes 000001xx ... 00111xxx */ static const u_long VLCtab0[60*2] = { CODE0(63,0,6), CODE0(63,0,6),CODE0(63,0,6), CODE0(63,0,6), /* ESCAPE */ CODE2(2,2,7), CODE2(2,-2,7), CODE2(9,1,7), CODE2(9,-1,7), CODE2(0,4,7), CODE2(0,-4,7), CODE2(8,1,7), CODE2(8,-1,7), CODE2(7,1,6), CODE2(7,1,6), CODE2(7,-1,6), CODE2(7,-1,6), CODE2(6,1,6), CODE2(6,1,6), CODE2(6,-1,6), CODE2(6,-1,6), CODE2(1,2,6), CODE2(1,2,6), CODE2(1,-2,6), CODE2(1,-2,6), CODE2(5,1,6), CODE2(5,1,6), CODE2(5,-1,6), CODE2(5,-1,6),
NORMAL (U"If you record a Sound with a druation of 2.3 seconds, and then do ##To TextGrid...#, " "you are asked to provide tier names and to say which of these tiers are point tiers. " "If you click OK without changing the settings from their standard values, " " you obtain a TextGrid with two interval tiers, called %Mary and %John, and one point tier called %bell. " "When you save this TextGrid to disk by choosing @@Save as text file...@ from the #New menu, " "the resulting text file, when opened in a text editor, will look as follows:") CODE (U"File type = \"ooTextFile\"") CODE (U"Object class = \"TextGrid\"") CODE (U"") CODE (U"xmin = 0") CODE (U"xmax = 2.3") CODE (U"tiers? <exists>") CODE (U"size = 3") CODE (U"item []:") CODE1 (U"item [1]:") CODE2 (U"class = \"IntervalTier\"") CODE2 (U"name = \"Mary\"") CODE2 (U"xmin = 0") CODE2 (U"xmax = 2.3") CODE2 (U"intervals: size = 1") CODE2 (U"intervals [1]:") CODE3 (U"xmin = 0") CODE3 (U"xmax = 2.3") CODE3 (U"text = \"\"") CODE1 (U"item [2]:") CODE2 (U"class = \"IntervalTier\"") CODE2 (U"name = \"John\"") CODE2 (U"xmin = 0") CODE2 (U"xmax = 2.3") CODE2 (U"intervals: size = 1") CODE2 (U"intervals [1]:")