note description: "[ ]" legal: "See notice at end of class." status: "See notice at end of class."; date: "$Date$"; revision: "$Revision$" class INPOUT32_API inherit DYNAMIC_API create make feature {NONE} -- Initialization initialize -- do last_error_code := error_success end feature {NONE} -- Clean up clean_up -- do end feature {NONE} -- Access module_name: IMMUTABLE_STRING_8 -- once if {PLATFORM}.pointer_bytes = 8 then Result := "inpoutx64" else Result := "inpout32" end end minimum_version: detachable READABLE_STRING_8 -- feature -- Access last_error_code: INTEGER -- Last operation error code. feature -- Status report is_successful: BOOLEAN -- Indicates if the last operation was successful do Result := last_error_code = 0 ensure last_error_code_positive: last_error_code /= 0 implies Result end is_thread_safe: BOOLEAN = False -- feature -- Basic operations send (a_address: INTEGER_16; a_data: INTEGER_16) -- Sends data require is_interface_usable: is_interface_usable a_address_positive: a_address > 0 do last_error_code := error_success c_out_32 (api_pointer (once "Out32"), a_address, a_data) last_error_code := c_get_last_error end receive (a_address: INTEGER_16): INTEGER_16 -- Receive data require a_address_positive: a_address > 0 do last_error_code := error_success Result := c_inp_32 (api_pointer (once "Inp32"), a_address) last_error_code := c_get_last_error end feature {NONE} -- Externals c_out_32 (a_fptr: POINTER; a_address: INTEGER_16; a_data: INTEGER_16) -- Calls `Out32' require not_a_fptr_is_null: a_fptr /= default_pointer a_address_positive: a_address > 0 external "C inline" alias "(FUNCTION_CAST(void, (short, short)) $a_fptr) ((short) $a_address, (short) $a_data);" end c_inp_32 (a_fptr: POINTER; a_address: INTEGER_16): INTEGER_16 -- Calls `Inp32' require not_a_a_fptr_is_null: a_fptr /= default_pointer a_address_positive: a_address > 0 external "C inline" alias "return (FUNCTION_CAST(short, (short)) $a_fptr) ((short) $a_address);" end c_get_last_error: INTEGER -- Calls `GetLastError' external "C inline" alias "return (EIF_INTEGER) GetLastError();" end error_success: INTEGER -- ERROR_SUCCESS macro value. external "C [macro ]" alias "ERROR_SUCCESS" end ;note copyright: "Copyright (c) 1984-2008, Eiffel Software" license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)" licensing_options: "http://www.eiffel.com/licensing" copying: "[ This file is part of Eiffel Software's Eiffel Development Environment. Eiffel Software's Eiffel Development Environment is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2 of the License (available at the URL listed under "license" above). Eiffel Software's Eiffel Development Environment is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Eiffel Software's Eiffel Development Environment; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ]" 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