cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: advice for building test suite with libcurl

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 28 Jan 2015 22:23:32 +0100

On Wed, Jan 28, 2015 at 11:28:11AM +0100, Raphael Bauduin wrote:
> And my question is how do you advise me to solve the translation from a string
> to its symbol value,
> eg from "CURLOPT_URL" to CURLOPT_URL ( get_symbol_value_from_name in the pseudo
> code)?

There was a similar question on this list a few months ago; maybe there were
some hints there. You could also look at some of the scripting language
bindings to libcurl to see how they accomplish this, as they have a similar
problem.

Depending on how reliable you need the string extraction to be in future
libcurl versions, you could process the curl.h header file directly. Passing it
through cpp and doing a simple grep on CURLOPT_ would get you most of the way.
For higher reliability, process it with a C compiler like gcc-xml and extra the
identifiers from the CURLoption typedef from the XML output. clang probably
also has an intermediate format that would work.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-01-28