From c2d597d2bab1387a391c335b61d494d015c872a6 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 2 Jun 2023 07:54:35 -0300 Subject: [PATCH] Using nested functions. --- src/core/properties/signed.c | 72 +++++++++++++++++++++++++++++++++++++++--------------------------------- src/include/lib3270/properties.h | 40 +++++++++++++++++++++------------------- 2 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/core/properties/signed.c b/src/core/properties/signed.c index 514789d..c560c92 100644 --- a/src/core/properties/signed.c +++ b/src/core/properties/signed.c @@ -1,25 +1,23 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ + /* - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. + * Copyright (C) 2008 Banco do Brasil S.A. * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Este programa está nomeado como - e possui - linhas de código. + * This program 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 Lesser General Public License + * along with this program. If not, see . + */ + +/* * Contatos: * * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) @@ -27,6 +25,10 @@ * */ +/** + * @brief Signed int properties. + */ + #include #include #include @@ -34,11 +36,7 @@ #include #include -static int lib3270_get_connection_state_as_int(const H3270 *hSession) { - return (int) lib3270_get_connection_state(hSession); -} - -const char * lib3270_get_connection_state_as_string(const H3270 *hSession) { +LIB3270_EXPORT const char * lib3270_get_connection_state_as_string(const H3270 *hSession) { static const char * values[] = { N_("Disconnected"), @@ -62,11 +60,7 @@ const char * lib3270_get_connection_state_as_string(const H3270 *hSession) { } -static int lib3270_get_program_message_as_int(const H3270 *hSession) { - return (int) lib3270_get_program_message(hSession); -} - -const char * lib3270_get_program_message_as_string(const H3270 *hSession) { +LIB3270_EXPORT const char * lib3270_get_program_message_as_string(const H3270 *hSession) { static const char * values[] = { "", @@ -95,11 +89,7 @@ const char * lib3270_get_program_message_as_string(const H3270 *hSession) { } -static int lib3270_get_ssl_state_as_int(const H3270 * hSession) { - return (int) lib3270_get_ssl_state(hSession); -} - -const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) { +LIB3270_EXPORT const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) { static const char * values[] = { N_("No secure connection"), @@ -120,6 +110,10 @@ const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) { const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) { + auto int lib3270_get_connection_state_as_int(const H3270 *hSession); + auto int lib3270_get_ssl_state_as_int(const H3270 * hSession); + auto int lib3270_get_program_message_as_int(const H3270 *hSession); + static const LIB3270_INT_PROPERTY properties[] = { { @@ -164,6 +158,18 @@ const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) { } }; + int lib3270_get_connection_state_as_int(const H3270 *hSession) { + return (int) lib3270_get_connection_state(hSession); + } + + int lib3270_get_ssl_state_as_int(const H3270 * hSession) { + return (int) lib3270_get_ssl_state(hSession); + } + + int lib3270_get_program_message_as_int(const H3270 *hSession) { + return (int) lib3270_get_program_message(hSession); + } + return properties; } diff --git a/src/include/lib3270/properties.h b/src/include/lib3270/properties.h index cfef186..d7a168e 100644 --- a/src/include/lib3270/properties.h +++ b/src/include/lib3270/properties.h @@ -1,29 +1,27 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ + /* - * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a - * aplicativos mainframe. Registro no INPI sob o nome G3270. - * - * Copyright (C) <2008> - * - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela - * Free Software Foundation. - * - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para - * obter mais detalhes. + * Copyright (C) 2008 Banco do Brasil S.A. * - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin - * St, Fifth Floor, Boston, MA 02110-1301 USA + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. * - * Este programa está nomeado como -.h e possui - linhas de código. + * This program 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 Lesser General Public License + * along with this program. If not, see . + */ + +/* * Contatos: * * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) * */ @@ -304,6 +302,10 @@ LIB3270_EXPORT int lib3270_set_auto_reconnect(H3270 *hSession, unsigned int time */ LIB3270_EXPORT unsigned int lib3270_get_auto_reconnect(const H3270 *hSession); +LIB3270_EXPORT const char * lib3270_get_connection_state_as_string(const H3270 *hSession); +LIB3270_EXPORT const char * lib3270_get_program_message_as_string(const H3270 *hSession); +LIB3270_EXPORT const char * lib3270_get_ssl_state_as_string(const H3270 * hSession); + #ifdef __cplusplus } #endif -- libgit2 0.21.2