flat assembler
Message board for the users of flat assembler.

Index > Linux > stru C to FASM

Author
Thread Post new topic Reply to topic
devilsclaw



Joined: 30 Oct 2003
Posts: 8
devilsclaw 31 Oct 2003, 23:20
I need help converting c structs to FASM ones

struct _GtkFileSelection
{
/*< private >*/
GtkDialog parent_instance;

/*< public >*/
GtkWidget *dir_list;
GtkWidget *file_list;
GtkWidget *selection_entry;
GtkWidget *selection_text;
GtkWidget *main_vbox;
GtkWidget *ok_button;
GtkWidget *cancel_button;
GtkWidget *help_button;
GtkWidget *history_pulldown;
GtkWidget *history_menu;
GList *history_list;
GtkWidget *fileop_dialog;
GtkWidget *fileop_entry;
gchar *fileop_file;
gpointer cmpl_state;

GtkWidget *fileop_c_dir;
GtkWidget *fileop_del_file;
GtkWidget *fileop_ren_file;

GtkWidget *button_area;
GtkWidget *action_area;

/*< private >*/
GPtrArray *selected_names;
gchar *last_selected;
};

i need that trans to FASM if possible i can learn from there
Post 31 Oct 2003, 23:20
View user's profile Send private message Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica 01 Nov 2003, 01:31
(unless I'm misstaken "whatever_datatype *name" is a pointer, thus a dword, on x86-32 at least). I assume GtkDialog is a structure defined somewhere (don't have access to the gtk includes now).
Here is a likley translation:
Code:
struc GtkFileSelection ; note: stripped the leading _
  ;< private >
  parent_instance  GtkDialog

  ;< public >
  dir_list              dd ?
  file_list             dd ?
  selection_entry               dd ?
  selection_text                dd ?
  main_vbox             dd ?
  ok_button             dd ?
  cancel_button         dd ?
  help_button           dd ?
  history_pulldown              dd ?
  history_menu          dd ?
  history_list          dd ?
  fileop_dialog         dd ?
  fileop_entry          dd ?
  fileop_file           dd ?
  cmpl_state            dd ? ; I think (=not sure) gpointer is a normal pointe

  fileop_c_dir            dd ?
  fileop_del_file               dd ?
  fileop_ren_file               dd ?

  button_area               dd ?
  action_area           dd ?

  ;< private >
  selected_names            dd ?
  last_selected         dd ?
struct GtkFileSelection ; strippd it here too    

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 01 Nov 2003, 01:31
View user's profile Send private message Visit poster's website Reply with quote
devilsclaw



Joined: 30 Oct 2003
Posts: 8
devilsclaw 01 Nov 2003, 02:29
thanks i will try that out... i have a feeling your right... Smile
Post 01 Nov 2003, 02:29
View user's profile Send private message Reply with quote
stanks



Joined: 01 Dec 2003
Posts: 36
Location: Croatia
stanks 27 Oct 2004, 19:04
Hi there

I know that this is one year later but i install linux one month ago. I also started with bazik's tutorials and they are great, but there is one big and important problem. There is no example about opening and saving files. With or without a dialog. I still have battle with this.
GtkWidget is structure too. And in it more structures...GtkStyle, GtkRequisition, GtkAllocation and GdkWindow. GtkStyle has more structures GdkColor, GdkGC and GdkPixmap.
I have a question....how to respond on button click in 'common' open dialog under GTK+?
How to get value of next example:

Code:
struc x
{
   a dd ?
   b dd ?
}

struc y
{
  now here i have one element (named abx) that will hold value of one element from structure x
  how to do this?
}
Or live example:
C code:
dialog_vbox1 = GTK_DIALOG (dialog1)->vbox;

How to translate this to asm?

    


Thanks in advance

stanks
Post 27 Oct 2004, 19:04
View user's profile Send private message ICQ Number Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing 28 Oct 2004, 12:33
Have you looked at bazik's examples to see if he has answered your question?

http://flatassembler.net/examples/gtk-examples.tar.gz

_________________
gorshing
Post 28 Oct 2004, 12:33
View user's profile Send private message Visit poster's website Reply with quote
stanks



Joined: 01 Dec 2003
Posts: 36
Location: Croatia
stanks 28 Oct 2004, 15:10
Hi gorshing

Yes i did, but as i stated in my previous post there is nothing about opening and saving files and similar. But today i learn most important thing....don't complicate simple stuff. I will post here example later this day.

stanks
Post 28 Oct 2004, 15:10
View user's profile Send private message ICQ Number Reply with quote
stanks



Joined: 01 Dec 2003
Posts: 36
Location: Croatia
stanks 28 Oct 2004, 18:53
Hi

Here it is...my file selection:

Code:
section '.data' writeable
        szBuffer rb 128

section '.bss' writeable
  filesel dd ?

proc open_file
  response_open dd ?

      enter
       ; new file selection
        argcall gtk_file_selection_new, szOpenDialogTitle
   mov [filesel], eax
  ; DON'T FORGET TO SHOW THE WIDGET!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   argcall gtk_widget_show, [filesel]

      argcall gtk_dialog_run, [filesel]
   mov [response_open], eax

        cmp [response_open], GTK_RESPONSE_OK
        jne end_dlg
 ; get file from dialog
      argcall gtk_file_selection_get_filename, [filesel]
  lea eax, [eax]
      mov esi, eax
        mov edi, szBuffer
   push edi
    mov ecx, 32
 rep movsd
   pop edi
  getname_end:
       argcall g_print, szBuffer
  end_dlg:
         argcall gtk_widget_destroy, [filesel]
       return
    


I will examine more and will post here what i will find.

stanks
Post 28 Oct 2004, 18:53
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.