Commit c2d597d2bab1387a391c335b61d494d015c872a6

Authored by Perry Werneck
1 parent 0e5fef36
Exists in develop

Using nested functions.

src/core/properties/signed.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
2   - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
11 5 *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
16 10 *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
20   - *
21   - * Este programa está nomeado como - e possui - linhas de código.
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
22 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18 + */
  19 +
  20 +/*
23 21 * Contatos:
24 22 *
25 23 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
... ... @@ -27,6 +25,10 @@
27 25 *
28 26 */
29 27  
  28 +/**
  29 + * @brief Signed int properties.
  30 + */
  31 +
30 32 #include <config.h>
31 33 #include <internals.h>
32 34 #include <string.h>
... ... @@ -34,11 +36,7 @@
34 36 #include <lib3270/properties.h>
35 37 #include <lib3270/keyboard.h>
36 38  
37   -static int lib3270_get_connection_state_as_int(const H3270 *hSession) {
38   - return (int) lib3270_get_connection_state(hSession);
39   -}
40   -
41   -const char * lib3270_get_connection_state_as_string(const H3270 *hSession) {
  39 +LIB3270_EXPORT const char * lib3270_get_connection_state_as_string(const H3270 *hSession) {
42 40  
43 41 static const char * values[] = {
44 42 N_("Disconnected"),
... ... @@ -62,11 +60,7 @@ const char * lib3270_get_connection_state_as_string(const H3270 *hSession) {
62 60  
63 61 }
64 62  
65   -static int lib3270_get_program_message_as_int(const H3270 *hSession) {
66   - return (int) lib3270_get_program_message(hSession);
67   -}
68   -
69   -const char * lib3270_get_program_message_as_string(const H3270 *hSession) {
  63 +LIB3270_EXPORT const char * lib3270_get_program_message_as_string(const H3270 *hSession) {
70 64  
71 65 static const char * values[] = {
72 66 "",
... ... @@ -95,11 +89,7 @@ const char * lib3270_get_program_message_as_string(const H3270 *hSession) {
95 89  
96 90 }
97 91  
98   -static int lib3270_get_ssl_state_as_int(const H3270 * hSession) {
99   - return (int) lib3270_get_ssl_state(hSession);
100   -}
101   -
102   -const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) {
  92 +LIB3270_EXPORT const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) {
103 93  
104 94 static const char * values[] = {
105 95 N_("No secure connection"),
... ... @@ -120,6 +110,10 @@ const char * lib3270_get_ssl_state_as_string(const H3270 * hSession) {
120 110  
121 111 const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) {
122 112  
  113 + auto int lib3270_get_connection_state_as_int(const H3270 *hSession);
  114 + auto int lib3270_get_ssl_state_as_int(const H3270 * hSession);
  115 + auto int lib3270_get_program_message_as_int(const H3270 *hSession);
  116 +
123 117 static const LIB3270_INT_PROPERTY properties[] = {
124 118  
125 119 {
... ... @@ -164,6 +158,18 @@ const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) {
164 158 }
165 159 };
166 160  
  161 + int lib3270_get_connection_state_as_int(const H3270 *hSession) {
  162 + return (int) lib3270_get_connection_state(hSession);
  163 + }
  164 +
  165 + int lib3270_get_ssl_state_as_int(const H3270 * hSession) {
  166 + return (int) lib3270_get_ssl_state(hSession);
  167 + }
  168 +
  169 + int lib3270_get_program_message_as_int(const H3270 *hSession) {
  170 + return (int) lib3270_get_program_message(hSession);
  171 + }
  172 +
167 173 return properties;
168 174 }
169 175  
... ...
src/include/lib3270/properties.h
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
2   - * "Software PW3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
3   - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
4   - * aplicativos mainframe. Registro no INPI sob o nome G3270.
5   - *
6   - * Copyright (C) <2008> <Banco do Brasil S.A.>
7   - *
8   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
9   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
10   - * Free Software Foundation.
11   - *
12   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
13   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
14   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
15   - * obter mais detalhes.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
16 5 *
17   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
18   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
19   - * St, Fifth Floor, Boston, MA 02110-1301 USA
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
20 10 *
21   - * Este programa está nomeado como -.h e possui - linhas de código.
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
22 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
  18 + */
  19 +
  20 +/*
23 21 * Contatos:
24 22 *
25 23 * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  24 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
27 25 *
28 26 */
29 27  
... ... @@ -304,6 +302,10 @@ LIB3270_EXPORT int lib3270_set_auto_reconnect(H3270 *hSession, unsigned int time
304 302 */
305 303 LIB3270_EXPORT unsigned int lib3270_get_auto_reconnect(const H3270 *hSession);
306 304  
  305 +LIB3270_EXPORT const char * lib3270_get_connection_state_as_string(const H3270 *hSession);
  306 +LIB3270_EXPORT const char * lib3270_get_program_message_as_string(const H3270 *hSession);
  307 +LIB3270_EXPORT const char * lib3270_get_ssl_state_as_string(const H3270 * hSession);
  308 +
307 309 #ifdef __cplusplus
308 310 }
309 311 #endif
... ...