diff --git a/src/core/tools.c b/src/core/tools.c new file mode 100644 index 0000000..0661da4 --- /dev/null +++ b/src/core/tools.c @@ -0,0 +1,45 @@ +/* + * "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. + * + * 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 main.c e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + +#include +#include + +/*--[ Implement ]------------------------------------------------------------------------------------*/ + + #if ! GLIB_CHECK_VERSION(2,44,0) + + // Reference: https://github.com/ImageMagick/glib/blob/master/glib/glib-autocleanups.h + void ipc3270_autoptr_cleanup_generic_gfree(void *p) + { + void **pp = (void**)p; + g_free (*pp); + } + + #endif // ! GLIB(2,44,0) + diff --git a/src/core/windows/pipesource.c b/src/core/windows/pipesource.c index d238be5..c602ef2 100644 --- a/src/core/windows/pipesource.c +++ b/src/core/windows/pipesource.c @@ -28,6 +28,7 @@ */ #include "gobject.h" +#include #include void ipc3270_wait_for_client(IPC3270_PIPE_SOURCE *source) { diff --git a/src/include/lib3270/ipc.h b/src/include/lib3270/ipc.h index ff6000a..4612c03 100644 --- a/src/include/lib3270/ipc.h +++ b/src/include/lib3270/ipc.h @@ -31,6 +31,8 @@ /** * @brief Common definitions for pw3270 IPC plugin. * + * @author Perry Werneck + * */ #ifndef PW3270_IPC_H_INCLUDED @@ -53,7 +55,7 @@ #endif // _WIN32 - + #include #include #include @@ -69,25 +71,25 @@ typedef struct _ipc3270 ipc3270; typedef struct _ipc3270Class ipc3270Class; - GObject * ipc3270_new(); - GType ipc3270_get_type(void); - void ipc3270_set_session(GObject *object, H3270 *hSession); - void ipc3270_export_object(GObject *object, const char *name, GError **error); + GObject * ipc3270_new(); + GType ipc3270_get_type(void); + void ipc3270_set_session(GObject *object, H3270 *hSession); + void ipc3270_export_object(GObject *object, const char *name, GError **error); - gchar * ipc3270_convert_output_string(GObject *object, const gchar *string, GError **error); - gchar * ipc3270_convert_input_string(GObject *object, const gchar *string, GError **error); - GVariant * ipc3270_GVariant_from_input_string(GObject *object, char *string, GError **error); + gchar * ipc3270_convert_output_string(GObject *object, const gchar *string, GError **error); + gchar * ipc3270_convert_input_string(GObject *object, const gchar *string, GError **error); + GVariant * ipc3270_GVariant_from_input_string(GObject *object, char *string, GError **error); - void ipc3270_add_terminal_introspection(GString *string); + void ipc3270_add_terminal_introspection(GString *string); - const gchar * ipc3270_get_display_charset(GObject *object); - H3270 * ipc3270_get_session(GObject *object); + const gchar * ipc3270_get_display_charset(GObject *object); + H3270 * ipc3270_get_session(GObject *object); - void ipc3270_set_error(GObject *object, int errcode, GError **error); + void ipc3270_set_error(GObject *object, int errcode, GError **error); - GVariant * ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error); - gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error); - GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error); + GVariant * ipc3270_method_call(GObject *object, const gchar *method_name, GVariant *parameters, GError **error); + gboolean ipc3270_set_property(GObject *object, const gchar *property_name, GVariant *value, GError **error); + GVariant * ipc3270_get_property(GObject *object, const gchar *property_name, GError **error); #ifdef _WIN32 unsigned char * ipc3270_pack(const gchar *name, int id, GVariant *values, size_t * szPacket); @@ -98,6 +100,11 @@ G_END_DECLS + #if ! GLIB_CHECK_VERSION(2,44,0) + G_GNUC_INTERNAL void ipc3270_autoptr_cleanup_generic_gfree(void *p); + #define g_autofree __attribute__((cleanup(ipc3270_autoptr_cleanup_generic_gfree))) + #endif // ! GLIB(2,44,0) + #ifdef DEBUG #define debug( fmt, ... ) fprintf(stderr,"%s(%d) " fmt "\n", __FILE__, (int) __LINE__, __VA_ARGS__ ); fflush(stderr); #else -- libgit2 0.21.2