Re: HTTPS with OpenSSL
- Posted by ghaberek (admin) Jul 18, 2016
- 3232 views
jimcbrown said...
May I suggest running it through the C preprocessor (e.g. gcc -E) ? That produces the following output for me:
You'll probably have to do this one per platform+arch combo, but the post-processed output is probably a lot easier to deal with...
(A shame that "gcc -E" doesn't have an option to process everything _except_ #include statements, though...)
This is what I came up with. I translated all of the macro-mania with the Regex find/replace in Notepad++.
map m_CURLopttype = map:new_from_kvpairs({ { "CURLOPTTYPE_LONG", CURLOPTTYPE_LONG }, { "CURLOPTTYPE_OBJECTPOINT", CURLOPTTYPE_OBJECTPOINT }, { "CURLOPTTYPE_STRINGPOINT", CURLOPTTYPE_OBJECTPOINT }, { "CURLOPTTYPE_FUNCTIONPOINT", CURLOPTTYPE_FUNCTIONPOINT }, { "CURLOPTTYPE_OFF_T", CURLOPTTYPE_OFF_T } }) constant LONG = "CURLOPTTYPE_LONG" constant OBJECTPOINT = "CURLOPTTYPE_OBJECTPOINT" constant STRINGPOINT = "CURLOPTTYPE_OBJECTPOINT" constant FUNCTIONPOINT = "CURLOPTTYPE_FUNCTIONPOINT" constant OFF_T = "CURLOPTTYPE_OFF_T" map m_CURLoption = map:new() function CINIT( sequence na, sequence t, atom nu ) atom value = map:get( m_CURLopttype, t, 0 ) + nu map:put( m_CURLoption, "CURLOPT_" & na, {na,t,nu} ) return value end function public constant /* This is the FILE * or void * the regular output should be written to. */ CURLOPT_WRITEDATA = CINIT("WRITEDATA", OBJECTPOINT, 1), /* The full URL to get/put */ CURLOPT_URL = CINIT("URL", STRINGPOINT, 2), /* Port number to connect to, if other than default. */ CURLOPT_PORT = CINIT("PORT", LONG, 3), /* Name of proxy to use. */ CURLOPT_PROXY = CINIT("PROXY", STRINGPOINT, 4), ...
Not sure how necessary this approach is when all I need are constant values...
-Greg