nano-x

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

nano-x

Carsten Bager
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.

Carsten

at line 698 error : syntax error
at line 964 error : syntax error
Unexpected wrap of line 964
" { GR_WM_PROPERTIES props; \"


-- line 698 --
#define GR_ERROR_STRINGS
        " "
        "Bad window id: %d\n",
        "Bad graphics context: %d\n",
        "Bad cursor size\n",
        "Out of server memory\n",
        "Bad window size: %d\n",
        "Keyboard error\n",
        "Mouse error\n",
        "Input only window: %d\n",
        "Illegal on root window: %d\n",
        "Clipping overflow\n",
        "Screen error\n",
        "Unmapped focus window: %d\n",
        "Bad drawing mode gc: %d\n",
        "Bad line attribute gc: %d\n",
        "Bad fill mode gc: %d\n",
        "Bad region id: %d\n",

-- line 964 --
#define GrSetWindowBackgroundColor(wid,color) \
                { GR_WM_PROPERTIES props; \
                        props.flags = GR_WM_FLAGS_BACKGROUND; \
                        props.background = color; \
                        GrSetWMProperties(wid, &props); \
                }

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: nano-x

Jeff Pohlmeyer
> 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
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal