bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ncurses binding, configure types?


From: willett
Subject: ncurses binding, configure types?
Date: Fri, 9 Sep 2005 01:34:37 -0400

This is a question rather than a bug.

I've written a binding for gpc Pascal to call ncurses. It seems to work very well on my own system, Mac OSX (powerpc-apple-darwin8). I'd like to distribute this for other gpc users, on a diversity of hosts. However, I believe it will break on systems with different size types, because I currently define the following as (the Pascal equivalents of):

 @cf_cv_typeof_chtype@     unsigned long
 @cf_cv_type_of_bool@       unsigned int

  @cf_cv_widec_shift@         8
  @cf_cv_shift_limit@           32
  @cf_cv_1UL@                   1UL


And chtype and bool, in particular, are used in structures. Thus if my Pascal type doesn't match the
size of the c type in ncurses, the structure fields will not align.

I would like to make my pascal binding more portable, but my knowledge of configuration files and c is rather limited, as is the time I can put into automating this process. My candiate
solutions are:

Simplest: I can give the user a couple of greps to run on ncurses.h, and instructions to edit
the Pascal types by hand to match the c types.

Harder: Ada bindings apparently run a c program that includes ncurses.h and does stuff like:

  if (sizeof(chtype)==sizeof(int)) {
        if (sizeof(int)==sizeof(long))
          printf(fmt,"C_ULong");
        else
          printf(fmt,"C_UInt");
      }
      else if (sizeof(chtype)==sizeof(long)) {
        printf(fmt,"C_ULong");
      }
      else
        printf("Error\n");

Then runs a makefile on the output of this program and eventually creates an Ada source
file.  Doing this is beyond my time and competence.

Any suggestions?


Thanks,

Willett Kempton






reply via email to

[Prev in Thread] Current Thread [Next in Thread]