/* 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; }
#include <limits.h> #include <ctype.h> #include "pmapi.h" #include "impl.h" #include "internal.h" #define CODE3(a,b,c) ((__uint32_t)(a)|((__uint32_t)(b)<<8)|((__uint32_t)(c)<<16)) #define whatmsg "unexpected value" #define moremsg "more information expected" #define alignmsg "alignment specified by -A switch could not be applied" #define N_WDAYS 7 static const __uint32_t wdays[N_WDAYS] = { CODE3('s', 'u', 'n'), CODE3('m', 'o', 'n'), CODE3('t', 'u', 'e'), CODE3('w', 'e', 'd'), CODE3('t', 'h', 'u'), CODE3('f', 'r', 'i'), CODE3('s', 'a', 't') }; #define N_MONTHS 12 static const __uint32_t months[N_MONTHS] = { CODE3('j', 'a', 'n'), CODE3('f', 'e', 'b'), CODE3('m', 'a', 'r'), CODE3('a', 'p', 'r'), CODE3('m', 'a', 'y'),
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]:") CODE3 (U"xmin = 0") CODE3 (U"xmax = 2.3") CODE3 (U"text = \"\"") CODE1 (U"item [3]:") CODE2 (U"class = \"TextTier\"") CODE2 (U"name = \"bell\"")