I've attempted to use different methods for converting gcc headers into assembler style '.inc' files.
Below are some examples that illustrate the resulting code.
I used 'h2incx', konw-fasm.pl and manual conversion of the gcc header 'term.h'.
Below is a snippet of a code section from the source file, followed by the resulting conversion of the same code section.
This is the source fragment:
/* term.h */
/* internals */
extern NCURSES_EXPORT(int) _nc_set_tty_mode (TTY *buf);
extern NCURSES_EXPORT(int) _nc_get_tty_mode (TTY *buf);
extern NCURSES_EXPORT(int) _nc_read_entry (const char * const, char * const, TERMTYPE *const);
extern NCURSES_EXPORT(int) _nc_read_file_entry (const char *const, TERMTYPE *);
extern NCURSES_EXPORT(int) _nc_read_termtype (TERMTYPE *, char *, int);
extern NCURSES_EXPORT(char *) _nc_first_name (const char *const);
extern NCURSES_EXPORT(int) _nc_name_match (const char *const, const char *const, const char *const);
extern NCURSES_EXPORT(const TERMTYPE *) _nc_fallback (const char *);
/* entry points */
extern NCURSES_EXPORT(TERMINAL *) set_curterm (TERMINAL *);
extern NCURSES_EXPORT(int) del_curterm (TERMINAL *);
/* miscellaneous entry points */
extern NCURSES_EXPORT(int) restartterm (NCURSES_CONST char *, int, int *);
extern NCURSES_EXPORT(int) setupterm (NCURSES_CONST char *,int,int *);
This is a h2incx converted fragment of the above:
/* h2incx generated: term.inc */
;NCURSES_EXPORT proto :DWORD
_nc_set_tty_mode proto :ptr TTY
;NCURSES_EXPORT proto :DWORD
_nc_get_tty_mode proto :ptr TTY
;NCURSES_EXPORT proto :DWORD
_nc_read_entry proto :ptr SBYTE, :ptr SBYTE, :ptr TERMTYPE
;NCURSES_EXPORT proto :DWORD
_nc_read_file_entry proto :ptr SBYTE, :ptr TERMTYPE
;NCURSES_EXPORT proto :DWORD
_nc_read_termtype proto :ptr TERMTYPE, :ptr SBYTE, :DWORD
;NCURSES_EXPORT proto :ptr SBYTE
_nc_first_name proto :ptr SBYTE
;NCURSES_EXPORT proto :DWORD
_nc_name_match proto :ptr SBYTE, :ptr SBYTE, :ptr SBYTE
;NCURSES_EXPORT proto :ptr TERMTYPE
_nc_fallback proto :ptr SBYTE
;NCURSES_EXPORT proto :ptr TERMINAL
set_curterm proto :ptr TERMINAL
;NCURSES_EXPORT proto :DWORD
del_curterm proto :ptr TERMINAL
;NCURSES_EXPORT proto :DWORD
restartterm proto :ptr NCURSES_CONST, :DWORD, :ptr DWORD
;NCURSES_EXPORT proto :DWORD
setupterm proto :ptr NCURSES_CONST, :DWORD, :ptr DWORD
The comments were added by me. It appears that h2incx misunderstood the declaration and converted the return type as well.
The header does not compile without errors.
This is a konw-fasm.pl converted fragment:
/* konw-fasm.pl generated term.inc */
/* internals */
/* entry points */
/* miscellaneous entry points */
konw-fasm.pl (as well as the -nasm.pl and -gas.pl) could not understand the declaration and therefore completely omitted the section.
This was converted manually:
/* hand generated: term.inc */
;/* internals */
_nc_set_tty_mode proto c :DWORD
_nc_get_tty_mode proto c :DWORD
_nc_read_entry proto c :DWORD,:DWORD,:DWORD
_nc_read_file_entry proto c :DWORD,:DWORD
_nc_read_termtype proto c :DWORD,:DWORD,:DWORD
_nc_first_name proto c :DWORD
_nc_name_match proto c :DWORD,:DWORD,:DWORD
_nc_fallback proto c :DWORD
;/* entry points */
set_curterm proto c :DWORD
del_curterm proto c :DWORD
;/* miscellaneous entry points */
restartterm proto c :DWORD,:DWORD,:DWORD
setupterm proto c :DWORD,:DWORD,:DWORD
The manually generated header compiles without errors, but, does not execute properly.
I have to tinker with it some more.