[fpc-pascal] Re: nano-x

Jeff Pohlmeyer yetanothergeek at gmail.com
Wed Jun 21 13:12:24 CEST 2006


> I am trying to convert nano-X.h to a pas file but I get some errors.
> This is 2 of them.
> I cannot se what the problem is, can anyone give me a hint.


h2pas is not perfect, some things it doesn't understand,
and other "C" things simply don't make sense in Pascal.

So you will probably end up translating a lot by hand.

My guess, the two problems you posted would look
something like this:


(**************************)


const GR_ERROR_STRINGS: array[0..17] of pchar = (
  ' ',
  'Bad window id: %d'#10,
  'Bad graphics context: %d'#10,
  'Bad cursor size'#10,
  'Out of server memory'#10,
  'Bad window size: %d'#10,
  'Keyboard error'#10,
  'Mouse error'#10,
  'Input only window: %d'#10,
  'Illegal on root window: %d'#10,
  'Clipping overflow'#10,
  'Screen error'#10,
  'Unmapped focus window: %d'#10,
  'Bad drawing mode gc: %d'#10,
  'Bad line attribute gc: %d'#10,
  'Bad fill mode gc: %d'#10,
  'Bad region id: %d'#10,
  nil
);



procedure GrSetWindowBackgroundColor(wid:GR_WINDOW_ID; color:GR_COLOR);
var
  props: GR_WM_PROPERTIES;
begin
  props.flags := GR_WM_FLAGS_BACKGROUND;
  props.background := color;
  GrSetWMProperties(wid, @props);
end;

(**************************)


You might also try pre-processing the headers
with cpp -nostdinc (or gcc -E)


 - Jeff



More information about the fpc-pascal mailing list