Example #1
0
static inline bool is_finite(const Sk4s& value) {
    auto finite = value * Sk4s(0) == Sk4s(0);
    return finite.allTrue();
}
Example #2
0
 static inline bool checkArgs(const Args& args, index_sequence<Is...>)
 {
     return allTrue(checkArg<As>(args[Is])...);
 }
Example #3
0
void
MakeDefs(char *name)
{
	Def *d;
	CmdCode dir;
	char *line, *cmd, *blk, *file;
	extern int pr_hide;
	int mod = 0, sec = 0, lino = 0;
	CmdCode lastdir = Continue;

	IoReadFile(name);
	d = NwDef(Bfile, mod, sec, 0, mx_file);
	d->d_cmd = name;

	while ((line = NextLine()) && *line != '@')
		;
	PrevLine();
	while (!EofFile()) {
		dir = DefDir();
		lino = mx_line;
		file = mx_file;
		cmd = DefCmd();
		blk = DefBlk();

		switch (dir) {
/*
 * conditional text and code
 * Syntax:
 *     @if <macroId>\n <block> [@else <block> ] @endif
 */
		case Ifdef:
			pushCond(GetDef(cmd) != NULL, cmd);
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = NULL;
				if (allTrue()) {
					d = NwDef(lastdir, mod, sec, lino, file);
					d->d_cmd = NULL;
					d->d_blk = blk;
				}
			}

			break;
		case Ifndef:
			toggle();
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = topMacro();
				d->d_blk = NULL;
				d = NwDef(lastdir, mod, sec, lino, file);
				d->d_cmd = NULL;
				d->d_blk = blk;
			}
			break;
		case Endif:
			if (!topCond())
				toggle();

			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = topMacro();
				d->d_blk = NULL;
			}
			popCond();
			if (allTrue()) {
				d = NwDef(lastdir, mod, sec, lino, file);
				d->d_cmd = NULL;
				d->d_blk = blk;
			}
			break;
			/*
			 * Define index.
			 * Syntax:@<n><string>\n@...
			 */
		case Index0:
		case Index1:
		case Index2:
		case Index3:
		case Index4:
		case Index5:
		case Index6:
		case Index7:
		case Index8:
		case Index9:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = blk;
				lastdir = Continue;
			}
			break;
			/*
			 * Define title, author, date, version.
			 * Syntax: @[tavd]<string>\n@...
			 */
		case Title:
			if (allTrue()) {
				mx_title = cmd;
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				lastdir = Continue;

			}
			break;
		case Version:
			if (allTrue()) {
				mx_version = cmd;
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				lastdir = Continue;
			}
			break;
		case Author:
			if (allTrue()) {
				mx_author = cmd;
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				lastdir = Continue;
			}
			break;
		case Date:
			if (allTrue()) {
				mx_date = cmd;
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				lastdir = Continue;
			}
			break;
			/*
			 * Text directives: chapter, section, paragraph.
			 * Syntax:@[*+ ]<string>\n<blok>@...
			 * Synatx:@\n<blok>@...
			 */
		case Module:
			if (allTrue()) {
				if (!Hide()) {
					mod++;
					sec = 0;
				}
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = blk;
				lastdir = Continue;
			}
			break;
		case Section:
			if (allTrue()) {
				if (!Hide())
					sec++;
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = blk;
				lastdir = Continue;
			}
			break;
		case Subsection:
		case Paragraph:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_blk = blk;
				d->d_cmd = cmd;
				lastdir = Continue;
			}
			break;
		case Qcode:
		case Continue:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_blk = blk;
				lastdir = Continue;
			}
			break;
			/*
			 * Code directives, 
			 * Pool: spec, impl
			 * C:    .h, .c, .cc, .y, .l
			 * Basename
			 * Syntax:@[sihcylfp]\n<blk>\n@...
			 */
		case Ofile:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				/* specially for Windows: replace all /'s with DIR_SEP's */
#if DIR_SEP != '/'
				{
					char *tmp = cmd;

					while ((tmp = strchr(tmp, '/')) != NULL)
						*tmp++ = DIR_SEP;
				}
#endif
				d->d_cmd = cmd;
				lastdir = Continue;
			}
			break;
		case Pspec:
		case Pimpl:
		case Cdef:
		case Csrc:
		case Cyacc:
		case Clex:
		case Prolog:
		case Haskell:
		case MALcode:
		case HTML:
		case ODLspec:
		case OQLspec:
		case SQL:
		case Java:
		case Qnap:
		case ProC:
		case Shell:
		case fGrammar:
		case Macro:
		case XML:
		case DTD:
		case XSL:
		case Config:
		case CCyacc:
		case CClex:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = blk;
				lastdir = dir;
			}
			break;
/*
 * Macro definitions.
 * Syntax:@=<def>\n<blok>\n@... 
 */
		case Mxmacro:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = cmd;
				d->d_blk = blk;
				/*add information */
				lastdir = Continue;
			}
			break;
		case InHide:
			d = NwDef(dir, mod, sec, lino, file);
			d->d_cmd = cmd;
			d->d_blk = blk;
			HideOn();
			break;
		case OutHide:
			d = NwDef(dir, mod, sec, lino, file);
			d->d_cmd = cmd;
			d->d_blk = blk;
			HideOff();
			break;
			/*
			 * Comment statement
			 * Syntax:@/<blk>\n...
			 */
		case Comment:
			if (allTrue()) {
				d = NwDef(dir, mod, sec, lino, file);
				d->d_cmd = NULL;
				d->d_blk = blk;
			}
			break;
		default:
			Fatal("MakeDefs", "Unknown directive:%c%c", MARK, dir);
		}
	}
	d = NwDef(Efile, mod, sec, mx_line, mx_file);
	CloseFile();
	pr_hide = 0;
}
Example #4
0
 // 2.1 compatibility
 array alltrue(const array &in, const int dim) { return allTrue(in, dim); }