OSX Xboard 4.7.2 .app

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

Oh sh*t! There is a conflict here between WinBoard option format (/variant=shogi) and the pathname starting with '/' as well. As the XBoard option parser always understands both formats, it thinks that the path name is an option...

I guess the only solution is to not have XBoard recognizing the WinBoard format. As far as I can see this should not cause any problems: settings are always saved in their own format, and for tourney files always in XBoard format (-variant shogi). It would make interchange of settings files between WinBoard and XBoard impossible, though.

So in args.h, replace the line

Code: Select all

    } else if (ch == '/' || ch == '-') {
by

Code: Select all

    } else if (ch == OPTCHAR || ch == '-') {
(OPTCHAR is defined as '-' or as '/', depending on whether you are compiling XBoard or WinBoard.)

Perhaps in the future I will think of something smarter (like only not recognizing the WB format if it is really parsing a command line, rather than a file, so that you can still exchange files).
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

acutally leaving it as 'xboard' seems to work fine too as it somehow gets the path of the bundle it's trying to open and a bundle's executable is always in the Bundle.app/contents/MacOS folder

Code: Select all

Open new XBoard
xboard
/Applications/Xboard.app/Contents/MacOS
xboard-bin: Unrecognized argument /Applications/Xboard/Josh-Crafty-23.5.pgn
But it doesn't open a second instance if one is running
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

hgm wrote:Oh sh*t! There is a conflict here between WinBoard option format (/variant=shogi) and the pathname starting with '/' as well. As the XBoard option parser always understands both formats, it thinks that the path name is an option...
Lol silly Unix and it's reversed slashes to indicate directories. Why cant we all use back slashes. It's utter madness I tell you!

Well I got good news and I got bad news
The good news is it now works. It opens a pgn file with the OS open with in a new instance.
The bad news is it works a little too well...infinite instances...
All I can say is 10.9 has impressive memory handling as it didn't crash my computer. I just had to log out and log back in.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

Let me make sure I understand what you are doing:

this infinite-instance thing, does that happen when you click the first PGN file (before any XBoards are started), or when you click a second one?

You could check what happens when you comment out the system(buf) line.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

Apparently It doesn't matter if xboard is open before hand. As soon as I click on the pgn file and the OS sends xboard the open file command, it floods.

I tried commenting out the system(buf); line but that broke the command so it doesn't load the file.
[edit]
To be honest I find this encouraging, it tells me that all this trouble messing the macintegration library actually does something, and not be pointless when you fixed / bug.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

What happens when you start XBoard from the command line, without clicking a file? Does it then also get the openFile signal from OS X? (Because that is what the system(buf) essentially does.) If it does, I cannot imagine what filename it would pass. Perhaps we should print that in the debug printf in StartNewXBoard():

Code: Select all

printf("New XBoard, path = '%s'\n", path);
and then look what it prints.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

In answer to your question I think It does. I opened a command terminal dragged the launcher and then the pgn file into it and got this

Code: Select all

Joshuas-MacBook-Pro:~ herecomethej$ /Users/herecomethej/Desktop/Xboard.app/Contents/MacOS/Xboard /Applications/Xboard/Josh-Crafty-23.5.pgn 
Xboard
/Users/herecomethej/Desktop/Xboard.app/Contents/MacOS
Open new XBoard
New XBoard, path = '/Applications/Xboard/Josh-Crafty-23.5.pgn'
Dec 19 12&#58;01&#58;01 Joshuas-MacBook-Pro.local Xboard-bin&#91;16264&#93; <Error>&#58; The function `CGContextErase' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance.
Ignore the error, it always says that, unless it is an xboard problem. But I have never seen it in linux so it must be some library

Anyway I didn't uncomment the system(buf); though as the end result would make it hard to see what was going on, but in this instance the pgn file did load correctly. This would not be using the finder "open with" but I see the debug stuff anyway.
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

It occurred to me that's exactly what we wanted to see.
I uncommented the system(buff), opened up a terminal, dragged the xboard launcher and png file into it, and hit enter.

Sure enough, it opened again and again...

So it's not the Finder 'open with' signal that's at fault, as i didn't open the pgn file that way. It has something to do with how it's creating new instances for the opening of a pgn file. Though the load game menu works perfectly into the currently open instance. I'm not sure how that relates.
User avatar
hgm
Posts: 27788
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: OSX Xboard 4.7.2 .app

Post by hgm »

One thing I still do not quite understand. To start XBoard you drew the launcher script to the terminal, rather than typing a command to start XBoard? Then, you have an XBoard running (but not having loaded any file yet), and you drag a PGN file to the terminal?
JoshPettus
Posts: 730
Joined: Fri Oct 19, 2012 2:23 am

Re: OSX Xboard 4.7.2 .app

Post by JoshPettus »

No I drag the launcher script and the pgn file so essentially it comes down to

Xboard PGNFILE in the terminal. then I hit enter.