Anyone else think that this is a good idea
Zebuddi.

I'd find it useful, especially as it relates to PureBasic. Great suggestion Zebuddi123.Zebuddi123 wrote:Anyone else think that this is a good idea

I think that to some extent, all of us are. College taught me COBOL for some reason, and coming from a six-year background of BASIC, I resisted that god-awful language. I had always wanted to make the shift to C, but BASIC was just so comfortable, with QuickBASIC, BASIC PDS, and then once VB came along, I never looked back. And now, with PureBasic, I never will.Zebuddi123 wrote:...some of us are not formally trained in the arts of programming, we are self taught, bedroom coders and tinkerers...

I just had to deal with this:idle wrote:it comes to dealing with char **string parameters to a function
Code: Select all
Bool XF86VidModeGetAllModeLines(Display *display, int screen, int *modecount_return, XF86VidModeModeInfo ***modesinfo);where's a barf icon when you need oneluis wrote:Triple indirection, someone offers more ?Code: Select all
Bool XF86 VidModeGetAllModeLines(Display *display, int screen, int *modecount_return, XF86VidModeModeInfo ***modesinfo);
Code: Select all
;in the function def *ppModes.XF86VidModeModeInfo)
global modes.XF86VidModeModeInfo
global *pmodes = @modes
global *ppmodes = @*pmodes
VidModeGetAllModeLines(@display,screen,@modecount_return,@*ppmodes)

I can understand address of address; but address of, address of address?idle wrote:where's a barf icon when you need one...
idle wrote: something like this?
Code: Select all
EnableExplicit
ImportC "-lXxf86vm"
XF86VidModeGetAllModeLines.i(*display, screen, *modecount_return, *ppmodesinfo)
EndImport
ImportC "-lX11"
XOpenDisplay.i(display_name.p-utf8)
XCloseDisplay(*display)
XDefaultScreen.i(*display)
EndImport
Structure XF86VidModeModeInfo Align #PB_Structure_AlignC
dotclock.l
hdisplay.u
hsyncstart.u
hsyncend.u
htotal.u
hskew.u
vdisplay.u
vsyncstart.u
vsyncend.u
vtotal.u
flags.l
privsize.l
*private
EndStructure
Global ModeNum, *modes, *mode.XF86VidModeModeInfo
Global screen, dpy, i
dpy = XOpenDisplay("")
screen = XDefaultScreen(dpy)
XF86VidModeGetAllModeLines(dpy, screen, @ModeNum, @*modes)
*mode = PeekI(*modes) ; triple indirection -> XF86VidModeModeInfo ***modes
For i = 1 To ModeNum
Debug "Mode " + i + " = " + *mode\hdisplay + " x " + *mode\vdisplay
*mode + SizeOf(XF86VidModeModeInfo)
Next
XCloseDisplay(dpy)
For C's "long" data type it depends on the platform. It is PB's Integer on Linux and Mac. On Windows it is PB's Long data type.idle wrote:There's usually no issue converting structures only needing to substitute
c int = pb long
c long = pb integer
