*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "3dview.h"
-#include <math.h>
+#include <cmath>
+#include <cstdio>
#include <algorithm>
dx = view->eye[XX];
dy = view->eye[YY];
dz = view->eye[ZZ];
- l = sqrt(dx*dx+dy*dy+dz*dz);
- r = sqrt(dx*dx+dy*dy);
+ l = std::sqrt(dx*dx+dy*dy+dz*dz);
+ r = std::sqrt(dx*dx+dy*dy);
#ifdef DEBUG
gmx_vec4_print(debug, "eye", view->eye);
- printf("del: %10.5f%10.5f%10.5f l: %10.5f, r: %10.5f\n", dx, dy, dz, l, r);
+ std::printf("del: %10.5f%10.5f%10.5f l: %10.5f, r: %10.5f\n", dx, dy, dz, l, r);
#endif
if (l < SMALL)
{
dr = view->eye[i];
dr2 += dr*dr;
}
- dr1 = sqrt(dr2);
+ dr1 = std::sqrt(dr2);
if (fac < 1)
{
bm = std::max(norm(view->box[XX]), std::max(norm(view->box[YY]), norm(view->box[ZZ])));
void translate_view(t_3dview *view, int axis, gmx_bool bPositive)
{
#ifdef DEBUG
- printf("Translate called\n");
+ std::printf("Translate called\n");
#endif
if (bPositive)
{
void reset_view(t_3dview *view)
{
#ifdef DEBUG
- printf("Reset view called\n");
+ std::printf("Reset view called\n");
#endif
set_scale(view, 4.0, 4.0);
clear_rvec(view->eye);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "buttons.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
#include <algorithm>
break;
default:
fprintf(stderr, "Invalid bitmap in init_vbox %d\n", ID);
- exit(1);
+ std::exit(1);
}
/* Rely on the fact that all bitmaps are equal size */
pm = XCreatePixmapFromBitmapData(x11->disp, x11->root,
*/
#include "gmxpre.h"
+#include "dialogs.h"
+
#include "config.h"
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
#ifdef HAVE_UNISTD_H
#include <unistd.h> // for fork()
#endif
-#include "dialogs.h"
-
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/names.h"
#include "gromacs/utility/cstringutil.h"
char command[STRLEN];
char tmp[32];
- strcpy(tmp, "dialogXXXXXX");
+ std::strcpy(tmp, "dialogXXXXXX");
gmx_tmpnam(tmp);
- if ((tfil = fopen(tmp, "w")) == NULL)
+ if ((tfil = std::fopen(tmp, "w")) == NULL)
{
- sprintf(tmp, "%ctmp%cdialogXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
+ std::sprintf(tmp, "%ctmp%cdialogXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
gmx_tmpnam(tmp);
}
else
{
- fclose(tfil);
+ std::fclose(tfil);
}
- if ((tfil = fopen(tmp, "w")) == NULL)
+ if ((tfil = std::fopen(tmp, "w")) == NULL)
{
gmx_fatal(FARGS, "Can not open tmp file %s", tmp);
}
- fprintf(tfil, "%s\n", script);
- fprintf(tfil, "sleep %d\n", nsleep);
- fclose(tfil);
+ std::fprintf(tfil, "%s\n", script);
+ std::fprintf(tfil, "sleep %d\n", nsleep);
+ std::fclose(tfil);
- sprintf(command, "xterm -title %s -e sh %s", title, tmp);
+ std::sprintf(command, "xterm -title %s -e sh %s", title, tmp);
#ifdef DEBUG
- fprintf(stderr, "command: %s\n", command);
+ std::fprintf(stderr, "command: %s\n", command);
#endif
- if (0 != system(command))
+ if (0 != std::system(command))
{
gmx_fatal(FARGS, "Failed to execute command: %s", command);
}
break;
}
#ifdef DEBUG
- fprintf(stderr, "exportcb: item_id=%d\n", item_id);
+ std::fprintf(stderr, "exportcb: item_id=%d\n", item_id);
#endif
break;
case DLG_EXIT:
if ((bOk = gmx_strcasecmp("ok", set)) == 0)
{
- strcpy(gmx->confout, EditText(dlg, eExConf));
+ std::strcpy(gmx->confout, EditText(dlg, eExConf));
}
HideDlg(dlg);
if (bOk)
et = EditText(dlg, ID);
if (et)
{
- strcpy(buf, et);
+ std::strcpy(buf, et);
}
}
case ebDPlus:
DO_NOT(gmx->man->bPlus);
#ifdef DEBUG
- fprintf(stderr, "gmx->man->bPlus=%s\n",
- gmx->man->bPlus ? "true" : "false");
+ std::fprintf(stderr, "gmx->man->bPlus=%s\n",
+ gmx->man->bPlus ? "true" : "false");
#endif
break;
case ebRMPBC:
case ebCue:
DO_NOT(gmx->man->bSort);
#ifdef DEBUG
- fprintf(stderr, "gmx->man->bSort=%s\n",
- gmx->man->bSort ? "true" : "false");
+ std::fprintf(stderr, "gmx->man->bSort=%s\n",
+ gmx->man->bSort ? "true" : "false");
#endif
break;
case ebSkip:
- nskip = strtol(set, &endptr, 10);
+ nskip = std::strtol(set, &endptr, 10);
if (endptr != set)
{
#ifdef DEBUG
- fprintf(stderr, "nskip: %d frames\n", nskip);
+ std::fprintf(stderr, "nskip: %d frames\n", nskip);
#endif
if (nskip >= 0)
{
}
break;
case ebWait:
- nwait = strtol(set, &endptr, 10);
+ nwait = std::strtol(set, &endptr, 10);
if (endptr != set)
{
#ifdef DEBUG
- fprintf(stderr, "wait: %d ms\n", nwait);
+ std::fprintf(stderr, "wait: %d ms\n", nwait);
#endif
if (nwait >= 0)
{
}
default:
#ifdef DEBUG
- fprintf(stderr, "item_id: %d, set: %s\n", item_id, set);
+ std::fprintf(stderr, "item_id: %d, set: %s\n", item_id, set);
#endif
break;
}
{
char script[256];
- sprintf(script, "vi %s", fn);
+ std::sprintf(script, "vi %s", fn);
shell_comm(fn, script, 0);
- exit(0);
+ std::exit(0);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "fgrid.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/futil.h"
void ReadDlgError(const char *infile, eDLGERR err, const char *s,
const char *file, int line)
{
- fprintf(stderr, "Error: ");
+ std::fprintf(stderr, "Error: ");
switch (err)
{
case eNOVALS:
- fprintf(stderr, "Not enough values for %s", s);
+ std::fprintf(stderr, "Not enough values for %s", s);
break;
case eGRIDEXP:
- fprintf(stderr, "'grid' expected instead of %s", s);
+ std::fprintf(stderr, "'grid' expected instead of %s", s);
break;
case eACCOEXP:
- fprintf(stderr, "'{' expected instead of %s", s);
+ std::fprintf(stderr, "'{' expected instead of %s", s);
break;
case eACCCEXP:
- fprintf(stderr, "'}' expected instead of %s", s);
+ std::fprintf(stderr, "'}' expected instead of %s", s);
break;
case eGRPEXP:
- fprintf(stderr, "'group' expected instead of %s", s);
+ std::fprintf(stderr, "'group' expected instead of %s", s);
break;
case eITEMEXP:
- fprintf(stderr, "item expected instead of %s", s);
+ std::fprintf(stderr, "item expected instead of %s", s);
break;
case eSAMEPOINT:
- fprintf(stderr, "grid point for %s already in use", s);
+ std::fprintf(stderr, "grid point for %s already in use", s);
break;
case eTOOWIDE:
- fprintf(stderr, "grid too wide for %s", s);
+ std::fprintf(stderr, "grid too wide for %s", s);
break;
case eTOOHIGH:
- fprintf(stderr, "grid too high for %s", s);
+ std::fprintf(stderr, "grid too high for %s", s);
break;
case eQUOTE:
- fprintf(stderr, "quote expected instead of %s", s);
+ std::fprintf(stderr, "quote expected instead of %s", s);
break;
default:
- fprintf(stderr, "????");
+ std::fprintf(stderr, "????");
break;
}
- fprintf(stderr, " in file %s\n", infile);
- fprintf(stderr, "source file: %s, line: %d\n", file, line);
- exit(1);
+ std::fprintf(stderr, " in file %s\n", infile);
+ std::fprintf(stderr, "source file: %s, line: %d\n", file, line);
+ std::exit(1);
}
#define ReadDlgErr(in, er, es) ReadDlgError(in, er, es, __FILE__, __LINE__)
char buf[STRLEN];
int result;
- result = fscanf(in, "%4s", buf);
- if ((1 != result) || strcmp(buf, "{") != 0)
+ result = std::fscanf(in, "%4s", buf);
+ if ((1 != result) || std::strcmp(buf, "{") != 0)
{
ReadDlgErr(infile, eACCOEXP, buf);
}
char buf[STRLEN];
int result;
- result = fscanf(in, "%4s", buf);
- if ((1 != result) || strcmp(buf, "}") != 0)
+ result = std::fscanf(in, "%4s", buf);
+ if ((1 != result) || std::strcmp(buf, "}") != 0)
{
ReadDlgErr(infile, eACCCEXP, buf);
}
int i = 0;
/* Read until first quote */
- while ((c[0] = fgetc(in)) != '"')
+ while ((c[0] = std::fgetc(in)) != '"')
{
- if (!isspace(c[0]))
+ if (!std::isspace(c[0]))
{
c[1] = '\0';
ReadDlgErr(infile, eQUOTE, c);
}
}
/* Read until second quote */
- while ((c[0] = fgetc(in)) != '"')
+ while ((c[0] = std::fgetc(in)) != '"')
{
buf[i++] = c[0];
}
/* Read until first quote */
do
{
- c = fgetc(in);
+ c = std::fgetc(in);
if (c == '}')
{
buf[0] = c;
while (c != '"');
/* Read until second quote */
- while ((c = fgetc(in)) != '"')
+ while ((c = std::fgetc(in)) != '"')
{
buf[i++] = c;
}
static bool bNotAccClose(const char *buf)
{
- return (strcmp(buf, "}") != 0);
+ return (std::strcmp(buf, "}") != 0);
}
static t_fitem *NewFItem(void)
for (edlg = 0; (edlg < edlgNR+1); edlg++)
{
- if (strcmp(buf, type[edlg]) == 0)
+ if (std::strcmp(buf, type[edlg]) == 0)
{
break;
}
int gridx, gridy;
in = libopen(infile);
- result = fscanf(in, "%6s", buf);
- if ((1 != result) || strcmp(buf, "grid") != 0)
+ result = std::fscanf(in, "%6s", buf);
+ if ((1 != result) || std::strcmp(buf, "grid") != 0)
{
ReadDlgErr(infile, eGRIDEXP, buf);
}
fgrid->w = gridx;
fgrid->h = gridy;
ReadAccOpen(infile, in);
- result = fscanf(in, "%15s", buf);
+ result = std::fscanf(in, "%15s", buf);
while ((1 == result) && bNotAccClose(buf))
{
if (strcmp(buf, "group") == 0)
ReadDlgErr(infile, eTOOHIGH, buf);
}
ReadAccOpen(infile, in);
- result = fscanf(in, "%15s", buf);
+ result = std::fscanf(in, "%15s", buf);
while ((1 == result) && bNotAccClose(buf))
{
AddFGroupFItem(fgroup, ScanFItem(infile, in, buf));
- result = fscanf(in, "%15s", buf);
+ result = std::fscanf(in, "%15s", buf);
}
}
else if (strcmp(buf, "simple") == 0)
ReadDlgErr(infile, eTOOHIGH, "simple");
}
ReadAccOpen(infile, in);
- result = fscanf(in, "%15s", buf);
+ result = std::fscanf(in, "%15s", buf);
if (1 == result)
{
fsimple->fitem = ScanFItem(infile, in, buf);
}
if (1 == result)
{
- result = fscanf(in, "%15s", buf);
+ result = std::fscanf(in, "%15s", buf);
}
}
gmx_ffclose(in);
{
int i;
- printf(" type: %s, set: '%s', get: '%s', def: '%s', help: '%s'\n {",
- type[fitem->edlg], fitem->set, fitem->get, fitem->def, fitem->help);
+ std::printf(" type: %s, set: '%s', get: '%s', def: '%s', help: '%s'\n {",
+ type[fitem->edlg], fitem->set, fitem->get, fitem->def, fitem->help);
for (i = 0; (i < fitem->nname); i++)
{
- printf(" '%s'", fitem->name[i]);
+ std::printf(" '%s'", fitem->name[i]);
}
- printf(" }\n");
+ std::printf(" }\n");
}
static void DumpFSimple(t_fsimple *fsimple)
{
- printf("Simple %dx%d at %d,%d\n", fsimple->w, fsimple->h, fsimple->x, fsimple->y);
+ std::printf("Simple %dx%d at %d,%d\n", fsimple->w, fsimple->h, fsimple->x, fsimple->y);
DumpFItem(fsimple->fitem);
}
{
int i;
- printf("Group %dx%d at %d,%d\n", fgroup->w, fgroup->h, fgroup->x, fgroup->y);
+ std::printf("Group %dx%d at %d,%d\n", fgroup->w, fgroup->h, fgroup->x, fgroup->y);
for (i = 0; (i < fgroup->nfitem); i++)
{
DumpFItem(fgroup->fitem[i]);
{
int i;
- printf("Grid %dx%d\n", fgrid->w, fgrid->h);
+ std::printf("Grid %dx%d\n", fgrid->w, fgrid->h);
for (i = 0; (i < fgrid->nfgroup); i++)
{
DumpFGroup(fgrid->fgroup[i]);
*/
#include "gmxpre.h"
+#include <cstdio>
#include <cstring>
#include <algorithm>
f = gmx->filter;
#ifdef DEBUG
- printf("item_id: %d, set: %s\n", item_id, set);
+ std::printf("item_id: %d, set: %s\n", item_id, set);
#endif
switch (dlg_mess)
{
std::strcpy(tmpfile, "filterXXXXXX");
gmx_tmpnam(tmpfile);
#ifdef DEBUG
- fprintf(stderr, "file: %s\n", tmpfile);
+ std::fprintf(stderr, "file: %s\n", tmpfile);
#endif
- if ((tmp = fopen(tmpfile, "w")) == NULL)
+ if ((tmp = std::fopen(tmpfile, "w")) == NULL)
{
- sprintf(tmpfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
+ std::sprintf(tmpfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
gmx_tmpnam(tmpfile);
- if ((tmp = fopen(tmpfile, "w")) == NULL)
+ if ((tmp = std::fopen(tmpfile, "w")) == NULL)
{
gmx_fatal(FARGS, "Can not open tmp file %s", tmpfile);
}
}
tlen = 1+ncol*(1+len);
- fprintf(tmp, "grid %d %d {\n\n", tlen, ht);
+ std::fprintf(tmp, "grid %d %d {\n\n", tlen, ht);
for (k = j = 0, x0 = 1; (j < ncol); j++, x0 += len+1)
{
- fprintf(tmp, "group \"%s-%d\" %d 1 %d %d {\n", title, j+1, x0, len, ht-5);
+ std::fprintf(tmp, "group \"%s-%d\" %d 1 %d %d {\n", title, j+1, x0, len, ht-5);
for (i = 0; (i < nrow) && (k < gmx->filter->grps->nr); i++, k++)
{
if (!gmx->filter->bDisable[k])
{
- fprintf(tmp, "checkbox \"%s\" \"%d\" %s %s %s\n",
- gmx->filter->grpnames[k], k, dummy, dummy, dummy);
+ std::fprintf(tmp, "checkbox \"%s\" \"%d\" %s %s %s\n",
+ gmx->filter->grpnames[k], k, dummy, dummy, dummy);
}
else
{
- fprintf(tmp, "statictext { \" %s\" } \"%d\" %s %s %s\n",
- gmx->filter->grpnames[k], k, dummy, dummy, dummy);
+ std::fprintf(tmp, "statictext { \" %s\" } \"%d\" %s %s %s\n",
+ gmx->filter->grpnames[k], k, dummy, dummy, dummy);
}
}
- fprintf(tmp, "}\n\n");
+ std::fprintf(tmp, "}\n\n");
}
- fprintf(tmp, "simple 1 %d %d 2 {\n", ht-3, tlen-2);
- fprintf(tmp, "defbutton %s %s %s %s %s\n", ok, ok, dummy, dummy, dummy);
- fprintf(tmp, "}\n\n}\n");
- fclose(tmp);
+ std::fprintf(tmp, "simple 1 %d %d 2 {\n", ht-3, tlen-2);
+ std::fprintf(tmp, "defbutton %s %s %s %s %s\n", ok, ok, dummy, dummy, dummy);
+ std::fprintf(tmp, "}\n\n}\n");
+ std::fclose(tmp);
dlg = ReadDlg(x11, gmx->wd->self, title, tmpfile,
0, 0, true, false, FilterCB, gmx);
- remove(tmpfile);
+ std::remove(tmpfile);
return dlg;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "logo.h"
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
#include "gromacs/legacyheaders/copyrite.h"
#include "gromacs/legacyheaders/macros.h"
logo->bQuitOnClick = bQuitOnClick;
InitWin(&logo->wd, 0, 0, 360, 270, 1, "GROMACS");
bg = LIGHTGREY;
- if ((newcol = getenv("GMX_LOGO_COLOR")) != NULL)
+ if ((newcol = std::getenv("GMX_LOGO_COLOR")) != NULL)
{
GetNamedColor(x11, newcol, &bg);
}
}
if (i == NBF)
{
- perror(bfname[i-1]);
- exit(1);
+ std::perror(bfname[i-1]);
+ std::exit(1);
}
#ifdef DEBUG
- fprintf(stderr, "Big Logofont: %s\n", bfname[i]);
+ std::fprintf(stderr, "Big Logofont: %s\n", bfname[i]);
#endif
for (i = 0, logo->smallfont = NULL; (i < NSF); i++)
{
}
if (i == NSF)
{
- perror(sfname[i-1]);
- exit(1);
+ std::perror(sfname[i-1]);
+ std::exit(1);
}
#ifdef DEBUG
- fprintf(stderr, "Small Logofont: %s\n", sfname[i]);
+ std::fprintf(stderr, "Small Logofont: %s\n", sfname[i]);
#endif
x11->RegisterCallback(x11, logo->wd.self, parent, LogoCallBack, logo);
x11->SetInputMask(x11, logo->wd.self, ButtonPressMask | ExposureMask);
*/
#include "gmxpre.h"
+#include "manager.h"
+
#include "config.h"
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#ifdef HAVE_UNISTD_H
#include <unistd.h> // for usleep()
#endif
-#include "manager.h"
-
#include "gromacs/fileio/tpxio.h"
#include "gromacs/legacyheaders/copyrite.h"
#include "gromacs/legacyheaders/macros.h"
int i, delta, ftype;
#ifdef DEBUG
- fprintf(stderr, "Going to make bonds from an ilist with %d entries\n", b->nr);
+ std::fprintf(stderr, "Going to make bonds from an ilist with %d entries\n", b->nr);
#endif
ia = b->iatoms;
for (i = 0; (i < b->nr); )
{
aj = ia[2];
#ifdef DEBUG
- fprintf(stderr, "Adding bond from %d to %d\n", ai, aj);
+ std::fprintf(stderr, "Adding bond from %d to %d\n", ai, aj);
#endif
bB[ai] = bB[aj] = true;
if (!(bH[ai] == bH[aj]))
}
}
#ifdef DEBUG
- fprintf(stderr, "Type: %5d, delta: %5d\n", type, delta);
+ std::fprintf(stderr, "Type: %5d, delta: %5d\n", type, delta);
#endif
ia += delta+1;
i += delta+1;
for (i = 0; (i < man->natom); i++)
{
- if ((abs(ix[i][XX]-x) < DELTA) && (abs(ix[i][YY]-y) < DELTA))
+ if ((std::abs(ix[i][XX]-x) < DELTA) && (std::abs(ix[i][YY]-y) < DELTA))
{
if (man->bVis[i])
{
}
XSetForeground(x11->disp, x11->gc, col);
XDrawString(x11->disp, man->molw->wd.self, x11->gc, x+2, y-2, man->szLab[ai],
- strlen(man->szLab[ai]));
+ std::strlen(man->szLab[ai]));
XSetForeground(x11->disp, x11->gc, x11->fg);
}
}
}
cool_quote(quote, 255, NULL);
- sprintf(buf, "%s: %s", *man->top.name, quote);
+ std::sprintf(buf, "%s: %s", *man->top.name, quote);
man->title.text = gmx_strdup(buf);
man->view = init_view(man->box);
at = &(man->top.atoms);
snew(man->szLab[i], 20);
if (ri->ic != ' ')
{
- sprintf(man->szLab[i], "%s%d%c, %s", *ri->name, ri->nr, ri->ic, aname);
+ std::sprintf(man->szLab[i], "%s%d%c, %s", *ri->name, ri->nr, ri->ic, aname);
}
else
{
- sprintf(man->szLab[i], "%s%d, %s", *ri->name, ri->nr, aname);
+ std::sprintf(man->szLab[i], "%s%d, %s", *ri->name, ri->nr, aname);
}
man->bHydro[i] = (toupper(aname[0]) == 'H');
if (man->bHydro[i])
if (!man->natom)
{
- fprintf(stderr, "Not initiated yet!");
- exit(1);
+ std::fprintf(stderr, "Not initiated yet!");
+ std::exit(1);
}
bEof = read_next_x(man->oenv, man->status, &man->time, man->x, man->box);
*nat = man->natom;
int th;
#ifdef DEBUG
- fprintf(stderr, "Move manager %dx%d\n", width, height);
+ std::fprintf(stderr, "Move manager %dx%d\n", width, height);
#endif
man->wd.width = width;
man->wd.height = height;
if (y0 > height)
{
- printf("Error: Windows falling out of main window!\n");
+ std::printf("Error: Windows falling out of main window!\n");
}
/* Button Box */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*/
#include "gmxpre.h"
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
#include "gromacs/fileio/writeps.h"
#include "gromacs/legacyheaders/macros.h"
nvis = filter_vis(man);
if (nvis && man->bSort)
{
- qsort(man->obj, nvis, sizeof(man->obj[0]), compare_obj);
+ std::qsort(man->obj, nvis, sizeof(man->obj[0]), compare_obj);
}
/* Draw the objects */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "nleg.h"
-#include <string.h>
+#include <cstring>
#include <algorithm>
{
for (i = 0; (i < NAC); i++)
{
- mij = std::min((int)strlen(type), (int)strlen(ac[i].tp));
+ mij = std::min(static_cast<int>(std::strlen(type)), static_cast<int>(std::strlen(ac[i].tp)));
for (nb = 0; (nb < mij); nb++)
{
if (type[nb] != ac[i].tp[nb])
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "nmol.h"
-#include <math.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/txtdump.h"
break;
case ButtonPress:
#ifdef DEBUG
- printf("Molwindow: Buttonpress\n");
+ std::printf("Molwindow: Buttonpress\n");
#endif
letter.xclient.data.l[0] = IDLABEL;
letter.xclient.data.l[1] = (long)event->xbutton.button;
void set_box_type (t_x11 *x11, t_molwin *mw, int bt)
{
#ifdef DEBUG
- fprintf(stderr, "mw->boxtype = %d, bt = %d\n", mw->boxtype, bt);
+ std::fprintf(stderr, "mw->boxtype = %d, bt = %d\n", mw->boxtype, bt);
#endif
if (bt != mw->boxtype)
{
}
else
{
- fprintf(stderr, "Can not change rectangular box to truncated octahedron\n");
+ std::fprintf(stderr, "Can not change rectangular box to truncated octahedron\n");
}
}
}
XClearWindow(x11->disp, win->self);
/* Draw Time */
- sprintf(tstr[ntime], "Time: %.3f ps", man->time);
- if (strcmp(tstr[ntime], tstr[1-ntime]) != 0)
+ std::sprintf(tstr[ntime], "Time: %.3f ps", man->time);
+ if (std::strcmp(tstr[ntime], tstr[1-ntime]) != 0)
{
set_vbtime(x11, man->vbox, tstr[ntime]);
ntime = 1-ntime;
nvis = filter_vis(man);
if (nvis && man->bSort)
{
- qsort(man->obj, nvis, sizeof(man->obj[0]), compare_obj);
+ std::qsort(man->obj, nvis, sizeof(man->obj[0]), compare_obj);
}
/* Draw the objects */
if (man->bLabel[i] && man->bVis[i])
{
XDrawString(x11->disp, win->self, x11->gc, vec2[i][XX]+2, vec2[i][YY]-2,
- man->szLab[i], strlen(man->szLab[i]));
+ man->szLab[i], std::strlen(man->szLab[i]));
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "popup.h"
-#include <math.h>
-#include <string.h>
+#include <cmath>
+#include <cstring>
#include <algorithm>
mlen = 0;
for (i = 0; (i < nent); i++)
{
- mlen = std::max(mlen, XTextWidth(x11->font, ent[i].str, strlen(ent[i].str)));
+ mlen = std::max(mlen, XTextWidth(x11->font, ent[i].str, std::strlen(ent[i].str)));
}
mht = XTextHeight(x11->font);
/* Now we have the biggest single box, add a border of 2 pixels */
mht += 4;
/* Calculate the area of the menu */
area = mlen*mht;
- ht = sqrt(area);
+ ht = std::sqrt(area);
/* No the number of rows per column, only beyond 8 rows */
if (ncol == 0)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "pulldown.h"
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#include <algorithm>
for (i = 0; (i < pd->nmenu); i++)
{
XDrawString(x11->disp, pd->wd.self, x11->gc, pd->xpos[i], x11->font->ascent,
- pd->title[i], strlen(pd->title[i]));
+ pd->title[i], std::strlen(pd->title[i]));
}
break;
case ButtonPress:
for (i = 1; (i <= nmenu); i++)
{
pd->xpos[i] = 20+pd->xpos[i-1]+
- XTextWidth(x11->font, title[i-1], strlen(title[i-1]));
+ XTextWidth(x11->font, title[i-1], std::strlen(title[i-1]));
}
if (pd->xpos[nmenu] > width)
{
- printf("Menu too wide\n");
+ std::printf("Menu too wide\n");
}
InitWin(&(pd->wd), 0, 0, width, XTextHeight(x11->font)+2, 0, "PullDown");
#include "config.h"
-#include <stdio.h>
-#include <string.h>
+#include <cstdio>
#include "gromacs/commandline/pargs.h"
#include "gromacs/fileio/confio.h"
{
int y0, wl, hl;
#ifdef DEBUG
- fprintf(stderr, "Move gmx %dx%d\n", width, height);
+ std::fprintf(stderr, "Move gmx %dx%d\n", width, height);
#endif
y0 = XTextHeight(x11->font);
/* Resize PD-Menu */
0, NULL, asize(desc), desc, asize(bugs), bugs, &oenv))
{
#if !GMX_X11
- fprintf(stderr, "Compiled without X-Windows - can not run viewer.\n");
+ std::fprintf(stderr, "Compiled without X-Windows - can not run viewer.\n");
#else
t_x11 *x11;
if ((x11 = GetX11(&argc, argv)) == NULL)
{
- fprintf(stderr, "Can't connect to X Server.\n"
- "Check your DISPLAY environment variable\n");
+ std::fprintf(stderr, "Can't connect to X Server.\n"
+ "Check your DISPLAY environment variable\n");
}
else
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "x11.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/cstringutil.h"
#ifdef DEBUG
if (font != NULL)
{
- fprintf(err, "Loaded font %s\n", name);
+ std::fprintf(err, "Loaded font %s\n", name);
}
#endif
return font;
}
else
{
- fprintf(x11->console, "No colour %s\n", name);
+ std::fprintf(x11->console, "No colour %s\n", name);
}
}
}
else
{
- fprintf(x11->console, "No such window (%d)\n", (int)w);
+ std::fprintf(x11->console, "No such window (%d)\n", (int)w);
}
}
static void Flush(t_x11 *x11)
{
- fflush(x11->console);
+ std::fflush(x11->console);
}
t_x11 *GetX11(int *argc, char *argv[])
title = gmx_strdup(argv[0]);
/* First check environment */
- fontname = getenv("GMX_FONT");
- display = getenv("DISPLAY");
+ fontname = std::getenv("GMX_FONT");
+ display = std::getenv("DISPLAY");
snew(ARGV, *argc);
ARGC = 1;
x11->console = stderr;
}
else
- if ((x11->console = fopen("/dev/null", "w")) == NULL)
+ if ((x11->console = std::fopen("/dev/null", "w")) == NULL)
{
x11->console = stderr;
}
{
if (bVerbose)
{
- fprintf(x11->console, "Display %s invalid\n", display);
+ std::fprintf(x11->console, "Display %s invalid\n", display);
}
return NULL;
}
}
if ((i == 4) || (i == 5))
{
- fprintf(x11->console, "Greyscale screen, using B & W only\n");
+ std::fprintf(x11->console, "Greyscale screen, using B & W only\n");
}
else
{
/* We have real color! */
- fprintf(x11->console, "%s screen with depth %d.\n",
- (i == NCLASS) ? "Unknown" : v_name[i], x11->depth);
+ std::fprintf(x11->console, "%s screen with depth %d.\n",
+ (i == NCLASS) ? "Unknown" : v_name[i], x11->depth);
GetNamedColor(x11, "midnight blue", &BLUE);
GetNamedColor(x11, "DarkGreen", &GREEN);
GetNamedColor(x11, "SeaGreen", &CYAN);
}
else
{
- fprintf(x11->console, "Monochrome screen.\n");
+ std::fprintf(x11->console, "Monochrome screen.\n");
}
/* We should use Xrm here... */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xdlg.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/utility/cstringutil.h"
dlgitem->win.height = h;
}
#ifdef DEBUG
- fprintf(dlg->x11->console,
- "Size window from: %dx%d to %dx%d\n", old_w, old_h,
- dlgitem->win.width, dlgitem->win.height);
+ std::fprintf(dlg->x11->console,
+ "Size window from: %dx%d to %dx%d\n", old_w, old_h,
+ dlgitem->win.width, dlgitem->win.height);
dlg->x11->Flush(dlg->x11);
#endif
if (dlgitem->win.self)
dlgitem->win.x = x0;
dlgitem->win.y = y0;
#ifdef DEBUG
- fprintf(dlg->x11->console,
- "Move window from: %d,%d to %d,%d\n", old_x, old_y, x0, y0);
+ std::fprintf(dlg->x11->console,
+ "Move window from: %d,%d to %d,%d\n", old_x, old_y, x0, y0);
dlg->x11->Flush(dlg->x11);
#endif
if (dlgitem->win.self)
{
if (dlgitem->type == edlgET)
{
- return strlen(dlgitem->u.edittext.buf);
+ return std::strlen(dlgitem->u.edittext.buf);
}
}
return;
}
- printf("%s\n", dlgitem->help);
+ std::printf("%s\n", dlgitem->help);
do
{
fgets2(buf, 79, stdin);
#ifdef DEBUG
- fprintf(dlg->x11->console, "buffer: '%s'\n", buf);
+ std::fprintf(dlg->x11->console, "buffer: '%s'\n", buf);
dlg->x11->Flush(dlg->x11);
#endif
if (gmx_strcasecmp(buf, "nok") == 0)
{
nWndProc = (dlgitem->WndProc)(x11, dlgitem, event);
#ifdef DEBUG
- fprintf(x11->console,
- "window: %s, nWndProc: %d\n", dlgitem->win.text, nWndProc);
+ std::fprintf(x11->console,
+ "window: %s, nWndProc: %d\n", dlgitem->win.text, nWndProc);
x11->Flush(x11);
#endif
switch (nWndProc)
int gid = dlgitem->GroupID;
t_id tid = RBSelected(dlg, gid);
#ifdef DEBUG
- fprintf(stderr, "RBPRESSED\n");
+ std::fprintf(stderr, "RBPRESSED\n");
#endif
if (tid != -1)
{
if (!CheckWindow(dlg->win.self))
{
- exit(1);
+ std::exit(1);
}
hints.x = dlg->win.x;
hints.y = dlg->win.y;
for (i = 0; (i < nitem); i++)
{
#ifdef DEBUG
- fprintf(dlg->x11->console,
- "Adding item: %d from group %d\n", item[i]->ID, item[i]->GroupID);
+ std::fprintf(dlg->x11->console,
+ "Adding item: %d from group %d\n", item[i]->ID, item[i]->GroupID);
dlg->x11->Flush(dlg->x11);
#endif
AddDlgItem(dlg, item[i]);
XGetGeometry(x11->disp, Parent, &root, &x, &y,
&(dlg->xmax), &(dlg->ymax), &dum, &dum);
#ifdef DEBUG
- fprintf(x11->console,
- "Daddy is %d x %d at %d, %d\n", dlg->xmax, dlg->ymax, x, y);
+ std::fprintf(x11->console,
+ "Daddy is %d x %d at %d, %d\n", dlg->xmax, dlg->ymax, x, y);
dlg->x11->Flush(dlg->x11);
#endif
}
dlg->win.height = h;
#ifdef DEBUG
- fprintf(dlg->x11->console, "SetDlgSize: Dialog is %dx%d, at %d,%d\n",
- dlg->win.width, dlg->win.height, dlg->win.x, dlg->win.y);
+ std::fprintf(dlg->x11->console, "SetDlgSize: Dialog is %dx%d, at %d,%d\n",
+ dlg->win.width, dlg->win.height, dlg->win.x, dlg->win.y);
dlg->x11->Flush(dlg->x11);
#endif
if (dlg->win.self)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xdlghi.h"
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#include <algorithm>
{
if (!item->list)
{
- printf("Error: empty list with non-empty nitem (%d)\n", item->nitem);
- printf(" at grid point: %d,%d\n", x, y);
- printf(" with size: %dx%d\n", item->w, item->h);
- exit(1);
+ std::printf("Error: empty list with non-empty nitem (%d)\n", item->nitem);
+ std::printf(" at grid point: %d,%d\n", x, y);
+ std::printf(" with size: %dx%d\n", item->w, item->h);
+ std::exit(1);
}
else
{
h1 = gridy*h;
SetDlgSize(dlg, w1, h1, bAutoPosition);
#ifdef DEBUG
- printf("Dimensions of grid cell: %8.3f x %8.3f\n", w, h);
- printf("Dimensions of window: %d x %d\n", w1, h1);
+ std::printf("Dimensions of grid cell: %8.3f x %8.3f\n", w, h);
+ std::printf("Dimensions of window: %d x %d\n", w1, h1);
#endif
for (x = 0; (x < gridx); x++)
w1 = item->w*w;
h1 = item->h*h;
#ifdef DEBUG
- printf("New size: %d x %d at %d, %d\n", w1, h1, x1, y1);
+ std::printf("New size: %d x %d at %d, %d\n", w1, h1, x1, y1);
#endif
SetDlgItemSize(dlg, item->list[0]->ID, w1, h1);
SetDlgItemPos(dlg, item->list[0]->ID, x1, y1);
x, (*y), 0, 0, 0));
break;
case edlgRB:
- strcpy(buf, fitem->def);
+ std::strcpy(buf, fitem->def);
iSel = -1;
for (i = 0; (i < fitem->nname); i++)
{
char buf2[100];
- strcpy(buf2, fitem->name[i]);
+ std::strcpy(buf2, fitem->name[i]);
buf2[strlen(buf)] = '\0'; /* truncate itemname */
if (gmx_strcasecmp(buf2, buf) == 0)
{
GroupID, x, (*y), 0, 0, 0));
break;
case edlgET:
- slen = strlen(fitem->name[0])+strlen(fitem->def);
+ slen = std::strlen(fitem->name[0])+strlen(fitem->def);
AddListItem(list, CreateEditText(x11, fitem->name[0], slen, fitem->def,
(*ID)++, GroupID, x, (*y), 0, 0, 0));
break;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xdlgitem.h"
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cctype>
+#include <cstdio>
+#include <cstring>
#include <algorithm>
int x, y1, y2;
et = &(dlgitem->u.edittext);
- x = XTextWidth(x11->font, dlgitem->win.text, strlen(dlgitem->win.text))+XCARET+
+ x = XTextWidth(x11->font, dlgitem->win.text, std::strlen(dlgitem->win.text))+XCARET+
XTextWidth(x11->font, (char*) &(et->buf[et->strbegin]), et->pos);
y1 = (dlgitem->win.height-XTextHeight(x11->font))/2;
y2 = (dlgitem->win.height-y1);
char c[BUFSIZE+1];
#ifdef DEBUG
- printf("DefWndProc\n");
+ std::printf("DefWndProc\n");
#endif
switch (event->type)
{
gmx_incons("button processing");
}
win = &(dlgitem->win);
- w = XTextWidth(x11->font, win->text, strlen(win->text));
+ w = XTextWidth(x11->font, win->text, std::strlen(win->text));
x = (win->width-w)/2;
th = XTextHeight(x11->font)+OFFS_Y;
switch (event->type)
}
win = &(dlgitem->win);
- x = XTextWidth(x11->font, win->text, strlen(win->text));
+ x = XTextWidth(x11->font, win->text, std::strlen(win->text));
y = XTextHeight(x11->font);
switch (event->type)
{
if (isprint(c))
{
- sl = strlen(s);
+ sl = std::strlen(s);
/* +1 for zero termination */
for (i = sl+1; (i > *pos); i--)
{
{
int i, sl;
- sl = strlen(s);
+ sl = std::strlen(s);
if ((sl > 0) && ((*pos) > 0))
{
for (i = *pos-1; (i < sl); i++)
{
int i, sl;
- sl = strlen(s);
+ sl = std::strlen(s);
if ((sl > 0) && ((*pos) < sl))
{
for (i = *pos; (i < sl); i++)
{
case Expose:
XSetForeground(x11->disp, x11->gc, x11->fg);
- xtitle = XTextWidth(x11->font, win->text, strlen(win->text));
+ xtitle = XTextWidth(x11->font, win->text, std::strlen(win->text));
ewidth = win->width-xtitle;
TextInRect(x11, win->self, win->text,
0, 0, xtitle-1, win->height, eXLeft, eYCenter);
TextInRect(x11, win->self, scrbuf,
xtitle+XCARET, 0, ewidth, win->height, eXLeft, eYCenter);
#ifdef DEBUG
- printf("Expose\n");
+ std::printf("Expose\n");
#endif
if (win->bFocus)
{
break;
case ButtonPress:
/* Calculate new position for caret */
- et->pos = strlen(et->buf);
+ et->pos = std::strlen(et->buf);
bp = gmx_strdup(et->buf);
- xp = event->xbutton.x-XTextWidth(x11->font, win->text, strlen(win->text))-
+ xp = event->xbutton.x-XTextWidth(x11->font, win->text, std::strlen(win->text))-
XCARET;
- while ((et->pos > 0) && (XTextWidth(x11->font, bp, strlen(bp)) > xp))
+ while ((et->pos > 0) && (XTextWidth(x11->font, bp, std::strlen(bp)) > xp))
{
et->pos--;
bp[et->pos] = '\0';
}
XLookupString(&(event->xkey), c, BUFSIZE, &keysym, NULL);
#ifdef DEBUG
- printf("Keysym: %x\n", keysym);
+ std::printf("Keysym: %x\n", keysym);
#endif
switch (keysym)
{
case XK_End:
if (strlen(et->buf) <= (unsigned int)et->buflen)
{
- et->pos = strlen(et->buf);
+ et->pos = std::strlen(et->buf);
}
else
{
et->pos = et->buflen;
- et->strbegin = strlen(et->buf)-et->buflen;
+ et->strbegin = std::strlen(et->buf)-et->buflen;
}
et->bChanged = true;
return ETCHANGED;
}
if (w == 0)
{
- w = XTextWidth(x11->font, szLab, strlen(szLab))+2*OFFS_X;
+ w = XTextWidth(x11->font, szLab, std::strlen(szLab))+2*OFFS_X;
}
if (bDef)
{
- snew(lab, strlen(szLab)+7); /* 6 for >> << and 1 for \0 */
- sprintf(lab, ">> %s <<", szLab);
+ snew(lab, std::strlen(szLab)+7); /* 6 for >> << and 1 for \0 */
+ std::sprintf(lab, ">> %s <<", szLab);
}
else
{
}
if (w == 0)
{
- w = XTextWidth(x11->font, szLab, strlen(szLab))+OFFS_X+h;
+ w = XTextWidth(x11->font, szLab, std::strlen(szLab))+OFFS_X+h;
}
InitWin(&(dlgitem->win), x0, y0, w, h, bw, szLab);
dlgitem->ID = id;
}
if (w == 0)
{
- w = XTextWidth(x11->font, szLab, strlen(szLab))+2*OFFS_X;
+ w = XTextWidth(x11->font, szLab, std::strlen(szLab))+2*OFFS_X;
}
InitWin(&(dlgitem->win), x0, y0, w, h, bw, szLab);
dlgitem->GroupID = id;
dlgitem->type = edlgGB;
dlgitem->u.groupbox.nitems = nitems;
snew(dlgitem->u.groupbox.item, nitems);
- memcpy((char *)dlgitem->u.groupbox.item, (char *)items,
- nitems*sizeof(items[0]));
+ std::memcpy((char *)dlgitem->u.groupbox.item, (char *)items,
+ nitems*sizeof(items[0]));
dlgitem->WndProc = WndProcGB;
return dlgitem;
}
if (w == 0)
{
- w = XTextWidth(x11->font, szLab, strlen(szLab))+OFFS_X+h;
+ w = XTextWidth(x11->font, szLab, std::strlen(szLab))+OFFS_X+h;
}
InitWin(&(dlgitem->win), x0, y0, w, h, bw, szLab);
dlgitem->ID = id;
{
for (i = 0; (i < nlines); i++)
{
- w = std::max(w, XTextWidth(x11->font, lines[i], strlen(lines[i])));
+ w = std::max(w, XTextWidth(x11->font, lines[i], std::strlen(lines[i])));
}
w += 2*OFFS_X;
}
char *test;
snew(test, screenbuf);
- memset(test, 'w', screenbuf);
+ std::memset(test, 'w', screenbuf);
w = XTextWidth(x11->font, test, screenbuf)+
- XTextWidth(x11->font, title, strlen(title))+
+ XTextWidth(x11->font, title, std::strlen(title))+
2*XCARET+2*OFFS_X;
sfree(test);
}
dlgitem->type = edlgET;
et = &(dlgitem->u.edittext);
snew(et->buf, STRLEN);
- strcpy(et->buf, buf);
+ std::strcpy(et->buf, buf);
et->buflen = screenbuf;
et->strbegin = 0;
et->bChanged = false;
dlgitem->get = SC(get);
dlgitem->help = SC(help);
#ifdef DEBUG
- printf("Help is: '%s'\n", dlgitem->help);
+ std::printf("Help is: '%s'\n", dlgitem->help);
#endif
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xmb.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstdlib>
#include "gromacs/legacyheaders/macros.h"
#include "gromacs/legacyheaders/typedefs.h"
((Flags & MB_NO) && (Flags & MB_CANCEL)) ||
(!(Flags & MB_OK) && !(Flags & MB_YES)))
{
- fprintf(stderr, "Invalid button selection in MessageBox\n");
- exit(1);
+ std::fprintf(stderr, "Invalid button selection in MessageBox\n");
+ std::exit(1);
}
nicon = 0;
if (Flags & MB_ICONSTOP)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "xutil.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
+#include <cstdio>
+#include <cstring>
#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/cstringutil.h"
{
if (win == winerr[i].n)
{
- fprintf(stderr, "%s", winerr[i].s);
+ std::fprintf(stderr, "%s", winerr[i].s);
break;
}
}
return 1;
}
- fprintf(stderr, " in file %s, line %d\n", file, line);
+ std::fprintf(stderr, " in file %s, line %d\n", file, line);
return 0;
}
f = x11->font;
}
- fw = XTextWidth(f, s, strlen(s));
+ fw = XTextWidth(f, s, std::strlen(s));
fh = XTextHeight(f);
switch (eX)
{
y0 = y+(height-fh)/2+f->ascent;
break;
}
- XDrawString(x11->disp, win, x11->gc, x0, y0, s, strlen(s));
+ XDrawString(x11->disp, win, x11->gc, x0, y0, s, std::strlen(s));
if (font)
{
XSetFont(x11->disp, x11->gc, x11->font->fid);
win->text = NULL;
}
#ifdef DEBUG
- printf("%s: %d x %d at %d, %d\n", text, w, h, x0, y0);
+ std::printf("%s: %d x %d at %d, %d\n", text, w, h, x0, y0);
#endif
}
mpos = newpos;
XWarpPointer(disp, None, dest, 0, 0, 0, 0, x, y);
#ifdef DEBUG
- fprintf(stderr, "Pushmouse %d, %d\n", x, y);
+ std::fprintf(stderr, "Pushmouse %d, %d\n", x, y);
#endif
}
XWarpPointer(disp, None, DefaultRootWindow(disp), 0, 0, 0, 0, old->x, old->y);
#ifdef DEBUG
- fprintf(stderr, "Popmouse %d, %d\n", old->x, old->y);
+ std::fprintf(stderr, "Popmouse %d, %d\n", old->x, old->y);
#endif
mpos = old->prev;
sfree(old);
case GrabSuccess:
return true;
case GrabNotViewable:
- fprintf(out, "GrabNotViewable\n"); break;
+ std::fprintf(out, "GrabNotViewable\n"); break;
case AlreadyGrabbed:
- fprintf(out, "AlreadyGrabbed\n"); break;
+ std::fprintf(out, "AlreadyGrabbed\n"); break;
case GrabFrozen:
- fprintf(out, "GrabFrozen\n"); break;
+ std::fprintf(out, "GrabFrozen\n"); break;
case GrabInvalidTime:
- fprintf(out, "GrabInvalidTime\n"); break;
+ std::fprintf(out, "GrabInvalidTime\n"); break;
default:
break;
}