gnubg-1.02.000/0000755000000000000000000000000012175510123010000 500000000000000gnubg-1.02.000/gtkrace.c0000644000000000000000000002437212157217760011527 00000000000000/* * gtkrace.c * * by Joern Thyssen , 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkrace.c,v 1.41 2013/06/16 02:16:16 mdpetch Exp $ */ #include "config.h" #include #include #include #include #include #include "backgammon.h" #include "gtkrace.h" #include "osr.h" #include "format.h" #include "gtkwindows.h" typedef struct _epcwidget { GtkWidget *apwEPC[2]; GtkWidget *apwWastage[2]; } epcwidget; typedef struct _racewidget { GtkAdjustment *padjTrials; GtkWidget *pwRollout, *pwOutput; TanBoard anBoard; epcwidget epcwOSR; int fMove; } racewidget; static GtkWidget * monospace_text(const char *szOutput) { GtkWidget *pwText; GtkTextBuffer *buffer; GtkTextIter iter; pwText = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(pwText), GTK_WRAP_NONE); buffer = gtk_text_buffer_new(NULL); gtk_text_buffer_create_tag(buffer, "monospace", "family", "monospace", NULL); gtk_text_buffer_get_end_iter(buffer, &iter); gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, szOutput, -1, "monospace", NULL); gtk_text_view_set_buffer(GTK_TEXT_VIEW(pwText), buffer); return pwText; } static GtkWidget * KleinmanPage(TanBoard anBoard, const int UNUSED(fMove)) { char sz[500]; show_kleinman(anBoard, sz); return monospace_text(sz); } static GtkWidget * TwoSidedPage(TanBoard anBoard, const int UNUSED(fMove)) { char sz[500]; show_bearoff(anBoard, sz); return monospace_text(sz); } static GtkWidget * KeithPage(TanBoard anBoard, const int UNUSED(fMove)) { char sz[500]; show_keith(anBoard, sz); return monospace_text(sz); } static GtkWidget * Pip8912Page(TanBoard anBoard, const int UNUSED(fMove)) { char sz[500]; show_8912(anBoard, sz); return monospace_text(sz); } static GtkWidget * ThorpPage(TanBoard anBoard, const int UNUSED(fMove)) { char sz[500]; show_thorp(anBoard, sz); return monospace_text(sz); } static GtkWidget * EffectivePipCount(const float arPips[2], const float arWastage[2], const int fInvert, epcwidget * pepcw) { GtkWidget *pwTable = gtk_table_new(3, 4, FALSE); GtkWidget *pwvbox = gtk_vbox_new(FALSE, 0); GtkWidget *pw; GtkWidget *pwFrame; gchar *sz; unsigned int i; pwFrame = gtk_frame_new(_("Effective pip count")); gtk_container_add(GTK_CONTAINER(pwFrame), pwvbox); gtk_container_set_border_width(GTK_CONTAINER(pwvbox), 4); /* table */ gtk_box_pack_start(GTK_BOX(pwvbox), pwTable, FALSE, FALSE, 4); gtk_table_attach(GTK_TABLE(pwTable), pw = gtk_label_new(_("EPC")), 1, 2, 0, 1, 0, 0, 4, 4); gtk_table_attach(GTK_TABLE(pwTable), pw = gtk_label_new(_("Wastage")), 2, 3, 0, 1, 0, 0, 4, 4); for (i = 0; i < 2; ++i) { sz = g_strdup_printf(_("Player %s"), ap[i].szName); gtk_table_attach(GTK_TABLE(pwTable), pw = gtk_label_new(sz), 0, 1, i + 1, i + 2, 0, 0, 4, 4); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); g_free(sz); sz = g_strdup_printf("%7.3f", arPips[fInvert ? !i : i]); gtk_table_attach(GTK_TABLE(pwTable), pw = gtk_label_new(sz), 1, 2, i + 1, i + 2, 0, 0, 4, 4); g_free(sz); if (pepcw) pepcw->apwEPC[i] = pw; sz = g_strdup_printf("%7.3f", arWastage[fInvert ? !i : i]); gtk_table_attach(GTK_TABLE(pwTable), pw = gtk_label_new(sz), 2, 3, i + 1, i + 2, 0, 0, 4, 4); g_free(sz); if (pepcw) pepcw->apwWastage[i] = pw; } gtk_box_pack_start(GTK_BOX(pwvbox), pw = gtk_label_new(_("EPC = Effective pip count = " "Avg. rolls * 8.167")), FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); gtk_box_pack_start(GTK_BOX(pwvbox), pw = gtk_label_new(_("Wastage = EPC - Pips")), FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); return pwFrame; } static void PerformOSR(GtkWidget * UNUSED(pw), racewidget * prw) { unsigned int nTrials = (unsigned int) gtk_adjustment_get_value(prw->padjTrials); float ar[5]; int i, j; char sz[16]; unsigned int anPips[2]; const float x = (2 * 3 + 3 * 4 + 4 * 5 + 4 * 6 + 6 * 7 + 5 * 8 + 4 * 9 + 2 * 10 + 2 * 11 + 1 * 12 + 1 * 16 + 1 * 20 + 1 * 24) / 36.0f; float arMu[2]; gchar *pch; GtkTreeIter iter; GtkTreeModel *store; raceProbs((ConstTanBoard) prw->anBoard, nTrials, ar, arMu); PipCount((ConstTanBoard) prw->anBoard, anPips); store = gtk_tree_view_get_model(GTK_TREE_VIEW(prw->pwOutput)); gtk_tree_model_get_iter_first(store, &iter); for (i = 0; i < 5; ++i) { if (fOutputWinPC) sprintf(sz, "%5.1f%%", ar[i] * 100.0f); else sprintf(sz, "%5.3f", ar[i]); gtk_list_store_set(GTK_LIST_STORE(store), &iter, i + 1, sz, -1); } /* effective pip count */ for (i = 0; i < 2; ++i) { j = prw->fMove ? i : !i; pch = g_strdup_printf("%7.3f", arMu[j] * x); gtk_label_set_text(GTK_LABEL(prw->epcwOSR.apwEPC[i]), pch); g_free(pch); pch = g_strdup_printf("%7.3f", arMu[j] * x - anPips[j]); gtk_label_set_text(GTK_LABEL(prw->epcwOSR.apwWastage[i]), pch); g_free(pch); } } static GtkWidget * do_rollout_view(void) { GtkWidget *view; GtkListStore *store; GtkCellRenderer *renderer; GtkTreeIter iter; int i; const char *aszTitle[] = { NULL, N_("Win"), N_("W g"), N_("W bg"), N_("L g"), N_("L bg") }; store = gtk_list_store_new(6, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); gtk_list_store_append(store, &iter); gtk_list_store_set(GTK_LIST_STORE(store), &iter, 0, _("Rollout"), -1); view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); g_object_unref(store); renderer = gtk_cell_renderer_text_new(); for (i = 0; i < 6; i++) { gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(view), -1, gettext(aszTitle[i]), renderer, "text", i, NULL); } return view; } static GtkWidget * OSRPage(TanBoard UNUSED(anBoard), racewidget * prw) { GtkWidget *pwvbox = gtk_vbox_new(FALSE, 4); GtkWidget *pw; GtkWidget *pwp = gtk_alignment_new(0, 0, 0, 0); float ar0[2] = { 0, 0 }; char *pch; gtk_container_set_border_width(GTK_CONTAINER(pwp), 4); gtk_container_add(GTK_CONTAINER(pwp), pwvbox); prw->padjTrials = GTK_ADJUSTMENT(gtk_adjustment_new(5760, 1, 1296 * 1296, 36, 36, 0)); pw = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwvbox), pw, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), gtk_label_new(_("Trials:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), gtk_spin_button_new(prw->padjTrials, 36, 0), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pw), prw->pwRollout = gtk_button_new_with_label(_("Roll out")), TRUE, TRUE, 4); g_signal_connect(G_OBJECT(prw->pwRollout), "clicked", G_CALLBACK(PerformOSR), prw); /* separator */ gtk_box_pack_start(GTK_BOX(pwvbox), gtk_hseparator_new(), FALSE, FALSE, 4); /* result */ pch = g_strdup_printf(_("%s on roll:"), ap[prw->fMove].szName); gtk_box_pack_start(GTK_BOX(pwvbox), pw = gtk_label_new(pch), FALSE, FALSE, 4); gtk_misc_set_alignment(GTK_MISC(pw), 0.0f, 0.5f); g_free(pch); prw->pwOutput = do_rollout_view(); gtk_box_pack_start(GTK_BOX(pwvbox), prw->pwOutput, FALSE, FALSE, 4); /* effective pip count */ gtk_box_pack_start(GTK_BOX(pwvbox), gtk_hseparator_new(), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwvbox), EffectivePipCount(ar0, ar0, !prw->fMove, &prw->epcwOSR), FALSE, FALSE, 4); return pwp; } /* * Display widget with misc. race stuff: * - kleinman * - thorp * - one chequer race * - one sided rollout */ extern void GTKShowRace(TanBoard anBoard) { GtkWidget *pwDialog; GtkWidget *pwNotebook; racewidget *prw; prw = malloc(sizeof(racewidget)); g_assert(prw != NULL); memcpy(prw->anBoard, anBoard, 2 * 25 * sizeof(int)); prw->fMove = ms.fMove; /* create dialog */ pwDialog = GTKCreateDialog(_("GNU Backgammon - Race Theory"), DT_INFO, NULL, DIALOG_FLAG_MODAL, NULL, NULL); /* add notebook pages */ pwNotebook = gtk_notebook_new(); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwNotebook); gtk_container_set_border_width(GTK_CONTAINER(pwNotebook), 4); /* 8-9-12 */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), Pip8912Page(anBoard, prw->fMove), gtk_label_new(_("8912 Rule"))); /* Kleinman */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), KleinmanPage(anBoard, prw->fMove), gtk_label_new(_("Kleinman Formula"))); /* Thorp */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), ThorpPage(anBoard, prw->fMove), gtk_label_new(_("Thorp Count"))); /* Keith */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), KeithPage(anBoard, prw->fMove), gtk_label_new(_("Keith Count"))); /* One sided rollout */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), OSRPage(anBoard, prw), gtk_label_new(_("One-Sided Rollout/Database"))); /* Two-sided database */ gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), TwoSidedPage(anBoard, prw->fMove), gtk_label_new(_("Two-Sided Database"))); /* show dialog */ /* OSR can take a long time for non-race positions */ if (ClassifyPosition(msBoard(), ms.bgv) <= CLASS_RACE) PerformOSR(NULL, prw); gtk_notebook_set_current_page(GTK_NOTEBOOK(pwNotebook), 0); GTKRunDialog(pwDialog); } gnubg-1.02.000/external_y.h0000644000000000000000000000523712175510116012254 00000000000000/* A Bison parser, made by GNU Bison 2.5. */ /* Bison interface for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { STRING = 258, NUMBER = 259, EVALUATION = 260, PLIES = 261, CUBE = 262, CUBEFUL = 263, CUBELESS = 264, NOISE = 265, PRUNE = 266, CRAWFORDRULE = 267, JACOBYRULE = 268, FIBSBOARD = 269, AFIBSBOARD = 270, ON = 271, OFF = 272 }; #endif /* Tokens. */ #define STRING 258 #define NUMBER 259 #define EVALUATION 260 #define PLIES 261 #define CUBE 262 #define CUBEFUL 263 #define CUBELESS 264 #define NOISE 265 #define PRUNE 266 #define CRAWFORDRULE 267 #define JACOBYRULE 268 #define FIBSBOARD 269 #define AFIBSBOARD 270 #define ON 271 #define OFF 272 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 2068 of yacc.c */ #line 49 "external_y.y" int number; char *sval; /* Line 2068 of yacc.c */ #line 91 "external_y.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif extern YYSTYPE extlval; gnubg-1.02.000/gtk-multiview.h0000644000000000000000000000443512173277425012724 00000000000000/* gtk-multiview.h * Copyright (C) 2000 Jonathan Blandford * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * $Id: gtk-multiview.h,v 1.9 2013/07/22 18:51:01 mdpetch Exp $ */ /* License changed from the GNU LGPL to the GNU GPL (as permitted * under Term 3 of the GNU LGPL) by Gary Wong for distribution * with GNU Backgammon. */ #ifndef __GTK_MULTIVIEW_H__ #define __GTK_MULTIVIEW_H__ #define GTK_TYPE_MULTIVIEW (gtk_multiview_get_type ()) #define GTK_MULTIVIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_MULTIVIEW, GtkMultiview)) #define GTK_MULTIVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_MULTIVIEW, GtkMultiviewClass)) #define GTK_IS_MULTIVIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_MULTIVIEW)) #define GTK_IS_MULTIVIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GTK_TYPE_MULTIVIEW)) #define GTK_MULTIVIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_MULTIVIEW, GtkMultiviewClass)) typedef struct _GtkMultiview GtkMultiview; typedef struct _GtkMultiviewClass GtkMultiviewClass; struct _GtkMultiview { GtkContainer parent; /*< private > */ GtkWidget *current; GList *children; }; struct _GtkMultiviewClass { GtkContainerClass parent_class; }; GType gtk_multiview_get_type(void); GtkWidget *gtk_multiview_new(void); void gtk_multiview_prepend_child(GtkMultiview * multiview, GtkWidget * child); void gtk_multiview_insert_child(GtkMultiview * multiview, GtkWidget * back_child, GtkWidget * child); void gtk_multiview_append_child(GtkMultiview * multiview, GtkWidget * child); void gtk_multiview_set_current(GtkMultiview * multiview, GtkWidget * child); #endif /* __GTK_MULTIVIEW_H__ */ gnubg-1.02.000/drawboard.h0000644000000000000000000000432512157217753012057 00000000000000/* * drawboard.h * * by Gary Wong , 1998-2001. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: drawboard.h,v 1.20 2013/06/16 02:16:11 mdpetch Exp $ */ #ifndef DRAWBOARD_H #define DRAWBOARD_H #include "gnubg-types.h" extern int fClockwise; /* Player 1 moves clockwise */ extern char *DrawBoard(char *pch, const TanBoard anBoard, int fRoll, char *asz[], char *szMatchID, int nChequers); /* Fill the buffer pch with a representation of the move anMove, assuming * the board looks like anBoard. pch must have room for 28 characters plus * a trailing 0 (consider the move `bar/24* 23/22* 21/20* 19/18*'). */ extern char *FormatMove(char *pch, const TanBoard anBoard, int anMove[8]); extern char *FormatMovePlain(char *pch, TanBoard anBoard, int anMove[8]); extern int ParseMove(char *pch, int an[8]); extern void CanonicalMoveOrder(int an[]); /* Fill the buffer pch with a FIBS "boardstyle 3" description of the game. */ extern char *FIBSBoard(char *pch, TanBoard anBoard, int fRoll, const char *szPlayer, const char *szOpp, int nMatchTo, int nScore, int nOpponent, int nDice0, int nDice1, int nCube, int fCubeOwner, int fDoubled, int fTurn, int fCrawford, int nChequers); /* Read a FIBS "boardstyle 3" description from pch. */ extern int ParseFIBSBoard(char *pch, TanBoard anBoard, char *szPlayer, char *szOpp, int *pnMatchTo, int *pnScore, int *pnScoreOpponent, int anDice[2], int *pnCube, int *pfCubeOwner, int *pfDoubled, int *pfCrawford); #endif gnubg-1.02.000/sgf_l.l0000644000000000000000000000457710731035352011206 00000000000000/* * sgf.l * * by Gary Wong , 2000. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: sgf_l.l,v 1.1 2007/12/15 20:36:58 c_anthon Exp $ */ %{ #include "config.h" #include #include "list.h" #include #include "sgf.h" #include "sgf_y.h" #include extern int _SGFWarning( char * ); static int error( char *s ) { /* refer to yy_fatal_error, to shut up the compiler */ (void) yy_fatal_error; if( SGFErrorHandler ) SGFErrorHandler( s, 0 ); else fprintf( stderr, "%s\n", s ); return 0; } #define YY_FATAL_ERROR(m) error(m) %} %option noyywrap %option prefix="sgf" %option 8bit %option nodefault %option ecs %option fast %option noread %option outfile="lex.yy.c" %option noinput %option nounput %option noyy_scan_buffer %option noyy_scan_bytes %option noyy_scan_string %x value %% [[:space:]]+ /* ignore */ "("|")"|";" return *yytext; [[:lower:]]*[[:upper:]][[:lower:]]*[[:upper:]]?[[:lower:]]* { char *pch; sgflval.ach[ 1 ] = 0; for( pch = yytext; *pch; pch++ ) if( isupper( *pch ) ) { sgflval.ach[ 0 ] = *pch; break; } for( pch++; *pch; pch++ ) if( isupper( *pch ) ) { sgflval.ach[ 1 ] = *pch; break; } return PROPERTY; } [[:lower:]]+ /* ignore -- this rule avoids making flex back up */ "[" BEGIN(value); return '['; . { error( _("illegal character in SGF file" )); } \0 /* ignore -- we want value strings null-terminated */ "\\]" { sgflval.pch = strdup( "]" ); return VALUETEXT; } "\\\n" /* ignore */ "]" BEGIN(INITIAL); return ']'; [^]\0\\]+ { sgflval.pch = strdup( yytext ); return VALUETEXT; } \\.? { sgflval.pch = strdup( yytext ); return VALUETEXT; } %% gnubg-1.02.000/file.c0000644000000000000000000002642512157217754011032 00000000000000/* * file.c * * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: file.c,v 1.25 2013/06/16 02:16:12 mdpetch Exp $ */ #include "config.h" #include "backgammon.h" #include #include "file.h" #include ExportFormat export_format[] = { {EXPORT_SGF, ".sgf", N_("Gnu Backgammon File"), "sgf", {TRUE, TRUE, TRUE} } , /*must be the first element */ {EXPORT_HTML, ".html", N_("HTML"), "html", {TRUE, TRUE, TRUE} } , {EXPORT_GAM, ".gam", N_("Jellyfish Game"), "gam", {FALSE, TRUE, FALSE} } , {EXPORT_MAT, ".mat", N_("Jellyfish Match"), "mat", {TRUE, FALSE, FALSE} } , {EXPORT_POS, ".pos", N_("Jellyfish Position"), "pos", {FALSE, FALSE, TRUE} } , {EXPORT_LATEX, ".tex", N_("LaTeX"), "latex", {TRUE, TRUE, FALSE} } , #if HAVE_PANGOCAIRO {EXPORT_PDF, ".pdf", N_("PDF"), "pdf", {TRUE, TRUE, TRUE} } , #endif {EXPORT_TEXT, ".txt", N_("Plain Text"), "text", {TRUE, TRUE, TRUE} } , #if HAVE_LIBPNG {EXPORT_PNG, ".png", N_("Portable Network Graphics"), "png", {FALSE, FALSE, TRUE} } , #endif #if HAVE_PANGOCAIRO {EXPORT_PS, ".ps", N_("Postscript"), "ps", {TRUE, TRUE, TRUE} } , #endif {EXPORT_SNOWIETXT, ".txt", N_("Snowie Text"), "snowietxt", {TRUE, TRUE, TRUE} } , #if HAVE_PANGOCAIRO {EXPORT_SVG, ".svg", N_("SVG"), "svg", {FALSE, FALSE, TRUE} } , #endif }; ImportFormat import_format[] = { {IMPORT_SGF, ".sgf", N_("Gnu Backgammon File"), "sgf"} , /*must be the first element */ {IMPORT_SGG, ".sgg", N_("Gamesgrid Save Game"), "sgg"} , {IMPORT_BKG, ".bkg", N_("Hans Berliner's BKG Format"), "bkg"} , {IMPORT_MAT, ".mat", N_("Jellyfish Match"), "mat"} , {IMPORT_OLDMOVES, ".fibs", N_("FIBS oldmoves format"), "oldmoves"} , {IMPORT_POS, ".pos", N_("Jellyfish Position"), "pos"} , {IMPORT_SNOWIETXT, ".txt", N_("Snowie Text"), "snowietxt"} , {IMPORT_TMG, ".tmg", N_("True Moneygames"), "tmg"} , {IMPORT_EMPIRE, ".gam", N_("GammonEmpire Game"), "empire"} , {IMPORT_PARTY, ".gam", N_("PartyGammon Game"), "party"} , {IMPORT_BGROOM, ".bgf", N_("BackGammonRoom Game"), "bgroom"} , {N_IMPORT_TYPES, NULL, N_("Unknown file format"), NULL} }; typedef struct _FileHelper { FILE *fp; size_t dataRead; unsigned int dataPos; char *data; } FileHelper; /* Data structures and functions for getting file type data */ static FileHelper * OpenFileHelper(const char *filename) { FileHelper *fh; if (!filename || !g_file_test(filename, G_FILE_TEST_EXISTS) || g_file_test(filename, G_FILE_TEST_IS_DIR)) return NULL; /* File not found */ fh = g_new(FileHelper, 1); fh->fp = g_fopen(filename, "r"); if (!fh->fp) { /* Failed to open file */ g_free(fh); return NULL; } fh->dataRead = 0; fh->dataPos = 0; fh->data = NULL; return fh; } static void CloseFileHelper( /*lint -e{818} */ FileHelper * fh) { fclose(fh->fp); free(fh->data); } static void fhReset(FileHelper * fh) { /* Reset data pointer to start of file */ fh->dataPos = 0; } static void fhDataGetChar(FileHelper * fh) { size_t numRead; if (fh->dataPos < fh->dataRead) return; #define BLOCK_SIZE 1024 #define MAX_READ_SIZE 5000 fh->data = realloc(fh->data, fh->dataRead + BLOCK_SIZE); if (fh->dataRead > MAX_READ_SIZE) numRead = 0; /* Too big - should have worked things out by now! */ else numRead = fread(fh->data + fh->dataRead, 1, BLOCK_SIZE, fh->fp); if (numRead < BLOCK_SIZE) { (fh->data + fh->dataRead)[numRead] = '\0'; numRead++; } fh->dataRead += numRead; } static char fhPeekNextChar(FileHelper * fh) { fhDataGetChar(fh); return fh->data[fh->dataPos]; } static char fhReadNextChar(FileHelper * fh) { fhDataGetChar(fh); return fh->data[fh->dataPos++]; } static int fhPeekNextIsWS(FileHelper * fh) { char c = fhPeekNextChar(fh); return (c == ' ' || c == '\t' || c == '\r' || c == '\n'); } static void fhSkipWS(FileHelper * fh) { while (fhPeekNextIsWS(fh)) (void) fhReadNextChar(fh); } static int fhSkipToEOL(FileHelper * fh) { char c; do { c = fhReadNextChar(fh); if (c == '\n') return TRUE; } while (c != '\0'); return FALSE; } static int fhReadString(FileHelper * fh, const char *str) { /* Check file has str next */ while (*str) { if (fhReadNextChar(fh) != *str) return FALSE; str++; } return TRUE; } static int fhReadStringNC(FileHelper * fh, const char *str) { /* Check file has str next (ignoring case) */ while (*str) { char c = fhReadNextChar(fh); if (g_ascii_tolower(c) != *str) return FALSE; str++; } return TRUE; } static int fhPeekStringNC(FileHelper * fh, const char *str) { /* Check file has str next (ignoring case) but don't move */ unsigned int pos = fh->dataPos; int ret = TRUE; while (*str) { char c = fhReadNextChar(fh); if (g_ascii_tolower(c) != *str) { ret = FALSE; break; } str++; } fh->dataPos = pos; return ret; } static int fhReadNumber(FileHelper * fh) { /* Check file has str next */ int anyNumbers = FALSE; do { char c = fhPeekNextChar(fh); if (!g_ascii_isdigit(c)) return anyNumbers; anyNumbers = TRUE; } while (fhReadNextChar(fh) != '\0'); return TRUE; } static int fhReadAnyAlphNumString(FileHelper * fh) { char c = fhPeekNextChar(fh); if (!g_ascii_isalnum(c)) return FALSE; do { c = fhPeekNextChar(fh); if (!g_ascii_isalnum(c) && c != '_') return fhPeekNextIsWS(fh); } while (fhReadNextChar(fh) != '\0'); return TRUE; } static int IsSGFFile(FileHelper * fh) { const char *elements[] = { "(", ";", "FF", "[", "4", "]", "GM", "[", "6", "]", "" }; const char **test = elements; fhReset(fh); while (**test) { fhSkipWS(fh); if (!fhReadString(fh, *test)) return FALSE; test++; } return TRUE; } static int IsSGGFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadAnyAlphNumString(fh)) { fhSkipWS(fh); if (!fhReadString(fh, "vs.")) return FALSE; fhSkipWS(fh); if (fhReadAnyAlphNumString(fh)) return TRUE; } return FALSE; } static int IsMATFile(FileHelper * fh) { fhReset(fh); do { char c; fhSkipWS(fh); c = fhPeekNextChar(fh); if (g_ascii_isdigit(c)) { if (fhReadNumber(fh)) { fhSkipWS(fh); if (fhReadStringNC(fh, "point")) { fhSkipWS(fh); if (fhReadStringNC(fh, "match")) return TRUE; } } return FALSE; } } while (fhSkipToEOL(fh)); return FALSE; } static int IsTMGFile(FileHelper * fh) { fhReset(fh); do { fhSkipWS(fh); if (fhPeekStringNC(fh, "game")) { (void) fhReadStringNC(fh, "game"); fhSkipWS(fh); return fhReadNumber(fh) && (fhPeekNextChar(fh) == ':'); } (void) fhReadAnyAlphNumString(fh); if (fhPeekNextChar(fh) != ':') return FALSE; } while (fhSkipToEOL(fh)); return FALSE; } static int IsTXTFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadNumber(fh) && fhReadNextChar(fh) == ';') { fhSkipWS(fh); if (fhReadNumber(fh) && fhReadNextChar(fh) == ';') return TRUE; } return FALSE; } static int IsJFPFile(FileHelper * fh) { char firstbyte; fhReset(fh); firstbyte = fhReadNextChar(fh); if (firstbyte < 124 || firstbyte > 126) return FALSE; if ((fhReadNextChar(fh) == '\0')) return TRUE; else return FALSE; } static int IsBKGFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadString(fh, "Black")) return TRUE; fhReset(fh); fhSkipWS(fh); if (fhReadString(fh, "White")) return TRUE; return FALSE; } static int IsGAMFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadAnyAlphNumString(fh)) { fhSkipWS(fh); if (fhReadAnyAlphNumString(fh)) { fhSkipWS(fh); return fhReadString(fh, "1)"); } } return FALSE; } static int IsPARFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadStringNC(fh, "boardid=")) { (void) fhSkipToEOL(fh); if (fhReadStringNC(fh, "creator=")) return TRUE; } return FALSE; } static int IsBGRFile(FileHelper * fh) { fhReset(fh); fhSkipWS(fh); if (fhReadStringNC(fh, "bgf version")) { fhSkipWS(fh); if (!fhReadString(fh, "1.2")) printf("Unexpected version of bgroom file!\n"); return TRUE; } return FALSE; } extern FilePreviewData * ReadFilePreview(const char *filename) { FilePreviewData *fpd; FileHelper *fh = OpenFileHelper(filename); if (!fh) return NULL; fpd = g_new0(FilePreviewData, 1); fpd->type = N_IMPORT_TYPES; if (IsSGFFile(fh)) fpd->type = IMPORT_SGF; else if (IsSGGFile(fh)) fpd->type = IMPORT_SGG; else if (IsTXTFile(fh)) fpd->type = IMPORT_SNOWIETXT; else if (IsTMGFile(fh)) fpd->type = IMPORT_TMG; else if (IsMATFile(fh)) fpd->type = IMPORT_MAT; else if (IsJFPFile(fh)) fpd->type = IMPORT_POS; else if (IsBKGFile(fh)) fpd->type = IMPORT_BKG; else if (IsGAMFile(fh)) fpd->type = IMPORT_EMPIRE; else if (IsPARFile(fh)) fpd->type = IMPORT_PARTY; else if (IsBGRFile(fh)) fpd->type = IMPORT_BGROOM; CloseFileHelper(fh); return fpd; } extern char * GetFilename(int CheckForCurrent, ExportType type) { char *sz, tstr[15]; time_t t; if (CheckForCurrent && szCurrentFileName && *szCurrentFileName) sz = g_strdup_printf("%s%s", szCurrentFileName, export_format[type].extension); else { if (mi.nYear) sprintf(tstr, "%04d-%02d-%02d", mi.nYear, mi.nMonth, mi.nDay); else { t = time(NULL); if (strftime(tstr, 14, "%Y-%m-%d-%H%M", localtime(&t)) == 0) *tstr = '\0'; } sz = g_strdup_printf("%s-%s_%dp_%s.sgf", ap[0].szName, ap[1].szName, ms.nMatchTo, tstr); } return sz; } gnubg-1.02.000/multithread.h0000644000000000000000000001447512167360641012437 00000000000000/* * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: multithread.h,v 1.52 2013/07/10 22:35:13 mdpetch Exp $ */ #ifndef MULTITHREAD_H #define MULTITHREAD_H #include "config.h" #if defined(WIN32) #include #include #endif #if defined(USE_MULTITHREAD) #include #endif #include "backgammon.h" /*#define DEBUG_MULTITHREADED 1 */ #if defined (USE_MULTITHREAD) && defined(DEBUG_MULTITHREADED) void multi_debug(const char *str, ...); #else #define multi_debug(x) #endif typedef struct _Task { AsyncFun fun; void *data; struct _Task *pLinkedTask; } Task; typedef struct _AnalyseMoveTask { Task task; moverecord *pmr; listOLD *plGame; statcontext *psc; matchstate ms; } AnalyseMoveTask; typedef struct _ThreadLocalData { int id; move *aMoves; NNState *pnnState; } ThreadLocalData; #if defined(GLIB_THREADS) typedef struct _ManualEvent { #if GLIB_CHECK_VERSION (2,32,0) GCond cond; #else GCond *cond; #endif int signalled; } *ManualEvent; typedef GPrivate* TLSItem; #if GLIB_CHECK_VERSION (2,32,0) typedef GMutex Mutex; #else typedef GMutex *Mutex; #endif #elif defined(WIN32) /* GLIB_THREAD */ typedef HANDLE ManualEvent; typedef DWORD TLSItem; typedef HANDLE Event; typedef HANDLE Mutex; #define WaitForManualEvent(ME) WaitForSingleObject(ME, INFINITE) #define ResetManualEvent(ME) ResetEvent(ME) #define SetManualEvent(ME) SetEvent(ME) extern void TLSSetValue(TLSItem pItem, int value); #if defined (DEBUG_MULTITHREADED) extern void Mutex_Lock(Mutex mutex, const char *reason); #else #define Mutex_Lock(mutex, reason) WaitForSingleObject(mutex, INFINITE) #define Mutex_Release(mutex) ReleaseMutex(mutex) #endif #endif #if defined(USE_MULTITHREAD) typedef struct _ThreadData { int doneTasks; GList *tasks; int result; ThreadLocalData *tld; ManualEvent activity; TLSItem tlsItem; Mutex queueLock; Mutex multiLock; ManualEvent syncStart; ManualEvent syncEnd; int addedTasks; int totalTasks; int closingThreads; unsigned int numThreads; } ThreadData; #else typedef struct _ThreadData { int doneTasks; GList *tasks; int result; ThreadLocalData *tld; } ThreadData; #endif extern int MT_GetDoneTasks(void); extern void MT_AbortTasks(void); extern void MT_AddTask(Task * pt, gboolean lock); extern void mt_add_tasks(unsigned int num_tasks, AsyncFun pFun, void *taskData, gpointer linked); extern int MT_WaitForTasks(gboolean(*pCallback) (gpointer), int callbackTime, int autosave); extern void MT_InitThreads(void); extern void MT_Close(void); extern void MT_CloseThreads(void); extern void CloseThread(void *unused); extern ThreadLocalData *MT_CreateThreadLocalData(int id); extern ThreadData td; #if defined(USE_MULTITHREAD) #if defined(GLIB_THREADS) extern void ResetManualEvent(ManualEvent ME); extern void Mutex_Lock(Mutex mutex, const char *reason); extern void Mutex_Release(Mutex mutex); extern void WaitForManualEvent(ManualEvent ME); extern void SetManualEvent(ManualEvent ME); extern void TLSSetValue(TLSItem pItem, size_t value); #endif extern void TLSFree(TLSItem pItem); extern void InitManualEvent(ManualEvent * pME); extern void FreeManualEvent(ManualEvent ME); extern void InitMutex(Mutex * pMutex); extern void FreeMutex(Mutex mutex); #define UI_UPDATETIME 250 #if defined (GLIB_THREADS) #define TLSGet(item) *((size_t*)g_private_get(item)) #else /* WIN32 */ #define TLSGet(item) *((int*)TlsGetValue(item)) #endif /* GLIB_THREADS */ #if !defined(MAX_NUMTHREADS) #define MAX_NUMTHREADS 48 #endif extern void MT_Release(void); extern void MT_Exclusive(void); extern void MT_StartThreads(void); extern void MT_SetNumThreads(unsigned int num); extern void MT_SyncInit(void); extern void MT_SyncStart(void); extern double MT_SyncEnd(void); extern void MT_SetResultFailed(void); extern void TLSCreate(TLSItem * pItem); extern unsigned int MT_GetNumThreads(void); #define MT_GetTLD() ((ThreadLocalData *)TLSGet(td.tlsItem)) #define MT_GetThreadID() ((ThreadLocalData *)TLSGet(td.tlsItem))->id #define MT_Get_nnState() ((ThreadLocalData *)TLSGet(td.tlsItem))->pnnState #define MT_Get_aMoves() ((ThreadLocalData *)TLSGet(td.tlsItem))->aMoves #if defined (GLIB_THREADS) #if GLIB_CHECK_VERSION (2,30,0) #define MT_SafeIncValue(x) (g_atomic_int_add(x, 1) + 1) #define MT_SafeIncCheck(x) (g_atomic_int_add(x, 1)) #else #define MT_SafeIncValue(x) (g_atomic_int_exchange_and_add(x, 1) + 1) #define MT_SafeIncCheck(x) (g_atomic_int_exchange_and_add(x, 1)) #endif /* * We don't use the value returned by the next three * Pre-2.30 void atomic_int_add() is ok */ #define MT_SafeInc(x) g_atomic_int_add(x, 1) #define MT_SafeAdd(x, y) g_atomic_int_add(x, y) #define MT_SafeDec(x) g_atomic_int_add(x, -1) #define MT_SafeDecCheck(x) g_atomic_int_dec_and_test(x) #else #define MT_SafeInc(x) (void)InterlockedIncrement((long*)x) #define MT_SafeIncValue(x) InterlockedIncrement((long*)x) #define MT_SafeIncCheck(x) (InterlockedIncrement((long*)x) > 1) #define MT_SafeAdd(x, y) InterlockedExchangeAdd((long*)x, y) #define MT_SafeDec(x) (void)InterlockedDecrement((long*)x) #define MT_SafeDecCheck(x) (InterlockedDecrement((long*)x) == 0) #endif #else /*USE_MULTITHREAD */ #if !defined(MAX_NUMTHREADS) #define MAX_NUMTHREADS 1 #endif extern int asyncRet; #define MT_Exclusive() {} #define MT_Release() {} #define MT_GetNumThreads() 1 #define MT_SetResultFailed() asyncRet = -1 #define MT_SafeInc(x) (++(*x)) #define MT_SafeIncValue(x) (++(*x)) #define MT_SafeIncCheck(x) ((*x)++) #define MT_SafeAdd(x, y) ((*x) += y) #define MT_SafeDec(x) (--(*x)) #define MT_SafeDecCheck(x) ((--(*x)) == 0) #define MT_GetThreadID() 0 #define MT_Get_nnState() td.tld->pnnState #define MT_Get_aMoves() td.tld->aMoves #define MT_GetTLD() td.tld #endif #endif gnubg-1.02.000/NEWS0000644000000000000000000002011611462622113010420 00000000000000GNU Backgammon NEWS -- history of user-visible changes. 15 Jan * Changes in GNU Backgammon 0.14.4 ** add functions for importing and exporting board designs. ** coloring of blunders, lucky rolls etc in the game list (controlled by styles in gnubg.gtkrc) ** improved chequer movement in GUI (dragging with pick'n'pass) ** right-click context menu with entries for undo move and score sheet * Changes in GNU Backgammon 0.14.3 ** fix "bug" in Zadeh match equity table ** Add built-in support for Claes Tornberg's mec ** Russian translation started ** Interface to relational databases using Python ** New utility program bearoffdump to dump information about databases. * Changes in GNU Backgammon 0.14.2 ** Translations *** added Czech *** several languages updates. See README for status. ** 3D boards *** new quick draw option for computers without accelerated drivers ** Several bug fixes * Changes in GNU Backgammon 0.14.1 ** Rollouts *** extendable rollouts ** Bearoff *** support for Hugh Sconyers' 15x15 full bearoff database ** 3D boards ** Time controls ** Translations to *** English (US) (complete) *** German (95% finished) *** Italian (90% finished) *** Japanese (60% finished) *** French (60% finished) *** Islandic (25% finished) *** Tyrkish (25% finished) *** Danish (20% finished) * Changes in GNU Backgammon 0.14 ** general *** improved support for Jacoby rule and variants (Nackgammon, Hypergammon, and cubeless) *** new program to generate databases for Hypergammon. ** New dice generator: *** read dice from file (similar to Jellyfish) *** dice manipulation, e.g., roll the best roll for computer player ** Import *** import position files in Snowie .txt format (illegal moves will be imported correctly) ** Export *** export positions in Snowie .txt format ** Analysis *** option to analyse one side only (e.g., skip analysis of GNU Backgammons moves) *** Sho Sengoku temperature map * Changes in GNU Backgammon 0.13 ** swap players *** new command "swap players" (also available from the menu Game->Swap Players) that swaps the players. Useful when your match imported from, e.g., GamesGrid is "upside-down". ** analysis *** new command "analyse move" (Analyse->Analyse Move) *** analysis of resignations *** tutor mode added ** match equity tables are now read from XML files. Allows the user to specify her own favorite MET. ** Support for "skewed" METs, for example, tables from Jacobs and Trice's fish book. Also, a new command "set invert met on|off" to specify whether the table should be used as entered, or used inverted. For example, the supplied METs from Jacobs and Trice's book are entered with player 0 being the stronger player. If the table should be used with player 1 being the stronger player use: "set invert met on". ** Rollouts: *** rollout positions as initial position (i.e., no doubles on first roll). *** quasi-random dice added. *** simple variance reduction for cubeful rollouts. *** statistics (e.g, number of times closed out, cube efficiency etc). *** fixed bug in calculations of standard errors. *** standard errors are now shown in equity or mwc according to user settings. ** Evaluations *** "crashed" neural net added. *** much more flexible rollout databases added. *** movefilter commands added, to allow user customisation of move pruning. *** hint dialog improved. ** Save, Load, Export, and Import *** it is now possible to set-up default paths for saving, loading, export, and import of matches and games. ** A set of predefined settings for evaluations. ** Introduction of a Match ID for simple and convinient exchange of positions. ** Import from BKG and TMG formats. ** Export in PDF, (Encapsulated) PostScript, LaTeX, HTML, plain text and PNG. *** export settings dialog available from Settings->Export (warning: only html export uses some of the options). ** New dice generators: *** random.org *** Blum, Blum and Shub ** Manual browser added (requires GTK+ 2.0 or newer). ** Message window added. ** Sounds added. ** Board designs added. ** Player records added. ** Internationali[sz]ation. ** Distribution of rolls ** Chequer movement: click bearoff tray for gready bearoff or for showing forced move. * Changes in GNU Backgammon 0.12 ** Various bug fixes. ** Cubeful rollouts added. ** Revised chequer moving interface (both while playing and in edit mode). ** Added chequer animation option. ** gnubg now offers resignations when its position is hopeless. ** "eq2mwc" and "mwc2eq" commands added. ** Importing of .mat, .sgg and FIBS "oldmoves" files added. ** Exporting to LaTeX, PostScript and PDF format added. ** Add a variant rule which forbids more than 5 chequers on a point. ** Added command line options `-c' (--command) and `-s' (--script). * Changes in GNU Backgammon 0.11 ** Various bug fixes. ** Reduced 2-ply searching improved. ** Support matches up to length 64, for all match equity tables. ** Annotation (analysis, commentary and statistics) features added. ** Various buttons (take, drop, double, roll, etc.) added to the GTK+ board. ** New Guile primitives: classify-position, evaluate-position-cubeful, game-state, menu-bar. ** Optional point number labels added to the GTK+ board. ** Random number seeds for rollouts may now be specified. * Changes in GNU Backgammon 0.10 ** Man page added. ** Import and export of position databases added. ** "set output" and "set training" commands added. ** External players (where moves are read from a socket to another process) added. ** Importing of JF ".pos" position files added. ** Added Guile support, if Guile is available. ** Allow "=n" notation for moves (e.g. "eval =1" evaluates the position after gnubg's first choice move is played; "rollout =1 =3" rolls out the best and 3rd best moves). ** Generate an in-memory heuristic bearoff database if it can't be read from the filesystem. ** .SGF format support for loading and saving added. ** Added game and match navigation: use `next' and `previous' commands, or equivalent buttons in game window. ** Cubeful evaluation added. ** You can now load and save settings, and specify startup commands in a ~/.gnubgrc file. ** Added GTK+ port, and many associated features. ** MD5 dice generation added. ** Added command line options `-d' (--datadir), `-b' (--no-bearoff), `-r' (--no-rc) and `-w' (--window-system-only). ** Reduced searches added. ** "!" shell escapes added. ** Allow finer grained "set evaluation" commands (rollouts, each player, and "eval"/"hint" use separate settings). ** Added Nackgammon option. ** Clicking on the cube in the board window is equivalent to the command "double". ** The board window now gives better feedback about any move (if the move is a partial or complete legal move, it is displayed, otherwise "Illegal move" is shown). Chequers may be moved around without restriction, and all legal moves will be recognised. ** The player names now default to the user's login name and "gnubg". ** Added --no-weights option to disable reading weights files. Generate and use binary weight files if available. ** Optional automatic bearoffs in non-contact positions ("set autobearoff"). ** Match and session play has been added, along with support for the Crawford and Jacoby rules, and automatic doubles. ** The position ID is now displayed in board window. ** Allow alternate style of moving chequers in board window with mouse buttons 2 and 3. ** Added support for other dice generators ("set rng"). ** Many miscellaneous commands implemented. ** More bug fixes. * Changes in GNU Backgammon 0.02 ** Bug fixes (10225, 10227). ** Added --tty option to disable X operation, and made everything fall back to TTY if X fails. ** Now reads weights and bearoff database from $pkgdatadir (defaults to /usr/local/share/gnubg/) if not found in current directory. ** Started implementation of supervised training (only enabled if gdbm is available). See "help database". * Changes in GNU Backgammon 0.01 ** Bug fixes (100110, 100113, 100114, 100115, 100118, 100122, 100150). ** Rudimentary X window system support. * GNU Backgammon 0.0 ** Initial release. Local Variables: mode: outline End: gnubg-1.02.000/gtksplash.c0000644000000000000000000000635112157217760012104 00000000000000/* * gtksplash.c * * by Joern Thyssen , 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtksplash.c,v 1.34 2013/06/16 02:16:16 mdpetch Exp $ */ #include "config.h" #include "gtklocdefs.h" #include "gtkgame.h" #include "util.h" #include "gtksplash.h" typedef struct _gtksplash { GtkWidget *pwWindow; GtkWidget *apwStatus[2]; } gtksplash; extern GtkWidget * CreateSplash(void) { gtksplash *pgs; GtkWidget *pwvbox, *pwFrame, *pwb; GtkWidget *pwImage; gchar *fn; int i; pgs = (gtksplash *) g_malloc(sizeof(gtksplash)); pgs->pwWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_role(GTK_WINDOW(pgs->pwWindow), "splash screen"); gtk_window_set_type_hint(GTK_WINDOW(pgs->pwWindow), GDK_WINDOW_TYPE_HINT_SPLASHSCREEN); gtk_window_set_title(GTK_WINDOW(pgs->pwWindow), _("Starting " VERSION_STRING)); gtk_window_set_position(GTK_WINDOW(pgs->pwWindow), GTK_WIN_POS_CENTER); gtk_widget_realize(GTK_WIDGET(pgs->pwWindow)); /* gdk_window_set_decorations ( GTK_WIDGET ( pgs->pwWindow )->window, 0 ); */ /* content of page */ pwvbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pgs->pwWindow), pwvbox); /* image */ fn = g_build_filename(getPkgDataDir(), "pixmaps", "gnubg-big.png", NULL); pwImage = gtk_image_new_from_file(fn); g_free(fn); gtk_box_pack_start(GTK_BOX(pwvbox), pwImage, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwvbox), pwFrame = gtk_frame_new(NULL), FALSE, FALSE, 0); gtk_frame_set_shadow_type(GTK_FRAME(pwFrame), GTK_SHADOW_ETCHED_OUT); gtk_container_add(GTK_CONTAINER(pwFrame), pwb = gtk_vbox_new(FALSE, 0)); /* status bar */ for (i = 0; i < 2; ++i) { pgs->apwStatus[i] = gtk_label_new(NULL); gtk_box_pack_start(GTK_BOX(pwb), pgs->apwStatus[i], FALSE, FALSE, 4); } /* signals */ g_object_set_data_full(G_OBJECT(pgs->pwWindow), "gtksplash", pgs, g_free); gtk_widget_show_all(GTK_WIDGET(pgs->pwWindow)); ProcessEvents(); return pgs->pwWindow; } extern void DestroySplash(GtkWidget * pwSplash) { if (!pwSplash) return; #ifndef WIN32 /* Don't bother with these pauses on windows? */ g_usleep(250 * 1000); #endif gtk_widget_destroy(pwSplash); } extern void PushSplash(GtkWidget * pwSplash, const gchar * szText0, const gchar * szText1) { gtksplash *pgs; if (!pwSplash) return; pgs = (gtksplash *) g_object_get_data(G_OBJECT(pwSplash), "gtksplash"); gtk_label_set_text(GTK_LABEL(pgs->apwStatus[0]), szText0); gtk_label_set_text(GTK_LABEL(pgs->apwStatus[1]), szText1); ProcessEvents(); } gnubg-1.02.000/gtkexport.c0000644000000000000000000005770012157217756012144 00000000000000/* * gtkexport.c * * by Joern Thyssen , 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkexport.c,v 1.50 2013/06/16 02:16:14 mdpetch Exp $ */ #include "config.h" #include #include #include #include #include #include "backgammon.h" #include "eval.h" #include "gtkgame.h" #include "export.h" #include "gtkexport.h" #include "boarddim.h" #include "gtkwindows.h" #include "gtklocdefs.h" static char *aszInclude[] = { N_("Annotations"), N_("Analysis"), N_("Statistics"), N_("Match Information") }; #define NUM_INCLUDE (sizeof(aszInclude)/sizeof(aszInclude[0])) static char *aszMovesDisplay[] = { N_("Show for moves marked 'very bad'"), N_("Show for moves marked 'bad'"), N_("Show for moves marked 'doubtful'"), N_("Show for unmarked moves"), }; #define NUM_MOVES (sizeof(aszMovesDisplay)/sizeof(aszMovesDisplay[0])) static char *aszCubeDisplay[] = { N_("Show for cube decisions marked 'very bad'"), N_("Show for cube decisions marked 'bad'"), N_("Show for cube decisions marked 'doubtful'"), N_("Show for unmarked cube decisions"), N_("Show for actual cube decisions"), N_("Show for missed doubles"), N_("Show for close cube decisions") }; #define NUM_CUBES (sizeof(aszCubeDisplay)/sizeof(aszCubeDisplay[0])) typedef struct _exportwidget { /* export settings */ exportsetup *pexs; /* include */ GtkWidget *apwInclude[NUM_INCLUDE]; /* board */ GtkAdjustment *padjDisplayBoard; GtkWidget *apwSide[2]; /* moves */ GtkAdjustment *padjMoves; GtkWidget *pwMovesDetailProb; GtkWidget *apwMovesParameters[2]; GtkWidget *apwMovesDisplay[NUM_MOVES]; /* cube */ GtkWidget *pwCubeDetailProb; GtkWidget *apwCubeParameters[2]; GtkWidget *apwCubeDisplay[NUM_CUBES]; /* other stuff */ GtkWidget *pwHTMLPictureURL; GtkWidget *pwHTMLType; GtkWidget *pwHTMLCSS; /* Sizes */ GtkWidget *pwPNGSize; GtkAdjustment *adjPNGSize; GtkWidget *pwHtmlSize; GtkAdjustment *adjHtmlSize; } exportwidget; static void ExportGetValues(exportwidget * pew, exportsetup * pexs) { unsigned int i; /* include */ pexs->fIncludeAnnotation = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwInclude[0])); pexs->fIncludeAnalysis = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwInclude[1])); pexs->fIncludeStatistics = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwInclude[2])); pexs->fIncludeMatchInfo = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwInclude[3])); /* board */ pexs->fDisplayBoard = (int) gtk_adjustment_get_value(pew->padjDisplayBoard); pexs->fSide = 0; for (i = 0; i < 2; i++) pexs->fSide = pexs->fSide | (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwSide[i])) << i); /* moves */ pexs->nMoves = (int) gtk_adjustment_get_value(pew->padjMoves); pexs->fMovesDetailProb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->pwMovesDetailProb)); for (i = 0; i < 2; i++) pexs->afMovesParameters[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwMovesParameters[i])); for (i = 0; i < NUM_MOVES; i++) pexs->afMovesDisplay[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwMovesDisplay[i])); /* cube */ pexs->fCubeDetailProb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->pwCubeDetailProb)); for (i = 0; i < 2; i++) pexs->afCubeParameters[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwCubeParameters[i])); /* skip unused entries */ for (i = 0; i < NUM_CUBES; i++) { if (aszCubeDisplay[i]) { pexs->afCubeDisplay[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pew->apwCubeDisplay[i])); } } /* html */ pexs->szHTMLPictureURL = g_strdup(gtk_entry_get_text(GTK_ENTRY(pew->pwHTMLPictureURL))); pexs->het = (htmlexporttype) gtk_combo_box_get_active(GTK_COMBO_BOX(pew->pwHTMLType)); pexs->hecss = (htmlexportcss) gtk_combo_box_get_active(GTK_COMBO_BOX(pew->pwHTMLCSS)); /* sizes */ pexs->nPNGSize = (int) gtk_adjustment_get_value(pew->adjPNGSize); pexs->nHtmlSize = (int) gtk_adjustment_get_value(pew->adjHtmlSize); } #define CHECKVALUE(orig,new,flag,text,format) \ { \ if ( orig->flag != new->flag ) { \ char *sz = g_strdup_printf ( "set export " text " " format, \ new->flag ); \ UserCommand ( sz ); \ g_free ( sz ); \ } \ } #define CHECKFLAG(orig,new,flag,text) \ { \ if ( orig->flag != new->flag ) { \ char *sz = g_strdup_printf ( "set export " text " %s", \ new->flag ? "on" : "off" ); \ UserCommand ( sz ); \ g_free ( sz ); \ } \ } #define CHECKFLAG2(orig,new,flag,text,text2) \ { \ if ( orig->flag != new->flag ) { \ char *sz = g_strdup_printf ( "set export " text " %s %s", \ text2, new->flag ? "on" : "off" ); \ UserCommand ( sz ); \ g_free ( sz ); \ } \ } static void SetExportCommands(const exportsetup * pexsOrig, const exportsetup * pexsNew) { int i; /* display */ CHECKFLAG(pexsOrig, pexsNew, fIncludeAnnotation, "include annotation"); CHECKFLAG(pexsOrig, pexsNew, fIncludeAnalysis, "include analysis"); CHECKFLAG(pexsOrig, pexsNew, fIncludeStatistics, "include statistics"); CHECKFLAG(pexsOrig, pexsNew, fIncludeMatchInfo, "include matchinfo"); /* board */ CHECKVALUE(pexsOrig, pexsNew, fDisplayBoard, "show board", "%d"); if (pexsOrig->fSide != pexsNew->fSide) { if (pexsNew->fSide == 3) UserCommand("set export show player both"); else { CHECKVALUE(pexsOrig, pexsNew, fSide - 1, "show player", "%d"); } } /* moves */ CHECKVALUE(pexsOrig, pexsNew, nMoves, "moves number", "%d"); CHECKFLAG(pexsOrig, pexsNew, fMovesDetailProb, "moves probabilities"); CHECKFLAG(pexsOrig, pexsNew, afMovesParameters[0], "moves parameters evaluation"); CHECKFLAG(pexsOrig, pexsNew, afMovesParameters[1], "moves parameters rollout"); for (i = 0; i < N_SKILLS; ++i) { if (i == SKILL_NONE) { CHECKFLAG(pexsOrig, pexsNew, afMovesDisplay[i], "moves display unmarked"); } else { CHECKFLAG2(pexsOrig, pexsNew, afMovesDisplay[i], "moves display", aszSkillTypeCommand[i]); } } /* cube */ CHECKFLAG(pexsOrig, pexsNew, fCubeDetailProb, "cube probabilities"); CHECKFLAG(pexsOrig, pexsNew, afCubeParameters[0], "cube parameters evaluation"); CHECKFLAG(pexsOrig, pexsNew, afCubeParameters[1], "cube parameters rollout"); for (i = 0; i < N_SKILLS; ++i) { if (i == SKILL_NONE) { CHECKFLAG(pexsOrig, pexsNew, afCubeDisplay[i], "cube display unmarked"); } else { CHECKFLAG2(pexsOrig, pexsNew, afCubeDisplay[i], "cube display", aszSkillTypeCommand[i]); } } CHECKFLAG(pexsOrig, pexsNew, afCubeDisplay[EXPORT_CUBE_ACTUAL], "cube display actual"); CHECKFLAG(pexsOrig, pexsNew, afCubeDisplay[EXPORT_CUBE_MISSED], "cube display missed"); CHECKFLAG(pexsOrig, pexsNew, afCubeDisplay[EXPORT_CUBE_CLOSE], "cube display close"); /* HTML */ if (strcmp(pexsOrig->szHTMLPictureURL, pexsNew->szHTMLPictureURL)) { char *sz = g_strdup_printf("set export html pictureurl \"%s\"", pexsNew->szHTMLPictureURL); UserCommand(sz); g_free(sz); } if (pexsOrig->het != pexsNew->het) { char *sz = g_strdup_printf("set export html type \"%s\"", aszHTMLExportType[pexsNew->het]); UserCommand(sz); g_free(sz); } if (pexsOrig->hecss != pexsNew->hecss) { char *sz = g_strdup_printf("set export html css \"%s\"", aszHTMLExportCSSCommand[pexsNew->hecss]); UserCommand(sz); g_free(sz); } /* Sizes */ if (pexsOrig->nPNGSize != pexsNew->nPNGSize) { char *sz = g_strdup_printf("set export png size %d", pexsNew->nPNGSize); UserCommand(sz); g_free(sz); } if (pexsOrig->nHtmlSize != pexsNew->nHtmlSize) { char *sz = g_strdup_printf("set export html size %d", pexsNew->nHtmlSize); UserCommand(sz); g_free(sz); } UserCommand("save settings"); } static void ExportOK(GtkWidget * pw, exportwidget * pew) { exportsetup *pexs = pew->pexs; exportsetup exsNew; /* get new settings */ ExportGetValues(pew, &exsNew); /* set new values */ SetExportCommands(pexs, &exsNew); g_free(exsNew.szHTMLPictureURL); gtk_widget_destroy(gtk_widget_get_toplevel(pw)); } static void ExportSet(exportwidget * pew) { exportsetup *pexs = pew->pexs; unsigned int i; /* include */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwInclude[0]), pexs->fIncludeAnnotation); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwInclude[1]), pexs->fIncludeAnalysis); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwInclude[2]), pexs->fIncludeStatistics); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwInclude[3]), pexs->fIncludeMatchInfo); /* board */ gtk_adjustment_set_value(pew->padjDisplayBoard, pexs->fDisplayBoard); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwSide[0]), pexs->fSide & 1); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwSide[1]), pexs->fSide & 2); /* moves */ gtk_adjustment_set_value(pew->padjMoves, pexs->nMoves); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->pwMovesDetailProb), pexs->fMovesDetailProb); for (i = 0; i < 2; i++) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwMovesParameters[i]), pexs->afMovesParameters[i]); for (i = 0; i < NUM_MOVES; i++) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwMovesDisplay[i]), pexs->afMovesDisplay[i]); /* cube */ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->pwCubeDetailProb), pexs->fCubeDetailProb); for (i = 0; i < 2; i++) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwCubeParameters[i]), pexs->afCubeParameters[i]); for (i = 0; i < NUM_CUBES; i++) { if (aszCubeDisplay[i]) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pew->apwCubeDisplay[i]), pexs->afCubeDisplay[i]); } } /* html */ if (pexs->szHTMLPictureURL) gtk_entry_set_text(GTK_ENTRY(pew->pwHTMLPictureURL), pexs->szHTMLPictureURL); gtk_combo_box_set_active(GTK_COMBO_BOX(pew->pwHTMLType), pexs->het); gtk_combo_box_set_active(GTK_COMBO_BOX(pew->pwHTMLCSS), pexs->hecss); /* Sizes */ gtk_adjustment_set_value(GTK_ADJUSTMENT(pew->adjPNGSize), pexs->nPNGSize); gtk_adjustment_set_value(GTK_ADJUSTMENT(pew->adjHtmlSize), pexs->nHtmlSize); } static void SizeChanged(GtkAdjustment * adj, GtkWidget * pwSize) { int n = (int) gtk_adjustment_get_value(adj); char *sz = g_strdup_printf(_("%dx%d pixels"), n * BOARD_WIDTH, n * BOARD_HEIGHT); gtk_label_set_text(GTK_LABEL(pwSize), sz); g_free(sz); } static void ExportHTMLImages(void) { GtkWidget *fc; gchar *message, *expfolder, *folder, *command; gint ok = FALSE; fc = gtk_file_chooser_dialog_new(_ ("Select top folder for html export"), NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL); gtk_window_set_modal(GTK_WINDOW(fc), TRUE); gtk_window_set_transient_for(GTK_WINDOW(fc), GTK_WINDOW(pwMain)); while (!ok) { if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_CANCEL) { gtk_widget_destroy(fc); return; } folder = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); if (folder) { char *name = g_path_get_basename(folder); if (!StrCaseCmp(name, "html-images")) expfolder = g_strdup(folder); else expfolder = g_build_filename(folder, "html-images", NULL); g_free(name); if (g_file_test(expfolder, G_FILE_TEST_IS_DIR)) { message = g_strdup_printf(_("Folder html-images exists\nin %s\nOK to overwrite images?"), folder); ok = GTKGetInputYN(message); g_free(message); } else if (g_mkdir(expfolder, 0777) == 0) { ok = TRUE; } else { message = g_strdup_printf(_("Folder html-images can't be created\nin %s"), folder); GTKMessage(message, DT_ERROR); g_free(message); } if (ok) { command = g_strconcat("export htmlimages \"", expfolder, "\"", NULL); UserCommand(command); g_free(command); UserCommand("save settings"); } g_free(expfolder); g_free(folder); } } gtk_widget_destroy(fc); } static void GenHtmlImages(GtkWidget * UNUSED(widget), gpointer data) { /* Temporariarly set html size and create images */ int temp = exsExport.nHtmlSize; exsExport.nHtmlSize = (int) gtk_adjustment_get_value(GTK_ADJUSTMENT(data)); ExportHTMLImages(); exsExport.nHtmlSize = temp; } extern void GTKShowExport(exportsetup * pexs) { GtkWidget *pwDialog; GtkWidget *pwNotebook; GtkWidget *pwVBox; GtkWidget *pwFrame; GtkWidget *pwTable; GtkWidget *pwTableX; GtkWidget *pwHBox; GtkWidget *pwHScale; GtkWidget *genHtml; GtkWidget *pw; unsigned int i; exportwidget *pew; pew = (exportwidget *) malloc(sizeof(exportwidget)); pew->pexs = pexs; /* create dialog */ pwDialog = GTKCreateDialog(_("GNU Backgammon - Export Settings"), DT_QUESTION, NULL, DIALOG_FLAG_MODAL, G_CALLBACK(ExportOK), pew); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwNotebook = gtk_notebook_new()); gtk_container_set_border_width(GTK_CONTAINER(pwNotebook), 4); /* first tab */ pwTable = gtk_table_new(2, 2, FALSE); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), pwTable, gtk_label_new(_("Content"))); /* include stuff */ pwFrame = gtk_frame_new(_("Include")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 8, 0); pwVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwVBox); for (i = 0; i < NUM_INCLUDE; i++) { gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwInclude[i] = gtk_check_button_new_with_label(gettext(aszInclude[i])), TRUE, TRUE, 0); } /* show stuff */ pwFrame = gtk_frame_new(_("Board")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 2, 2); pwTableX = gtk_table_new(2, 3, FALSE); gtk_container_add(GTK_CONTAINER(pwFrame), pwTableX); gtk_table_attach(GTK_TABLE(pwTableX), pw = gtk_label_new(_("Board")), 0, 1, 0, 1, GTK_FILL, GTK_FILL, 4, 0); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); pw = gtk_hbox_new(FALSE, 0); pew->padjDisplayBoard = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 1000, 1, 1, 0)); gtk_box_pack_start(GTK_BOX(pw), gtk_spin_button_new(pew->padjDisplayBoard, 1, 0), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), gtk_label_new(_("move(s) between board shown")), TRUE, TRUE, 0); gtk_table_attach(GTK_TABLE(pwTableX), pw, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach(GTK_TABLE(pwTableX), pw = gtk_label_new(_("Players")), 0, 1, 1, 2, GTK_FILL, GTK_FILL, 4, 0); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); gtk_table_attach(GTK_TABLE(pwTableX), pew->apwSide[0] = gtk_check_button_new_with_label(ap[0].szName), 1, 2, 1, 2, GTK_FILL, GTK_FILL, 4, 0); gtk_table_attach(GTK_TABLE(pwTableX), pew->apwSide[1] = gtk_check_button_new_with_label(ap[1].szName), 1, 2, 2, 3, GTK_FILL, GTK_FILL, 4, 0); /* moves */ pwFrame = gtk_frame_new(_("Output move analysis")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 0, 1, 1, 2, GTK_FILL, GTK_FILL, 2, 2); pwVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwVBox); pw = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), gtk_label_new(_("Show at most")), TRUE, TRUE, 4); pew->padjMoves = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 1000, 1, 1, 0)); gtk_box_pack_start(GTK_BOX(pw), gtk_spin_button_new(pew->padjMoves, 1, 0), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pw), gtk_label_new(_("move(s)")), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwVBox), pew->pwMovesDetailProb = gtk_check_button_new_with_label(_("Show detailed " "probabilities")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwMovesParameters[0] = gtk_check_button_new_with_label(_("Show evaluation parameters")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwMovesParameters[1] = gtk_check_button_new_with_label(_("Show rollout parameters")), TRUE, TRUE, 0); for (i = 0; i < NUM_MOVES; i++) gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwMovesDisplay[i] = gtk_check_button_new_with_label(gettext(aszMovesDisplay[i])), TRUE, TRUE, 0); /* cube */ pwFrame = gtk_frame_new(_("Output cube decision analysis")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 2, 2); pwVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwVBox); gtk_box_pack_start(GTK_BOX(pwVBox), pew->pwCubeDetailProb = gtk_check_button_new_with_label(_("Show detailed " "probabilities")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwCubeParameters[0] = gtk_check_button_new_with_label(_("Show evaluation " "parameters")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwCubeParameters[1] = gtk_check_button_new_with_label(_("Show rollout " "parameters")), TRUE, TRUE, 0); for (i = 0; i < NUM_CUBES; i++) { if (aszCubeDisplay[i]) { gtk_box_pack_start(GTK_BOX(pwVBox), pew->apwCubeDisplay[i] = gtk_check_button_new_with_label(gettext(aszCubeDisplay[i])), TRUE, TRUE, 0); } } /* second tab */ pwTable = gtk_table_new(1, 2, FALSE); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), pwTable, gtk_label_new(_("Style"))); /* html */ pwFrame = gtk_frame_new(_("HTML export options")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 2, 2); pwVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwVBox); gtk_container_set_border_width(GTK_CONTAINER(pwVBox), 4); gtk_box_pack_start(GTK_BOX(pwVBox), pw = gtk_label_new(_("URL to pictures")), TRUE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(pw), 0, 0.5); gtk_box_pack_start(GTK_BOX(pwVBox), pew->pwHTMLPictureURL = gtk_entry_new(), TRUE, TRUE, 0); pwHBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), gtk_label_new(_("HTML board type:")), TRUE, TRUE, 0); pew->pwHTMLType = gtk_combo_box_text_new(); gtk_box_pack_start(GTK_BOX(pwHBox), pew->pwHTMLType, FALSE, FALSE, 0); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLType), _("GNU Backgammon")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLType), _("BBS")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLType), _("fibs2html")); gtk_combo_box_set_active(GTK_COMBO_BOX(pew->pwHTMLType), 0); gtk_container_set_border_width(GTK_CONTAINER(pwHBox), 4); gtk_box_pack_start(GTK_BOX(pwVBox), pwHBox, FALSE, FALSE, 0); /* HTML CSS */ pwHBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), gtk_label_new(_("CSS Style sheet:")), TRUE, TRUE, 0); pew->pwHTMLCSS = gtk_combo_box_text_new(); gtk_box_pack_start(GTK_BOX(pwHBox), pew->pwHTMLCSS, FALSE, FALSE, 0); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLCSS), _("In ")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLCSS), _("Inline (in tags)")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pew->pwHTMLCSS), _("External file")); gtk_combo_box_set_active(GTK_COMBO_BOX(pew->pwHTMLCSS), 0); gtk_container_set_border_width(GTK_CONTAINER(pwHBox), 4); gtk_box_pack_start(GTK_BOX(pwVBox), pwHBox, FALSE, FALSE, 0); /* Sizes */ pwFrame = gtk_frame_new(_("Export sizes")); gtk_container_set_border_width(GTK_CONTAINER(pwFrame), 8); gtk_table_attach(GTK_TABLE(pwTable), pwFrame, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 2, 2); pwVBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwVBox); gtk_container_set_border_width(GTK_CONTAINER(pwVBox), 4); /* Png size */ pwHBox = gtk_hbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(pwHBox), 4); gtk_box_pack_start(GTK_BOX(pwVBox), pwHBox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), gtk_label_new(_("Size of PNG images:")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), pew->pwPNGSize = gtk_label_new(""), TRUE, TRUE, 0); pew->adjPNGSize = GTK_ADJUSTMENT(gtk_adjustment_new(1, 1, 20, 1, 5, 0)); pwHScale = gtk_hscale_new(pew->adjPNGSize); gtk_scale_set_digits(GTK_SCALE(pwHScale), 0); gtk_box_pack_start(GTK_BOX(pwVBox), pwHScale, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(pew->adjPNGSize), "value-changed", G_CALLBACK(SizeChanged), pew->pwPNGSize); /* Html size */ pwHBox = gtk_hbox_new(FALSE, 0); gtk_container_set_border_width(GTK_CONTAINER(pwHBox), 4); gtk_box_pack_start(GTK_BOX(pwVBox), pwHBox, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), gtk_label_new(_("Size of Html images:")), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), pew->pwHtmlSize = gtk_label_new(""), TRUE, TRUE, 0); pew->adjHtmlSize = GTK_ADJUSTMENT(gtk_adjustment_new(1, 1, 20, 1, 5, 0)); pwHScale = gtk_hscale_new(pew->adjHtmlSize); gtk_scale_set_digits(GTK_SCALE(pwHScale), 0); gtk_box_pack_start(GTK_BOX(pwVBox), pwHScale, FALSE, FALSE, 0); genHtml = gtk_button_new_with_label(_("Generate Html images...")); pwHBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHBox), genHtml, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwVBox), pwHBox, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(genHtml), "clicked", G_CALLBACK(GenHtmlImages), pew->adjHtmlSize); g_signal_connect(G_OBJECT(pew->adjHtmlSize), "value-changed", G_CALLBACK(SizeChanged), pew->pwHtmlSize); /* show dialog */ ExportSet(pew); GTKRunDialog(pwDialog); } gnubg-1.02.000/sound.h0000644000000000000000000000365412157217765011251 00000000000000/* * sound.h * * by Joern Thyssen , 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: sound.h,v 1.23 2013/06/16 02:16:21 mdpetch Exp $ */ #ifndef SOUND_H #define SOUND_H typedef enum _gnubgsound { /* start & exit of gnubg */ SOUND_START = 0, SOUND_EXIT, /* commands */ SOUND_AGREE, SOUND_DOUBLE, SOUND_DROP, SOUND_CHEQUER, SOUND_MOVE, SOUND_REDOUBLE, SOUND_RESIGN, SOUND_ROLL, SOUND_TAKE, /* events */ SOUND_HUMAN_DANCE, SOUND_HUMAN_WIN_GAME, SOUND_HUMAN_WIN_MATCH, SOUND_BOT_DANCE, SOUND_BOT_WIN_GAME, SOUND_BOT_WIN_MATCH, SOUND_ANALYSIS_FINISHED, /* number of sounds */ NUM_SOUNDS } gnubgsound; extern const char *sound_description[NUM_SOUNDS]; extern const char *sound_command[NUM_SOUNDS]; extern int fSound; extern int fQuiet; extern void playSound(const gnubgsound gs); extern void SoundFlushCache(const gnubgsound gs); extern void SoundWait(void); extern char *GetDefaultSoundFile(gnubgsound sound); extern void playSoundFile(char *file, gboolean sync); extern void SetSoundFile(const gnubgsound gs, const char *szFilename); extern char *GetSoundFile(gnubgsound sound); extern const char *sound_get_command(void); extern char *sound_set_command(const char *sz); extern void SetExitSoundOff(void); #endif gnubg-1.02.000/gtkprefs.c0000644000000000000000000034422012161543707011727 00000000000000/* * gtkprefs.c * * by Gary Wong , 2000, 2001, 2002. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkprefs.c,v 1.192 2013/06/23 10:02:47 plm Exp $ */ #include "config.h" #include "gtklocdefs.h" #include "backgammon.h" #include #include #include #include #include #include #include #include #include "drawboard.h" #include "gtkboard.h" #include "gtkgame.h" #include "gtkfile.h" #include "gtkprefs.h" #include "render.h" #include "renderprefs.h" #include "boarddim.h" #include "gtkwindows.h" #include "util.h" #if USE_BOARD3D #include "fun3d.h" #define NUM_NONPREVIEW_PAGES 2 #else #define NUM_NONPREVIEW_PAGES 1 #endif typedef enum _pixmapindex { PI_DESIGN, PI_CHEQUERS0, PI_CHEQUERS1, PI_BOARD, PI_BORDER, PI_DICE0, PI_DICE1, PI_CUBE, NUM_PIXMAPS } pixmapindex; static GtkAdjustment *apadj[2], *paAzimuth, *paElevation, *apadjCoefficient[2], *apadjExponent[2], *apadjBoard[4], *padjRound; static GtkAdjustment *apadjDiceExponent[2], *apadjDiceCoefficient[2]; static GtkWidget *apwColour[2], *apwBoard[4], *pwWood, *pwWoodType, *pwHinges, *pwLightTable, *pwMoveIndicator, *pwWoodF, *pwNotebook, *pwLabels, *pwDynamicLabels; static GList *plBoardDesigns = NULL; #if USE_BOARD3D GtkWidget *pwBoardType, *pwShowShadows, *pwAnimateRoll, *pwAnimateFlag, *pwCloseBoard, *pwDarkness, *lightLab, *darkLab, *pwLightSource, *pwDirectionalSource, *pwQuickDraw, *pwTestPerformance, *pmHingeCol, *frame3dOptions, *dtTextureTypeFrame, *pwPlanView, *pwBoardAngle, *pwSkewFactor, *skewLab, *anglelab, *pwBgTrays, *pwRoundPoints, *dtLightPositionFrame, *dtLightLevelsFrame, *pwRoundedEdges, *pwRoundedPiece, *pwFlatPiece, *pwTextureTopPiece, *pwTextureAllPiece; GtkAdjustment *padjDarkness, *padjAccuracy, *padjBoardAngle, *padjSkewFactor, *padjLightPosX, *padjLightLevelAmbient, *padjLightLevelDiffuse, *padjLightLevelSpecular, *padjLightPosY, *padjLightPosZ, *padjDiceSize; int redrawChange; int pc3dDiceId[2], pcChequer2; #endif GtkWidget *pwPrevBoard; renderdata rdPrefs; static GtkWidget *pwDesignAdd, *pwDesignRemove, *pwDesignUpdate; static GtkWidget *pwDesignImport, *pwDesignExport; static GtkWidget *pwDesignList; static GtkWidget *pwDesignAddAuthor; static GtkWidget *pwDesignAddTitle; GtkListStore *designListStore; enum { NAME_COL = 0, DATA_COL = 1 }; static GtkWidget *apwDiceColour[2]; static GtkWidget *pwCubeColour; static GtkWidget *apwDiceDotColour[2]; static GtkWidget *apwDieColour[2]; static GtkWidget *apwDiceColourBox[2]; static int /*fWood, */ fUpdate; static void GetPrefs(renderdata * prd); void AddPages(BoardData * bd, GtkWidget * pwNotebook, GList * plBoardDesigns); static void AddDesignRow(gpointer data, gpointer user_data); static void AddDesignRowIfNew(gpointer data, gpointer user_data); static GList *ParseBoardDesigns(const char *szFile, const int fDeletable); typedef struct _boarddesign { gchar *szTitle; /* Title of board design */ gchar *szAuthor; /* Name of author */ gchar *szBoardDesign; /* Command for setting board */ int fDeletable; /* is the board design deletable */ } boarddesign; static boarddesign *pbdeSelected = NULL, *pbdeModified; static int FindDesgin(GtkTreeModel * model, boarddesign * pbde, GtkTreeIter * pIter) { if (gtk_tree_model_get_iter_first(model, pIter)) { do { boarddesign *testPtr; gtk_tree_model_get(model, pIter, DATA_COL, &testPtr, -1); if (testPtr == pbde) return TRUE; } while (gtk_tree_model_iter_next(model, pIter)); } return FALSE; } static void SelectRow(boarddesign * pbde) { GtkTreeIter iter; GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(pwDesignList)); if (FindDesgin(model, pbde, &iter)) { /* Select row */ GtkTreePath *start, *end; GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(pwDesignList)); gtk_tree_selection_select_iter(sel, &iter); /* Make sure selection is visible */ if (gtk_notebook_get_current_page(GTK_NOTEBOOK(pwNotebook)) == NUM_NONPREVIEW_PAGES && gtk_tree_view_get_visible_range(GTK_TREE_VIEW(pwDesignList), &start, &end)) { do { boarddesign *testPtr; GtkTreeIter testIter; gtk_tree_model_get_iter(model, &testIter, start); gtk_tree_model_get(model, &testIter, DATA_COL, &testPtr, -1); if (testPtr == pbde) return; /* Visible */ gtk_tree_path_next(start); } while (gtk_tree_path_compare(start, end) != 0); /* Scroll list so item is visible */ gtk_tree_view_scroll_to_cell(GTK_TREE_VIEW(pwDesignList), gtk_tree_model_get_path(model, &iter), NULL, TRUE, 1, 0); } } } static void RemoveListDesign(boarddesign * pbdeSelected) { GtkTreeIter iter; if (FindDesgin(gtk_tree_view_get_model(GTK_TREE_VIEW(pwDesignList)), pbdeSelected, &iter)) gtk_list_store_remove(designListStore, &iter); } static GList * read_board_designs(void) { GList *plUser, *plSystem, *plFinal; gchar *sz; sz = BuildFilename("boards.xml"); plSystem = ParseBoardDesigns(sz, FALSE); g_free(sz); sz = g_build_filename(szHomeDirectory, "boards.xml", NULL); plUser = ParseBoardDesigns(sz, TRUE); g_free(sz); /* Add user list to system list (doesn't copy the user list) */ plFinal = g_list_concat(plSystem, plUser); return plFinal; } static void free_board_design(boarddesign * pbde, void *UNUSED(dummy)) { if (pbde == NULL) return; g_free(pbde->szTitle); g_free(pbde->szAuthor); g_free(pbde->szBoardDesign); g_free(pbde); } static void free_board_designs(GList * pl) { g_list_foreach(pl, (GFunc) free_board_design, NULL); g_list_free(pl); } static void ParsePreferences(boarddesign * pbde, renderdata * prdNew) { char *apch[2]; gchar *sz, *pch; *prdNew = rdPrefs; pch = sz = g_strdup(pbde->szBoardDesign); while (ParseKeyValue(&sz, apch)) RenderPreferencesParam(prdNew, apch[0], apch[1]); g_free(pch); } static boarddesign * FindDesign(GList * plBoardDesigns, renderdata * prdDesign) { int i; renderdata rdTest; for (i = 0; i < (int) g_list_length(plBoardDesigns); i++) { boarddesign *pbde = g_list_nth_data(plBoardDesigns, i); if (pbde) { ParsePreferences(pbde, &rdTest); if (PreferenceCompare(&rdTest, prdDesign)) return pbde; } } return NULL; } static void SetTitle(void) { /* Update dialog title to include design name + author */ boarddesign *pbde; char title[1024]; GtkWidget *pwDialog = gtk_widget_get_toplevel(pwPrevBoard); strcpy(title, _("GNU Backgammon - Appearance")); /* Search for current settings in designs */ strcat(title, ": "); pbde = FindDesign(plBoardDesigns, &rdPrefs); if (pbde) { char design[1024]; SelectRow(pbde); gtk_widget_set_sensitive(GTK_WIDGET(pwDesignRemove), pbde->fDeletable); sprintf(design, "%s by %s (%s)", pbde->szTitle, pbde->szAuthor, pbde->fDeletable ? _("user defined") : _("predefined")); strcat(title, design); pbdeSelected = pbde; gtk_widget_set_sensitive(GTK_WIDGET(pwDesignAdd), FALSE); gtk_widget_set_sensitive(pwDesignUpdate, FALSE); } else { strcat(title, _("Custom design")); gtk_widget_set_sensitive(GTK_WIDGET(pwDesignAdd), TRUE); if (gtk_widget_is_sensitive(pwDesignRemove)) { gtk_widget_set_sensitive(pwDesignUpdate, TRUE); gtk_widget_set_sensitive(pwDesignRemove, FALSE); pbdeModified = pbdeSelected; } pbdeSelected = 0; } gtk_window_set_title(GTK_WINDOW(pwDialog), title); } extern void UpdatePreview(void) { if (!fUpdate) return; { BoardData *bd = BOARD(pwPrevBoard)->board_data; #if USE_BOARD3D BoardData3d *bd3d = bd->bd3d; renderdata *prd = bd->rd; if (display_is_3d(prd)) { /* Sort out chequer and dice special settings */ RerenderBase(bd3d); if (prd->ChequerMat[0].textureInfo != prd->ChequerMat[1].textureInfo) { /* Make both chequers have the same texture */ prd->ChequerMat[1].textureInfo = prd->ChequerMat[0].textureInfo; prd->ChequerMat[1].pTexture = prd->ChequerMat[0].pTexture; UpdateColPreview(pcChequer2); /* Change to main area and recreate piece display lists */ MakeCurrent3d(bd3d); preDraw3d(bd, bd3d, prd); } if (prd->afDieColour3d[0] && !MaterialCompare(&prd->DiceMat[0], &prd->ChequerMat[0])) { memcpy(&prd->DiceMat[0], &prd->ChequerMat[0], sizeof(Material)); prd->DiceMat[0].textureInfo = 0; prd->DiceMat[0].pTexture = 0; UpdateColPreview(pc3dDiceId[0]); } if (prd->afDieColour3d[1] && !MaterialCompare(&prd->DiceMat[1], &prd->ChequerMat[1])) { memcpy(&prd->DiceMat[1], &prd->ChequerMat[1], sizeof(Material)); prd->DiceMat[1].textureInfo = 0; prd->DiceMat[1].pTexture = 0; UpdateColPreview(pc3dDiceId[1]); } gtk_widget_set_sensitive(GTK_WIDGET(dtTextureTypeFrame), (prd->ChequerMat[0].textureInfo != NULL)); } else #endif { /* Create new 2d pixmaps */ board_free_pixmaps(bd); GetPrefs(&rdPrefs); board_create_pixmaps(pwPrevBoard, bd); } } SetTitle(); gtk_widget_queue_draw(pwPrevBoard); } static void DieColourChanged(GtkWidget * pw, gpointer pf) { int f = GPOINTER_TO_INT(pf); int set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pw)); gtk_widget_set_sensitive(apwDiceColourBox[f], !set); if (!fUpdate) return; #if USE_BOARD3D if (display_is_3d(&rdPrefs)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; bd->rd->afDieColour3d[f] = set; memcpy(&bd->rd->DiceMat[f], bd->rd->afDieColour3d[f] ? &bd->rd->ChequerMat[f] : &bd->rd->DiceMat[f], sizeof(Material)); bd->rd->DiceMat[f].textureInfo = 0; bd->rd->DiceMat[f].pTexture = 0; UpdateColPreview(pc3dDiceId[f]); } #endif UpdatePreview(); } static void option_changed(GtkWidget * UNUSED(widget), GtkWidget * UNUSED(pw)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; if (!fUpdate) return; { #if USE_BOARD3D BoardData3d *bd3d = bd->bd3d; renderdata *prd = bd->rd; if (display_is_3d(prd)) { ClearTextures(bd3d); TidyCurveAccuracy3d(bd->bd3d, rdPrefs.curveAccuracy); GetPrefs(&rdPrefs); GetTextures(bd3d, prd); SetupViewingVolume3d(bd, bd3d, prd); preDraw3d(bd, bd3d, prd); } else #endif { board_free_pixmaps(bd); board_create_pixmaps(pwPrevBoard, bd); } } UpdatePreview(); } #if USE_BOARD3D static void redraw_changed(GtkWidget * UNUSED(widget), GtkWidget ** UNUSED(ppw)) { /* Update 3d colour previews */ if (!fUpdate) return; GetPrefs(&rdPrefs); SetPreviewLightLevel(rdPrefs.lightLevels); UpdateColPreviews(); } static void DiceSizeChanged(GtkWidget * UNUSED(pw)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; bd->rd->diceSize = (float) gtk_adjustment_get_value(padjDiceSize); if (DiceTooClose(bd->bd3d, bd->rd)) setDicePos(bd, bd->bd3d); option_changed(0, 0); } static void HingeChanged(GtkWidget * UNUSED(pw)) { gtk_widget_set_sensitive(pmHingeCol, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwHinges))); option_changed(0, 0); } static GtkWidget * ChequerPrefs3d(BoardData * bd) { GtkWidget *pw, *pwx, *vbox, *pwhbox, *dtPieceTypeFrame; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Chequer 0:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->ChequerMat[0], DF_VARIABLE_OPACITY, TT_PIECE), FALSE, FALSE, TT_PIECE); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Chequer 1:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->ChequerMat[1], DF_VARIABLE_OPACITY, TT_PIECE | TT_DISABLED), FALSE, FALSE, TT_PIECE); pcChequer2 = GetPreviewId(); dtPieceTypeFrame = gtk_frame_new(_("Piece type")); gtk_container_set_border_width(GTK_CONTAINER(dtPieceTypeFrame), 4); gtk_box_pack_start(GTK_BOX(pw), dtPieceTypeFrame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtPieceTypeFrame), vbox); pwRoundedPiece = gtk_radio_button_new_with_label(NULL, _("Rounded disc")); gtk_widget_set_tooltip_text(pwRoundedPiece, _("Piece will be a rounded disc")); gtk_box_pack_start(GTK_BOX(vbox), pwRoundedPiece, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundedPiece), (bd->rd->pieceType == PT_ROUNDED)); pwFlatPiece = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pwRoundedPiece), _("Flat edged disc")); gtk_widget_set_tooltip_text(pwFlatPiece, _("Piece will be a flat sided disc")); gtk_box_pack_start(GTK_BOX(vbox), pwFlatPiece, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwFlatPiece), (bd->rd->pieceType == PT_FLAT)); g_signal_connect(G_OBJECT(pwFlatPiece), "toggled", G_CALLBACK(option_changed), bd); dtTextureTypeFrame = gtk_frame_new(_("Texture type")); gtk_container_set_border_width(GTK_CONTAINER(dtTextureTypeFrame), 4); gtk_box_pack_start(GTK_BOX(pw), dtTextureTypeFrame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtTextureTypeFrame), vbox); gtk_widget_set_sensitive(GTK_WIDGET(dtTextureTypeFrame), (bd->rd->ChequerMat[0].textureInfo != NULL)); pwTextureAllPiece = gtk_radio_button_new_with_label(NULL, _("All of piece")); gtk_widget_set_tooltip_text(pwTextureAllPiece, _("All of piece will be textured")); gtk_box_pack_start(GTK_BOX(vbox), pwTextureAllPiece, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwTextureAllPiece), (bd->rd->pieceTextureType == PTT_ALL)); pwTextureTopPiece = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pwTextureAllPiece), _("Top Only")); gtk_widget_set_tooltip_text(pwTextureTopPiece, _("Only top of piece will be textured")); gtk_box_pack_start(GTK_BOX(vbox), pwTextureTopPiece, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwTextureTopPiece), (bd->rd->pieceTextureType == PTT_TOP)); g_signal_connect(G_OBJECT(pwTextureTopPiece), "toggled", G_CALLBACK(option_changed), bd); return pwx; } static GtkWidget * DicePrefs3d(BoardData * bd, int f) { GtkWidget *pw, *pwhbox; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); apwDieColour[f] = gtk_check_button_new_with_label(_("Die colour same " "as chequer colour")); gtk_box_pack_start(GTK_BOX(pw), apwDieColour[f], FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(apwDieColour[f]), bd->rd->afDieColour3d[f]); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Die colour:")), FALSE, FALSE, 4); apwDiceColourBox[f] = gtk_colour_picker_new3d(&bd->rd->DiceMat[f], DF_VARIABLE_OPACITY, TT_NONE); pc3dDiceId[f] = GetPreviewId(); gtk_widget_set_sensitive(GTK_WIDGET(apwDiceColourBox[f]), !bd->rd->afDieColour3d[f]); gtk_box_pack_start(GTK_BOX(pwhbox), apwDiceColourBox[f], FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Pip colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->DiceDotMat[f], DF_FULL_ALPHA, TT_NONE), FALSE, FALSE, TT_PIECE); g_signal_connect(G_OBJECT(apwDieColour[f]), "toggled", G_CALLBACK(DieColourChanged), GINT_TO_POINTER(f)); return pwx; } static GtkWidget * CubePrefs3d(BoardData * bd) { GtkWidget *pw, *pwhbox; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Cube colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->CubeMat, DF_NO_ALPHA, TT_NONE), FALSE, FALSE, TT_PIECE); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Text colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->CubeNumberMat, DF_FULL_ALPHA, TT_NONE), FALSE, FALSE, TT_PIECE); return pwx; } static GtkWidget * BoardPage3d(BoardData * bd) { GtkWidget *pw, *pwhbox; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Background\ncolour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->BaseMat, DF_NO_ALPHA, TT_GENERAL), FALSE, FALSE, TT_PIECE); pwBgTrays = gtk_check_button_new_with_label(_("Show background in bear-off trays")); gtk_widget_set_tooltip_text(pwBgTrays, _("If unset the bear-off trays will be drawn with the board colour")); gtk_box_pack_start(GTK_BOX(pw), pwBgTrays, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwBgTrays), bd->rd->bgInTrays); g_signal_connect(G_OBJECT(pwBgTrays), "toggled", G_CALLBACK(option_changed), 0); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("First\npoint colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->PointMat[0], DF_FULL_ALPHA, TT_GENERAL), FALSE, FALSE, TT_PIECE); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Second\npoint colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->PointMat[1], DF_FULL_ALPHA, TT_GENERAL), FALSE, FALSE, TT_PIECE); pwRoundPoints = gtk_check_button_new_with_label(_("Rounded points")); gtk_widget_set_tooltip_text(pwBgTrays, _("Display the points with a rounded end")); gtk_box_pack_start(GTK_BOX(pw), pwRoundPoints, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundPoints), bd->rd->roundedPoints); g_signal_connect(G_OBJECT(pwRoundPoints), "toggled", G_CALLBACK(option_changed), 0); return pwx; } static GtkWidget * BorderPage3d(BoardData * bd) { GtkWidget *pw, *pwhbox; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Border colour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->BoxMat, DF_FULL_ALPHA, TT_GENERAL), FALSE, FALSE, TT_PIECE); pwRoundedEdges = gtk_check_button_new_with_label(_("Rounded board edges")); gtk_widget_set_tooltip_text(pwRoundedEdges, _("Toggle rounded or square edges to the board")); gtk_box_pack_start(GTK_BOX(pw), pwRoundedEdges, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundedEdges), bd->rd->roundedEdges); g_signal_connect(G_OBJECT(pwRoundedEdges), "toggled", G_CALLBACK(option_changed), 0); pwHinges = gtk_check_button_new_with_label(_("Show hinges")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwHinges), bd->rd->fHinges3d); gtk_box_pack_start(GTK_BOX(pw), pwHinges, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(pwHinges), "toggled", G_CALLBACK(HingeChanged), NULL); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Hinge colour:")), FALSE, FALSE, 4); pmHingeCol = gtk_colour_picker_new3d(&bd->rd->HingeMat, DF_NO_ALPHA, TT_HINGE); gtk_widget_set_sensitive(pmHingeCol, bd->rd->fHinges3d); gtk_box_pack_start(GTK_BOX(pwhbox), pmHingeCol, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Point number\ncolour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->PointNumberMat, DF_FULL_ALPHA, TT_NONE), FALSE, FALSE, TT_PIECE); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Background\ncolour:")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_colour_picker_new3d(&bd->rd->BackGroundMat, DF_NO_ALPHA, TT_GENERAL), FALSE, FALSE, TT_PIECE); return pwx; } #endif extern void gtk_color_button_get_array(GtkColorButton * button, double array[4]) { GdkColor color; guint16 alpha; gtk_color_button_get_color(button, &color); alpha = gtk_color_button_get_alpha(button); array[0] = (gdouble) color.red / 65535.0; array[1] = (gdouble) color.green / 65535.0; array[2] = (gdouble) color.blue / 65535.0; array[3] = (gdouble) alpha / 65535.0; } extern void gtk_color_button_set_from_array(GtkColorButton * button, double colarray[4]) { GdkColor color; guint16 alpha; color.red = (guint16) (colarray[0] * 65535); color.green = (guint16) (colarray[1] * 65535); color.blue = (guint16) (colarray[2] * 65535); alpha = (guint16) (colarray[3] * 65535); gtk_color_button_set_color(button, &color); gtk_color_button_set_alpha(button, alpha); } static GtkWidget * ChequerPrefs(BoardData * bd, int f) { GtkWidget *pw, *pwhbox, *pwx, *pwScale, *pwBox; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); apadj[f] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->arRefraction[f], 1.0, 3.5, 0.1, 1.0, 0.0)); apadjCoefficient[f] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->arCoefficient[f], 0.0, 1.0, 0.1, 0.1, 0.0)); apadjExponent[f] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->arExponent[f], 1.0, 100.0, 1.0, 10.0, 0.0)); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Colour:")), FALSE, FALSE, 4); apwColour[f] = gtk_color_button_new(); g_object_set(G_OBJECT(apwColour[f]), "use-alpha", TRUE, NULL); g_signal_connect(G_OBJECT(apwColour[f]), "color-set", UpdatePreview, NULL); gtk_box_pack_start(GTK_BOX(pwhbox), apwColour[f], TRUE, TRUE, 4); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwColour[f]), bd->rd->aarColour[f]); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Refractive Index:")), FALSE, FALSE, 4); gtk_box_pack_end(GTK_BOX(pwhbox), gtk_hscale_new(apadj[f]), TRUE, TRUE, 4); g_signal_connect(G_OBJECT(apadj[f]), "value-changed", G_CALLBACK(UpdatePreview), NULL); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Dull")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_hscale_new(apadjCoefficient[f]), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Shiny")), FALSE, FALSE, 4); g_signal_connect(G_OBJECT(apadjCoefficient[f]), "value-changed", G_CALLBACK(UpdatePreview), NULL); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Diffuse")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_hscale_new(apadjExponent[f]), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Specular")), FALSE, FALSE, 4); g_signal_connect(G_OBJECT(apadjExponent[f]), "value-changed", G_CALLBACK(UpdatePreview), NULL); if (f == 0) { padjRound = GTK_ADJUSTMENT(gtk_adjustment_new(1.0 - bd->rd->rRound, 0, 1, 0.1, 0.1, 0)); g_signal_connect(G_OBJECT(padjRound), "value-changed", G_CALLBACK(UpdatePreview), NULL); pwScale = gtk_hscale_new(padjRound); gtk_widget_set_size_request(pwScale, 100, -1); gtk_scale_set_draw_value(GTK_SCALE(pwScale), FALSE); gtk_scale_set_digits(GTK_SCALE(pwScale), 2); pwBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwBox), gtk_label_new(_("Chequer shape:")), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), pwBox, FALSE, FALSE, 4); pwBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwBox), gtk_label_new(_("Flat")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwBox), pwScale, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwBox), gtk_label_new(_("Round")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), pwBox, FALSE, FALSE, 4); } return pwx; } static GtkWidget * DicePrefs(BoardData * bd, int f) { GtkWidget *pw, *pwhbox; GtkWidget *pwvbox; GtkWidget *pwFrame; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); /* frame with colour selections for the dice */ pwFrame = gtk_frame_new(_("Die colour")); gtk_box_pack_start(GTK_BOX(pw), pwFrame, FALSE, FALSE, 0); pwvbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(pwFrame), pwvbox); apwDieColour[f] = gtk_check_button_new_with_label(_("Die colour same " "as chequer colour")); gtk_box_pack_start(GTK_BOX(pwvbox), apwDieColour[f], FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(apwDieColour[f]), bd->rd->afDieColour[f]); apwDiceColourBox[f] = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwvbox), apwDiceColourBox[f], FALSE, FALSE, 0); apadjDiceCoefficient[f] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->arDiceCoefficient[f], 0.0, 1.0, 0.1, 0.1, 0.0)); apadjDiceExponent[f] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->arDiceExponent[f], 1.0, 100.0, 1.0, 10.0, 0.0)); gtk_box_pack_start(GTK_BOX(apwDiceColourBox[f]), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Die colour:")), FALSE, FALSE, 4); apwDiceColour[f] = gtk_color_button_new(); g_signal_connect(G_OBJECT(apwDiceColour[f]), "color-set", UpdatePreview, NULL); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwDiceColour[f]), bd->rd->aarDiceColour[f]); gtk_box_pack_start(GTK_BOX(pwhbox), apwDiceColour[f], TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(apwDiceColourBox[f]), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(apwDiceColourBox[f]), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Dull")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_hscale_new(apadjDiceCoefficient[f]), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Shiny")), FALSE, FALSE, 4); g_signal_connect(G_OBJECT(apadjDiceCoefficient[f]), "value-changed", G_CALLBACK(UpdatePreview), NULL); gtk_box_pack_start(GTK_BOX(apwDiceColourBox[f]), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Diffuse")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_hscale_new(apadjDiceExponent[f]), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Specular")), FALSE, FALSE, 4); g_signal_connect(G_OBJECT(apadjDiceExponent[f]), "value-changed", G_CALLBACK(UpdatePreview), NULL); gtk_widget_set_sensitive(GTK_WIDGET(apwDiceColourBox[f]), !bd->rd->afDieColour[f]); /* colour of dot on dice */ gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Pip colour:")), FALSE, FALSE, 4); apwDiceDotColour[f] = gtk_color_button_new(); g_signal_connect(G_OBJECT(apwDiceDotColour[f]), "color-set", UpdatePreview, NULL); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwDiceDotColour[f]), bd->rd->aarDiceDotColour[f]); gtk_box_pack_start(GTK_BOX(pwhbox), apwDiceDotColour[f], TRUE, TRUE, 4); g_signal_connect(G_OBJECT(apwDieColour[f]), "toggled", G_CALLBACK(DieColourChanged), GINT_TO_POINTER(f)); return pwx; } static GtkWidget * CubePrefs(BoardData * bd) { GtkWidget *pw; GtkWidget *pwx; pw = gtk_vbox_new(FALSE, 4); pwx = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), pwx, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), gtk_label_new(_("Cube colour:")), FALSE, FALSE, 0); pwCubeColour = gtk_color_button_new(); g_signal_connect(G_OBJECT(pwCubeColour), "color-set", UpdatePreview, NULL); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(pwCubeColour), bd->rd->arCubeColour); gtk_box_pack_start(GTK_BOX(pwx), pwCubeColour, TRUE, TRUE, 0); /* FIXME add cube text colour settings */ return pw; } static GtkWidget * BoardPage(BoardData * bd) { GtkWidget *pw, *pwhbox; gdouble ar[4]; int i, j; GtkWidget *pwx; static const char *asz[4] = { N_("Background colour:"), NULL, N_("First point colour:"), N_("Second point colour:"), }; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); for (j = 0; j < 4; j++) { if (j == 1) continue; /* colour 1 unused */ apadjBoard[j] = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->aSpeckle[j] / 128.0, 0, 1, 0.1, 0.1, 0)); for (i = 0; i < 4; i++) ar[i] = bd->rd->aanBoardColour[j][i] / 255.0; gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(gettext(asz[j])), FALSE, FALSE, 4); apwBoard[j] = gtk_color_button_new(); g_signal_connect(G_OBJECT(apwBoard[j]), "color-set", UpdatePreview, NULL); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwBoard[j]), ar); gtk_box_pack_start(GTK_BOX(pwhbox), apwBoard[j], TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pw), pwhbox = gtk_hbox_new(FALSE, 0), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Smooth")), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_hscale_new(apadjBoard[j]), TRUE, TRUE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Speckled")), FALSE, FALSE, 4); g_signal_connect(G_OBJECT(apadjBoard[j]), "value-changed", G_CALLBACK(UpdatePreview), NULL); } return pwx; } static void ToggleWood(GtkWidget * pw, BoardData * UNUSED(bd)) { int fWood; fWood = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pw)); gtk_widget_set_sensitive(pwWoodType, fWood); gtk_widget_set_sensitive(apwBoard[1], !fWood); } static GtkWidget * BorderPage(BoardData * bd) { GtkWidget *pw; gdouble ar[4]; int i; static const char *aszWood[] = { N_("Alder"), N_("Ash"), N_("Basswood"), N_("Beech"), N_("Cedar"), N_("Ebony"), N_("Fir"), N_("Maple"), N_("Oak"), N_("Pine"), N_("Redwood"), N_("Walnut"), N_("Willow") }; woodtype bw; GtkWidget *pwx; pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), pw, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(pw), pwWood = gtk_radio_button_new_with_label(NULL, _("Wooden")), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), pwWoodType = gtk_combo_box_text_new(), FALSE, FALSE, 4); for (bw = 0; bw < WOOD_PAINT; bw++) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(pwWoodType), gettext(aszWood[bw])); if (bd->rd->wt == WOOD_PAINT) gtk_combo_box_set_active(GTK_COMBO_BOX(pwWoodType), 0); else gtk_combo_box_set_active(GTK_COMBO_BOX(pwWoodType), bd->rd->wt); g_signal_connect(G_OBJECT(pwWoodType), "changed", G_CALLBACK(UpdatePreview), NULL); gtk_box_pack_start(GTK_BOX(pw), pwWoodF = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pwWood), _("Painted")), FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(bd->rd->wt != WOOD_PAINT ? pwWood : pwWoodF), TRUE); for (i = 0; i < 3; i++) ar[i] = bd->rd->aanBoardColour[1][i] / 255.0; ar[3] = 0; apwBoard[1] = gtk_color_button_new(); g_signal_connect(G_OBJECT(apwBoard[1]), "color-set", UpdatePreview, NULL); gtk_box_pack_start(GTK_BOX(pw), apwBoard[1], FALSE, FALSE, 0); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwBoard[1]), ar); pwHinges = gtk_check_button_new_with_label(_("Show hinges")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwHinges), bd->rd->fHinges); gtk_box_pack_start(GTK_BOX(pw), pwHinges, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(pwHinges), "toggled", G_CALLBACK(UpdatePreview), NULL); g_signal_connect(G_OBJECT(pwWood), "toggled", G_CALLBACK(ToggleWood), bd); g_signal_connect(G_OBJECT(pwWood), "toggled", G_CALLBACK(UpdatePreview), NULL); gtk_widget_set_sensitive(pwWoodType, bd->rd->wt != WOOD_PAINT); gtk_widget_set_sensitive(apwBoard[1], bd->rd->wt == WOOD_PAINT); return pwx; } static void BoardPrefsOK(GtkWidget * pw, GtkWidget * mainBoard) { BoardData *bd = BOARD(mainBoard)->board_data; GetPrefs(&rdPrefs); #if USE_BOARD3D if (gtk_gl_init_success) { redrawChange = FALSE; rdPrefs.quickDraw = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwQuickDraw)); TidyCurveAccuracy3d(bd->bd3d, bd->rd->curveAccuracy); } if (display_is_3d(&rdPrefs)) { /* Delete old objects */ ClearTextures(bd->bd3d); } else #endif { if (bd->diceShown == DICE_ON_BOARD && bd->x_dice[0] <= 0) { /* Make sure dice are visible */ RollDice2d(bd); } } board_free_pixmaps(bd); rdPrefs.fDiceArea = bd->rd->fDiceArea; rdPrefs.fShowGameInfo = bd->rd->fShowGameInfo; rdPrefs.nSize = bd->rd->nSize; /* Copy new settings to main board */ *bd->rd = rdPrefs; #if USE_BOARD3D { BoardData3d *bd3d = bd->bd3d; renderdata *prd = bd->rd; DisplayCorrectBoardType(bd, bd3d, prd); SetSwitchModeMenuText(); if (display_is_3d(prd)) { MakeCurrent3d(bd3d); GetTextures(bd3d, prd); preDraw3d(bd, bd3d, prd); SetupViewingVolume3d(bd, bd3d, prd); ShowFlag3d(bd, bd3d, prd); if (bd->diceShown == DICE_ON_BOARD) setDicePos(bd, bd3d); /* Make sure dice appear ok */ RestrictiveRedraw(); } } #endif board_create_pixmaps(mainBoard, bd); gtk_widget_destroy(gtk_widget_get_toplevel(pw)); /* Make sure chequers correct below board */ gtk_widget_queue_draw(bd->table); UserCommand("save settings"); } static void WorkOut2dLight(renderdata * prd) { prd->arLight[2] = (float) sin(gtk_adjustment_get_value(paElevation) / 180 * G_PI); prd->arLight[0] = (float) (cos(gtk_adjustment_get_value(paAzimuth) / 180 * G_PI) * sqrt(1.0 - prd->arLight[2] * prd->arLight[2])); prd->arLight[1] = (float) (sin(gtk_adjustment_get_value(paAzimuth) / 180 * G_PI) * sqrt(1.0 - prd->arLight[2] * prd->arLight[2])); } static void LightChanged2d(GtkWidget * UNUSED(pwWidget), void *UNUSED(data)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; if (!fUpdate) return; WorkOut2dLight(bd->rd); board_free_pixmaps(bd); board_create_pixmaps(pwPrevBoard, bd); UpdatePreview(); } static void LabelsToggled(GtkWidget * UNUSED(pwWidget), void *UNUSED(data)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; int showLabels = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwLabels)); gtk_widget_set_sensitive(GTK_WIDGET(pwDynamicLabels), showLabels); /* Update preview */ if (!fUpdate) return; bd->rd->fLabels = showLabels; bd->rd->fDynamicLabels = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwDynamicLabels)); #if USE_BOARD3D if (display_is_2d(bd->rd)) #endif { board_free_pixmaps(bd); board_create_pixmaps(pwPrevBoard, bd); } option_changed(0, 0); } static void MoveIndicatorToggled(GtkWidget * UNUSED(pwWidget), void *UNUSED(data)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; /* Update preview */ if (!fUpdate) return; bd->rd->showMoveIndicator = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwMoveIndicator)); #if USE_BOARD3D if (display_is_2d(bd->rd)) #endif { board_free_pixmaps(bd); board_create_pixmaps(pwPrevBoard, bd); } UpdatePreview(); } #if USE_BOARD3D static void toggle_display_type(GtkWidget * widget, BoardData * bd) { int i; int state = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); int numPages = g_list_length(gtk_container_get_children(GTK_CONTAINER(GTK_NOTEBOOK(pwNotebook)))); /* Show pages with correct 2d/3d settings */ for (i = numPages - 1; i >= NUM_NONPREVIEW_PAGES; i--) gtk_notebook_remove_page(GTK_NOTEBOOK(pwNotebook), i); gtk_notebook_remove_page(GTK_NOTEBOOK(pwNotebook), 1); rdPrefs.fDisplayType = state ? DT_3D : DT_2D; if (display_is_3d(&rdPrefs)) { DoAcceleratedCheck(bd->bd3d, widget); updateDiceOccPos(bd, bd->bd3d); } else { board_free_pixmaps(bd); board_create_pixmaps(pwPrevBoard, bd); } AddPages(bd, pwNotebook, plBoardDesigns); gtk_widget_set_sensitive(pwTestPerformance, (display_is_3d(&rdPrefs))); #if USE_BOARD3D DisplayCorrectBoardType(bd, bd->bd3d, bd->rd); #endif /* Make sure everything is correctly sized */ gtk_widget_queue_resize(gtk_widget_get_toplevel(pwNotebook)); SetTitle(); } static void toggle_quick_draw(GtkWidget * widget, int init) { int set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); gtk_widget_set_sensitive(pwShowShadows, !set); gtk_widget_set_sensitive(pwCloseBoard, !set); if (set) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwShowShadows), 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwCloseBoard), 0); if (init != -1) GTKShowWarning(WARN_QUICKDRAW_MODE, widget); } } static void toggle_show_shadows(GtkWidget * widget, int init) { int set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); gtk_widget_set_sensitive(lightLab, set); gtk_widget_set_sensitive(pwDarkness, set); gtk_widget_set_sensitive(darkLab, set); if (set && init != -1) GTKShowWarning(WARN_SET_SHADOWS, widget); option_changed(0, 0); } static void toggle_planview(GtkWidget * widget, GtkWidget * UNUSED(pw)) { int set = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); gtk_widget_set_sensitive(pwSkewFactor, !set); gtk_widget_set_sensitive(pwBoardAngle, !set); gtk_widget_set_sensitive(skewLab, !set); gtk_widget_set_sensitive(anglelab, !set); option_changed(0, 0); } static void DoTestPerformance(GtkWidget * pw, GtkWidget * board) { BoardData *bd = BOARD(board)->board_data; char str[255]; char *msg; float fps; GTKSetCurrentParent(pw); if (!GetInputYN(_("Save settings and test 3d performance for 3 seconds?"))) return; BoardPrefsOK(pw, board); ProcessEvents(); fps = TestPerformance3d(bd); if (fps >= 30) msg = _("3d Performance is very fast.\n"); else if (fps >= 15) msg = _("3d Performance is good.\n"); else if (fps >= 10) msg = _("3d Performance is ok.\n"); else if (fps >= 5) msg = _("3d Performance is poor.\n"); else msg = _("3d Performance is very poor.\n"); sprintf(str, _("%s\n(%.1f frames per second)\n"), msg, fps); outputl(str); if (fps <= 5) { /* Give some advice, hopefully to speed things up */ if (bd->rd->showShadows) outputl(_("Disable shadows to improve performance")); else if (!bd->rd->quickDraw) outputl(_("Try the quick draw option to improve performance")); else outputl(_("The quick draw option will not change the result of this performance test")); } outputx(); } #endif static void Add2dLightOptions(GtkWidget * pwx, renderdata * prd) { float rAzimuth, rElevation; GtkWidget *pScale; pwLightTable = gtk_table_new(2, 2, FALSE); gtk_box_pack_start(GTK_BOX(pwx), pwLightTable, FALSE, FALSE, 4); gtk_table_attach(GTK_TABLE(pwLightTable), gtk_label_new(_("Light azimuth")), 0, 1, 0, 1, 0, 0, 4, 2); gtk_table_attach(GTK_TABLE(pwLightTable), gtk_label_new(_("Light elevation")), 0, 1, 1, 2, 0, 0, 4, 2); rElevation = (float) (asinf(prd->arLight[2]) * 180 / G_PI); { float s = (float) sqrt(1.0 - prd->arLight[2] * prd->arLight[2]); if (s == 0) rAzimuth = 0; else { float ac = (float) acosf(prd->arLight[0] / s); if (ac == 0) rAzimuth = 0; else rAzimuth = (float) (ac * 180 / G_PI); } } if (prd->arLight[1] < 0) rAzimuth = 360 - rAzimuth; paAzimuth = GTK_ADJUSTMENT(gtk_adjustment_new(rAzimuth, 0.0, 360.0, 1.0, 30.0, 0.0)); pScale = gtk_hscale_new(paAzimuth); gtk_widget_set_size_request(pScale, 150, -1); gtk_table_attach(GTK_TABLE(pwLightTable), pScale, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, 0, 4, 2); g_signal_connect(G_OBJECT(paAzimuth), "value-changed", G_CALLBACK(LightChanged2d), NULL); paElevation = GTK_ADJUSTMENT(gtk_adjustment_new(rElevation, 0.0, 90.0, 1.0, 10.0, 0.0)); gtk_table_attach(GTK_TABLE(pwLightTable), gtk_hscale_new(paElevation), 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, 0, 4, 2); g_signal_connect(G_OBJECT(paElevation), "value-changed", G_CALLBACK(LightChanged2d), NULL); /* FIXME add settings for ambient light */ } #if USE_BOARD3D static GtkWidget * LightingPage(BoardData * bd) { GtkWidget *dtBox, *pwx; GtkWidget *vbox, *vbox2, *frameBox, *hBox, *lab, *pwLightPosX, *pwLightLevelAmbient, *pwLightLevelDiffuse, *pwLightLevelSpecular, *pwLightPosY, *pwLightPosZ, *dtLightSourceFrame; pwx = gtk_hbox_new(FALSE, 0); dtBox = gtk_vbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwx), dtBox, FALSE, FALSE, 0); if (display_is_3d(&rdPrefs)) { dtBox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), dtBox, FALSE, FALSE, 0); dtLightSourceFrame = gtk_frame_new(_("Light Source Type")); gtk_container_set_border_width(GTK_CONTAINER(dtLightSourceFrame), 4); gtk_box_pack_start(GTK_BOX(dtBox), dtLightSourceFrame, FALSE, FALSE, 0); vbox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtLightSourceFrame), vbox); pwLightSource = gtk_radio_button_new_with_label(NULL, _("Positional")); gtk_widget_set_tooltip_text(pwLightSource, _("This is a fixed light source, like a lamp")); gtk_box_pack_start(GTK_BOX(vbox), pwLightSource, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwLightSource), (bd->rd->lightType == LT_POSITIONAL)); pwDirectionalSource = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pwLightSource), _("Directional")); gtk_widget_set_tooltip_text(pwDirectionalSource, _("This is a light direction, like the sun")); gtk_box_pack_start(GTK_BOX(vbox), pwDirectionalSource, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwDirectionalSource), (bd->rd->lightType == LT_DIRECTIONAL)); g_signal_connect(G_OBJECT(pwDirectionalSource), "toggled", G_CALLBACK(option_changed), bd); dtLightPositionFrame = gtk_frame_new(_("Light Position")); gtk_container_set_border_width(GTK_CONTAINER(dtLightPositionFrame), 4); gtk_box_pack_start(GTK_BOX(dtBox), dtLightPositionFrame, FALSE, FALSE, 0); frameBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtLightPositionFrame), frameBox); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frameBox), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("Left")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjLightPosX = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightPos[0], -1.5, 4, .1, 1, 0)); g_signal_connect(G_OBJECT(padjLightPosX), "value-changed", G_CALLBACK(option_changed), NULL); pwLightPosX = gtk_hscale_new(padjLightPosX); gtk_scale_set_draw_value(GTK_SCALE(pwLightPosX), FALSE); gtk_widget_set_size_request(pwLightPosX, 150, -1); gtk_box_pack_start(GTK_BOX(hBox), pwLightPosX, TRUE, TRUE, 0); lab = gtk_label_new(_("Right")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frameBox), hBox, FALSE, FALSE, 0); vbox2 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hBox), vbox2, FALSE, FALSE, 0); lab = gtk_label_new(_("Bottom")); gtk_box_pack_start(GTK_BOX(vbox2), lab, FALSE, FALSE, 0); padjLightPosY = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightPos[1], -1.5, 4, .1, 1, 0)); g_signal_connect(G_OBJECT(padjLightPosY), "value-changed", G_CALLBACK(option_changed), NULL); pwLightPosY = gtk_vscale_new(padjLightPosY); gtk_scale_set_draw_value(GTK_SCALE(pwLightPosY), FALSE); gtk_widget_set_size_request(pwLightPosY, -1, 70); gtk_box_pack_start(GTK_BOX(vbox2), pwLightPosY, TRUE, TRUE, 0); lab = gtk_label_new(_("Top")); gtk_box_pack_start(GTK_BOX(vbox2), lab, FALSE, FALSE, 0); vbox2 = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(hBox), vbox2, FALSE, FALSE, 0); lab = gtk_label_new(_("Low")); gtk_box_pack_start(GTK_BOX(vbox2), lab, FALSE, FALSE, 0); padjLightPosZ = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightPos[2], .5, 5, .1, 1, 0)); g_signal_connect(G_OBJECT(padjLightPosZ), "value-changed", G_CALLBACK(option_changed), NULL); pwLightPosZ = gtk_vscale_new(padjLightPosZ); gtk_scale_set_draw_value(GTK_SCALE(pwLightPosZ), FALSE); gtk_box_pack_start(GTK_BOX(vbox2), pwLightPosZ, TRUE, TRUE, 0); lab = gtk_label_new(_("High")); gtk_box_pack_start(GTK_BOX(vbox2), lab, FALSE, FALSE, 0); dtLightLevelsFrame = gtk_frame_new(_("Light Levels")); gtk_container_set_border_width(GTK_CONTAINER(dtLightLevelsFrame), 4); gtk_box_pack_start(GTK_BOX(dtBox), dtLightLevelsFrame, FALSE, FALSE, 0); frameBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtLightLevelsFrame), frameBox); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frameBox), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("Ambient")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjLightLevelAmbient = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightLevels[0], 0, 100, 1, 10, 0)); g_signal_connect(G_OBJECT(padjLightLevelAmbient), "value-changed", G_CALLBACK(option_changed), NULL); pwLightLevelAmbient = gtk_hscale_new(padjLightLevelAmbient); gtk_widget_set_tooltip_text(pwLightLevelAmbient, _("Ambient light specifies the general light level")); gtk_box_pack_start(GTK_BOX(hBox), pwLightLevelAmbient, TRUE, TRUE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frameBox), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("Diffuse")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjLightLevelDiffuse = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightLevels[1], 0, 100, 1, 10, 0)); g_signal_connect(G_OBJECT(padjLightLevelDiffuse), "value-changed", G_CALLBACK(option_changed), NULL); pwLightLevelDiffuse = gtk_hscale_new(padjLightLevelDiffuse); gtk_widget_set_tooltip_text(pwLightLevelDiffuse, _("Diffuse light specifies light from the light source")); gtk_box_pack_start(GTK_BOX(hBox), pwLightLevelDiffuse, TRUE, TRUE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(frameBox), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("Specular")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjLightLevelSpecular = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->lightLevels[2], 0, 100, 1, 10, 0)); g_signal_connect(G_OBJECT(padjLightLevelSpecular), "value-changed", G_CALLBACK(option_changed), NULL); pwLightLevelSpecular = gtk_hscale_new(padjLightLevelSpecular); gtk_widget_set_tooltip_text(pwLightLevelSpecular, _("Specular light is reflected light off shiny surfaces")); gtk_box_pack_start(GTK_BOX(hBox), pwLightLevelSpecular, TRUE, TRUE, 0); } else Add2dLightOptions(dtBox, bd->rd); gtk_widget_show_all(pwx); return pwx; } #endif #if USE_BOARD3D static GtkWidget * GeneralPage(BoardData * bd, GtkWidget * bdMain) { #else static GtkWidget * GeneralPage(BoardData * bd, GtkWidget * UNUSED(bdMain)) { #endif GtkWidget *pw, *pwx; #if USE_BOARD3D GtkWidget *dtBox, *button, *dtFrame, *hBox, *lab, *pwev, *pwhbox, *pwvbox, *pwAccuracy, *pwDiceSize; pwQuickDraw = 0; #endif pwx = gtk_hbox_new(FALSE, 0); pw = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), pw, FALSE, FALSE, 0); #if USE_BOARD3D dtFrame = gtk_frame_new(_("Display Type")); gtk_container_set_border_width(GTK_CONTAINER(dtFrame), 4); gtk_box_pack_start(GTK_BOX(pw), dtFrame, FALSE, FALSE, 0); dtBox = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(dtFrame), dtBox); pwBoardType = gtk_radio_button_new_with_label(NULL, _("2d Board")); gtk_box_pack_start(GTK_BOX(dtBox), pwBoardType, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwBoardType), (display_is_2d(bd->rd))); button = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(pwBoardType), _("3d Board")); if (!gtk_gl_init_success) gtk_widget_set_sensitive(button, FALSE); gtk_box_pack_start(GTK_BOX(dtBox), button, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (display_is_3d(bd->rd))); g_signal_connect(G_OBJECT(button), "toggled", G_CALLBACK(toggle_display_type), bd); #endif pwLabels = gtk_check_button_new_with_label(_("Numbered point labels")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwLabels), bd->rd->fLabels); gtk_box_pack_start(GTK_BOX(pw), pwLabels, FALSE, FALSE, 0); gtk_widget_set_tooltip_text(pwLabels, _("Show or hide point numbers")); pwDynamicLabels = gtk_check_button_new_with_label(_("Dynamic labels")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwDynamicLabels), bd->rd->fDynamicLabels); gtk_box_pack_start(GTK_BOX(pw), pwDynamicLabels, FALSE, FALSE, 0); g_signal_connect(G_OBJECT(pwDynamicLabels), "toggled", G_CALLBACK(LabelsToggled), 0); g_signal_connect(G_OBJECT(pwLabels), "toggled", G_CALLBACK(LabelsToggled), 0); LabelsToggled(0, 0); gtk_widget_set_tooltip_text(pwDynamicLabels, _("Update the labels so they are correct " "for the player on roll")); pwMoveIndicator = gtk_check_button_new_with_label(_("Show move indicator")); gtk_widget_set_tooltip_text(pwMoveIndicator, _("Show or hide arrow indicating who is moving")); gtk_box_pack_start(GTK_BOX(pw), pwMoveIndicator, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwMoveIndicator), bd->rd->showMoveIndicator); g_signal_connect(G_OBJECT(pwMoveIndicator), "toggled", G_CALLBACK(MoveIndicatorToggled), 0); #if USE_BOARD3D pwvbox = gtk_vbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwx), pwvbox, FALSE, FALSE, 0); frame3dOptions = gtk_frame_new(_("3d Options")); gtk_container_set_border_width(GTK_CONTAINER(frame3dOptions), 4); gtk_box_pack_start(GTK_BOX(pwvbox), frame3dOptions, FALSE, FALSE, 0); pw = gtk_vbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(frame3dOptions), pw); pwShowShadows = gtk_check_button_new_with_label(_("Show shadows")); gtk_widget_set_tooltip_text(pwShowShadows, _("Display shadows, this option requires a fast graphics card")); gtk_box_pack_start(GTK_BOX(pw), pwShowShadows, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwShowShadows), bd->rd->showShadows); g_signal_connect(G_OBJECT(pwShowShadows), "toggled", G_CALLBACK(toggle_show_shadows), NULL); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), hBox, FALSE, FALSE, 0); lightLab = gtk_label_new(_("light")); gtk_box_pack_start(GTK_BOX(hBox), lightLab, FALSE, FALSE, 0); padjDarkness = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->shadowDarkness, 3, 100, 1, 10, 0)); g_signal_connect(G_OBJECT(padjDarkness), "value-changed", G_CALLBACK(option_changed), NULL); pwDarkness = gtk_hscale_new(padjDarkness); gtk_widget_set_tooltip_text(pwDarkness, _("Vary the darkness of the shadows")); gtk_scale_set_draw_value(GTK_SCALE(pwDarkness), FALSE); gtk_box_pack_start(GTK_BOX(hBox), pwDarkness, TRUE, TRUE, 0); darkLab = gtk_label_new(_("dark")); gtk_box_pack_start(GTK_BOX(hBox), darkLab, FALSE, FALSE, 0); toggle_show_shadows(pwShowShadows, -1); pwAnimateRoll = gtk_check_button_new_with_label(_("Animate dice rolls")); gtk_widget_set_tooltip_text(pwAnimateRoll, _("Dice rolls will shake across board")); gtk_box_pack_start(GTK_BOX(pw), pwAnimateRoll, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwAnimateRoll), bd->rd->animateRoll); pwAnimateFlag = gtk_check_button_new_with_label(_("Animate resignation flag")); gtk_widget_set_tooltip_text(pwAnimateFlag, _("Waves resignation flag")); gtk_box_pack_start(GTK_BOX(pw), pwAnimateFlag, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwAnimateFlag), bd->rd->animateFlag); pwCloseBoard = gtk_check_button_new_with_label(_("Close board on exit")); gtk_widget_set_tooltip_text(pwCloseBoard, _("When you quit gnubg, the board will close")); gtk_box_pack_start(GTK_BOX(pw), pwCloseBoard, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwCloseBoard), bd->rd->closeBoardOnExit); pwev = gtk_event_box_new(); gtk_event_box_set_visible_window(GTK_EVENT_BOX(pwev), FALSE); gtk_box_pack_start(GTK_BOX(pw), pwev, FALSE, FALSE, 0); pwhbox = gtk_hbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(pwev), pwhbox); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), hBox, FALSE, FALSE, 0); anglelab = gtk_label_new(_("Board angle: ")); gtk_box_pack_start(GTK_BOX(hBox), anglelab, FALSE, FALSE, 0); padjBoardAngle = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->boardAngle, 0, 60, 1, 10, 0)); g_signal_connect(G_OBJECT(padjBoardAngle), "value-changed", G_CALLBACK(option_changed), NULL); pwBoardAngle = gtk_hscale_new(padjBoardAngle); gtk_widget_set_tooltip_text(pwBoardAngle, _("Vary the angle the board is tilted at")); gtk_scale_set_digits(GTK_SCALE(pwBoardAngle), 0); gtk_widget_set_size_request(pwBoardAngle, 100, -1); gtk_box_pack_start(GTK_BOX(hBox), pwBoardAngle, FALSE, FALSE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), hBox, FALSE, FALSE, 0); skewLab = gtk_label_new(_("FOV skew: ")); gtk_box_pack_start(GTK_BOX(hBox), skewLab, FALSE, FALSE, 0); padjSkewFactor = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->skewFactor, 0, 100, 1, 10, 0)); g_signal_connect(G_OBJECT(padjSkewFactor), "value-changed", G_CALLBACK(option_changed), NULL); pwSkewFactor = gtk_hscale_new(padjSkewFactor); gtk_widget_set_size_request(pwSkewFactor, 100, -1); gtk_widget_set_tooltip_text(pwSkewFactor, _("Vary the field-of-view of the 3d display")); gtk_scale_set_digits(GTK_SCALE(pwSkewFactor), 0); gtk_box_pack_start(GTK_BOX(hBox), pwSkewFactor, FALSE, FALSE, 0); pwPlanView = gtk_check_button_new_with_label(_("Plan view")); gtk_widget_set_tooltip_text(pwPlanView, _("Display the 3d board with a 2d overhead view")); gtk_box_pack_start(GTK_BOX(pw), pwPlanView, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwPlanView), bd->rd->planView); g_signal_connect(G_OBJECT(pwPlanView), "toggled", G_CALLBACK(toggle_planview), NULL); toggle_planview(pwPlanView, 0); lab = gtk_label_new(_("Curve accuracy")); gtk_box_pack_start(GTK_BOX(pw), lab, FALSE, FALSE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("low")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjAccuracy = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->curveAccuracy, 8, 60, 4, 12, 0)); g_signal_connect(G_OBJECT(padjAccuracy), "value-changed", G_CALLBACK(option_changed), NULL); pwAccuracy = gtk_hscale_new(padjAccuracy); gtk_widget_set_tooltip_text(pwAccuracy, _("Change how accurately curves are drawn." " If performance is slow try lowering this value." " Increasing this value will only have an effect on large displays")); gtk_scale_set_draw_value(GTK_SCALE(pwAccuracy), FALSE); gtk_box_pack_start(GTK_BOX(hBox), pwAccuracy, TRUE, TRUE, 0); lab = gtk_label_new(_("high")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); lab = gtk_label_new(_("Dice size")); gtk_box_pack_start(GTK_BOX(pw), lab, FALSE, FALSE, 0); hBox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pw), hBox, FALSE, FALSE, 0); lab = gtk_label_new(_("small")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); padjDiceSize = GTK_ADJUSTMENT(gtk_adjustment_new(bd->rd->diceSize, 1.5, 4, .1, 1, 0)); g_signal_connect(G_OBJECT(padjDiceSize), "value-changed", G_CALLBACK(DiceSizeChanged), NULL); pwDiceSize = gtk_hscale_new(padjDiceSize); gtk_widget_set_tooltip_text(pwDiceSize, _("Vary the size of the dice")); gtk_scale_set_draw_value(GTK_SCALE(pwDiceSize), FALSE); gtk_box_pack_start(GTK_BOX(hBox), pwDiceSize, TRUE, TRUE, 0); lab = gtk_label_new(_("large")); gtk_box_pack_start(GTK_BOX(hBox), lab, FALSE, FALSE, 0); pwQuickDraw = gtk_check_button_new_with_label(_("Quick drawing")); gtk_widget_set_tooltip_text(pwQuickDraw, _("Fast drawing option to improve performance")); gtk_box_pack_start(GTK_BOX(pw), pwQuickDraw, FALSE, FALSE, 0); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwQuickDraw), bd->rd->quickDraw); g_signal_connect(G_OBJECT(pwQuickDraw), "toggled", G_CALLBACK(toggle_quick_draw), NULL); toggle_quick_draw(pwQuickDraw, -1); pwTestPerformance = gtk_button_new_with_label(_("Test performance")); gtk_widget_set_sensitive(pwTestPerformance, (display_is_3d(bd->rd))); gtk_box_pack_start(GTK_BOX(pwvbox), pwTestPerformance, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwTestPerformance), "clicked", G_CALLBACK(DoTestPerformance), bdMain); #else Add2dLightOptions(pw, bd->rd); #endif return pwx; } /* functions for board design */ static void UseDesign(void) { int i, j; gdouble ar[4]; gfloat rAzimuth, rElevation; renderdata newPrefs; #if USE_BOARD3D BoardData *bd = BOARD(pwPrevBoard)->board_data; #endif fUpdate = FALSE; #if USE_BOARD3D if (display_is_3d(&rdPrefs)) ClearTextures(bd->bd3d); #endif ParsePreferences(pbdeSelected, &newPrefs); #if USE_BOARD3D /* Set only 2D or 3D options */ if (display_is_3d(&rdPrefs)) { Set3dSettings(&rdPrefs, &newPrefs); GetTextures(bd->bd3d, bd->rd); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwLightSource), (newPrefs.lightType == LT_POSITIONAL)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwDirectionalSource), (newPrefs.lightType == LT_DIRECTIONAL)); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightPosX), newPrefs.lightPos[0]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightPosY), newPrefs.lightPos[1]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightPosZ), newPrefs.lightPos[2]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightLevelAmbient), newPrefs.lightLevels[0]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightLevelDiffuse), newPrefs.lightLevels[1]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjLightLevelSpecular), newPrefs.lightLevels[2]); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjBoardAngle), newPrefs.boardAngle); gtk_adjustment_set_value(GTK_ADJUSTMENT(padjSkewFactor), newPrefs.skewFactor); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwTextureAllPiece), (newPrefs.pieceTextureType == PTT_ALL)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwTextureTopPiece), (newPrefs.pieceTextureType == PTT_TOP)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundedPiece), (newPrefs.pieceType == PT_ROUNDED)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwFlatPiece), (newPrefs.pieceType == PT_FLAT)); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundedEdges), newPrefs.roundedEdges); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwBgTrays), newPrefs.bgInTrays); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwRoundPoints), newPrefs.roundedPoints); for (i = 0; i < 2; i++) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(apwDieColour[i]), newPrefs.afDieColour3d[i]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwHinges), newPrefs.fHinges3d); redrawChange = TRUE; } else #endif { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwMoveIndicator), newPrefs.showMoveIndicator); /* chequers */ for (i = 0; i < 2; ++i) { gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwColour[i]), newPrefs.aarColour[i]); gtk_adjustment_set_value(GTK_ADJUSTMENT(apadj[i]), newPrefs.arRefraction[i]); gtk_adjustment_set_value(GTK_ADJUSTMENT(apadjCoefficient[i]), newPrefs.arCoefficient[i]); gtk_adjustment_set_value(GTK_ADJUSTMENT(apadjExponent[i]), newPrefs.arExponent[i]); } /* dice + dice dot */ for (i = 0; i < 2; ++i) { gtk_widget_set_sensitive(GTK_WIDGET(apwDiceColourBox[i]), !newPrefs.afDieColour[i]); gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwDiceColour[i]), newPrefs.afDieColour[i] ? newPrefs.aarColour[i] : newPrefs.aarDiceColour[i]); gtk_adjustment_set_value(GTK_ADJUSTMENT(apadjDiceExponent[i]), newPrefs.afDieColour[i] ? newPrefs.arExponent[i] : newPrefs.arDiceExponent[i]); gtk_adjustment_set_value(GTK_ADJUSTMENT(apadjDiceCoefficient[i]), newPrefs.afDieColour[i] ? newPrefs.arCoefficient[i] : newPrefs.arDiceCoefficient[i]); /* die dot */ gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwDiceDotColour[i]), newPrefs.aarDiceDotColour[i]); } /* cube colour */ gtk_color_button_set_from_array(GTK_COLOR_BUTTON(pwCubeColour), newPrefs.arCubeColour); /* board + points */ for (i = 0; i < 4; ++i) { if (i != 1) gtk_adjustment_set_value(GTK_ADJUSTMENT(apadjBoard[i]), newPrefs.aSpeckle[i] / 128.0); for (j = 0; j < 3; j++) ar[j] = newPrefs.aanBoardColour[i][j] / 255.0; gtk_color_button_set_from_array(GTK_COLOR_BUTTON(apwBoard[i]), ar); } /* board, border, and points */ gtk_combo_box_set_active(GTK_COMBO_BOX(pwWoodType), newPrefs.wt); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(newPrefs.wt != WOOD_PAINT ? pwWood : pwWoodF), TRUE); gtk_widget_set_sensitive(pwWoodType, newPrefs.wt != WOOD_PAINT); gtk_widget_set_sensitive(apwBoard[1], newPrefs.wt == WOOD_PAINT); /* round */ gtk_adjustment_set_value(GTK_ADJUSTMENT(padjRound), 1.0f - newPrefs.rRound); /* light */ rElevation = (float) (asin(newPrefs.arLight[2]) * 180 / G_PI); if (fabs(newPrefs.arLight[2] - 1.0f) < 1e-5) rAzimuth = 0.0; else rAzimuth = (float) (acos(newPrefs.arLight[0] / sqrt(1.0 - newPrefs.arLight[2] * newPrefs.arLight[2])) * 180 / G_PI); if (newPrefs.arLight[1] < 0) rAzimuth = 360 - rAzimuth; gtk_adjustment_set_value(GTK_ADJUSTMENT(paAzimuth), rAzimuth); gtk_adjustment_set_value(GTK_ADJUSTMENT(paElevation), rElevation); for (i = 0; i < 2; i++) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(apwDieColour[i]), newPrefs.afDieColour[i]); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwHinges), newPrefs.fHinges); GetPrefs(&rdPrefs); } fUpdate = TRUE; option_changed(0, 0); } static void WriteTheDesign(boarddesign * pbde, FILE * pf) { fputs(" \n\n", pf); /* */ fprintf(pf, " \n" " %s\n" " %s\n" " \n\n" " %s \n\n", pbde->szTitle ? pbde->szTitle : _("unknown title"), pbde->szAuthor ? pbde->szAuthor : _("unknown author"), pbde->szBoardDesign ? pbde->szBoardDesign : ""); fputs(" \n\n\n", pf); } static void WriteDesignOnlyDeletables(gpointer data, gpointer user_data) { boarddesign *pbde = data; FILE *pf = user_data; if (!pbde) return; if (!pbde->fDeletable) /* predefined board design */ return; WriteTheDesign(pbde, pf); } static void WriteDesign(gpointer data, gpointer user_data) { boarddesign *pbde = data; FILE *pf = user_data; if (!pbde) return; WriteTheDesign(pbde, pf); } static void WriteDesignHeader(const char *szFile, FILE * pf) { time_t t; fprintf(pf, "\n" "\n" "\n" "\n" "\n" "\n" "\n", pf); } static void WriteDesignFooter(FILE * pf) { fputs("\n", pf); } static void DesignSave(GtkWidget * UNUSED(pw), gpointer data) { gchar *szFile; FILE *pf; GList *plBoardDesigns = (GList *) data; szFile = g_build_filename(szHomeDirectory, "boards.xml", NULL); if ((pf = g_fopen(szFile, "w+")) == 0) { outputerr(szFile); g_free(szFile); return; } WriteDesignHeader(szFile, pf); g_list_foreach(plBoardDesigns, WriteDesignOnlyDeletables, pf); WriteDesignFooter(pf); fclose(pf); g_free(szFile); } static void DesignAddOK(GtkWidget * pw, boarddesign * pbde) { pbde->szAuthor = gtk_editable_get_chars(GTK_EDITABLE(pwDesignAddAuthor), 0, -1); pbde->szTitle = gtk_editable_get_chars(GTK_EDITABLE(pwDesignAddTitle), 0, -1); gtk_widget_destroy(gtk_widget_get_toplevel(pw)); } static void DesignAddChanged(GtkWidget * UNUSED(pw), GtkWidget * pwDialog) { char *szAuthor = gtk_editable_get_chars(GTK_EDITABLE(pwDesignAddAuthor), 0, -1); char *szTitle = gtk_editable_get_chars(GTK_EDITABLE(pwDesignAddTitle), 0, -1); GtkWidget *pwOK = DialogArea(GTK_WIDGET(pwDialog), DA_OK); gtk_widget_set_sensitive(GTK_WIDGET(pwOK), szAuthor && szTitle && *szAuthor && *szTitle); } static void DesignAddTitle(boarddesign * pbde) { GtkWidget *pwDialog; GtkWidget *pwvbox; GtkWidget *pwhbox; pwDialog = GTKCreateDialog(_("GNU Backgammon - Add current board design"), DT_QUESTION, NULL, DIALOG_FLAG_MODAL, G_CALLBACK(DesignAddOK), pbde); pwvbox = gtk_vbox_new(FALSE, 4); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwvbox); /* title */ pwhbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwvbox), pwhbox, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Title of new design:")), FALSE, FALSE, 4); pwDesignAddTitle = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(pwDesignAddTitle), TRUE); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignAddTitle, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignAddTitle), "changed", G_CALLBACK(DesignAddChanged), pwDialog); /* author */ pwhbox = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pwvbox), pwhbox, FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwhbox), gtk_label_new(_("Author of new design:")), FALSE, FALSE, 4); pwDesignAddAuthor = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(pwDesignAddAuthor), TRUE); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignAddAuthor, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignAddAuthor), "changed", G_CALLBACK(DesignAddChanged), pwDialog); /* show dialog */ gtk_widget_grab_focus(pwDesignAddTitle); DesignAddChanged(NULL, pwDialog); GTKRunDialog(pwDialog); } static void WriteDesignString(boarddesign * pbde, renderdata * prd) { char szTemp[2048], *pTemp; gchar buf1[G_ASCII_DTOSTR_BUF_SIZE], buf2[G_ASCII_DTOSTR_BUF_SIZE], buf3[G_ASCII_DTOSTR_BUF_SIZE], buf4[G_ASCII_DTOSTR_BUF_SIZE]; float rElevation = (float) (asin(prd->arLight[2]) * 180 / G_PI); float rAzimuth = (fabs(prd->arLight[2] - 1.0f) < 1e-5) ? 0.0f : (float) (acos(prd->arLight[0] / sqrt(1.0 - prd->arLight[2] * prd->arLight[2])) * 180 / G_PI); if (prd->arLight[1] < 0) rAzimuth = 360 - rAzimuth; pTemp = szTemp; pTemp += sprintf(pTemp, "\n" " board=#%02X%02X%02X;%sf\n" " border=#%02X%02X%02X\n", /* board */ prd->aanBoardColour[0][0], prd->aanBoardColour[0][1], prd->aanBoardColour[0][2], g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->aSpeckle[0] / 128.0f), /* border */ prd->aanBoardColour[1][0], prd->aanBoardColour[1][1], prd->aanBoardColour[1][2]); pTemp += sprintf(pTemp, " wood=%s\n" " hinges=%c\n" " light=%s;%s\n" " shape=%s\n", /* wood ... */ aszWoodName[prd->wt], prd->fHinges ? 'y' : 'n', g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.0f", rAzimuth), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.0f", rElevation), g_ascii_formatd(buf3, G_ASCII_DTOSTR_BUF_SIZE, "%0.1f", 1.0 - prd->rRound)); pTemp += sprintf(pTemp, " chequers0=#%02X%02X%02X;%s;%s;%s;%s\n", /* chequers0 */ (int) (prd->aarColour[0][0] * 0xFF), (int) (prd->aarColour[0][1] * 0xFF), (int) (prd->aarColour[0][2] * 0xFF), g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->aarColour[0][3]), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arRefraction[0]), g_ascii_formatd(buf3, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arCoefficient[0]), g_ascii_formatd(buf4, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arExponent[0])); pTemp += sprintf(pTemp, " chequers1=#%02X%02X%02X;%s;%s;%s;%s\n", /* chequers1 */ (int) (prd->aarColour[1][0] * 0xFF), (int) (prd->aarColour[1][1] * 0xFF), (int) (prd->aarColour[1][2] * 0xFF), g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->aarColour[1][3]), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arRefraction[1]), g_ascii_formatd(buf3, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arCoefficient[1]), g_ascii_formatd(buf4, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arExponent[1])); pTemp += sprintf(pTemp, " dice0=#%02X%02X%02X;%s;%s;%c\n", /* dice0 */ (int) (prd->aarDiceColour[0][0] * 0xFF), (int) (prd->aarDiceColour[0][1] * 0xFF), (int) (prd->aarDiceColour[0][2] * 0xFF), g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arDiceCoefficient[0]), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arDiceExponent[0]), prd->afDieColour[0] ? 'y' : 'n'); pTemp += sprintf(pTemp, " dice1=#%02X%02X%02X;%s;%s;%c\n", /* dice1 */ (int) (prd->aarDiceColour[1][0] * 0xFF), (int) (prd->aarDiceColour[1][1] * 0xFF), (int) (prd->aarDiceColour[1][2] * 0xFF), g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arDiceCoefficient[1]), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->arDiceExponent[1]), prd->afDieColour[1] ? 'y' : 'n'); pTemp += sprintf(pTemp, " dot0=#%02X%02X%02X\n" " dot1=#%02X%02X%02X\n" " cube=#%02X%02X%02X\n", /* dot0 */ (int) (prd->aarDiceDotColour[0][0] * 0xFF), (int) (prd->aarDiceDotColour[0][1] * 0xFF), (int) (prd->aarDiceDotColour[0][2] * 0xFF), /* dot1 */ (int) (prd->aarDiceDotColour[1][0] * 0xFF), (int) (prd->aarDiceDotColour[1][1] * 0xFF), (int) (prd->aarDiceDotColour[1][2] * 0xFF), /* cube */ (int) (prd->arCubeColour[0] * 0xFF), (int) (prd->arCubeColour[1] * 0xFF), (int) (prd->arCubeColour[2] * 0xFF)); pTemp += sprintf(pTemp, " points0=#%02X%02X%02X;%s\n" " points1=#%02X%02X%02X;%s\n", /* points0 */ prd->aanBoardColour[2][0], prd->aanBoardColour[2][1], prd->aanBoardColour[2][2], g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->aSpeckle[2] / 128.0f), /* points1 */ prd->aanBoardColour[3][0], prd->aanBoardColour[3][1], prd->aanBoardColour[3][2], g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%0.2f", prd->aSpeckle[3] / 128.0f)); #if USE_BOARD3D pTemp += sprintf(pTemp, " hinges3d=%c\n" " piecetype=%d\n" " piecetexturetype=%d\n" " roundededges=%c\n" " bgintrays=%c\n" " roundedpoints=%c\n" " lighttype=%c\n" " lightposx=%s lightposy=%s lightposz=%s\n" " lightambient=%d lightdiffuse=%d lightspecular=%d\n" " chequers3d0=%s\n" " chequers3d1=%s\n" " dice3d0=%s\n" " dice3d1=%s\n" " dot3d0=%s\n" " dot3d1=%s\n" " cube3d=%s\n" " cubetext3d=%s\n" " base3d=%s\n" " points3d0=%s\n" " points3d1=%s\n" " border3d=%s\n" " hinge3d=%s\n" " numbers3d=%s\n" " background3d=%s\n" "\n", prd->fHinges3d ? 'y' : 'n', prd->pieceType, prd->pieceTextureType, prd->roundedEdges ? 'y' : 'n', prd->bgInTrays ? 'y' : 'n', prd->roundedPoints ? 'y' : 'n', prd->lightType == LT_POSITIONAL ? 'p' : 'd', g_ascii_formatd(buf1, G_ASCII_DTOSTR_BUF_SIZE, "%f", prd->lightPos[0]), g_ascii_formatd(buf2, G_ASCII_DTOSTR_BUF_SIZE, "%f", prd->lightPos[1]), g_ascii_formatd(buf3, G_ASCII_DTOSTR_BUF_SIZE, "%f", prd->lightPos[2]), prd->lightLevels[0], prd->lightLevels[1], prd->lightLevels[2], WriteMaterial(&prd->ChequerMat[0]), WriteMaterial(&prd->ChequerMat[1]), WriteMaterialDice(prd, 0), WriteMaterialDice(prd, 1), WriteMaterial(&prd->DiceDotMat[0]), WriteMaterial(&prd->DiceDotMat[1]), WriteMaterial(&prd->CubeMat), WriteMaterial(&prd->CubeNumberMat), WriteMaterial(&prd->BaseMat), WriteMaterial(&prd->PointMat[0]), WriteMaterial(&prd->PointMat[1]), WriteMaterial(&prd->BoxMat), WriteMaterial(&prd->HingeMat), WriteMaterial(&prd->PointNumberMat), WriteMaterial(&prd->BackGroundMat)); #endif pbde->szBoardDesign = g_malloc(strlen(szTemp) + 1); strcpy(pbde->szBoardDesign, szTemp); } #if USE_BOARD3D static void Set2dColour(double newcol[4], Material * pMat) { newcol[0] = (pMat->ambientColour[0] + pMat->diffuseColour[0]) / 2; newcol[1] = (pMat->ambientColour[1] + pMat->diffuseColour[1]) / 2; newcol[2] = (pMat->ambientColour[2] + pMat->diffuseColour[2]) / 2; newcol[3] = (pMat->ambientColour[3] + pMat->diffuseColour[3]) / 2; } static void Set2dColourChar(unsigned char newcol[4], Material * pMat) { newcol[0] = (unsigned char) (((pMat->ambientColour[0] + pMat->diffuseColour[0]) / 2) * 255); newcol[1] = (unsigned char) (((pMat->ambientColour[1] + pMat->diffuseColour[1]) / 2) * 255); newcol[2] = (unsigned char) (((pMat->ambientColour[2] + pMat->diffuseColour[2]) / 2) * 255); newcol[3] = (unsigned char) (((pMat->ambientColour[3] + pMat->diffuseColour[3]) / 2) * 255); } static void Set3dColour(Material * pMat, double col[4]) { pMat->ambientColour[0] = pMat->diffuseColour[0] = (float) col[0]; pMat->ambientColour[1] = pMat->diffuseColour[1] = (float) col[1]; pMat->ambientColour[2] = pMat->diffuseColour[2] = (float) col[2]; pMat->ambientColour[3] = pMat->diffuseColour[3] = 1; } static void Set3dColourChar(Material * pMat, unsigned char col[4]) { pMat->ambientColour[0] = pMat->diffuseColour[0] = ((float) col[0]) / 255; pMat->ambientColour[1] = pMat->diffuseColour[1] = ((float) col[1]) / 255; pMat->ambientColour[2] = pMat->diffuseColour[2] = ((float) col[2]) / 255; pMat->ambientColour[3] = pMat->diffuseColour[3] = 1; } static void CopyNewSettingsToOtherDimension(renderdata * prd) { if (display_is_3d(prd)) { /* Create rough 2d settings based on new 3d settings */ prd->wt = WOOD_PAINT; Set2dColour(prd->aarColour[0], &prd->ChequerMat[0]); Set2dColour(prd->aarColour[1], &prd->ChequerMat[1]); Set2dColour(prd->aarDiceColour[0], &prd->DiceMat[0]); Set2dColour(prd->aarDiceColour[1], &prd->DiceMat[1]); Set2dColour(prd->aarDiceDotColour[0], &prd->DiceDotMat[0]); Set2dColour(prd->aarDiceDotColour[1], &prd->DiceDotMat[1]); prd->afDieColour[0] = prd->afDieColour3d[0]; prd->afDieColour[1] = prd->afDieColour3d[1]; prd->fHinges = prd->fHinges3d; Set2dColour(prd->arCubeColour, &prd->CubeMat); Set2dColourChar(prd->aanBoardColour[0], &prd->BaseMat); Set2dColourChar(prd->aanBoardColour[1], &prd->BoxMat); Set2dColourChar(prd->aanBoardColour[2], &prd->PointMat[0]); Set2dColourChar(prd->aanBoardColour[3], &prd->PointMat[1]); } else { /* Create rough 3d settings based on new 2d settings */ Set3dColour(&prd->ChequerMat[0], prd->aarColour[0]); Set3dColour(&prd->ChequerMat[1], prd->aarColour[1]); Set3dColour(&prd->DiceMat[0], prd->aarDiceColour[0]); Set3dColour(&prd->DiceMat[1], prd->aarDiceColour[1]); Set3dColour(&prd->DiceDotMat[0], prd->aarDiceDotColour[0]); Set3dColour(&prd->DiceDotMat[1], prd->aarDiceDotColour[1]); prd->afDieColour3d[0] = prd->afDieColour[0]; prd->afDieColour3d[1] = prd->afDieColour[1]; prd->fHinges3d = prd->fHinges; Set3dColour(&prd->CubeMat, prd->arCubeColour); Set3dColourChar(&prd->BaseMat, prd->aanBoardColour[0]); Set3dColourChar(&prd->BoxMat, prd->aanBoardColour[1]); Set3dColourChar(&prd->PointMat[0], prd->aanBoardColour[2]); Set3dColourChar(&prd->PointMat[1], prd->aanBoardColour[3]); } } #endif static void DesignAdd(GtkWidget * pw, gpointer data) { boarddesign *pbde; GList *plBoardDesigns = data; renderdata rdNew; if ((pbde = (boarddesign *) g_malloc(sizeof(boarddesign))) == 0) { outputerr("allocate boarddesign"); return; } /* name and author of board */ pbde->szTitle = pbde->szAuthor = pbde->szBoardDesign = NULL; GTKSetCurrentParent(pw); DesignAddTitle(pbde); if (!pbde->szTitle || !pbde->szAuthor) { g_free(pbde); return; } /* get board design */ GetPrefs(&rdPrefs); rdNew = rdPrefs; #if USE_BOARD3D CopyNewSettingsToOtherDimension(&rdNew); #endif WriteDesignString(pbde, &rdNew); pbde->fDeletable = TRUE; plBoardDesigns = g_list_append(plBoardDesigns, (gpointer) pbde); AddDesignRow(pbde, pwDesignList); DesignSave(pw, data); pbdeSelected = pbde; SetTitle(); } static void ExportDesign(GtkWidget * UNUSED(pw), gpointer UNUSED(data)) { GList *designs; gchar *pch; gchar *szFile; FILE *pf; boarddesign *pbde; renderdata rdNew; if ((pch = szFile = GTKFileSelect(_("Export Design"), NULL, NULL, NULL, GTK_FILE_CHOOSER_ACTION_SAVE)) == 0) return; #if !defined(WIN32) szFile = NextToken(&szFile); #endif /* * Copy current design */ if ((pbde = (boarddesign *) g_malloc(sizeof(boarddesign))) == 0) { outputerr("allocate boarddesign"); return; } if (pbdeSelected) { /* Exporting current design so just get settings */ pbde->szTitle = g_strdup(pbdeSelected->szTitle); pbde->szAuthor = g_strdup(pbdeSelected->szAuthor); ParsePreferences(pbdeSelected, &rdNew); } else { /* new design, so get settings and copy to other dimension */ pbde->szTitle = g_strdup(_("User defined")); pbde->szAuthor = g_strdup(_("User")); GetPrefs(&rdPrefs); rdNew = rdPrefs; #if USE_BOARD3D CopyNewSettingsToOtherDimension(&rdNew); #endif } WriteDesignString(pbde, &rdNew); pbde->fDeletable = TRUE; /* if file exists, read in any designs */ if ((designs = ParseBoardDesigns(szFile, TRUE)) == 0) { /* None found so create empty list */ designs = g_list_alloc(); } designs = g_list_append(designs, (gpointer) pbde); /* write designs to file */ if ((pf = g_fopen(szFile, "w+")) == 0) { outputerr(szFile); free_board_design(pbde, NULL); g_free(pch); return; } WriteDesignHeader(szFile, pf); g_list_foreach(designs, WriteDesign, pf); WriteDesignFooter(pf); fclose(pf); free_board_design(pbde, NULL); g_free(pch); } static void ImportDesign(GtkWidget * pw, gpointer data) { gchar *pch; gchar *szFile; GList *new_designs; gint old_length; gint num_added; GList *plBoardDesigns = (GList *) data; if ((pch = szFile = GTKFileSelect(_("Import Design"), NULL, NULL, NULL, GTK_FILE_CHOOSER_ACTION_OPEN)) == 0) return; #if !defined(WIN32) szFile = NextToken(&szFile); #endif if ((new_designs = ParseBoardDesigns(szFile, TRUE)) == 0) { /* no designs found */ outputl(_("File not found or no designs in file.")); outputx(); g_free(pch); return; } g_free(pch); /* add designs to current list */ /* FIXME: show dialog instead */ outputl(_("Adding new designs:")); old_length = g_list_length(plBoardDesigns); g_list_foreach(new_designs, AddDesignRowIfNew, pwDesignList); num_added = g_list_length(plBoardDesigns) - old_length; outputf(ngettext("%d design added.\n", "%d designs added.\n", num_added), num_added); outputx(); if (num_added > 0) { DesignSave(pw, plBoardDesigns); pbdeSelected = g_list_nth_data(plBoardDesigns, old_length); UseDesign(); } } static void RemoveDesign(GtkWidget * pw, gpointer data) { GList *plBoardDesigns = (GList *) data; char prompt[200]; sprintf(prompt, _("Permanently remove design %s?"), pbdeSelected->szTitle); if (!GetInputYN(prompt)) return; gtk_widget_set_sensitive(GTK_WIDGET(pwDesignRemove), FALSE); plBoardDesigns = g_list_remove(plBoardDesigns, pbdeSelected); RemoveListDesign(pbdeSelected); DesignSave(pw, data); SetTitle(); } static void UpdateDesign(GtkWidget * pw, gpointer data) { renderdata newPrefs; char prompt[200]; #if USE_BOARD3D if (display_is_3d(&rdPrefs)) sprintf(prompt, _("Permanently overwrite 3d settings for design %s?"), pbdeModified->szTitle); else sprintf(prompt, _("Permanently overwrite 2d settings for design %s?"), pbdeModified->szTitle); #else sprintf(prompt, _("Permanently overwrite settings for design %s?"), pbdeModified->szTitle); #endif if (!GetInputYN(prompt)) return; gtk_widget_set_sensitive(GTK_WIDGET(pwDesignUpdate), FALSE); #if USE_BOARD3D if (display_is_3d(&rdPrefs)) { /* Get current (2d) settings for design */ ParsePreferences(pbdeModified, &newPrefs); /* Overwrite 3d settings with current values */ Set3dSettings(&newPrefs, &rdPrefs); } else #endif { #if USE_BOARD3D /* Get current (3d) design settings */ renderdata designPrefs; ParsePreferences(pbdeModified, &designPrefs); #endif /* Copy current (2d) settings */ GetPrefs(&rdPrefs); newPrefs = rdPrefs; #if USE_BOARD3D /* Overwrite 3d design settings */ Set3dSettings(&newPrefs, &designPrefs); #endif } /* Save updated design */ WriteDesignString(pbdeModified, &newPrefs); DesignSave(pw, data); rdPrefs = newPrefs; SetTitle(); } static void AddDesignRow(gpointer data, gpointer UNUSED(user_data)) { boarddesign *pbde = data; GtkTreeIter iter; if (pbde == NULL) return; gtk_list_store_append(designListStore, &iter); gtk_list_store_set(designListStore, &iter, NAME_COL, pbde->szTitle, DATA_COL, pbde, -1); } static void AddDesignRowIfNew(gpointer data, gpointer user_data) { renderdata rdNew; boarddesign *pbde = data; if (pbde == NULL) return; ParsePreferences(pbde, &rdNew); if (FindDesign(plBoardDesigns, &rdNew)) { outputf("Design %s already present\n", pbde->szTitle); return; } AddDesignRow(data, user_data); plBoardDesigns = g_list_append(plBoardDesigns, (gpointer) pbde); outputf("Design %s added\n", pbde->szTitle); } static void DesignSelectNew(GtkTreeView * treeview, gpointer UNUSED(userdata)) { GtkTreeIter selected_iter; GtkTreeModel *model; boarddesign *pbde; gtk_tree_selection_get_selected(gtk_tree_view_get_selection(treeview), &model, &selected_iter); gtk_tree_model_get(model, &selected_iter, DATA_COL, &pbde, -1); if (gtk_widget_is_sensitive(pwDesignAdd)) { GTKSetCurrentParent(GTK_WIDGET(pwDesignList)); if (!GetInputYN(_("Select new design and lose current changes?"))) { pbdeModified = pbde; gtk_widget_set_sensitive(GTK_WIDGET(pwDesignUpdate), pbdeModified->fDeletable); return; } } pbdeSelected = pbde; UseDesign(); } static GtkWidget * DesignPage(GList * plBoardDesigns, BoardData * UNUSED(bd)) { GtkWidget *pwhbox; GtkWidget *pwScrolled; GtkWidget *pwPage; GtkCellRenderer *renderer; pwPage = gtk_vbox_new(FALSE, 4); /* List with board designs */ renderer = gtk_cell_renderer_text_new(); g_object_set(renderer, "ypad", 0, NULL); designListStore = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); g_list_foreach(plBoardDesigns, AddDesignRow, pwDesignList); pwDesignList = gtk_tree_view_new_with_model(GTK_TREE_MODEL(designListStore)); g_object_unref(G_OBJECT(designListStore)); /* The view now holds a reference. We can get rid of our own reference */ gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(pwDesignList)), GTK_SELECTION_BROWSE); gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(pwDesignList), -1, _("Design"), renderer, "text", NAME_COL, NULL); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pwDesignList), FALSE); g_signal_connect(pwDesignList, "cursor-changed", G_CALLBACK(DesignSelectNew), NULL); pwScrolled = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(pwScrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add(GTK_CONTAINER(pwScrolled), pwDesignList); gtk_container_add(GTK_CONTAINER(pwPage), pwScrolled); /* button: use design */ pwhbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwPage), pwhbox, FALSE, FALSE, 4); /* * buttons */ /* add current design */ pwDesignAdd = gtk_button_new_with_label(_("Add current design")); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignAdd, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignAdd), "clicked", G_CALLBACK(DesignAdd), plBoardDesigns); /* remove design */ pwDesignRemove = gtk_button_new_with_label(_("Remove design")); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignRemove, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignRemove), "clicked", G_CALLBACK(RemoveDesign), plBoardDesigns); gtk_widget_set_sensitive(GTK_WIDGET(pwDesignRemove), FALSE); /* update design */ pwDesignUpdate = gtk_button_new_with_label(_("Update design")); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignUpdate, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignUpdate), "clicked", G_CALLBACK(UpdateDesign), plBoardDesigns); gtk_widget_set_sensitive(GTK_WIDGET(pwDesignUpdate), FALSE); /* export design */ pwhbox = gtk_hbox_new(FALSE, 0); gtk_box_pack_start(GTK_BOX(pwPage), pwhbox, FALSE, FALSE, 4); pwDesignExport = gtk_button_new_with_label(_("Export design")); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignExport, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignExport), "clicked", G_CALLBACK(ExportDesign), NULL); /* import design */ pwDesignImport = gtk_button_new_with_label(_("Import design")); gtk_box_pack_start(GTK_BOX(pwhbox), pwDesignImport, FALSE, FALSE, 4); g_signal_connect(G_OBJECT(pwDesignImport), "clicked", G_CALLBACK(ImportDesign), plBoardDesigns); gtk_widget_show_all(pwPage); return pwPage; } static void BoardPrefsDestroy(GtkWidget * UNUSED(pw), GList * plBoardDesigns) { fUpdate = FALSE; free_board_designs(plBoardDesigns); } static void GetPrefs(renderdata * prd) { int i, j; gdouble ar[4]; #if USE_BOARD3D prd->fDisplayType = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwBoardType)) ? DT_2D : DT_3D; if (display_is_3d(&rdPrefs)) { int newCurveAccuracy; /* dice colour same as chequer colour */ for (i = 0; i < 2; ++i) { prd->afDieColour3d[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(apwDieColour[i])); } prd->showShadows = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwShowShadows)); prd->shadowDarkness = (int) gtk_adjustment_get_value(padjDarkness); /* Darkness as percentage of ambient light */ prd->dimness = ((prd->lightLevels[1] / 100.0f) * (100 - prd->shadowDarkness)) / 100; prd->animateRoll = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwAnimateRoll)); prd->animateFlag = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwAnimateFlag)); prd->closeBoardOnExit = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwCloseBoard)); newCurveAccuracy = (int) gtk_adjustment_get_value(padjAccuracy); newCurveAccuracy -= (newCurveAccuracy % 4); prd->curveAccuracy = newCurveAccuracy; prd->lightType = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwLightSource)) ? LT_POSITIONAL : LT_DIRECTIONAL; prd->lightPos[0] = (float) gtk_adjustment_get_value(padjLightPosX); prd->lightPos[1] = (float) gtk_adjustment_get_value(padjLightPosY); prd->lightPos[2] = (float) gtk_adjustment_get_value(padjLightPosZ); prd->lightLevels[0] = (int) gtk_adjustment_get_value(padjLightLevelAmbient); prd->lightLevels[1] = (int) gtk_adjustment_get_value(padjLightLevelDiffuse); prd->lightLevels[2] = (int) gtk_adjustment_get_value(padjLightLevelSpecular); prd->boardAngle = (int) gtk_adjustment_get_value(padjBoardAngle); prd->skewFactor = (int) gtk_adjustment_get_value(padjSkewFactor); prd->pieceType = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwRoundedPiece)) ? PT_ROUNDED : PT_FLAT; prd->pieceTextureType = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwTextureAllPiece)) ? PTT_ALL : PTT_TOP; prd->diceSize = (float) gtk_adjustment_get_value(padjDiceSize); prd->roundedEdges = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwRoundedEdges)); prd->bgInTrays = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwBgTrays)); prd->roundedPoints = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwRoundPoints)); prd->planView = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwPlanView)); prd->fHinges3d = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwHinges)); } else #endif { /* dice colour same as chequer colour */ for (i = 0; i < 2; ++i) { prd->afDieColour[i] = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(apwDieColour[i])); } for (i = 0; i < 2; i++) { prd->arRefraction[i] = (float) gtk_adjustment_get_value(apadj[i]); prd->arCoefficient[i] = (float) gtk_adjustment_get_value(apadjCoefficient[i]); prd->arExponent[i] = (float) gtk_adjustment_get_value(apadjExponent[i]); prd->arDiceCoefficient[i] = (float) gtk_adjustment_get_value(apadjDiceCoefficient[i]); prd->arDiceExponent[i] = (float) gtk_adjustment_get_value(apadjDiceExponent[i]); } gtk_color_button_get_array(GTK_COLOR_BUTTON(apwColour[0]), ar); for (i = 0; i < 4; i++) prd->aarColour[0][i] = ar[i]; gtk_color_button_get_array(GTK_COLOR_BUTTON(apwColour[1]), ar); for (i = 0; i < 4; i++) prd->aarColour[1][i] = ar[i]; gtk_color_button_get_array(GTK_COLOR_BUTTON(apwDiceColour[0]), ar); for (i = 0; i < 3; i++) prd->aarDiceColour[0][i] = ar[i]; gtk_color_button_get_array(GTK_COLOR_BUTTON(apwDiceColour[1]), ar); for (i = 0; i < 3; i++) prd->aarDiceColour[1][i] = ar[i]; for (j = 0; j < 2; ++j) { gtk_color_button_get_array(GTK_COLOR_BUTTON(apwDiceDotColour[j]), ar); for (i = 0; i < 3; i++) prd->aarDiceDotColour[j][i] = ar[i]; } /* cube colour */ gtk_color_button_get_array(GTK_COLOR_BUTTON(pwCubeColour), ar); for (i = 0; i < 3; i++) prd->arCubeColour[i] = ar[i]; /* board colour */ for (j = 0; j < 4; j++) { gtk_color_button_get_array(GTK_COLOR_BUTTON(apwBoard[j]), ar); for (i = 0; i < 3; i++) prd->aanBoardColour[j][i] = (unsigned char) (ar[i] * 0xFF); } prd->aSpeckle[0] = (int) (gtk_adjustment_get_value(apadjBoard[0]) * 0x80); /* prd->aSpeckle[ 1 ] = (int)(gtk_adjustment_get_value( apadjBoard[ 1 ] ) * 0x80); */ prd->aSpeckle[2] = (int) (gtk_adjustment_get_value(apadjBoard[2]) * 0x80); prd->aSpeckle[3] = (int) (gtk_adjustment_get_value(apadjBoard[3]) * 0x80); if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwWood))) prd->wt = gtk_combo_box_get_active(GTK_COMBO_BOX(pwWoodType)); else prd->wt = WOOD_PAINT; prd->rRound = 1.0f - (float) gtk_adjustment_get_value(padjRound); prd->fHinges = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwHinges)); WorkOut2dLight(prd); } prd->fDynamicLabels = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwDynamicLabels)); prd->fLabels = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwLabels)); prd->showMoveIndicator = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pwMoveIndicator)); prd->fClockwise = fClockwise; /* yuck */ } static void append_preview_page(GtkWidget * pwNotebook, GtkWidget * pwPage, char *szLabel, pixmapindex UNUSED(pi)) { GtkWidget *pw; pw = gtk_hbox_new(FALSE, 4); gtk_box_pack_start(GTK_BOX(pw), pwPage, TRUE, TRUE, 0); gtk_widget_show_all(pw); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), pw, gtk_label_new(szLabel)); } void AddPages(BoardData * bd, GtkWidget * pwNotebook, GList * plBoardDesigns) { #if USE_BOARD3D gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), LightingPage(bd), gtk_label_new(_("Lighting"))); gtk_widget_set_sensitive(frame3dOptions, display_is_3d(&rdPrefs)); #endif gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), DesignPage(plBoardDesigns, bd), gtk_label_new(_("Designs"))); #if USE_BOARD3D if (display_is_3d(&rdPrefs)) { ResetPreviews(); append_preview_page(pwNotebook, ChequerPrefs3d(bd), _("Chequers"), PI_CHEQUERS0); append_preview_page(pwNotebook, BoardPage3d(bd), _("Board"), PI_BOARD); append_preview_page(pwNotebook, BorderPage3d(bd), _("Border"), PI_BORDER); append_preview_page(pwNotebook, DicePrefs3d(bd, 0), _("Dice (0)"), PI_DICE0); append_preview_page(pwNotebook, DicePrefs3d(bd, 1), _("Dice (1)"), PI_DICE1); append_preview_page(pwNotebook, CubePrefs3d(bd), _("Cube"), PI_CUBE); } else #endif { append_preview_page(pwNotebook, ChequerPrefs(bd, 0), _("Chequers (0)"), PI_CHEQUERS0); append_preview_page(pwNotebook, ChequerPrefs(bd, 1), _("Chequers (1)"), PI_CHEQUERS1); append_preview_page(pwNotebook, BoardPage(bd), _("Board"), PI_BOARD); append_preview_page(pwNotebook, BorderPage(bd), _("Border"), PI_BORDER); append_preview_page(pwNotebook, DicePrefs(bd, 0), _("Dice (0)"), PI_DICE0); append_preview_page(pwNotebook, DicePrefs(bd, 1), _("Dice (1)"), PI_DICE1); append_preview_page(pwNotebook, CubePrefs(bd), _("Cube"), PI_CUBE); } } static void ChangePage(GtkNotebook * UNUSED(notebook), GtkNotebook * UNUSED(page), guint page_num, gpointer UNUSED(user_data)) { BoardData *bd = BOARD(pwPrevBoard)->board_data; unsigned int dicePage = NUM_NONPREVIEW_PAGES + PI_DICE0; if (!fUpdate) return; #if USE_BOARD3D if (display_is_3d(&rdPrefs)) dicePage -= 1; #endif /* Make sure correct dice preview visible */ if ((page_num == dicePage && bd->turn == 1) || (page_num == dicePage + 1 && bd->turn == -1)) { bd->turn = -bd->turn; #if USE_BOARD3D if (display_is_3d(&rdPrefs)) setDicePos(bd, bd->bd3d); else #endif RollDice2d(bd); option_changed(0, 0); } #if USE_BOARD3D if (display_is_3d(&rdPrefs) && redrawChange) { redraw_changed(NULL, NULL); redrawChange = FALSE; } #endif } #if USE_BOARD3D static void pref_dialog_map(GtkWidget * UNUSED(window), BoardData * bd) { DisplayCorrectBoardType(bd, bd->bd3d, bd->rd); redrawChange = FALSE; bd->rd->quickDraw = FALSE; SetTitle(); /* Make sure title selected properly */ } #else static void pref_dialog_map(GtkWidget * UNUSED(window), BoardData * UNUSED(bd)) { SetTitle(); /* Make sure title selected properly */ } #endif extern void BoardPreferences(GtkWidget * pwBoard) { GtkWidget *pwDialog, *pwHbox; BoardData *bd; /* Set up board with current preferences, hide unwanted elements */ CopyAppearance(&rdPrefs); rdPrefs.fDiceArea = FALSE; rdPrefs.fShowGameInfo = FALSE; /* Create preview board */ pwPrevBoard = board_new(&rdPrefs); bd = BOARD(pwPrevBoard)->board_data; #if USE_BOARD3D InitColourSelectionDialog(); #endif InitBoardPreview(bd); RollDice2d(bd); pwDialog = GTKCreateDialog(_("GNU Backgammon - Appearance"), DT_QUESTION, NULL, DIALOG_FLAG_MODAL | DIALOG_FLAG_MINMAXBUTTONS, G_CALLBACK(BoardPrefsOK), pwBoard); #if USE_BOARD3D if (gtk_gl_init_success) { SetPreviewLightLevel(bd->rd->lightLevels); setDicePos(bd, bd->bd3d); } #endif gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwHbox = gtk_hbox_new(FALSE, 0)); pwNotebook = gtk_notebook_new(); gtk_notebook_set_scrollable(GTK_NOTEBOOK(pwNotebook), TRUE); gtk_notebook_popup_enable(GTK_NOTEBOOK(pwNotebook)); gtk_container_set_border_width(GTK_CONTAINER(pwNotebook), 4); #if !USE_BOARD3D /* Make sure preview is big enough in 2d mode */ gtk_widget_set_size_request(GTK_WIDGET(pwNotebook), -1, 360); #endif gtk_box_pack_start(GTK_BOX(pwHbox), pwNotebook, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(pwHbox), pwPrevBoard, TRUE, TRUE, 0); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), GeneralPage(bd, pwBoard), gtk_label_new(_("General"))); plBoardDesigns = read_board_designs(); AddPages(bd, pwNotebook, plBoardDesigns); g_signal_connect(G_OBJECT(pwNotebook), "switch-page", G_CALLBACK(ChangePage), 0); g_signal_connect(G_OBJECT(pwDialog), "destroy", G_CALLBACK(BoardPrefsDestroy), plBoardDesigns); gtk_notebook_set_current_page(GTK_NOTEBOOK(pwNotebook), NUM_NONPREVIEW_PAGES); g_signal_connect(pwDialog, "map", G_CALLBACK(pref_dialog_map), bd); fUpdate = TRUE; GTKRunDialog(pwDialog); } /* External board preference helper functions */ extern void SetBoardPreferences(GtkWidget * pwBoard, char *sz) { char *apch[2]; while (ParseKeyValue(&sz, apch)) RenderPreferencesParam(GetMainAppearance(), apch[0], apch[1]); if (fX) { BoardData *bd = BOARD(pwBoard)->board_data; if (gtk_widget_get_realized(pwBoard)) board_free_pixmaps(bd); if (gtk_widget_get_realized(pwBoard)) { board_create_pixmaps(pwBoard, bd); #if USE_BOARD3D DisplayCorrectBoardType(bd, bd->bd3d, bd->rd); if (display_is_3d(bd->rd)) UpdateShadows(bd->bd3d); else StopIdle3d(bd, bd->bd3d); if (display_is_2d(bd->rd)) #endif { gtk_widget_queue_draw(bd->drawing_area); gtk_widget_queue_draw(bd->dice_area); } gtk_widget_queue_draw(bd->table); } } } #if USE_BOARD3D static int IsWhiteColour3d(Material * pMat) { return (pMat->ambientColour[0] == 1) && (pMat->ambientColour[1] == 1) && (pMat->ambientColour[2] == 1) && (pMat->diffuseColour[0] == 1) && (pMat->diffuseColour[1] == 1) && (pMat->diffuseColour[2] == 1) && (pMat->specularColour[0] == 1) && (pMat->specularColour[1] == 1) && (pMat->specularColour[2] == 1); } static int IsBlackColour3d(Material * pMat) { return (pMat->ambientColour[0] == 0) && (pMat->ambientColour[1] == 0) && (pMat->ambientColour[2] == 0) && (pMat->diffuseColour[0] == 0) && (pMat->diffuseColour[1] == 0) && (pMat->diffuseColour[2] == 0) && (pMat->specularColour[0] == 0) && (pMat->specularColour[1] == 0) && (pMat->specularColour[2] == 0); } extern void Default3dSettings(BoardData * bd) { /* If no 3d settings loaded, set 3d appearance to first design */ /* Check if colours are set to default values */ if (IsWhiteColour3d(&bd->rd->ChequerMat[0]) && IsBlackColour3d(&bd->rd->ChequerMat[1]) && IsWhiteColour3d(&bd->rd->DiceMat[0]) && IsBlackColour3d(&bd->rd->DiceMat[1]) && IsBlackColour3d(&bd->rd->DiceDotMat[0]) && IsWhiteColour3d(&bd->rd->DiceDotMat[1]) && IsWhiteColour3d(&bd->rd->CubeMat) && IsBlackColour3d(&bd->rd->CubeNumberMat) && IsWhiteColour3d(&bd->rd->PointMat[0]) && IsBlackColour3d(&bd->rd->PointMat[1]) && IsBlackColour3d(&bd->rd->BoxMat) && IsWhiteColour3d(&bd->rd->PointNumberMat) && IsWhiteColour3d(&bd->rd->BackGroundMat)) { GList *plDesigns; /* Use new appearance settings to preserve current 2d settings */ renderdata rdNew; CopyAppearance(&rdNew); plDesigns = read_board_designs(); if (plDesigns && g_list_length(plDesigns) > 0) { boarddesign *pbde = g_list_nth_data(plDesigns, 0); if (pbde->szBoardDesign) { char *apch[2]; gchar *sz, *pch; pch = sz = g_strdup(pbde->szBoardDesign); while (ParseKeyValue(&sz, apch)) RenderPreferencesParam(&rdNew, apch[0], apch[1]); g_free(pch); /* Copy 3d settings from rdNew to main appearance settings */ bd->rd->pieceType = rdNew.pieceType; bd->rd->pieceTextureType = rdNew.pieceTextureType; bd->rd->fHinges3d = rdNew.fHinges3d; bd->rd->showMoveIndicator = rdNew.showMoveIndicator; bd->rd->showShadows = rdNew.showShadows; bd->rd->roundedEdges = rdNew.roundedEdges; bd->rd->bgInTrays = rdNew.bgInTrays; bd->rd->roundedPoints = rdNew.roundedPoints; bd->rd->shadowDarkness = rdNew.shadowDarkness; bd->rd->curveAccuracy = rdNew.curveAccuracy; bd->rd->skewFactor = rdNew.skewFactor; bd->rd->boardAngle = rdNew.boardAngle; bd->rd->diceSize = rdNew.diceSize; bd->rd->planView = rdNew.planView; bd->rd->quickDraw = rdNew.quickDraw; memcpy(bd->rd->ChequerMat, rdNew.ChequerMat, sizeof(Material[2])); memcpy(bd->rd->DiceMat, rdNew.DiceMat, sizeof(Material[2])); bd->rd->DiceMat[0].textureInfo = bd->rd->DiceMat[1].textureInfo = 0; bd->rd->DiceMat[0].pTexture = bd->rd->DiceMat[1].pTexture = 0; memcpy(bd->rd->DiceDotMat, rdNew.DiceDotMat, sizeof(Material[2])); memcpy(&bd->rd->CubeMat, &rdNew.CubeMat, sizeof(Material)); memcpy(&bd->rd->CubeNumberMat, &rdNew.CubeNumberMat, sizeof(Material)); memcpy(&bd->rd->BaseMat, &rdNew.BaseMat, sizeof(Material)); memcpy(bd->rd->PointMat, rdNew.PointMat, sizeof(Material[2])); memcpy(&bd->rd->BoxMat, &rdNew.BoxMat, sizeof(Material)); memcpy(&bd->rd->HingeMat, &rdNew.HingeMat, sizeof(Material)); memcpy(&bd->rd->PointNumberMat, &rdNew.PointNumberMat, sizeof(Material)); memcpy(&bd->rd->BackGroundMat, &rdNew.BackGroundMat, sizeof(Material)); memset(&bd->rd->lightPos, 0, sizeof(rdNew.lightPos)); memset(&bd->rd->lightLevels, 0, sizeof(rdNew.lightLevels)); memcpy(&bd->rd->lightPos, &rdNew.lightPos, sizeof(rdNew.lightPos)); memcpy(&bd->rd->lightLevels, &rdNew.lightLevels, sizeof(rdNew.lightLevels)); memcpy(&bd->rd->afDieColour3d, &rdNew.afDieColour3d, sizeof(rdNew.afDieColour3d)); } } free_board_designs(plDesigns); } } #endif /* Xml board parsing code */ typedef enum { STATE_NONE, STATE_BOARD_DESIGNS, STATE_BOARD_DESIGN, STATE_ABOUT, STATE_TITLE, STATE_AUTHOR, STATE_DESIGN } parserstate; typedef struct _DesignParser { gchar *filename; parserstate state; boarddesign *current_design; GList *designs; gboolean deletable; } DesignParser; static void design_parser_start_element(GMarkupParseContext * UNUSED(context), const gchar * element_name, const gchar ** UNUSED(attribute_names), const gchar ** UNUSED(attribute_values), gpointer user_data, GError ** UNUSED(error)) { DesignParser *parser = (DesignParser *) user_data; switch (parser->state) { case STATE_NONE: if (strcmp(element_name, "board-designs") == 0) parser->state = STATE_BOARD_DESIGNS; break; case STATE_BOARD_DESIGNS: if (strcmp(element_name, "board-design") == 0) { parser->state = STATE_BOARD_DESIGN; parser->current_design = g_new0(boarddesign, 1); } break; case STATE_BOARD_DESIGN: if (strcmp(element_name, "about") == 0) parser->state = STATE_ABOUT; if (strcmp(element_name, "design") == 0) parser->state = STATE_DESIGN; break; case STATE_ABOUT: if (strcmp(element_name, "title") == 0) parser->state = STATE_TITLE; if (strcmp(element_name, "author") == 0) parser->state = STATE_AUTHOR; break; case STATE_TITLE: case STATE_AUTHOR: case STATE_DESIGN: default: break; } } static void design_parser_end_element(GMarkupParseContext * UNUSED(context), const gchar * UNUSED(element_name), gpointer user_data, GError ** UNUSED(error)) { DesignParser *parser = (DesignParser *) user_data; switch (parser->state) { case STATE_NONE: g_assert_not_reached(); break; case STATE_BOARD_DESIGNS: parser->state = STATE_NONE; break; case STATE_BOARD_DESIGN: parser->current_design->fDeletable = parser->deletable; parser->designs = g_list_prepend(parser->designs, parser->current_design); parser->current_design = NULL; parser->state = STATE_BOARD_DESIGNS; break; case STATE_ABOUT: parser->state = STATE_BOARD_DESIGN; break; case STATE_TITLE: parser->state = STATE_ABOUT; break; case STATE_AUTHOR: parser->state = STATE_ABOUT; break; case STATE_DESIGN: parser->state = STATE_BOARD_DESIGN; break; default: g_assert_not_reached(); } } static void design_parser_characters(GMarkupParseContext * UNUSED(context), const gchar * text, gsize UNUSED(text_len), gpointer user_data, GError ** UNUSED(error)) { DesignParser *parser = (DesignParser *) user_data; switch (parser->state) { case STATE_TITLE: parser->current_design->szTitle = g_strdup(text); break; case STATE_AUTHOR: parser->current_design->szAuthor = g_strdup(text); break; case STATE_DESIGN: parser->current_design->szBoardDesign = g_strdup(text); break; default: break; } } static void design_parser_error(GMarkupParseContext * UNUSED(context), GError * UNUSED(error), gpointer user_data) { DesignParser *parser = (DesignParser *) user_data; g_warning("An error occured while parsing file: %s\n", parser->filename); } static GList * ParseBoardDesigns(const char *szFile, const int fDeletable) { GMarkupParser markup_parser = { design_parser_start_element, design_parser_end_element, design_parser_characters, NULL, design_parser_error }; GList *returnlist; GMarkupParseContext *context; DesignParser *parser; char *contents; gsize size; GError *error = NULL; parser = g_new0(DesignParser, 1); parser->filename = g_strdup(szFile); parser->designs = NULL; parser->deletable = fDeletable; /* create parser context */ if (!g_file_get_contents(szFile, &contents, &size, NULL)) { g_free(parser->filename); g_free(parser); return NULL; } context = g_markup_parse_context_new(&markup_parser, 0, parser, NULL); if (!context) { g_free(parser->filename); g_free(parser); return NULL; } /* parse document */ if (!g_markup_parse_context_parse(context, contents, size, &error)) { g_warning("Error parsing XML: %s\n", error->message); g_error_free(error); free_board_designs(parser->designs); g_markup_parse_context_free(context); g_free(parser->filename); g_free(parser); return NULL; } g_markup_parse_context_free(context); returnlist = parser->designs; g_free(parser->filename); free_board_design(parser->current_design, NULL); g_free(parser); return g_list_reverse(returnlist); } gnubg-1.02.000/boarddim.h0000644000000000000000000001261212157217752011670 00000000000000/* * boarddim.h * * by Holger Bochnig , 2003 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: boarddim.h,v 1.15 2013/06/16 02:16:10 mdpetch Exp $ */ #ifndef BOARDDIM_H #define BOARDDIM_H /* fundamental constants */ #define CHEQUER_WIDTH 6 #define DIE_WIDTH 7 #define CUBE_WIDTH 6 #define ARROW_WIDTH 3 #define HINGE_HEIGHT 12 #define HINGE_WIDTH 2 /* additional space (beyone one chequer's worth) between two points * with 5 chequers */ #define EXTRA_HEIGHT 10 /* derived constants */ #define CHEQUER_HEIGHT CHEQUER_WIDTH #define DIE_HEIGHT DIE_WIDTH #define CUBE_HEIGHT CUBE_WIDTH #define ARROW_HEIGHT ARROW_WIDTH #define BORDER_HEIGHT (CHEQUER_HEIGHT / 2) #define BORDER_WIDTH (CHEQUER_WIDTH / 2) #define BAR_WIDTH (2 * CHEQUER_WIDTH) #define BEAROFF_INSIDE CHEQUER_WIDTH #define BEAROFF_WIDTH (BEAROFF_INSIDE + 2 * BORDER_WIDTH) #define BOARD_WIDTH (12 * CHEQUER_WIDTH + 2 * BEAROFF_WIDTH + BAR_WIDTH) #define BEAROFF_DIVIDER_HEIGHT CHEQUER_HEIGHT /* the following is technically wrong - it should be 10 chequers, die/cube * and two borders - there may be undisplayable positions otherwise */ #define BOARD_MIN_HEIGHT (11 * CHEQUER_HEIGHT + 2 * BORDER_HEIGHT) #define BOARD_HEIGHT (BOARD_MIN_HEIGHT + EXTRA_HEIGHT) /* more derived constants */ #define CUBE_LABEL_WIDTH (CUBE_WIDTH - 2) #define CUBE_LABEL_HEIGHT (CUBE_HEIGHT - 2) #define RESIGN_WIDTH CUBE_WIDTH #define RESIGN_HEIGHT CUBE_HEIGHT #define RESIGN_LABEL_WIDTH CUBE_LABEL_WIDTH #define RESIGN_LABEL_HEIGHT CUBE_LABEL_HEIGHT #define CHEQUER_LABEL_WIDTH (CHEQUER_WIDTH - 2) #define CHEQUER_LABEL_HEIGHT (CHEQUER_HEIGHT - 2) #define POINT_WIDTH CHEQUER_WIDTH /* for a tall enough board, let the points extend past a stack of 5 chequers */ #if (EXTRA_HEIGHT >= (CHEQUER_HEIGHT + 4)) #define DISPLAY_POINT_EXTRA 4 #elif (EXTRA_HEIGHT >= (CHEQUER_HEIGHT + 3)) #define DISPLAY_POINT_EXTRA 3 #elif (EXTRA_HEIGHT >= (CHEQUER_HEIGHT + 2)) #define DISPLAY_POINT_EXTRA 2 #elif (EXTRA_HEIGHT >= (CHEQUER_HEIGHT + 1)) #define DISPLAY_POINT_EXTRA 1 #else #define DISPLAY_POINT_EXTRA 0 #endif #define DISPLAY_POINT_HEIGHT (5 * CHEQUER_HEIGHT + DISPLAY_POINT_EXTRA) /* for HTML */ #define BEAROFF_HEIGHT (5 * CHEQUER_HEIGHT) #define POINT_HEIGHT (5 * CHEQUER_HEIGHT) #define BOARD_CENTER_WIDTH (6 * CHEQUER_WIDTH) #define BOARD_CENTER_HEIGHT (BOARD_HEIGHT - 2 * (BORDER_HEIGHT + POINT_HEIGHT)) #define DISPLAY_BEAROFF_HEIGHT ((BOARD_HEIGHT - BEAROFF_DIVIDER_HEIGHT) / 2 - \ BORDER_HEIGHT) /* where to place a chequer on the bar - x */ #define BAR_X ((BOARD_WIDTH - CHEQUER_WIDTH) / 2) /* where to place the first player 0 chequer on the bar - y */ #define BAR_Y_0 (BOARD_HEIGHT / 2 - 16) /* and where to place the first player 1 chequer on the bar - y */ #define BAR_Y_1 (BOARD_HEIGHT / 2 + 9) /* where to start point x, x = 1..13 */ #define POINT_X(n) ((n < 7) ? (BOARD_WIDTH - BEAROFF_WIDTH - \ n * CHEQUER_WIDTH) : \ (n < 13) ? ((BOARD_WIDTH - BAR_WIDTH) / 2 - \ (n - 6) * CHEQUER_WIDTH) : \ (n < 19) ? (BEAROFF_WIDTH + \ (n - 13) * CHEQUER_WIDTH) : \ (BOARD_WIDTH + BAR_WIDTH) / 2 + (n - 19) * CHEQUER_WIDTH) /* top and bottom y co-ordinates of chequers */ #define TOP_POINT_Y (BOARD_HEIGHT - BORDER_HEIGHT - CHEQUER_HEIGHT) #define BOT_POINT_Y (BORDER_HEIGHT) /* left and right bearoff tray coordinates */ #define BEAROFF_RIGHT_X (BOARD_WIDTH - BORDER_WIDTH - CHEQUER_WIDTH) #define BEAROFF_LEFT_X (BORDER_WIDTH) /* x and y coordinates of cube when not available/doubling/owned/centred */ #define NO_CUBE -32768 /* width of board between tray and bar */ #define PLAY_WIDTH (((BOARD_WIDTH - (2 * BEAROFF_WIDTH)) - BAR_WIDTH) / 2) #define CUBE_RIGHT_X (BEAROFF_WIDTH + (PLAY_WIDTH - CUBE_WIDTH) / 2) #define CUBE_LEFT_X (BOARD_WIDTH - (CUBE_RIGHT_X)) #define CUBE_TRAY_X (BEAROFF_LEFT_X + (BEAROFF_INSIDE - CUBE_WIDTH) / 2) #define PLAY_HEIGHT (BOARD_HEIGHT - 2 * BORDER_HEIGHT ) #define CUBE_CENTRE_Y (BORDER_HEIGHT + (PLAY_HEIGHT - CUBE_HEIGHT) / 2) #define CUBE_OWN_1_Y (BOARD_HEIGHT - (CUBE_HEIGHT + BORDER_HEIGHT)) #define CUBE_OWN_0_Y (BORDER_HEIGHT) #define CUBE_RESIGN_LEFT_X (CUBE_LEFT_X - CHEQUER_WIDTH) #define CUBE_RESIGN_RIGHT_X (CUBE_RIGHT_X + CHEQUER_WIDTH) /* where the hinges begin - y */ #define HINGE_BOT_Y ((BOARD_HEIGHT - CUBE_HEIGHT) / 2 - \ 2 * CHEQUER_HEIGHT - HINGE_HEIGHT - 1) #define HINGE_TOP_Y ((BOARD_HEIGHT + CUBE_HEIGHT) / 2 + \ 2 * CHEQUER_HEIGHT + 1) #endif /* BOARDDIM_H */ gnubg-1.02.000/util.h0000644000000000000000000000276312167602167011071 00000000000000/* * util.h * * by Christian Anthon 2007 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: util.h,v 1.15 2013/07/11 19:16:07 mdpetch Exp $ */ #ifndef UTIL_H #define UTIL_H #include #include extern char *prefsdir; extern char *datadir; extern char *pkg_datadir; extern char *docdir; extern char *getDataDir(void); extern char *getPkgDataDir(void); extern char *getDocDir(void); #define BuildFilename(file) g_build_filename(getPkgDataDir(), file, NULL) #define BuildFilename2(file1, file2) g_build_filename(getPkgDataDir(), file1, file2, NULL) extern void PrintSystemError(const char *message); extern void PrintError(const char *message); extern FILE *GetTemporaryFile(const char *nameTemplate, char **retName); #if defined(WIN32) extern int TEMP_g_mkstemp(char *tmpl); extern int TEMP_g_file_open_tmp(const char *tmpl, char **name_used, GError **pError); #endif #endif gnubg-1.02.000/external_y.c0000644000000000000000000014540512175510116012251 00000000000000/* A Bison parser, made by GNU Bison 2.5. */ /* Bison implementation for Yacc-like parsers in C Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.5" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse extparse #define yylex extlex #define yyerror exterror #define yylval extlval #define yychar extchar #define yydebug extdebug #define yynerrs extnerrs /* Copy the first part of user declarations. */ /* Line 268 of yacc.c */ #line 1 "external_y.y" /* * external_y.y -- command parser for external interface * * by Jørn Thyssen , 2003. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: external_y.y,v 1.20 2012/11/30 23:27:59 plm Exp $ */ #include "config.h" #include #include #include #include #include "external.h" #include "backgammon.h" extern int extlex(void); extern int exterror(const char *s); extcmd ec; static void reset_command(void); void ( *ExtErrorHandler )( const char *, const char *, const int ) = NULL; /* Line 268 of yacc.c */ #line 124 "external_y.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 1 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { STRING = 258, NUMBER = 259, EVALUATION = 260, PLIES = 261, CUBE = 262, CUBEFUL = 263, CUBELESS = 264, NOISE = 265, PRUNE = 266, CRAWFORDRULE = 267, JACOBYRULE = 268, FIBSBOARD = 269, AFIBSBOARD = 270, ON = 271, OFF = 272 }; #endif /* Tokens. */ #define STRING 258 #define NUMBER 259 #define EVALUATION 260 #define PLIES 261 #define CUBE 262 #define CUBEFUL 263 #define CUBELESS 264 #define NOISE 265 #define PRUNE 266 #define CRAWFORDRULE 267 #define JACOBYRULE 268 #define FIBSBOARD 269 #define AFIBSBOARD 270 #define ON 271 #define OFF 272 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 293 of yacc.c */ #line 49 "external_y.y" int number; char *sval; /* Line 293 of yacc.c */ #line 201 "external_y.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif /* Copy the second part of user declarations. */ /* Line 343 of yacc.c */ #line 213 "external_y.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif #if defined YYCOPY_NEEDED && YYCOPY_NEEDED /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 25 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 18 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 17 /* YYNRULES -- Number of rules. */ #define YYNRULES 30 /* YYNRULES -- Number of states. */ #define YYNSTATES 39 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 272 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 7, 9, 12, 13, 15, 17, 20, 23, 24, 27, 30, 31, 34, 35, 38, 41, 42, 44, 45, 47, 48, 50, 51, 54, 55, 58, 65 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 19, 0, -1, -1, 21, 20, -1, 34, -1, 22, 32, -1, -1, 15, -1, 15, -1, 13, 16, -1, 13, 17, -1, -1, 12, 16, -1, 12, 17, -1, -1, 6, 4, -1, -1, 7, 16, -1, 7, 17, -1, -1, 8, -1, -1, 11, -1, -1, 9, -1, -1, 10, 4, -1, -1, 25, 24, -1, 26, 27, 28, 29, 30, 31, -1, 5, 14, 23, 33, 32, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 65, 65, 66, 69, 70, 73, 78, 85, 91, 92, 93, 96, 97, 98, 101, 102, 105, 106, 107, 110, 111, 114, 115, 118, 119, 122, 123, 126, 129, 132 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "STRING", "NUMBER", "EVALUATION", "PLIES", "CUBE", "CUBEFUL", "CUBELESS", "NOISE", "PRUNE", "CRAWFORDRULE", "JACOBYRULE", "FIBSBOARD", "AFIBSBOARD", "ON", "OFF", "$accept", "the_command", "command", "reset_command", "cmdfibsboard", "fibsboard", "optjacobyrule", "optcrawfordrule", "optplies", "optcube", "optcubeful", "optprune", "optcubeless", "optnoise", "sessionrules", "evalcontext", "evaluation", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 18, 19, 19, 20, 20, 21, 22, 23, 24, 24, 24, 25, 25, 25, 26, 26, 27, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 33, 34 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 2, 0, 1, 1, 2, 2, 0, 2, 2, 0, 2, 0, 2, 2, 0, 1, 0, 1, 0, 1, 0, 2, 0, 2, 6, 5 }; /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. Performed when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 6, 0, 0, 1, 0, 7, 3, 14, 4, 0, 0, 11, 5, 8, 16, 12, 13, 0, 28, 0, 19, 14, 9, 10, 15, 0, 21, 30, 17, 18, 20, 23, 22, 25, 24, 27, 0, 29, 26 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 6, 2, 7, 14, 18, 11, 20, 26, 31, 33, 35, 37, 12, 21, 8 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -16 static const yytype_int8 yypact[] = { 7, 8, -5, -16, -3, -16, -16, 0, -16, -6, -15, 1, -16, -16, 9, -16, -16, -13, -16, 12, 6, 0, -16, -16, -16, -11, 10, -16, -16, -16, -16, 11, -16, 14, -16, 15, 13, -16, -16 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, -2, -16, -16 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -3 static const yytype_int8 yytable[] = { 4, 15, 16, 22, 23, 28, 29, -2, 3, 13, 5, 9, 10, 25, 17, 19, 24, 38, 30, 27, 0, 0, 32, 34, 0, 36 }; #define yypact_value_is_default(yystate) \ ((yystate) == (-16)) #define yytable_value_is_error(yytable_value) \ YYID (0) static const yytype_int8 yycheck[] = { 5, 16, 17, 16, 17, 16, 17, 0, 0, 15, 15, 14, 12, 7, 13, 6, 4, 4, 8, 21, -1, -1, 11, 9, -1, 10 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 19, 21, 0, 5, 15, 20, 22, 34, 14, 12, 25, 32, 15, 23, 16, 17, 13, 24, 6, 26, 33, 16, 17, 4, 7, 27, 32, 16, 17, 8, 28, 11, 29, 9, 30, 10, 31, 4 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. However, YYFAIL appears to be in use. Nevertheless, it is formally deprecated in Bison 2.4.2's NEWS entry, where a plan to phase it out is discussed. */ #define YYFAIL goto yyerrlab #if defined YYFAIL /* This is here to suppress warnings from the GCC cpp's -Wunused-macros. Normally we don't worry about that warning, but some users do, and we want to make it easy for users to remove YYFAIL uses, which will produce warnings from Bison 2.5. */ #endif #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* This macro is provided for backward compatibility. */ #ifndef YY_LOCATION_PRINT # define YY_LOCATION_PRINT(File, Loc) ((void) 0) #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message about the unexpected token YYTOKEN for the state stack whose top is YYSSP. Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is not large enough to hold the message. In that case, also set *YYMSG_ALLOC to the required number of bytes. Return 2 if the required number of bytes is too large to store. */ static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ const char *yyformat = 0; /* Arguments of yyformat. */ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; /* Number of reported tokens (one for the "unexpected", one per "expected"). */ int yycount = 0; /* There are many possibilities here to consider: - Assume YYFAIL is not used. It's too flawed to consider. See for details. YYERROR is fine as it does not invoke this function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected tokens because there are none. - The only way there can be no lookahead present (in yychar) is if this state is a consistent state with a default action. Thus, detecting the absence of a lookahead is sufficient to determine that there is no unexpected or expected token to report. In that case, just report a simple "syntax error". - Don't assume there isn't a lookahead just because this state is a consistent state with a default action. There might have been a previous inconsistent state, consistent state with a non-default action, or user semantic action that manipulated yychar. - Of course, the expected token list depends on states to have correct lookahead information, and it depends on the parser not to perform extra reductions after fetching a lookahead from the scanner and before detecting a syntax error. Thus, state merging (from LALR or IELR) and default reductions corrupt the expected token list. However, the list is correct for canonical LR with one exception: it will still contain any token that will not be accepted due to an error action in a later state. */ if (yytoken != YYEMPTY) { int yyn = yypact[*yyssp]; yyarg[yycount++] = yytname[yytoken]; if (!yypact_value_is_default (yyn)) { /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. In other words, skip the first -YYN actions for this state because they are default actions. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yyx; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR && !yytable_value_is_error (yytable[yyx + yyn])) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; } } } switch (yycount) { # define YYCASE_(N, S) \ case N: \ yyformat = S; \ break YYCASE_(0, YY_("syntax error")); YYCASE_(1, YY_("syntax error, unexpected %s")); YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); # undef YYCASE_ } yysize1 = yysize + yystrlen (yyformat); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; yysize = yysize1; if (*yymsg_alloc < yysize) { *yymsg_alloc = 2 * yysize; if (! (yysize <= *yymsg_alloc && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; return 1; } /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ { char *yyp = *yymsg; int yyi = 0; while ((*yyp = *yyformat) != '\0') if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyformat += 2; } else { yyp++; yyformat++; } } return 0; } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yypact_value_is_default (yyn)) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yytable_value_is_error (yyn)) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 6: /* Line 1806 of yacc.c */ #line 73 "external_y.y" { reset_command(); } break; case 7: /* Line 1806 of yacc.c */ #line 78 "external_y.y" { ec.ct = COMMAND_FIBSBOARD; free( ec.szFIBSBoard ); ec.szFIBSBoard = (yyvsp[(1) - (1)].sval); } break; case 8: /* Line 1806 of yacc.c */ #line 85 "external_y.y" { free( ec.szFIBSBoard ); ec.szFIBSBoard = (yyvsp[(1) - (1)].sval); } break; case 9: /* Line 1806 of yacc.c */ #line 91 "external_y.y" { ec.fJacobyRule = TRUE; } break; case 10: /* Line 1806 of yacc.c */ #line 92 "external_y.y" { ec.fJacobyRule = FALSE; } break; case 11: /* Line 1806 of yacc.c */ #line 93 "external_y.y" { ec.fJacobyRule = fJacoby; } break; case 12: /* Line 1806 of yacc.c */ #line 96 "external_y.y" { ec.fCrawfordRule = TRUE; } break; case 13: /* Line 1806 of yacc.c */ #line 97 "external_y.y" { ec.fCrawfordRule = FALSE; } break; case 14: /* Line 1806 of yacc.c */ #line 98 "external_y.y" { ec.fCrawfordRule = TRUE; } break; case 15: /* Line 1806 of yacc.c */ #line 101 "external_y.y" { ec.nPlies = (yyvsp[(2) - (2)].number); } break; case 17: /* Line 1806 of yacc.c */ #line 105 "external_y.y" { ec.fCubeful = TRUE; } break; case 18: /* Line 1806 of yacc.c */ #line 106 "external_y.y" { ec.fCubeful = FALSE; } break; case 20: /* Line 1806 of yacc.c */ #line 110 "external_y.y" { ec.fCubeful = TRUE; } break; case 22: /* Line 1806 of yacc.c */ #line 114 "external_y.y" { ec.fUsePrune = TRUE; } break; case 24: /* Line 1806 of yacc.c */ #line 118 "external_y.y" { ec.fCubeful = FALSE; } break; case 26: /* Line 1806 of yacc.c */ #line 122 "external_y.y" { ec.rNoise = (yyvsp[(2) - (2)].number); } break; case 30: /* Line 1806 of yacc.c */ #line 132 "external_y.y" { ec.ct = COMMAND_EVALUATION; } break; /* Line 1806 of yacc.c */ #line 1594 "external_y.c" default: break; } /* User semantic actions sometimes alter yychar, and that requires that yytoken be updated with the new translation. We take the approach of translating immediately before every use of yytoken. One alternative is translating here after every semantic action, but that translation would be missed if the semantic action invokes YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an incorrect destructor might then be invoked immediately. In the case of YYERROR or YYBACKUP, subsequent parser actions might lead to an incorrect destructor call or verbose syntax error message before the lookahead is translated. */ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ yyssp, yytoken) { char const *yymsgp = YY_("syntax error"); int yysyntax_error_status; yysyntax_error_status = YYSYNTAX_ERROR; if (yysyntax_error_status == 0) yymsgp = yymsg; else if (yysyntax_error_status == 1) { if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); if (!yymsg) { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; yysyntax_error_status = 2; } else { yysyntax_error_status = YYSYNTAX_ERROR; yymsgp = yymsg; } } yyerror (yymsgp); if (yysyntax_error_status == 2) goto yyexhaustedlab; } # undef YYSYNTAX_ERROR #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (!yypact_value_is_default (yyn)) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) { /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ yytoken = YYTRANSLATE (yychar); yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); } /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 2067 of yacc.c */ #line 137 "external_y.y" /* lexer interface */ extern FILE *extin; extern char *exttext; extern int exterror( const char *s ) { if ( ExtErrorHandler ) ExtErrorHandler( s, exttext && exttext[ 0 ] ? exttext : "", 1); else fprintf( stderr, "Error: %s at %s\n", s, exttext && exttext[ 0 ] ? exttext : "" ); return 0; } static void reset_command(void) { ec.ct = COMMAND_NONE; ec.nPlies = 0; ec.rNoise = 0; ec.fDeterministic = 1; ec.fCubeful = 0; ec.fUsePrune = 0; ec.fCrawfordRule = 1; ec.fJacobyRule = fJacoby; free(ec.szFIBSBoard); ec.szFIBSBoard = NULL; } #ifdef EXTERNAL_TEST extern int main( int argc, char *argv[] ) { FILE *pf = NULL; if ( argc > 1 ) if ( ! ( pf = fopen( argv[ 1 ], "r" ) ) ) { perror( argv[ 1 ] ); return 1; } extin = pf ? pf : stdin; extparse(); fclose( extin ); printf( "command type %d\n" "plies %d\n" "noise %f\n" "deterministic %d\n" "cubeful %d\n" "prune %d\n" "fibsboard %s\n" "crawfordrule %s\n" "jacobyrule %s\n", ec.ct, ec.nPlies, ec.rNoise, ec.fDeterministic, ec.fCubeful, ec.fUsePrune, ec.szFIBSBoard, ec.fCrawfordRule, ec.fJacobyRule ); return 0; } #endif gnubg-1.02.000/sgf.c0000644000000000000000000021462312166106133010655 00000000000000/* * sgf.c * * by Gary Wong , 2000, 2001. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: sgf.c,v 1.150 2013/07/06 21:30:03 plm Exp $ */ #include "config.h" #include "common.h" #include #include #include #include #include #include #include #include "backgammon.h" #include "dice.h" #include "eval.h" #if USE_GTK #include "gtkgame.h" #endif #include "analysis.h" #include "positionid.h" #include "sgf.h" static const char *szFile; static int fError; static int CheckSGFVersion(const char **sz); static void ErrorHandler(const char *sz, int UNUSED(fParseError)) { if (!fError) { fError = TRUE; outputerrf("%s: %s", szFile, sz); } } static void FreeList(listOLD * pl, int nLevel) { /* Levels are: * 0 - GameTreeSeq * 1 - GameTree * 2 - Sequence * 3 - Node * 4 - Property */ if (nLevel == 1) { FreeList(pl->plNext->p, 2); /* initial sequence */ ListDelete(pl->plNext); nLevel = 0; /* remainder of list is more GameTreeSeqs */ } while (pl->plNext != pl) { if (nLevel == 3) { FreeList(((property *) pl->plNext->p)->pl, 4); free(pl->plNext->p); } else if (nLevel == 4) free(pl->plNext->p); else FreeList(pl->plNext->p, nLevel + 1); ListDelete(pl->plNext); } if (nLevel != 4) free(pl); } static void FreeGameTreeSeq(listOLD * pl) { FreeList(pl, 0); } static listOLD * LoadCollection(char *sz) { listOLD *plCollection, *pl, *plRoot, *plProp; FILE *pf; int fBackgammon; property *pp; fError = FALSE; SGFErrorHandler = ErrorHandler; if (strcmp(sz, "-")) { if (!(pf = g_fopen(sz, "r"))) { outputerr(sz); return NULL; } szFile = sz; } else { /* FIXME does it really make sense to try to load from stdin? */ pf = stdin; szFile = "(stdin)"; } plCollection = SGFParse(pf); if (pf != stdin) fclose(pf); /* Traverse collection, looking for backgammon games. */ if (plCollection) { pl = plCollection->plNext; while (pl != plCollection) { plRoot = ((listOLD *) ((listOLD *) pl->p)->plNext->p)->plNext->p; fBackgammon = FALSE; for (plProp = plRoot->plNext; plProp != plRoot; plProp = plProp->plNext) { pp = plProp->p; if (pp->ach[0] == 'G' && pp->ach[1] == 'M' && pp->pl->plNext->p && atoi((char *) pp->pl->plNext->p) == 6) { fBackgammon = TRUE; break; } } pl = pl->plNext; if (!fBackgammon) { FreeList(pl->plPrev->p, 1); ListDelete(pl->plPrev); } } if (ListEmpty(plCollection)) { ErrorHandler(_("warning: no backgammon games in SGF file"), TRUE); free(plCollection); plCollection = NULL; } } return plCollection; } static void CopyName(int i, char *sz) { char *pc; /* FIXME sanity check the name as in CommandSetPlayerName */ pc = g_strdup(sz); if (strlen(pc) > 31) pc[31] = 0; strcpy(ap[i].szName, pc); g_free(pc); } static void SetScore(xmovegameinfo * pmgi, int fBlack, int n) { if (n >= 0 && (!pmgi->nMatch || n < pmgi->nMatch)) pmgi->anScore[fBlack] = n; } static void RestoreMI(listOLD * pl, moverecord * pmr) { char *pch; xmovegameinfo *pmgi = &pmr->g; for (pl = pl->plNext; (pch = pl->p); pl = pl->plNext) if (!strncmp(pch, "length:", 7)) { pmgi->nMatch = atoi(pch + 7); if (pmgi->nMatch < 0) pmgi->nMatch = 0; } else if (!strncmp(pch, "game:", 5)) { pmgi->i = atoi(pch + 5); if (pmgi->i < 0) pmgi->i = 0; } else if (!strncmp(pch, "ws:", 3) || !strncmp(pch, "bs:", 3)) SetScore(pmgi, *pch == 'b', atoi(pch + 3)); } static void RestoreGS(listOLD * pl, statcontext * psc) { char *pch; lucktype lt; skilltype st; for (pl = pl->plNext; (pch = pl->p); pl = pl->plNext) switch (*pch) { case 'M': /* moves */ psc->fMoves = TRUE; psc->anUnforcedMoves[0] = (int)strtol(pch + 2, &pch, 10); psc->anUnforcedMoves[1] = (int)strtol(pch, &pch, 10); psc->anTotalMoves[0] = (int)strtol(pch, &pch, 10); psc->anTotalMoves[1] = (int)strtol(pch, &pch, 10); for (st = SKILL_VERYBAD; st <= SKILL_NONE; st++) { psc->anMoves[0][st] = (int)strtol(pch, &pch, 10); psc->anMoves[1][st] = (int)strtol(pch, &pch, 10); } psc->arErrorCheckerplay[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorCheckerplay[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorCheckerplay[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorCheckerplay[1][1] = (float)g_ascii_strtod(pch, &pch); break; case 'C': /* cube */ psc->fCube = TRUE; psc->anTotalCube[0] = (int)strtol(pch + 2, &pch, 10); psc->anTotalCube[1] = (int)strtol(pch, &pch, 10); psc->anDouble[0] = (int)strtol(pch, &pch, 10); psc->anDouble[1] = (int)strtol(pch, &pch, 10); psc->anTake[0] = (int)strtol(pch, &pch, 10); psc->anTake[1] = (int)strtol(pch, &pch, 10); psc->anPass[0] = (int)strtol(pch, &pch, 10); psc->anPass[1] = (int)strtol(pch, &pch, 10); psc->anCubeMissedDoubleDP[0] = (int)strtol(pch, &pch, 10); psc->anCubeMissedDoubleDP[1] = (int)strtol(pch, &pch, 10); psc->anCubeMissedDoubleTG[0] = (int)strtol(pch, &pch, 10); psc->anCubeMissedDoubleTG[1] = (int)strtol(pch, &pch, 10); psc->anCubeWrongDoubleDP[0] = (int)strtol(pch, &pch, 10); psc->anCubeWrongDoubleDP[1] = (int)strtol(pch, &pch, 10); psc->anCubeWrongDoubleTG[0] = (int)strtol(pch, &pch, 10); psc->anCubeWrongDoubleTG[1] = (int)strtol(pch, &pch, 10); psc->anCubeWrongTake[0] = (int)strtol(pch, &pch, 10); psc->anCubeWrongTake[1] = (int)strtol(pch, &pch, 10); psc->anCubeWrongPass[0] = (int)strtol(pch, &pch, 10); psc->anCubeWrongPass[1] = (int)strtol(pch, &pch, 10); psc->arErrorMissedDoubleDP[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleDP[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleTG[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleTG[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleDP[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleDP[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleTG[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleTG[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongTake[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongTake[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongPass[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongPass[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleDP[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleDP[1][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleTG[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorMissedDoubleTG[1][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleDP[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleDP[1][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleTG[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongDoubleTG[1][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongTake[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongTake[1][1] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongPass[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arErrorWrongPass[1][1] = (float)g_ascii_strtod(pch, &pch); break; case 'D': /* dice */ psc->fDice = TRUE; pch += 2; for (lt = LUCK_VERYBAD; lt <= LUCK_VERYGOOD; lt++) { psc->anLuck[0][lt] = (int)strtol(pch, &pch, 10); psc->anLuck[1][lt] = (int)strtol(pch, &pch, 10); } psc->arLuck[0][0] = (float)g_ascii_strtod(pch, &pch); psc->arLuck[0][1] = (float)g_ascii_strtod(pch, &pch); psc->arLuck[1][0] = (float)g_ascii_strtod(pch, &pch); psc->arLuck[1][1] = (float)g_ascii_strtod(pch, &pch); break; default: /* ignore */ break; } AddStatcontext(psc, &scMatch); } static char * CopyEscapedString(const char *pchOrig) { char *sz, *pch; for (pch = sz = malloc(strlen(pchOrig) + 1); *pchOrig; pchOrig++) { if (*pchOrig == '\\') { if (pchOrig[1] == '\\') { *pch++ = '\\'; pchOrig++; } continue; } if (isspace(*pchOrig) && *pchOrig != '\n') { *pch++ = ' '; continue; } *pch++ = *pchOrig; } *pch = 0; return sz; } static void RestoreText(char *sz, char **ppch) { if (!sz || !*sz) return; free(*ppch); *ppch = CopyEscapedString(sz); } static void RestoreRules(xmovegameinfo * pmgi, const char *sz) { char *pch; char *pchx; /* split string at colons */ pch = g_strdup(sz); pchx = strtok(pch, ":"); while (pchx) { if (!strcmp(pchx, "Crawford")) pmgi->fCrawford = TRUE; else if (!strcmp(pchx, "CrawfordGame")) pmgi->fCrawfordGame = TRUE; else if (!strcmp(pchx, "Jacoby")) pmgi->fJacoby = TRUE; else if (!strcmp(pchx, "Nackgammon")) pmgi->bgv = VARIATION_NACKGAMMON; else if (!strcmp(pchx, "Hypergammon1")) pmgi->bgv = VARIATION_HYPERGAMMON_1; else if (!strcmp(pchx, "Hypergammon2")) pmgi->bgv = VARIATION_HYPERGAMMON_2; else if (!strcmp(pchx, "Hypergammon3")) pmgi->bgv = VARIATION_HYPERGAMMON_3; else if (!strcmp(pchx, "NoCube")) pmgi->fCubeUse = FALSE; pchx = strtok(NULL, ":"); } g_free(pch); } static void RestoreRootNode(listOLD * pl) { property *pp; moverecord *pmr; char *pch; int i; pmr = NewMoveRecord(); pmr->mt = MOVE_GAMEINFO; pmr->g.i = 0; pmr->g.nMatch = 0; pmr->g.anScore[0] = 0; pmr->g.anScore[1] = 0; pmr->g.fCrawford = FALSE; pmr->g.fCrawfordGame = FALSE; pmr->g.fJacoby = FALSE; pmr->g.fWinner = -1; pmr->g.nPoints = 0; pmr->g.fResigned = FALSE; pmr->g.nAutoDoubles = 0; pmr->g.bgv = VARIATION_STANDARD; pmr->g.fCubeUse = TRUE; IniStatcontext(&pmr->g.sc); for (pl = pl->plNext; (pp = pl->p); pl = pl->plNext) if (pp->ach[0] == 'M' && pp->ach[1] == 'I') /* MI - Match info property */ RestoreMI(pp->pl, pmr); else if (pp->ach[0] == 'P' && pp->ach[1] == 'B') /* PB - Black player property */ CopyName(1, pp->pl->plNext->p); else if (pp->ach[0] == 'P' && pp->ach[1] == 'W') /* PW - White player property */ CopyName(0, pp->pl->plNext->p); else if (pp->ach[0] == 'R' && pp->ach[1] == 'E') { /* RE - Result property */ pch = pp->pl->plNext->p; pmr->g.fWinner = -1; if (toupper(*pch) == 'B') pmr->g.fWinner = 1; else if (toupper(*pch) == 'W') pmr->g.fWinner = 0; if (pmr->g.fWinner == -1) continue; if (*++pch != '+') continue; pmr->g.nPoints = (int)strtol(pch, &pch, 10); if (pmr->g.nPoints < 1) pmr->g.nPoints = 1; pmr->g.fResigned = toupper(*pch) == 'R'; } else if (pp->ach[0] == 'R' && pp->ach[1] == 'U') { /* RU - Rules property */ RestoreRules(&pmr->g, (const char *) pp->pl->plNext->p); } else if (pp->ach[0] == 'C' && pp->ach[1] == 'V') { /* CV - Cube value (i.e. automatic doubles) */ for (i = 0; (1 << i) <= MAX_CUBE; i++) if (atoi(pp->pl->plNext->p) == 1 << i) { pmr->g.nAutoDoubles = i; break; } } else if (pp->ach[0] == 'G' && pp->ach[1] == 'S') /* GS - Game statistics */ RestoreGS(pp->pl, &pmr->g.sc); else if (pp->ach[0] == 'W' && pp->ach[1] == 'R') /* WR - White rank */ RestoreText(pp->pl->plNext->p, &mi.pchRating[0]); else if (pp->ach[0] == 'B' && pp->ach[1] == 'R') /* BR - Black rank */ RestoreText(pp->pl->plNext->p, &mi.pchRating[1]); else if (pp->ach[0] == 'D' && pp->ach[1] == 'T') { /* DT - Date */ int nYear, nMonth, nDay; if (pp->pl->plNext->p && sscanf(pp->pl->plNext->p, "%d-%d-%d", &nYear, &nMonth, &nDay) == 3) { mi.nYear = nYear; mi.nMonth = nMonth; mi.nDay = nDay; } } else if (pp->ach[0] == 'E' && pp->ach[1] == 'V') /* EV - Event */ RestoreText(pp->pl->plNext->p, &mi.pchEvent); else if (pp->ach[0] == 'R' && pp->ach[1] == 'O') /* RO - Round */ RestoreText(pp->pl->plNext->p, &mi.pchRound); else if (pp->ach[0] == 'P' && pp->ach[1] == 'C') /* PC - Place */ RestoreText(pp->pl->plNext->p, &mi.pchPlace); else if (pp->ach[0] == 'A' && pp->ach[1] == 'N') /* AN - Annotator */ RestoreText(pp->pl->plNext->p, &mi.pchAnnotator); else if (pp->ach[0] == 'G' && pp->ach[1] == 'C') /* GC - Game comment */ RestoreText(pp->pl->plNext->p, &mi.pchComment); AddMoveRecord(pmr); } static int Point(char ch, int f) { if (ch == 'y') return 24; /* bar */ else if (ch <= 'x' && ch >= 'a') return f ? 'x' - ch : ch - 'a'; else return -1; /* off */ } static void RestoreRolloutScore(move * pm, const char *sz) { char *pc = strstr(sz, "Score"); pm->rScore = -99999; pm->rScore2 = -99999; if (!pc) return; pc += 6; pm->rScore = (float)g_ascii_strtod(pc, &pc); pm->rScore2 = (float)g_ascii_strtod(pc, &pc); } static void RestoreRolloutTrials(unsigned int *piTrials, const char *sz) { char *pc = strstr(sz, "Trials"); *piTrials = 0; if (!pc) return; sscanf(pc, "Trials %ud", piTrials); } static void RestoreRolloutOutput(float ar[NUM_ROLLOUT_OUTPUTS], const char *sz, const char *szKeyword) { char *pc = strstr(sz, szKeyword); int i; for (i = 0; i < NUM_ROLLOUT_OUTPUTS; i++) ar[i] = 0.0; if (!pc) return; pc += strlen(szKeyword) + 1; for (i = 0; i < 7; i++) ar[i] = (float)g_ascii_strtod(pc, &pc); } static void InitEvalContext(evalcontext * pec) { pec->nPlies = 0; pec->fCubeful = FALSE; pec->fUsePrune = FALSE; pec->fDeterministic = FALSE; pec->rNoise = 0.0; } static void RestoreEvalContext(evalcontext * pec, char *pc) { int fUsePrune = 0; int red __attribute((unused)) = 0; int ver = CheckSGFVersion((const char **) &pc); InitEvalContext(pec); pec->nPlies = (unsigned int)strtol(pc, &pc, 10); if (*pc == 'C') { pec->fCubeful = TRUE; pc++; } if (ver < 3) { red = (int)strtol(pc, &pc, 10); pec->fDeterministic = (unsigned int)strtol(pc, &pc, 10); pec->rNoise = (float)g_ascii_strtod(pc, &pc); } else { pec->fDeterministic = (unsigned int)strtol(pc, &pc, 10); pec->rNoise = (float)g_ascii_strtod(pc, &pc); fUsePrune = (unsigned int)strtol(pc, &pc, 10); pec->fUsePrune = fUsePrune; } } static void RestoreRolloutContextEvalContext(evalcontext * pec, const char *sz, const char *szKeyword) { char *pc = strstr(sz, szKeyword); InitEvalContext(pec); if (!pc) return; pc = strchr(pc, ' '); if (!pc) return; RestoreEvalContext(pec, pc); } static void RestoreRolloutRolloutContext(rolloutcontext * prc, const char *sz) { char *pc = strstr(sz, "RC"); char szTemp[1024]; int fCubeful, fVarRedn, fInitial, fRotate, fTruncBearoff2, fTruncBearoffOS; fCubeful = FALSE; fVarRedn = FALSE; fInitial = FALSE; prc->nTruncate = 0; prc->nTrials = 0; prc->rngRollout = RNG_MERSENNE; prc->nSeed = 0; fRotate = TRUE; fTruncBearoff2 = FALSE; fTruncBearoffOS = FALSE; /* set usable, but ignored values for everything else */ prc->fLateEvals = 0; prc->fStopOnSTD = 0; prc->nLate = 0; prc->nMinimumGames = 144; prc->rStdLimit = 0.01; if (!pc) return; sscanf(pc, "RC %d %d %d %hu %u \"%[^\"]\" %lu %d %d %d", &fCubeful, &fVarRedn, &fInitial, &prc->nTruncate, &prc->nTrials, szTemp, &prc->nSeed, &fRotate, &fTruncBearoff2, &fTruncBearoffOS); prc->fCubeful = fCubeful; prc->fVarRedn = fVarRedn; prc->fRotate = fRotate; prc->fInitial = fInitial; prc->fTruncBearoff2 = fTruncBearoff2; prc->fTruncBearoffOS = fTruncBearoffOS; RestoreRolloutContextEvalContext(&prc->aecCube[0], sz, "cube0"); RestoreRolloutContextEvalContext(&prc->aecCube[1], sz, "cube1"); RestoreRolloutContextEvalContext(&prc->aecChequer[0], sz, "cheq0"); RestoreRolloutContextEvalContext(&prc->aecChequer[1], sz, "cheq1"); } static void RestoreRollout(move * pm, const char *sz) { unsigned int n; pm->esMove.et = EVAL_ROLLOUT; RestoreRolloutScore(pm, sz); RestoreRolloutTrials(&n, sz); RestoreRolloutOutput(pm->arEvalMove, sz, "Output"); RestoreRolloutOutput(pm->arEvalStdDev, sz, "StdDev"); RestoreRolloutRolloutContext(&pm->esMove.rc, sz); } static void RestoreCubeRolloutOutput(float arOutput[], float arStdDev[], const char *sz, const char *szKeyword) { char *pc = strstr(sz, szKeyword); memset(arOutput, 0, NUM_ROLLOUT_OUTPUTS * sizeof(float)); memset(arStdDev, 0, NUM_ROLLOUT_OUTPUTS * sizeof(float)); if (!pc) return; RestoreRolloutOutput(arOutput, pc, "Output"); RestoreRolloutOutput(arStdDev, pc, "StdDev"); } static void RestoreCubeRollout(const char *sz, float aarOutput[][NUM_ROLLOUT_OUTPUTS], float aarStdDev[][NUM_ROLLOUT_OUTPUTS], evalsetup * pes) { RestoreRolloutTrials(&pes->rc.nGamesDone, sz); RestoreCubeRolloutOutput(aarOutput[0], aarStdDev[0], sz, "NoDouble"); RestoreCubeRolloutOutput(aarOutput[1], aarStdDev[1], sz, "DoubleTake"); RestoreRolloutRolloutContext(&pes->rc, sz); } static void RestoreRolloutInternals(evalsetup * pes, const char *sz) { char *pc; if ((pc = strstr(sz, "SK")) != 0) sscanf(pc, "SK %d", &pes->rc.nSkip); } static int CheckSGFVersion(const char **sz) { int n; static int ver = 0; char *pch = strstr(*sz, "ver"); if ((pch == 0) || (sscanf(pch, "ver %d", &n) != 1)) return ver; ver = n; /* skip over version info */ pch += 4; while (*pch != ' ') { ++pch; } *sz = pch; return ver; } static void RestoreRolloutMoveFilter(const char *sz, char *name, movefilter mf[MAX_FILTER_PLIES][MAX_FILTER_PLIES], int nPlies) { char *pc = strstr(sz, name); int i; if (pc == 0) return; pc += strlen(name); for (i = 0; i < nPlies; ++i) { mf[nPlies - 1][i].Accept = (int)strtol(pc, &pc, 10); mf[nPlies - 1][i].Extra = (int)strtol(pc, &pc, 10); mf[nPlies - 1][i].Threshold = (float)g_ascii_strtod(pc, &pc); } } static void RestoreExtendedRolloutContext(rolloutcontext * prc, const char *sz) { char *pc = strstr(sz, "RC"); char szTemp[1024]; int fCubeful, fVarRedn, fInitial, fRotate, fTruncBearoff2, fTruncBearoffOS; int fLateEvals, fDoTruncate; int i; if (!pc) return; if (sscanf(pc, "RC %d %d %d %d %d %d %hu %d %d %hu \"%[^\"]\" %lu", &fCubeful, &fVarRedn, &fInitial, &fRotate, &fLateEvals, &fDoTruncate, &prc->nTruncate, &fTruncBearoff2, &fTruncBearoffOS, &prc->nLate, szTemp, &prc->nSeed) != 12) return; prc->fCubeful = fCubeful; prc->fVarRedn = fVarRedn; prc->fInitial = fInitial; prc->fRotate = fRotate; prc->fLateEvals = fLateEvals; prc->fDoTruncate = fDoTruncate; prc->fTruncBearoff2 = fTruncBearoff2; prc->fTruncBearoffOS = fTruncBearoffOS; prc->rngRollout = RNG_MERSENNE; prc->nMinimumGames = 144; prc->rStdLimit = 0.01; for (i = 0; i < 2; ++i) { sprintf(szTemp, "latecube%d ", i); RestoreRolloutContextEvalContext(&prc->aecCube[i], sz, szTemp + 4); RestoreRolloutContextEvalContext(&prc->aecCubeLate[i], sz, szTemp); sprintf(szTemp, "latecheq%d", i); RestoreRolloutContextEvalContext(&prc->aecChequer[i], sz, szTemp + 4); RestoreRolloutContextEvalContext(&prc->aecChequerLate[i], sz, szTemp); sprintf(szTemp, "latefilt%d ", i); if (prc->aecChequer[i].nPlies) { RestoreRolloutMoveFilter(sz, szTemp + 4, prc->aaamfChequer[i], prc->aecChequer[i].nPlies); } if (prc->aecChequerLate[i].nPlies) { RestoreRolloutMoveFilter(sz, szTemp, prc->aaamfLate[i], prc->aecChequerLate[i].nPlies); } } RestoreRolloutContextEvalContext(&prc->aecCubeTrunc, sz, "cubetrunc"); RestoreRolloutContextEvalContext(&prc->aecChequerTrunc, sz, "cheqtrunc"); } static void RestoreExtendedCubeRollout(const char *sz, float aarOutput[][NUM_ROLLOUT_OUTPUTS], float aarStdDev[][NUM_ROLLOUT_OUTPUTS], evalsetup * pes) { /* we assume new versions will still begin with Eq 4 floats * Trials int */ RestoreRolloutTrials(&pes->rc.nGamesDone, sz); RestoreCubeRolloutOutput(aarOutput[0], aarStdDev[0], sz, "NoDouble"); RestoreCubeRolloutOutput(aarOutput[1], aarStdDev[1], sz, "DoubleTake"); if (CheckSGFVersion(&sz)) { RestoreRolloutInternals(pes, sz); RestoreExtendedRolloutContext(&pes->rc, sz); } } static void RestoreExtendedRollout(move * pm, const char *sz) { evalsetup *pes = &pm->esMove; /* we assume new versions will still begin with Score 2 floats * Trials int */ pes->et = EVAL_ROLLOUT; RestoreRolloutScore(pm, sz); RestoreRolloutTrials(&pes->rc.nGamesDone, sz); RestoreRolloutOutput(pm->arEvalMove, sz, "Output"); RestoreRolloutOutput(pm->arEvalStdDev, sz, "StdDev"); if (CheckSGFVersion(&sz)) { RestoreRolloutInternals(pes, sz); RestoreExtendedRolloutContext(&pes->rc, sz); } } static void RestoreDoubleAnalysis(property * pp, float aarOutput[][NUM_ROLLOUT_OUTPUTS], float aarStdDev[][NUM_ROLLOUT_OUTPUTS], evalsetup * pes) { char *pch = pp->pl->plNext->p; int nReduced __attribute((unused)); int fUsePrune = 0; /* leftovers from earlier formats */ float arUnused[4] __attribute__ ((unused)); int ver; int i, j; switch (*pch) { case 'E': /* EVAL_EVAL */ ++pch; pes->et = EVAL_EVAL; ver = CheckSGFVersion((const char **) &pch); nReduced = 0; pes->ec.rNoise = 0.0f; memset(aarOutput[0], 0, NUM_ROLLOUT_OUTPUTS * sizeof(float)); memset(aarOutput[1], 0, NUM_ROLLOUT_OUTPUTS * sizeof(float)); aarOutput[0][OUTPUT_CUBEFUL_EQUITY] = -20000.0; aarOutput[1][OUTPUT_CUBEFUL_EQUITY] = -20000.0; if (ver < 2) { arUnused[0] = (float)g_ascii_strtod(pch, &pch); arUnused[1] = (float)g_ascii_strtod(pch, &pch); arUnused[2] = (float)g_ascii_strtod(pch, &pch); arUnused[3] = (float)g_ascii_strtod(pch, &pch); pes->ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pes->ec.fCubeful = TRUE; pch++; } nReduced = (int)strtol(pch, &pch, 10); pes->ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pes->ec.rNoise = (float)g_ascii_strtod(pch, &pch); } else if (ver == 2) { pes->ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pes->ec.fCubeful = TRUE; pch++; } nReduced = (int)strtol(pch, &pch, 10); pes->ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pes->ec.rNoise = (float)g_ascii_strtod(pch, &pch); fUsePrune = (int)strtol(pch, &pch, 10); } else { pes->ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pes->ec.fCubeful = TRUE; pch++; } pes->ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pes->ec.rNoise = (float)g_ascii_strtod(pch, &pch); fUsePrune = (int)strtol(pch, &pch, 10); } pes->ec.fUsePrune = fUsePrune; for (i = 0; i < 2; i++) for (j = 0; j < 7; j++) aarOutput[i][j] = (float)g_ascii_strtod(pch, &pch); break; case 'R': pes->et = EVAL_ROLLOUT; RestoreCubeRollout(pch + 1, aarOutput, aarStdDev, pes); break; case 'X': pes->et = EVAL_ROLLOUT; RestoreExtendedCubeRollout(pch + 1, aarOutput, aarStdDev, pes); break; default: break; } } static void RestoreMarkedMoves(property * pp, movelist * pml) { int val; char *pch = pp->pl->plNext->p; while ((val = (int)strtol(pch, &pch, 10))) { if (val > (int) pml->cMoves || val < 1) continue; pml->amMoves[val - 1].cmark = CMARK_ROLLOUT; } } static void RestoreMoveAnalysis(property * pp, int fPlayer, movelist * pml, unsigned int *piMove, evalsetup * pesChequer, const matchstate * pms) { listOLD *pl = pp->pl->plNext; const char *pc; char *pch; char ch; move *pm; int i; int fDeterministic __attribute((unused)); int nReduced __attribute((unused)); int fUsePrune = 0; TanBoard anBoardMove; int ver; *piMove = atoi(pl->p); for (pml->cMoves = 0, pl = pl->plNext; pl->p; pl = pl->plNext) pml->cMoves++; if (pml->cMoves == 0) { g_assert_not_reached(); return; } /* FIXME we could work these out, but it hardly seems worth it */ pml->cMaxMoves = pml->cMaxPips = pml->iMoveBest = 0; pml->rBestScore = 0; pm = pml->amMoves = calloc(pml->cMoves, sizeof(move)); pesChequer->et = EVAL_NONE; for (pl = pp->pl->plNext->plNext; pl->p; pl = pl->plNext, pm++) { pc = pl->p; /* FIXME we could work these out, but it hardly seems worth it */ pm->cMoves = pm->cPips = 0; pm->rScore2 = 0; for (i = 0; i < 4 && pc[0] && pc[1] && pc[0] != ' '; pc += 2, i++) { pm->anMove[i << 1] = Point(pc[0], fPlayer); pm->anMove[(i << 1) | 1] = Point(pc[1], fPlayer); } if (i < 4) pm->anMove[i << 1] = -1; /* restore auch */ memcpy(anBoardMove, pms->anBoard, sizeof(anBoardMove)); ApplyMove(anBoardMove, pm->anMove, FALSE); PositionKey((ConstTanBoard) anBoardMove, &pm->key); pch = (char *) pc; while (isspace(ch = *pch++)) { }; pch++; switch (ch) { case 'E': ver = CheckSGFVersion((const char **) &pch); /* EVAL_EVAL */ pm->esMove.et = EVAL_EVAL; nReduced = 0; fDeterministic = 0; for (i = 0; i < 5; i++) pm->arEvalMove[i] = (float)g_ascii_strtod(pch, &pch); pm->rScore = (float)g_ascii_strtod(pch, &pch); if (ver < 2) { pm->esMove.ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pm->esMove.ec.fCubeful = TRUE; pch++; } nReduced = (int)strtol(pch, &pch, 10); pm->esMove.ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pm->esMove.ec.rNoise = (float)g_ascii_strtod(pch, &pch); } else if (ver == 2) { pm->esMove.ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pm->esMove.ec.fCubeful = TRUE; pch++; } nReduced = (int)strtol(pch, &pch, 10); pm->esMove.ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pm->esMove.ec.rNoise = (float)g_ascii_strtod(pch, &pch); fUsePrune = (int)strtol(pch, &pch, 10); } else { pm->esMove.ec.nPlies = (unsigned int)strtol(pch, &pch, 10); if (*pch == 'C') { pm->esMove.ec.fCubeful = TRUE; pch++; } /* FIXME: reduced shouldn't be saved/loaded */ nReduced = (int)strtol(pch, &pch, 10); pm->esMove.ec.fDeterministic = (unsigned int)strtol(pch, &pch, 10); pm->esMove.ec.rNoise = (float)g_ascii_strtod(pch, &pch); fUsePrune = (int)strtol(pch, &pch, 10); } pm->esMove.ec.fUsePrune = fUsePrune; break; case 'R': RestoreRollout(pm, pch); break; case 'X': RestoreExtendedRollout(pm, pch); break; default: /* FIXME */ break; } /* save "largest" evalsetup */ if (cmp_evalsetup(pesChequer, &pm->esMove) < 0) memcpy(pesChequer, &pm->esMove, sizeof(evalsetup)); } } static void PointList(listOLD * pl, int an[]) { int i; char *pch, ch0, ch1; for (i = 0; i < 25; i++) an[i] = 0; for (; pl->p; pl = pl->plNext) { pch = pl->p; if (strchr(pch, ':')) { ch0 = ch1 = 0; sscanf(pch, "%c:%c", &ch0, &ch1); if (ch0 >= 'a' && ch1 <= 'y' && ch0 < ch1) for (i = ch0 - 'a'; i <= ch1 - 'a'; i++) an[i]++; } else if (*pch >= 'a' && *pch <= 'y') an[*pch - 'a']++; } } static void RestoreNode(listOLD * pl) { property *pp, *ppDA = NULL, *ppA = NULL, *ppC = NULL, *ppMR = NULL, *ppCR = NULL; moverecord *pmr = NULL; char *pch; int i, fPlayer = 0, fSetBoard = FALSE, an[25]; skilltype ast[2] = { SKILL_NONE, SKILL_NONE }; lucktype lt = LUCK_NONE; float rLuck = ERR_VAL; for (pl = pl->plNext; (pp = pl->p); pl = pl->plNext) { if (pp->ach[1] == 0 && (pp->ach[0] == 'B' || pp->ach[0] == 'W')) { /* B or W - Move property. */ if (pmr) /* Duplicate move -- ignore. */ continue; pch = pp->pl->plNext->p; fPlayer = pp->ach[0] == 'B'; if (!strcmp(pch, "double")) { pmr = NewMoveRecord(); pmr->mt = MOVE_DOUBLE; pmr->fPlayer = fPlayer; LinkToDouble(pmr); } else if (!strcmp(pch, "take")) { pmr = NewMoveRecord(); pmr->mt = MOVE_TAKE; pmr->fPlayer = fPlayer; LinkToDouble(pmr); } else if (!strcmp(pch, "drop")) { pmr = NewMoveRecord(); pmr->mt = MOVE_DROP; pmr->fPlayer = fPlayer; LinkToDouble(pmr); } else { pmr = NewMoveRecord(); pmr->mt = MOVE_NORMAL; pmr->fPlayer = fPlayer; pmr->anDice[1] = 0; for (i = 0; i < 2 && *pch; pch++, i++) pmr->anDice[i] = *pch - '0'; for (i = 0; i < 4 && pch[0] && pch[1]; pch += 2, i++) { pmr->n.anMove[i << 1] = Point(pch[0], pmr->fPlayer); pmr->n.anMove[(i << 1) | 1] = Point(pch[1], pmr->fPlayer); } if (i < 4) pmr->n.anMove[i << 1] = -1; if (pmr->anDice[0] < 1 || pmr->anDice[0] > 6 || pmr->anDice[1] < 1 || pmr->anDice[1] > 6) { /* illegal roll -- ignore */ free(pmr); pmr = NULL; } } } else if (pp->ach[0] == 'A' && pp->ach[1] == 'E') { fSetBoard = TRUE; PointList(pp->pl->plNext, an); for (i = 0; i < 25; i++) if (an[i]) { ms.anBoard[0][i == 24 ? i : 23 - i] = 0; ms.anBoard[1][i] = 0; } } else if (pp->ach[0] == 'A' && pp->ach[1] == 'B') { fSetBoard = TRUE; PointList(pp->pl->plNext, an); for (i = 0; i < 25; i++) ms.anBoard[0][i == 24 ? i : 23 - i] += an[i]; } else if (pp->ach[0] == 'A' && pp->ach[1] == 'W') { fSetBoard = TRUE; PointList(pp->pl->plNext, an); for (i = 0; i < 25; i++) ms.anBoard[1][i] += an[i]; } else if (pp->ach[0] == 'P' && pp->ach[1] == 'L') { int fTurnNew = *((char *) pp->pl->plNext->p) == 'B'; if (ms.fMove != fTurnNew) SwapSides(ms.anBoard); ms.fTurn = ms.fMove = fTurnNew; } else if (pp->ach[0] == 'C' && pp->ach[1] == 'V') { for (i = 1; i <= MAX_CUBE; i <<= 1) if (atoi(pp->pl->plNext->p) == i) { pmr = NewMoveRecord(); pmr->mt = MOVE_SETCUBEVAL; pmr->scv.nCube = i; AddMoveRecord(pmr); pmr = NULL; break; } } else if (pp->ach[0] == 'C' && pp->ach[1] == 'P') { pmr = NewMoveRecord(); pmr->mt = MOVE_SETCUBEPOS; switch (*((char *) pp->pl->plNext->p)) { case 'c': pmr->scp.fCubeOwner = -1; break; case 'b': pmr->scp.fCubeOwner = 1; break; case 'w': pmr->scp.fCubeOwner = 0; break; default: free(pmr); pmr = NULL; } if (pmr) { AddMoveRecord(pmr); pmr = NULL; } } else if (pp->ach[0] == 'D' && pp->ach[1] == 'I') { char ach[2]; sscanf(pp->pl->plNext->p, "%2c", ach); if (ach[0] >= '1' && ach[0] <= '6' && ach[1] >= '1' && ach[1] <= '6') { pmr = NewMoveRecord(); pmr->mt = MOVE_SETDICE; pmr->fPlayer = ms.fMove; pmr->anDice[0] = ach[0] - '0'; pmr->anDice[1] = ach[1] - '0'; } } else if (pp->ach[0] == 'D' && pp->ach[1] == 'A') /* double analysis */ ppDA = pp; else if (pp->ach[0] == 'A' && !pp->ach[1]) /* move analysis */ ppA = pp; else if (pp->ach[0] == 'M' && pp->ach[1] == 'R') /* marked moves */ ppMR = pp; else if (pp->ach[0] == 'C' && pp->ach[1] == 'R') /* marked moves */ ppCR = pp; else if (pp->ach[0] == 'C' && !pp->ach[1]) /* comment */ ppC = pp; else if (pp->ach[0] == 'B' && pp->ach[1] == 'M') ast[0] = *((char *) pp->pl->plNext->p) == '2' ? SKILL_VERYBAD : SKILL_BAD; else if (pp->ach[0] == 'D' && pp->ach[1] == 'O') ast[0] = SKILL_DOUBTFUL; else if (pp->ach[0] == 'B' && pp->ach[1] == 'C') ast[1] = *((char *) pp->pl->plNext->p) == '2' ? SKILL_VERYBAD : SKILL_BAD; else if (pp->ach[0] == 'D' && pp->ach[1] == 'C') ast[1] = SKILL_DOUBTFUL; else if (pp->ach[0] == 'L' && pp->ach[1] == 'U') rLuck = (float)g_ascii_strtod(pp->pl->plNext->p, NULL); else if (pp->ach[0] == 'G' && pp->ach[1] == 'B') /* good for black */ lt = *((char *) pp->pl->plNext->p) == '2' ? LUCK_VERYGOOD : LUCK_GOOD; else if (pp->ach[0] == 'G' && pp->ach[1] == 'W') /* good for white */ lt = *((char *) pp->pl->plNext->p) == '2' ? LUCK_VERYBAD : LUCK_BAD; } if (fSetBoard && !pmr) { pmr = NewMoveRecord(); pmr->mt = MOVE_SETBOARD; ClosestLegalPosition(ms.anBoard); PositionKey(msBoard(), &pmr->sb.key); } if (pmr && ppC) pmr->sz = CopyEscapedString(ppC->pl->plNext->p); if (pmr) { FixMatchState(&ms, pmr); switch (pmr->mt) { case MOVE_NORMAL: if (ppDA) RestoreDoubleAnalysis(ppDA, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble); if (ppCR) pmr->CubeDecPtr->cmark = CMARK_ROLLOUT; if (ppA) RestoreMoveAnalysis(ppA, pmr->fPlayer, &pmr->ml, &pmr->n.iMove, &pmr->esChequer, &ms); if (ppMR) RestoreMarkedMoves(ppMR, &pmr->ml); /* FIXME: separate st's */ pmr->n.stMove = ast[0]; pmr->stCube = ast[1]; pmr->lt = fPlayer ? lt : LUCK_VERYGOOD - lt; pmr->rLuck = rLuck; break; case MOVE_DOUBLE: case MOVE_TAKE: case MOVE_DROP: if (ppDA) RestoreDoubleAnalysis(ppDA, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble); if (ppCR) pmr->CubeDecPtr->cmark = CMARK_ROLLOUT; pmr->stCube = ast[0]; break; case MOVE_SETDICE: pmr->lt = lt; pmr->rLuck = rLuck; break; default: /* FIXME allow comments for all movetypes */ break; } AddMoveRecord(pmr); } } static void RestoreSequence(listOLD * pl, int fRoot) { pl = pl->plNext; if (fRoot) RestoreRootNode(pl->p); else RestoreNode(pl->p); while (pl = pl->plNext, pl->p) RestoreNode(pl->p); } static void RestoreTree(listOLD * pl, int fRoot) { pl = pl->plNext; RestoreSequence(pl->p, fRoot); pl = pl->plNext; if (pl->p) RestoreTree(pl->p, FALSE); /* FIXME restore other variations, once we can handle them */ } static void RestoreGame(listOLD * pl) { moverecord *pmr, *pmrResign; InitBoard(ms.anBoard, ms.bgv); /* FIXME should anything be done with the current game? */ ClearMoveRecord(); ListInsert(&lMatch, plGame); ms.anDice[0] = ms.anDice[1] = 0; ms.fResigned = ms.fDoubled = FALSE; ms.nCube = 1; ms.fTurn = ms.fMove = ms.fCubeOwner = -1; ms.gs = GAME_NONE; RestoreTree(pl, TRUE); pmr = plGame->plNext->p; g_assert(pmr->mt == MOVE_GAMEINFO); AddGame(pmr); if (pmr->g.fResigned) { /* setting fTurn = fMove = -1 results in the board being * inverted when shown. /jth 2003-10-12 * ms.fTurn = ms.fMove = -1; */ pmrResign = NewMoveRecord(); pmrResign->mt = MOVE_RESIGN; pmrResign->fPlayer = !pmr->g.fWinner; pmrResign->r.nResigned = pmr->g.nPoints / ms.nCube; if (pmrResign->r.nResigned < 1) pmrResign->r.nResigned = 1; else if (pmrResign->r.nResigned > 3) pmrResign->r.nResigned = 3; AddMoveRecord(pmrResign); } } extern void CommandLoadGame(char *sz) { listOLD *pl; sz = NextToken(&sz); if (!sz || !*sz) { outputl(_("You must specify a file to load from (see `help load " "game').")); return; } if ((pl = LoadCollection(sz))) { if (!get_input_discard()) return; #if USE_GTK if (fX) { /* Clear record to avoid ugly updates */ GTKClearMoveRecord(); GTKFreeze(); } #endif FreeMatch(); ClearMatch(); /* FIXME if pl contains multiple games, ask which one to load */ RestoreGame(pl->plNext->p); FreeGameTreeSeq(pl); UpdateSettings(); #if USE_GTK if (fX) { GTKThaw(); GTKSet(ap); } setDefaultFileName(sz); #endif /* FIXME : don't do this if we just loaded a single position */ if (fGotoFirstGame) CommandFirstGame(NULL); } } extern void CommandLoadPosition(char *sz) { listOLD *pl; sz = NextToken(&sz); if (!sz || !*sz) { outputl(_("You must specify a file to load from (see `help load " "position').")); return; } if ((pl = LoadCollection(sz))) { if (!get_input_discard()) return; #if USE_GTK if (fX) { /* Clear record to avoid ugly updates */ GTKClearMoveRecord(); GTKFreeze(); } #endif FreeMatch(); ClearMatch(); /* FIXME if pl contains multiple games, ask which one to load */ RestoreGame(pl->plNext->p); FreeGameTreeSeq(pl); UpdateSettings(); #if USE_GTK if (fX) { GTKThaw(); GTKSet(ap); } setDefaultFileName(sz); #endif } } extern void CommandLoadMatch(char *sz) { listOLD *pl; sz = NextToken(&sz); if (!sz || !*sz) { outputl(_("You must specify a file to load from (see `help load " "match').")); return; } if ((pl = LoadCollection(sz))) { /* FIXME make sure the root nodes have MI properties; if not, * we're loading a session. */ if (!get_input_discard()) return; #if USE_GTK if (fX) { /* Clear record to avoid ugly updates */ GTKClearMoveRecord(); GTKFreeze(); } #endif FreeMatch(); ClearMatch(); for (pl = pl->plNext; pl->p; pl = pl->plNext) { RestoreGame(pl->p); } FreeGameTreeSeq(pl); UpdateSettings(); #if USE_GTK if (fX) { GTKThaw(); GTKSet(ap); } #endif setDefaultFileName(sz); /* FIXME : don't do this if we just loaded a single position */ if (fGotoFirstGame) CommandFirstGame(NULL); } } static void WriteEscapedString(FILE * pf, char *pch, int fEscapeColons) { char *sz, *pc; sz = (char *) malloc(2 * strlen(pch) + 1); for (pc = sz; *pch; pch++) switch (*pch) { case '\\': *pc++ = '\\'; *pc++ = '\\'; break; case ':': if (fEscapeColons) *pc++ = '\\'; *pc++ = ':'; break; case ']': *pc++ = '\\'; *pc++ = ']'; break; default: *pc++ = *pch; break; } *pc++ = 0; fputs(sz, pf); free(sz); } static void WriteEvalContext(FILE * pf, const evalcontext * pec) { gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pec->rNoise); fprintf(pf, "ver %d %d%s %d %s %d", SGF_FORMAT_VER, pec->nPlies, pec->fCubeful ? "C" : "", pec->fDeterministic, buffer, pec->fUsePrune); } static void WriteMoveFilters(FILE * pf, movefilter mf[MAX_FILTER_PLIES][MAX_FILTER_PLIES], int nPlies) { int i; gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; for (i = 0; i < nPlies; ++i) { g_ascii_formatd(buffer, sizeof(buffer), "%.5f", mf[nPlies - 1][i].Threshold); fprintf(pf, "%d %d %s ", mf[nPlies - 1][i].Accept, mf[nPlies - 1][i].Extra, buffer); } } static void WriteRolloutContext(FILE * pf, const rolloutcontext * prc) { int i; fprintf(pf, "RC %d %d %d %d %d %d %d %d %d %d \"%s\" %lu ", prc->fCubeful, prc->fVarRedn, prc->fInitial, prc->fRotate, prc->fLateEvals, prc->fDoTruncate, prc->nTruncate, prc->fTruncBearoff2, prc->fTruncBearoffOS, prc->nLate, aszRNG[prc->rngRollout], prc->nSeed); for (i = 0; i < 2; i++) { fprintf(pf, " cube%d ", i); WriteEvalContext(pf, &prc->aecCube[i]); fputc(' ', pf); fprintf(pf, " cheq%d ", i); WriteEvalContext(pf, &prc->aecChequer[i]); if (prc->aecChequer[i].nPlies) { fprintf(pf, " filt%d ", i); WriteMoveFilters(pf, (movefilter(*)[4]) prc->aaamfChequer[i], prc->aecChequer[i].nPlies); } } for (i = 0; i < 2; i++) { fprintf(pf, " latecube%d ", i); WriteEvalContext(pf, &prc->aecCubeLate[i]); fputc(' ', pf); fprintf(pf, " latecheq%d ", i); WriteEvalContext(pf, &prc->aecChequerLate[i]); if (prc->aecChequerLate[i].nPlies) { fprintf(pf, " latefilt%d ", i); WriteMoveFilters(pf, (movefilter(*)[4]) prc->aaamfLate[i], prc->aecChequerLate[i].nPlies); } } fprintf(pf, " cubetrunc "); WriteEvalContext(pf, &prc->aecCubeTrunc); fprintf(pf, " cheqtrunc "); WriteEvalContext(pf, &prc->aecChequerTrunc); } static void WriteRolloutAnalysis(FILE * pf, int fIsMove, float rScore, float rScore2, float aarOutput0[NUM_ROLLOUT_OUTPUTS], float aarOutput1[NUM_ROLLOUT_OUTPUTS], float aarStdDev0[NUM_ROLLOUT_OUTPUTS], float aarStdDev1[NUM_ROLLOUT_OUTPUTS], evalsetup * pes) { int i; gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; /* identify what version we're writing to avoid future problems * the version is defined in eval.h */ if (fIsMove) { fprintf(pf, "X ver %d Score ", SGF_FORMAT_VER); g_ascii_formatd(buffer, sizeof(buffer), "%.10g", rScore); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.10g", rScore2); fprintf(pf, "%s ", buffer); } else { fprintf(pf, "X ver %d Eq ", SGF_FORMAT_VER); } fprintf(pf, "Trials %d ", pes->rc.nGamesDone); if (!fIsMove) fprintf(pf, "NoDouble "); fprintf(pf, "Output "); for (i = 0; i < 7; ++i) { g_ascii_formatd(buffer, sizeof(buffer), "%.10g", aarOutput0[i]); fprintf(pf, "%s ", buffer); } fprintf(pf, "StdDev "); for (i = 0; i < 7; ++i) { g_ascii_formatd(buffer, sizeof(buffer), "%.10g", aarStdDev0[i]); fprintf(pf, "%s ", buffer); } if (!fIsMove) { fprintf(pf, "DoubleTake Output "); for (i = 0; i < 7; ++i) { g_ascii_formatd(buffer, sizeof(buffer), "%.10g", aarOutput1[i]); fprintf(pf, "%s ", buffer); } fprintf(pf, "StdDev "); for (i = 0; i < 7; ++i) { g_ascii_formatd(buffer, sizeof(buffer), "%.10g", aarStdDev1[i]); fprintf(pf, "%s ", buffer); } } fprintf(pf, "SK %d ", pes->rc.nSkip); WriteRolloutContext(pf, &pes->rc); } static void WriteDoubleAnalysis(FILE * pf, float aarOutput[][NUM_ROLLOUT_OUTPUTS], float aarStdDev[][NUM_ROLLOUT_OUTPUTS], evalsetup * pes, int cmark) { gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; int i, j; /* FIXME: removing write of 0 0 0 0 will break existing SGF files */ fputs("DA[", pf); switch (pes->et) { case EVAL_EVAL: g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pes->ec.rNoise); fprintf(pf, "E ver %d %d%s %d %s %d", SGF_FORMAT_VER, pes->ec.nPlies, pes->ec.fCubeful ? "C" : "", pes->ec.fDeterministic, buffer, pes->ec.fUsePrune); for (i = 0; i < 2; i++) { for (j = 0; j < 7; j++) { g_ascii_formatd(buffer, sizeof(buffer), "%.6f", aarOutput[i][j]); fprintf(pf, " %s", buffer); } } break; case EVAL_ROLLOUT: WriteRolloutAnalysis(pf, 0, 0.0f, 0.0f, aarOutput[0], aarOutput[1], aarStdDev[0], aarStdDev[1], pes); break; default: g_assert_not_reached(); } fputc(']', pf); if (cmark) fputs("CR[]", pf); } static void WriteMove(FILE * pf, int fPlayer, int anMove[]) { int i; for (i = 0; i < 8; i++) switch (anMove[i]) { case 24: /* bar */ putc('y', pf); break; case -1: /* off */ if (!(i & 1)) return; putc('z', pf); break; default: putc(fPlayer ? 'x' - anMove[i] : 'a' + anMove[i], pf); } } static void WriteMoveAnalysis(FILE * pf, int fPlayer, movelist * pml, unsigned int iMove) { unsigned int i; gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; fprintf(pf, "A[%u]", iMove); for (i = 0; i < pml->cMoves; i++) { fputc('[', pf); WriteMove(pf, fPlayer, pml->amMoves[i].anMove); fputc(' ', pf); switch (pml->amMoves[i].esMove.et) { case EVAL_NONE: break; case EVAL_EVAL: g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].arEvalMove[0]); fprintf(pf, "E ver %d %s ", SGF_FORMAT_VER, buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].arEvalMove[1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].arEvalMove[2]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].arEvalMove[3]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].arEvalMove[4]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].rScore); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", pml->amMoves[i].esMove.ec.rNoise); fprintf(pf, "%d%s %d %d %s %d", pml->amMoves[i].esMove.ec.nPlies, pml->amMoves[i].esMove.ec.fCubeful ? "C" : "", 0, pml->amMoves[i].esMove.ec.fDeterministic, buffer, pml->amMoves[i].esMove.ec.fUsePrune); break; case EVAL_ROLLOUT: WriteRolloutAnalysis(pf, 1, pml->amMoves[i].rScore, pml->amMoves[i].rScore2, pml->amMoves[i].arEvalMove, 0, pml->amMoves[i].arEvalStdDev, 0, &pml->amMoves[i].esMove); break; default: g_assert_not_reached(); } fputc(']', pf); } fprintf(pf, "MR["); for (i = 0; i < pml->cMoves; i++) { if (pml->amMoves[i].cmark) fprintf(pf, "%d ", i + 1); } fputc(']', pf); } static void WriteLuck(FILE * pf, int fPlayer, float rLuck, lucktype lt) { gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; if (rLuck != ERR_VAL) { g_ascii_formatd(buffer, sizeof(buffer), "%.5f", rLuck); fprintf(pf, "LU[%s]", buffer); } switch (lt) { case LUCK_VERYBAD: fprintf(pf, "G%c[2]", fPlayer ? 'W' : 'B'); break; case LUCK_BAD: fprintf(pf, "G%c[1]", fPlayer ? 'W' : 'B'); break; case LUCK_NONE: break; case LUCK_GOOD: fprintf(pf, "G%c[1]", fPlayer ? 'B' : 'W'); break; case LUCK_VERYGOOD: fprintf(pf, "G%c[2]", fPlayer ? 'B' : 'W'); break; } } static void WriteSkill(FILE * pf, const skilltype st) { switch (st) { case SKILL_VERYBAD: fputs("BM[2]", pf); break; case SKILL_BAD: fputs("BM[1]", pf); break; case SKILL_DOUBTFUL: fputs("DO[]", pf); break; default: break; } } static void WriteSkillCube(FILE * pf, const skilltype st) { switch (st) { case SKILL_VERYBAD: fputs("BC[2]", pf); break; case SKILL_BAD: fputs("BC[1]", pf); break; case SKILL_DOUBTFUL: fputs("DC[]", pf); break; default: break; } } static void WriteStatContext(FILE * pf, statcontext * psc) { lucktype lt; skilltype st; gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; fputs("GS", pf); if (psc->fMoves) { fprintf(pf, "[M:%d %d %d %d ", psc->anUnforcedMoves[0], psc->anUnforcedMoves[1], psc->anTotalMoves[0], psc->anTotalMoves[1]); for (st = SKILL_VERYBAD; st <= SKILL_NONE; st++) fprintf(pf, "%d %d ", psc->anMoves[0][st], psc->anMoves[1][st]); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorCheckerplay[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorCheckerplay[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorCheckerplay[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorCheckerplay[1][1]); fprintf(pf, "%s]", buffer); } if (psc->fCube) { fprintf(pf, "[C:%d %d %d %d %d %d %d %d ", psc->anTotalCube[0], psc->anTotalCube[1], psc->anDouble[0], psc->anDouble[1], psc->anTake[0], psc->anTake[1], psc->anPass[0], psc->anPass[1]); fprintf(pf, "%d %d %d %d %d %d %d %d %d %d %d %d ", psc->anCubeMissedDoubleDP[0], psc->anCubeMissedDoubleDP[1], psc->anCubeMissedDoubleTG[0], psc->anCubeMissedDoubleTG[1], psc->anCubeWrongDoubleDP[0], psc->anCubeWrongDoubleDP[1], psc->anCubeWrongDoubleTG[0], psc->anCubeWrongDoubleTG[1], psc->anCubeWrongTake[0], psc->anCubeWrongTake[1], psc->anCubeWrongPass[0], psc->anCubeWrongPass[1]); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleDP[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleDP[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleTG[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleTG[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleDP[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleDP[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleTG[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleTG[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongTake[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongTake[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongPass[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongPass[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleDP[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleDP[1][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleTG[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorMissedDoubleTG[1][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleDP[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleDP[1][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleTG[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongDoubleTG[1][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongTake[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongTake[1][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongPass[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arErrorWrongPass[1][1]); fprintf(pf, "%s]", buffer); } if (psc->fDice) { fputs("[D:", pf); for (lt = LUCK_VERYBAD; lt <= LUCK_VERYGOOD; lt++) fprintf(pf, "%d %d ", psc->anLuck[0][lt], psc->anLuck[1][lt]); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arLuck[0][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arLuck[0][1]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arLuck[1][0]); fprintf(pf, "%s ", buffer); g_ascii_formatd(buffer, sizeof(buffer), "%.6f", psc->arLuck[1][1]); fprintf(pf, "%s]", buffer); } } static void WriteProperty(FILE * pf, const char *szName, char *szValue) { if (!szValue || !*szValue) return; fputs(szName, pf); putc('[', pf); WriteEscapedString(pf, szValue, FALSE); putc(']', pf); } static void AddRule(FILE * pf, const char *sz, int *pfFirst) { fprintf(pf, "%s%s", (*pfFirst) ? "" : ":", sz); *pfFirst = FALSE; } extern void SaveGame(FILE * pf, listOLD * plGame) { listOLD *pl; moverecord *pmr; unsigned int i, j; TanBoard anBoard; listOLD *pl_hint = NULL; int fMoveNormalSeen; updateStatisticsGame(plGame); pl = plGame->plNext; pmr = pl->p; g_assert(pmr->mt == MOVE_GAMEINFO); /* Fixed header */ fputs("(;FF[4]GM[6]CA[UTF-8]AP[GNU Backgammon:" VERSION "]", pf); /* Match length, if appropriate */ /* FIXME: isn't it always appropriate to write this? */ /* If not, money games will be loaded without score and game number */ /* if( pmr->g.nMatch ) */ fprintf(pf, "MI[length:%d][game:%d][ws:%d][bs:%d]", pmr->g.nMatch, pmr->g.i, pmr->g.anScore[0], pmr->g.anScore[1]); /* Names */ fputs("PW[", pf); WriteEscapedString(pf, ap[0].szName, FALSE); fputs("]PB[", pf); WriteEscapedString(pf, ap[1].szName, FALSE); putc(']', pf); if (!pmr->g.i) { char szDate[32]; WriteProperty(pf, "WR", mi.pchRating[0]); WriteProperty(pf, "BR", mi.pchRating[1]); if (mi.nYear) { sprintf(szDate, "%04d-%02d-%02d", mi.nYear, mi.nMonth, mi.nDay); WriteProperty(pf, "DT", szDate); } WriteProperty(pf, "EV", mi.pchEvent); WriteProperty(pf, "RO", mi.pchRound); WriteProperty(pf, "PC", mi.pchPlace); WriteProperty(pf, "AN", mi.pchAnnotator); WriteProperty(pf, "GC", mi.pchComment); } if (pmr->g.fCrawford || pmr->g.fJacoby || pmr->g.bgv != VARIATION_STANDARD || !pmr->g.fCubeUse) { static const char *aszSGFVariation[NUM_VARIATIONS] = { NULL, "Nackgammon", "Hypergammon1", "Hypergammon2", "Hypergammon3" }; int fFirst = TRUE; fputs("RU[", pf); if (!pmr->g.fCubeUse) AddRule(pf, "NoCube", &fFirst); if (pmr->g.fCrawford) AddRule(pf, "Crawford", &fFirst); if (pmr->g.fCrawfordGame) AddRule(pf, "CrawfordGame", &fFirst); if (pmr->g.fJacoby) AddRule(pf, "Jacoby", &fFirst); if (pmr->g.bgv != VARIATION_STANDARD) AddRule(pf, aszSGFVariation[pmr->g.bgv], &fFirst); fputs("]", pf); } if (pmr->g.nAutoDoubles) fprintf(pf, "CV[%d]", 1 << pmr->g.nAutoDoubles); if (pmr->g.fWinner >= 0) fprintf(pf, "RE[%c+%d%s]", pmr->g.fWinner ? 'B' : 'W', pmr->g.nPoints, pmr->g.fResigned ? "R" : ""); if (pmr->g.sc.fMoves || pmr->g.sc.fCube || pmr->g.sc.fDice) WriteStatContext(pf, &pmr->g.sc); if (game_is_last(plGame)) pl_hint = game_add_pmr_hint(plGame); fMoveNormalSeen = FALSE; for (pl = pl->plNext; pl != plGame; pl = pl->plNext) { pmr = pl->p; switch (pmr->mt) { case MOVE_NORMAL: fMoveNormalSeen = TRUE; /* sanitise the move if from a hint record */ if (pmr->ml.cMoves && pmr->n.iMove > pmr->ml.cMoves) { memcpy(pmr->n.anMove, pmr->ml.amMoves[0].anMove, sizeof(pmr->n.anMove)); pmr->n.iMove = 0; } fprintf(pf, "\n;%c[%d%d", pmr->fPlayer ? 'B' : 'W', pmr->anDice[0], pmr->anDice[1]); WriteMove(pf, pmr->fPlayer, pmr->n.anMove); putc(']', pf); if (pmr->CubeDecPtr->esDouble.et != EVAL_NONE) WriteDoubleAnalysis(pf, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble, pmr->CubeDecPtr->cmark); if (pmr->ml.cMoves) WriteMoveAnalysis(pf, pmr->fPlayer, &pmr->ml, pmr->n.iMove); WriteLuck(pf, pmr->fPlayer, pmr->rLuck, pmr->lt); /* FIXME: separate skill for cube and move */ WriteSkill(pf, pmr->n.stMove); WriteSkillCube(pf, pmr->stCube); break; case MOVE_DOUBLE: /* Last record cannot usually be a legitimate double, it * is a placeholder for hint data for a possible double by * the player on roll. Skip it. See discussion of bug #36716. */ if (pl->plNext == plGame && /* Exception. In a scenario like: copy id from position * with dice not rolled yet / paste it into gnubg / hint * / save, it is reasonable to assume that the user is * interested in the doubling decision analysis. There * was no explicit double action but save the * MOVE_DOUBLE record anyway. */ !(fMoveNormalSeen == FALSE && pmr->CubeDecPtr->esDouble.et != EVAL_NONE)) break; fprintf(pf, "\n;%c[double]", pmr->fPlayer ? 'B' : 'W'); if (pmr->CubeDecPtr->esDouble.et != EVAL_NONE) WriteDoubleAnalysis(pf, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble, pmr->CubeDecPtr->cmark); WriteSkill(pf, pmr->stCube); break; case MOVE_TAKE: fprintf(pf, "\n;%c[take]", pmr->fPlayer ? 'B' : 'W'); if (pmr->CubeDecPtr->esDouble.et != EVAL_NONE) WriteDoubleAnalysis(pf, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble, pmr->CubeDecPtr->cmark); WriteSkill(pf, pmr->stCube); break; case MOVE_DROP: fprintf(pf, "\n;%c[drop]", pmr->fPlayer ? 'B' : 'W'); if (pmr->CubeDecPtr->esDouble.et != EVAL_NONE) WriteDoubleAnalysis(pf, pmr->CubeDecPtr->aarOutput, pmr->CubeDecPtr->aarStdDev, &pmr->CubeDecPtr->esDouble, pmr->CubeDecPtr->cmark); WriteSkill(pf, pmr->stCube); break; case MOVE_RESIGN: break; case MOVE_SETBOARD: PositionFromKey(anBoard, &pmr->sb.key); /* Insert a PL record. This will set the right player on * roll when loading a before-diceroll position (instead * of always player 0, which is usually wrong) and is * transparent in the other cases. */ fprintf(pf, "\n;PL[%c]", pmr->fPlayer ? 'B' : 'W'); fputs("AE[a:y]", pf); for (i = 0, j = 0; i < 25; ++i) j += anBoard[1][i]; if (j) { fputs("AW", pf); for (i = 0; i < 25; i++) for (j = 0; j < anBoard[1][i]; j++) fprintf(pf, "[%c]", 'a' + i); } for (i = 0, j = 0; i < 25; ++i) j += anBoard[0][i]; if (j) { fputs("AB", pf); for (i = 0; i < 25; i++) for (j = 0; j < anBoard[0][i]; j++) fprintf(pf, "[%c]", i == 24 ? 'y' : 'x' - i); } break; case MOVE_SETDICE: fprintf(pf, "\n;PL[%c]DI[%d%d]", pmr->fPlayer ? 'B' : 'W', pmr->anDice[0], pmr->anDice[1]); WriteLuck(pf, pmr->fPlayer, pmr->rLuck, pmr->lt); break; case MOVE_SETCUBEVAL: fprintf(pf, "\n;CV[%d]", pmr->scv.nCube); break; case MOVE_SETCUBEPOS: fprintf(pf, "\n;CP[%c]", "cwb"[pmr->scp.fCubeOwner + 1]); break; default: g_assert_not_reached(); } if (pmr->sz) { fputs("C[", pf); WriteEscapedString(pf, pmr->sz, FALSE); putc(']', pf); } } if (pl_hint) game_remove_pmr_hint(pl_hint); /* FIXME if the game is not over and the player on roll is the last * player to move, add a PL property */ fputs(")\n", pf); } extern void CommandSaveGame(char *sz) { FILE *pf; sz = NextToken(&sz); if (!plGame) { outputl(_("No game in progress (type `new game' to start one).")); return; } if (!sz || !*sz) { outputl(_("You must specify a file to save to (see `help save " "game').")); return; } if (!confirmOverwrite(sz, fConfirmSave)) return; if (!strcmp(sz, "-")) pf = stdout; else if (!(pf = g_fopen(sz, "w"))) { outputerr(sz); return; } SaveGame(pf, plGame); if (pf != stdout) fclose(pf); setDefaultFileName(sz); } extern void CommandSaveMatch(char *sz) { FILE *pf; listOLD *pl; sz = NextToken(&sz); if (!plGame) { outputl(_("No game in progress (type `new game' to start one).")); return; } /* FIXME what should be done if nMatchTo == 0? */ if (!sz || !*sz) { outputl(_("You must specify a file to save to (see `help save " "match').")); return; } if (!confirmOverwrite(sz, fConfirmSave)) return; if (!strcmp(sz, "-")) pf = stdout; else if (!(pf = g_fopen(sz, "w"))) { outputerr(sz); return; } for (pl = lMatch.plNext; pl != &lMatch; pl = pl->plNext) SaveGame(pf, pl->p); if (pf != stdout) fclose(pf); setDefaultFileName(sz); delete_autosave(); } extern void CommandSavePosition(char *sz) { FILE *pf; listOLD l; moverecord *pmgi; moverecord *pmsb; moverecord *pmsd = NULL; moverecord *pmr_cur = NULL; moverecord *pmscv; moverecord *pmscp; sz = NextToken(&sz); if (!plGame) { outputl(_("No game in progress (type `new game' to start one).")); return; } if (!sz || !*sz) { outputl(_("You must specify a file to save to (see `help save " "position').")); return; } if (!confirmOverwrite(sz, fConfirmSave)) return; if (!strcmp(sz, "-")) pf = stdout; else if (!(pf = g_fopen(sz, "w"))) { outputerr(sz); return; } ListCreate(&l); /* gameinfo record */ pmgi = NewMoveRecord(); pmgi->mt = MOVE_GAMEINFO; pmgi->sz = NULL; pmgi->g.i = 0; pmgi->g.nMatch = ms.nMatchTo; pmgi->g.anScore[0] = ms.anScore[0]; pmgi->g.anScore[1] = ms.anScore[1]; pmgi->g.fCrawford = fAutoCrawford && ms.nMatchTo > 1; pmgi->g.fCrawfordGame = ms.fCrawford; pmgi->g.fJacoby = ms.fJacoby && !ms.nMatchTo; pmgi->g.fWinner = -1; pmgi->g.nPoints = 0; pmgi->g.fResigned = FALSE; pmgi->g.nAutoDoubles = 0; pmgi->g.bgv = ms.bgv; pmgi->g.fCubeUse = ms.fCubeUse; IniStatcontext(&pmgi->g.sc); ListInsert(&l, pmgi); /* setboard record */ pmsb = NewMoveRecord(); pmsb->mt = MOVE_SETBOARD; pmsb->fPlayer = ms.fMove; if (ms.fMove) SwapSides(ms.anBoard); PositionKey(msBoard(), &pmsb->sb.key); if (ms.fMove) SwapSides(ms.anBoard); ListInsert(&l, pmsb); /* set cube value */ pmscv = NewMoveRecord(); pmscv->mt = MOVE_SETCUBEVAL; pmscv->scv.nCube = ms.nCube; ListInsert(&l, pmscv); /* cube position */ pmscp = NewMoveRecord(); pmscp->mt = MOVE_SETCUBEPOS; pmscp->scp.fCubeOwner = ms.fCubeOwner; ListInsert(&l, pmscp); /* set dice */ /* FIXME if the dice are not rolled, this should be done with a PL * property (which is SaveGame()'s job) */ pmr_cur = get_current_moverecord(NULL); if (pmr_cur && (pmr_cur->ml.cMoves > 0 || pmr_cur->CubeDecPtr->esDouble.et != EVAL_NONE)) ListInsert(&l, pmr_cur); else if (ms.anDice[0] > 0) { pmsd = NewMoveRecord(); pmsd->mt = MOVE_SETDICE; pmsd->fPlayer = ms.fMove; pmsd->anDice[0] = ms.anDice[0]; pmsd->anDice[1] = ms.anDice[1]; pmsd->lt = LUCK_NONE; pmsd->rLuck = ERR_VAL; ListInsert(&l, pmsd); } /* FIXME add MOVE_DOUBLE record(s) as appropriate */ SaveGame(pf, &l); if (pf != stdout) fclose(pf); while (l.plNext->p) ListDelete(l.plNext); free(pmgi); free(pmsb); free(pmsd); free(pmscv); free(pmscp); setDefaultFileName(sz); } gnubg-1.02.000/aclocal.m40000644000000000000000000012477312175510051011576 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes ], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])[]dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_PREREQ(2.50)dnl AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_PROG_CC_C_O # -------------- # Like AC_PROG_CC_C_O, but changed for automake. AC_DEFUN([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC_C_O])dnl AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o if test "$am_t" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi dnl Make sure AC_PROG_CC is never called again, or it will override our dnl setting of CC. m4_define([AC_PROG_CC], [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_ext.m4]) m4_include([m4/ax_gcc_x86_avx_xgetbv.m4]) m4_include([m4/ax_gcc_x86_cpuid.m4]) m4_include([m4/az_python.m4]) m4_include([m4/glib-gettext.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/versioncompare.m4]) gnubg-1.02.000/timer.c0000644000000000000000000000330212157217765011222 00000000000000/* * timer.c * by Jon Kinsey, 2003 * * Accurate win32 timer or default timer * * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: timer.c,v 1.17 2013/06/16 02:16:21 mdpetch Exp $ */ #include "config.h" #include #include #if HAVE_SYS_TIME_H #include #endif #ifdef WIN32 #include "windows.h" static double perFreq = 0; static int setup_timer() { LARGE_INTEGER freq; if (!QueryPerformanceFrequency(&freq)) { /* Timer not supported */ return 0; } else { perFreq = ((double) freq.QuadPart) / 1000; return 1; } } double get_time() { /* Return elapsed time in milliseconds */ LARGE_INTEGER timer; if (!perFreq) { if (!setup_timer()) return clock() / 1000.0; } QueryPerformanceCounter(&timer); return timer.QuadPart / perFreq; } #else extern double get_time(void) { /* Return elapsed time in milliseconds */ struct timeval tv; gettimeofday(&tv, 0); return 1000.0 * tv.tv_sec + 0.001 * tv.tv_usec; } #endif gnubg-1.02.000/gtkmet.c0000644000000000000000000001660112157217757011404 00000000000000/* * gtkmet.c * * by Joern Thyssen , 2002 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkmet.c,v 1.29 2013/06/16 02:16:15 mdpetch Exp $ */ #include "config.h" #include "gtkgame.h" #include "matchequity.h" #include "gtkmet.h" #include "gtkwindows.h" typedef struct _mettable { GtkWidget *pwTable; GtkWidget *pwName; GtkWidget *pwFileName; GtkWidget *pwDescription; GtkWidget *aapwLabel[MAXSCORE][MAXSCORE]; } mettable; typedef struct _metwidget { GtkWidget *apwPostCrawford[2]; GtkWidget *pwPreCrawford; unsigned int nMatchTo; unsigned int anAway[2]; } metwidget; static void UpdateTable(const mettable * pmt, /*lint -e{818} */ float met[MAXSCORE][MAXSCORE], const metinfo * pmi, const unsigned int nRows, const unsigned int nCols, const int fInvert) { unsigned int i, j; char sz[9]; /* set labels */ gtk_label_set_text(GTK_LABEL(pmt->pwName), (char *) pmi->szName); gtk_label_set_text(GTK_LABEL(pmt->pwFileName), (char *) pmi->szFileName); gtk_label_set_text(GTK_LABEL(pmt->pwDescription), (char *) pmi->szDescription); /* fill out table */ for (i = 0; i < nRows; i++) for (j = 0; j < nCols; j++) { g_assert(met[i][j] >= 0.0f && met[i][j] <= 1.0f); if (fInvert) sprintf(sz, "%8.4f", met[j][i] * 100.0f); else sprintf(sz, "%8.4f", met[i][j] * 100.0f); gtk_label_set_text(GTK_LABEL(pmt->aapwLabel[i][j]), sz); } } static void UpdateAllTables(const metwidget * pmw) { const mettable *pmt; int i; pmt = (const mettable *) g_object_get_data(G_OBJECT(pmw->pwPreCrawford), "mettable"); UpdateTable(pmt, aafMET, &miCurrent, pmw->nMatchTo, pmw->nMatchTo, FALSE); for (i = 0; i < 2; ++i) { pmt = (const mettable *) g_object_get_data(G_OBJECT(pmw->apwPostCrawford[i]), "mettable"); UpdateTable(pmt, (float (*)[MAXSCORE]) (void *) aafMETPostCrawford[i], &miCurrent, pmw->nMatchTo, 1, TRUE); } } static GtkWidget * GTKWriteMET(const unsigned int nRows, const unsigned int nCols, const unsigned int nAway0, const unsigned int nAway1) { unsigned int i, j; char sz[16]; GtkWidget *pwScrolledWindow = gtk_scrolled_window_new(NULL, NULL); GtkWidget *pwTable = gtk_table_new(nRows + 1, nCols + 1, TRUE); GtkWidget *pw; GtkWidget *pwBox = gtk_vbox_new(FALSE, 0); mettable *pmt; pmt = (mettable *) g_malloc(sizeof(mettable)); pmt->pwTable = pwTable; gtk_box_pack_start(GTK_BOX(pwBox), pmt->pwName = gtk_label_new((char *) miCurrent.szName), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwBox), pmt->pwFileName = gtk_label_new((char *) miCurrent.szFileName), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwBox), pmt->pwDescription = gtk_label_new((char *) miCurrent.szDescription), FALSE, FALSE, 4); gtk_box_pack_start(GTK_BOX(pwBox), pwScrolledWindow, TRUE, TRUE, 0); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(pwScrolledWindow), pwTable); /* header for rows */ for (i = 0; i < nCols; i++) { sprintf(sz, _("%d-away"), i + 1); gtk_table_attach_defaults(GTK_TABLE(pwTable), pw = gtk_label_new(sz), i + 1, i + 2, 0, 1); if (i == nAway1) { gtk_widget_set_name(GTK_WIDGET(pw), "gnubg-met-matching-score"); } } /* header for columns */ for (i = 0; i < nRows; i++) { sprintf(sz, _("%d-away"), i + 1); gtk_table_attach_defaults(GTK_TABLE(pwTable), pw = gtk_label_new(sz), 0, 1, i + 1, i + 2); if (i == nAway0) { gtk_widget_set_name(GTK_WIDGET(pw), "gnubg-met-matching-score"); } } /* fill out table */ for (i = 0; i < nRows; i++) for (j = 0; j < nCols; j++) { pmt->aapwLabel[i][j] = gtk_label_new(NULL); gtk_table_attach_defaults(GTK_TABLE(pmt->pwTable), pmt->aapwLabel[i][j], j + 1, j + 2, i + 1, i + 2); if (i == nAway0 && j == nAway1) { gtk_widget_set_name(GTK_WIDGET(pmt->aapwLabel[i][j]), "gnubg-met-the-score"); } else if (i == nAway0 || j == nAway1) { gtk_widget_set_name(GTK_WIDGET(pmt->aapwLabel[i][j]), "gnubg-met-matching-score"); } } gtk_table_set_col_spacings(GTK_TABLE(pwTable), 4); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(pwScrolledWindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); g_object_set_data_full(G_OBJECT(pwBox), "mettable", pmt, g_free); return pwBox; } static void invertMETlocal(GtkWidget * UNUSED(widget), const metwidget * pmw) { if (fInvertMET) UserCommand("set invert met off"); else UserCommand("set invert met on"); UserCommand("save settings"); UpdateAllTables(pmw); } static void loadMET(GtkWidget * UNUSED(widget), const metwidget * pmw) { SetMET(NULL, NULL); UpdateAllTables(pmw); } extern void GTKShowMatchEquityTable(const unsigned int nMatchTo, const int anScore[2]) { /* FIXME: Widget should update after 'Invert' or 'Load ...' */ int i; char sz[50]; GtkWidget *pwDialog = GTKCreateDialog(_("GNU Backgammon - Match equity table"), DT_INFO, NULL, DIALOG_FLAG_MODAL, NULL, NULL); GtkWidget *pwNotebook = gtk_notebook_new(); GtkWidget *pwLoad = gtk_button_new_with_label(_("Load table...")); GtkWidget *pwInvertButton = gtk_toggle_button_new_with_label(_("Invert table")); metwidget mw; mw.nMatchTo = nMatchTo; mw.anAway[0] = (nMatchTo - (unsigned) anScore[0]) - 1; mw.anAway[1] = (nMatchTo - (unsigned) anScore[1]) - 1; gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(pwInvertButton), fInvertMET); gtk_container_set_border_width(GTK_CONTAINER(pwNotebook), 4); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_MAIN)), pwNotebook); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_BUTTONS)), pwInvertButton); gtk_container_add(GTK_CONTAINER(DialogArea(pwDialog, DA_BUTTONS)), pwLoad); mw.pwPreCrawford = GTKWriteMET((unsigned) mw.nMatchTo, (unsigned) mw.nMatchTo, mw.anAway[0], mw.anAway[1]); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), mw.pwPreCrawford, gtk_label_new(_("Pre-Crawford"))); for (i = 0; i < 2; i++) { sprintf(sz, _("Post-Crawford for player %s"), ap[i].szName); mw.apwPostCrawford[i] = GTKWriteMET(nMatchTo, 1, mw.anAway[i], mw.anAway[!i]); gtk_notebook_append_page(GTK_NOTEBOOK(pwNotebook), mw.apwPostCrawford[i], gtk_label_new(sz)); } gtk_window_set_default_size(GTK_WINDOW(pwDialog), 500, 300); g_signal_connect(G_OBJECT(pwInvertButton), "toggled", G_CALLBACK(invertMETlocal), &mw); g_signal_connect(G_OBJECT(pwLoad), "clicked", G_CALLBACK(loadMET), &mw); UpdateAllTables(&mw); GTKRunDialog(pwDialog); } gnubg-1.02.000/TODO0000644000000000000000000004442211214566525010430 00000000000000$Id: TODO,v 1.302 2009/06/13 00:05:41 c_anthon Exp $ People's names next to entries in this file mean they intend to work on that item soon. Please contact them before working on related areas, to avoid duplication of effort and to make sure our changes merge easily. * Evaluations: ** Allow different settings (e.g. search ply, candidates, tolerance) for each position class. ** Add more evaluation classes. *** Add a neural net to correct errors in BEAROFF1 class. *** Classes for bearing off against contact, back games, containment positions, prime-vs-prime... *** Consider meta-pi scheme for using output from multiple nets. ** Add another "eval"-like command that show the distribution of equities n rolls ahead. SW does bar graphs of this stuff; Cam Trenor suggests alternative output. ** Create multiple threads to parallelise rollouts (and evaluations?) on multiprocessors. Perhaps start remote processes? (Olivier Baur) ** Add more statistics for rollouts, e.g. number of turns on the bar, average number of forced moves ** Add Michael Zehr's method for cube variance reduction in money games. ** Add a cache for cubeful evaluations. ** Joseph has weights for small (5 hidden nodes) nets, which could be used for the internal evaluations of deep searches for a significant speed increase. See FindBestMoveInEval() in eval.c from fibs2html. ** Consider making EvalEfficiency() more sophisticated. ** Save rollouts and evaluations in moverecords, e.g., a cubeless rollout for a position. ** Movefilters: *** accept=0, extra=0 is an illegal value! *** Improve dialog ** Cube filters *** similar to move filters (jth) * Commands: ** Add interactive rollouts. ** Analyse games and matches. *** Allow re-evaluating analysis with different settings, and rollouts. *** Make sure cube analysis works for beavers. *** Use the fComputed field in statcontext (make "show statistics ..." complain if not computed, disable the GTK menu items if not available). *** Make sure analysis works with resignations. *** Consider a way for analysis to mark _good_ moves (e.g. moves which are flagged as errors at 0-ply but turn out to be correct at higher plies). *** Option "[X] update annotations if re-evaluated or rolled out", and update annotations if option is selected. Alternatively, update annotation if it's different from good/very good. *** fix logic for determining whether a double is around too-good or double point. *** Calculate "advantage" (i.e. luck-adjusted result): ppg in game stats for money; MWC in match stats for matches. Save the results in pairwise player records. (gary) ** Finish saving positions and evaluations to databases. ** Finish supervised training, and allow people to submit training data via web. ** Allow resuming interrupted rollouts, and extending completed rollouts. *** Allow saving rollouts -- see Jim Segrave's message at for details. *** An option to stop a rollout once the stderr error has reached some arbitrary threshold *** Report equivalent number of games when using variance reduction *** Aborted rollouts show the full number of games in outputs *** Implement for rollouts the same heuristics used by ComputerTurn for cube decisions *** Predefined rollout settings ** Extend ParsePosition() to handle some sort of syntax like [8/5 6/5] (meaning the position after that move). FIBS boardstyle 3 output might be nice, too. ** When rolling out multiple decisions, add p-values (a la the equity difference). ** Importing and exporting: *** Add missing export formats (FIBS oldmoves, .sgg, .pos). *** Make the .mat format identical to Jellyfish (things to check: beavers, resignations, "and the match"...) *** Check drops, beavers, resignations, implement Crawford and Jacoby etc. in SGG importing. *** Make option to output board only for, say, very bad moves. *** Consider rewriting export engine into one XML exporter combined with a number of XSL stylesheets. HTML/XHTML and text is a normal XSL stylesheet, and PDF/PS/TeX export is XSL-FO. *** Improve the LaTeX, PS and PDF output: **** Add commands to change paper size, board magnification, and number of move candidates listed in analysis. (gary) **** Show game and match statistics (if available) at end of game/match. **** Allow some option for selecting which boards to print (see the "FG" SGF property). ** Tutor mode *** save evaluation into pmr for doubles *** Warn about erroneous resignations. ** Make the command functions return an int, instead of void; that way commands which use other commands can provide sensible error handling. (gary) ** Kit Woolsey suggests adding an option for truncated rollouts: when truncating at n plies, take the mean of the (n-1) and n ply results. ** The "play" command is broken in "load command" scripts. Add subcommands like "play game", "play match" for finer control. (gary) * TTY interface: ** Handle "list game" and "list match". (oysteijo) ** Allow setting/editing commentary. ** Show take/drop analysis. ** Make DumpStatcontext work for money sessions. ** Make output*() functions wrap words, and pause before scrolling (as in gdb). * X interface: ** Does anybody still use the old Xlib (Ext) interface any more? If so, perhaps they are interested in maintaining it. If not, maybe it should be deprecated and eventually removed (all the recent GUI effort has concentrated on the GTK interface anyway). * GTK interface: ** Allow copy/paste and drag & drop of the board ID in the board window. ** Add a prompt and entry field to allow commands to be entered (replacing stdin). ** Disable the "stop" button when nothing is happening. ** Add option to exchange the dice after a single click move has been made. ** Make sure we apply GTK styles correctly: create a GtkRcStyle; set the background colour in the style and the flag indicating the background is set; call gtk_widget_modify_style; unref the style. This makes sure the style will survive across theme changes. ** Make usage() show the GDK and GTK options, if appropriate. ** Allow the cube text colour and the border specular/shiny parameters to be changed. ** Use a file selection widget for the socket in the player dialog. ** Would ShowList() look better if it used a text widget? (Wait for GTK+ 2.0.) ** Enable and disable the take/drop/redouble/agree/decline etc. buttons and menu items when appropriate. ** Make some of the information below the board optional (suggested by Jeremie Petit). This might be possible with a vertical pane widget, but it would be nice if there was a way to forbid children from being given _more_ than their requested size. This might require a subclass which overrides gtk_vpaned_motion and sets paned->min_position. ** Optionally merge the game record and annotation windows into one big paned window (suggested by Jeremie Petit). ** When a long string is displayed in the status bar, the main window grows to accomodate it -- not very pretty. A Layout or Viewport widget might be able to fix this. (Fixed under GTK+ 2.0.) ** Make GTKDumpStatcontext check psc->fMoves, psc->fDice and psc->fCube, and only output the relevant statistics. ** Make sure copy/paste works correctly everywhere. See . (Wait for GTK+ 2.0.) ** The edges of the board should cast shadows. Getting shadows on the board surface is fairly easy... getting shadows on the chequers is not. ** chequer movement *** right-blick bearoff tray for bearing off 4 men Also, if "allow dragging to illegal points" is disabled right clicking on the bearoff tray will hit the chequer in the home board. *** Problems with movement with dice 63, 42, or 21. See ** Annotations: it's not possible to write to the annotation window while playing ** Redesign some of the GUI. See mails from Albert Silver and others. ** The "take" hint-widget is not used. Either use it, or alter the current "double"-widget. ** Allow some way to specify long RNG seeds, and RNG parameters besides the seed (e.g. BBS modulus, user .so file) in the GUI. ** Make sure all the buttons in the game record window are also available as main menu commands. ** The sound setting options page isn't complete yet. ** Show player on roll on board, e.g., dice cup, arrow, or whatever ** Optionally show numbers based on who's on roll ** Show resignations on board. Currently we show a white cube with a number. Change this to showing, e.g., R1, or change to a white flag. ** the Race Theory window is way too large. Where does all that white space come from? ** Extend the Race Theory window with the output from "eval" for bearoff databases. ** Temperatur maps: *** save window geometry *** add Eval button/eval settings button (like in hint-dialog) *** show difference histogram *** export to html *** show eval settings (i.e., remember eval settings) ** Dialogs: *** Add buttons to the "help" window to look up the command in the manual, or execute it. Also use gtk_label_set_markup style markup in the help window. *** Make open/save/import/export dialogs larger to accomodate very long filenames *and* save the geometry) ** Deprecated functions: Once GTK+ 2.0 is released, remove references to the following deprecated functions: *** gdk_style_get_font *** gdk_style_set_font *** gdk_image_new_bitmap *** GtkText *** Save geometry for other windows: match statistics, hint, etc. * Bugs: ** The erroneous commands "set player both" and "set player both evaluation" give poor error messages. szSetCommand is not always set correctly, which leads to other bad errors (e.g. "set player 0 cubedecision rollout"). ** "help load sfdkljsdlf" gives a poor error message. ** Check that calls to GTKUpdateAnnotations() are made where necessary (e.g. the "annotate" commands probably should, and "set output ..."). ** The SGF loading (saving?) routines and CommandLoadCommands use stdio, which restarts system calls on signals. This means TTY interrupts and the GTK `stop' button don't work. (gary) ** There's no way to see the annotation on the opening move using the TTY interface. Changing ShowBoard() to display the starting position and then the annotation might work. ** The SGF lexer and parser are robust against illegal input, but the game reading functions in sgf.c are very fragile. They need to be fixed to detect invalid saved games. ** CommandCopy() should complain (or copy a board initialised to the starting position) if no game is being played. ** If "set turn" has been used during a game (so a player has two consecutive moves), then export to .mat format saves it incorrectly. ** Analysis with rollouts crashes under GTK. (There are problems with the rollout window -- do we really want a window in this case?) ** FIBS oldmoves format doesn't record how many points a resignation is for -- we should calculate it based on the score. ** "help next" (and "next ") are incomplete. ** GtkTexi should try to load images from the same directory as the XML file. ** It is possible to give some commands (e.g. "roll", "play") while in edit mode, which messes things up. ** make rollout as initial position work correctly. Currently, you have to perform two rollouts (one with player 0 on roll, and another with player 1 on roll) and average the two results. Instead gnubg should automagically perform both rollouts and do the averaging. ** the move number shown when exporting positions to text or html is -1 ** the rollout window is a bit to small ** try to eliminate dependency on pstopng and friends ** settings analysis thresholds doesn't seem to work (see http://mail.gnu.org/pipermail/bug-gnubg/2002-October/001313.html) (This is working as designed. The navigation commands are based on the annotations, which are not necessarily related to the analysis at all, e.g. if they were marked by a human. Perhaps we could add more navigation commands which are derived directly from the analysis, which would give the behaviour the user seems to want, and allow us to implement David Montgomery's suggestion of allowing negative error thresholds.) ** ShowBoard always shows "resigns" message as the player on roll, but it might have been the opponent. ** There is an extra column in the GTK+ player record list. I can't see anything wrong with the code -- perhaps it is a GTK+ bug? (That list widget is obselete, so presumably the problem will go away when we move to GTK+ 2.0.) ** it's not possible to drag the opponents chequers back if the player regret the hit; e.g., play one chequer to but the opponent on the bar. After this it's neither possible to drag the opponent's chequer back nor to drag your own chequer back. [2003-04-05: it's now possible to drag your own chequer back] ** when there is both a missed double and a chequer play error, gnubg skips the chequer play error when browsing for marked decisions only * Documentation: ** Complete the Texinfo manual. Perhaps for now, only things that are unlikely to change should be documented. ** The GNU coding standards say: "Don't just tell the reader what each feature can do -- say what jobs it is good for, and show how to use it for those jobs. Explain what is recommended usage, and what kinds of usage users should avoid." * Miscellaneous: ** Add more to http://www.gnu.org/software/gnubg/... -- perhaps pages to submit training data, an online evaluator like Monte Carlo, maybe even an entire game like Motif. ** Submit something to . ** Allow loading and saving weights to specify binary or ASCII format (perhaps load and save use binary, import and export use ASCII). ** Think about generating huge databases for CD-ROMs (we can get 1-sided databases for all chequers up to the 11 point, or 2-sided databases where both players have up to 11 chequers in the home board onto a CD-ROM). ** Add optional time rules, for tournament play when clocks are used. ** Add more optional feature tests to "make check" -- databases, X? ** Add import/export tests. ** Change the fConfirm ("are you sure you want to abort the game in progress") checks so that they _do_ ask when the game is over but the match is still in progress, and they _don't_ ask if a game has not been modified since it was last loaded/saved. ** Handle SGF variations. ** Allow loading/saving of compressed games/matches with zlib. ** Make the external player handle resignation decisions. ** Allow an option for illegal moves to be entered. ** Allow ~ and $ escapes in filenames (use wordexp()). ** Allow printing positions/games/matches/etc. (More or less the same as exporting to PostScript, but piped to a printing process.) (gary) *** Consider adding optional Ghostscript support -- Ghostscript can be built as a shared library/DLL (see doc/API.htm in the Ghostscript distribution). This would allow us to print to any device that Ghostscript supports, although the user would still have to figure out the Ghostscript configuration. Under MS Windows, the "mswinpr2" device (see doc/Devices.htm) outputs to MS Windows printer drivers, which could be useful. ** Add statistics of won/lost games/matches to the player records. (gary) ** Make sure the Nackgammon option works properly: record when loading/saving, make sure that InitBoard during analysis gets it right, etc. Similarly for Egyptian and Jacoby. ** If a MOVE_NORMAL is marked bad, it's not clear whether that means a bad move, or a costly missed double. ** Consider some kind of interface for recording live matches as quickly as possible. David Montgomery suggests showing a list of legal moves, ordered by equity, as soon as the dice roll is entered; hopefully the user will usually be able to select the top move and enter most of them very quickly. Entry of illegal moves should be possible, and it should be easy to move back to correct mistakes. ** Think about adding features which attempt to predict the time and standard error of rollouts in advance (see Chuck's work). (gary) ** Investigate more sophisticated training techniques, e.g. real simulated annealing (see the GNU Scientific Library, at ). ** It would be nice if you could mark positions and moves for "Rollout later". One could then look through a game and mark all positions of interest, set the rollouts off and come back later. ** Consider a Mozilla plug-in so that boards in generated HTML can be displayed efficiently. (gary) ** We provide access to non-deterministic dice from random.org. Add completely deterministic dice from noentropy.net as well. * Bugs believed fixed: ** Save the results of rollouts/evaluations performed with hint during playing * Obselete or problematic ideas (probably better not to implement these): ** Save partial input when TTY input is overwritten by an X command. The best way would be to unify what GetInput does and ProcessInput, with push/pop semantics for readline state. ** Nothing handles running out of memory gracefully. A solution could be to write a malloc() wrapper that (if malloc fails) first tries to free memory (e.g. flush the eval cache); if malloc still doesn't succeed, then print an error message and longjmp() to the main loop. When using the GNU C library, __malloc_hook can be used too (so we can intercept calls coming from Xlib, for instance). We shouldn't longjmp() out of the hook, though (it might confuse library functions). ** When using mmap()ed bearoff databases, add a signal handler for SIGBUS/SIGSEGV to trap I/O errors. Unfortunately, the semantics of errors on mmap()ed regions are the most unportable that can be imagined... ** Think about ways to improve event handling while "busy". We could save them somewhere and then use gdk_event_put() when we're ready. (gary) ** The following two items are probably redundant once ParsePosition is extended (see above). *** Add a command "show moves" which shows a list of legal moves, like hint does, but without evaluating them. *** Also "add move", to add a specific move to the list (e.g. "add move 8/5 6/5"). ** When 'Allow dragging to illegal input' is selected, Two consecutive Button 1 click will both use the 'first' dice. (This is working as intended -- to implement the opposite behaviour, see the item about exchanging dice under "GTK interface".) Local Variables: mode: outline End: gnubg-1.02.000/gtkrelational.h0000644000000000000000000000230112157217760012740 00000000000000/* * gtkrelational.h * * by Christian Anthon , 2006. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkrelational.h,v 1.12 2013/06/16 02:16:16 mdpetch Exp $ */ #include "relational.h" #include #ifndef GTKRELATIONAL_H #define GTKRELATIONAL_H extern void GtkRelationalAddMatch(gpointer p, guint n, GtkWidget * pw); extern void GtkShowRelational(gpointer p, guint n, GtkWidget * pw); extern GtkWidget *RelationalOptions(void); extern void RelationalOptionsShown(void); extern void RelationalSaveOptions(void); extern void GtkShowQuery(RowSet * pRow); #endif gnubg-1.02.000/gtkoptions.h0000644000000000000000000000167012157217757012317 00000000000000/* * gtkoptions.h * * by Joern Thyssen , 2003 * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkoptions.h,v 1.7 2013/06/16 02:16:15 mdpetch Exp $ */ #ifndef GTKOPTIONS_H #define GTKOPTIONS_H extern void GTKSetOptions(void); extern void GTKSound(void); #endif /* GTKOPTIONS_H */ gnubg-1.02.000/rollout.h0000644000000000000000000001406512157217764011616 00000000000000/* * rollout.h * * by Gary Wong , 1999. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: rollout.h,v 1.37 2013/06/16 02:16:20 mdpetch Exp $ */ #ifndef ROLLOUT_H #define ROLLOUT_H #define MAXHIT 50 /* for statistics */ #define STAT_MAXCUBE 10 typedef struct _rolloutstat { /* Regular win statistics (dimension is cube turns) */ int acWin[STAT_MAXCUBE]; int acWinGammon[STAT_MAXCUBE]; int acWinBackgammon[STAT_MAXCUBE]; /* Cube statistics (dimension is cube turns) */ int acDoubleDrop[STAT_MAXCUBE]; /* # of Double, drop */ int acDoubleTake[STAT_MAXCUBE]; /* # of Double, takes */ /* Chequer hit statistics (dimension is move number) */ /* Opponent closed out */ int nOpponentHit; int rOpponentHitMove; /* Average loss of pips in bear-off */ int nBearoffMoves; /* number of moves with bearoff */ int nBearoffPipsLost; /* number of pips lost in these moves */ /* Opponent closed out */ int nOpponentClosedOut; int rOpponentClosedOutMove; /* FIXME: add more stuff */ } rolloutstat; typedef void (rolloutprogressfunc) (float arOutput[][NUM_ROLLOUT_OUTPUTS], float arStdDev[][NUM_ROLLOUT_OUTPUTS], const rolloutcontext * prc, const cubeinfo aci[], unsigned int initial_game_count, const int iGame, const int iAlternative, const int nRank, const float rJsd, const int fStopped, const int fShowRanks, int fCubeRollout, void *pUserData); extern int RolloutGeneral(ConstTanBoard * apBoard, float (*apOutput[])[NUM_ROLLOUT_OUTPUTS], float (*apStdDev[])[NUM_ROLLOUT_OUTPUTS], rolloutstat apStatistics[][2], evalsetup(*apes[]), const cubeinfo(*apci[]), int (*apCubeDecTop[]), int alternatives, int fInvert, int fCubeRollout, rolloutprogressfunc * pfRolloutProgress, void *pUserData); extern int GeneralEvaluation(float arOutput[NUM_ROLLOUT_OUTPUTS], float arStdDev[NUM_ROLLOUT_OUTPUTS], rolloutstat arsStatistics[2], TanBoard anBoard, const cubeinfo * pci, const evalsetup * pes, rolloutprogressfunc * pfRolloutProgress, void *pUserData); extern int GeneralEvaluationR(float arOutput[NUM_ROLLOUT_OUTPUTS], float arStdDev[NUM_ROLLOUT_OUTPUTS], rolloutstat arsStatistics[2], const TanBoard anBoard, const cubeinfo * pci, const rolloutcontext * prc, rolloutprogressfunc * pfRolloutProgress, void *pUserData); extern int GeneralCubeDecision(float aarOutput[2][NUM_ROLLOUT_OUTPUTS], float aarStdDev[2][NUM_ROLLOUT_OUTPUTS], rolloutstat aarsStatistics[2][2], const TanBoard anBoard, cubeinfo * pci, evalsetup * pes, rolloutprogressfunc * pfRolloutProgress, void *pUserData); extern int GeneralCubeDecisionR(float aarOutput[2][NUM_ROLLOUT_OUTPUTS], float aarStdDev[2][NUM_ROLLOUT_OUTPUTS], rolloutstat aarsStatistics[2][2], const TanBoard anBoard, cubeinfo * pci, rolloutcontext * prc, evalsetup * pes, rolloutprogressfunc * pfRolloutProgress, void *pUserData); /* operations on rolloutstat */ /* Resignations */ extern int getResignation(float arResign[NUM_ROLLOUT_OUTPUTS], TanBoard anBoard, const cubeinfo * pci, const evalsetup * pesResign); extern void getResignEquities(float arResign[NUM_ROLLOUT_OUTPUTS], cubeinfo * pci, int nResigned, float *prBefore, float *prAfter); extern int ScoreMoveRollout(move ** ppm, const cubeinfo ** ppci, int cMoves, rolloutprogressfunc * pfRolloutProgress, void *pUserData); extern void RolloutLoopMT(void *unused); /* Quasi-random permutation array: the first index is the "generation" of the * permutation (0 permutes each set of 36 rolls, 1 permutes those sets of 36 * into 1296, etc.); the second is the roll within the game (limited to 128, * so we use pseudo-random dice after that); the last is the permutation * itself. 6 generations are enough for 36^6 > 2^31 trials. */ typedef struct _perArray { unsigned char aaanPermutation[6][128][36]; int nPermutationSeed; } perArray; EXP_LOCK_FUN(int, BasicCubefulRollout, unsigned int aanBoard[][2][25], float aarOutput[][NUM_ROLLOUT_OUTPUTS], int iTurn, int iGame, const cubeinfo aci[], int afCubeDecTop[], unsigned int cci, rolloutcontext * prc, rolloutstat aarsStatistics[][2], int nBasisCube, perArray * dicePerms, rngcontext * rngctxRollout, FILE * logfp); extern FILE *log_game_start(const char *name, const cubeinfo * pci, int fCubeful, TanBoard anBoard); extern void log_cube(FILE * logfp, const char *action, int side); extern void log_move(FILE * logfp, const int *anMove, int side, int die0, int die1); extern int RolloutDice(int iTurn, int iGame, int fInitial, unsigned int anDice[2], rng * rngx, void *rngctx, const int fRotate, const perArray * dicePerms); extern void ClosedBoard(int afClosedBoard[2], const TanBoard anBoard); extern void log_game_over(FILE * logfp); extern void QuasiRandomSeed(perArray * pArray, int n); #endif gnubg-1.02.000/gtkgame.h0000644000000000000000000001670712157217756011543 00000000000000/* * gtkgame.h * * by Gary Wong , 2000, 2002. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: gtkgame.h,v 1.153 2013/06/16 02:16:14 mdpetch Exp $ */ #ifndef GTKGAME_H #define GTKGAME_H #include #include "backgammon.h" #include "gtkpanels.h" #include "gtkchequer.h" #define TOOLBAR_ACTION_OFFSET 10000 #if (USE_GTKUIMANAGER) extern GtkUIManager *puim; #endif extern GdkColor wlCol; extern GtkAccelGroup *pagMain; extern GtkWidget *pwAnalysis; extern GtkWidget *pwBoard; extern GtkWidget *pwCommentary; extern GtkWidget *pwGrab; extern GtkWidget *pwMain; extern GtkWidget *pwMessageText; extern GtkWidget *pwMoveAnalysis; extern GtkWidget *pwOldGrab; extern GtkWidget *pwPanelVbox; extern GtkWidget *pwToolbar; extern GtkWidget *pwGnubgID; extern guint nNextTurn; /* GTK idle function */ extern int fEndDelay; extern int fNeedPrompt; extern int frozen; extern int fTTY; extern int fX; extern int fToolbarShowing; extern int inCallback; extern unsigned int nDelay; extern GtkWidget *hpaned; extern GtkWidget *pom; extern moverecord *pmrCurAnn; extern char *ReturnHits(TanBoard anBoard); extern gboolean ShowGameWindow(void); extern gint MoveListClearSelection(GtkWidget * pw, GdkEventSelection * pes, hintdata * phd); extern gint NextTurnNotify(gpointer p); extern GList *MoveListGetSelectionList(const hintdata * phd); extern GtkWidget *GetPanelWidget(gnubgwindow window); extern GtkWidget *GL_Create(void); extern int ArePanelsDocked(void); extern int ArePanelsShowing(void); extern int DockedPanelsShowing(void); extern int edit_new(unsigned int length); extern int GetPanelWidth(gnubgwindow panel); extern int GTKGetManualDice(unsigned int an[2]); extern int GTKGetMove(int anMove[8]); extern int GtkTutor(char *sz); extern int IsPanelDocked(gnubgwindow window); extern int IsPanelShowVar(gnubgwindow panel, void *p); extern int SetMainWindowSize(void); extern move *MoveListGetMove(const hintdata * phd, GList * pl); extern void CommentaryChanged(GtkWidget * pw, GtkTextBuffer * buffer); extern void DisplayWindows(void); extern void DockPanels(void); extern void FullScreenMode(int state); extern void GetFullscreenWindowSettings(int *panels, int *ids, int *maxed); extern void GetStyleFromRCFile(GtkStyle ** ppStyle, const char *name, GtkStyle * psBase); extern void GL_Freeze(void); extern void GL_SetNames(void); extern void GL_Thaw(void); extern void GTKAddGame(moverecord * pmr); extern void GTKAddMoveRecord(moverecord * pmr); extern void GTKAllowStdin(void); extern void GTKBearoffProgress(int i); extern void GTKCalibrationEnd(void *context); extern void *GTKCalibrationStart(void); extern void GTKCalibrationUpdate(void *context, float rEvalsPerSec); extern void GtkChangeLanguage(void); extern void GTKClearMoveRecord(void); extern void GTKCommandShowCredits(GtkWidget * pw, GtkWidget * parent); extern void GTKCubeHint(moverecord * pmr, const matchstate * pms, int did_double, int did_take, int hist); extern void GTKDelay(void); extern void GTKDisallowStdin(void); extern void GTKDumpStatcontext(int game); extern void GTKEval(char *szOutput); extern void GTKFreeze(void); extern void GTKHelp(char *sz); extern void GTKHint(moverecord * pmr, int hist); extern void GTKMatchInfo(void); extern void GTKNew(void); extern void GTKOutput(const char *sz); extern void GTKOutputErr(const char *sz); extern void GTKOutputNew(void); extern void GTKOutputX(void); extern void GTKPopGame(int c); extern void GTKPopMoveRecord(moverecord * pmr); extern void GTKProgressEnd(void); extern void GTKProgressStart(const char *sz); extern void GTKProgressStartValue(char *sz, int iMax); extern void GTKProgressValue(int fValue, int iMax); extern void GTKProgress(void); extern void GTKRecordShow(FILE * pfIn, char *sz, char *szPlayer); extern void GTKRegenerateGames(void); extern void GTKResign(gpointer p, guint n, GtkWidget * pw); extern void GTKResignHint(float arOutput[], float rEqBefore, float rEqAfter, cubeinfo * pci, int fMWC); extern void GTKResumeInput(void); extern void GTKSaveSettings(void); extern void GTKSetCube(gpointer p, guint n, GtkWidget * pw); extern void GTKSetDice(gpointer p, guint n, GtkWidget * pw); extern void GTKSetGame(int i); extern void GTKSetMoveRecord(moverecord * pmr); extern void GTKSet(void *p); extern void GTKShowBuildInfo(GtkWidget * pw, GtkWidget * pwParent); extern void GTKShowCalibration(void); extern void GTKShowScoreSheet(void); extern void GTKShowVersion(void); extern void GTKSuspendInput(void); extern void GTKTextToClipboard(const char *sz); extern void GTKTextWindow(const char *szOutput, const char *title, const int type, GtkWidget * parent); extern void GTKThaw(void); extern void HideAllPanels(gpointer p, guint n, GtkWidget * pw); extern void HintDoubleClick(GtkTreeView * treeview, GtkTreePath * path, GtkTreeViewColumn * col, hintdata * phd); extern void HintSelect(GtkTreeSelection * selection, hintdata * phd); extern void InitGTK(int *argc, char ***argv); extern void MoveListCreate(hintdata * phd); extern void MoveListFreeSelectionList(GList * pl); extern void MoveListShowToggledClicked(GtkWidget * pw, hintdata * phd); extern void MoveListUpdate(const hintdata * phd); extern void OK(GtkWidget * pw, int *pf); extern void PanelHide(gnubgwindow panel); extern void PanelShow(gnubgwindow panel); extern void RefreshGeometries(void); extern void RunGTK(GtkWidget * pwSplash, char *commands, char *python_script, char *match); extern void SetAnnotation(moverecord * pmr); extern void SetAnalysis(gpointer p, guint n, GtkWidget * pw); extern void SetMET(GtkWidget * pw, gpointer p); extern void SetPanelWidget(gnubgwindow window, GtkWidget * pWin); extern void SetRollouts(gpointer p, guint n, GtkWidget * pw); extern void SetToolbarStyle(int value); extern void setWindowGeometry(gnubgwindow window); extern void ShowAllPanels(gpointer p, guint n, GtkWidget * pw); extern void ShowHidePanel(gnubgwindow panel); extern void ShowList(char *asz[], const char *szTitle, GtkWidget * parent); extern void ShowMove(hintdata * phd, const int f); extern void SwapBoardToPanel(int ToPanel, int updateEvents); extern void DoHideAllPanels(int updateEvents); #if (USE_GTKUIMANAGER) extern void ToggleEdit(GtkToggleAction * action, gpointer user_data); extern void ToggleClockwise(GtkToggleAction * action, gpointer user_data); extern void ToggleDockPanels(GtkToggleAction * action, gpointer user_data); #else extern void ToggleDockPanels(gpointer p, guint n, GtkWidget * pw); #endif extern void GTKUndo(void); extern void UserCommand(const char *sz); extern void ShowToolbar(void); extern void HideToolbar(void); extern void MoveListDestroy(void); #if HAVE_LIBREADLINE extern int fReadingCommand; extern void ProcessInput(char *sz); #endif #if USE_BOARD3D extern void SetSwitchModeMenuText(void); extern gboolean gtk_gl_init_success; #endif extern GtkWidget *get_statusbar_label(GtkStatusbar * statusbar); extern void toolbar_set_orientation(GtkToolbar * toolbar, GtkOrientation orientation); #endif gnubg-1.02.000/gtk-multiview.c0000644000000000000000000002353312173277425012717 00000000000000/* gtk-multiview.c * Copyright (C) 2000 Jonathan Blandford * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * $Id: gtk-multiview.c,v 1.16 2013/07/22 18:51:01 mdpetch Exp $ */ /* License changed from the GNU LGPL to the GNU GPL (as permitted * under Term 3 of the GNU LGPL) by Gary Wong for distribution * with GNU Backgammon. */ #include "config.h" #include "common.h" #include "gtklocdefs.h" #include #include "gtk-multiview.h" G_DEFINE_TYPE(GtkMultiview, gtk_multiview, GTK_TYPE_CONTAINER) static void gtk_multiview_size_request(GtkWidget * widget, GtkRequisition * requisition); static void gtk_multiview_size_allocate(GtkWidget * widget, GtkAllocation * allocation); static void gtk_multiview_map(GtkWidget * widget); static void gtk_multiview_unmap(GtkWidget * widget); static GType gtk_multiview_child_type(GtkContainer * container); static void gtk_multiview_forall(GtkContainer * container, gboolean include_internals, GtkCallback callback, gpointer callback_data); static void gtk_multiview_add(GtkContainer * widget, GtkWidget * child); static void gtk_multiview_remove(GtkContainer * widget, GtkWidget * child); static void gtk_multiview_init(GtkMultiview * multiview) { gtk_widget_set_has_window(GTK_WIDGET(multiview), FALSE); multiview->current = NULL; multiview->children = NULL; } static void gtk_multiview_class_init(GtkMultiviewClass * klass) { GtkWidgetClass *widget_class; GtkContainerClass *container_class; widget_class = (GtkWidgetClass *) klass; container_class = (GtkContainerClass *) klass; widget_class->size_request = gtk_multiview_size_request; widget_class->size_allocate = gtk_multiview_size_allocate; widget_class->map = gtk_multiview_map; widget_class->unmap = gtk_multiview_unmap; container_class->forall = gtk_multiview_forall; container_class->add = gtk_multiview_add; container_class->remove = gtk_multiview_remove; container_class->child_type = gtk_multiview_child_type; } static void gtk_multiview_size_request(GtkWidget * widget, GtkRequisition * requisition) { GList *tmp_list; GtkMultiview *multiview; GtkRequisition child_requisition; GtkWidget *child; multiview = GTK_MULTIVIEW(widget); requisition->width = 0; requisition->height = 0; /* We find the maximum size of all children widgets */ tmp_list = multiview->children; while (tmp_list) { child = GTK_WIDGET(tmp_list->data); tmp_list = tmp_list->next; if (gtk_widget_get_visible(child)) { gtk_widget_size_request(child, &child_requisition); requisition->width = MAX(requisition->width, child_requisition.width); requisition->height = MAX(requisition->height, child_requisition.height); if (gtk_widget_get_mapped(child) && child != multiview->current) { gtk_widget_unmap(GTK_WIDGET(child)); } } } } static void gtk_multiview_size_allocate(GtkWidget * widget, GtkAllocation * allocation) { GtkMultiview *multiview; GList *tmp_list; GtkWidget *child; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(widget)); multiview = GTK_MULTIVIEW(widget); gtk_widget_set_allocation(widget, allocation); tmp_list = multiview->children; while (tmp_list) { child = GTK_WIDGET(tmp_list->data); tmp_list = tmp_list->next; if (gtk_widget_get_visible(child)) { gtk_widget_size_allocate(child, allocation); } } } static void gtk_multiview_map(GtkWidget * widget) { GtkMultiview *multiview; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(widget)); multiview = GTK_MULTIVIEW(widget); gtk_widget_set_mapped(widget, TRUE); if (multiview->current && gtk_widget_get_visible(multiview->current) && !gtk_widget_get_mapped(multiview->current)) { gtk_widget_map(GTK_WIDGET(multiview->current)); } } static void gtk_multiview_unmap(GtkWidget * widget) { GtkMultiview *multiview; g_return_if_fail(widget != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(widget)); multiview = GTK_MULTIVIEW(widget); gtk_widget_set_mapped(widget, FALSE); if (multiview->current && gtk_widget_get_visible(multiview->current) && gtk_widget_get_mapped(multiview->current)) { gtk_widget_unmap(GTK_WIDGET(multiview->current)); } } static GType gtk_multiview_child_type(GtkContainer * UNUSED(container)) { return gtk_widget_get_type(); } static void gtk_multiview_forall(GtkContainer * container, gboolean UNUSED(include_internals), GtkCallback callback, gpointer callback_data) { GtkWidget *child; GtkMultiview *multiview; GList *tmp_list; g_return_if_fail(container != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(container)); g_return_if_fail(callback != NULL); multiview = GTK_MULTIVIEW(container); tmp_list = multiview->children; while (tmp_list) { child = GTK_WIDGET(tmp_list->data); tmp_list = tmp_list->next; (*callback) (GTK_WIDGET(child), callback_data); } } static void gtk_multiview_add(GtkContainer * container, GtkWidget * child) { g_return_if_fail(container != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(container)); g_return_if_fail(child != NULL); g_return_if_fail(GTK_IS_WIDGET(child)); gtk_multiview_append_child(GTK_MULTIVIEW(container), child); } static void gtk_multiview_remove(GtkContainer * container, GtkWidget * child) { GtkMultiview *multiview; GList *list; g_return_if_fail(container != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(container)); g_return_if_fail(child != NULL); multiview = GTK_MULTIVIEW(container); list = g_list_find(multiview->children, child); g_return_if_fail(list != NULL); /* If we are mapped and visible, we want to deal with changing the page. */ if ((gtk_widget_get_mapped(GTK_WIDGET(container))) && (list->data == (gpointer) multiview->current) && (list->next != NULL)) { gtk_multiview_set_current(multiview, GTK_WIDGET(list->next->data)); } multiview->children = g_list_remove(multiview->children, child); gtk_widget_unparent(child); } /* Public Functions */ GtkWidget * gtk_multiview_new(void) { return g_object_new(GTK_TYPE_MULTIVIEW, NULL); } void gtk_multiview_prepend_child(GtkMultiview * multiview, GtkWidget * child) { g_return_if_fail(multiview != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(multiview)); g_return_if_fail(child != NULL); g_return_if_fail(GTK_IS_WIDGET(child)); gtk_multiview_insert_child(multiview, NULL, child); } void gtk_multiview_insert_child(GtkMultiview * multiview, GtkWidget * back_child, GtkWidget * child) { GList *list; g_return_if_fail(multiview != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(multiview)); g_return_if_fail(child != NULL); g_return_if_fail(GTK_IS_WIDGET(child)); list = g_list_find(multiview->children, back_child); if (list == NULL) { multiview->children = g_list_prepend(multiview->children, child); } else { GList *new_el = g_list_alloc(); new_el->next = list->next; new_el->prev = list; if (new_el->next) new_el->next->prev = new_el; new_el->prev->next = new_el; new_el->data = (gpointer) child; } gtk_widget_set_parent(GTK_WIDGET(child), GTK_WIDGET(multiview)); if (gtk_widget_get_realized(GTK_WIDGET(multiview))) gtk_widget_realize(GTK_WIDGET(child)); if (gtk_widget_get_visible(GTK_WIDGET(multiview)) && gtk_widget_get_visible(GTK_WIDGET(child))) { if (gtk_widget_get_mapped(GTK_WIDGET(child))) gtk_widget_unmap(GTK_WIDGET(child)); gtk_widget_queue_resize(GTK_WIDGET(multiview)); } /* if it's the first and only entry, we want to bring it to the foreground. */ if (multiview->children->next == NULL) gtk_multiview_set_current(multiview, child); } void gtk_multiview_append_child(GtkMultiview * multiview, GtkWidget * child) { GList *list; g_return_if_fail(multiview != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(multiview)); g_return_if_fail(child != NULL); g_return_if_fail(GTK_IS_WIDGET(child)); list = g_list_last(multiview->children); if (list) { gtk_multiview_insert_child(multiview, GTK_WIDGET(list->data), child); } else { gtk_multiview_insert_child(multiview, NULL, child); } } void gtk_multiview_set_current(GtkMultiview * multiview, GtkWidget * child) { GList *list; GtkWidget *old = NULL; g_return_if_fail(multiview != NULL); g_return_if_fail(GTK_IS_MULTIVIEW(multiview)); g_return_if_fail(child != NULL); g_return_if_fail(GTK_IS_WIDGET(child)); if (multiview->current == child) return; list = g_list_find(multiview->children, child); g_return_if_fail(list != NULL); if ((multiview->current) && (gtk_widget_get_visible(multiview->current)) && (gtk_widget_get_mapped(GTK_WIDGET(multiview)))) { old = GTK_WIDGET(multiview->current); } multiview->current = GTK_WIDGET(list->data); if (gtk_widget_get_visible(multiview->current) && (gtk_widget_get_mapped(GTK_WIDGET(multiview)))) { gtk_widget_map(multiview->current); } if (old && gtk_widget_get_mapped(old)) gtk_widget_unmap(old); } gnubg-1.02.000/config.guess0000755000000000000000000012743212175510052012252 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2011, 2012 Free Software Foundation, Inc. timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Per Bothner. Please send patches (context # diff format) to and include a ChangeLog # entry. # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` ;; *5.*) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") UNAME_MACHINE="alpha" ;; "EV5 (21164)") UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH="hppa2.0w" else HP_ARCH="hppa64" fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo ${UNAME_MACHINE}-unknown-linux-gnueabi else echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) LIBC=gnu eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __dietlibc__ LIBC=dietlibc #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; or32:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown case $UNAME_PROCESSOR in i386) eval $set_cc_for_build if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then UNAME_PROCESSOR="x86_64" fi fi ;; unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; NEO-?:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-?:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit ;; *:ITS:*:*) echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: gnubg-1.02.000/positionid.c0000644000000000000000000002711412157217763012270 00000000000000/* * positionid.c * * by Gary Wong , 1998-1999. * * An implementation of the position "external" key/IDs at: * * http://www.gnu.org/manual/gnubg/html_node/A-technical-description-of-the-Position-ID.html * * Please see that page for more information. * * For internal use, we use another "key", much faster to encode or decode * that is essentially the raw board squeezed down to 4 bits/point. * * This library also calculates bearoff IDs, which are enumerations of the * * c+6 * C * 6 * * combinations of (up to c) chequers among 6 points. * * * This program is free software; you can redistribute it and/or modify * it under the terms of version 3 or later of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: positionid.c,v 1.52 2013/06/16 02:16:19 mdpetch Exp $ */ #include "config.h" #include #include #include #include "positionid.h" extern void PositionKey(const TanBoard anBoard, positionkey * pkey) { unsigned int i, j; unsigned int *anpBoard = pkey->data; for (i = 0, j = 0; i < 3; i++, j += 8) { anpBoard[i] = anBoard[1][j] + (anBoard[1][j + 1] << 4) + (anBoard[1][j + 2] << 8) + (anBoard[1][j + 3] << 12) + (anBoard[1][j + 4] << 16) + (anBoard[1][j + 5] << 20) + (anBoard[1][j + 6] << 24) + (anBoard[1][j + 7] << 28); anpBoard[i + 3] = anBoard[0][j] + (anBoard[0][j + 1] << 4) + (anBoard[0][j + 2] << 8) + (anBoard[0][j + 3] << 12) + (anBoard[0][j + 4] << 16) + (anBoard[0][j + 5] << 20) + (anBoard[0][j + 6] << 24) + (anBoard[0][j + 7] << 28); } anpBoard[6] = anBoard[0][24] + (anBoard[1][24] << 4); } extern void PositionFromKey(TanBoard anBoard, const positionkey * pkey) { unsigned int i, j; unsigned int const *anpBoard = pkey->data; for (i = 0, j = 0; i < 3; i++, j += 8) { anBoard[1][j] = anpBoard[i] & 0x0f; anBoard[1][j + 1] = (anpBoard[i] >> 4) & 0x0f; anBoard[1][j + 2] = (anpBoard[i] >> 8) & 0x0f; anBoard[1][j + 3] = (anpBoard[i] >> 12) & 0x0f; anBoard[1][j + 4] = (anpBoard[i] >> 16) & 0x0f; anBoard[1][j + 5] = (anpBoard[i] >> 20) & 0x0f; anBoard[1][j + 6] = (anpBoard[i] >> 24) & 0x0f; anBoard[1][j + 7] = (anpBoard[i] >> 28) & 0x0f; anBoard[0][j] = anpBoard[i + 3] & 0x0f; anBoard[0][j + 1] = (anpBoard[i + 3] >> 4) & 0x0f; anBoard[0][j + 2] = (anpBoard[i + 3] >> 8) & 0x0f; anBoard[0][j + 3] = (anpBoard[i + 3] >> 12) & 0x0f; anBoard[0][j + 4] = (anpBoard[i + 3] >> 16) & 0x0f; anBoard[0][j + 5] = (anpBoard[i + 3] >> 20) & 0x0f; anBoard[0][j + 6] = (anpBoard[i + 3] >> 24) & 0x0f; anBoard[0][j + 7] = (anpBoard[i + 3] >> 28) & 0x0f; } anBoard[0][24] = anpBoard[6] & 0x0f; anBoard[1][24] = (anpBoard[6] >> 4) & 0x0f; } static inline void addBits(unsigned char auchKey[10], unsigned int bitPos, unsigned int nBits) { unsigned int k = bitPos / 8; unsigned int r = (bitPos & 0x7); unsigned int b = (((unsigned int) 0x1 << nBits) - 1) << r; auchKey[k] |= (unsigned char) b; if (k < 8) { auchKey[k + 1] |= (unsigned char) (b >> 8); auchKey[k + 2] |= (unsigned char) (b >> 16); } else if (k == 8) { auchKey[k + 1] |= (unsigned char) (b >> 8); } } extern void oldPositionKey(const TanBoard anBoard, oldpositionkey * pkey) { unsigned int i, iBit = 0; const unsigned int *j; memset(pkey, 0, sizeof(oldpositionkey)); for (i = 0; i < 2; ++i) { const unsigned int *const b = anBoard[i]; for (j = b; j < b + 25; ++j) { const unsigned int nc = *j; if (nc) { addBits(pkey->auch, iBit, nc); iBit += nc + 1; } else { ++iBit; } } } } extern void oldPositionFromKey(TanBoard anBoard, const oldpositionkey * pkey) { int i = 0, j = 0, k; const unsigned char *a; memset(anBoard[0], 0, sizeof(anBoard[0])); memset(anBoard[1], 0, sizeof(anBoard[1])); for (a = pkey->auch; a < pkey->auch + 10; ++a) { unsigned char cur = *a; for (k = 0; k < 8; ++k) { if ((cur & 0x1)) { if (i >= 2 || j >= 25) { /* Error, so return - will probably show error message */ return; } ++anBoard[i][j]; } else { if (++j == 25) { ++i; j = 0; } } cur >>= 1; } } } static char * oldPositionIDFromKey(const oldpositionkey * pkey) { unsigned char const *puch = pkey->auch; static char szID[L_POSITIONID + 1]; char *pch = szID; static char aszBase64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; int i; for (i = 0; i < 3; i++) { *pch++ = aszBase64[puch[0] >> 2]; *pch++ = aszBase64[((puch[0] & 0x03) << 4) | (puch[1] >> 4)]; *pch++ = aszBase64[((puch[1] & 0x0F) << 2) | (puch[2] >> 6)]; *pch++ = aszBase64[puch[2] & 0x3F]; puch += 3; } *pch++ = aszBase64[*puch >> 2]; *pch++ = aszBase64[(*puch & 0x03) << 4]; *pch = 0; return szID; } extern char * PositionIDFromKey(const positionkey * pkey) { TanBoard anBoard; oldpositionkey okey; PositionFromKey(anBoard, pkey); oldPositionKey((ConstTanBoard) anBoard, &okey); return oldPositionIDFromKey(&okey); } extern char * PositionID(const TanBoard anBoard) { oldpositionkey key; oldPositionKey(anBoard, &key); return oldPositionIDFromKey(&key); } extern int CheckPosition(const TanBoard anBoard) { unsigned int ac[2], i; /* Check for a player with over 15 chequers */ for (i = ac[0] = ac[1] = 0; i < 25; i++) if ((ac[0] += anBoard[0][i]) > 15 || (ac[1] += anBoard[1][i]) > 15) { errno = EINVAL; return 0; } /* Check for both players having chequers on the same point */ for (i = 0; i < 24; i++) if (anBoard[0][i] && anBoard[1][23 - i]) { errno = EINVAL; return 0; } /* Check for both players on the bar against closed boards */ for (i = 0; i < 6; i++) if (anBoard[0][i] < 2 || anBoard[1][i] < 2) return 1; if (!anBoard[0][24] || !anBoard[1][24]) return 1; errno = EINVAL; return 0; } extern void ClosestLegalPosition(TanBoard anBoard) { unsigned int i, j, ac[2]; /* Limit each player to 15 chequers */ for (i = 0; i < 2; i++) { ac[i] = 15; for (j = 0; j < 25; j++) { if (anBoard[i][j] <= ac[i]) ac[i] -= anBoard[i][j]; else { anBoard[i][j] = ac[i]; ac[i] = 0; } } } /* Forbid both players having a chequer on the same point */ for (i = 0; i < 24; i++) if (anBoard[0][i]) anBoard[1][23 - i] = 0; /* If both players have closed boards, let at least one of them off * the bar */ for (i = 0; i < 6; i++) if (anBoard[0][i] < 2 || anBoard[1][i] < 2) /* open board */ return; if (anBoard[0][24]) anBoard[1][24] = 0; } extern unsigned char Base64(const unsigned char ch) { if (ch >= 'A' && ch <= 'Z') return ch - 'A'; if (ch >= 'a' && ch <= 'z') return (ch - 'a') + 26; if (ch >= '0' && ch <= '9') return (ch - '0') + 52; if (ch == '+') return 62; if (ch == '/') return 63; return 255; } extern int PositionFromID(TanBoard anBoard, const char *pchEnc) { oldpositionkey key; unsigned char ach[L_POSITIONID + 1], *pch = ach, *puch = key.auch; int i; memset(ach, 0, L_POSITIONID + 1); for (i = 0; i < L_POSITIONID && pchEnc[i]; i++) pch[i] = Base64((unsigned char) pchEnc[i]); for (i = 0; i < 3; i++) { *puch++ = (unsigned char) (pch[0] << 2) | (pch[1] >> 4); *puch++ = (unsigned char) (pch[1] << 4) | (pch[2] >> 2); *puch++ = (unsigned char) (pch[2] << 6) | pch[3]; pch += 4; } *puch = (unsigned char) (pch[0] << 2) | (pch[1] >> 4); oldPositionFromKey(anBoard, &key); return CheckPosition((ConstTanBoard) anBoard); } extern int EqualBoards(const TanBoard anBoard0, const TanBoard anBoard1) { int i; for (i = 0; i < 25; i++) if (anBoard0[0][i] != anBoard1[0][i] || anBoard0[1][i] != anBoard1[1][i]) return 0; return 1; } #define MAX_N 40 #define MAX_R 25 static unsigned int anCombination[MAX_N][MAX_R], fCalculated = 0; static void InitCombination(void) { unsigned int i, j; for (i = 0; i < MAX_N; i++) anCombination[i][0] = i + 1; for (j = 1; j < MAX_R; j++) anCombination[0][j] = 0; for (i = 1; i < MAX_N; i++) for (j = 1; j < MAX_R; j++) anCombination[i][j] = anCombination[i - 1][j - 1] + anCombination[i - 1][j]; fCalculated = 1; } extern unsigned int Combination(const unsigned int n, const unsigned int r) { g_assert(n <= MAX_N && r <= MAX_R); if (!fCalculated) InitCombination(); return anCombination[n - 1][r - 1]; } static unsigned int PositionF(unsigned int fBits, unsigned int n, unsigned int r) { if (n == r) return 0; return (fBits & (1u << (n - 1))) ? Combination(n - 1, r) + PositionF(fBits, n - 1, r - 1) : PositionF(fBits, n - 1, r); } extern unsigned int PositionBearoff(const unsigned int anBoard[], unsigned int nPoints, unsigned int nChequers) { unsigned int i, fBits, j; for (j = nPoints - 1, i = 0; i < nPoints; i++) j += anBoard[i]; fBits = 1u << j; for (i = 0; i < nPoints - 1; i++) { j -= anBoard[i] + 1; fBits |= (1u << j); } return PositionF(fBits, nChequers + nPoints, nPoints); } static unsigned int PositionInv(unsigned int nID, unsigned int n, unsigned int r) { unsigned int nC; if (!r) return 0; else if (n == r) return (1u << n) - 1; nC = Combination(n - 1, r); return (nID >= nC) ? (1u << (n - 1)) | PositionInv(nID - nC, n - 1, r - 1) : PositionInv(nID, n - 1, r); } extern void PositionFromBearoff(unsigned int anBoard[], unsigned int usID, unsigned int nPoints, unsigned int nChequers) { unsigned int fBits = PositionInv(usID, nChequers + nPoints, nPoints); unsigned int i, j; for (i = 0; i < nPoints; i++) anBoard[i] = 0; j = nPoints - 1; for (i = 0; i < (nChequers + nPoints); i++) { if (fBits & (1u << i)) { if (j == 0) break; j--; } else anBoard[j]++; } } extern unsigned short PositionIndex(unsigned int g, const unsigned int anBoard[6]) { unsigned int i, fBits; unsigned int j = g - 1; for (i = 0; i < g; i++) j += anBoard[i]; fBits = 1u << j; for (i = 0; i < g - 1; i++) { j -= anBoard[i] + 1; fBits |= (1u << j); } /* FIXME: 15 should be replaced by nChequers, but the function is * only called from bearoffgammon, so this should be fine. */ return (unsigned short) PositionF(fBits, 15, g); } gnubg-1.02.000/ChangeLog0000644000000000000000000101270312173335137011506 000000000000002013-07-22 Michael Petch * configure.ac, openurl.c: Add a configure option --with-default-browser to override the default value "xdg-open". if --with-default-browser is specified without an argument it will look for a default in this order sensible-browser, xdg-open, firefox . If none are found the default xdg-open will be used. This option is not available on Win32 platforms. Add a new configure option --enable-gasserts . Previously g_assert macros have been enabled by default. They are now disabled by default. This option is used to enable those macros. Take the AVX code out of the experimental stage. If AVX is supported on the processor and OS then it will be used by default. 2013-07-22 Michael Petch * gtk-multiview.c, gtk-multiview.h, mec.c, sound.c, board3d/tr.c, board3d/tr.h, lib/mm_malloc.h: Fix some licensing inconsistencies identified by Russ Allbery. 2013-07-21 Michael Petch * gnubg.c: When displaying "save settings to" attempt to output the message immediately. This prevents some unnecessary popup messages. 2013-07-20 Michael Petch * multithread.c: Fix bug on thread disabled builds that caused an assertion while updating the progress bar. Ensure the callback timer is removed when all tasks are done. 2013-07-20 Michael Petch * eval.c lib/neuralnet.c, lib/neuralnet.h: Remedy a bug that produced inconsistent results when producing non-SIMD builds. Make sure that EvaluateFromBase is using comparable nets when using a neural net shortcut. 2013-07-17 Michael Petch * analysis.c, dbprovider.c, eval.c, gnubgmodule.c, gnubgmodule.h, multithread.c, lib/inputs.c, lib/neuralnetsse.c, lib/simd.h: Fix stack issues that cause AVX WIN32 builds to segfault when optimizations are used. 2013-07-17 Michael Petch * sound.c: Allow GNUBG to build on OS/X builds using the CLang compiler. CLang supports AVX instructions. GCC shipped by Apple is based upon the older 4.2 version of GCC. 2013-07-12 Michael Petch * sound.c: On systems using libcanberra it is possible that the canberra sound system may be available, but disabled by default. When the sound context is created enable the canberra sound system explicitly. Bug report (and patch) received from Dan Fandrich. See: http://lists.gnu.org/archive/html/bug-gnubg/2013-07/msg00008.html 2013-07-11 Michael Petch * gnubg.c, utils.h, utils.c: Added a new command line option '-s ' to specify the location of the user's GNUBG preferences directory. This overrides the default location of $(HOME)/.gnubg . If you wish to save your settings to the directory that GNUBG was run from then use '-s .' 2013-07-10 Michael Petch * gtkgame.c: Fixed bug that prevented the stop button in the status bar from being active. 2013-07-10 Michael Petch * +mtsupport.c, Makefile.am, Makefile.w32, bearoffdump.c, makebearoff.c, makehyper.c, multithread.c, multithread.h: Reduce the cpu cycle overhead of the new heap allocated thread local data. Rework the multithreaded code. Split multithreaded support functions out of multithread.c and into mtsupport.c . mtsupport.c can be used by the utiltity programs (makebearoff etc). 2013-07-08 Michael Petch * Makefile.am, bearoffdump.c, eval.c, eval.h, gnubg.c, makebearoff.c, makehyper.c multithread.c multithread.h po/*: Move static thread local data from eval.c into thread local storage (multithread.c). This reduces the bss data size. Thread storage is allocated on the heap as required. Ensure that the data is properly aligned for SIMD usage. 2013-07-06 Michael Petch * lib/inputs.c, lib/simd.h, Makefile.am, configure.ac: Fix an AVX alignment bug while creating the baseinputs for the NN on Win32 platforms with GNUC. * eval.c, gnubgmodule.c, multithread.c, multithread.h, m4/ax_ext.m4: Fix some warnings and general cleanup 2013-06-29 Michael Petch * backgammon.h, gnubg.c, gnubgmodule.c: Added preliminary support for Python module function 'hint'. Work in progress The function interface and the dictionary returned may change. Added module functions mwc2eq_stderr and eq2mwc_stderr. Inefficient memory use for eval and rollout contexts should be cleaned up. Rollout contexts should include all the cube and chequer play sub contexts. The hint dictionary needs to be documented. 2013-06-25 Michael Petch * backgammon.h, gnubg.c, play.c: hint_move has been modified to support external callbacks. Part of future Python integration. 2013-06-25 Michael Petch * eval.c, lib/neuralnet.c: If SIMD instructions are compiled in and they are not supported by the processor, output an error message and then terminate immediately. 2013-06-22 Michael Petch * INSTALL, configure.ac, eval.c, gnubg.c, gnubg.spec, po/POTFILES.in Rename file sse.h to simd.h. Rename USE_SSE_VECTORIZE to USE_SIMD_INSTRUCTIONS, rename SSE_Supported to SIMD_Supported, rename DISABLE_SSE_TEST to DISABLE_SIMD_TEST, rename SSE_CFLAGS to SIMD_CFLAGS Make sse/simd usage more consistent, ./configure option --enable-sse/--disable-sse is now --enable-simd/--disable-simd 2013-06-20 Michael Petch * +m4/ax_check_compile_flag.m4, +m4/ax_ext.m4 +m4/ax_gcc_x86_avx_xgetbv.m4 +m4/ax_gcc_x86_cpuid.m4, configure.ac: Added better autoconf support to determine whether the processor supports certain SIMD instruction sets like SSE,SSE2,AVX etc. --enable-simd behaves a bit different. --enable-simd with no parameters is the same as --enable-simd=yes . The behavior of --enable-simd=yes has been changed to find the latest supported SIMD instruction set used by the build machines CPU. Priority is given in this order (highest first): SSE2, SSE, AVX, None. Since AVX is still experimental it is not given priority over SSE2 during build time autodetection. 2013-06-19 Michael Petch * +output.c +output.h, gnubg.c, backgammon.h, lib/Makefile.am lib/neuralnet.c: Moved the output functions from gnubg.c to their own files. 2013-06-19 Michael Petch * gnubg.c, eval.c, lib/neuralnet.c, lib/neuralnet.h, configure.ac: Add support for plm's new AVX instruction additions. Separate the cputest from the --enable-simd configure option. Created a new option --disable-cputest. Supports cputest functionality on GCC builds with either 64-bit or 32-Bit OSes on Intel processors. Code will work with builds that use -fpic option. 2013-06-18 Michael Petch * gnubg.c: When using the -r flag to start GNUBG (start without reading the gnubgautorc file), the gnugbautorc file will be overwritten with defaults if running with the GUI. Reported by plm, see: https://savannah.gnu.org/bugs/?38497#postcomment 2013-06-17 Michael Petch * gtkgame.c: Fix language bug that prevented the GUI from properly refreshing the screen when a new Language was chosen * Makefile.am: Win32 builds have a localedir of ./locale relative to the executables directory. A bug had newer windows builds seeking locale files in the default locations which was incorrect, and consquently language translation didn't occur. 2013-06-15 Michael Petch * All .c and .h files: Standardized the code formatting with indent -kr -l120 -fc1 -sc -nut -psl . K&R style, 120 column limit process comment in column 1, multiline comments have an asterisk at the beginning of each line, convert all tabs to spaces, and split the return type of a function from the function name (each on their own line). K&R uses 4 spaces for an indentation level. Update the language files. * script/*.py : Reformat the python files to conform to PEP8 standard. See http://www.python.org/dev/peps/pep-0008/#indentation 2013-06-15 Michael Petch * gnubgmodule.c, scripts/gnubg.py: Modify the python interpreter processing so that it falls back to a simple command line interface on older versions of Windows (Versions before WinXP SP2). Fix segfault related to launching the Python command line interpreter 2013-06-15 Philippe Michel * configure.ac, lib/neuralnetsse.c, lib/sse.h, lib/inputs.c: Use AVX instructions when built with "configure --enable-simd=avx" 2013-06-13 Michael Petch * gtkprefs.c: Save board preferences when clicking "OK" on the board appearance configuration dialog. 2013-06-12 Michael Petch * dbprovider.c, dbprovider.h, gtkrelational.c, relational.c, scripts/database.py : Allow hostname to be specified in the database connection dialog box. Hostnames can be any valid combination of hostname:portnumber 2013-06-07 Michael Petch * gtkwindows.c, play.c: Fix a bug that segfaulted the "end game" command when built with GTK and the "-t" option is used to launch GNUBG. 2013-06-06 Michael Petch * gnubgmodule.c, gnubgmodule.h, gtkgame.c, scripts/gnubg.py: Move loading of the Python command line interpreter to Python functions in gnubg.py. The Python command line now supports IPython if present. IPython takes precedence over the standard Python interpreter. If the standard interpreter is used, attempt to load command history (readline module) and then try loading auto completion (rlcompleter module) support if present. Fix Python related ifdefs to allow compiling when built without Python support. 2013-06-05 Michael Petch * scripts/gnubg.py: Add the scripts directory to the Python path so that files in the directory can be imported. 2013-06-05 Michael Petch * gnubgmodule.c, gtkgame.c, play.c: Modify the interactive Python interpreter to support tab completion and command history. Begin reintroducing Python IDLE, since it functions on MS Windows and various linux distros. Ubuntu/Debian installation of IDLE can be done via: apt-get install idle . If IDLE is not present it will drop back to the old method. CLI builds don't use IDLE at present. IDLE is not on the GUI menu but can be activated by turning on the "command" pane and entering '>' (greater than sign without quotes) as a command. IF IDLE is not presnt and usable it will do nothing. This is a work in progress. 2013-06-04 Michael Petch * gtkrelational.c: Don't allow a user to create a player database that already exists. * dbprovider.h, dbprovider.c, scripts/database.py, gnubgmodule.c: Add Mysql support on Win32 platforms using pymysql (a purely python based database driver for mysql) 2013-06-04 Michael Petch * configure.ac, multithread.h: Allow a new autoconf/configure parameter --with-eval-max-threads=size to allow the maximum number of evaluation threads to be specified. Default is 48 if not specified. * dbprovider.h, dbprovider.c, relational.c scripts/database.py: Fix bugs that prevented proper connections and database usage when using the Mysql and Postgres player database providers. Mysql and Postgres are unsupported on the MS Windows platform - Disable them in the GUI 2013-05-31 Michael Petch * play.c: Under certain situations (load commands from a file containing a play command within the GUI) would stop on an assertion. PlayCommand not properly resetting the notification handler. Reported by Ian Shaw 2013-05-28 Michael Petch * gnubg.c: Fix bugs related to python handling of ParseMove and FormatMove . Fix bug that would cause crash when command "load commands" used unquoted filenames on Win32 platform. Reported by Ian Shaw 2013-05-17 Michael Petch * configure.ac eval.h gnubg.weights doc/gnubgdb.xml doc/gnubg/* doc/gnubgman.xml: Version bumped to V1.00.0 . * gnubg.c: Change default MET to Kazaross-XG2.xml 2013-04-13 Philippe Michel * import.c: Interpret some of the comments eXtreme Gammon puts at the start of .mat files to fill match information in and determine game variation. * export.c: Writes similar comments when exporting as .mat 2013-03-26 Philippe Michel * matchequity.c: Recalculate gammon prices after inverting the MET. This is needed for asymetric tables. Problem reported by Maik Stiebler in bug-gnubg. 2013-03-15 Michael Petch * doc/gnubg/* doc/gnubgdb.xml doc/gnubgman.xml: Version bumped to V0.91.0 in the documentation. 2013-03-07 Philippe Michel * gnubg.c: Use stronger default settings for Computer opponent, Tutor and Analysis (2 ply instead of 0 ply) and for rollouts (0 ply checker play and 2 ply cube instead of 0 ply for everything). Increase the default JSDs and minimum trials to stop a rollout early. * eval.c: Use SSE instructions, if available, in the pruning nets computations. This is a small speed improvement but constrains the size of the pruning nets' intermediate layer to be a multiple of 4. 2013-03-06 Philippe Michel * configure.ac, credits.sh, eval.h, gnubg.weights: New nets. Version bumped to 0.91. 2013-02-17 Philippe Michel * format.c: Use EMG by default in matchplay analysis output since these numbers are generally easier to interpret than MWC. 2013-01-23 Philippe Michel * simpleboard.c, simpleboard.h, export.c: Improve export of positions in cairo graphics. Problem reported by Leo Bueno. 2012-10-25 Michael Petch * gnubgmodule.c : Add movetupletostring method to the Python interface. Added support for tuples generated by findbestmove and parsemove. 2012-10-23 Michael Petch * gnubgmodule.c : recent removal of reduced dict item from the Python eval contexts introduced a bug that produced an error processing the noise dict item. Reported by Bagrat Lazaryan 2012-10-21 Michael Petch * play.c, gnubgmodule.c : Fix issue with GNUBG not resigning if the opponent is guaranteed to win a backgammon or a gammon. Discovered in matches played by Murat (R.G.B). Add number of points resigned (1=regular,2=gammon,3=backgammon) to Python resign dictionary item. 2012-10-20 Michael Petch * analysis.c, gtkpanels.c : Fix issues with crawford games. If not using "automatically start next game" and you analyse a game or match in the game preceding the crawford game the next game will not be treated as a crawford game. See: https://savannah.gnu.org/bugs/?35179 Fixed bug with the Crawford flag beneath the board not being properly set when Crawford game is reached. 2012-10-19 Michael Petch * gtkprefs.c, renderprefs.c, set.c : Export of positions/matches didn't honour the board styles when GNUBG launched with -t or was built with --without-gtk option. Reported by Fredrik. See: http://lists.gnu.org/archive/html/bug-gnubg/2012-10/msg00011.html 2012-10-19 Michael Petch * gnubgmodule.c, gnubgmodule.h : Stack alignment issue. On Win32/GCC builds, SSE instructions acting on variables allocated on the stack in Python code would cause a segfault. Properly align stack in Python functions that may call SSE code. Reported by bagratte. See https://savannah.gnu.org/bugs/?37583 2012-10-18 Michael Petch * play.c : Murat (R.G.B) noticed that resignations acted differently in some cases. Found that resignations can be analysed in 0 ply in some places and 2 ply in others. To remain consistent we now compute them at 0 ply. 2012-10-11 Michael Petch * import.c : Fix BGRoom import bug reported by Adi Kadmon where player names were not properly applied to Player 1 and Player 2 (They could be reversed). 2012-10-11 Michael Petch * configure.ac : Configure process modified to support a thread type with --enable-threads default threading is glib threads. Supports win32, glib and no threading 2012-10-08 Philippe Michel * configure.in: This file name is deprecated, rename it to configure.ac. 2012-10-07 Michael Petch * backgammon.h, gnubg.c, configure.in : Convert BUILD_DATE define to literal string before usage. Allow VERSION_EXT environment variable to be passed to autogen.sh to specify an extension on a version number. VERSION_EXT="-mingw" would yield a version that would appear as 0.90.0-mingw . 2012-10-07 Michael Petch * +win32/*, pixmaps/Makefile.am, configure.in, Makefile.am: Added WIN32 resource support (icons etc), and general automake cleanup 2012-09-18 Michael Petch * backgammon.h, dice.c, gnubg.c, gtkoptions.c, set.c, lib/mt19937ar.c lib/mt19937ar.h Better Mersenne Twister seed support when compiled with libgmp. MT Seeds with libgmp support can be full range from 0 to 2^19973-1. To retain backward comaptibility with rolls generated from seeds between 0 and 2^32-1 on previous releases of GNUBG, seeds in this range will be set using the old method. GUI modified to support a seed value between 0 and 2^32-1 instead of 2^31-1 When libgmp support is absent we now support unsigned 32 bit integers rather than signed. When compiling 64bit (without libgmp), seeds will be limited to 32 bit integers. Compile with libgmp to support seeds greater than 32 bits. Note: In previous releases, if libgmp support was present, seeds exceeding 2^32-1 did not work as expected even though the seed appeared to be successfully set. 2012-08-05 Michael Petch * gtkchequer.c: Fix string buffer over run when copying move analysis data. Reported by Mike Mannon, see bug http://savannah.gnu.org/bugs/?37025. TODO: introduce a better way to allocate space for the text buffer. 2012-08-01 Philippe Michel * import.c: Fix some import problems with files exported by eXtreme Gammon and GridGammon. 2012-07-01 Michael Petch * gnubg.c: Added a define NO_OVERLAYSCROLLBARS that can be used to override LIB_OVERLAYSCROLLBARS to be 0 on platforms where overlay scrollbars currently cause problems. The long term fix is to replace GtkCList with GtkTreeview. mdpetch is curretly working on this solution. More information on this problem can be found at: https://bugs.launchpad.net/ubuntu/+source/gnubg/+bug/1002063 2012-06-21 Michael Petch * gtkboard.c: Fix bug reported by motiv4u and Tim Chow that caused edit mode to act oddly when the player on roll is changed. 2012-05-15 Michael Petch * play.c: Fix bug reported on R.G.B. by murat that prevented the GUI from navigating to the next game when a resignation is offered and the "End Game" feature is used. The issue only occurred in 3D view. 2012-05-04 Jon Kinsey * drawboard3d.c: remove no longer needed board resize when cube moves to top of screen. 2012-03-03 Philippe Michel * eval.c: Improve backgammons estimation in race pruning by using the same method than in the regular evaluation. 2011-12-31 Philippe Michel * lib/neuralnetsse.c: Fixes error in sigmoid approximation when using SSE instructions. This will cause occasional small discrepancies in evalation output compared to previous code. 2011-12-07 Philippe Michel * dice.c: fix small modulo bias in dice generation with some RNGs. Affects ansi, bsd, isaac, md5 and mersenne. As a consequence, a match or session started with the same seed can very occasionally unfold differently from how it did before the change. Rollouts using the same seed can give a marginally different result as well. The probability of the dice sequence diverging at each roll is on the order of 1 in 1,000,000,000. Mon Oct 31 12:22:59 CET 2011 Christian Anthon * gtklocdefs.c, gtklocdefs.h, m4/Makefile.am m4/versioncompare.m4: compile on centos5 Mon Oct 31 10:40:01 CET 2011 Christian Anthon * analysis.c, backgammon.h, export.c, format.c, gtkboard.c, gtkgame.c, gtkgame.h, gtklocdefs.c, gtkpanels.c, gtktheory.c, import.c, makebearoff.c, play.c, set.c, sgf.c, board3d/graph.c, board3d/widget3d.c, lib/inputs.c: silence compiler warnings from gcc 2011-09-29 Michael Petch * html.c: BBS Match output rendered with white space when outputting a complete match. Rendering problem was because Strict XHTML DocType. Reported by Chris Yep BBS output cleaned up to validate properly as Strict XHTML 1.0. 2011-09-08 Philippe Michel * import.c: Don't replace spaces by underscores in players' names while importing. 2011-09-02 Michael Petch * gtkboard.c, gtkfile.c, gtkgame.c, gtklocdefs.c, gtklocdefs.h, gtktoolbar.c, gtktoolbar.h, gtkwindows.c: Work around more deprecated functions. 2011-08-30 Michael Petch * Makefile.am, credits.sh gtk-multiview.c, gtkboard.c, gtkexport.c, gtkgame.c, gtkgame.h, gtkgamelist.c, gtkmovefilter.c, gtkmovefilter.h, gtkmovelist.c, gtkmovelistctrl.c, gtkoptions.c, gtkpanels.c, gtkprefs.c, gtkrace.c, gtksplash.c, gtktempmap.c, gtktheory.c, gtktoolbar.c, gtktoolbar.h, gtkwindows.c, set.c, board3d/graph.c, board3d/gtkcolour3d.c, board3d/inc3d.h, board3d/misc3d.c, board3d/widget3d.c, +gtklocdefs.h, +gtklocdefs.c, +gtkuidefs.h: Work around deprecated functions in GTK 2.24, remove direct member access of opaque types, convert GtkItemFactory to GtkUIManager for the menu and toolbars. Building with 2.24 using compile flags -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DGSEAL_ENABLE is a first step to supporting GTK3. Keep the code backward compatible with GTK 2.6 with conditonal expressions. 2011-08-24 Michael Petch * met/Kazaross-XG2.xml: Add XG2 MET generated by Neil Kazaross 2011-08-21 Michael Petch * gtkchequer.c,gtkcube.c: Fixed bug #33781. When doing a chequer play rollout from the hint window, destroy the rollout window when the user hits "Stop" or the rollout finishes. This is the same behavior as doing "Rollout" from the move list in the game record pane. Fix similar issue with cube rollout. Please see https://savannah.gnu.org/bugs/index.php?33781 for additional comments and other coding options to resolve these issues 2011-08-20 Philippe Michel * eval.c: Improve evaluation of late bearoff positions in match play. Problem reported by Neil Robins (in 2009). 0- and 1-ply can still be way off if there is an impending automatic redouble but evaluations with deeper lookahead should be adequate. 2011-08-20 Michael Petch * gnubg.c: Fixed bug #33781. When doing a chequer play rollout from the hint window, detroy the rollout window when the user hits "Stop" or the rollout finishes. This is the same behavior as doing "Rollout" from the move list in the game record pane. 2011-08-20 Michael Petch * gnubg.c: Fixed bug #33141. Under Windows convert file name from locale to utf8 to handle special characters in file names. 2011-08-19 Michael Petch * set.c: Fixed bug reported by Chris Yep. If you use "hint" on a Crawford position, edit the position and remove Crawford flag, and click "Hint" it used the previous position info and produced identical results. Also occurred if using "set crawford" command directly. 2011-08-18 Michael Petch * configure.in, Makefile.am, gnubgmodule.c: Fixed build issues with Mingw/Msys environment. MingW doesn't output Binary data by default to stdout. Use makeweights "-f" argument to output proper binary weights files. On Windows path names need to be properly escaped when passed to the Python interpreter. 2011-08-16 Michael Petch * sound.c, configure.in: Play CoreAudio sounds in the background on OS/X builds. Deficiency found by Louis Zulli. 2011-08-16 Michael Petch * sound.c, configure.in: Play CoreAudio sounds in the background on OS/X builds. Deficiency found by Louis Zulli. 2011-08-16 Philippe Michel * eval.c, eval.h: Add 4ply with large movefilter to predefined play levels. Bump grandmaster movefilter up to large. 2011-08-15 Michael Petch * Makefile.am, configure.in, util.c, board3d/Makefile.am, doc/Makefile.am: better support for Mingw/Msys windows builds. 2011-08-12 Michael Petch * play.c, gtkgame.c, gtkboard.c: Fixed bug #33866 reported by Gerhard. In 3D mode with option "Start new Games immediately" turned off, match would not continue properly if the computer offered a resignation. Also fixes the bug where the resignation flag is not cleared after accepting/rejecting a resignation. Fixed Bug #33701, #33313 - When "Start Game Immediately" option is off, resigning gets the user stuck trying to start a new game. Now allow user to click dice area on board to start new game after a resign. 2011-08-11 Michael Petch * set.c: When importing XGIDs prompt user in positions where person on roll is on top before swapping. In non interactive mode swapping will not occur. This option exists because XG2 swaps players when exporting (default), so person on roll appears on bottom. Unfortunately, XG2 does not change the XGID to account for the change. 2011-08-09 Michael Petch * play.c, gtkoptions.c: A new bug was introduced that broke canceling of a match where bot played bot (or potentially other scenario of automatic play). Fixed an old bug where canceling automated bearoff of the human didn't work properly. Cache size is now reported as MB (Megabyte) not "Mb" (Megabit) 2011-08-07 Michael Petch * set.c: Some imported XGID cube positions were not properly swapped when the board was displayed. Reported by Philippe (plm) 2011-08-07 Michael Petch * play.c: Fixed bug #33143 reported by Kevin McDonough where interrupting a forced move in 2D got into wrong state causing bot not to continue automatic play. 2011-08-03 Michael Petch * gnubgmodule.c: Add PythonParseMove function 2011-08-03 Michael Petch * set.c: Fixed the display of the board when importing XGID's so that they appear *similar* to those HTML positions pasted to websites. Reported by Leo Bueno (on BGO). Assume that most people are using XG2 and exporting with default setting "Player on roll always at the bottom". 2011-08-03 Philippe Michel * gnubg.c, gtkboard.c, play.c, set.c: More fixes to swap players feature. 2011-08-01 Philippe Michel * play.c, gnubg.c, set.c: Fixed display of SETBOARD records in the game record panel (bug #32778). Fixed Game|Swap players for games ending with a SETBOARD record (in practice, games created from a pasted id). 2011-07-29 Michael Petch * analysis.c: Previous getLuckRating change had unintended side effects when we stopped using hard coded values. Hard coded values were off by an approximate factor of 10. Although this has been fixed it may wish to be revisited as to why the values were hardcoded in this fashion originally. Reported by Chris (pck). 2011-07-17 Michael Petch * gnubgmodule.c: Fixed Python position key functions to internally call the old style position keys functions. Fixes compiler errors due to new position key changes made on 2011/07/15. 2011-07-15 Philippe Michel * positionid.c, positionid.h, lib/cache.c, lib/gnubg-types.h: Use a simpler position key for internal use. PositionKey() and PositionFromKey() are much faster. The global speed improvement is about 10%. A side effect is that the evalution cache becomes 38% larger. 2011-07-09 Philippe Michel * gnubg.c, gtkgame.c: Set players names from default_names at program launch and when pasting a position id, in addition to when starting a match. 2011-07-08 Philippe Michel * play.c: Update players names in game record panel when starting a new match. 2011-06-13 Michael Petch * analysis.c: getLuckRating was returning values based on old hard coded luck thresholds. Use the user supplied ones instead 2011-06-08 Michael Petch * gnubgmodule.c: Add new python function "DiceRolls" to return the next "n" rolls from the current RNG. 2011-05-18 Michael Petch * configure.in: --enable-threads and --enable-extmatchid are now the default. amd64 cpu types will automatically enable sse2 2011-05-17 Michael Petch * gtkgame.c: Modify the Menu to support copying of GNUBGID's, as well as the MatchId or positionID's individually. 2011-05-17 Michael Petch * configure.in: Modify the ./configure process to now enable Extended match ID's by default. They can be disabled with --disable-extmatchid 2011-05-17 Michael Petch * gnubg.c, backgammon.h, gtkfile.c, gtkrelational.c: The word "Relational" has been removed from the GUI when referring to the database. This makes more sense to the casual users. Fixed the situation where a Batch sometimes had to be preceded by a clear match/session. Fixed bug reported by Leo that prevented matches being analysed with incomplete analysis settings. Fixed bug reported by Leo Bueno that prevented matches that may not have been played to completion from being analysed. Added Warning if you use incomplete analysis settings and have requested to save the matches to the database 2011-05-13 Philippe Michel * eval.c, lib/inputs.c (new file), lib/Makefile.am: Computation of baseInputs() with SSE. The code was already there in eval.c, but commented out. 2011-05-08 Philippe Michel * lib/gnubg-types.h, lib/cache.h, lib/cache.c, backgammon.h, positionid.h, positionid.c, analysis.c, eval.c, export.c, eval.h, gnubg.c, gnubgmodule.c, gtkboard.c, gtkpanels.c, import.c, play.c, rollout.c, set.c, sgf.c, makebearoff.c, makehyper.c: Use a defined type for the position key. Small speed up with faster EqualKeys and CopyKey macros. 2011-04-10 Michael Petch * board3d/drawboard3d.c board3d/fun3d.h board3d/shadow.c: Converted int to GLint where appropriate to avoid compiler warnings about incompatible types in certain build environments. 2011-04-09 Philippe Michel * gtkexport.c, gtkgame.c, gtktempmap.c: Alter some pop-up panels that were too tall too be usable on smaller screens (the OK button was below the bottom of the display). Affected are Settings|Export, Settings|Rollouts and Analyze|Temperature Map. 2011-04-08 Michael Petch * gtkprefs.c: Fixed bug that disallowed import/export board designs from using file names with paths that had spaces on Windows (WIN32) platform. 2011-04-08 Michael Petch * gtkgame.c, play.c: Fixed bug that didn't update the cube properly when navigating from a non crawford game to crawford game. Reported by Ongun Alsac. 2011-04-06 Michael Petch * configure.in, board3d/font3d.c, board3d/inc3d.h: Added better 3dboard autoconf support for Apple build environments. Use Apple OpenGL, and add appropriate check for GTK X windows headers. GTK does not necessarily rely on X as a backend. 2011-04-06 Michael Petch * gnubg.c: Fixed WIN32 specific bug that caused command filenames with spaces to not be processed. Reported by Nardy. 2011-03-23 Michael Petch * gtkboard.c, play.c, gtkgame.c: Fixed bug that caused crawford flag to be unset in the GUI if you changed to a crawford game in the game list. Reported by Phillipe Michel. Fixed bug that caused a new money session to not correctly use the global Jacoby setting in some cases. 2011-03-23 Michael Petch * gtkboard.c: Update global match state with changes in score made through edit mode. Fixes hint/edit bug reported by Pierre Zakia 2011-03-23 Michael Petch * gtkboard.c: Did cleanup of new Jacoby code. Modified the edit GUI to enforce proper Crawford settings when editing. If scores and match length make Crawford impossible, disable Crawford toggle and turn off Crawford until settings make it possible 2011-03-22 Michael Petch * gnubg.c, gtkgame.c, gtkboard.c, matchid.c, play.c set.c, gtkboard.h: Improve support for Jacoby. - When using extended Match ID's - Jacoby comes from the ID, - When using regular ID's Jacoby is decided by the global "Jacoby" setting in options. - Fixed bug with Jacoby being read from an extended ID. - Added Jacoby flag to the table. When MatchLen is 0 (money session) Crawford flag replaced by Jacoby and vice versa. - Fixed some editing issues with Crawford 2011-03-22 Michael Petch * gtkgame.c, simpleboard.c, gnubgmodule.c, matchid.c matchid.h, configure.in, play.c : Began adding support for an extended matchID that includes Jacoby. While in testing phase ./configure supports --enable-extmatchid and a USE_EXTENDEDMATCHID define in config.h. By default builds do not have this feature turned on. 2011-03-20 Philippe Michel * gnubg.c: Fixed missing handling of MOVE_SETBOARD records in swapGame(). Needed for single positions (bug #32272) and games with illegal moves. 2011-03-19 Philippe Michel * set.c: Don't change the global Jacoby setting when pasting a XGID. 2011-03-17 Michael Petch * gtkgame.c : Fixed ClipBoard copy from the Match statistics dialog that caused both players data to be the same. Added player names to the match statistic tables (treeviews). Reported by Boomslang 2011-03-17 Philippe Michel * positionid.h, eval.c: Speed improvements. 2011-03-16 Michael Petch * gnubgmodule.c : Added GNUBG python module functions: gnubgid, matchid, posinfo ToDo: xgid 2011-03-14 Michael Petch * gnubg.c, sound.c, configure.in : Added support for Apple CoreAudio sound on platforms that are supported. CoreAudio takes precedence over QuickTime. This should allow for native 64bit builds without the need for an external sound player. 2011-03-10 Michael Petch * gnubg.c: Fixed bug with random numbers being read from www.random.org preventing GNUBG from exiting. We now skip HTTP headers and make sure we don't read more numbers than the dice array can hold. Reported by Leo Bueno. 2011-03-07 Michael Petch * board3d/drawboard3d.c: Fixed array indexing issue in drawDice that would cause hangs/crashes on OS/X when "set gui dicearea on" with 3D boards were on. Crash would occur during program startup. May be related to fix commited on 2009-03-26 by Christian. Reported by Pierre Viau. 2011-03-04 Michael Petch * gtkgame.c: Fixed problem with language change getting stuck in loop 2011-02-24 Philippe Michel * gnubg.c: In Tutor/Hint, always evaluate the tried move at the deepest ply. Problem pointed by Michael Depreli in bug-gnubg. 2011-02-14 Philippe Michel * sgf.c, eval.h (comment only), gtkgame.c, gnubg.c, analysis.c: Fixed crash when loading a take or drop saved as a position (bug #32270). Mon Feb 14 21:11:28 CET 2011 Christian Anthon * backgammon.h, commands.inc, gnubg.c, gtkchequer.c, gtkcube.c, gtkexport.c, gtkfile.c, gtkgame.c, gtkmet.c, gtkmovefilter.c, gtkoptions.c, gtktoolbar.c, gtkwindows.c, play.c, set.c: Have different default and current player names. Only change default player names in dialog, not in edit mode. Attempt to autosave settings. Mon Feb 14 18:05:09 CET 2011 Christian Anthon * sound.c: Fix sound in cl interface (unix) 2011-02-13 Philippe Michel * play.c: Fix display of MOVE_SETCUBEPOS in game record panel. Sat Feb 12 22:19:18 CET 2011 Christian Anthon * gtkgame.c: Just one clist to go. 2011-02-10 Philippe Michel * po/ro.po, configure.in, gtkgame.c, flags/romania.png, flags/Makefile.am : Romanian translation by Mihai Varzaru. 2011-02-09 Philippe Michel * eval.c: Small speed improvements. 2011-02-08 Philippe Michel * eval.c, lib/neuralnetsse.c, lib/neuralnet.h : Øystein Johansen's patch to handle a different number of hidden nodes with SSE. Tue Feb 8 20:23:42 CET 2011 Christian Anthon * Makefile.am, backgammon.h, commands.inc, gtkgame.c, R record.c, R record.h: remove the rest of old player records Tue Feb 8 19:54:13 CET 2011 Christian Anthon : : * gtkgame.c: cleanup after previous commit * progress.c: convert the rollout clist to tree view, sortable and simpler, but fewer details than before. Tue Feb 8 19:16:12 CET 2011 Christian Anthon : * gtkgame.c, gtkgame.h: update the evaluation summary to gtk_combo_box Tue Feb 8 18:24:42 CET 2011 Christian Anthon * gtkmovefilter.c: update movefilter selection to gtk_combo_box Tue Feb 8 17:58:05 CET 2011 Christian Anthon * gtkgame.c: update the stats navigation to gtk_combo_box Sun Feb 6 21:04:11 CET 2011 Christian Anthon * Makefile.am, configure.in, gnubgstock.c, gnubgstock.h, gtkgame.c, gtkpanels.c, gtktoolbar.c, gtkwindows.c, gtkwindows.h, pixmaps/Makefile.am, pixmaps/gnubg-stock-pixbufs.h, pixmaps/24x24/actions/anti_clockwise_24.png, pixmaps/24x24/actions/clockwise_24.png, pixmaps/24x24/actions/new0_24.png, pixmaps/24x24/actions/new11_24.png, pixmaps/24x24/actions/new13_24.png, pixmaps/24x24/actions/new15_24.png, pixmaps/24x24/actions/new17_24.png, pixmaps/24x24/actions/new1_24.png, pixmaps/24x24/actions/new3_24.png, pixmaps/24x24/actions/new5_24.png, pixmaps/24x24/actions/new7_24.png, pixmaps/24x24/actions/new9_24.png, pixmaps/24x24/actions/resignsb_24.png, pixmaps/24x24/actions/resignsg_24.png, pixmaps/24x24/actions/resignsn_24.png, R xpm/*: Cleanup of the pixmaps Sat Feb 5 18:27:35 CET 2011 Christian Anthon * gtkpanels.c: one less clist Wed Feb 2 22:00:24 CET 2011 Christian Anthon * gtkgame.c: one less clist. 2011-01-30 Philippe Michel * export.c, commands.inc, file.c, backgammon.h : Export games and matches in Snowie standard text format. 2011-01-23 Philippe Michel * positionid.h : Speed improvement. 2011-01-20 Philippe Michel * export.c : More robust .mat export in case of illegal moves. Stepping stone to Snowie standard text export. 2011-01-10 Philippe Michel * latex.c: Escapes characters reserved by TeX/LaTeX (%, $, _, etc...) + other minor fixes. * gnubg.c, html.c, latex.c, text.c : Should avoid ??-numbered moves in exports. 2011-01-05 Philippe Michel * gtkmovefilter.c, gtktheory.c: Prevent warnings about deprecated usage of GtkSpinButton that appeared with a recent gtk2 update. * gtkgame.c: Decrease absurdly high page_increments in some GtkSpinButtons. * gtktheory.c: Decrease a page_increment that seemed too high. 2010-12-21 Philippe Michel * import.c: Fix handling of resignations in .mat files created by eXtreme Gammon. 2010-11-29 Philippe Michel * gtkcube.c: More unwarranted assertion failures. * speed.c: Fix speed calibrating. 2010-11-21 Philippe Michel * rollout.c: Fix for crashes in rollouts. This is essentially Guido Flohr's patch from the discussion of bug #29880. * gtkcube.c: Avoid assertion failure when asking for a cube decision hint after rolling the dice. Bug #31713. 2010-11-13 Philippe Michel * gtktempmap.c: Retain temperature map's checkboxes status (for a given instance, not in gnubgautorc). Bug/wish #27150. 2010-11-11 Philippe Michel * rollout.c: In multithreaded rollouts, make every alternative stop at the right number of trials instead of when the speediest one reaches it. * progress.c, format.c, format.h, gnubg.c: fix TextOutputProgress() display of match cubes (bug #27149). 2010-11-01 Philippe Michel * play.c: workaround for bug #27178 * backgammon.h, commands.inc, gtkgame.c, html.c: copy position as URL to image.backammonbase.com. Submitted by Noriyuki Hosaka : http://lists.gnu.org/archive/html/bug-gnubg/2010-04/msg00024.html 2010-10-31 Philippe Michel * play.c: don't do luck analysis while playing as highlighting very lucky or unlucky rolls in the game record panel gives away big equity swings. http://lists.gnu.org/archive/html/bug-gnubg/2010-06/msg00034.html * eval.h, eval.c, gtkoptions.c: bump up evaluation cache size default x4 to 21Mb, maximum settable from GUI x2 to 336Mb 2010-10-29 Philippe Michel * NEWS, dice.c, eval.c, gtkpanels.c, show.c: typos Picked from Debian and FreeBSD ports. 2010-10-17 Philippe Michel * file.c: Fix in automatic import. Detect sgg now. * gtkfile.c: In the Open File panel, with supported files filters, show both lowercase and uppercase file extensions. 2010-09-27 Philippe Michel * set.c: XGIDs with large cubes were not correctly decoded Wed Jul 28 16:42:36 CEST 2010 Christian Anthon * set.c: checkers weren't swapped when reading XGIDs Fri Jul 16 21:52:51 CEST 2010 Christian Anthon * gtkboard.c: Allow rolling on both sides and start new game/match as appropriate Fri Jul 16 18:12:30 CEST 2010 Christian Anthon * gtkboard.c: fix redraw bug when navigating an unfinished move where dice are rolled. Fri Jul 16 14:03:13 CEST 2010 Christian Anthon * render.c: fix clockwise display. Bar was reversed. Mon Jul 5 20:00:46 CEST 2010 Christian Anthon * format.c: fix text output of rolled out cube analysis Mon Jul 5 19:39:35 CEST 2010 Christian Anthon * play.c: remove TurnDone from CancelCubeAction. Fixes a batch analyse bug. Fri Jun 25 16:00:08 CEST 2010 Christian Anthon * gtkfile.c: Show the discard dialog before batch analyse starts. Fri Jun 25 10:49:12 CEST 2010 Christian Anthon * backgammon.h, commands.inc, gnubg.c, gtkboard.c, set.c: support for xg ids - please test Thu Jun 24 01:31:48 CEST 2010 Christian Anthon * analysis.c: don't refind move, when none made Sun Jun 20 17:42:38 CEST 2010 Christian Anthon * analysis.c: refind made move after cmark_rollout Sat Jun 19 09:22:16 CEST 2010 Christian Anthon * eval.c, import.c: Fix a counting error in the import match code. Ask if you want to try another variation after the first one fails. 2010-06-02 Philippe Michel * commands.inc, file.c: if an export format is not supported by the build, #if it out of the UI. * configure.in, export.c, gnubgmodule.c : patches by Christopher Hofmann via bug-gnubg@gnu.org 2010-05-29 Philippe Michel * rollout.c: partial fix for stop-on-jsd criterion From http://lists.gnu.org/archive/html/bug-gnubg/2010-01/msg00041.html * matchequity.c: wasteful computations in GetPoints() Pointed by Massimiliano Maini in http://lists.gnu.org/archive/html/bug-gnubg/2009-07/msg00002.html 2010-05-26 Philippe Michel * gtkgame.c: compiles again with pre-2.12 gtk From http://lists.gnu.org/archive/html/bug-gnubg/2009-11/msg00016.html 2010-05-23 Philippe Michel * gtkpanels.c: Crawford game highlighted in the games pulldown in the Game record panel. Bug #28463. * rollout.c: change "Stop when STD is small enough" criterion for rollouts. Parameter is stdev of equity, not the ratio of stdev/value for every output. See rationale at http://lists.gnu.org/archive/html/bug-gnubg/2009-02/msg00035.html and http://lists.gnu.org/archive/html/bug-gnubg/2009-10/msg00159.html * gtkgame.c: GUI change * gnubg.c, sgf.c: older default values for maxerr become inadequate 2010-05-08 Philippe Michel * text.c: fix double output of match statistics in plain text export 2010-05-03 Philippe Michel * gnubg.c: use Rockwell-Kazaross MET by default Tue Dec 29 19:56:07 CET 2009 Christian Anthon * rollout.c: minor fixes: a) check jsd's before rollout b) fix a minor jsd bug where the number of trials where checked for the wrong alternative. c) allow trials to catch up when extending rollouts Tue Dec 29 07:36:41 MST 2009 Michael Petch : * gnubg.c: Fix random.org buffer overrun, Cleanup code and add appropriate User-Agent string Wed Dec 23 22:34:19 CET 2009 Christian Anthon * gnubg.c: random.org has been restructered, update the GET accordingly Sat Dec 12 15:25:58 CET 2009 Christian Anthon * gtktoolbar.c: reset of board when entering edit mode didn't work Mon Nov 30 19:54:56 CET 2009 Christian Anthon * gtkgame.c: add keyboard short-cuts to marked navigation menu items Tue Nov 24 21:51:56 CET 2009 Christian Anthon : * gtkrolls.c: fix a bug where the printed average equity was wrong when MWC printed as EM Sat Nov 21 21:56:58 CET 2009 Christian Anthon * gtkoptions.c, gtkpanels.c: Minor warnings, fix resizing of commentary panel. Fri Nov 13 23:30:00 2009 Jon Kinsey * gtkoptions.c, dice.c: Simplify dice entry method dialog Tue Nov 03 17:30:00 2009 Jon Kinsey * gtkgame.c, gtkboard.c: Improve manual dice selection colours and text Sat Oct 31 21:48:27 CET 2009 Christian Anthon * backgammon.h, gtkgame.c, import.c, timer.c: dnd didn't work under linux at all. Plus minor compiler warnings. Thu Oct 29 11:30:00 2009 Jon Kinsey * gtkgame.c: Allow files to be dropped onto gnubg to open them Bug #27685 suggested by Eric. Mon Oct 26 16:30:00 2009 Jon Kinsey * render.c, gtkboard.c + others: Sort out 2d dice colours when in 3d mode Sun Oct 18 12:30:00 2009 Jon Kinsey * gtkgame.c: Sort out full screen transitions Tue Oct 13 19:30:00 2009 Jon Kinsey * gtkgame.c, gtkboard.c + others: Move gnubgid into status bar Mon Oct 12 21:30:00 2009 Jon Kinsey * gtkgame.c: Simplify player and rollout evaluation settings Fri Oct 9 15:46:17 CEST 2009 Christian Anthon * analysis.c: error in last checkin source and dest reversed Wed Oct 7 21:17:04 CEST 2009 Christian Anthon * analysis.c: protect movelist during autosave Tue Oct 2 04:32:27 MDT 2009 Michael Petch * progress.c: Fix assert/crash when doing a single rollout when no stopall button is present Thu Oct 1 23:04:28 CEST 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc, external.c, gnubg.c, gtkgame.c, gtkoptions.c, gtkprefs.c, gtksplash.c, import.c, multithread.c, multithread.h, play.c, rollout.c, set.c, sgf.c, show.c, speed.c: add autosave functionallity during analysis and rollout. disabled by default -- needs testing. Thu Oct 1 15:18:32 CEST 2009 Christian Anthon * gtktoolbar.c: remove labels from navigation buttons and add previous marked and cmarked buttons. Wed Sep 30 08:57:54 CEST 2009 Christian Anthon * gtkfile.c: quote filename input to Open Commands Wed Sep 30 00:07:22 CEST 2009 Christian Anthon * analysis.c, gnubg.c, gtkchequer.c, gtkcube.c, gtkgame.c, progress.c, progress.h: add button to stop all cmarked rollouts. Fix a few minor cmark navigation problems Tue Sep 29 21:45:37 CEST 2009 Christian Anthon * simpleboard.c: fix a language problem with fonts Wed Sep 23 23:18:09 CEST 2009 Christian Anthon * gtkgame.c: fix problem with inactive navigation buttons Wed Sep 23 23:15:00 CEST 2009 Christian Anthon * gtkgame.c: only update eval/hint settings when sameasanalysis is uncticked. Wed Sep 23 23:07:10 CEST 2009 Christian Anthon * analysis.c, eval.c, evallock.c, gnubg.c, multithread.c, multithread.h, progress.c, rollout.c: use mt rollout code for non-threaded rollouts. Only generate unlocked code with --disable-threads Mon Sep 21 09:41:27 CEST 2009 Christian Anthon * analysis.c, backgammon.h, gnubgmodule.c, gnubgstock.c, gnubgstock.h, gtkgame.c, gtkpanels.c, gtktoolbar.c, play.c, pixmaps/Makefile.am, pixmaps/gnubg-stock-pixbufs.h, pixmaps/16x16/actions/go-prev-marked_16.png, pixmaps/16x16/actions/go_next_16.png, pixmaps/16x16/actions/go_next_cmarked_16.png, pixmaps/16x16/actions/go_next_game_16.png, pixmaps/16x16/actions/go_next_marked_16.png, pixmaps/16x16/actions/go_prev_16.png, pixmaps/16x16/actions/go_prev_cmarked_16.png, pixmaps/16x16/actions/go_prev_game_16.png, pixmaps/16x16/actions/go_prev_marked_16.png, pixmaps/24x24/actions/go-prev-marked_24.png, pixmaps/24x24/actions/go_next_24.png, pixmaps/24x24/actions/go_next_cmarked_24.png, pixmaps/24x24/actions/go_next_game_24.png, pixmaps/24x24/actions/go_next_marked_24.png, pixmaps/24x24/actions/go_prev_24.png, pixmaps/24x24/actions/go_prev_cmarked_24.png, pixmaps/24x24/actions/go_prev_game_24.png, pixmaps/24x24/actions/go_prev_marked_24.png, pixmaps/scalable/actions/go_next_cmarked.svg, pixmaps/scalable/actions/go_next_marked.svg, pixmaps/scalable/actions/go_prev_cmarked.svg, pixmaps/scalable/actions/go_prev_marked.svg: add cmark navigation, move navigation toolbar to main toolbar. Works best with toolbar->icons only. Fri Sep 18 11:40:40 CEST 2009 Christian Anthon * Makefile.am, backgammon.h, configure.in, dbprovider.c, dbprovider.h, gnubg.c, gtkgame.c: allow compiling without sqlite even when found. Notice that HAVE_SQLITE is now USE_SQLITE in your config.h Fri Sep 18 00:37:23 CEST 2009 Christian Anthon * gtkcube.c: Print cubeless details in take/drop for EVAL_ROLLOUT. Wed Sep 16 23:30:00 2009 Jon Kinsey * gtkgame.c + others: Simplify analysis gui settings Tue Sep 13 06:30:12 MDT 2009 Michael Petch * eval.c: Properly initialize all thread specific data to NULL Tue Sep 13 00:03:19 MDT 2009 Michael Petch * analysis.c: Fixed non threaded build errors Sat Sep 12 21:41:50 CEST 2009 Christian Anthon * gtkchequer.c: Update board on MoveListMove to allow it to work with tutor. Sat Sep 5 14:10:46 CEST 2009 Christian Anthon * gtkmovelist.c: Fix a bug where worst move were reported as outside the list. Tue Sep 4 00:48:46 MDT 2009 Michael Petch * eval.c: Increased bits for score keys to allow appropriate hashing for matches upto 64away-64away corresponding to the current maximum match length of 64. Tue Sep 4 00:41:50 MDT 2009 Michael Petch * sgf.c: FIXED: cmark data is not restored properly when an SGF file is opened. The last candidate move for each position will lose its cmark status. Tue Sep 1 22:41:46 CEST 2009 Christian Anthon * gnubgmodule.c: Avoid calling PyRun_File to allow linking against official windows python. Needs testing. Tue Sep 1 21:12:24 CEST 2009 Christian Anthon * eval.c, eval.h, gtkgame.c, rollout.c, rollout.h: silence prototype warnings Tue Sep 01 19:30:00 2009 Jon Kinsey * eval.c: Remove noise entry from cache key and increase plies size Tue Sep 01 19:00:00 2009 Jon Kinsey * various files: Remove the (currently unused) reduction evaluation code. Sun Aug 30 22:00:00 2009 Jon Kinsey * eval.c/.h, rollout.c/.h, cache.c/.h, multithread.c: Try to speed up single threaded code in multi-threaded build. Sat Aug 22 22:50:38 CEST 2009 Christian Anthon * backgammon.h, commands.inc, format.c, gnubg.c, gtkgame.c, rollout.c, set.c: Simplify stop on jsd by just having one option. Sat Aug 22 22:40:22 CEST 2009 Christian Anthon * gnubg.c: silence unknown keyword error during load of rc files Fri Aug 21 23:02:38 CEST 2009 Christian Anthon * play.c: fix problems with storing computer cube evals Fri Aug 21 18:22:55 CEST 2009 Christian Anthon * gnubg.c: check for et == EVAL_NONE before displaying skills Fri Aug 14 21:05:09 CEST 2009 Christian Anthon * dbprovider.c: width has size of size_t, which is different from int on 64 bit platforms causing crash on db lookup Tue Aug 11 22:45:52 CEST 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc, gnubg.c, gtkgame.c, set.c, show.c: Remove set analysis move limit. Didn't do any good. Mon Aug 10 21:15:32 CEST 2009 Christian Anthon * eval.c: more or less revert to a cleaned up version of FindBestMoveInEval, but declare pm a volatile pointer. Sat Aug 8 20:07:51 CEST 2009 Christian Anthon * gnubg.c: hint didn't annotate MOVE_DROP Sat Aug 8 14:42:20 CEST 2009 Christian Anthon * eval.c: clean up the prune evaluation function (FindBestMoveInEval) and circumvent a compiler bug causing invalid prune evaluation on certain systems using gcc compiler optimization. This is a critical function and should be optimized further if possible. Thu Aug 6 10:44:28 CEST 2009 Christian Anthon * play.c: destroy pmr_hint on changed dice Wed Aug 5 18:21:59 CEST 2009 Christian Anthon * gnubgmodlule.c: remove inline from DictItemSteal, isn't inlined by gcc, and pointless anyway. Mon Aug 3 23:57:49 CEST 2009 Christian Anthon * gnubg.c, gtkgame.c, gtksplash.c, show.c, util.c, util.h: add options to specify datadir, pkgdatadir and docdir Tue Jul 21 11:52:24 CEST 2009 Christian Anthon * backgammon.h, commands.inc, gnubg.c: add command to turn off output Thu Jul 16 22:55:06 CEST 2009 Christian Anthon * po/da.mo, progress.c: port rollout stat page to gtk_tree_view Thu Jul 9 21:12:42 CEST 2009 Christian Anthon * play.c: fix a problem with disappearing dice when Previous reaches game border and let Next and Previous Marked skip game borders Tue Jul 07 12:00:00 2003 Jon Kinsey * gtkgame.c: Tidy stop button Tue Jun 30 12:00:00 2003 Jon Kinsey * neuralnet.c, gnubg.c,eval.c: Simplify SSE, now it's either supported or it isn't Tue Jun 30 09:10:24 CEST 2009 Christian Anthon * po/da.mo, board3d/Makefile.am, po/POTFILES.in, po/cs.po, po/da.po, po/de.po, po/en_US.po, po/es.po, po/fr.po, po/gnubg.pot, po/is.po, po/it.po, po/ja.po, po/ru.po, po/tr.po: update the danish translation and remove misc3d.h from Makefiles and POTFILES.in Mon Jun 29 20:00:00 2003 Jon Kinsey * neuralnet.c, gnubg.c: Add check for SSE2 Thu Jun 25 22:50:54 CEST 2009 Christian Anthon * gnubg.c, gtkfile.c: fix a problem with translated text in the save dialog used for the "save" command. Wed Jun 24 22:19:44 CEST 2009 Christian Anthon * backgammon.h, commands.inc, gtkgame.c, play.c, set.c: add a menu point to clear turn (dice and cubes) and add the functionally to the dice widget as a button. Mon Jun 22 05:47:27 CEST 2009 Michael Petch * configure.in, lib/neuralnetsse.c, fixed SSE2 build problems and defaulted Apple OS/X i386 builds to use SSE2 Sun Jun 21 23:21:36 CEST 2009 Christian Anthon * configure.in, lib/neuralnetsse.c, lib/sigmoid.h: check Øysteins sigmoid sse2 patch in. Sun Jun 14 22:00:00 2003 Jon Kinsey * positionid.c: Rewrite position key functions (hopefully faster) Sat Jun 13 02:04:28 CEST 2009 Christian Anthon * err? gmon.out, Makefile.am, Makefile.w32, TODO, configure.in, matchequity.c, matchequity.h, board3d/Makefile.am, board3d/Makefile.win, board3d/drawboard3d.c: minor cleanups after removal of libxml code Wed Jun 12 23:00:00 2003 Jon Kinsey * matchequity.c: Replace libxml code that reads met (code from Øystein) Fri May 8 14:29:05 CEST 2009 Christian Anthon * import.c: fix tmg import of resigns Fri May 8 13:08:57 CEST 2009 Christian Anthon * gnubg.c, html.c, latex.c, text.c: checkin of Philippe Michel's export patch. Wed May 6 21:24:09 CEST 2009 Christian Anthon * gtkfile.c, gtkfile.h, gtkgame.c: Re-implement the load commands menu item Wed May 6 15:44:22 CEST 2009 Christian Anthon * gnubg.c: too good to redouble-pass errors didn't get annotated Tue May 5 22:55:53 CEST 2009 Christian Anthon * backgammon.h, commands.inc, eval.c: add command to clear cache for test purposes Tue May 5 18:08:56 CEST 2009 Christian Anthon * gtktempmap.c: fix font size for locales using comma Sun Apr 26 23:01:07 CEST 2009 Christian Anthon * format.c, format.h, gnubg.c, html.c, progress.c, progress.h, rollout.c, rollout.h: Fix the rollout timer to allow for stopped rollouts and differing number of games done. Print the rollout context in the text progress. Sun Apr 26 01:02:06 CEST 2009 Christian Anthon * rollout.c: mt rollouts stopped one short of the minum number of trials when using jsd or sd criteria. Sat Apr 25 22:01:35 CEST 2009 Christian Anthon * AUTHORS, credits.sh, non-src/credits.c: Add Ingo Macherius to list of code contributors. Fri Apr 24 21:55:27 CEST 2009 Christian Anthon * gnubg.c, renderprefs.c, renderprefs.h: Clean the CommandSaveSettings function up, and fix a (gtk) bug where saving the settings would pop an error message about resource unavailable. Wed Apr 22 18:28:09 CEST 2009 Christian Anthon * progress.c: show the number of trials finished for each of candidates Tue Apr 21 01:08:20 CEST 2009 Christian Anthon * import.c: match wasn't cleared before import of mat files Mon Apr 20 17:46:37 CEST 2009 Christian Anthon * gtkboard.c, play.c: fix a minor problem in quick_roll and dont' call CommandPlay when clicking during computer turn (may crash) Mon Apr 20 17:42:19 CEST 2009 Christian Anthon * gtkrace.c, osr.c: only perform automatic osr when the position is a race and fix a problem in osr with chequers in the 3rd or 4th quadrant Sat Apr 18 23:45:02 CEST 2009 Christian Anthon * gtkchequer.c, play.c: fix two problems with the update of skill labels reported by Philippe Michel. Sat Apr 18 22:29:37 CEST 2009 Christian Anthon * gtkgame.c: set shrink FALSE in the panel pane * rollout.c: fix typo in jsd check causing cube rollouts to stop early Wed Apr 15 19:51:11 CEST 2009 Christian Anthon * import.c: check for bg variations when importing mat. Sun Apr 5 17:16:41 CEST 2009 Christian Anthon * gtkboard.c, gtkgame.c: add labels to the manual dice widget Fri Apr 3 22:04:43 CEST 2009 Christian Anthon * gtkboard.c: Use the player's dice color to chose who wins the opening roll with manual dice. Fri Apr 3 21:45:17 CEST 2009 Christian Anthon * gnubgmodule.c, gtkprefs.c, import.c, multithread.c, play.c, relational.c, text.c: minor compile stuff, an error in the last checkin, and ifdef WIN32 the align in multithread.c Fri Apr 3 13:59:50 CEST 2009 Christian Anthon * backgammon.h, gtkboard.c, gtkchequer.c, play.c: CommandMove didn't accept moves of type 25/16. Thu Apr 2 23:33:25 CEST 2009 Christian Anthon * play.c: hopefully fix a crash related to canceling of manual dice Thu Apr 2 22:32:14 CEST 2009 Christian Anthon * play.c: fix a crash (assert in getCubeDecisionOrdering) when updating the current game annotions. Thu Apr 2 10:13:47 CEST 2009 Christian Anthon * gnubg.c: hint - don't update annotation when working through tutor Wed Apr 1 17:41:13 CEST 2009 Christian Anthon * gtkoptions.c: display options was added twice and rng was update even if unchanged Mon Mar 30 13:52:31 CEST 2009 Christian Anthon * gtkgame.c: rc files should be added before gtk_init Mon Mar 30 10:46:29 CEST 2009 Christian Anthon * gtkgame.c: add highligting to the skill label when take/drop Sun Mar 29 21:25:51 CEST 2009 Christian Anthon * gnubgmodule.c: Avoid calling PythonNextTurn in PythonCommand, since PythonNextTurn always plays the next turn, and the command doesn't imply that. Sun Mar 29 15:50:38 CEST 2009 Christian Anthon * dice.c, dice.h, gnubg.c, play.c, rollout.c: fall back to mersenne twister if dice generator fails Sat Mar 28 23:12:15 CET 2009 Christian Anthon * analysis.c, gnubg.c, gtkcube.c, gtkgame.c: minor fixes to hint/analysis of games with beavers: account for initial double in statistics, but not the following ones and show the take/beaver widget when applicable (i.e. not for raccoons). Sat Mar 28 22:49:14 CET 2009 Christian Anthon * play.c: fix to find the dice after updating the gamelist Sat Mar 28 22:42:43 CET 2009 Christian Anthon * gtkoptions.c, show.c: fix tooltips for rngs and refactor the options page function Sat Mar 28 22:30:41 CET 2009 Christian Anthon * m4/az_python.m4: detect python2.5 and python2.6 Sat Mar 28 22:16:21 CET 2009 Christian Anthon * commands.inc, gnubg.c: fix a few command help strings Sat Mar 28 22:11:39 CET 2009 Christian Anthon * eval.c: delete a debug message and reformat a few things Thu Mar 26 13:56:00 CET 2009 Christian Anthon * gtkboard.c: don't call update_move in board size allocation, leads to a hang. Thu Mar 26 11:48:33 CET 2009 Christian Anthon * analysis.c, eval.c, play.c, sgf.c: make hint and cmark features work together and fix save match / hint bug report by Philippe Michel. Wed Mar 25 22:30:30 CET 2009 Christian Anthon * eval.c, play.c: sort moves according to "back" chequer as a last resort in analysis and computer moves to avoid some silly looking moves when the game is over, but not resigned yet. Wed Mar 25 11:48:28 CET 2009 Christian Anthon : * gtkboard.c, gtkoptions.c: minor pips/epc display changes Wed Mar 25 11:05:57 CET 2009 Christian Anthon * backgammon.h, eval.c, gtk-multiview.c, gtkgame.h, html.c, relational.c: fix minor compiler warnings Wed Mar 25 00:44:46 CET 2009 Christian Anthon * analysis.c, analysis.h, backgammon.h, commands.inc, formatgs.c, formatgs.h, gnubg.c, gtkgame.c, html.c, record.c, record.h, relational.c, relational.h, text.c: Remove the player records (may still be viewed if existing). Add simple stats from the relational db to html and text exports Wed Mar 25 00:39:33 CET 2009 Christian Anthon * export.c, gnubg.c, html.c, play.c, sgf.c, text.c: don't create a hint move record when we gs!=GAME_PLAYING Mon Mar 23 09:54:12 CET 2009 Christian Anthon * gtkgame.c: gtkcubehint shouldn't be modal either. Sun Mar 22 23:33:50 CET 2009 Christian Anthon * gnubg.c, gtkchequer.c, gtkchequer.h, gtkcube.c, gtkcube.h, gtkgame.c, gtkgame.h: only update the annotation when we have a move history. * matchid.c: sign warning Sun Mar 22 22:00:17 CET 2009 Christian Anthon * gtkfile.c, relational.c : add an open button and an option to add to the relational database when done. Sun Mar 22 09:24:09 CET 2009 Christian Anthon * set.c: destroy pmr_hint in CommandSetTurn Sat Mar 21 22:44:02 CET 2009 Christian Anthon * analysis.c, analysis.h, backgammon.h, eval.h, gnubg.c, gtkboard.c, gtkchequer.c, gtkcube.c, gtkcube.h, gtkgame.c, gtkgame.h, gtkpanels.c, gtktoolbar.c, html.c, matchid.c, matchid.h, play.c, set.c, simpleboard.c, text.c, lib/gnubg-types.h: another bunch of hint related changes. Sat Mar 21 11:44:35 WEST 2009 Øystein Johansen * gtkprefs.c: Parse XML-boards with g_markup_parse. Fri Mar 20 21:37:46 WEST 2009 Øystein Johansen * boards.xml: Change encoding to UTF-8. Fri Mar 20 17:17:44 CET 2009 Christian Anthon * Makefile.am, configure.in, gnubg.c, sound.c: use libcanberra as a simple sound wrapper and remove gstreamer support Tue Mar 17 14:23:23 CET 2009 Christian Anthon * sound.c: make gstreamer sounds wait till play is ready Fri Mar 13 22:50:48 CET 2009 Christian Anthon * backgammon.h, gnubg.c, gtkchequer.c, gtkchequer.h, gtkcube.c, gtkcube.h, gtkgame.c, gtkgame.h, gtkgamelist.c, html.c, play.c: fix the color for chosen move problem. Attempt to keep the gamelist annotation marks up to date. Fri Mar 13 17:23:57 CET 2009 Christian Anthon * gtkgame.c, gtkmovelist.c, gtkmovelistctrl.c: fix double-click move in movelist crash. Add star to mark chosen move. Thu Mar 12 22:08:49 CET 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc, export.c, gnubg.c, gtkgame.c, gtkoptions.c, html.c, play.c, set.c, sgf.c, show.c, text.c: hopefully fix the problems introduced by the hint changes Tue Mar 10 17:50:43 CET 2009 Christian Anthon * backgammon.h, commands.inc, gnubg.c, gtkboard.c, gtkboard.h, gtkgame.c, gtkoptions.c, renderprefs.c, set.c: minor changes to pip count display Tue Mar 10 14:08:18 CET 2009 Christian Anthon * backgammon.h, gtkgame.c: Minor changes to BUILD_DATE use Sat Mar 7 21:47:05 CET 2009 Christian Anthon * Makefile.am, backgammon.h, bearoff.c, boardpos.c, commands.inc, common.h, configure.in, dice.c, dice.h, gnubg.c, gtkgame.c, gtkmovelistctrl.c, gtkoptions.c, htmlimages.c, import.c, render.c, set.c, show.c userrng.c, board3d/gtkcolour3d.c, lib/md5.h: Various autoconf centered cleanups. Wed Mar 4 23:07:11 CET 2009 Christian Anthon * backgammon.h, credits.sh, gnubg.c, gtkgame.c: use configurable BUILD_DATE instead of __DATE__ to mark the build. Update copyright notice. Tue Mar 3 14:19:11 CET 2009 Christian Anthon * Makefile.am, configure.in, m4/az_python.m4: improve python detection Tue Mar 3 13:53:25 CET 2009 Christian Anthon * htmlimages.c, render.c: allow compilation without cairo Tue Mar 3 13:42:13 CET 2009 Christian Anthon * bearoff.c, gtksplash.c: minor cleanup * gtkprefs.c, matchequity.c: allow compiling without xml Mon Mar 2 10:35:14 CET 2009 Christian Anthon * eval.c, eval.h, osr.c: use swap_us * osr.h, osr.c: conflicting definitions of raceProbs * gtkmet.c: the meaning of const int a[][] and const int **a is not defined in C. We need confusing casts to avoid warnings in gcc. Sun Mar 1 10:02:02 CET 2009 Øystein Johansen * makebearoff.c, bearoff.c: Repair building of onesided bearoff databases w/o gammon distributions. Fixed heuristic bearoff databases. (HEURISTIC_C => 15) Mon Feb 23 20:55:11 CET 2009 Christian Anthon * gtkcube.c: fix a bug in cubehint Sun Feb 22 23:38:44 CET 2009 Christian Anthon * backgammon.h, export.c, gnubg.c, gtkchequer.c, gtkchequer.h, gtkcube.c, gtkcube.h, gtkgame.c, gtkgame.h, gtkmovelist.c, html.c, latex.c, play.c, set.c, sgf.c, text.c: fix the hint functionality, so that it normally works on the moverecord, or at the end of the game, creates a tmp moverecord. Make sure that it is used in exports and saves. Sun Feb 22 10:02:42 CET 2009 Christian Anthon * eval.c, eval.h, gtkboard.c: fix the legal dest points function once and for all Sat Feb 21 22:05:58 CET 2009 Oystein Johansen * removed file: makebearoff.rc Wed Feb 18 00:12:58 CET 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc, eval.c, eval.h, gnubg.c, gtkchequer.c, gtkchequer.h, gtkcube.c, gtkcube.h, gtkgame.c, gtkmovelist.c, gtkmovelistctrl.c, play.c, progress.c, progress.h, sgf.c: Add functionality to mark moves and cubes for rollout Sat Feb 7 09:56:10 CET 2009 Christian Anthon * po/it.po: Update the italian translation Fri Feb 6 14:02:25 CET 2009 Christian Anthon * gnubg.c, gtkgame.c, gtkwindows.c, gtkwindows.h, progress.c: Clean up the rollout command. It hardly ever did what people wanted anyway. Now only roll-outs the current position. Fri Feb 6 11:05:29 CET 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc, play.c, progress.c: Add a Command "analyse rollout double". Warn if user tryes to use analyse move on a take. Print final result if user interrupts rollouts in the cl interface. Tue Feb 3 21:43:32 CET 2009 Christian Anthon * backgammon.h, play.c: remove quick_roll from non-gtk code Sun Feb 1 16:59:04 CET 2009 Christian Anthon : * gtkboard.c, play.c: New games/matches could be started when ms.gs==GAME_NONE even though the move wasn't the last in the match Sun Feb 1 16:48:01 CET 2009 Christian Anthon * htmlimages.c: fix creation of htmlimages in the export dialog Sat Jan 31 15:21:55 CET 2009 Christian Anthon * format.c, gtkchequer.c, gtkcube.c: Make the Copy button open a text window for easy display of analysis details. Thu Jan 29 09:09:16 CET 2009 Christian Anthon * analysis.c: use the right index in the new analyse rollout move function Thu Jan 29 09:07:26 CET 2009 Christian Anthon * bearoff.c: avoid assert_false when hypergammon db present Tue Jan 27 14:40:32 CET 2009 Christian Anthon * doc/allabout.xml, doc/gnubgdb.xml, doc/gnubg/allabout.html, doc/gnubg/allabout.pdf, doc/gnubg/gnubg.6, doc/gnubg/gnubg.html, doc/gnubg/gnubg.info, doc/gnubg/gnubg.pdf, doc/gnubg/gnubg.texi: Update document license to GFDL 1.3. Mon Jan 26 12:09:19 CET 2009 Christian Anthon * progress.c: jSD not printed in text interface for fCubeRollout. Mon Jan 26 10:49:56 CET 2009 Christian Anthon * rollout.c: fix stop on stds in the MT code. May well be broken in the non-MT code as well. Sun Jan 25 16:21:08 CET 2009 Christian Anthon * gtkboard.c, play.c: Clicking anywhere on the board before first match is started starts a new match. Clicking in the dice area either starts a new game or roll the dice as appropriate. Sat Jan 24 21:31:10 CET 2009 Christian Anthon * analysis.c, backgammon.h, commands.inc: Add a command to rollout the current analysed move. "analyse rollout move 1 2 3" will rollout the first three candidates in the movelist. Fri Jan 23 09:34:07 CET 2009 Christian Anthon * board3d/drawboard3d.c: Protect some function calls if shadows not initialised. Thu Jan 22 23:33:24 CET 2009 Christian Anthon * eval.c, rollout.c: Stop adding noise to EvalOver and to the variance reduction. Thu Jan 22 12:42:57 CET 2009 Christian Anthon * relational.c: Asume that sql always uses . for decimal separator in input/output. Sat Jan 17 21:57:31 CET 2009 Christian Anthon * rollout.c: Fix a small bug in BasicRollout. The first move (0-ply) in the variance reduction was cubeless, regardless of the cube setting. Only the cubeful 0-ply rollouts should be affected with infinite trials, but the variance reduction will change a bit for all rollouts. Sun Jan 11 21:32:44 CET 2009 Christian Anthon * progress.c, progress.h, rollout.c, rollout.h: The JSD printed for cube rollouts is now sensible. Top JSD for nodouble / double decision and buttom JSD for take / pass decision. (MT code only) * rollout.c: minor cleanup in JSD for cubeless possible since the cube rollouts are always cubeful. Sun Jan 11 01:06:47 CET 2009 Christian Anthon * play.c: Add warning and cancel if fDoubled is set in SetMatchID Sun Jan 11 00:07:30 CET 2009 Christian Anthon * play.c: Allow canceling of dice on the first roll a match Sat Jan 10 21:16:19 CET 2009 Christian Anthon * gtkgame.c: Make edit_new more smooth, and work with more obscure options Fri Jan 9 14:06:05 CET 2009 Christian Anthon * play.c: set matchid was missing a call to AddGame Fri Jan 9 13:00:25 CET 2009 Christian Anthon * set.c: set turn should invalidate the gtk dice as well as the match state ones. Fri Jan 9 11:29:14 CET 2009 Christian Anthon * bearoff.c: fix bug also printing 1-sided in bearoffstatus Thu Jan 8 21:32:44 CET 2009 Christian Anthon * gnubg.c, gtkgame.c: use autoimport for loading from commandline Thu Jan 8 12:25:27 CET 2009 Christian Anthon * gnubg.c, play.c, po/cs.po, po/da.po, po/de.po, po/en_US.po, po/es.po, po/fr.po, po/gnubg.pot, po/is.po, po/it.po, po/ja.po, po/ru.po, po/tr.po: Collect the check for last move in one function and let GetInputYN return TRUE when run non-interactively. Update the translations. Sat Jan 3 23:53:54 CET 2009 Christian Anthon * backgammon.h, gtkgame.c, gtkgame.h, play.c, render.c, set.c: Change confusing use of types in SetRNG, and other minor stuff Tue Dec 30 18:12:45 2008 Jon Kinsey * render.c: Minor adjustment to 2d arrow size and outline colour. Tue Dec 30 11:12:45 2008 Jon Kinsey * gtkgame.c, play.c: Add warning for simplified resign action. Tue Dec 30 00:36:27 CET 2008 Christian Anthon * gnubg.c, gtkboard.c, gtkgame.c, play.c: add "resign -1" as a command to guess the resign level and add appropriately (i.e. resign if the error is below 0.05). Use it to autoresign or pop the resign dialog in the gui. Mon Dec 29 23:12:45 2008 Jon Kinsey * gtkgame.c, gnubg.c: Fix rare crash on exit. Mon Dec 29 23:12:45 2008 Jon Kinsey * util.c: Hack GetTemporaryFile() so it will work properly. Mon Dec 29 22:06:40 CET 2008 Christian Anthon * common.h, configure.in, lib/neuralnet.c, lib/neuralnetsse.c: move replacement declarations of signbit and lrint to common.h Mon Dec 29 22:03:44 CET 2008 Christian Anthon * common.h, configure.in: Mon Dec 29 21:11:31 CET 2008 Christian Anthon * po/es.po: updated spanish translation Mon Dec 29 11:56:38 CET 2008 Christian Anthon * gnubg.c: turn splash screen off by default Mon Dec 29 11:36:28 CET 2008 Christian Anthon * play.c: make end game work without gtk Mon Dec 29 00:08:28 CET 2008 Christian Anthon * util.c: fix CreateTempFile to something that hopefully works universally Thu Dec 28 22:12:45 2008 Jon Kinsey * gtktoolbar.c: Fix size of edit button * gtkgame.c: Fix menu toolbar state (on startup) Sun Dec 28 01:18:17 CET 2008 Christian Anthon * eval.c: fix a bug in eval lookup in hypergammon db. iPos was (by accident) made an unsigned short int in november 2004, but should be at least an int. Fri Dec 26 00:33:04 CET 2008 Christian Anthon * gtkprefs.c, gtktoolbar.c: we don't use the old tooltip api anymore Thu Dec 18 22:12:45 2008 Jon Kinsey * gtkprogress.c: Fix bug in number of rollouts displayed when alternatives finish early (reported by Bob Koca) Wed Dec 17 22:12:45 2008 Jon Kinsey * gtkprefs.c: Replace clist control with tree view Wed Dec 17 10:12:45 2008 Jon Kinsey * util.c: Dodgy temp file fix to get export to gol working. Tue Dec 16 22:12:45 2008 Jon Kinsey * gtkmovelist.c, gtkmovelistctrl.c: Draw move analysis lines closer together. Sun Dec 14 20:12:45 2008 Jon Kinsey * gtktoolbar.c: Sort out spacing on toolbar with new "end game" button. Update toolbar code to new style at same time. Sun Dec 14 18:41:20 CET 2008 Christian Anthon * import.c: issue warning when importing matchfiles with length > MAXSCORE Sun Dec 14 11:12:45 2008 Jon Kinsey * play.c: Sort out "stop" button for "end game" and gnubg vs gnubg. Fri Dec 12 22:12:45 2008 Jon Kinsey * play.c: Add warning when end game clicked. Fri Dec 12 14:57:42 CET 2008 Christian Anthon * gtkboard.c: remove deprecate gtk_drawing_area_size Fri Dec 12 14:05:30 CET 2008 Christian Anthon * gtk-multiview.c, gtk-multiview.h, gtkboard.c, gtkboard.h: remove the deprecated use of GtkType Thu Dec 11 23:11:16 CET 2008 Christian Anthon * backgammon.h, commands.inc, gnubgstock.c, gnubgstock.h, gtkgame.c, gtktoolbar.c, play.c, set.c: minor changes to the end-game button. Tue Dec 9 16:59:54 CET 2008 Christian Anthon * import.c: do not try to import failed formats * gtkfile.c: output not recognized format in batch analyse, when appropriate. Do not try to set non-valid files and directories in the file selection dialog (Savannah bug). Tue Dec 9 14:03:52 CET 2008 Christian Anthon * analysis.c: fix a bug causing wrong luck stats in matches as reported on savannah Tue Dec 9 01:32:30 CET 2008 Christian Anthon * gnubg.c, sound.c: missing frees Mon Dec 8 22:22:19 CET 2008 Christian Anthon * backgammon.h, commands.inc, gnubgstock.c, gnubgstock.h, gtkgame.c, gtktoolbar.c, play.c, pixmaps/Makefile.am, pixmaps/gnubg-stock-pixbufs.h, pixmaps/16x16/actions/runit_16.png, pixmaps/24x24/actions/runit_24.png: Add a quickgame button Mon Dec 8 21:29:12 CET 2008 Christian Anthon : * gtkgame.c: UserCommand("set ..."); may have strange sideeffects through GTKSet, and cannot be used in edit_new Dec 5 10:30:38 CET 2008 Christian Anthon : * bearoff.c, bearoff.h: disable gmappedfile code when glib is old, and fix a bug causing a crash when mapping of the bearoffdb fails. Thu Dec 4 23:11:23 CET 2008 Christian Anthon * file.c, gnubg.c, gtkcube.c, gtkgamelist.c: more minor memory errors Wed Dec 3 12:06:57 CET 2008 Christian Anthon * gtktheory.c: remove missed debug stuff Wed Dec 3 11:51:33 CET 2008 Christian Anthon * dice.c, dice.h, gnubg.c: free gmp random data * gtkboard.c: init bd->cube and remove unused widget from board_init * gtkgame.c: the list returned by gtk_container_get_children should be freed * gtkgamelist.c: widget destroy doesn't work (gtk bug) * gtkprefs.c: free the xml parser context * gtkwindows.c: we cannot rely on the response cb to free the data as the widget may be destroyed in other ways * board3d/drawboard3d.c, board3d/misc3d.c: simple frees Tue Dec 2 01:19:31 CET 2008 Christian Anthon * gnubg.c, gnubgmodule.c, gnubgmodule.h: Py_SetProgramname should be parsed argv[0]; * gtkboard.c: init bd->turn to avoid a warning from valgrind * gtktheory.c: small memory leak caused by missing g_objec_unref Mon Dec 1 23:07:43 CET 2008 Christian Anthon * gtktempmap.c: make "show equities" more readable Sun Sep 29 19:12:45 2008 Jon Kinsey * gtkgame.c, flags/spain.png: add a spanish flag Mon Nov 24 17:07:00 CET 2008 Christian Anthon * configure.in, po/es.po: add es translation Sat Nov 15 23:32:42 CET 2008 Christian Anthon * gnubgstock.c, gnubgstock.h, gtkgame.c, gtktoolbar.c, pixmaps/Makefile.am, pixmaps/gnubg-stock-pixbufs.h, pixmaps/16x16/actions/resign_16.png, pixmaps/24x24/actions/hint_16.png, pixmaps/24x24/actions/resign_24.png, xpm/resign.xpm: Make a stock item of the resign xpm Tue Nov 11 23:39:30 CET 2008 Christian Anthon * gnubg.c, gtkboard.c, gtkboard.h: fix two minor bugs causing crashes on closing Tue Nov 11 11:59:52 CET 2008 Christian Anthon * backgammon.h, eval.c, eval.h, play.c: Evaluate accept resign at 2ply. Const a few evalcontext's. Mon Nov 10 23:39:32 CET 2008 Christian Anthon * gtkboard.c: fix a bug in LegalDestPoints when skipping pips during bearoff Mon Nov 10 00:18:25 CET 2008 Christian Anthon * gtkgame.c: add notidy flag to the bearoff database creation window Mon Nov 10 00:10:06 CET 2008 Christian Anthon * makebearoff.c: delete special win32 code Sat Nov 1 14:31:07 CET 2008 Christian Anthon * dbprovider.c, dbprovider.h, gnubg.c: fix minor compile problems with and without python Fri Oct 24 17:07:03 CEST 2008 Christian Anthon * dbprovider.c, dbprovider.h, gnubg.c, gnubgmodule.c, gnubgmodule.h, gtkrelational.c, relational.c, relational.h: improve on the inter-dependencies a bit by moving pure database functions to dbprovider.c Wed Oct 22 22:20:42 CEST 2008 Christian Anthon * play.c: delete some debug code that doesn't work anymore Wed Oct 22 22:17:53 CEST 2008 Christian Anthon * gtkboard.c: set the page-size to zero in gtkadjustment for gtkspinbutton to silence a gtk warning in 2.14.3 Wed Oct 22 21:42:38 CEST 2008 Christian Anthon * gtkgame.c, html.c, import.c, makebearoff.c, makehyper.c, makeweights.c, record.c: check the return value of fread, fwrite, and fscanf Wed Oct 22 21:21:45 CEST 2008 Christian Anthon * export.c: check the return value of fwrite to silence a compiler warning. Wed Oct 22 21:10:02 CEST 2008 Christian Anthon * gnubg.c: check the return value of fgets to silence a compiler warning. Wed Oct 22 20:50:55 CEST 2008 Christian Anthon * relational.c: check the return value of fgets to silence a compiler warning. Mon Oct 20 21:15:01 CEST 2008 Christian Anthon * configure.in: die if gtk or board3d is requested but gtk/gtkglext not found Thu Oct 9 22:44:44 CEST 2008 Christian Anthon * play.c: add safeguard questions to avoid accidental destruction of the match when "playing from here" Wed Oct 8 12:16:04 CEST 2008 Christian Anthon * bearoff.c, bearoff.h, format.c, format.h, gtkgame.c, gtkmovefilter.c, gtkmovefilter.h, rollout.c, rollout.h, board3d/drawboard3d.c, board3d/fun3d.h, board3d/misc3d.c, board3d/misc3d.h: remove a number of unused codefragments Sun Oct 5 07:52:09 CEST 2008 Christian Anthon * gtkboard.c: check for legal dest points for normal click moves. Fri Oct 3 11:44:47 CEST 2008 Christian Anthon * gnubgmodule.c: fix a couple of sizeof usage errors introduced by TanBoard Mon Sep 29 11:59:31 CEST 2008 Christian Anthon * backgammon.h commands.inc export.h gnubg.c gtkexport.c, gtkoptions.c gtkrolls.c html.c import.c makebearoff.c, makehyper.c play.c record.c rollout.c set.c show.c text.c, po/Makefile.in.in po/cs.po po/da.po po/de.po po/en_US.po, po/fr.po po/gnubg.pot po/is.po po/it.po po/ja.po po/ru.po, po/tr.po: completed the danish translation and updated a number of strings Sat Sep 27 22:27:05 CEST 2008 Christian Anthon * lib/Makefile.am, lib/neuralnet.c, lib/neuralnet.h, lib/neuralnetsse.c, lib/sigmoid.h: allow a small speedup by inlining the sigmoid function again. Tue Sep 23 21:59:02 CEST 2008 Christian Anthon * gtkmovefilter.c, gtkrace.c, gtkrelational.c, gtkwindows.c, gtkwindows.h: remove GtkSignalFunc as it will be deprecated Tue Sep 23 17:41:15 CEST 2008 Christian Anthon * text.c: fix minor \n output bug Tue Sep 23 17:29:17 CEST 2008 Christian Anthon * configure.in, render.c, pixmaps/Makefile.am: fix a few minor without gtk issues Tue Sep 23 12:44:36 CEST 2008 Christian Anthon * backgammon.h, commands.inc, gnubg.c, gtkboard.c, gtkboard.h, gtkoptions.c, set.c: add option to disable boardgraying Sun Sep 29 19:12:45 2008 Jon Kinsey * gtkboard.c, render.c: Attempt to gray board in edit mode Mon Sep 15 21:20:28 CEST 2008 Christian Anthon * configure.in, pixmaps/Makefile.am: allow building even if gdk-pixbuf-csource is not found Sun Sep 14 22:32:57 CEST 2008 Christian Anthon * : update danish translation and adjust a few strings Thu Sep 4 15:18:09 CEST 2008 Christian Anthon * gtk-multiview.[ch]: port to g_object Tue Sep 2 23:05:52 CEST 2008 Christian Anthon * gtkcolour.c, gtkcolour.h, gtkprefs.c, gtkprefs.h, board3d/gtkcolour3d.c, board3d/misc3d.h, board3d/inc3d.h: use the gtk_color_button, rather than designing our own. Tue Aug 12 19:12:45 2008 Jon Kinsey * board3d files, removed total.bmp: Replace totoal.bmp with text in graph Mon Aug 11 10:48:21 CEST 2008 Christian Anthon * gnubg.c, gnubgmodule.c, gtkcube.c, gtkgame.c, gtkgamelist.c, set.c: update a few strings for translation. Sun Aug 10 01:35:06 CEST 2008 Christian Anthon * gtktempmap.c: improve a bit on printing of equties and best moves Thu Aug 7 15:28:33 CEST 2008 Christian Anthon * configure.in: add options to disable deprecated glib/gtk functions * gtkgame.c, gtktempmap.c: replace gtk_object_weakref with g_object_weakref Thu Aug 7 15:19:09 CEST 2008 Christian Anthon * board3d/gtkcolour3d.c: replace a gtk_combo with a gtk_combo_box * gtkgame.c, gtkrace.c, gtkrelational.c, gtktheory.c: g_object_unref the gtktreemodel in a couple of places where forgotten Wed Jul 30 20:27:26 CEST 2008 Christian Anthon * backgammon.h: issue warning if libintl.h is included too early to avoid libintl_printf warnings under mingw. Wed Jul 30 17:01:07 CEST 2008 Christian Anthon * gtkboard.c, gtkchequer.c, gtkcube.c, gtkgame.c, gtkgame.h, gtkgamelist.c, gtkmovefilter.c, gtkmovelist.c, gtkpanels.c, gtkprefs.c, gtksplash.c, gtktempmap.c, gtktoolbar.h, gtkwindows.c: more deprecated gtk functions Wed Jul 30 13:20:05 CEST 2008 Christian Anthon * gtkboard.c, gtkgame.c, gtkgame.h, gtkoptions.c, gtkpanels.c, gtktempmap.c, gtkwindows.c: port tooltips to the gtk-2.12 version, which is more flexible than the old one (e.g. treeview cells). Allow for tips with the older gtk versions to work as well. Wed Jul 30 12:50:47 CEST 2008 Christian Anthon * play.c: show board when dice rolled if, and only if, fX or fDisplay. Tue Jul 29 00:31:04 CEST 2008 Christian Anthon * gtktheory.c: port to gtk_tree_view Thu Jul 24 14:32:45 CEST 2008 Christian Anthon * gtkrelational.c, gtkrace.c: cleanup of deprecated gtk functions Thu Jul 24 11:36:21 CEST 2008 Christian Anthon * gtkchequer.c, gtkgame.c, gtkprefs.c, gtkrace.c, gtktheory.c: get rid of deprecated functions gtk_notebook_set_page and gtk_paint_string Wed Jul 23 11:34:27 CEST 2008 Christian Anthon * set.c, gnubg.c, gtkgame.c: give a sensible error message if language change fails, i.e. locale unsupported. * gtkwindows.c: don't run gtk_widget_present(parent) if parent isn't realized. Sat Jul 19 23:54:09 CEST 2008 Christian Anthon * bearoff.c, eval.c, osr.c: replace 6, 15 with nChequers and nPoints in a couple of places Fri Jul 18 18:07:38 CEST 2008 Christian Anthon * backgammon.h, credits.sh, gnubg.c, gtkgame.c, gtkgame.h, relational.c, show.c: Changes to allow GTKTextWindow to be called from within a dialog. Make license, etc. be printed as text rather than gtk_lists. Make the intro text conform with the GPL3 suggestion. Minor translational changes. Sun Jul 13 21:07:17 CEST 2008 Christian Anthon * bearoff.c, eval.c, export.c, file.c, gnubg.c, gnubgmodule.c, gtkprefs.c, html.c, import.c, latex.c, makebearoff.c, makehyper.c, makeweights.c, relational.c, rollout.c, sgf.c, text.c, board3d/matrix.c, board3d/misc3d.c: replace fopen with g_fopen to avoid problems with special characters in filenames Sat Jul 12 09:10:43 CEST 2008 Christian Anthon * gnubg.c, renderprefs.c, renderprefs.h: fix places where g_strdup wasn't followed by g_free Fri Jul 11 22:54:46 CEST 2008 Christian Anthon * bearoff.c, dice.c, eval.c, format.c, gnubg.c, show.c, renderprefs.c: fix some printf format related compiler warnings Fri Jul 11 22:48:59 CEST 2008 Christian Anthon * rollout.c: fix type of board in log_game_start Fri Jul 11 11:23:02 CEST 2008 Christian Anthon * rollout.c: move log_name out of globals Mon Jul 7 22:42:20 CEST 2008 Petr Kadlec * eval.c, gnubg.c, gtkgame.c, matchequity.c, render.c, renderprefs.c show.c, sound.c: minor fixes for MSVC compiler happinnes (mainly adding "float" suffix to decimal number literals etc.) Mon Jul 7 12:12:45 2008 Jon Kinsey * rollout.c: Give each thread separate random number context to try and get results the same as single-threaded rollouts. Mon Jul 7 00:22:35 CEST 2008 Christian Anthon * rollout.c: fix multithreaded dice generation and logfiles Mon Jul 7 00:20:52 CEST 2008 Christian Anthon * gnubg.c: print prompt and answer for automatic questions Sun Jul 6 00:00:22 CEST 2008 Christian Anthon * format.c: correct minor error introduced by translational changes Wed Jul 2 00:01:04 CEST 2008 Christian Anthon * backgammon.h, commands.inc, gnubg.c, gtkfile.c, gtkoptions.c, import.c, play.c, set.c, sgf.c, show.c: fix minor problems with the batch analyse function and add an option for setting default answers to yes/no questions. Mon Jun 30 23:12:09 CEST 2008 Christian Anthon * Makefile.am, analysis.c, backgammon.h, bearoff.c, configure.in, dbprovider.c, dice.c, drawboard.c, eval.c, export.c, external.c, file.c, format.c, formatgs.c, gnubg.c, gtkgame.c, gtkmovefilter.c, gtkoptions.c, util.c, pixmaps/Makefile.am, po/cs.po, po/da.po, po/de.po, po/en_US.po, po/fr.po, po/gnubg.pot, po/is.po, po/it.po, po/ja.po, po/ru.po, po/tr.po, po/gnubg-langs/__catstatus.php, mkinstalldirs, po/LINGUAS: fix minor translation problems and update the pot/po files to use glib macros * gnubgi18n.c, gnubgi18n.h: removed as similar functions are provided by glib/gettext Mon Jun 30 19:38:38 CEST 2008 Christian Anthon * po/* m4/*, configure.in: modify gettext and friends to use glib gettext macros Sun Jun 29 21:12:45 2008 Jon Kinsey * analysis.c - gnubg.c: First part of translation string cleanup Tue Jun 24 01:06:38 CEST 2008 Christian Anthon * formatgs.c: make 95% ci interval an interval rather than a number Thu Jun 19 22:00:38 CEST 2008 Christian Anthon * Makefile.am, configure.in, gnubgstock.c, gnubgstock.h, gtkgame.c, gtktoolbar.c, pixmaps/.cvsignore, pixmaps/Makefile.am, pixmaps/gnubg-stock-pixbufs.h, pixmaps/16x16/actions/cancel_16.png, pixmaps/16x16/actions/double_16.png, pixmaps/16x16/actions/hint_16.png, pixmaps/16x16/actions/ok_16.png, pixmaps/24x24/actions/cancel_24.png, pixmaps/24x24/actions/double_24.png, pixmaps/24x24/actions/hint_16.png, pixmaps/24x24/actions/hint_24.png, pixmaps/24x24/actions/ok_24.png, xpm/beaver.xpm, xpm/hint_alt.xpm, xpm/stock_cancel.xpm, xpm/stock_ok.xpm: Make stock icons for double, hint, cancel, accept and reject actions. Remove beaver button and add general purpose double button instead. Thu Jun 19 21:54:55 CEST 2008 Christian Anthon * Makefile.am: add multithread.c to non-threaded build * gtkgame.c: signed/unsigned compiler warning * bearoff.c: signed/unsigned compiler warning (fread returns size_t) Mon Mar 17 21:12:45 2008 Jon Kinsey * multithread.c + others: Simplify multithreaded code a little bit Tue Jun 17 21:13:03 CEST 2008 Christian Anthon * gtktoolbar.c: fix icon sizes Tue Jun 17 16:34:17 CEST 2008 Christian Anthon * bearoff.c: be more silent when db files are missing Tue Jun 17 16:31:10 CEST 2008 Christian Anthon * gtktoolbar.c, xpm/Makefile.am, xpm/gnubg-big.xpm, xpm/stock_edit.xpm, xpm/stock_new.xpm, xpm/stock_open.xpm, xpm/stock_save.xpm, xpm/stock_undo.xpm, xpm/tb_double.xpm, xpm/tb_edit.xpm, xpm/tb_no.xpm, xpm/tb_roll.xpm, xpm/tb_stop.xpm, xpm/tb_undo.xpm, xpm/tb_yes.xpm: use gtk stock icons where directly applicable Fri Jun 13 13:04:19 CEST 2008 Christian Anthon * bearoff.c, bearoff.h, eval.c, configure.in: always mmap datase files using g_mapped_file. Read using fopen rather than open. Various cleanups. * gtkgame.c, util.c: revert some recent visual c++ prompted changes Thu Jun 12 10:23:38 CEST 2008 Christian Anthon * bearoff.c, bearoff.h: more cleanup of unused code Thu Jun 12 00:20:30 CEST 2008 Christian Anthon * bearoff.c, bearoff.h: remove unused code to read non-gnubg exact bearoff databases. Wed Jun 11 16:34:04 CEST 2008 Christian Anthon * dice.c, dice.h, set.c: use fopen instead of open Wed Jun 11 15:06:45 CEST 2008 Christian Anthon * html.c, htmlimages.c, board3d/misc3d.c: replace access by g_file_test Tue Jun 10 10:07:33 CEST 2008 Christian Anthon * gtkame.c, xpm/Makefile.am: use GTK_STOCK_STOP rather than keeping out own copy. Mon Jun 9 17:56:00 CEST 2008 Christian Anthon * M gtkgame.c, gtkwindows.c, gtkwindows.h, pixmaps/Makefile.am, pixmaps/gnubg-big.png, gtksplash.c: move gnubg-big.png out of xpm Mon Jun 9 00:14:45 CEST 2008 Christian Anthon * pixmaps, gtkgame.c, Makefile.am, configure.in: add expected directory structure for the icon. Make a windows .ico file Sat Jun 7 22:41:53 CEST 2008 Christian Anthon * rollout.c: fix a problem with too many trials done. Be a bit more verbose when rolling out in the text interface. * gnubg.c: extend the CommandRollout help Fri Jun 6 17:42:04 CEST 2008 Christian Anthon * Makefile.am, show.c, doc/Makefile.am, util.c, util.h: install documentation in DOCDIR Wed Jun 4 20:27:41 CEST 2008 Christian Anthon * dbprovider.c, show.c, lib/neuralnet.c: minor compiler warnings Wed Jun 4 14:26:16 CEST 2008 Christian Anthon * render.c: fix problems with 2d player turn arrows Wed Jun 4 10:38:36 CEST 2008 Christian Anthon * Makefile.am, board3d/Makefile.am, configure.in: do "PKGDATADIR" the recommended way Wed May 14 10:19:43 CEST 2008 Christian Anthon * gnubg.c, sound.c, sound.h: Make the quiet option work again. Mon May 5 16:29:51 CEST 2008 Christian Anthon * gnubg.c, relational.c, play.c: cleanup of the UserCommand function. Avoid using UserCommand outside gtk. Mon May 5 09:36:34 CEST 2008 Christian Anthon * record.c: fix illegal g_free in RecordRead Sun May 4 21:53:07 CEST 2008 Christian Anthon * gtkgame.c: cleanup use of the word 'session' Sat May 3 00:07:21 CEST 2008 Christian Anthon * gtkgame.c, play.c: allow double command to be used for beavers. Merge double/beaver menu items. Merge take/pass with accept/reject resignation menu items. Tue Apr 29 22:46:50 CEST 2008 Christian Anthon * gtkwindows.c: change GTKMessage to use gtk_text_view and fix a sizing problem on the way. Tue Apr 29 13:11:02 CEST 2008 Christian Anthon * sound.c, gtkoptions.c: minor gstreamer changes. Use sync play of max 6 seconds in gtk sound options. Sun Apr 27 22:15:13 CEST 2008 Christian Anthon * backgammon.h, credits.sh, dice.c, dice.h, drawboard.c, drawboard.h, export.h, format.c, formatgs.c, gnubg.c, gnubgmodule.c, gtkboard.c, gtkboard.h, gtkfile.c, gtkfile.h, gtkgame.c, gtkgame.h, gtkgamelist.c, gtkprefs.c, html.c, htmlimages.c, import.c, latex.c, play.c, progress.c, relational.c, renderprefs.c, renderprefs.h, set.c, sgf.c, show.c, board3d/fun3d.h, board3d/misc3d.c: use const char* in a number of places. Sat Apr 26 19:09:00 CEST 2008 Christian Anthon * bearoff.c, boarddim.h, eval.c, external_y.y, gnubg.c, gnubgmodule.c, gtkfile.c, gtkgame.c, gtkmovelist.c, gtktempmap.c, html.c, htmlimages.c, makebearoff.c, multithread.c, play.c, set.c, sgf.c, sgf_y.y, simpleboard.c, util.c, board3d/font3d.c, board3d/misc3d.c, lib/neuralnet.c, non-src/external_l.c, non-src/external_y.c, non-src/sgf_l.c, non-src/sgf_y.c: #if's to #ifdef for things not normally defined by configure Fri Apr 25 17:33:11 CEST 2008 Christian Anthon * configure.in: try to guess the right sse flag according to cpu type Fri Apr 25 00:04:58 CEST 2008 Christian Anthon * backgammon.h ,gnubg.c ,gtkboard.c ,gtkboard.h ,gtkgame.c ,matchid.c ,matchid.h ,positionid.c ,positionid.h ,set.c: merge position and match ids Mon Apr 21 11:05:10 CEST 2008 Christian Anthon * gnubg.c, sound.c: minor gstreamer issues when compiling without threads or without gtk. * set.c: CommandSetGUIShowWastage needs to be defined when compiling without gtk Sun Apr 20 23:25:42 CEST 2008 Christian Anthon * backgammon.h, gnubg.c, gtkboard.c, gtkboard.h, gtkoptions.c, set.c: make showing of epc wastage optional and fix minor sizing problems. Sun Apr 20 20:36:28 CEST 2008 Christian Anthon * play.c: fix cube tutoring after changes to make the progress indicator async. Wed Apr 16 22:05:24 CEST 2008 Christian Anthon * eval.c: in FindBestCubeDecision. Fix rare case where no double, beaver was returned as double, beaver. Wed Apr 16 20:58:34 CEST 2008 Christian Anthon * Makefile.am, configure.in, gnubg.c, gtkgame.c, gtkoptions.c, set.c, sound.c, sound.h: Change sound system from esound to gstreamer. Fix minor problems in PrompForExit and CommandSetClockwise. Sun Apr 13 23:08:43 CEST 2008 Christian Anthon * file.c: relax recognition of JF Pos files. Sun Apr 13 22:38:55 CEST 2008 Christian Anthon * sound.c, matchequity.c: deal more gracefully with people relocating their program paths. Thu Apr 10 21:33:59 CEST 2008 Christian Anthon * configure.in, Makefile.am: cleanup and remove x86 host test * multithread.c: only align stack when USE_SSE_VECTORIZE Wed Apr 9 21:21:58 UTC 2008 mdpetch * gnubg.c, sound.c: Changed to Apple Quicktime for sound under OS/X rather than ESD This change may be revisted if it is decided to use another sound subsystem * multithread.c, configure.in: modified to support multithreaded version on non Intel system (Apple PPC etc) Sun Apr 6 22:33:51 CEST 2008 Christian Anthon * lib/neuralnet.c: fix minor apple compile problem. Sun Apr 6 22:33:04 CEST 2008 Christian Anthon * INSTALL: update . Mon Mar 31 12:58:06 CEST 2008 Christian Anthon * dbprovider.c, gnubgmodule.c: include stdint.h on win32 Fri Mar 28 15:25:34 CET 2008 Achim Mueller * changed configure.in: new release number 0.9.0 Fri Mar 28 00:40:32 CET 2008 Christian Anthon * gtkrelational.c: rearrange player details and stats view Thu Mar 27 22:37:01 CET 2008 Christian Anthon * po/gnubg.pot, non-src/credits.c, po/it.po: update italian translation Tue Mar 25 14:30:42 CET 2008 Christian Anthon * dbprovider.c: fix a compiler warning when without python and sqlite Tue Mar 18 23:47:53 CET 2008 Christian Anthon * bearoffdump.c, gnubg.c, makebearoff.c, makehyper.c: minor compile problems without threads Tue Mar 18 02:25:32 CET 2008 Christian Anthon * analysis.c, formatgs.c: edit the texts in the game analysis Tue Mar 18 01:54:21 CET 2008 Christian Anthon * po/*.po, po/gnubg.pot: update the translation files Mon Mar 17 21:12:45 2008 Jon Kinsey * credits.sh/c: Update copyright to 2008. Sun Mar 16 22:01:07 CET 2008 Christian Anthon * set.c, gtkgame.c: fix minor problems with the hide/show ids Sun Mar 16 21:56:59 CET 2008 Christian Anthon * credits.sh, gnubg.c, non-src/credits.c, non-src/external_l.c, non-src/external_y.c, non-src/sgf_l.c, non-src/sgf_y.c, non-src/sgf_y.h: minor updates to version printing and to non-src files Sun Mar 16 10:12:45 2008 Jon Kinsey * gtkgame.c, gtktoolbar.c: Change menus: Add menu items for edit position and swap direction toolbar commands. Add option to hide toolbar. Add option to show/hide ids. Remove Python shell item. Put panel items in a sub menu. Move match info to file menu. Sat Mar 15 13:12:45 2008 Jon Kinsey * gtkgame.c: Merge match/session analysis menu items. Thu Mar 13 22:27:26 CET 2008 Christian Anthon * gtkexport.c: change html export type and style sheet to combo_box Thu Mar 13 22:16:39 CET 2008 Christian Anthon * gktoptions.c: change cheat roll and rng choosers to combo_box Thu Mar 13 21:54:24 CET 2008 Christian Anthon * gtkprefs.c: change the wood type to combo_box Thu Mar 13 22:12:45 2008 Jon Kinsey * gtktoolbar.c, gtkgame.c: Move stop button from toolbar to status bar. Thu Mar 13 22:12:45 2008 Jon Kinsey * gtk files: Tidy up some common gtk functions and remove SIG_IO signal. Wed Mar 12 23:06:32 CET 2008 Christian Anthon * gtkgame.c, gtkpanels.c, gtkpanels.h: update game selection menu to gtk_combo_box and remove the redundant names Wed Mar 12 20:36:40 CET 2008 Christian Anthon * gtkgame.c: cleanup the Go menu Tue Mar 11 14:53:12 CET 2008 Christian Anthon * gtkexport.c, gtkgame.c, gtktoolbar.c, xpm/dice.xpm, xpm/leftarrow.xpm, xpm/rightarrow.xpm, xpm/stock_export.xpm, xpm/stock_import.xpm, xpm/stock_stop_16.xpm, xpm/stock_undo_16.xpm, xpm/tb_redouble.xpm: cleanup in the help menu and delete some unused xpms Mon Mar 10 09:12:45 2008 Jon Kinsey * gtkgame.c, gtkfile.c: Remove export button/menu item (use save instead) Sun Mar 9 12:12:45 2008 Jon Kinsey * gtkgame.c, gtkfile.c: Move load commands from menu into load dialog. (and other small changes to this dialog) * gtkexport.c: Move generate html images from file menu into export settings. Sat Mar 8 09:12:45 2008 Jon Kinsey * boardpos.c, render.c: Change 2d direction arrow to look like 3d arrow (smaller and near bearoff tray). Move cube to side of board. Swap position of pieces on bar. Fri Mar 7 22:28:52 CET 2008 Christian Anthon * backgammon.h, gnubg.c, gtkgame.c, gtkpanels.c, board3d/Makefile.am, board3d/gtkcolour3d.c: minor stuff and warnings Fri Feb 29 19:12:45 2008 Jon Kinsey * gtkprefs.c, gtkcolour3d.c: Change 3d previews to use widgets not pixmaps. Thu Feb 28 15:15:08 CET 2008 Christian Anthon * osr.c: fix bug introduced by uint changes Wed Feb 27 21:22:47 CET 2008 Christian Anthon * gtkoptions.c: add reset all to defaults button. * sound.c: fix sound default file bug on windows Tue Feb 26 12:35:23 CET 2008 Christian Anthon * makebearoff.c: don't print progress to stderr unless on a TTY. Mon Feb 25 23:16:26 CET 2008 Christian Anthon * text.c, html.c, latex.c: Allow export of games with beavers/raccoons in them. Mon Feb 25 15:12:08 CET 2008 Christian Anthon * backgammon.h, gnubg.c, set.c, sgf.h: cleanup in lists of commands. Removed declared but undefined, and defined, but unused. Move all declarations to backgammon.h and all lists of commands to gnubg.c. Sun Feb 24 10:12:45 2008 Jon Kinsey * gnubg.c, play.c, multithreaded.c, others: Fix multi-threaded progress indicator. Wed Feb 20 23:52:48 CET 2008 Christian Anthon * relational.c: fix bug caused by APPENDI and APPENDF not being properly {}'ed. * dbprovider.h, relational.c: fix minor compiler warnings. * dbprovider.c: add input string to SQL warnings. Wed Feb 20 23:50:02 CET 2008 Christian Anthon * gtkgame.c: update GTKOutput to use a g_string instead of a list. Sun Feb 17 13:19:58 CET 2008 Christian Anthon * bearoff.c, dbprovider.c, dbprovider.h, gnubg.sql, gnubgmodule.c, gtkrelational.c, gtkrelational.h, relational.c: more relational db changes and a few minor compiler warnings. Added new item to matchstat and gamestat. Fri Feb 15 16:59:43 CET 2008 Christian Anthon * drawboard.c: revert to Jan 19 after accidental checkin (fix board after uint changes) Fri Feb 15 13:03:31 CET 2008 Christian Anthon * .cvsignore, backgammon.h, gtkoptions.c, makebearoff.c, play.c, util.h, board3d/Makefile.am, po/POTFILES.in: minor cleanups and compiler warnings Sun Feb 10 23:21:33 CET 2008 Christian Anthon * backgammon.h, export.c, export.h, file.c, gnubg.c, html.c, play.c, simpleboard.c, text.c: allow cairo ps and pdf to export games and matches Sun Feb 10 11:12:45 2008 Jon Kinsey * gtkoptions.c: Move database settings to options dialog. Sat Feb 9 23:12:45 2008 Jon Kinsey * gtkrelational.c: Put simple stats into relational dialog Sat Feb 9 14:12:45 2008 Jon Kinsey * dbprovider.c, relational.c: Added game stats to database Fri Feb 8 23:11:13 CET 2008 Christian Anthon * Makefile.am, dbprovider.c, relational.h: allow code to compile without python and fix a couple of minor warnings Fri Feb 8 11:24:23 CET 2008 Christian Anthon * Makefile.am, configure.in: compile in native sqlite3 on linux Thu Feb 7 22:12:45 2008 Jon Kinsey * dbprovider.c: Added native sqlite interface. Wed Feb 6 22:12:45 2008 Jon Kinsey * dbprovider.c+.h, gnubg.c, relational.c, gtkrelational.c, database.py: Move relational code out of database.py and into relational.c Sun Feb 3 16:34:37 CET 2008 Christian Anthon * gtkboard.c: size cube and dice widgets according to board size * gtkgame.c, gtkpanels.c, gtkprefs.c, gtkrelational.c, gtktheory.c: replace deprecated gtk_widget_set_usize with gtk_widget_set_size_request Sun Feb 3 01:02:54 CET 2008 Christian Anthon * gnubg.c, relational.c, scripts/database.py: allow creation of default sqlite database in szHomeDirectory. Look for database conf file in szHomeDirectory. MIGHT DISTURB EXISTING USERS? Sun Feb 3 00:47:49 CET 2008 Christian Anthon * gnubg.c, gtksplash.c: disable splash unless asked for. Shorten pauses a bit Thu Jan 31 17:20:11 CET 2008 Christian Anthon * multithread.c: check if g_threads already initialized. Mon Jan 21 00:36:53 CET 2008 Christian Anthon * backgammon.h, dice.c, eval.c, gnubg.c, gtkboard.c, gtkexport.c, gtkoptions.c, import.c, makebearoff.c, makehyper.c, relational.c, render.c, rollout.c, sgf.c: replace uint with unsigned int Sat Jan 19 21:45:51 CET 2008 Christian Anthon * eval.c: fix a potential signed/unsigned problem in crashed net Sat Jan 19 09:58:13 CET 2008 Christian Anthon * drawboard.c: fix board after uint changes Tue Jan 15 22:12:45 2008 Jon Kinsey * gnubg-types.h + others: change board type to unsigned hopefully not breaking anything on the way (esp. bearoff) Tue Jan 15 19:05:58 CET 2008 Christian Anthon * analysis.c, backgammon.h, dice.c, eval.c, gnubg.c, gtkboard.c, gtkexport.c, gtkgame.c, gtkmovelist.c, gtkoptions.c, import.c, makebearoff.c, makehyper.c, multithread.c, play.c, render.c, sgf.c, board3d/drawboard3d.c, relational.c, rollout.c: Fix some minor uint//int gcc warnings Sun Jan 13 09:03:18 CET 2008 Christian Anthon * backgammon.h, bearoff.c, bearoff.h, external_l.l, external_y.y, gnubg.c, gtkgame.c, gtkgame.h, gtkpanels.c, multithread.c, multithread.h, sound.c, sound.h, board3d/fun3d.h, lib/cache.c, non-src/external_y.c, non-src/external_l.c: fix some incomplete or missing prototypes Sun Jan 13 01:07:21 CET 2008 Christian Anthon * bearoffdump.c, gnubg.c, makehyper.c, multithread.c, sound.c: compiler warnings and Sleep is a win32 function Sun Jan 13 00:36:48 CET 2008 Christian Anthon * configure.in, common.h: change how acosf, signbit and lrint are checked for to allow to compile with -Werror Sat Jan 12 23:12:45 2008 Jon Kinsey * sound.c, set.c, gnubg.c: Re-introduce exit sound, but disabled by default Wed Jan 2 15:48:02 CET 2008 Christian Anthon * Makefile.am, doc/Makefile.am, lib/Makefile.am, non-src/Makefile.am, po/POTFILES.in: fix make distcheck * multithread.h: fix typo and add MT_SafeDecCheck Tue Jan 01 21:12:45 2008 Jon Kinsey * relational.c, gtkrelational.c, database.py, gnubg.sql: Simplify relational database by removing "environments". Wed Dec 19 11:06:45 CET 2007 Christian Anthon * lib/cache.c: only lock one level Wed Dec 19 10:32:27 CET 2007 Christian Anthon * Makefile.am, util.c, board3d/drawboard3d.c, board3d/misc3d.h, lib/cache.c: small changes to previous Tue Dec 18 21:12:45 2007 Jon Kinsey * Code changes so -ansi -pedantic (just about) works for gcc on windows. Tue Dec 18 14:14:10 CET 2007 Christian Anthon * set.c, board3d/drawboard3d.c, board3d/fun3d.h, board3d/inc3d.h, board3d/matrix.c, board3d/matrix.h, board3d/misc3d.c, board3d/misc3d.h, board3d/shadow.c, board3d/widget3d.c: let new board3d code compile under linux. Tue Dec 18 14:10:55 CET 2007 Christian Anthon * bearoffdump.c, makebearoff.c, makehyper.c, record.c: make utily programs compile with threads enabled Mon Dec 17 16:33:01 CET 2007 Christian Anthon * lib/cache.c: Fix multithreaded hang when runing quad core with four threads. WaitForManualEvent appears to be broken, at least on glib threads Mon Dec 17 15:06:44 CET 2007 Christian Anthon * Makefile.am, dice.c, dice.h, eval.c, format.c, gnubg.c, gtkgame.c, gtkgame.h: move things around a bit so that utility programs compile without ugly fixes (only without threads for now) Mon Dec 17 15:04:42 CET 2007 Christian Anthon * sgf.c, gtkgame.c, show.c: use %lu instead of casting to uint. Mon Dec 17 14:59:20 CET 2007 Christian Anthon * sounds/Makefile.am, configure.in: we haven't beeen able to recompile the sounds for a long time, so let's stop trying. Sat Dec 15 21:27:19 CET 2007 Christian Anthon * Renamed sgf.y to sgf_y.y and sgf.l sgf_l.l to avoid conflicts with sgf.c * bearoff.c, eval.c, format.c, gnubg.c, gtkgame.c, gtkrolls.c, makebearoff.c, multithread.c, play.c, relational.c, rollout.c, sgf.c, show.c: minor compiler warnings Sat Dec 15 21:23:49 CET 2007 Christian Anthon * board3d/gtkcolour3d.c: remove unneeded gdk_gl_drawable_begin calls since they causes assertions on newer X window. Thu Dec 13 22:39:56 CET 2007 Christian Anthon * Makefile.am, backgammon.h, bearoff.c, bearoff.h, bearoffdump.c, drawboard.c, drawboard.h, gnubg.c, gtkrolls.c, makebearoff.c, makehyper.c, multithread.c, positionid.c, positionid.h, render.h, rollout.c, sgf.y, util.c, util.h, lib/gnubg-types.h: fixes to make gnubg compile after Jon's changes. board3d doesn't compile. utility programs doesn't compile. Wed Dec 12 23:12:45 2007 Jon Kinsey * movelistctrl: Fix spacing in German (reported by Thomas Steiner) * bearoff.c: Fix multithreaded disk bearoff access (reported by Hugh Sconyers) * list.h + others: list type renamed to listOLD (ideally replace with glist in future) Wed Dec 12 15:40:08 CET 2007 Christian Anthon * Makefile.am, gnubg.6: manual now maintained in doc Wed Dec 12 13:52:14 CET 2007 Christian Anthon * Makefile.am, board3d/Makefile.am, doc/Makefile.am, lib/Makefile.am, m4/Makefile.am, met/Makefile.am, po/POTFILES.in: cleanup and fixes to make distcheck Wed Nov 28 09:43:59 CET 2007 Christian Anthon * po/POTFILES.in: remove pub_eval.c * doc/Makefile.am: remove *.txt from EXTRA_DIST Sun Nov 25 12:09:04 CET 2007 Christian Anthon * import.c: fix partygammon import. Games terminated badly. Sun Nov 18 07:04:44 CET 2007 Christian Anthon * eval.c, makebearoff.c: Fix messed up evaluation of hypergammon. Redirect loading of hyper databases to pkgdir. Sat Nov 17 11:27:28 CET 2007 Christian Anthon * eval.c eval.h gnubg.c lib/neuralnet.c lib/neuralnet.h: cleanup neuralnet.[ch] Fri Nov 16 23:24:02 CET 2007 Christian Anthon * backgammon.h, gtkchequer.h, gtkgame.c, gtkgame.h, gtkpanels.c, gtkrelational.c, gtkrelational.h, relational.c, rollout.h: cleanup gtkgame.h Fri Nov 16 22:11:05 CET 2007 Christian Anthon * backgammon.h, export.h, gnubg.c, gtkfile.c, gtkfile.h, import.h, makeweights.c, multithread.h, play.c, timer.c: cleanup backgammon.h Fri Nov 16 14:32:04 CET 2007 Christian Anthon * : update manuals Thu Nov 8 01:29:47 CET 2007 Christian Anthon * text.c: fix small bug reported by Philippe Mon Nov 5 21:31:24 CET 2007 Christian Anthon * doc/.cvsignore, doc/Makefile.am, doc/gnubg/allabout.pdf, doc/gnubg/gnubg.pdf, doc/images/appearence.png, doc/images/cubeful-ex1.png: build pdf files Wed Oct 24 17:17:50 CEST 2007 Christian Anthon * external_y.y, file.c, gnubg.c, gnubgmodule.c, gtk-multiview.c, gtkboard.c, gtkgame.c, gtksplash.c, htmlimages.c, import.c, makebearoff.c, relational.c, renderprefs.c, set.c, sgf.y, simpleboard.c, board3d/gtkcolour3d.c, board3d/misc3d.c, lib/neuralnet.c: fix a bunch of minor compiler warnings Tue Oct 23 12:38:57 CEST 2007 Christian Anthon * gktgame.c, gtkpanels.c: cleanup of InitGTK, move command widget to gtkpanels.c Mon Oct 8 15:46:22 CEST 2007 Christian Anthon * gtkcube.c: add rollout presets to cube tool Wed Oct 3 19:23:28 CEST 2007 Christian Anthon * analysis.c, rollout.c: fix to minor mt problems Wed Oct 3 18:58:41 CEST 2007 Christian Anthon * bearoffdump.c eval.c gnubg.c gtkgame.c gtkmovelistctrl.c gtkpanels.c latex.c makebearoff.c makehyper.c matchequity.c play.c render.c: compiler warnings Mon Oct 1 23:06:52 CEST 2007 Christian Anthon * Makefile.am, configure.in, export.c, multithread.c, simpleboard.c, simpleboard.h: make code compile without gtk, cairo or pangocairo Sat Sep 29 23:10:12 CEST 2007 Christian Anthon * backgammon.h, eval.c, eval.h, gnubg.c, gtkgame.c, set.c, show.c: remove unused training functions. Fri Sep 28 11:27:57 CEST 2007 Christian Anthon * Makefile.am po/LINGUAS po/POTFILES.in po/da.po po/en_US.po po/gnubg.pot po/is.po po/ru.po po/tr.po: make sure that "make dist" works. Remove unmaintained languages. Fri Sep 28 00:28:34 CEST 2007 Christian Anthon * backgammon.h, bearoff.c, bearoff.h, ChangeLog, export.c, export.h, file.c, file.h, formatgs.c, gnubg.c, gtkfile.c, gtkgame.c, html.c, lib/.cvsignore, lib/Makefile.am, Makefile.am, matchid.h, rollout.c, text.c: add a simple cairo board capable of exporting positions to svg, pdf and postscript surfaces * simpleboard.c, simpleboard.h: new files * lib/dynarray.c, lib/dynarray.h, lib/event.c, lib/event.h, lib/event.texi, lib/hash.c, lib/hash.h, lib/heap.c, lib/heap.h, lib/stamp-vti, postscript.c: removed files Thu Sep 27 22:50:16 CEST 2007 Christian Anthon * analysis.c, analysis.h, formatgs.c, gnubg.c, gnubgmodule.c, gtkexport.c, gtkgame.c, play.c, relational.c, set.c, show.c: remove SKILL_GOOD completely as the use was overlapping with that of SKILL_NONE Thu Sep 27 16:22:08 CEST 2007 Christian Anthon * gtkfile.c: allow default extension to be .sgf when saving and last used extension otherwise. Thu Sep 27 16:20:17 CEST 2007 Christian Anthon * AUTHORS, INSTALL, Makefile.am, README, configure.in, credits.sh, non-src/credits.c, non-src/external_l.c, non-src/external_y.c, non-src/external_y.h, non-src/sgfl.c, non-src/sgfp.c, non-src/sgfp.h: cleanup of readme and install files and minor updates to the rest Mon Sep 24 22:56:56 CEST 2007 Christian Anthon * makebearoff.c: fix tmp file creation problem Wed Sep 19 22:15:09 CEST 2007 Christian Anthon * rollout.c: change assertion to error message when mt_rollout results in too many rollouts done. Sat Sep 15 14:30:36 CEST 2007 Christian Anthon * Makefile.am: fix external_l.c dependency problem Fri Sep 14 23:40:14 CEST 2007 Christian Anthon * remove unused makebearoff1 program Fri Sep 14 13:58:36 CEST 2007 Christian Anthon * gnubg.c, configure.in: remove need for fstat Fri Sep 14 13:28:57 CEST 2007 Christian Anthon * .cvsignore, backgammon.h, bearoff.c, bearoffgammon.h, boarddim.h, boardpos.h, common.h, dice.c, eval.h, gnubgmodule.c, gtk-multiview.h, gtkboard.h, gtkcolour.h, gtkprefs.c, render.c, render.h, renderprefs.c, board3d/drawboard3d.c, board3d/matrix.c, board3d/misc3d.c, board3d/model.c: header clean-up. Use definitions from glib.h instead. Fri Sep 14 09:52:15 CEST 2007 Christian Anthon * gnubg.c, set.c: Make lang change more robust Mon Sep 3 11:40:07 CEST 2007 Christian Anthon * html.c: fix tmpfile creation problem to allow export of gammonline to clipboard under MS Vista. Mon Sep 3 01:18:12 CEST 2007 Christian Anthon * rollout.c: fix buffer overflow on 64 bit platforms * analysis.c, gnubg.c, multithread.c, rollout.c: add a new --debug option to turn on debugging for multithreaded code. Sun Sep 2 22:20:43 CEST 2007 Christian Anthon * board3d/misc3d.h, speed.h: new files * analysis.c, analysis.h, backgammon.h, board3d/drawboard3d.c, board3d/fun3d.h, board3d/graph.c, board3d/gtkcolour3d.c, board3d/Makefile.am, board3d/misc3d.c, board3d/widget3d.c, dice.c, eval.c, eval.h, external_y.y, format.c, gnubg.c, gnubgmodule.c, gnubgmodule.h, gtkboard.c, gtkchequer.c, gtkchequer.h, gtkfile.c, gtkgame.c, gtkgame.h, gtkgamelist.c, gtkmovelist.c, gtkmovelistctrl.c, gtkmovelistctrl.h, gtkoptions.c, gtkoptions.h, gtkpanels.c, gtkpanels.h, gtkprefs.c, gtkrace.c, gtkrelational.c, gtkrelational.h, gtkrolls.c, gtktoolbar.c, gtktoolbar.h, gtkwindows.c, gtkwindows.h, import.c, lib/cache.c, Makefile.am, matchequity.c, multithread.c, multithread.h, play.c, progress.c, pub_eval.c, relational.c, relational.h, render.c, renderprefs.c, rollout.c, rollout.h, set.c, show.c, speed.c, timer.c, userrng.c, util.c, util.h: make sure that functions are either static or declared in an appropriate header. Fri Aug 31 23:36:49 CEST 2007 Christian Anthon * gnubg.c, gtkgame.c, set.c, gtkgame.h: make sure that GTKOutput calls are rejected if the gtk interface isn't up and running. Fix a few potential language setting problems. Wed Aug 22 22:59:26 CEST 2007 Christian Anthon * gtkboard.c: fix player name setting bug Tue Aug 14 15:10:14 CEST 2007 Christian Anthon * gtkgame.c, gnubg.svg, gnubg.png: Add png file in case svg load unsupported. Sun Aug 12 10:45:16 CEST 2007 Christian Anthon * gtkcube.c, gtkmet.c, gtkrolls.c, gtksplash.c, gtktheory.c, gtktoolbar.c: update deprecated gtk_object_set_data Sat Aug 11 21:30:46 CEST 2007 Christian Anthon * gtkboard.c: update deprecated gtk_entry_new_with_max_length Sat Aug 11 21:09:41 CEST 2007 Christian Anthon * gtkwindows.c, gtkgame.c: update deprecated gtk_window_set_policy and gtk_container_children Sat Aug 11 20:58:02 CEST 2007 Christian Anthon * play.c, gtkboard.c: update deprecated gtk_timeout* Sat Aug 11 20:26:54 CEST 2007 Christian Anthon * board3d/fun3d.h, board3d/misc3d.c: make export position png work when using board3d Wed Aug 1 20:57:30 CEST 2007 Christian Anthon * gtkgame.c: set default icon for all windows Tue Jul 31 00:27:34 CEST 2007 Christian Anthon * analysis.c, configure.in, multithread.c, multithread.h, rollout.c, speed.c: make windows threads compile again and make a few simplifying changes * M html.c: UserCommand not awailable without gtk Sun Jul 29 08:27:41 CEST 2007 Christian Anthon * file.c, file.h, gtkfile.c, import.c: allow manual setting of the import file format in the GUI Sun Jul 29 08:24:22 CEST 2007 Christian Anthon * html.c: export html-images dir if non-existing * gtkgame.c: always export images to html-images/ Sun Jul 29 00:42:50 CEST 2007 Christian Anthon * multithread.c: another attempt to fix the check for all tasks done * rollout.c: fix mt rollout bug (wrong count) Wed Jul 18 14:35:32 CEST 2007 Christian Anthon * gnubg.c, gtkboard.c, gtkgame.c, gtkgame.h, gtkgamelist.c, gtkoptions.c, gtkpanels.c, gtkprefs.c, gtktoolbar.c, play.c, render.c, renderprefs.c, board3d/fun3d.h, board3d/graph.c, board3d/misc3d.c, board3d/widget3d.c: Allow startup in 2D mode if gtk_gl_init_check fails Sat Jul 14 22:54:29 CEST 2007 Christian Anthon * multithread.c: Fix hangup when all task done signal was missed and fix a closing bug for gthreads. Win32 threads are likely a bit messed up after these changes. Sat Jul 14 22:53:32 CEST 2007 Christian Anthon * gtkchequer.[ch]: Add quick rollout buttons Sat Jul 14 22:50:07 CEST 2007 Christian Anthon * export.c, import.c: Fix two Jellyfish MAT format bugs. One import and one export. Sat Jul 14 22:47:19 CEST 2007 Christian Anthon * backgammon.h, gnubg.c, set.c: Fix a couple of set sound options. Sat Jul 14 22:41:22 CEST 2007 Christian Anthon * Makefile.w32, Makefile.am, bearoffdump.c, getopt*, makebearoff.c, makebearoff1.c, makehyper.c, tctutorial.h, lib/Makefile.am, lib/hashtest.c, lib/md5test.c: Code clean, remove unused test programs and getopt. Wed Jul 11 15:37:49 CEST 2007 Christian Anthon * Makefile.w32: Delete a few unused files * eval.c: Fix startup bug when gnubg.wd was missing Tue Jul 10 17:22:33 CEST 2007 Christian Anthon * set.c, show.c, gnubg.c: Fix a language setting problem Tue Jul 10 10:42:39 CEST 2007 Christian Anthon * progress.c, rollout.c: Fix counting bug in multithreaded code for cube rollouts. Revert changes in progress.c so that the displayed number of games i correct for both non-threaded and multi-threaded code. Wed Jul 4 00:01:48 CEST 2007 Christian Anthon * : Updated GNU Backgammon to use GPL version 3. Achim did the work. I'm removing a few obsoleted and autotools related files. Sun Jul 1 13:05:02 CEST 2007 Christian Anthon * gtkprefs.c: fix bug with default board designs not being loaded Thu Jun 28 21:20:45 CEST 2007 Christian Anthon * import.c: Fix TMG post-Crawford import bug Mon Jun 11 20:54:35 CEST 2007 Christian Anthon * boardpos.c, copying.awk, corecount.c, credits.sh, erf.c, erftest.c, external_l.l, getopt.c, getopt1.c, gnubgmodule.h, gtk-multiview.c, gtkboard.c, gtkchequer.c, gtkcolour.c, gtkcube.c, gtkexport.c, gtkfile.c, gtkgame.c, gtkgamelist.c, gtkmet.c, gtkmovefilter.c, gtkmovelist.c, gtkoptions.c, gtkpanels.c, gtkprefs.c, gtkrace.c, gtkrelational.c, gtkrolls.c, gtksplash.c, gtktempmap.c, gtktheory.c, gtktoolbar.c, gtkwindows.c, htmlimages.c, progress.c, pub_eval.c, rollout.c, sgf.l, sound.c, speed.c, userrng.c, util.c, board3d/drawboard3d.c, board3d/font3d.c, board3d/graph.c, board3d/gtkcolour3d.c, board3d/inc3d.h, board3d/matrix.c, board3d/misc3d.c, board3d/model.c, board3d/shadow.c, board3d/widget3d.c, lib/cache.c, lib/dynarray.c, lib/hash.c, lib/heap.c, lib/isaac.c, lib/list.c, lib/md5.c, lib/md5test.c, lib/mt19937ar.c, non-src/copying.c, non-src/credits.c, non-src/external_l.c, non-src/sgfl.c: replace deprecated gtk_signal functions with g_signal functions. Make sure that config.h is included at the top of all .c files and not in .h files for better control (e.g. #define GTK_DISABLE_DEPRECATED). Fri Jun 8 00:07:30 CEST 2007 Christian Anthon * analysis.c, analysis.h, gnubg.c, gtkfile.c, progress.c, relational.c: make a gtkwidget for batch_analysis Fri Jun 1 08:43:07 CEST 2007 Christian Anthon * gnubg.c: fix rollout problem in cl interface. Allow doubling before rolling the dice when positions are obtained from the move hint list, but not when rolling out a single position. Fri Jun 1 00:27:53 CEST 2007 Christian Anthon * backgammon.h, gnubg.c, openurl.c, openurl.h, set.c, show.c: fix some problems with setting the web browser Thu May 31 11:43:08 CEST 2007 Christian Anthon * gnubg.c, sound.c: update a few strings. Thu May 31 23:22:37 CEST 2007 Christian Anthon * gnubg.c, dice.c: fix a few text mode locale problems Thu May 31 22:11:00 CEST 2007 Christian Anthon * sound.c: minor bug * gtkboard.c, gtkgame.c: make pasting of position and match id's work in edit mode and before starting a new match. Wed May 30 16:43:08 CEST 2007 Christian Anthon * sound.c: print to stdout instead of stderr in case of missing sound files, etc. Tue May 29 20:37:13 CEST 2007 Christian Anthon * gtkoptions.c: removed bearoff options Mon May 28 23:37:57 CEST 2007 Christian Anthon * sound.c: fix small sound setting problem Fri May 25 17:56:41 CEST 2007 Christian Anthon * sound.c, show.c, gtkoptions.c: fix small sound setting problem Wed May 23 22:44:14 CEST 2007 Christian Anthon * render.c: malloc more space for the labels to avoid crashes on small board sizes. Wed May 23 17:12:54 CEST 2007 Christian Anthon * file.c, file.h, Makefile.am, backgammon.h, export.c, export.h, gnubg.c, gtkfile.c, gtkgame.c, html.c, import.c, import.h, sgf.h: move some import/export/load/save functions for consistency. New files file.[ch] to allow the new cl command "import auto". Fri May 18 21:02:50 CEST 2007 Christian Anthon * openurl.c: small win32 improvement Thu May 17 21:35:00 CEST 2007 Christian Anthon * util.c: win32 fixes Thu May 17 15:53:42 CEST 2007 Christian Anthon * gtkgame.c, gtkwindows.c, progress.c: fix problem with DIALOG_FLAG_NOTIDY not being used. Make sure that the parent of the dialog is present. * util.c, board3d/matrix.c, board3d/matrix.h: compiler warnings Mon May 14 12:21:13 CEST 2007 Christian Anthon * util.[ch]: new files. Keeps the common parts of the ugly fixes of the util programs in one place. Mon May 14 01:18:33 CEST 2007 Christian Anthon * makehyper.c: rename WriteFile to WriteHyperFile to avoid conflict with windows.h Mon May 14 01:10:14 CEST 2007 Christian Anthon * gnubg.c, gtkgame.c, set.c: Fix problems in SetupLang Tue May 8 02:22:42 CEST 2007 Christian Anthon * gtkgame.c, rollout.c: solved problem with calibration widget causing crash. Modality disabled, because of an unresolved issue. DIALOG_FLAG_NOTIDY is unused?? Mon May 7 23:29:33 CEST 2007 Christian Anthon * gnubg.c: fix problem with lang settings not being loaded. * po/: now fuzzy matching, since po files are ill maintained. Fri May 4 10:21:14 CEST 2007 Christian Anthon * gnubg.c: fix issue with matches loaded twice from command line * analysis.c: fix issue with progress bar when running multithreaded * export.c, multithread.c: fix WIN32 compiler warnings Wed May 2 00:00:38 CEST 2007 Christian Anthon * Makefile.am, backgammon.h, bearoff.c, bearoff.h, bearoffdump.c, dice.c, eval.c, eval.h, gnubg.c, gnubgmodule.c, gnubgmodule.h, gtkfile.c, gtkgame.c, gtkoptions.c, gtkprefs.c, html.c, makebearoff.c, matchequity.c, matchequity.h, openurl.c, path.c, path.h, render.c, set.c, show.c, sound.c, sound.h, board3d/font3d.c, board3d/misc3d.c: remove path.[ch] Sun Apr 29 01:18:40 CEST 2007 Christian Anthon * analysis.c ,backgammon.h ,gnubg.c ,html.c ,latex.c ,play.c ,postscript.c ,relational.c ,text.c: removed MOVE_TIME Fri Apr 27 10:50:01 CEST 2007 Christian Anthon * Makefile.am, analysis.c, analysis.h, backgammon.h, configure.in, drawboard.c, formatgs.c, gnubg.c, gnubgmodule.c, gtkboard.c, gtkboard.h, gtkgame.c, gtkgame.h, import.c, play.c, set.c, sgf.c, show.c, sound.c, sound.h, text.c: removed timecontrol Fri Apr 27 01:35:36 CEST 2007 Christian Anthon * configure.in: cleanup Fri Apr 27 00:04:02 CEST 2007 Christian Anthon * eval.c, gnubg.c, gtkoptions.c, set.c, show.c: removed egyptian rule Thu Apr 26 23:52:57 CEST 2007 Christian Anthon * gtkbearoff.c, gtkbearoff.h, Makefile.am, backgammon.h, bearoff.c, bearoff.h, eval.c, eval.h, gnubg.c, gtkgame.c, gtkoptions.c, gtkrace.c, onechequer.c, onechequer.h, set.c, show.c: race cleanup. Removed Sconyers support. Thu Apr 26 23:06:04 CEST 2007 Christian Anthon * dice.c, gnubg.c, configure.in: replace gettimeofday by g_get_current_time Mon Apr 23 13:52:56 CEST 2007 Christian Anthon * gtkfile.c: fixed problem with . being added to filename on eache export. Fri Apr 20 18:00:10 CEST 2007 Christian Anthon * gtkfile.c, gtkgame.c: compiler warnings and fixed problem with extension not being remembered when exporting. Wed Apr 18 20:52:26 CEST 2007 Christian Anthon * gtkgame.h, gtktoolbar.c, gtktoolbar.h, play.c, speed.c: hack to make edit start a new game if gameste is none. Added an edit new position button to the new game widget. Tue Apr 17 09:13:43 CEST 2007 Christian Anthon * gnubg.c: swap r ratings when swapping players Tue Apr 17 09:08:36 CEST 2007 Christian Anthon * doc/Makefile.am: DESTDIR support Thu Apr 12 20:43:03 2007 Øystein Johansen * gtkfile.[ch], gtkgame.c: New feature: Batch analysis (still buggy) Thu Apr 12 16:57:39 CEST 2007 Christian Anthon * gnubg.c: init_sconyers unused, protect spaces in LoadRC Tue Apr 10 00:41:03 CEST 2007 Christian Anthon * backgammon.h, configure.in, gnubg.c, gnubgmodule.c, gtkgame.c, gtkgame.h, gtkwindows.c, show.c, doc/.cvsignore: cleanup of the main function. Fix problem with error messages during startup. Postpone efectuation of -p and -c options so that they may be used under gtk. Fix problem with readline not being detected under redhat. Sun Apr 8 18:44:45 CEST 2007 Christian Anthon * analysis.c, eval.c, eval.h, external.c, format.c, format.h, gnubg.c, gnubgmodule.c, gtkcube.c, gtkwindows.c, html.c, latex.c, makebearoff.c, play.c, postscript.c, progress.c, rollout.c, set.c, sgf.c, show.c, text.c: icc compiler fixes Sun Apr 8 13:40:34 CEST 2007 Christian Anthon * backgammon.h, eval.c, eval.h, gnubg.c, gtkgame.c, gtkrace.c, gtkrace.h, gtktoolbar.c, show.c: race theory update and simplification of analyse menu. Wed Apr 4 00:07:07 CEST 2007 Christian Anthon * bearoff.c: fix the fnd function, which was messed up by a typecast. Thu Mar 29 17:57:17 CEST 2007 Christian Anthon * board3d/Makefile.am: fix --without-board3d Thu Mar 29 09:51:40 CEST 2007 Christian Anthon * configure.in, m4/az_python.m4: Fix --without-python Mon Mar 26 17:05:29 CEST 2007 Christian Anthon * configure.in, m4/az_python.m4: OS/X changes Thu Mar 22 00:22:47 CET 2007 Christian Anthon * import.c, openurl.c, sound.c, doc/Makefile.am: a few compile fixes after previous checkins Wed Mar 21 00:23:10 CET 2007 Christian Anthon * : Sound system cleanup. We now allow only an external command or for system that support it: either esound, or win32 sound. Wed Mar 21 00:21:08 CET 2007 Christian Anthon * import.c: Allow import of nackgammon mat files. (thx, Joerg Picard ) Tue Mar 20 19:28:06 CET 2007 Christian Anthon * : Removed gtktexi. Added Albert Silver's 'All about GNU'. Updated the openurl function and allowed user configuration of the web browser. Tue Mar 20 16:49:37 CET 2007 Christian Anthon * eval.[ch]: fix bug caused by signed/unsigned changes Fri Mar 16 02:30:26 CET 2007 Christian Anthon * : updated documentation. It now contains the information from the dokuwiki as well as the old info files. The documentation is now written in docbook format, and texinfo and info files are now generated from the docbook source. The manpage has been updated as well. Fri Mar 16 00:04:44 CET 2007 Christian Anthon * gnubg.c, gtkgame.c, gtkwindows.c, play.c: replace gtk_idle with g_idle. Fri Mar 16 00:04:29 CET 2007 Christian Anthon * : silence a bunch of intel c compiler warnings (recomitting after savannah crash) Fri 15 Mar 21:47:53 2007 GMT Jim Segrave * rollout.c: was using the 'this is a cube rollout' flag to decide whether to calculate JSDs from cubeful or cubeless equities Sun 25 Feb 12:11:40 2007 GMT Jim Segrave * rollout.c : if settings were for cubeful rollouts, then extending rollouts used cubeful equity. Threading aggravates the problem, this is not a complete fix (rcRollout is used globally but needs to be modified to match the set of moves being rolled out. Ensuring it's put back for all sequences which might terminate a rollout is non-trivial Mon Feb 12 21:56:45 2006 GMT Jon Kinsey * speed.c : Make calibration test multi-threaded Wed Feb 14 11:07:07 CET 2007 Christian Anthon * multithread.h: first argument to MT_Safe* is pointer not value also when compiled without threads Wed Feb 14 10:03:35 CET 2007 Christian Anthon * Makefile.am, configure.in: remove pthread Mon Feb 12 21:56:45 2006 GMT Jon Kinsey * multithread.c : Remove pthread tls code and reduce #ifs/tidy win32 code Sun Feb 11 22:18:33 CET 2007 Christian Anthon * bearoffdump.c, eval.c, makebearoff.c, makehyper.c, rollout.c: small fixes to let gnubg and tools compile without warnings. Thu Feb 08 19:56:45 2006 GMT Jon Kinsey * multithread.c, rollout.c : Multi-thread rollouts. Fri Feb 02 18:56:45 2006 GMT Jon Kinsey * multithread.c/.h, lib/neuralnet.c, lib/neuralnetsse.c, lib/cache.c (new) : syncronize cache access, fix mis-aligned mingw thread stack, remove frombase optimisation for SSE. Wed Jan 31 12:49:00 CET 2007 Christian Anthon * Makefile.am, configure.in, eval.c, gnubg.c, multithread.c, multithread.h, lib/neuralnet.c, lib/neuralnetsse.c: various changes to make gnubg compile with ./configure --enable-threads Thu Jan 25 20:27:53 CET 2007 Christian Anthon * makehyper.c, lib/neuralnet*.c: small fixes needed to compile without threads on linux Thu 25 Jan 09:43:30 2007 GMT Jim Segrave * gnubg.c: restore some code dropped some revisions ago Sun Jan 05 10:56:45 2006 GMT Jon Kinsey * eval.c: Fix some concurrency problems. Fri Jan 05 21:56:45 2006 GMT Jon Kinsey * analysis.c multithread.c: Add multi-thread compatiblity for game analysis. Fri Dec 29 12:51:42 CET 2006 Christian Anthon * lib/Makefile.am, lib/fifo.[ch], lib/buffer.[ch]: removed as they are not used anymore. Thu Dec 28 10:03:36 CET 2006 Christian Anthon * common.h, board3d/matrix.c, board3d/matrix.h, lib/fifo.c, lib/fifo.h, lib/neuralnet.c: small linux compile fixes after last commit. Tue Dec 26 11:56:45 2006 GMT Jon Kinsey * lib/board3d: Run through lint, added consts to pointers and made some int's unsigned. Wed Dec 20 10:06:46 CET 2006 Christian Anthon * */: add some filenames to .cvsignore Wed Dec 20 09:25:49 CET 2006 Christian Anthon * non-src/: updated the flex/bison files to versions supplied by Ingo Tue Dec 19 23:30:58 CET 2006 Christian Anthon * configure.in: fix small python and png problems Tue Dec 19 12:03:14 CET 2006 Christian Anthon * configure.in, common.h, render.c, lib/neuralnet.c: declare signbit and lrint as macros if undeclared Mon Dec 18 23:58:05 2006 GMT Jim Segrave * analysis.c: fix casts and parens in relativeFibsRating Sun Dec 16 20:56:45 2006 GMT Jon Kinsey * gtkmovelist.c: Fix for bug #18526 s Thu Dec 14 17:56:45 2006 GMT Jon Kinsey * gtkmovelist.c: Fix for bug #17845 multiple highlights in hint * import.c: Small partygammon fix * gnubg.c: Fix for bug #12131 menus while analysing games Tue Dec 12 15:54:22 CET 2006 Christian Anthon * gnubg.c, gtkgame.c: Save/Load rollout settings added to gtk interface Sun Dec 10 17:27:29 CET 2006 Christian Anthon * configure.in, lib/neuralnet.c: configure option to disable the sse test (e.g. on amd64) Thu Dec 7 16:57:14 CET 2006 Christian Anthon * gnubg.c: make CommandImportParty compile without gtk Thu Dec 7 00:59:04 CET 2006 Christian Anthon * various: mingw fixes of autotool changes Thu Dec 7 00:10:46 CET 2006 Christian Anthon * too many to list: major autotools/library cleanup. Likely some things will be broken on some systems. Tue Dec 5 09:53:54 CET 2006 Christian Anthon * ChangeLog, configure.in, gnubg.c, gtkprefs.c, gtktexi.c, matchequity.c, rollout.c: vprintf cleanup Tue Dec 5 00:44:07 CET 2006 Christian Anthon * common.h, configure.in, dice.c, eval.c, export.c, gnubg.c, gtkchequer.c, gtkcube.c, gtkexport.c, gtkgame.c, gtkmet.c, gtkmovefilter.c, gtkrace.c, gtktexi.c, gtktheory.c, osr.c, path.c, render.c, rollout.c, lib/Makefile.am, lib/buffer.c, lib/neuralnet.c: alloca cleanup (we allways have g_alloca). Mon Dec 4 10:10:29 CET 2006 Christian Anthon * gtkoptions.c: hide sound options when compile without USE_SOUND Sat Dec 2 21:52:04 CET 2006 Christian Anthon * rollout.c, progress.c: Disable view rollout statistics after close/reopen. Add drops to won games in rollout statistics. Thu Nov 30 23:43:03 CET 2006 Christian Anthon * eval.c, gtkgame.c: remove meaningless data from evaluation window and fix window size Thu Nov 30 22:17:24 CET 2006 Christian Anthon * gtkwindows.c: fix sizing problem in messages window Thu Nov 30 20:14:05 CET 2006 Christian Anthon * gtkoptions.c: fix gtk sizing problem in sound options. Tue Nov 28 23:59:09 CET 2006 Christian Anthon * sound.c: cleanup of play_file Sun Nov 26 21:56:45 2006 GMT Jon Kinsey * gtkoptions.c (mainly): Selectable sound files (in gui) Sun Nov 26 16:59:28 CET 2006 Christian Anthon * backgammon.h, gnubg.c, gtkfile.c, import.c, import.h: "import gam", "import party" and "import empire", respectively imports, jellyfish .gam, partygammon .gam and gammonempire .gam. Sun Nov 26 16:24:30 CET 2006 Christian Anthon * gtkfile.c: Default folders on win32 Sat Nov 25 17:56:45 2006 GMT Jon Kinsey * import.c: First try at PartyGammon import (based on convert-to-mat script by gunnar bluth and achim mueller) Thu Nov 23 18:56:45 2006 GMT Jon Kinsey * gtkfile.c: Add warning if trying to import PartyGammon game files Sat Nov 18 14:56:45 2006 GMT Jon Kinsey * gtkprefs.c: Fix bug in saving/exporting custom designs Wed Nov 15 16:53:19 CET 2006 Christian Anthon * gnubg.c, set.c, show.c: in fresh installs: g11.xml, more sensible rollout settings, infinite number of moves analysed. * gtkboard.c, gtkgame.c, gtkpanels.c: docked panels wider by default. gnubg starts maximized(make this an option?). Attempt to fix ugly resizes in player/score frames. Thu Nov 16 15:27:32 CET 2006 Christian Anthon * gnubg.c, gtkgame.c, record.c, record.h, gtkprefs.c: Move all rc files to g_get_home_dir()/.gnubg (both windows and unix). Tue Nov 14 21:17:55 GMT 2006 Jim Segrave * gtkgame.c : GTKShowScoreSheet callback to MoveListIntoView 2nd parameter is pointer to int, not int Mon Nov 13 22:32:37 CET 2006 Christian Anthon * Makefile.am, configure.in,g gnubg.c , gtkbearoff.c , gtkgame.c , gtkprefs.c , record.c: attempt fix of recent problems with szHomeDirectory Mon Nov 13 18:50:22 CET 2006 Christian Anthon * Makefile.am, configure.in, board3d/.cvsignore, board3d/Makefile.am, lib/.cvsignore, lib/Makefile.am: Use libtool static libs. Mon Nov 13 12:16:54 CET 2006 Christian Anthon * Makefile.am, configure.in, board3d/Makefile.am, lib/Makefile.am, non-src/Makfile.am: Add various files to EXTRA_DIST or sources. Fri Nov 10 15:22:46 CET 2006 Christian Anthon * fonts/Makefile.am, flags/Makefile.am: Add flags and fonts to EXTRA_DIST Fri Nov 10 12:40:47 CET 2006 Christian Anthon * configure.in: Version bump, MAIN now version 0.16-devel Fri Nov 10 12:35:50 CET 2006 Christian Anthon * gnubgmodule.c: Hopefully fix AMD64 relational database crash Fri Nov 10 08:31:26 2006 GMT TAKAHASHI Kaoru * gtktheory.c: Fix typo. Use TG instead of TP for "Too good". Tue Nov 7 19:56:45 2006 GMT Jon Kinsey * import.c, gktfile.c : Add money game import for .gam files Thu Nov 9 20:56:45 2006 GMT Jon Kinsey * font3d.c, render.c : Minor changes to 3d cube font and 2d point number font to make them look slightly better. Mon Nov 6 15:11:40 CET 2006 Christian Anthon * render.c, board3d/font3d.c, board3d/widget3d.c: Allow fallback when no stencil buffer and make vera fonts work in 3d. Mon Nov 6 13:28:52 CET 2006 Christian Anthon * Makefile.am, configure.in, render.c, board3d/font3d.c, R luxi.c, A fonts/: Use the free bitstream vera fonts instead of the non-free luxi.c Thu Nov 2 20:56:45 2006 GMT Jon Kinsey * gtkfile.c + .h: Removed import option and now open any file type automatically. Thu Nov 2 20:56:45 2006 GMT Jon Kinsey * gtkgame.c + .h: Show 3 decimals for epc and include wastage. (By Ian Shaw) Wed Nov 1 00:52:26 CET 2006 Christian Anthon * gnubg.c, backgammon.h, Makefile.am: Move option parser to glib option parser, since it facilitates the integration of gnubg options with gtk options. getopt*.[ch] still needed for utility programs. Wed Oct 25 11:36:58 CEST 2006 Christian Anthon * Makefile.am, backgammon.h, export.c, gnubg.c, gnubgmodule.c, gtkfile.c, gtkgame.c, gtkgame.h, gtkoptions.c, gtkprefs.c, gtktoolbar.c, html.c, latex.c, postscript.c, set.c, sgf.c, show.c, text.c: Moved file dialogs to gtk_file_chooser * gtkfile.h: new file * gtkpath.c gtkpath.h: removed Wed Oct 18 14:54:34 CEST 2006 Christian Anthon * Makefile.am, configure.in, gtkgame.c, flags/.cvsignore, flags/Makefile.am: automake and install stuff for the new flags Wed Oct 18 09:31:12 CEST 2006 Christian Anthon * backgammon.h, gnubg.c, gtkgame.c, postscript.c, sgf.c: charset conversion cleanup Tue Oct 17 15:03:08 CEST 2006 Christian Anthon * drawboard.c: avoid assuming length of translated strings Mon Oct 16 15:45:49 CEST 2006 Christian Anthon * gtkgame.c: Correct locales. Call language changes directly instead of through UserCommand. * gnubg.c: Use environment locale. Replace putenv by setenv. Thu Oct 12 19:56:45 2006 GMT Jon Kinsey * gtkgame.c, gtkoptions.c, flags dir: Added new dialog to set language Thu Oct 5 23:51:15 CEST 2006 Christian Anthon * gtkgame.c: Fix compiler warnings without USE_PYTHON after last commit Wed Oct 4 14:18:35 CEST 2006 Christian Anthon * Makefile.am analysis.c, analysis.h, formatgs.c, formatgs.h, html.c, text.c: minor changes to allow "relational show details" * database, database.example: rename * gtkgame.c, gtkgame.h, gtkrelational.c, gtkrelational.h, relational.c: detailed player stats in the CL version. List of all player stats and details upon double-clicking in the GUI. Wed Oct 4 11:58:50 CEST 2006 Christian Anthon * gtktoolbar.c: make sure labels are shown * .cvsignore: add linked files Mon Oct 2 00:49:27 CEST 2006 Christian Anthon * several: compiler warnings mainly on 64bit platforms. Avoid casting integer to pointer and back. Sat Sep 30 09:56:45 2006 GMT Jon Kinsey * gtkgame.c: Fix minor edit bug (labels dissappearing when panels moved) Sun Sep 24 06:12:42 2006 GMT TAKAHASHI Kaoru * makebearoff.c: Fix typo: #include . Wed Sep 20 21:56:45 2006 GMT Jon Kinsey * gtkgame.c: Save full screen state and show pip count Mon Sep 18 22:17:39 CEST 2006 Christian Anthon * misc: Keith Count Wed Sep 13 21:42:45 CEST 2006 Christian Anthon * gtk*, Makefile.am: Cleanup after modal comit Wed Sep 13 21:38:50 CEST 2006 Christian Anthon * sgf.c: make save/load locale independent Mon Sep 11 23:56:45 2006 GMT Jon Kinsey * gtkwindows.c+.h, lots of gtk files: Move dialog code to new file Fixed modal dialog z order problems (mainly on windows) Sat Sep 9 14:11:25 CEST 2006 Christian Anthon * gtkgame.c: Reimplement the idle python shell Wed Sep 6 19:16:04 CEST 2006 Christian Anthon * gtkgame.c: make ctrl-c and ctrl-v work for gtktextview Tue Sep 5 12:42:29 CEST 2006 Christian Anthon * gtkgame.c and friends: replace gtktext (gtk1) with gtktextview Tue Aug 29 14:32:51 CEST 2006 Christian Anthon * drawboard.c: 'off' and 'bar' should not be translated Wed 23 Aug 2006 Jim Segrave * gnubg.c: initialise rollout context when calling RolloutGeneral Tue Jul 4 18:45:04 CEST 2006 Christian Anthon * several files: fix gcc4 compiler warnings due to xml using usigned char Mon Jul 3 17:58:33 CEST 2006 Christian Anthon * doc/gnubg.xml, non-src/README: gnubg.xml moved (edit gnubg.texi instead). Fri Jun 30 11:41:51 CEST 2006 Christian Anthon * gtkgame.c: fix save settings when using gnubg -t Thu Jun 29 11:41:00 CEST 2006 Christian Anthon * gnubg.weights: added to archive Thu Jun 29 11:27:09 CEST 2006 Christian Anthon * Several files: move generated files to non-src. Make the generated files actually compile and automake work as expected. Mon Jun 26 22:05:50 CEST 2006 Christian Anthon * Several files: remove simplelibgen Mon Jun 26 21:00:44 2006 UTC CEST 2006 Christian Anthon * Several files: remove gtk_1 code missed first time Thu Jun 22 23:56:45 2006 GMT Jon Kinsey * Several files: Moved some 3d settings and code into 3d lib. Thu Jun 22 20:53:54 CEST 2006 Christian Anthon * Several files: remove gtk_1 code Sun Jun 18 01:26:05 CEST 2006 Christian Anthon * Several files: cleanup after Øystein i18n changes Sat Jun 17 19:42:19 2006 Øystein Johansen * Many files: Remove i18n functions like PushLocale and PopLocale, use glibs g_ascii_strtod and g_ascii_formatd instead. * gnubg.c and others: Remove gdbm database training Sat Jun 10 00:02:19 CEST 2006 Christian Anthon * : Removal of USE_GUI, USE_EXT, xgame* xboard*, the ext directory Tue Jun 22 Christian Anthon * Makefile.am (SUBDIRS): Remove intl. (EXTRA_DIST): Add config.rpath. Upgrade to gettext-0.14.5. Mon May 29 13:01:07 CEST 2006 Christian Anthon * M Makefile.am, configure.in, gnubg.gtkrc : gtk1/gtk2 cleanup, we now expect gtk-2.6.0 * M README,TODO : guile clean * R config.guess, config.sub, ltmain.sh, libtool : autoconfig cleanup * M gnubg.c, gtkgame.c : gtk1/gtk2 cleanup, get rid of gdkx.h, which seems unneeded, update evaluate widget to gtk_text_view * M gnubg.gtkrc : gtk2 cleanup, don't autogenerate from gnubg.gtkrc.in anymore Fri May 26 20:35:05 2006 Øystein Johansen * gnubg.c: Simple Win32 fixes (Windows doesn't use gdkx.h) Fri May 26 11:51:05 CEST 2006 Christian Anthon * Many files : Updated the autobuild system. Please read INSTALL in the topdir. Gtk1 and guile are no longer supported. Tue May 24 19:56:45 2006 GMT Jon Kinsey * gnubg.c : Fixed memory overwrite and .mat export for foreign languages Tue May 24 19:56:45 2006 GMT Jon Kinsey * render.c, htmlimages.c : Rewrite libart 2d board arrows using cairo Sat May 21 15:56:45 2006 GMT Jon Kinsey * boards.xml : Added two new designs by Wilson Amaral Jorge. Mon May 8 21:32:34 2006 Øystein Johansen * renderprefs.c: A revised 64 bit patch from Alex applied. Sun May 7 18:49:34 2006 Øystein Johansen * renderprefs.c: Revert Alex' patch. Tue May 2 00:33:07 CEST 2006 Christian Anthon * gtkgame.c: fix display of gtkeval window Mon May 1 22:06:34 2006 Øystein Johansen * renderprefs.c: Apply Alex patch. * texture.txt: Bump version Sun Apr 16 12:48:31 CEST 2006 Christian Anthon * rollout.c: Use abs in time check * gnubg.py : Fix typo Tue Apr 14 09:56:45 2006 GMT Jon Kinsey * export.c : Fix 3d png export (and 3d preview bars in appearance dialog) Thu Apr 13 01:37:29 CEST 2006 Christian Anthon * Make Jon's sse-splitup actually compile on linux. Moved SSE_Support() to neuralnet.c to make makeweights compile. Added some autoconf magick. Tue Apr 12 07:56:45 2006 GMT Jon Kinsey * backgammon.h +various: Tidy up min/max to use MIN/MAX everywhere Tue Apr 11 21:56:45 2006 GMT Jon Kinsey * gtkboard.c: Minor bugfix when hitting chequers in edit mode Tue Apr 11 17:56:45 2006 GMT Jon Kinsey * rollout.c: Only update rollout stats once a second at most Tue Apr 11 17:56:45 2006 GMT Jon Kinsey * gtkfile.c: Fix bug changing met with gtk 2 Mon Apr 10 09:49:03 CEST 2006 Christian Anthon * gtkgame.c: Fixed typo causing crash in RelationalAddMatch Fri Apr 7 13:46:58 CEST 2006 Christian Anthon * gnubg.c, gtkgame.c: Fix problems with help menus in gtk * gtkgame.c : Enable add game to relational in gtk(thx MaX) * database.py : Create games database when appropriate(thx MaX) * html.c : small improvement on previous Thu Apr 6 22:30:58 CEST 2006 Christian Anthon * html.c make it clearer who is who when exporting to gammonline Wed Mar 29 10:13:39 CEST 2006 Christian Anthon * **/Makefile.in aclocal.m4 config.h.in configure: Sync auto-tools files. Tue Mar 28 23:45:53 CEST 2006 Christian Anthon * gnubg.game.mysql gnubg.game.sql gnubg.sql: Fix switched order of normalised/unnormalised for some error_, so that it matches database.py. Tue Mar 28 23:37:40 CEST 2006 Christian Anthon * remove m4/gettext.m4 Tue Mar 28 23:24:14 CEST 2006 Christian Anthon * format.c eval.c analysis.c: Clean up isCloseCube and lower limit to 0.16 Sat Mar 20 23:16:45 2006 Øystein Johansen * analysis.c: Fix for problem with wrong double statistics. (Thanks to Christian Anthon) Sat Mar 03 10:56:45 2006 GMT Jon Kinsey * gtkgame.c: Change mouse pointer to watch when computer is thinking Sat Mar 03 09:56:45 2006 GMT Jon Kinsey * gtktoolbar.c: Undo any partial move that may have been made when entering edit mode. Sat Mar 03 09:56:45 2006 GMT Jon Kinsey * gtkgame.c: Remove old ClearText function Mon Feb 27 10:56:45 2006 GMT Jon Kinsey * play.c: Fix 'too good' tutor bug Fri Feb 24 17:56:45 2006 GMT Jon Kinsey * gtkgame.c and others: Sort out copy/paste for gtk 2 Sat Feb 11 09:56:45 2006 GMT Jon Kinsey * import.c: Fixed an import bug for TMG files (reported by Christian Anthon). Mon Feb 06 08:56:45 2006 GMT Jon Kinsey * gtkfile.c, eval.c, matchequity.c: 3 small fixes from Philippe Michel Thu Feb 02 07:56:45 2006 GMT Jon Kinsey * gtkgame.c, gtkgamelist.c: Replace old gdk_string_width() calls Thu Jan 31 07:56:45 2006 GMT Jon Kinsey * gtkgame.c: Add menu option to switch between 2d and 3d views Sun Jan 29 19:32:05 GMT 2006 Jim Segrave * gtkpanels.c - don't do anything to undock panels in CLI mode ChangeLog entry for 27/01 listed the wrong source file, sigh Fri Jan 27 18:36:46 GMT 2006 Jim Segrave * play.c - don't do anything to undock panels in CLI mode Sat Dec 17 -3:31:09 GMT 2005 Jim Segrave * gtkchequer.c - CreateMoveListTools() must be called before calling MoveListCreate(), otherwise coredumps can result Sat Dec 17 -1:22:09 GMT 2005 Jim Segrave * html.c - copy basemane() from simplelibgen.c to get_basename(), as basename() is not promised to be re-entrant. This caused all the links between html game files to be set to the last call to basename() Thu Dec 12 13:23:12 GMT 2005 Jim Segrave *eval.c change assembler code labels to locals. gcc 3.42 saw labels as redfined. I don't know what this will do to MS compilers or the Intel compiler. Fri Nov 18 16:38:11 GMT 2005 Jim Segrave *gtktexi.c - make inclusion of io.h dependent on not having unistd.h, as done in other routines (io.h is a Windows-only header) Mon Sep 19 22:37:25 GMT 2005 Jim Segrave * relational.c, gtkgame.c - don't reference non-existent gtk objects postgresql does not accept queries in the form SELECT column from A INNER JOIN B INNER JOIN C ON A.id1 = B.id1 AND B.id2 = C.id2 must be SELECT column from A INNER JOIN B ON A.id1 = B.id1 INNER JOIN C ON B.id2 = C.id2 Sun Sep 18 14:10:02 GMT 2005 Jim Segrave * gnubg.game.sql, gnubg.game.mysql - create databases with tables for game statistics * database - sample database configuration file Mon Aug 29 15:56:45 2005 GMT Jon Kinsey * gtkchequer.c (and a few others), gtkmovelist(.h, .c, ctrl.c) - new files Added win/loss stats to movelist Fri Aug 5 11:45:31 2005 GMT Jim Segrave * gtkexport.c - fix to skip SKILL_GOOD for cube decisions Sun May 8 12:56:45 2005 GMT Jon Kinsey * gtkgame.c, gtkpanels.c: full screen improvments (for gtk 2.6) * progress.c: alloc mismatch Wed May 4 18:10:43 GMT 2005 Jim Segrave * eval.c: Don't use MMAP for reading weights when using sse Fri Apr 29 20:56:45 2005 GMT Jon Kinsey * progress.c: Limit list updates in rollouts to reduce flicker and improve speed (gtk 2.6) * eval.c: Minor speed improvment Thu Apr 28 22:35:45 2005 Oystein Johansen Vectorization of neural net evaluation. * eval.c: Change callers to NeuralNetEvaluate to use vectorized code. * set.c: Fix typo. Thanks Jim Curtis. Wed Mar 30 16:56:45 2005 GMT Jon Kinsey * gtkfile.c : Allow spaces in filenames (new 2.6 file dialog), not tested with linux * gtkgame.c : Fix maximised window->full screen (gtk 2+) Sat Mar 26 00:17:49 GMT 2005 Jim Segrave * gtkgame.c, sound.c - fix for Cygwin FASYNC vs O_ASYNC (from Ingo Macherius Fri Mar 11 19:25:45 2005 Oystein Johansen * gtkgame.c (InitGTK): move the 'Go' menu to the right place accoring to HIG. * gtkgame.c (GTKHelp): Make the command reference window a dialog. Sun Mar 06 18:00:45 2005 Oystein Johansen * gtkgame.c InitGTK(): Exclude GTK_STOCK_ABOUT when gtkversion < 2.6 Sat Mar 05 23:50:45 2005 Oystein Johansen This is the first commit in a large GUI cleanup I intend to do. Cleanup in the menu system. Simplify all the 'File' menues. Rearrange accoring to Human Interface Guidlines 2.0 (HIG 2.0). Add some stock icons to some of the menu items. Please comment on the stock items. * gtkgame.[ch], gtkpanels.c, gtktoolbar.c: Menu cleanup. Fri Feb 25 11:56:45 2005 GMT Jon Kinsey * gtk(some).c : Make event boxes transparent (By Ingo Macherius) Tue Feb 23 18:26:45 2005 Oystein Johansen * gtkgame.c, progress.c: Make all progress bars with gtk_progress_bar instead of the deprecated gtk_progress_*, when compiled with GTK+2. Wed Feb 23 06:49:52 2005 GMT Jim Segrave * gtkpanels.c: use string.h rather than strings.h to get prototype for strcasecmp() Tue Feb 22 19:26:45 2005 Oystein Johansen * gtkcube.c (CubeAnalysisEvalPly): Get the evalcontext right! Tue Feb 22 19:06:45 2005 Oystein Johansen * gtkgame.c (GTKFileCommand): Apply a fix from Ingo Fri Feb 18 16:56:45 2005 GMT Jon Kinsey * matchequity.c : Fix met xml files met/catalog (By Ingo Macherius) Thu Feb 17 16:56:45 2005 GMT Jon Kinsey * gtkgame.c, gtkfile.c (and a few others): First part of new file dialogs (By Ingo Macherius) * gtkpanels.c: Minor gtk 2 window fix Tue Feb 15 17:56:45 2005 GMT Jon Kinsey * gnubg.c, gtkpanels.c: Remember maximised state of windows Mon Feb 14 12:56:45 2005 GMT Jon Kinsey Fixes from Philippe Michel: rollout.c, format.c: Fix bugs in rollout output gnubg.c: Fix for bug 10099 makebearoff1.c: Typo Thu Feb 10 10:56:45 2005 GMT Jon Kinsey Fixes from Ingo Macherius: external_l.l, external_y.y: Minor parser change gnubg.c: No-gui build fixes gtkpanels.c: Remove compiler warning gnubgmodule.c/h: Add paramater to FindCubeDecision Fix from Philippe Michel: matchid.c: Buffer fix for matchidfromkey Fixes for gtk 2.6: gnubg.c: Don't hide windows on close - so sound finishes correctly gtkprefs.c: Fix long pause if no boards.xml file misc3d.c, play.c: Dice not shown until after roll sound (3d) Wed Feb 8 16:56:45 2005 GMT Jon Kinsey * Various fixes for gtk 2.6: eval.c : Increase poll time gnubg.c : Fix ok click problem for gtk 2.6 gtkgame.c : Fix dock/undock problem for gtk 2.6 gtkoptions.c gtkbearoff.c gtktempmap.c : Fix dialog modality Tue Feb 7 17:56:45 2005 GMT Jon Kinsey * gnubg.c: change get install dir to look at path to exe (windows) Tue Feb 2 19:56:45 2005 GMT Jon Kinsey * gtkgamelist.c: Remove gtk loop, hopefully fixing "can't move" bug * gtkgame.c: More relational db code Tue Jan 5 8:56:45 2005 GMT Jon Kinsey * relational.c: Add warning if adding unfinished or unanalyzed match * gtkpanels.c: Fix for console build Tue Jan 4 9:56:45 2005 GMT Jon Kinsey * gtkpanels.c: Move remaining window/panel code to this file and fix a couple of small bugs Tue Jan 4 00:16:32 2005 GMT Jim Segrave * gnubgmodule.c - add detail to python doc strings Sun Jan 2 13:44:55 2005 GMT Jim Segrave * gnubgmodule.h - reinclude config.h to set HAVE_FSTAT (gcc doesn't like trying to redfine it and config.h is not idempotent) * gnubgmodule.c - replace _getcwd with getcwd, _MAX_PATH with PATH_MAX, which should be available in all C implementations Sun Jan 2 11:56:45 2005 GMT Jon Kinsey * gnubgmodule.c: Look for local python installation (windows) Sun 12 Dec 13:27:54 gmt 2004 Jim Segrave * fix some bugs in scripts/database.py Sun 28 Nov 01:04:30 GMT 2004 Jim Segrave * import.c - patch Fibs code to ignore non-game lines in input Wed Nov 23 10:56:45 2004 GMT Jon Kinsey * play.c: Fix wrong resign acceptance * eval.c, bearoff.c, set.c: Hypergammon fixes Thu Nov 18 23:06:46 2004 GMT Holger Bochnig * bearoffdump.c: allow posids as arguments Mon Nov 15 10:56:45 2004 GMT Jon Kinsey * gtkgame.c (and others) : Simplify widget grabbing, hopefully fixing multiple "can't move" bug Mon Nov 8 11:56:45 2004 GMT Jon Kinsey * gtkgame.c : Fixed bug with credits Fri Nov 5 14:56:45 2004 GMT Jon Kinsey * gnubg.sql, gtkgame.c, realational.c, database.py : Added multiple environments to the realational database Fri Nov 5 14:08:48 2004 Joseph Heled * eval.c (EvalInitialise): Fix bug with prunning. Order of crash and race nets was reversed, So crashed/race prune nets were returning garbage. Thu Nov 4 13:12:07 2004 Joseph Heled * eval.c: Make evals after prunning cubeful. See if it makes a difference. Would be nice to offer this as a global option. Wed Nov 03 20:44:45 2004 Oystein Johansen * gtkgame.c (EvalWidget): Fix a copy'n'waste error * eval.c: Change 'Tiny' movefilter to 5 candidates. Wed Nov 03 20:07:45 2004 Oystein Johansen * gtkchequer.c (CreateMoveList): Use NULL instead of "" Wed Nov 03 09:15:45 2004 Oystein Johansen * i18n.h: reenter #include "config.h" Tue Nov 02 22:03:30 2004 CET Petr Kadlec * gtkprefs.c: Fixed an issue when not using HAVE_LIBXML2 Wed Oct 27 01:20:45 2004 Oystein Johansen * boards.xml: Add design by Ian Curtis. Wed Oct 27 01:20:45 2004 Oystein Johansen * gtktheory.c gtktempmap.c: Two files I missed in the last commit. Tue Oct 26 21:00:45 2004 Oystein Johansen Hate me or love me! I've commited the code that removes the reduced searches. (Sorry Nis! Hope it won't cause you any trouble). Hopefully I will be able to combine the two reduction methods later. * gtkgame.c, eval.c and other files: Add user interface to prune nets Fri Oct 22 15:56:45 2004 GMT Jon Kinsey * html.c, and others : Fix exports to display cube analysis whenever analysis available Thu Oct 21 15:56:45 2004 GMT Jon Kinsey * matchequity.c, set.c : Bug fix while inverting met Tue Oct 19 17:56:45 2004 GMT Jon Kinsey * gtkprefs.c : Fixes for import/export appearance designs Sun Oct 17 22:14:00 2004 UTC Jim Segrave * Makefile.in - missing gtkpanels.* * sgf.c - versioning for pruning * gnubg.c - move reduction variables inside ifdef * eval.c - cosmetic fix for compiler warnings * xpm/x.xpm - missing final line of bmp * eval.h - add version numbers for pruning in .sgf files Sat Oct 16 23:36:45 2004 Oystein Johansen * gnubgmodule.c: Fix dice option handling Thu Oct 14 17:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkgame.c : Remember last import+export file type Thu Oct 14 12:56:45 2004 GMT Jon Kinsey * eval.c : Minor (non gcc) compiler fixes Tue Oct 12 19:44:00 2004 Oystein Johansen * gnubgmodule.c: Add methods for FindBestMove and EvaluateCubeful Tue Oct 12 21:36:00 2004 Joseph Heled * eval.c (FindBestMoveInEval): Add usage of prunning nets. This is quite a large change, and since it adds a member to evalcontext, possibly a destructive one. Sun Oct 10 23:04:14 GMT 2004 Jon Nall * backgammon.h, gnubg.c, play.c: Added support for adding comments to moves from the command line. Closes bug #10638 Tue Oct 5 16:56:45 2004 GMT Jon Kinsey * database.py, relational.c, gtkgame.c (and others) : Added check for match in database Wed Sep 29 21:29:45 2004 Oystein Johansen * relational.c: make it compile without gtk Wed Sep 29 18:56:45 2004 GMT Jon Kinsey * database.py, relational.c, gtkgame.c: Added more relational database code Wed Sep 29 15:10:45 2004 Oystein Johansen * makebearoff.c: Display 'usage' on Windows. Sun Sep 19 14:56:45 2004 GMT Jon Kinsey * gtkgame.c: Fix gtk2 panel bug Thu Sep 16 8:56:45 2004 GMT Jon Kinsey * eval.c: Fix bug (navigate to last match crash) - hopefully Fri Sep 10 10:56:45 2004 GMT Jon Kinsey * gtkboard.c, gtkgame.c, gnubg.c, gtkpanels.c: Added command and theory panels (test) and slider for panels. Thu Sep 9 12:56:45 2004 GMT Jon Kinsey * gtkboard.c, render.*, gnubg.c: Small memory leaks, uninitialized memory reads and tidy up code added. May fix import .mat bugs Mon Sep 6 00:27:04 2004 GMT Jim Segrave * show.c = fix for running off array end in show path command Wed Sep 1 17:56:45 2004 GMT Jon Kinsey * gtkgame.c: Small import bug fixed Wed Aug 25 18:56:45 2004 GMT Jon Kinsey * gtkgame.c, gtkgamelist.c, import.c, sgf.c: Speed up loading and remove flickering Fri Aug 13 09:56:45 2004 GMT Jon Kinsey * play.c: Small bug fix (bug 9926) Wed Aug 11 23:39:41 CEST 2004 Joern Thyssen * external_y.y: remove %output to stop ylwrap complaining. Thu Aug 12 07:46:18 2004 Joseph Heled * gnubg.c: Add search in "scripts/gnubg.py" if all else fails in CommandLoadPython, since this IS the place 'gmake install' puts on my Linux box (i.e./usr/local/share/gnubg/scripts/gnubg.py). Mon Aug 02 09:56:45 2004 GMT Jon Kinsey * play.c: Fixed 3d quick draw bug Sun Aug 01 00:40:47 UTC 2004 Jim Segrave * gnubgmodule.c - calls to PythonGame had arguments in different order, so database ratings were calculated on 1 point matches Fri Jul 30 23:08:58 CEST 2004 Oystein Johansen * gtkgame.c (PythonShell): starting "idle" differs between platforms. Sun Jul 25 20:34:35 2004 GMT TAKAHASHI Kaoru * gnubg.c (Convert): Suppress compiler warnings. Synch with iconv() prototype. Sun Jul 25 19:19:41 2004 GMT TAKAHASHI Kaoru * rollout.h: Suppress compiler warnings; static declaration for `nSkip' follows non-static. Sun Jul 25 18:15:47 UTC 2004 Jim Segrave * gtkexport.c - fix handling of cube export settings (typo and corrections for unused entries) Mon Jul 19 09:53:10 CEST 2004 Joern Thyssen * gnubg.c (real_main): initialise random seed for rollout RNG. (bug reported by Chuck Bower, fix suggested by Jim) Mon Jul 12 22:48:32 CEST 2004 Petr Kadlec * gtkprefs.c (ImportDesign): Use ngettext. * html.c (HTMLBoardHeader): Ditto. Sun Jul 11 16:37:02 2004 GMT TAKAHASHI Kaoru * eval.c (EvalInitialise): Suppress compiler warnings. Sun Jul 11 14:47:30 2004 GMT TAKAHASHI Kaoru * gtkgame.c: include for isspace(). Sun Jul 11 14:42:51 2004 GMT TAKAHASHI Kaoru * dice.h: Added extern UserRNGOpen(); Sun Jul 11 13:30:11 2004 GMT TAKAHASHI Kaoru * htmlimages.c: include . Sun Jul 11 12:07:25 CEST 2004 Joern Thyssen * external.c: pacify fussy compilers. Sun Jul 11 07:17:35 2004 GMT TAKAHASHI Kaoru * gnubg.c (DisplayTimeAnalysis, ShowBoard, CommandCopy): Use ngettext. And tabify. * gtkboard.c (ReturnHits): Ditto. * gtkgame.c (TimeAnalysis, GTKShowScoreSheet): Ditto. * html.c (HTMLPrologue, ExportGameHTML): Ditto. * html.c (ExportPositionGammOnLine): Ditto. * play.c (ApplyMoveRecord): Ditto. Sat Jul 10 14:35:26 2004 GMT TAKAHASHI Kaoru * gtkoptions.c (aaszLang): Use ja_JP instead of ja_JA. Added ru_RU. Sat Jul 10 08:17:26 2004 GMT TAKAHASHI Kaoru * i18n.h [!ENABLE_NLS] (ngettext): New macro. Sun Jul 4 14:22:59 CEST 2004 Joern Thyssen * analysis.c (CashPoint): fix bug leading to wrong classification of wrong doubles. (reported by Hans-Jürgen Schäfer) * eval.c (calculate_gammon_rates): new function. * openurl.c, gtkgame.c, relational.c: pacify fussy compilers. Sun Jul 4 11:41:54 CEST 2004 Joern Thyssen * gtkprefs.c: add functions for importing and exporting board designs. Sat Jul 3 14:41:56 CEST 2004 Joern Thyssen * configure.in: rewrite test for ftgl. * gtkgame.[ch]: declare SelectFile external. Wed Jun 30 22:28:07 CEST 2004 Joern Thyssen * configure.in: write test for ftgl. Wed Jun 30 20:42:53 CEST 2004 Nis Joergensen * gtkboard.c: fix bug that disallowed certain legal moves. Mon Jun 28 16:56:45 2004 GMT Jon Kinsey * boards.xml: Add 2 new designs by Ruth Schneider and Ausbilder Schmidt Mon Jun 28 10:56:45 2004 GMT Jon Kinsey * gtkgamelist.c: Allow last move to be selected in game list * render.c: Small bug in design dialog Sun Jun 27 11:56:45 2004 GMT Jon Kinsey * gtkboard.c: Fixed bug - 2d chequers disappearing if dragged off board * positionid.c: Fixed bug - illegal position id's not being errored Sat Jun 26 16:49:31 CEST 2004 Nis Joergensen * speed.c (CommandCalibrate): Speed Calibration" now avoids using the same seed for randomization every time, so gives reliable results on consecutive runs. * gtkboard.c: Dragging checkers allows for pick-and-pass. The logic I have implemented is to hit if possible, and if there are two options, hit with the "left" die (ie highest in standard setup). I am still working on undo of pick-and-pass. * play.c: Gnubg allows you to resign AFTER you roll, based on what you rolled. This actually fixes a way to cheat - resigning if your equity drops to below -1 or -2 when you roll. Thu Jun 17 10:56:45 2004 GMT Jon Kinsey * gtkchequer.c, gtkgamelist.c: Fixes for styles in gamelist Wed Jun 16 20:50:46 CEST 2004 Joern Thyssen * gnubg.gtkrc.in: backport changes to gnubg.gtkrc Wed Jun 16 12:56:45 2004 GMT Jon Kinsey * gtkchequer.c, gtkboard.c, gnubg.gtkrc: separate styles for current move and done move in move list Wed Jun 16 12:56:45 2004 GMT Jon Kinsey * gtkchequer.c: use move style for hint window, also removed highlight code from several files Tue Jun 15 20:32:05 CEST 2004 Joern Thyssen * gnubg.gtkrc.in: autogenerate gnubg.gtkrc Tue Jun 15 15:56:45 2004 GMT Jon Kinsey * gtkgame.c: gtk_widget_destroy error message when opening hint window (reported by Ian) Tue Jun 15 12:56:45 2004 GMT Jon Kinsey * gtkgamelist.c, gnubg.gtkrc: Fix font styles for gtk2 and style order Tue Jun 15 05:58:34 2004 TAKAHASHI Kaoru * credits.sh, credits.c, AUTHORS: Fix Japanese translations credit. Sun Jun 13 22:32:09 CEST 2004 Jim Segrave * import.c - allow handling uncompleted matches in .mat files Sat Jun 12 12:25:54 CEST 2004 Joern Thyssen * import.c (ParseSGGOptions): use strcasecmp for deciding which variant of backgammon is used. (reported by Hugh Sconyers) Fri Jun 11 18:56:45 GMT 2004 Jon Kinsey * gtkboard.c: Fix minor chequer display bug Fri Jun 11 19:00:05 CEST 2004 Jim Segrave * gtkgamelist.c gnubg.gtkrc * Add gtkrc support for any-blunder/any-error/any-doubtful Thu Jun 10 17:41:40 CEST 2004 Joern Thyssen * Makefile.am: add gtkgamelist.c Thu Jun 10 14:56:45 2004 GMT Jon Kinsey * gtkgamelist.c, gnubg.gtkrc: Multiple styles and new defaults for game list Wed Jun 9 14:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkgamelist.c, gnubg.gtkrc: Get game list colours from gtkrc file Tue Jun 8 8:56:45 2004 GMT Jon Kinsey * gtkgame.c, gtkgamelist.c: Colour mistakes in game list Mon Jun 7 8:56:45 2004 GMT Jon Kinsey * gtkgame.c: Remove keyboard focus from game window, fix minor bug with new right click menu. * gnubg.c: Empty board on startup (try #2) Sun Jun 6 18:56:45 2004 GMT Jon Kinsey * gnubg.c: Empty board on startup * gtkboard.c: Close hint window when editing * import.c: Ignore empty lines in mat import Fri Jun 4 22:58:22 CEST 2004 Joern Thyssen * eval.c (EvalKey): add another bit to match scores in hash key. (fixes bug #9211 reported by Casey Hopkins) Fri Jun 4 18:56:45 2004 GMT Jon Kinsey * gtkgame.c, gnubg.c: Add show scoresheet command (to right click menu) Wed Jun 2 9:56:45 2004 GMT Jon Kinsey * gtkgame.c, gtkboard.c: Add undo right click menu Thu May 27 19:05:49 CEST 2004 Joern Thyssen * import.c (ParseMatMove): fix logic for calculating resignations. (reported by Joachim Matussek) Tur May 20 15:56:45 2004 GMT Jon Kinsey * external.*: Remove memory leaks Tue May 18 15:56:45 2004 GMT Jon Kinsey * external.*: Minor changes to parser Tue May 18 8:56:45 2004 GMT Jon Kinsey * gtkprefs.c, render.c: Several small fixes to board appearance options Wed May 12 10:56:45 2004 GMT Jon Kinsey * boards.xml, gtkprefs.c, render.c+.h, renderprefs.c: Add Taki-style rounded points Mon May 10 21:33:28 CEST 2004 Joern Thyssen * external.h: move "#define closesocket close" to external.h Sat May 8 11:25:08 CEST 2004 Joern Thyssen * gnubg.c, show.c: enlarge buffers Fri May 7 21:13:26 CEST 2004 Joern Thyssen * external_l.l: fix buffer overflow. Fri May 8 10:56:45 2004 GMT Jon Kinsey * external.c, dice.c, set.c: Fix socket code for windows Fri May 7 16:17:09 CEST 2004 Joern Thyssen Change union moverecord into struct moverecord (this is step 1 towards better support for editing positions and storing analysis) * backgammon.h: Change union moverecord into struct moverecord (change a gazillion subroutines) Fri May 8 10:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkgame.c, gtkpath.c, set.c: Added png to set path command Fri May 7 07:48:47 CEST 2004 Joern Thyssen Prerelease 0.14.3. CVS tag is pre-rel-0-14-3 * configure.in, gtkgame.c: prelease 0.14.3 Fri May 7 07:27:18 CEST 2004 Joern Thyssen * gnubg.c: fix problems with initialisation of rollout contexts. This lead the problem about cubeless and cubeful equities being different for -1,-3C rollouts reported by Robert Eberlein. Thu May 6 15:56:45 2004 GMT Jon Kinsey * gtktempmap.c, gtkboard.c: Show correct dice colour in temperture map when in 3d Mon May 3 15:20:43 CEST 2004 Joern Thyssen * osr.c, dice.c: add mti as parameter to init_genrand. Fri Apr 30 18:56:45 2004 GMT Jon Kinsey * gtkgame.c, gtkboard.c: Change dice and cube selection dialogs to fixed size * gtkboard.c board3d/graph.c: Remove event->count optimization as now done in gtk * i18n.c: Warn if too many PopLocale() calls attempted * gtkprefs.c, htmlimages.c: No libart build fixes * gtkprefs.c: Small bug in colours when switching from 3d to 2d Thu Apr 29 20:44:24 CEST 2004 Joern Thyssen * bearoff.c (GetDistCompressed): fix sanity check for huge databases. Wed Apr 28 20:28:22 CEST 2004 Joern Thyssen Add new utility program bearoffdump for inspection of databases. * bearoffdump.c: new file. * Makefile.am: add bearoffdump as installable file. Wed Apr 28 16:56:45 2004 GMT Jon Kinsey * set.c: Change "set priority idle" to set the process priority to idle (for windows). Mon Apr 26 13:56:45 2004 GMT Jon Kinsey * gnubg.c, credits.*: Moved copyright string to credits.sh Sun Apr 25 08:46:27 CEST 2004 Dmitri I GOULIAEV * credits.sh: add Dmitri I GOULIAEV * NEWS: add russian translation Fri Apr 23 22:12:51 CEST 2004 Joern Thyssen * gnubg.c: according to FSF we must give individual years rather than an interval. * gtkboard.c (update_pipcount): show epc in lowercase. * gnubg.c: fix a typo in the definition for "relational" command. * relational.c: add code for most functions. * scripts/database.py: adapt code to relational.c Fri Apr 23 13:56:45 2004 GMT Jon Kinsey * gnubg.c: Change year to 2004 for command line build Thu Apr 22 21:09:01 CEST 2004 Joern Thyssen Introduce RNG context for storage of RNG-specific private data. * dice.c (many functions): add rngctx to a number of functions (change all callers) * show.c (CommandShowSeed): show RNG counter as well. Wed Apr 21 22:53:44 CEST 2004 Petr Kadlec Corrected some i18n-related problems + typos. * gnubg.c, gtkgame.c, gtkprefs.c, gtkrace.c, html.c, play.c, set.c, show.c, text.c: Added calls to gettext, marked some previously unmarked translatable strings (and vice versa), corrected a few typos. Tue Apr 20 17:56:25 CEST 2004 Joern Thyssen * matchequity.c (initPostCrawfordMETFromParameters): add missing call to PushLocale. (reported by Joachim Matussek) Mon Apr 19 22:52:41 CEST 2004 Joern Thyssen * gnubg.c (EPC): fix "same dice sequence for several games in a row"-bug, reported by several users (Erik Barfoed, Øystein, Murat etc). Well, this is not really a fix, I've just changed the code to avoid calling the OSR code, that resets the seed. We really need to introduce several RNG contexts... Mon Apr 19 10:56:45 2004 GMT Jon Kinsey * gtkprefs.c: Small 3d bug fix Sun Apr 18 10:53:26 CEST 2004 Joern Thyssen Define functions for CLI and GUI support for relational database interface. * gnubg.c: new functions "relational ...". * relational.c, Makefile.am: new file * gtkgame.c: menu items for relational database. * dice.c (InitRNGSeedLong): allow setting seed = 0. Sat Apr 17 23:43:07 2004 Oystein Johansen * render.c (RenderFrameWood): Fix typo. Sat Apr 17 20:01:07 CEST 2004 Joern Thyssen * set.c (CommandSetMet): call "clear hint". Sat Apr 17 10:58:18 CEST 2004 Joern Thyssen Save leading comment lines in the match information when reading Jellyfish .mat files (e.g., the information Dueller adds to .mat files) * import.c (ImportMat): same comments. * html.c (HTMLMatchInfo): rearrange match info into a Fri Apr 16 22:02:23 CEST 2004 Joern Thyssen Add built-in support for mec * mec.c: new file (copy of original mec.c with modfications for gnubg) * Makefile.am: add mec.c * matchequity.c (initMetFromParameters, initPostCrawfordMETFromParameters): support for mec. Fri Apr 16 16:56:45 2004 GMT Jon Kinsey * sound.c: Fix bug if no sound card on windows Wed Apr 14 22:41:23 CEST 2004 Joern Thyssen * set.c (SetMoveFilter): insert some debug code. * set.c: set szSetCommand a few places. Wed 14 Apr 2004 16:39:45 GMT Jim Segrave * play.c - turn off Crawford on one point matches * board3d/misc3d.c - avoid segfault if no textures (CLI mode) Mon 12 Apr 2004 13:12:06 GMT Jim Segrave * set.c - put if (fX) wrapper around SetToolbarStyle, stops GTK complaints in text mode Sun Apr 11 22:52:49 CEST 2004 Joern Thyssen * gtkprefs.c (SetTitle): move misplaced pbdeSelected. (contributed by Petr Kadlec) * gnubg.c (real_main): no env. variable DISPLAY on wintendo. (contributed by Petr Kadlec) Sun Apr 11 19:20:52 CEST 2004 Joern Thyssen Various patches from Mike Petch. * gnubg.c (real_main): avoid segfaults with gnubg -t * sound.c (SoundWait): do nothing if sound is disabled. * sound.c: only include stropts.h when HAVE_STROPTS_H * openurl.c, import.c: include glib.h * Makefile.am: move openurl.c to common files (it's now being used by CommandShowManualWeb) * configure.in: various checks for Mac. * set.c (CommandSetGUIShowEPCs): define a NO_GUI variant of function Thu Apr 8 16:03:09 CEST 2004 Joern Thyssen Show EPCs in GUI. (suggested by Ian Shaw) * gtkboard.c (update_pipcount): show EPCs * gnubg.c: new command "set gui showepcs on|off" * set.c (CommandSetGUIShowEPCs): new sub. * gnubg.c (EPC): new parameter fOnlyRace * gtkoptions.c: gui control for setting fGUIShowEPCs Wed Apr 7 10:46:00 CEST 2004 Joern Thyssen * configure.in, sound.c, config.h.in: check for _af_ulaw2linear Mon Apr 5 08:24:52 CEST 2004 Joern Thyssen * Makefile.am: add gnubg.sql to DATA * gnubg.sql, scripts/database.py: rename stat to matchstat, and change some PKs/FKs * gnubg.c (CommandLoadPython): use PathSearch. Sun Apr 4 15:50:55 CEST 2004 Joern Thyssen First implementation of gnubg-rel.database interface. * gnubg.sql: DDLs for gnubg database. * scripts/database.py: python script for adding match to database. Sun Apr 4 15:11:10 2004 Joern Thyssen * gnubgmodule.c (PyGameStats): add missing statistics. * gnubgmodule.c: new functions "gnubg.luckrating" and "gnubg.errorrating". Sun Apr 4 10:35:13 2004 Joern Thyssen Respect $BROWSER (http://www.catb.org/~esr/BROWSER/index.html) * openurl.c: use env. variable BROWSER. Also, call "system" instead of g_command_line_sync which doesn't seem to work with lynx. * gnubg.c: new commands "show manual [web|gui]". * gtkgame.c: use "show manual [web|gui]". * show.c: new functions "show manual [web|gui]". Sun Apr 4 09:43:17 2004 Joern Thyssen * sound.c: include Thu Apr 1 11:56:45 2004 GMT Jon Kinsey * gtkchequer.c: Reset interupt flag on analysis start * sound.c: Add some error handiling to windows sound Wed Mar 31 20:58:49 2004 Joern Thyssen * Makefile.am: add BR1_SOURCES to makebearoff and makehyper. * configure.in: whoops, remove "dynamic".. * sound.c: include [SIGIO] Wed Mar 31 9:56:45 2004 GMT Jon Kinsey * gtkprefs.c and other files: Moved preview in preferences Mon Mar 29 17:56:45 2004 GMT Jon Kinsey * gtkgame.c: Fixed small bug to allow both names to be swapped Mon Mar 29 09:40:02 CEST 2004 Joern Thyssen * Makefile.am: target for br1.c not kept up to date with changes in makebearoff * Makefile.am: FLEX->LEX, BISON->YACC * bearoff.h: declare BearoffAlloc extern * configure.in: add "dynamic" as parameter to --enable-bearoff * makebearoff1.c: update code to match latest version of bearoff.h * play.c (DumpGameList): fix typo, add linebreak (reported by Mike Whitton) * gtkgame.c: use correct release_id when reporting bugs. Sun Mar 28 09:07:48 2004 Joern Thyssen * matchequity.c (initMETZadeh): use G1 for calculation of 1-away pre-Crawford values. Sat Mar 27 10:45:08 CET 2004 Joern Thyssen Prerelease 0.14.2 Thu Mar 25 22:22:57 CET 2004 Joern Thyssen * Makefile.am, */Makefile.am: add a few missing files (reported by Christian Anthon) Thu Mar 25 21:04:54 CET 2004 Joern Thyssen * credits.sh, gtkgame.c, show.c, credits.c, credits.h: Move generation of cred entries into credits.sh for easy reuse in the text version of CommandShowCredits. Wed Mar 24 12:56:45 2004 GMT Jon Kinsey * gtkgame.c: More credits and version info now copyable. Tue Mar 23 12:56:45 2004 GMT Jon Kinsey * boards.xml, textures.txt: Added settings for final few 3d designs, tidied up design a bit too. Mon Mar 22 12:56:45 2004 GMT Jon Kinsey * gtkgame.c: Make sure messages shown when docked panels are hidden, also don't show a message when setting cube (bug 3973) Fri Mar 19 12:56:45 2004 GMT Jon Kinsey * gtkgame.c: Change window order and titles, and put back accelerators from windows (Ned's suggestions) Fri Mar 19 00:26:45 2004 Oystein Johansen * external.c (and other files): changes to use winsock2.h Thu Mar 18 10:56:45 2004 GMT Jon Kinsey * gtkgame.c: Panel bug fixed (removed warning) Mon Mar 16 11:56:45 2004 GMT Jon Kinsey * gtkgame.c: Panel bug fixed (crash at startup) Mon Mar 15 17:56:45 2004 GMT Jon Kinsey * sound.c: Wait when multiple sounds attempted to be played (windows) Mon Mar 15 11:56:45 2004 GMT Jon Kinsey * gnubg.c gtkgame.c: Reorganized about box Mon Mar 15 07:49:53 2004 Joern Thyssen * gnubgmodule.c (PythonInitialise): fix bug for szDir==NULL (reported by Joseph Heled) Sun Mar 14 08:55:39 2004 Joseph Heled * gtkcolour.h: Change broken type for GtkColourPicker::func and prototype. Fri Mar 12 10:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkprefs.c, gtkgame.c: Removed texture load errors when in 2d mode Mon Mar 8 8:56:45 2004 GMT Jon Kinsey * gtkcolor.c, gtkprefs.c: Remove "property delete" gtk warning message when changin colours Thu Mar 4 10:56:45 2004 GMT Jon Kinsey * gtkgame.c, gnubg.c: Replace USE_OLD_LAYOUT compile flag with menu option * gtkboard.c: Crawford flag only changeable when editing Sun Feb 29 18:17:14 2004 TAKAHASHI Kaoru * gnubg.c: #include only if WIN32 defined. Wed Feb 25 10:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkgame.c: Add option so toolbar can show text, icon or both Wed Feb 25 10:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkgame.c, set.c: Save shown panels * gnubg.c : Fixed small show epc bug Fri Feb 20 15:10:39 CET 2004 Joern Thyssen * Makefile.am, configure.in: move gnubg.py to scripts. * gnubgmodule.c: _MAX_PATH only defined onwintendo. Thu Feb 19 13:56:45 2004 GMT Jon Kinsey * import.c: Fixed import jellyfish pos problem (bug 6086) Thu Feb 19 9:56:45 2004 GMT Jon Kinsey * scripts: Added new directory to cvs for python scripts Wed Feb 18 11:56:45 2004 GMT Jon Kinsey * gtkgame.c: Remove maximum column size of text copied to clipboard from statistics view (Bug 4161). Mon Feb 16 21:57:18 CET 2004 Joern Thyssen * bearoff.c (HeuristicDatabase): align heuristic database with GetBearoffDistUncompressed (a.k.a. the 40 byte offset). (reported by Daniel Murphy) Mon Feb 16 9:56:45 2004 GMT Jon Kinsey * html.c: Tidy text version of html export Sat Feb 14 20:32:24 CET 2004 Joern Thyssen * gnubg.c: new command "load python ". Mon Feb 9 22:56:17 CET 2004 Joern Thyssen * import.c (ImportTMG): don't call SwapPlayers unless a game is in progress. (reported by John Marttila) Thu Feb 5 19:06:31 CET 2004 Joern Thyssen * progress.c (formatDelta): fix small bug leading to gnubg thining that there is 60 hours/day. (reported by Michael Depreli) Wed Feb 4 17:56:45 2004 GMT Jon Kinsey * import.c (and minor changes in others) : Limit size of player names in import files, bug #7526 Mon Feb 02 2004 18:42:05 GMT * timer.c - wrong #if around include Fri Jan 30 9:56:45 2004 GMT Jon Kinsey * several files: Small changes for msdev compiler Thu Jan 29 10:56:45 2004 GMT Jon Kinsey * gtkboard.c, gtkprefs.c: 3d quick draw-last options added Wed Jan 28 10:56:45 2004 GMT Jon Kinsey * gtkboard.c: 3d quick draw-chequer target help added Tue Jan 27 9:56:45 2004 GMT Jon Kinsey * gtkboard.c, gtkprefs.c: Some more 3d quick draw code Mon Jan 26 19:24:34 2004 Joern Thyssen NetBSD compilation fixes by Adrian Bunk. * gnubg.c (real_main): HAVE_NL_INFO does not necessarily imply HAVE_LANGINFO_CODESET * sound.c: include sys/types.h before sys/audioio.h to define u_int. Mon Jan 26 07:31:03 2004 TAKAHASHI Kaoru * htmlimages.c [!HAVE_LIBPNG] (CommandExportHTMLImages): Argument synch with HAVE_LIBPNG version. Wed Jan 21 21:17:12 2004 Joern Thyssen * bearoff.c (GetDistCompressed): fix stupid stupid stupid bug. (reported by several users) Tue Jan 20 00:22:21 CET 2004 Joern Thyssen Prerelease 0.14.1 * configure.in: bump to 0.14.1-devel Tue Jan 20 00:02:30 CET 2004 Joern Thyssen * bearoff.c (GetDistCompressed): add sanity check to detect corrupted bearoff files. (inspired by bug #7296 by Rod Roark) Mon Jan 19 10:56:45 2004 GMT Jon Kinsey * timer.c timecontrol.c: Small timing changes Mon Jan 19 9:56:45 2004 GMT Jon Kinsey * gnubg.c, gtkboard.c, gtkchequer.c, gtkgame.c, gtkgame.h, gtkprefs.c, gtktoolbar.c: More 3d quick draw option stuff Fri Jan 16 9:56:45 2004 GMT Jon Kinsey * set.c, render.c, play.c, renderprefs.c, gtkprefs.c, gtkoptions.c, gtkgame.c, gtkboard.c: 3d quick draw option Fri Jan 16 9:56:45 2004 GMT Jon Kinsey * bearoff.c, show.c, progress.c: Removed some build warnings Sun Jan 4 13:35:16 2004 Joern Thyssen * gtkchequer.c (CreateMoveList): remove the old layout version as the new can do both versions. (reported by Nardy) Sun Jan 4 11:05:03 2004 Joern Thyssen The hint dialog will now always show the w/g/bg's whereas the panelled analysis only shows the equity/MWC. Pressing the "details" button will pop up the hint dialog. * gtkchequer.c: restore some of the old non-panel code Sun Jan 4 2004 00:51:45 Jim Segrave * makebearoff.c: va_start needs stdarg.h Sat Jan 3 16:53:09 2004 Oystein Johansen * makebearoff.c: Add progress bar. (Win32 only) * makebearoff.rc: New file. Sat Jan 3 14:32:46 2004 Joern Thyssen Some updates to EPCs: * gnubg.c (EPC): return mu and sigma if requested. * gnubg.c (ShowEPC): calculate GWC from mu and sigma. * onechequer.c (GWCFromMuSigma, GWCFromDist): new funtions. Sat Jan 3 01:02:49 2004 Joern Thyssen * configure.in: look for socklen_t. Fri Jan 2 19:23:09 2004 Oystein Johansen * render.c (RenderDice): Redesign the dice in the 2D board. * gtkboard.c (DrawDie): Redesign the dice in the dice selection dialog. Fri Jan 2 12:14:52 2004 Joern Thyssen Use one chequer racing formulae from Zadeh & Kobliska, Management Science, 1977. * onechequer.c (GWCFromPipCount): new function. Delete obsolete OneChequer and GetDistFromPipCount. (change all callers) Thu Jan 1 22:59:09 2004 Oystein Johansen * external.c: Add som #if USE_SOCKETS to make it compile w/o socket support. Thu Jan 1 20:29:09 2004 Joern Thyssen * gnubg.c (DisplayAnalysis, DisplayTimeAnalysis): show time analysis in cli. * gtkgame.c (TimeAnalysis, SetAnnotation): show time analysis in gui. * analysis.c, import.c: remove debug output * format.c (OutputMWCDiff): new function. Thu Jan 1 18:56:50 2004 Joern Thyssen Report equity loss due to "time outs", e.g., when importing matches from TMG which ended with "time out". [USE_TIMECONTROL] TODOs: save in SGF file, text/gtk analysis output * analysis.c (AnalyzeMove): analyse time-outs. * analysis.c (updateStatContext): calculate equity loss from time-outs. * formatgs.c (formatGS): output time-outs. * import.c (ParseTMGGame): don't record dice rolls with dice recorded as '?' Thu Jan 1 12:44:52 2004 Joern Thyssen Happy New Year to all! * gtktoolbar.c (ToolbarUpdate): disable edit button if there is no match in progress (reported by Misja Alma) Wed Dec 31 23:24:55 2003 Joern Thyssen Change external interface to use yacc/lex parser/scanner. * configure.in: look for yacc, lex using correct macros. * external_l.l, external_y.y: new files * external.c: use yacc/lex Mon Dec 29 23:58:34 2003 Joern Thyssen * play.c (NewGame): remove some old code that led to gnubg deleting the current game. I wonder why I originally inserted that code??? (bug #7008 reported by Petr Kadlec) Mon Dec 29 23:17:20 2003 Joern Thyssen * progress.c: move cpp directive. Mon Dec 29 23:14:35 2003 Joern Thyssen * Makefile.am, configure.in: don't use old X code anymore. (bug #7003, reported by Rod Roark) Thu Dec 18 23:35:16 2003 Joern Thyssen * configure.in: search for ATLAS libblas. * bearoff.c: disable cache, since it appears to be rather inefficient. * bearoff.c (ReadBearoffOneSidedExact): only use cache when initialised. * show.c (CommandShowEPC): new subroutines. * gnubg.c (ShowEPC, EPC): new functions. * gnubg.c: new command "show epc". * onechequer.c (DistFromEPC): new function. * makebearoff.c (BearOff): fix database lookup bug. * gtktheory.c, gtkbearoff.c, gtkgame.c: fix font bug introduced earlier. * gtkbearoff.c (GTKShowEPC): new function. * eval.c (EvalInitialise): initialise table used for neural net evaluation * gtkgame.c: add "show epc" to menu. Sat Dec 13 21:15:52 2003 Joern Thyssen * gtkrace.c (OneChequerPage): remove call to SwapSides (reported by Ned Cross and Petr Kadlec) * gnubg.c (HintChequer): compile error: move "moverecord *pmr" outside USE_GTK. (reported by Nardy) * gtkgame.c (ReportBug): remove extra slash in path (bug #6898 by Kennedy Fraser) * analysis.c (AnalyzeMove): generalise calculation of is_initial_position. Use is_initial_position for calculation of luck. (reported by Mathias Kegelmann) * progress.c: print time elapsed, estimated time left, and estimated final standard error. * show.c (CommandShowVariation): * bearoff.c, format.c, gtktheory.c: add some gettexts. * import.c (isAscending): fix off-by-one bug. (reported by Joseph Heled) * set.c (CommandSetVariation): add some extra output to emphasize that the new setting won't be effective until a new match or session has been started. Mon Dec 29 10:56:45 2003 GMT Jon Kinsey * htmlimages.c, html.c: Small fixes and variable size html image generation Wed Dec 3 11:56:45 2003 GMT Jon Kinsey * htmlimages.c: Tidied code Sun Nov 30 13:15:48 2003 Joern Thyssen * gnubg.c (real_main): honour env. var HISTSIZE. * gnubg.c (CommandHistory): show all entries in history. (suggested by Achim) Son Nov 30 12:50:45 2003 Joern Thyssen * html.c (HTMLPrologue): set Charset to GNUBG_CHARSET instead of hardcoded ISO-8859-1. (suggested by Petr Kadlec) Sun Nov 30 09:56:25 2003 Joern Thyssen * gtkbearoff.c, gtkgame.c, gtktheory.c: subst. "iso8859-1" with "*" in font names. (suggested by Petr Kadlec) Sun Nov 30 09:10:46 2003 Joern Thyssen * gnubg.c (HintCube): improve logic for determining whether a move has been made: (a) by having moved something in the GUI (old logic) (b) by going back in the match and doing a hint on an already stored move (suggested by Michael Depreli) Sun Nov 30 08:47:01 2003 Joern Thyssen New command "clear hint" to allow CLI users to force re-evaluation of "hint" after changing settings. (suggested by Achim) * gnubg.c (CommandClearHint): new command "clear hint". * gnubg.c (InvalidateStoredCube): new function. * gnubg.c (HintCube): fix typo Sat Nov 29 21:22:13 2003 Joern Thyssen Implement history * gnubg.c (real_main, PromptForExit, ProcessInput): implement history * gnubg.c (CommandHistory): new command "history". Sat Nov 29 11:02:50 2003 Joern Thyssen * gnubgmodule.c: new python command "nextturn" to emulate C routine "NextTurn". * gnubgmodule.c (PyGameStats): add a few stats. * gnubgmodule.c (PythonCommand): add calls to nextturn. Sat Nov 29 10:14:33 2003 Joern Thyssen * gtkgame.c (ReportBug): use uname to improve logic. Thu Nov 27 9:56:45 2003 GMT Jon Kinsey * htmlimages.c: Fix dice colour * gtkboard.c: Remove previous fix... Wed Nov 26 22:12:37 2003 GMT Holger Bochnig * gtkgame.c: when opening the bug report page in a browser window make gnubg fill in its version, build date and the operating system Mon Nov 24 9:56:45 2003 GMT Jon Kinsey * gtkprefs.c: Make sure preview appears if libxml not present * gtkboard.c: Remove valgrind error Sun Nov 23 21:07:12 GMT Jim Segrave * gnubg.c function header comments for token handling Sat Nov 21 21:19:17 2003 Oystein Johansen * gtkgame.c: corrected some links (reported by Frank Grosse) Thu Nov 20 20:24:04 GMT Jim Segrave * rollout.c - board setup in .sgf files of rollouts only worked if player 0 made first move, now appears to be correct for both players and double by both players Thu Nov 20 07:44:55 2003 TAKAHASHI Kaoru * gtkgame.c (EvalWidget): Add /* xgettext: no-c-format */ comment. Wed Nov 19 19:52:16 2003 GMT Jim Segrave * gtkgame.c gtkprefs.c gtkrace.c add some more I18n strings Wed Nov 19 19:16:25 2003 GMT Jim Segrave * play.c - always output moves to stdout/message window Wed Nov 19 16:35:25 2003 GMT Holger Bochnig * htmlimages.c, play.c, progress.c, rollout.c: make CLI version compile, get rid of compiler warnings Wed Nov 19 07:15:17 2003 Oystein Johansen * latex.c: use unicode and decrease size of board Mon Nov 17 20:04:17 2003 GMT Holger Bochnig * gtkoptions.c: add GUI menu entry for Czech language Sun Nov 16 10:56:59 2003 Joern Thyssen * play.c (DiceRolled): add call to ShowBoard for CLI. (reported by Achim) Wed Nov 12 01:17:58 2003 Oystein Johansen * gnubg.iss: New file for building MS-Windows installation archives with Inno Setup. Sat Nov 8 19:56:58 GMT 2003 Jim Segrave * analysis.c - set up cubeinfo before analysis of a SET_DICE moverecord. Thu Nov 6 13:18:48 GMT 2003 Jim Segrave * analysis.c - Stupid, stupid, stupid. My silly last minute change prevented cube analysis on any position except the initial one. Arrgh. Wed Nov 5 00:31:27 GMT 2003 Jim Segrave * analysis.c - don't analyse cube if board is in initial position (spurious annotations for not doubling when tutor mode was enabled) * gtkoptions.c - fix bug which crashed with invalid language option Mon Nov 3 11:56:45 2003 GMT Jon Kinsey * gtkgame.c: Changes to the panel view Sat Nov 1 14:36:45 2003 Joern Thyssen * htmlimages (CommandExportHTMLImages): make the html image export work with the new board dimensions. (reported by Olivier Croisille) * html.c (printHTMLBoardGNU): some new images. Wed Oct 29 12:26:45 2003 GMT Jon Kinsey * gtkgame.c: Moved .xpm files in root directory to xpm directory Tue Oct 28 21:10:39 GMT 2003 Jim Segrave * gtkoptions.c - add Turkish and Icelandic to language options Tue Oct 28 11:56:45 2003 GMT Jon Kinsey * import.c: Minor memory bug * gtkboard.c: Minor chequer sound fix Fri Oct 25 10:10:07 GMT Jim Segrave * rollout.c - correct stupid mistake causing board setup in sgf file to be reversed Fri Oct 25 10:10:07 GMT Jim Segrave * rollout.c - cast to keep compiler happy Thu Oct 24 22:52:23 2003 GMT Jim Segrave * set.c backgammon.h rollout.c gnubg.c - added text mode commands set rollout log on/off, set rollout logfile