Esempio n. 1
0
void head(FILE *out, char *fn_, gmx_bool bH,
	  char *cstart, char *ccont, char *cend)
{
  char buf[STRLEN];
  int i;

  fprintf(out,"%s\n",cstart);
  /* NOTE: the "" are to mislead CVS so it will not replace by version info */
  fprintf(out,"%s $""Id""$\n",ccont);
  for(i=0; (i<NH1); i++)
    fprintf(out,"%s %s\n",ccont,head1[i]);
  fprintf(out,"%s                        %s\n",ccont,GromacsVersion());
  for(i=0; (i<NCR); i++)
    fprintf(out,"%s %s\n",ccont,CopyrightText[i]);
  for(i=0; (i<NH2); i++)
    fprintf(out,"%s %s\n",ccont,head2[i]);
  bromacs(buf,STRLEN-1);
  fprintf(out,"%s %s\n",ccont,buf);
  fprintf(out,"%s\n",cend);
  if (bH) {
    fprintf(out,"\n");
    fprintf(out,"#ifndef _%s\n",fn_);
    fprintf(out,"#define _%s\n",fn_);
    fprintf(out,"\n");
  }
}
void CopyRight(FILE *out,const char *szProgram)
{
  /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the 
   * name of a file. Otherwise, we won't be able to find the library dir.
   */
#define NCR (int)asize(CopyrightText)
#ifdef GMX_FAHCORE
#define NGPL 0 /*FAH has an exception permission from GPL to allow digital signatures in Gromacs*/
#else
#define NGPL (int)asize(GPLText)
#endif

  char buf[256],tmpstr[1024];
  int i;

#ifdef GMX_FAHCORE
  set_program_name("Gromacs");
#else
  set_program_name(szProgram);
#endif

  ster_print(out,"G  R  O  M  A  C  S");
  fprintf(out,"\n");
  
  bromacs(tmpstr,1023);
  sp_print(out,tmpstr); 
  fprintf(out,"\n");

  ster_print(out,GromacsVersion());
  fprintf(out,"\n");

  /* fprintf(out,"\n");*/

  /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
  
  fprintf(out,"\n"); */

  for(i=0; (i<NCR); i++) 
    sp_print(out,CopyrightText[i]);
  for(i=0; (i<NGPL); i++)
    sp_print(out,GPLText[i]);

  fprintf(out,"\n");

  snprintf(buf,256,"%s",Program());
#ifdef GMX_DOUBLE
  strcat(buf," (double precision)");
#endif
  ster_print(out,buf);
  fprintf(out,"\n");
}
Esempio n. 3
0
void _gmx_error(const char *key,const char *msg,const char *file,int line)
{
  char buf[10240],tmpbuf[1024];
  int  cqnum;

  /* protect the audience from suggestive discussions */
  char *lines = "-------------------------------------------------------";
  
  cool_quote(tmpbuf,1023,&cqnum);
  sprintf(buf,"\n%s\nProgram %s, %s\n"
	  "Source code file: %s, line: %d\n\n"
	  "%s:\n%s\n%s\n\n%s\n",
	  lines,ShortProgram(),GromacsVersion(),file,line,
	  gmx_strerror(key),msg ? msg : warn_buf,lines,tmpbuf);
  
  gmx_error_handler(buf);
}
Esempio n. 4
0
static void write_ttyman(FILE *out,
                         const char *program,
                         int nldesc, const char **desc,
                         int nfile, t_filenm *fnm,
                         int npargs, t_pargs *pa,
                         int nbug, const char **bugs, gmx_bool bHeader,
                         t_linkdata *links)
{
    int   i;
    char  buf[256];
    char *tmp;

    if (bHeader)
    {
        fprintf(out, "%s\n\n", check_tty(program));
        fprintf(out, "%s\n%s\n", GromacsVersion(), mydate(buf, 255, FALSE));
    }
    if (nldesc > 0)
    {
        fprintf(out, "DESCRIPTION\n-----------\n");
        print_tty_formatted(out, nldesc, desc, 0, links, program, FALSE);
    }
    if (nbug > 0)
    {
        fprintf(out, "\n");
        fprintf(out, "KNOWN PROBLEMS\n----------\n");
        for (i = 0; i < nbug; i++)
        {
            snew(tmp, strlen(bugs[i])+3);
            strcpy(tmp, "* ");
            strcpy(tmp+2, check_tty(bugs[i]));
            fprintf(out, "%s\n", wrap_lines(tmp, 78, 2, FALSE));
            sfree(tmp);
        }
    }
    if (nfile > 0)
    {
        fprintf(out, "\n");
        pr_fns(out, nfile, fnm);
    }
    if (npargs > 0)
    {
        print_pargs(out, npargs, pa, FALSE);
    }
}
Esempio n. 5
0
void _gmx_error(const char *key,const char *msg,const char *file,int line)
{
  char buf[10240],tmpbuf[1024];
  int  cqnum;

  /* protect the audience from suggestive discussions */
  const char *lines = "-------------------------------------------------------";
  
  cool_quote(tmpbuf,1023,&cqnum);
  sprintf(buf,"\n%s\nProgram %s, %s\n"
	  "Source code file: %s, line: %d\n\n"
	  "%s:\n%s\nFor more information and tips for trouble shooting please check the GROMACS Wiki at\n"
	  "http://wiki.gromacs.org/index.php/Errors\n%s\n\n%s\n",
	  lines,ShortProgram(),GromacsVersion(),file,line,
	  gmx_strerror(key),msg ? msg : warn_buf,lines,tmpbuf);
  
  gmx_error_handler(buf);
}
Esempio n. 6
0
void CopyRight(FILE *out,char *szProgram)
{
  /* Dont change szProgram arbitrarily - it must be argv[0], i.e. the 
   * name of a file. Otherwise, we won't be able to find the library dir.
   */
#define NCR (int)asize(CopyrightText)
#define NGPL (int)asize(GPLText)

  char buf[256],tmpstr[1024];
  int i;

  set_program_name(szProgram);

  ster_print(out,"G  R  O  M  A  C  S");
  fprintf(out,"\n");
  
  bromacs(tmpstr,1023);
  sp_print(out,tmpstr); 
  fprintf(out,"\n");

  ster_print(out,GromacsVersion());
  fprintf(out,"\n\n");

  /* fprintf(out,"\n");*/

  /* sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
  
  fprintf(out,"\n"); */

  for(i=0; (i<NCR); i++) 
    sp_print(out,CopyrightText[i]);
  for(i=0; (i<NGPL); i++)
    sp_print(out,GPLText[i]);

  fprintf(out,"\n");

  sprintf(buf,"%s",Program());
#ifdef GMX_DOUBLE
  strcat(buf," (double precision)");
#endif
  ster_print(out,buf);
  fprintf(out,"\n");
}
Esempio n. 7
0
void printFatalErrorHeader(FILE *fp, const char *title,
                           const char *func, const char *file, int line)
{
    // In case ProgramInfo is not initialized and there is an issue with the
    // initialization, fall back to "GROMACS".
    const char *programName = "GROMACS";
    try
    {
        programName = ProgramInfo::getInstance().displayName().c_str();
    }
    catch (const std::exception &)
    {
    }

    std::fprintf(fp, "\n-------------------------------------------------------\n");
    std::fprintf(fp, "Program:     %s, %s\n", programName, GromacsVersion());
    if (file != NULL)
    {
        // TODO: Check whether this works on Windows. If it doesn't, perhaps
        // add Path::startsWith().
        if (startsWith(file, CMAKE_SOURCE_DIR))
        {
            file += std::strlen(CMAKE_SOURCE_DIR);
            if (file[0] == '/' || file[0] == '\\')
            {
                ++file;
            }
        }
        std::fprintf(fp, "Source file: %s (line %d)\n", file, line);
    }
    if (func != NULL)
    {
        std::fprintf(fp, "Function:    %s\n", func);
    }
    std::fprintf(fp, "\n");
    std::fprintf(fp, "%s:\n", title);
}
Esempio n. 8
0
static void write_ttyman(FILE *out,
			 char *program,
			 int nldesc,char **desc,
			 int nfile,t_filenm *fnm,
			 int npargs,t_pargs *pa,
			 int nbug,char **bugs,bool bHeader)
{
  int i;
  char *tmp;
  
  if (bHeader) {
    fprintf(out,"%s\n\n",check_tty(program));
    fprintf(out,"%s\n%s\n",GromacsVersion(),mydate());
  }
  if (nldesc > 0) {
    fprintf(out,"DESCRIPTION:\n\n");
    print_tty_formatted(out,nldesc,desc);
  }
  if (nbug > 0) {
    fprintf(out,"\n");
    for(i=0; i<nbug; i++) {
      snew(tmp,strlen(bugs[i])+3);
      strcpy(tmp,"* ");
      strcpy(tmp+2,bugs[i]);
      fprintf(out,"%s\n",wrap_lines(tmp,80,2));
      sfree(tmp);
    }
  }
  if (nfile > 0) {
    fprintf(out,"\n");
    pr_fns(out,nfile,fnm);
  }
  if (npargs > 0) {
    print_pargs(out,npargs,pa);
  }
}
Esempio n. 9
0
void gmx_tng_open(const char       *filename,
                  char              mode,
                  tng_trajectory_t *tng)
{
#ifdef GMX_USE_TNG
    /* First check whether we have to make a backup,
     * only for writing, not for read or append.
     */
    if (mode == 'w')
    {
#ifndef GMX_FAHCORE
        /* only make backups for normal gromacs */
        make_backup(filename);
#endif
    }

    /* tng must not be pointing at already allocated memory.
     * Memory will be allocated by tng_util_trajectory_open() and must
     * later on be freed by tng_util_trajectory_close(). */
    if (TNG_SUCCESS != tng_util_trajectory_open(filename, mode, tng))
    {
        /* TNG does return more than one degree of error, but there is
           no use case for GROMACS handling the non-fatal errors
           gracefully. */
        gmx_fatal(FARGS,
                  "%s while opening %s for %s",
                  gmx_strerror("file"),
                  filename,
                  modeToVerb(mode));
    }

    if (mode == 'w' || mode == 'a')
    {
        /* FIXME in TNG: When adding data to the header, subsequent blocks might get
         * overwritten. This could be solved by moving the first trajectory
         * frame set(s) to the end of the file. Could that cause other problems,
         * e.g. when continuing a simulation? */
        char hostname[256];
        gmx_gethostname(hostname, 256);
        if (mode == 'w')
        {
            tng_first_computer_name_set(*tng, hostname);
        }
/* TODO: This should be implemented when the above fixme is done (adding data to
 * the header). */
//         else
//         {
//             tng_last_computer_name_set(*tng, hostname);
//         }

        char        programInfo[256];
        const char *precisionString = "";
#ifdef GMX_DOUBLE
        precisionString = " (double precision)";
#endif
        sprintf(programInfo, "%.100s, %.128s%.24s",
                gmx::getProgramContext().displayName(),
                GromacsVersion(), precisionString);
        if (mode == 'w')
        {
            tng_first_program_name_set(*tng, programInfo);
        }
/* TODO: This should be implemented when the above fixme is done (adding data to
 * the header). */
//         else
//         {
//             tng_last_program_name_set(*tng, programInfo);
//         }

#ifdef HAVE_UNISTD_H
        char username[256];
        getlogin_r(username, 256);
        if (mode == 'w')
        {
            tng_first_user_name_set(*tng, username);
        }
/* TODO: This should be implemented when the above fixme is done (adding data to
 * the header). */
//         else
//         {
//             tng_last_user_name_set(*tng, username);
//         }
#endif
    }
#else
    gmx_file("GROMACS was compiled without TNG support, cannot handle this file type");
    GMX_UNUSED_VALUE(filename);
    GMX_UNUSED_VALUE(mode);
    GMX_UNUSED_VALUE(tng);
#endif
}
Esempio n. 10
0
static bool LogoCallBack(t_x11 *x11, XEvent *event, Window /*w*/, void *data)
{
    /* Assume window is 100x110 */
    static bool bFirst = true;
#define CSIZE 9
#define NSIZE 8
#define OSIZE 9
#define HSIZE 7
#define YOFFS 30
    static t_circle c[] = {
        { 10, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 20, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 20, YOFFS+34, OSIZE, &LIGHTRED   },
        { 30, YOFFS+12, NSIZE, &LIGHTCYAN  },
        { 30, YOFFS+ 2, HSIZE, &WHITE     },
        { 40, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 40, YOFFS+34, CSIZE, &LIGHTGREEN },
        { 50, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 50, YOFFS,    OSIZE, &LIGHTRED   },
        { 60, YOFFS+22, NSIZE, &LIGHTCYAN  },
        { 60, YOFFS+32, HSIZE, &WHITE     },
        { 70, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 80, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 80, YOFFS+34, OSIZE, &LIGHTRED   },
        { 90, YOFFS+12, NSIZE, &LIGHTCYAN  },
        { 90, YOFFS+ 2, HSIZE, &WHITE      },
        {100, YOFFS+22, CSIZE, &LIGHTGREEN }
    };
    static int      lines[] = {
        0, 1, 1, 2, 1, 3, 3, 4, 3, 5, 5, 6, 5, 7, 7, 8, 7, 9,
        9, 10, 9, 11, 11, 12, 12, 13, 12, 14, 14, 15, 14, 16
    };
#define COFFS 70
    static t_mess   Mess[] = {
        { "GROMACS",                         0,       20, NULL },
        { NULL,                             16,        9, NULL },
        { "Copyright (c) 1991-2013",        COFFS+ 2,  9, NULL },
        { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11,  9, NULL },
        { "& Groningen University ",        COFFS+20,  9, NULL },
        { "click to dismiss",               COFFS+31,  8, NULL }
    };
#define NMESS asize(Mess)
    int             i;
    real            wfac, hfac;
    t_logo         *logo;
    t_windata      *wd;

    logo = (t_logo *)data;
    wd   = &(logo->wd);
    if (bFirst)
    {
        wfac = wd->width/110.0;
        hfac = wd->height/110.0;
        for (i = 0; (i < asize(c)); i++)
        {
            c[i].x *= wfac;
            c[i].y *= hfac;
        }
        Mess[1].text = GromacsVersion();
        for (i = 0; (i < NMESS); i++)
        {
            Mess[i].y  *= hfac;
            Mess[i].h  *= hfac;
            Mess[i].fnt = (i == 0) ? logo->bigfont : (i == NMESS-1) ? x11->font :
                logo->smallfont;
        }
        bFirst = false;
    }
    switch (event->type)
    {
        case Expose:
            XSetForeground(x11->disp, x11->gc, WHITE);
            XSetLineAttributes(x11->disp, x11->gc, 3, LineSolid, CapNotLast, JoinRound);
            for (i = 0; (i < asize(lines)); i += 2)
            {
                XDrawLine(x11->disp, wd->self, x11->gc,
                          c[lines[i]].x, c[lines[i]].y, c[lines[i+1]].x, c[lines[i+1]].y);
            }
            XSetLineAttributes(x11->disp, x11->gc, 1, LineSolid, CapNotLast, JoinRound);
            for (i = 0; (i < asize(c)); i++)
            {
                XSetForeground(x11->disp, x11->gc, *(c[i].col));
                XFillCircle(x11->disp, wd->self, x11->gc, c[i].x, c[i].y, c[i].rad);
            }
            XSetForeground(x11->disp, x11->gc, BLACK);
            XDrawRectangle(x11->disp, wd->self, x11->gc, 2, 2, wd->width-5, wd->height-5);
            for (i = 0; (i < NMESS); i++)
            {
                SpecialTextInRect(x11, Mess[i].fnt, wd->self, Mess[i].text,
                                  0, Mess[i].y, wd->width, Mess[i].h,
                                  eXCenter, eYCenter);
            }
            XSetForeground(x11->disp, x11->gc, x11->fg);
            break;
        case ButtonPress:
            hide_logo(x11, logo);
            return logo->bQuitOnClick;
            break;
        default:
            break;
    }

    return false;
}
Esempio n. 11
0
void
gmx_mtxio_write(char *                   filename,
                int                      nrow,
                int                      ncol,
                real *                   full_matrix,
                gmx_sparsematrix_t *     sparse_matrix)
{
    int     fd;
    XDR *   xd;
    int     i,j,prec;
    bool    bDum = TRUE;
    bool    bRead = FALSE;
    size_t  sz;

    if(full_matrix!=NULL && sparse_matrix!=NULL)
    {
        gmx_fatal(FARGS,"Both full AND sparse matrix specified to gmx_mtxio_write().\n");
    }

    fd = gmx_fio_open(filename,"w");
    gmx_fio_select(fd);
    xd = gmx_fio_getxdr(fd);

    /* Write magic number */
    i = GMX_MTXIO_MAGIC_NUMBER;
    do_int(i);

    /* Write generating Gromacs version */
    do_string(GromacsVersion());

    /* Write 1 for double, 0 for single precision */
    if(sizeof(real)==sizeof(double))
        prec = 1;
    else
        prec = 0;
    do_int(prec);

    do_int(nrow);
    do_int(ncol);

    if(full_matrix!=NULL)
    {
        /* Full matrix storage format */
        i = GMX_MTXIO_FULL_MATRIX;
        do_int(i);
        sz = nrow*ncol;
        ndo_real(full_matrix,sz,bDum);
    }
    else
    {
        /* Sparse storage */
        i = GMX_MTXIO_SPARSE_MATRIX;
        do_int(i);

        do_int(sparse_matrix->compressed_symmetric);
        do_int(sparse_matrix->nrow);
        if(sparse_matrix->nrow != nrow)
        {
            gmx_fatal(FARGS,"Internal inconsistency in sparse matrix.\n");
        }
        ndo_int(sparse_matrix->ndata,sparse_matrix->nrow,bDum);
        for(i=0; i<sparse_matrix->nrow; i++)
        {
            for(j=0; j<sparse_matrix->ndata[i]; j++)
            {
                do_int(sparse_matrix->data[i][j].col);
                do_real(sparse_matrix->data[i][j].value);
            }
        }
    }
    gmx_fio_close(fd);
}
Esempio n. 12
0
static void write_xmlman(FILE *out,
			 const char *program,
			 int nldesc,const char **desc,
			 int nfile,t_filenm *fnm,
			 int npargs,t_pargs *pa,
			 int nbug,const char **bugs,
			 t_linkdata *links)
{
  int i;
  char link[10],buf[256],opt[10];

#define NSR2(s) check_xml(s,program,links)
#define FLAG(w,f) (((w) & (f))==(f)) 

  fprintf(out,"<gromacs-manual version=\"%s\" date=\"%s\" www=\"http://www.gromacs.org\">\n",GromacsVersion(),mydate(buf,255,FALSE));
  /* fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n"); */

  fprintf(out,"<program name=\"%s\">",program);  
  if (nldesc > 0) {
    fprintf(out,"\n<description>\n<par>\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",NSR2(desc[i]));
  }
  fprintf(out,"</par>\n</description>\n");

  if (nfile > 0) {
    fprintf(out,"\n<files>\n");
    for(i=0; (i<nfile); i++) {
      strcpy(link,ftp2ext(fnm[i].ftp));
      if (strcmp(link,"???")==0)
	strcpy(link,"files");
        if (fnm[i].opt[0]=='-') strcpy(opt,fnm[i].opt+1);
	else strcpy(opt,fnm[i].opt);
      fprintf(out,
	      "<file type=\"%s\" typeid=\"%d\">\n"
              "\t<flags read=\"%d\" write=\"%d\" optional=\"%d\"/>\n"
	      "\t<option>%s</option>\n"
	      "\t<default-name link=\"%s.html\">%s</default-name>\n"
	      "\t<description>%s</description>\n"
	      "</file>\n",
	      ftp2defnm(fnm[i].ftp),	/* from gmxlib/filenm.c */
	      fnm[i].ftp,
	      FLAG(fnm[i].flag,ffREAD), FLAG(fnm[i].flag,ffWRITE), FLAG(fnm[i].flag,ffOPT), 
	      opt,link,fnm[i].fn,/*fileopt(fnm[i].flag),*/
	      NSR(ftp2desc(fnm[i].ftp)));
    }
    fprintf(out,"</files>\n");
  }

  if (npargs > 0) {
    fprintf(out,"\n<options>\n");
    for(i=0; (i<npargs); i++)
      fprintf(out,
	      "<option type=\"%s\" hidden=\"%d\">\n"
	      "\t<name >%s</name>\n"
	      "\t<default-value>%s</default-value>\n"
	      "\t<description>%s</description>\n"
	      "</option>\n",
	      argtp[pa[i].type], is_hidden(&pa[i]),
	      pa[i].option+1,	               /* +1 - with no trailing '-' */
	      pa_val(&(pa[i]),buf,255),pa[i].desc); /*argtp[pa[i].type],*/
    fprintf(out,"</options>\n");
  }

  if (nbug > 0) {
    fprintf(out,"\n<bugs>\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"\t<bug>%s</bug>\n",NSR(bugs[i]));
    fprintf(out,"</bugs>\n");
  }
  fprintf(out,"\n</program>\n</gromacs-manual>\n");
#undef FLAG  
}
Esempio n. 13
0
static void write_htmlman(FILE *out,
			  const char *program,
			  int nldesc,const char **desc,
			  int nfile,t_filenm *fnm,
			  int npargs,t_pargs *pa,
			  int nbug,const char **bugs,
			  t_linkdata *links)
{
  int i;
  char link[10],tmp[255];
  
  fprintf(out,"<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n",program);
  fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n");
  fprintf(out,"<BODY text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000FF\" vlink=\"#990000\" alink=\"#FF0000\">\n");
  fprintf(out,"<TABLE WIDTH=\"98%%\" NOBORDER >\n<TR><TD WIDTH=400>\n");
  fprintf(out,"<TABLE WIDTH=400 NOBORDER>\n<TD WIDTH=116>\n");
  fprintf(out,"<a href=\"http://www.gromacs.org/\">"
	  "<img SRC=\"../images/gmxlogo_small.png\""
	  "BORDER=0 </a></td>\n");
  fprintf(out,"<td ALIGN=LEFT VALIGN=TOP WIDTH=280>"
	  "<br><h2>%s</h2>",program);
  fprintf(out,"<font size=-1><A HREF=\"../online.html\">Main Table of Contents</A></font><br>");
  fprintf(out,"<br></td>\n</TABLE></TD><TD WIDTH=\"*\" ALIGN=RIGHT VALIGN=BOTTOM><p><B>%s<br>\n",GromacsVersion());
  fprintf(out,"%s</B></td></tr></TABLE>\n<HR>\n",mydate(tmp,255,FALSE));
  
  if (nldesc > 0) {
    fprintf(out,"<H3>Description</H3>\n<p>\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",NSR(desc[i]));
  }
  if (nfile > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Files</H3>\n");
    pr_html_files(out,nfile,fnm,program,links,FALSE);
  }
  if (npargs > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Other options</H3>\n");
    fprintf(out,
	    "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>\n"
	    "<TR>"
	    "<TH>option</TH>"
	    "<TH>type</TH>"
	    "<TH>default</TH>"
	    "<TH>description</TH>"
	    "</TR>\n");
    for(i=0; (i<npargs); i++)
      fprintf(out,
	      "<TR>"
	      "<TD ALIGN=RIGHT> <b><tt>%s%s</tt></b> </TD>"
	      "<TD ALIGN=RIGHT> %s </TD>"
	      "<TD ALIGN=RIGHT> <tt>%s</tt> </TD>"
	      "<TD> %s </TD>"
	      "</TD>\n",
	      (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1,
	      argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),NSR(pa[i].desc));
    fprintf(out,"</TABLE>\n");
  }
  if (nbug > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Known problems</H3>\n");
    fprintf(out,"<UL>\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"<LI>%s\n",NSR(bugs[i]));
    fprintf(out,"</UL>\n");
  }
  fprintf(out,"<P>\n");
  fprintf(out,"<hr>\n<div ALIGN=RIGHT>\n");
  fprintf(out,"<font size=\"-1\"><a href=\"http://www.gromacs.org\">"
	  "http://www.gromacs.org</a></font><br>\n");
  fprintf(out,"<font size=\"-1\"><a href=\"mailto:[email protected]\">"
	  "[email protected]</a></font><br>\n");
  fprintf(out,"</div>\n");
  fprintf(out,"</BODY>\n");
}
Esempio n. 14
0
static void write_nroffman(FILE *out,
			   const char *program,
			   int nldesc,const char **desc,
			   int nfile,t_filenm *fnm,
			   int npargs,t_pargs *pa,
			   int nbug,const char **bugs,
			   t_linkdata *links)

{
  int i;
  char tmp[256];
  
  
  fprintf(out,".TH %s 1 \"%s\" \"\" \"GROMACS suite, %s\"\n",program,mydate(tmp,255,FALSE),GromacsVersion());
  fprintf(out,".SH NAME\n");
  fprintf(out,"%s\n",program);
  fprintf(out,".B %s\n",GromacsVersion());
  
  fprintf(out,".SH SYNOPSIS\n");
  fprintf(out,"\\f3%s\\fP\n",program);

  /* command line arguments */
  if (nfile > 0) {
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s \"\n",check_nroff(fnm[i].opt),
	      check_nroff(fnm[i].fns[0]));
  }
  if (npargs > 0) {
    for(i=0; (i<npargs); i++)
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"\\-[no]%s\" \"\"\n",check_nroff(pa[i].option+1));
      else
	fprintf(out,".BI \"%s\" \" %s \"\n",check_nroff(pa[i].option),
		check_nroff(argtp[pa[i].type]));
  }
  
  /* description */
  if (nldesc > 0) {
    fprintf(out,".SH DESCRIPTION\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"\\&%s\n",check_nroff(desc[i]));
  }

  /* FILES */
  if (nfile > 0) {
    fprintf(out,".SH FILES\n");
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s\" \n.B %s\n %s \n\n",
	      check_nroff(fnm[i].opt),
              check_nroff(fnm[i].fns[0]),
              check_nroff(fileopt(fnm[i].flag,tmp,255)),
	      check_nroff(ftp2desc(fnm[i].ftp)));
  }
  
  /* other options */
  fprintf(out,".SH OTHER OPTIONS\n");
  if ( npargs > 0 ) {
    for(i=0; (i<npargs); i++) {
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"\\-[no]%s\"  \"%s\"\n %s\n\n",
		check_nroff(pa[i].option+1),
		check_nroff(pa_val(&(pa[i]),tmp,255)),
                check_nroff(pa[i].desc));
      else
	fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
		check_nroff(pa[i].option),
                check_nroff(argtp[pa[i].type]),
		check_nroff(pa_val(&(pa[i]),tmp,255)),
                check_nroff(pa[i].desc));
    }
  }

  if (nbug > 0) {
    fprintf(out,".SH KNOWN PROBLEMS\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"\\- %s\n\n",check_nroff(bugs[i]));
  }

  fprintf(out,".SH SEE ALSO\n.BR gromacs(7)\n\n");
  fprintf(out,"More information about \\fBGROMACS\\fR is available at <\\fIhttp://www.gromacs.org/\\fR>.\n");

}
Esempio n. 15
0
static void write_htmlman(FILE *out,
			  char *program,
			  int nldesc,char **desc,
			  int nfile,t_filenm *fnm,
			  int npargs,t_pargs *pa,
			  int nbug,char **bugs)
{
  int i;
  char link[10];
  
#define NSR(s) check_html(s,program)
  
  fprintf(out,"<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n",program);
  fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n");
  fprintf(out,"<BODY text=\"#000000\" bgcolor=\"#FFFFFF\" link=\"#0000FF\" vlink=\"#990000\" alink=\"#FF0000\">\n");
  fprintf(out,"<TABLE WIDTH=\"98%%\" NOBORDER >\n<TR><TD WIDTH=400>\n");
  fprintf(out,"<TABLE WIDTH=400 NOBORDER>\n<TD WIDTH=116>\n");
  fprintf(out,"<a href=\"http://www.gromacs.org/\">"
	  "<img SRC=\"../images/gmxlogo_small.jpg\""
	  "BORDER=0 height=133 width=116></a></td>\n");
  fprintf(out,"<td ALIGN=LEFT VALIGN=TOP WIDTH=280>"
	  "<br><h2>%s</h2>",program);
  fprintf(out,"<font size=-1><A HREF=\"../online.html\">Main Table of Contents</A></font><br>");
  fprintf(out,"<br></td>\n</TABLE></TD><TD WIDTH=\"*\" ALIGN=RIGHT VALIGN=BOTTOM><p><B>%s<br>\n",GromacsVersion());
  fprintf(out,"%s</B></td></tr></TABLE>\n<HR>\n",mydate());
  
  if (nldesc > 0) {
    fprintf(out,"<H3>Description</H3>\n<p>\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",NSR(desc[i]));
  }
  if (nfile > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Files</H3>\n");
    fprintf(out,
	    "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>\n"
	    "<TR>"
	    "<TH>option</TH>"
	    "<TH>filename</TH>"
	    "<TH>type</TH>"
	    "<TH>description</TH>"
	    "</TR>\n");
    for(i=0; (i<nfile); i++) {
      strcpy(link,ftp2ext(fnm[i].ftp));
      if (strcmp(link,"???")==0)
	strcpy(link,"files");
      fprintf(out,
	      "<TR>"
	      "<TD ALIGN=RIGHT> <b><tt>%s</tt></b> </TD>"
	      "<TD ALIGN=RIGHT> <tt><a href=\"%s.html\">%12s</a></tt> </TD>"
	      "<TD> %s </TD>"
	      "<TD> %s </TD>"
	      "</TR>\n",
	      fnm[i].opt,link,fnm[i].fn,fileopt(fnm[i].flag),
	      NSR(ftp2desc(fnm[i].ftp)));
    }
    fprintf(out,"</TABLE>\n");
  }
  if (npargs > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<H3>Other options</H3>\n");
    fprintf(out,
	    "<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>\n"
	    "<TR>"
	    "<TH>option</TH>"
	    "<TH>type</TH>"
	    "<TH>default</TH>"
	    "<TH>description</TH>"
	    "</TR>\n");
    for(i=0; (i<npargs); i++)
      fprintf(out,
	      "<TR>"
	      "<TD ALIGN=RIGHT> <b><tt>%s%s</tt></b> </TD>"
	      "<TD ALIGN=RIGHT> %s </TD>"
	      "<TD ALIGN=RIGHT> <tt>%s</tt> </TD>"
	      "<TD> %s </TD>"
	      "</TD>\n",
	      (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1,
	      argtp[pa[i].type],pa_val(&(pa[i])),NSR(pa[i].desc));
    fprintf(out,"</TABLE>\n");
  }
  if (nbug > 0) {
    fprintf(out,"<P>\n");
    fprintf(out,"<UL>\n");
    for(i=0; (i<nbug); i++)
      fprintf(out,"<LI>%s\n",NSR(bugs[i]));
    fprintf(out,"</UL>\n");
  }
  fprintf(out,"<P>\n");
  fprintf(out,"<hr>\n<div ALIGN=RIGHT>\n");
  fprintf(out,"<font size=\"-1\"><a href=\"http://www.gromacs.org\">"
	  "http://www.gromacs.org</a></font><br>\n");
  fprintf(out,"</div>\n");
  fprintf(out,"</BODY>\n");
}
Esempio n. 16
0
static void write_nroffman(FILE *out,
			   char *program,
			   int nldesc,char **desc,
			   int nfile,t_filenm *fnm,
			   int npargs,t_pargs *pa,
			   int nbug,char **bugs)

{
  int i;
  
  fprintf(out,".TH %s 1 \"%s\"\n",program,mydate());
  fprintf(out,".SH NAME\n");
  fprintf(out,"%s\n",program);
  fprintf(out,".B %s\n",GromacsVersion());
  
  fprintf(out,".SH SYNOPSIS\n");
  fprintf(out,"\\f3%s\\fP\n",program);

  /* command line arguments */
  if (nfile > 0) {
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s \"\n",fnm[i].opt,
	      fnm[i].fn);
  }
  if (npargs > 0) {
    for(i=0; (i<npargs); i++)
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"-[no]%s\" \"\"\n",pa[i].option+1);
      else
	fprintf(out,".BI \"%s\" \" %s \"\n",pa[i].option,
		argtp[pa[i].type]);
  }
  
  /* description */
  if (nldesc > 0) {
    fprintf(out,".SH DESCRIPTION\n");
    for(i=0; (i<nldesc); i++) 
      fprintf(out,"%s\n",check_nroff(desc[i]));
  }

  /* FILES */
  if (nfile > 0) {
    fprintf(out,".SH FILES\n");
    for(i=0; (i<nfile); i++)
      fprintf(out,".BI \"%s\" \" %s\" \n.B %s\n %s \n\n",
	      fnm[i].opt,fnm[i].fn,fileopt(fnm[i].flag),
	      check_nroff(ftp2desc(fnm[i].ftp)));
  }
  
  /* other options */
  fprintf(out,".SH OTHER OPTIONS\n");
  if ( npargs > 0 ) {
    for(i=0; (i<npargs); i++) {
      if (pa[i].type == etBOOL)
	fprintf(out,".BI \"-[no]%s\"  \"%s\"\n %s\n\n",
		check_nroff(pa[i].option+1),
		pa_val(&(pa[i])),check_nroff(pa[i].desc));
      else
	fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
		check_nroff(pa[i].option),argtp[pa[i].type],
		pa_val(&(pa[i])),check_nroff(pa[i].desc));
    }
  }

  if (nbug > 0) {
    for(i=0; (i<nbug); i++)
      fprintf(out,"\\- %s\n\n",check_nroff(bugs[i]));
  }

}