<commit_before>;////////////////////////////////////////////////////////////////
;// DEMO8.ASM
;//
;// Copyright (C)2005-2012 The NASMX Project
;//
;// Purpose:
;//    NASMX - GTK Demo in Linux 32 bit.
;//
;// Contributors:
;//    Mathi
;//
;// This demo needs libgtk2.0-dev package.
;//  
;// sudo apt-get install libgtk2.0-dev
;//


BITS 32

%include 'nasmx.inc'

%include "gtk/gtk.inc"

ENTRY demo8

IMPORT gtk_init,8
IMPORT gtk_window_new,4
IMPORT gtk_button_new_with_label,4
IMPORT gtk_entry_new,0
IMPORT gtk_hbox_new,8
IMPORT gtk_window_set_title,8
IMPORT gtk_window_set_default_size,12
IMPORT g_signal_connect_data,24
IMPORT gtk_box_pack_start,20
IMPORT gtk_container_add,8
IMPORT gtk_widget_show_all,4
IMPORT gtk_main,0
IMPORT gtk_exit,4
IMPORT gtk_entry_get_text,4
IMPORT gtk_message_dialog_new,20
IMPORT gtk_dialog_run,4
IMPORT gtk_widget_destroy,4
IMPORT gtk_main_quit,0

segment .bss

	window: reserve(uint32_t) 1
	button: reserve(uint32_t) 1
	hbox: reserve(uint32_t) 1
	entrydata: reserve(uint32_t) 1
	msgboxdiag: reserve(uint32_t) 1

segment .code
;;Define the call back functions.
proc cdecl, kill_window, ptrdiff_t widget, ptrdiff_t event, ptrdiff_t data  ;; cdecl for callback function which is called from inside the c library !? 
locals none

	invoke gtk_main_quit
	return 0
endproc

proc cdecl, button_press,ptrdiff_t widget, ptrdiff_t data  ;;cdecl for callback function which is called from inside the c library !? 
locals none

	invoke gtk_entry_get_text,[entrydata]

	invoke gtk_message_dialog_new, [window], GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, eax
	mov [msgboxdiag],eax

	invoke gtk_window_set_title, [msgboxdiag], "Info"

	invoke gtk_dialog_run, [msgboxdiag]

	invoke gtk_widget_destroy, [msgboxdiag]
endproc

;; Our Main proc.
proc demo8
locals none
	invoke gtk_init,NULL,NULL
	
	invoke gtk_window_new, GTK_WINDOW_TOPLEVEL
	mov [window],eax

	invoke gtk_button_new_with_label, "Echo"
	mov [button],eax
<commit_msg>Minor changes to linux demo8.asm<commit_after>;////////////////////////////////////////////////////////////////
;// DEMO8.ASM
;//
;// Copyright (C)2005-2012 The NASMX Project
;//
;// Purpose:
;//    NASMX - GTK Demo in Linux 32 bit.
;//
;// Contributors:
;//    Mathi
;//
;// This demo needs libgtk2.0-dev package.
;//  
;// sudo apt-get install libgtk2.0-dev
;//



%include 'nasmx.inc'

%include "gtk/gtk.inc"

ENTRY demo8

IMPORT gtk_init,8
IMPORT gtk_window_new,4
IMPORT gtk_button_new_with_label,4
IMPORT gtk_entry_new,0
IMPORT gtk_hbox_new,8
IMPORT gtk_window_set_title,8
IMPORT gtk_window_set_default_size,12
IMPORT g_signal_connect_data,24
IMPORT gtk_box_pack_start,20
IMPORT gtk_container_add,8
IMPORT gtk_widget_show_all,4
IMPORT gtk_main,0
IMPORT gtk_exit,4
IMPORT gtk_entry_get_text,4
IMPORT gtk_message_dialog_new,20
IMPORT gtk_dialog_run,4
IMPORT gtk_widget_destroy,4
IMPORT gtk_main_quit,0

segment .bss

	window: reserve(uint32_t) 1
	button: reserve(uint32_t) 1
	hbox: reserve(uint32_t) 1
	entrydata: reserve(uint32_t) 1
	msgboxdiag: reserve(uint32_t) 1

segment .code
;;Define the call back functions.
;; cdecl for callback function which is called from inside the c library !?
;; NOTE : cdecl is not really needed in linux
;; By default NASMX assembles procs in linux with cdecl. (when invoked with -f elf32)
;; cdecl is needed in windows. 

proc cdecl, kill_window, ptrdiff_t widget, ptrdiff_t event, ptrdiff_t data
locals none

	invoke gtk_main_quit
	return 0
endproc

proc cdecl, button_press,ptrdiff_t widget, ptrdiff_t data  
locals none

	invoke gtk_entry_get_text,[entrydata]

	invoke gtk_message_dialog_new, [window], GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, eax
	mov [msgboxdiag],eax

	invoke gtk_window_set_title, [msgboxdiag], "Info"

	invoke gtk_dialog_run, [msgboxdiag]

	invoke gtk_widget_destroy, [msgboxdiag]
endproc

;; Our Main proc.
proc demo8
locals none
	invoke gtk_init,NULL,NULL
	
	invoke gtk_window_new, GTK_WINDOW_TOPLEVEL
	mov [window],eax

	invoke gtk_button_new_with_label, "Echo"
	mov [button],eax

{'fraction_non_alphanumeric': 0.11408067310071765, 'fraction_numerical': 0.02845830240039594, 'mean_word_length': 4.410977242302543, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4496963', 'n_tokens_mistral': 1601, 'n_tokens_neox': 1531, 'n_words': 383}