flat assembler
Message board for the users of flat assembler.

Index > Linux > Can I use Struct.inc ?

Author
Thread Post new topic Reply to topic
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
Can I use struct.inc from the fasmw include macro for programming in linux ?
Is there any examples

Regard

Senolc_eht

_________________
sorry if i always asking.....
Post 23 Oct 2007, 00:53
View user's profile Send private message Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
yes
Post 23 Oct 2007, 01:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
thanks, but i get this error code when using struct macro
Code:
simple.asm [52]:
ends
struct.inc [86] ends [6]:
                                                          make@struct name,fields
struct.inc [106] make@struct [13]:
    match fields, define \{ define@struct fields \} }
struct.inc [114] define@struct [5]:
     name#field type def
error: undefined symbol.
make: *** [simple.o] Error 2
    



and this is my code:
Code:
format ELF

include 'cdecl.inc'
include 'struct.inc'

struct XPrivDisplay
 ext_data rb 4   ; hook for extension to hang data 
  private1 rb 4
       fd rb 4         ; Network socket. 
  private2 rb 4
       proto_major_version rb 4 ; major version of servers X protocol 
     proto_minor_version rb 4 ; minor version of servers X protocol 
     vendor rb 4             ; vendor of the server hardware 
        private3 rb XID
 private4 rb XID
     private5 rb XID
     private6 rb 4
       resource_alloc rb 4     ; allocator function 
       byte_order rb 4 ; screen byte order, LSBFirst, MSBFirst 
    bitmap_unit rb 4        ; padding and data requirements 
    bitmap_pad rb 4 ; padding requirements on bitmaps 
  bitmap_bit_order rb 4; LeastSignificant or MostSignificant 
 nformats rb 4   ; number of pixmap formats in list 
 ScreenFormat rb 4       ; pixmap format list 
       private8 rb 4
       release rb 4            ; release of the server 
    private9 rb 4
       private10 rb 4
      qlen rb 4               ; Length of input event queue 
      last_request_read rb 4 ; seq number of last event read 
     request rb 4    ; sequence number of last request. 
 private11 rb 4
      private12 rb 4
      private13 rb 4
      private14 rb 4
      max_request_size rb 4 ; maximum number 32 bit words in request
      db1 rb 4
    private15 rb 4
      display_name rb 4       ; "host:display" string used on this connect
  default_screen rb 4     ; default screen for operations 
    nscreens rb 4   ; number of screens on this server
  screens rb 4            ; pointer to list of screens 
       motion_buffer rb 4      ; size of motion buffer 
    private16 rb 4 
     min_keycode rb 4        ; minimum defined keycode 
  max_keycode rb 4        ; maximum defined keycode 
  private17 rb 4
      private18 rb 4
      private19 rb 4
      xdefaults rb 4  ; contents of defaults from server 
   ; there is more to this structure, but it is private to Xlib 
ends

public main

extrn exit
extrn g_print
extrn XMapWindow
extrn XCloseDisplay
extrn XCreateSimpleWindow
extrn getenv
extrn XOpenDisplay
extrn sleep
extrn XFlush

section '.data' writeable

display_name db "DISPLAY",0
EX db "ERROR IN CONNECTING TO X SERVER",0Ah,0Bh,0
EX_len equ $ - EX


section '.bss' writeable
        win dd ? 
   disp dd ?
   hWindow         dd ?

section '.text' executable

proc main, argc, argv
       enter
               ccall getenv, display_name
          ccall XOpenDisplay,eax
              test eax,eax
                jnz .ok
             ccall g_print, EX
           ccall exit, 0
               .ok:
            mov [disp],eax
              mov ebx, eax
                virtual at ebx
              .ad XPrivDisplay
            end virtual
         ;mov ebx, [.ad.default_screen]
              ;mov esi, [.ad.screen]
              ccall XCreateSimpleWindow,[disp],[.ad.screen],0,0,100,100,1,0,0
             mov [win],eax
               ccall XMapWindow,[disp],[win]
               ccall sleep,10
              ccall XCloseDisplay,[disp]

      return
    


and file cdecl.inc same as in the gtk-examples, file struct.inc same in the fasmw16723 include macro

_________________
sorry if i always asking.....
Post 24 Oct 2007, 23:59
View user's profile Send private message Yahoo Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Code:
        private3 rb XID 
        private4 rb XID 
        private5 rb XID
    

XID is undefined.
Post 25 Oct 2007, 00:04
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
senolc_eht



Joined: 22 Mar 2004
Posts: 57
Location: Indonesia
senolc_eht
thanks a lot

regard
senolc_eht

_________________
sorry if i always asking.....
Post 25 Oct 2007, 00:23
View user's profile Send private message Yahoo Messenger 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-2020, Tomasz Grysztar.

Powered by rwasa.