From 09a1c2d34a24add534d1ab8ac72b5a71638c3da0 Mon Sep 17 00:00:00 2001 From: larryl Date: Tue, 30 Oct 2007 11:22:26 +0000 Subject: [PATCH] Made cURL wrapper library works on Linux. git-svn-id: https://svn.origo.ethz.ch/eiffelstudio/trunk/Src/library/cURL@70943 8089f293-4706-0410-a29e-feb5c42a2edf --- curl_easy_externals.e | 28 +++++++++++++++++----------- curl_externals.e | 8 +++++++- curl_utility.e | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 12 deletions(-) create mode 100644 curl_utility.e diff --git a/curl_easy_externals.e b/curl_easy_externals.e index 11c5daa1..bd1a9805 100644 --- a/curl_easy_externals.e +++ b/curl_easy_externals.e @@ -149,8 +149,14 @@ feature {NONE} -- Implementation not_void: Result /= Void end - module_name: STRING is "libcurl.dll" + module_name: STRING is -- Module name. + local + l_utility: CURL_UTILITY + once + create l_utility + Result := l_utility.module_name + end setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER) is -- Declared as curl_easy_setopt(). @@ -218,10 +224,10 @@ feature {NONE} -- C externals alias "[ { - (FUNCTION_CAST(void, (CURL *, CURLoption, CURLoption)) $a_api) + (FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api) ((CURL *) $a_curl_handle, (CURLoption)$a_opt, - (CURLoption)$a_data); + $a_data); } ]" end @@ -238,10 +244,10 @@ feature {NONE} -- C externals alias "[ { - (FUNCTION_CAST(void, (CURL *, CURLoption, CURLoption)) $a_api) + (FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_api) ((CURL *) $a_curl_handle, (CURLoption)$a_opt, - (CURLoption)$a_data); + $a_data); } ]" end @@ -256,10 +262,10 @@ feature {NONE} -- C externals alias "[ { - (FUNCTION_CAST(void, (CURL *, CURLoption, CURLoption)) $a_setopt_api) + (FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api) ((CURL *) $a_curl_handle, (CURLoption)CURLOPT_WRITEFUNCTION, - (CURLoption)WriteMemoryCallback); + WriteMemoryCallback); } ]" end @@ -274,15 +280,15 @@ feature {NONE} -- C externals alias "[ { - (FUNCTION_CAST(void, (CURL *, CURLoption, CURLoption)) $a_setopt_api) + (FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api) ((CURL *) $a_curl_handle, (CURLoption)CURLOPT_DEBUGFUNCTION, - (CURLoption)curl_trace); + curl_trace); - (FUNCTION_CAST(void, (CURL *, CURLoption, CURLoption)) $a_setopt_api) + (FUNCTION_CAST(void, (CURL *, CURLoption, ...)) $a_setopt_api) ((CURL *) $a_curl_handle, (CURLoption)CURLOPT_VERBOSE, - (CURLoption)TRUE); + TRUE); } ]" end diff --git a/curl_externals.e b/curl_externals.e index 912e2175..44c058cc 100644 --- a/curl_externals.e +++ b/curl_externals.e @@ -85,8 +85,14 @@ feature {NONE} -- Implementation not_void: Result /= Void end - module_name: STRING is "libcurl.dll" + module_name: STRING is -- Module name. + local + l_utility: CURL_UTILITY + once + create l_utility + Result := l_utility.module_name + end internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: STRING_GENERAL; a_arg_3: INTEGER) is -- Declared as curl_formadd (). diff --git a/curl_utility.e b/curl_utility.e new file mode 100644 index 00000000..4a204759 --- /dev/null +++ b/curl_utility.e @@ -0,0 +1,42 @@ +indexing + description: "[ + Utilities for Eiffel cURL wrapper library. + ]" + status: "See notice at end of class." + legal: "See notice at end of class." + date: "$Date$" + revision: "$Revision$" + +class + CURL_UTILITY + +feature -- Query + + module_name: STRING is + -- Module name. + local + l_platform: PLATFORM + once + create l_platform + if l_platform.is_windows then + Result := "libcurl.dll" + else + Result := "libcurl.so" + end + ensure + not_void: Result /= Void + end + +indexing + library: "cURL: Library of reusable components for Eiffel." + copyright: "Copyright (c) 1984-2006, Eiffel Software and others" + license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" + source: "[ + Eiffel Software + 356 Storke Road, Goleta, CA 93117 USA + Telephone 805-685-1006, Fax 805-685-6869 + Website http://www.eiffel.com + Customer support http://support.eiffel.com + ]" + +end