diff --git a/makedoc.sh b/makedoc.sh index 58336ceffd999931473dc52de436ab7e2d612b45..a82bb6ea95114a473558d8f06b3f962e45a36666 100644 --- a/makedoc.sh +++ b/makedoc.sh @@ -1,4 +1,14 @@ #!/bin/bash +# +# Make user information HTML pages of each of TPCCLIB applications that are found in ./bin folder. +# These are made by calling each program with option --helphtml. +# HTML files are placed in ./doc folder. Also a web page ./doc/index.html, containing download +# links and links to application docs, is created. +# +# The bin folder is created during TPCCLIB compilation under the build directory. +# Accordingly, this script should be copied to the build directory and executed from there +# with command ./makedoc.sh +# FILES=* cd ./bin/ if [ $? -ne 0 ] @@ -19,26 +29,27 @@ then fi printf "<!DOCTYPE html>\n" > ../doc/index.html -printf "<html>\n" >> ../doc/index.html +printf "<html lang=\"en-GB\">\n" >> ../doc/index.html printf "<head>\n" >> ../doc/index.html -printf " <meta charset="UTF-8">\n" >> ../doc/index.html +printf " <meta charset=\"utf-8\">\n" >> ../doc/index.html +printf " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n" >> ../doc/index.html printf " <title>tpcclib applications</title>\n" >> ../doc/index.html - -printf " <style>\n" >> ../doc/index.html -printf " .containter {\n" >> ../doc/index.html -printf " width: 500px;\n" >> ../doc/index.html +printf " <style type=\"text/css\">\n" >> ../doc/index.html +printf " body { font-family: monospace; font-size: 1em; margin-left: 4em; }\n" >> ../doc/index.html +printf " ul.container {\n" >> ../doc/index.html +printf " list-style-type: none;\n" >> ../doc/index.html +printf " line-height: 2.0;\n" >> ../doc/index.html +printf " width: 60em;\n" >> ../doc/index.html +printf " display: table;\n" >> ../doc/index.html printf " }\n" >> ../doc/index.html -printf " .containter div {\n" >> ../doc/index.html -printf " width: 100px;\n" >> ../doc/index.html +printf " li {\n" >> ../doc/index.html +printf " width: 12em;\n" >> ../doc/index.html printf " float: left;\n" >> ../doc/index.html -printf " padding: 5px 0px;\n" >> ../doc/index.html -printf " font-family: monospace;\n" >> ../doc/index.html printf " }\n" >> ../doc/index.html printf " </style>\n" >> ../doc/index.html -printf " <meta name=\"keywords\" content=\"MODELING, ANALYSIS\n" >> ../doc/index.html -printf " SOFTWARE, PROGRAMS, WINDOWS, MACOS, LINUX, UBUNTU,\n" >> ../doc/index.html -printf " TPC, TPCCLIB, TURKU, POSITRON EMISSION TOMOGRAPHY\" />\n" >> ../doc/index.html +printf " <meta name=\"keywords\" content=\"MODELING, ANALYSIS SOFTWARE, TPCCLIB,\n" >> ../doc/index.html +printf " TPC, TURKU PET CENTRE, POSITRON EMISSION TOMOGRAPHY\" />\n" >> ../doc/index.html printf " <meta name=\"description\" content=\"List of TPC software\" />\n" >> ../doc/index.html printf "</head>\n" >> ../doc/index.html @@ -46,19 +57,19 @@ printf "<body>\n" >> ../doc/index.html printf "<!-- THIS HTML FILE IS AUTOMATICALLY CREATED - DO NOT EDIT -->\n" >> ../doc/index.html -printf "<h1>List of applications in TPCCLIB</h1>\n" >> ../doc/index.html +printf "<div>\n<h1>List of applications in TPCCLIB</h1>\n" >> ../doc/index.html -printf "<p>Download the listed applications for Windows, macOS, and Linux from \n" >> ../doc/index.html +printf "<p>Download the listed applications for Windows and Linux from \n" >> ../doc/index.html printf "<a href=\"https://www.dropbox.com/sh/l22cilo1ze25rj4/RoJiiLh2Q7\">Dropbox</a>, \n" >> ../doc/index.html printf "<a href=\"https://seafile.utu.fi/d/15843078fb/\">seafile.utu.fi</a>, or\n" >> ../doc/index.html printf "<a href=\"https://1drv.ms/u/s!At2-B4twnc-loADgwe__5uL5noRq?e=Lc3GRk\">OneDrive</a>.\n" >> ../doc/index.html printf "</p>\n" >> ../doc/index.html printf "<p>Download source code from \n" >> ../doc/index.html -printf "<a href=\"https://gitlab.utu.fi/vesoik/tpcclib/-/releases\">GitLab</a>.</p>\n" >> ../doc/index.html +printf "<a href=\"https://gitlab.utu.fi/vesoik/tpcclib/-/releases\">GitLab</a>.</p>\n</div>\n" >> ../doc/index.html -printf "<div class=\"containter\">\n" >> ../doc/index.html +printf "<ul class=\"container\">\n" >> ../doc/index.html for f in $FILES do @@ -66,12 +77,12 @@ if [[ "$f" != lib* ]] then ls -al $f ./$f --helphtml > ../doc/"${f%.*}".html - printf " <div><a href=\""${f%.*}".html\">"${f%.*}"</a></div>\n" >> ../doc/index.html + printf " <li><a href=\""${f%.*}".html\">"${f%.*}"</a></li>\n" >> ../doc/index.html fi done -printf "</div>\n" >> ../doc/index.html +printf "</ul>\n" >> ../doc/index.html +printf "<footer><br><br></footer>\n" >> ../doc/index.html printf "</body>\n" >> ../doc/index.html printf "</html>\n" >> ../doc/index.html - diff --git a/v1/libtpcmisc/proginfo.c b/v1/libtpcmisc/proginfo.c index 4f5cc7a1f104525c3bc97665b5b5c2f58b182d81..9007335f5b893cf621d8b5964f8859e189a9102a 100644 --- a/v1/libtpcmisc/proginfo.c +++ b/v1/libtpcmisc/proginfo.c @@ -8,10 +8,14 @@ /*****************************************************************************/ static char *tpclicense[] = { - "This program comes with ABSOLUTELY NO WARRANTY.", - "This is free software, and you are welcome to redistribute it under", - "GNU General Public License. Source codes are available in", - "https://gitlab.utu.fi/vesoik/tpcclib.git", + "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and", + "you are welcome to redistribute it under GNU General Public License v3.", + "Source codes are available in https://gitlab.utu.fi/vesoik/tpcclib.git", + 0}; +static char *tpclicense4html[] = { + "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome", + "to redistribute it under <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General Public License</a>.", + "Source codes are available in <a href=\"https://gitlab.utu.fi/vesoik/tpcclib.git\">https://gitlab.utu.fi/vesoik/tpcclib.git</a>.", 0}; static char *tpcstdoptions[] = { " -h, --help", @@ -218,7 +222,7 @@ int tpcHtmlUsage( char *bprogram, *fname, *cptr, *line; FILE *fp; - if(program==NULL || text==NULL || strlen(program)<1) return 1; + if(program==NULL || text==NULL || strnlen(program, 1)<1) return 1; /* Clean program name */ bprogram=strdup(program); @@ -240,17 +244,27 @@ int tpcHtmlUsage( /* Write HTML header */ len=fprintf(fp, "<!DOCTYPE html>\n"); if(len<10) {free(bprogram); free(fname); return 2;} - fprintf(fp, "<html>\n"); + fprintf(fp, "<html lang=\"en-GB\">\n"); fprintf(fp, "<head>\n"); - fprintf(fp, " <meta charset=\"UTF-8\">\n"); + fprintf(fp, " <meta charset=\"utf-8\">\n"); + fprintf(fp, " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"); fprintf(fp, " <title>%s</title>\n", bprogram); fprintf(fp, " <style type=\"text/css\">\n"); - fprintf(fp, " * {font-family: monospace;}\n"); + fprintf(fp, " body {\n"); + fprintf(fp, " margin-left: 2em;\n"); + fprintf(fp, " font-family: monospace;\n"); + fprintf(fp, " font-size: 1em;\n"); + fprintf(fp, " }\n"); + fprintf(fp, " h1 {\n"); + fprintf(fp, " font-size: 1.3em;\n"); + fprintf(fp, " margin-top: 1em;\n"); + fprintf(fp, " margin-bottom: 1em;\n"); + fprintf(fp, " }\n"); fprintf(fp, " footer {\n"); fprintf(fp, " border:1px solid gray;\n"); - fprintf(fp, " font-size: smaller;\n"); + fprintf(fp, " font-size: 0.8em;\n"); fprintf(fp, " }\n"); - fprintf(fp, " img {border-width: 0px;}\n"); + fprintf(fp, " footer p {margin-left: 1em;}\n"); fprintf(fp, " </style>\n"); fprintf(fp, "</head>\n\n"); @@ -259,14 +273,14 @@ int tpcHtmlUsage( /* Write program name, version and copyright as title; */ /* replace (c) with html code when necessary */ - fprintf(fp, "<h2>%s - tpcclib %d.%d.%d ", bprogram, tpcclib_VERSION_MAJOR, + fprintf(fp, "<h1>%s - tpcclib %d.%d.%d ", bprogram, tpcclib_VERSION_MAJOR, tpcclib_VERSION_MINOR, tpcclib_VERSION_PATCH); line=tpcclib_COPYRIGHT; len=strlen(line); for(j=0; j<len; j++) { if(strncasecmp(line+j, "(C)", 3)==0) {fputs("©", fp); j+=2; continue;} fputc(line[j], fp); } - fputs("</h2>\n\n", fp); + fputs("</h1>\n\n", fp); /* Print usage */ fprintf(fp, "<pre>\n"); @@ -345,19 +359,9 @@ int tpcHtmlUsage( /* Write footer */ fprintf(fp, "\n<footer>\n"); - - /* Licence info */ - fprintf(fp, "<div>\n"); - /* Icon with link to GNU-GPL */ - fprintf(fp, "<a href=\"http://www.gnu.org/licenses/gpl-3.0-standalone.html\">\n"); - fprintf(fp, "<img alt=\"GNU GPL\" "); - fprintf(fp, "style=\"width:88px; height:31px; float:left; margin: 5px 20px 5px 5px;\""); - fprintf(fp, "\n src=\"http://www.turkupetcentre.net/petanalysis/pic/gplv3-88x31.png\"></a>\n"); - /* Text */ fprintf(fp, "<p>"); - i=0; while(tpclicense[i]!=0) fprintf(fp, "%s<br>\n", tpclicense[i++]); + i=0; while(tpclicense4html[i]!=0) fprintf(fp, "%s<br>\n", tpclicense4html[i++]); fprintf(fp, "</p>\n"); - fprintf(fp, "</div>\n"); fprintf(fp, "</footer>\n"); /* Close HTML */ diff --git a/v2/libtpcextensions/proginfo.c b/v2/libtpcextensions/proginfo.c index 1631d143f6d2c17abfe7a1047a63ff55d93d2c39..761a53c31268ebe03ad70d7a83effa4a1b96336c 100644 --- a/v2/libtpcextensions/proginfo.c +++ b/v2/libtpcextensions/proginfo.c @@ -14,10 +14,14 @@ /*****************************************************************************/ static char *tpclicense[] = { - "This program comes with ABSOLUTELY NO WARRANTY.", - "This is free software, and you are welcome to redistribute it under", - "GNU General Public License. Source codes are available in", - "https://gitlab.utu.fi/vesoik/tpcclib.git", + "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and", + "you are welcome to redistribute it under GNU General Public License v3.", + "Source codes are available in https://gitlab.utu.fi/vesoik/tpcclib.git", + 0}; +static char *tpclicense4html[] = { + "This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome", + "to redistribute it under <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General Public License</a>.", + "Source codes are available in <a href=\"https://gitlab.utu.fi/vesoik/tpcclib.git\">https://gitlab.utu.fi/vesoik/tpcclib.git</a>.", 0}; static char *tpcstdoptions[] = { " -h, --help", @@ -165,7 +169,7 @@ void tpcPrintUsage( int tpcHtmlUsage( /** Program name, may contain extension and path. */ const char *program, - /** Program usage text */ + /** Program usage text. */ char *text[], /** Path name where to create file programname.html; path may contain trailing '/' or '\\'. */ const char *path @@ -196,17 +200,27 @@ int tpcHtmlUsage( /* Write HTML header */ len=fprintf(fp, "<!DOCTYPE html>\n"); if(len<10) {free(bprogram); free(fname); return 2;} - fprintf(fp, "<html>\n"); + fprintf(fp, "<html lang=\"en-GB\">\n"); fprintf(fp, "<head>\n"); - fprintf(fp, " <meta charset=\"UTF-8\">\n"); + fprintf(fp, " <meta charset=\"utf-8\">\n"); + fprintf(fp, " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"); fprintf(fp, " <title>%s</title>\n", bprogram); fprintf(fp, " <style type=\"text/css\">\n"); - fprintf(fp, " * {font-family: monospace;}\n"); + fprintf(fp, " body {\n"); + fprintf(fp, " margin-left: 2em;\n"); + fprintf(fp, " font-family: monospace;\n"); + fprintf(fp, " font-size: 1em;\n"); + fprintf(fp, " }\n"); + fprintf(fp, " h1 {\n"); + fprintf(fp, " font-size: 1.3em;\n"); + fprintf(fp, " margin-top: 1em;\n"); + fprintf(fp, " margin-bottom: 1em;\n"); + fprintf(fp, " }\n"); fprintf(fp, " footer {\n"); fprintf(fp, " border:1px solid gray;\n"); - fprintf(fp, " font-size: smaller;\n"); + fprintf(fp, " font-size: 0.8em;\n"); fprintf(fp, " }\n"); - fprintf(fp, " img {border-width: 0px;}\n"); + fprintf(fp, " footer p {margin-left: 1em;}\n"); fprintf(fp, " </style>\n"); fprintf(fp, "</head>\n\n"); @@ -215,14 +229,14 @@ int tpcHtmlUsage( /* Write program name, version and copyright as title; */ /* replace (c) with html code when necessary */ - fprintf(fp, "<h2>%s - tpcclib %d.%d.%d ", bprogram, tpcclib_VERSION_MAJOR, + fprintf(fp, "<h1>%s - tpcclib %d.%d.%d ", bprogram, tpcclib_VERSION_MAJOR, tpcclib_VERSION_MINOR, tpcclib_VERSION_PATCH); line=tpcclib_COPYRIGHT; len=strlen(line); for(j=0; j<len; j++) { if(strncasecmp(line+j, "(C)", 3)==0) {fputs("©", fp); j+=2; continue;} fputc(line[j], fp); } - fputs("</h2>\n\n", fp); + fputs("</h1>\n\n", fp); /* Print usage */ fprintf(fp, "<pre>\n"); @@ -301,21 +315,11 @@ int tpcHtmlUsage( /* Write footer */ fprintf(fp, "\n<footer>\n"); - - /* Licence info */ - fprintf(fp, "<div>\n"); - /* Icon with link to GNU-GPL */ - fprintf(fp, "<a href=\"http://www.gnu.org/licenses/gpl-3.0-standalone.html\">\n"); - fprintf(fp, "<img alt=\"GNU GPL\" "); - fprintf(fp, "style=\"width:88px; height:31px; float:left; margin: 5px 20px 5px 5px;\""); - fprintf(fp, "\n src=\"http://www.turkupetcentre.net/petanalysis/pic/gplv3-88x31.png\"></a>\n"); - /* Text */ fprintf(fp, "<p>"); - i=0; while(tpclicense[i]!=0) fprintf(fp, "%s<br>\n", tpclicense[i++]); + i=0; while(tpclicense4html[i]!=0) fprintf(fp, "%s<br>\n", tpclicense4html[i++]); fprintf(fp, "</p>\n"); - fprintf(fp, "</div>\n"); fprintf(fp, "</footer>\n"); - + /* Close HTML */ fprintf(fp, "</body>\n"); fprintf(fp, "</html>\n");