Added basic help messages in addtion to reference to web pages
This commit is contained in:
parent
76cf00853c
commit
de7d292501
|
|
@ -17,19 +17,20 @@
|
||||||
* Internet Archive using the link below.
|
* Internet Archive using the link below.
|
||||||
* https://web.archive.org/web/20180221111839/http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/
|
* https://web.archive.org/web/20180221111839/http://newton.ex.ac.uk/teaching/CDHW/Electronics2/userguide/
|
||||||
*/
|
*/
|
||||||
void
|
#define BASE_HELP_URL "http://ngspice.sourceforge.net/docs"
|
||||||
com_ghelp(wordlist *wl)
|
void com_ghelp(wordlist *wl)
|
||||||
{
|
{
|
||||||
#if defined(HAS_WINGUI) || defined(_MSC_VER) || defined(__MINGW32__) || defined(X_DISPLAY_MISSING) || defined(NOINTHELP)
|
#if defined(HAS_WINGUI) || defined(_MSC_VER) || defined(__MINGW32__) ||\
|
||||||
|
defined(X_DISPLAY_MISSING) || defined(NOINTHELP)
|
||||||
|
com_help(wl);
|
||||||
|
|
||||||
NG_IGNORE(wl);
|
/* After brief help from com_help, add info on the web links to the
|
||||||
|
* the PDF and HTML versions of the manual */
|
||||||
(void) printf("Internal help is no longer available!\n"
|
(void) out_printf("For further details please see the latest official "
|
||||||
"For the latest official ngspice manual in PDF format, "
|
"ngspice manual in PDF format at\n"
|
||||||
"please see\n"
|
" " BASE_HELP_URL "/ngspice-manual.pdf\n"
|
||||||
" http://ngspice.sourceforge.net/docs/ngspice-manual.pdf\n"
|
"or in HTML format at\n"
|
||||||
"Or for HTML see\n"
|
" " BASE_HELP_URL "/ngspice-html-manual/manual.html\n\n");
|
||||||
" http://ngspice.sourceforge.net/docs/ngspice-html-manual/manual.html\n");
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
|
||||||
|
|
@ -9,51 +9,78 @@
|
||||||
#include "com_help.h"
|
#include "com_help.h"
|
||||||
#include "ngspice/fteext.h"
|
#include "ngspice/fteext.h"
|
||||||
|
|
||||||
|
#define N_CMD_DFLT 512
|
||||||
void
|
void com_help(wordlist *wl)
|
||||||
com_help(wordlist *wl)
|
|
||||||
{
|
{
|
||||||
struct comm *c;
|
|
||||||
struct comm *ccc[512]; /* Should be enough. */
|
|
||||||
int numcoms, i;
|
|
||||||
bool allflag = FALSE;
|
bool allflag = FALSE;
|
||||||
|
|
||||||
|
/* Make empty list and "all" behave the same except for the part
|
||||||
|
* related to "help all" */
|
||||||
if (wl && eq(wl->wl_word, "all")) {
|
if (wl && eq(wl->wl_word, "all")) {
|
||||||
allflag = TRUE;
|
allflag = TRUE;
|
||||||
wl = NULL; /* XXX Probably right */
|
wl = (wordlist *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We want to use more mode whether "moremode" is set or not. */
|
/* We want to use more mode whether "moremode" is set or not.
|
||||||
|
* In that case the code below should be changed... */
|
||||||
out_moremode = TRUE;
|
out_moremode = TRUE;
|
||||||
out_init();
|
out_init();
|
||||||
out_moremode = FALSE;
|
out_moremode = FALSE;
|
||||||
|
|
||||||
|
|
||||||
if (wl == NULL) {
|
if (wl == NULL) {
|
||||||
out_printf("For a complete description "
|
struct comm *ccc_dflt[N_CMD_DFLT]; /* Should be enough. */
|
||||||
"read the Spice3 User's Manual.\n");
|
struct comm **ccc; /* dynamic alloc in case it is not */
|
||||||
|
int numcoms;
|
||||||
|
|
||||||
if (!allflag) {
|
if (!allflag) {
|
||||||
out_printf("For a list of all commands "
|
out_printf("For a list of all commands "
|
||||||
"type \"help all\", for a short\n"
|
"type \"help all\", for a short\n"
|
||||||
"description of \"command\", "
|
"description of \"command\", "
|
||||||
"type \"help command\".\n");
|
"type \"help command\".\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Count the number of commands */
|
||||||
|
for (numcoms = 0; cp_coms[numcoms].co_func != NULL; numcoms++) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
if (numcoms > N_CMD_DFLT) {
|
||||||
|
ccc = TMALLOC(struct comm *, numcoms);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ccc = ccc_dflt;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sort the commands */
|
/* Sort the commands */
|
||||||
for (numcoms = 0; cp_coms[numcoms].co_func != NULL; numcoms++)
|
for (numcoms = 0; cp_coms[numcoms].co_func != NULL; numcoms++) {
|
||||||
ccc[numcoms] = &cp_coms[numcoms];
|
ccc[numcoms] = &cp_coms[numcoms];
|
||||||
|
}
|
||||||
qsort(ccc, (size_t) numcoms, sizeof(struct comm *), hcomp);
|
qsort(ccc, (size_t) numcoms, sizeof(struct comm *), hcomp);
|
||||||
|
|
||||||
for (i = 0; i < numcoms; i++) {
|
/* Print help for each of the "major" commands */
|
||||||
if ((ccc[i]->co_spiceonly && ft_nutmeg) ||
|
{
|
||||||
(ccc[i]->co_help == NULL) ||
|
int i;
|
||||||
(!allflag && !ccc[i]->co_major))
|
for (i = 0; i < numcoms; i++) {
|
||||||
continue;
|
if ((ccc[i]->co_spiceonly && ft_nutmeg) ||
|
||||||
out_printf("%s ", ccc[i]->co_comname);
|
(ccc[i]->co_help == NULL) ||
|
||||||
out_printf(ccc[i]->co_help, cp_program);
|
(!allflag && !ccc[i]->co_major)) {
|
||||||
out_send("\n");
|
continue;
|
||||||
|
}
|
||||||
|
out_printf("%s ", ccc[i]->co_comname);
|
||||||
|
out_printf(ccc[i]->co_help, cp_program);
|
||||||
|
out_send("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
|
/* Free allocation if it was required */
|
||||||
|
if (ccc != ccc_dflt) {
|
||||||
|
txfree(ccc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
while (wl != NULL) {
|
while (wl != NULL) {
|
||||||
|
struct comm *c;
|
||||||
for (c = &cp_coms[0]; c->co_func != NULL; c++)
|
for (c = &cp_coms[0]; c->co_func != NULL; c++)
|
||||||
if (eq(wl->wl_word, c->co_comname)) {
|
if (eq(wl->wl_word, c->co_comname)) {
|
||||||
out_printf("%s ", c->co_comname);
|
out_printf("%s ", c->co_comname);
|
||||||
|
|
@ -73,16 +100,20 @@ com_help(wordlist *wl)
|
||||||
|
|
||||||
if (al == NULL) {
|
if (al == NULL) {
|
||||||
fprintf(cp_out, "Sorry, no help for %s.\n", wl->wl_word);
|
fprintf(cp_out, "Sorry, no help for %s.\n", wl->wl_word);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
out_printf("%s is aliased to ", wl->wl_word);
|
out_printf("%s is aliased to ", wl->wl_word);
|
||||||
/* Minor badness here... */
|
/* Minor badness here... */
|
||||||
wl_print(al->al_text, cp_out);
|
wl_print(al->al_text, cp_out);
|
||||||
out_send("\n");
|
out_send("\n");
|
||||||
}
|
}
|
||||||
}
|
} /* end of case that a function with the given name was found */
|
||||||
wl = wl->wl_next;
|
wl = wl->wl_next; /* step to next word in list of help items */
|
||||||
}
|
} /* end of loop over list of help items */
|
||||||
}
|
}
|
||||||
|
|
||||||
out_send("\n");
|
out_send("\n");
|
||||||
}
|
} /* end of function com_help */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue