News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

C to HLA

Started by stanks, December 24, 2010, 07:45:58 AM

Previous topic - Next topic

stanks

Hi

How to translate this to HLA:


/* GtkTextIter -> info from doc */

typedef struct {
  /* GtkTextIter is an opaque datatype; ignore all these fields.
   * Initialize the iter with gtk_text_buffer_get_iter_*
   * functions
   */
} GtkTextIter;

...
/* Callback for close button */
void
on_button_clicked (GtkWidget *button, GtkTextBuffer *buffer)
{
  GtkTextIter start;
  GtkTextIter end;

  gchar *text;

  /* Obtain iters for the start and end of points of the buffer */
  gtk_text_buffer_get_start_iter (buffer, &start);
  gtk_text_buffer_get_end_iter (buffer, &end);

  /* Get the entire buffer text. */
  text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
...
}


or this:


...
GtkTextIter start, end;
GtkTextBuffer *buffer;
char *text;

buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_bounds (buffer, &start, &end);
text = gtk_text_iter_get_text (&start, &end);
...


Problem for me is that iter stuff, '&' in C and empty structure. Never learned that '&' :(

thanks

Sevag.K


how familiar are you with hla?  i'm asking because translating something like this requires moderate to advanced familiarity with the language.

the '&' in c i believe means "address of variable."  in assembly, that can be the static address of a section or the dynamic address of a stack, depending on where the variable is declared.  there are different ways of retrieving the address.

the code you have is a bit of mystery.  we don't know the size of "GtkTextIter."  we can't just declare an empty storage structure in assembly without knowing how much memory is going to be overwritten.
[my guess is that it's a dword-sized pointer to a structure of unspecified size.]

we also don't know how the prototypes of these functions are declared.  it is important to know this to pass the correct information to the external routines.

have you been able to test compile and link simpler routines from this graphics toolkit library?

DarkWolf

This looks like the GTK library that Linux uses for creating GUIs (The GIMP Tool Kit , though technically there is a Windows version you usually find this on Linux / BSD)

I thought I remeber reading a section in AOA that covered calling C functions from HLA but now I can't find it (maybe it was the paperback or tree edition).

It should be possible to call gtk_text_buffer_get_text(); from an HLA program but yes that would probably be a bit advanced.
--
Where's there's smoke, There are mirrors.
Give me Free as in Freedom not Speech or Beer.
Thank You and Welcome to the Internet.

Sevag.K


it makes a good cross platform gui library.