Add the SYSINCLUDE directive.

This commit is contained in:
Dianne Skoll
2024-12-13 08:18:22 -05:00
parent af8b4e6df1
commit 5e333f6162
8 changed files with 28 additions and 9 deletions

View File

@@ -117,7 +117,8 @@
"NOQUEUE" "OMIT" "OMITFUNC" "ONCE" "POP" "POP-OMIT-CONTEXT" "PRESERVE"
"PRIORITY" "PS" "PSFILE" "PUSH" "PUSH-OMIT-CONTEXT" "REM" "RUN"
"SATISFY" "SCAN" "SCANFROM" "SCHED" "SECOND" "SET" "SKIP" "SPECIAL"
"TAG" "THIRD" "THROUGH" "TRANSLATE" "TRANS" "UNSET" "UNTIL" "WARN")
"SYSINCLUDE" "TAG" "THIRD" "THROUGH" "TRANSLATE" "TRANS" "UNSET"
"UNTIL" "WARN")
#'(lambda (a b) (> (length a) (length b)))))

View File

@@ -1924,7 +1924,7 @@ the first day of the month. The local \fBOMIT\fR keyword causes the
Finally, the \fBAFTER\fR keyword will keep moving the reminder forward
until it has passed any holidays specified with global \fBOMIT\fR
commands.
.SH THE DO AND INCLUDE COMMANDS
.SH THE DO, INCLUDE AND SYSINCLUDE COMMANDS
.PP
\fBRemind\fR allows you to include other files in your reminder script,
similar to the C preprocessor #include directive. For example, your
@@ -1981,6 +1981,11 @@ symbolic link itself, \fBDO\fR will fail. \fBRemind\fR does \fInot\fR
resolve the real path of symbolic links, so you should avoid using
symbolic links to files.
.PP
The \fBSYSINCLUDE\fR command is similar to \fBDO\fR, but it looks for
relative pathnames under the system directory containing standard reminder
scripts. For thie version of \fBRemind\fR, the system directory is
"@prefix@/share/remind".
.PP
.SH THE RUN COMMAND
.PP
If you include other files in your reminder script, you may not always
@@ -5804,14 +5809,14 @@ To use a language pack (in this example, de.rem), simply place this at
the top of your reminders file:
.PP
.nf
INCLUDE [$SysInclude]/lang/de.rem
SYSINCLUDE lang/de.rem
.fi
.PP
If you want \fBRemind\fR to try to find the language pack appropriate
for your locale settings, use:
.PP
.nf
INCLUDE [$SysInclude]/lang/auto.rem
SYSINCLUDE lang/auto.rem
.fi
.PP
You are encouraged to study the language packs to see how to translate

View File

@@ -1708,6 +1708,7 @@ static void GenerateCalEntries(int col)
case T_EndIf: r=DoEndif(&p); break;
case T_Include:
case T_IncludeSys:
case T_IncludeR: r=DoInclude(&p, tok.type); break;
case T_IncludeCmd: r=DoIncludeCmd(&p); break;

View File

@@ -612,12 +612,21 @@ int DoInclude(ParsePtr p, enum TokTypes tok)
e = VerifyEoln(p);
if (e) Eprint("%s", GetErr(e));
if (tok == T_IncludeR && *(DBufValue(&buf)) != '/') {
if ((tok == T_IncludeR || tok == T_IncludeSys) &&
*(DBufValue(&buf)) != '/') {
/* Relative include: Include relative to dir
containing current file */
if (DBufPuts(&path, FileName) != OK) {
r = E_NO_MEM;
goto bailout;
if (tok == T_IncludeR) {
if (DBufPuts(&path, FileName) != OK) {
r = E_NO_MEM;
goto bailout;
}
} else {
if (DBufPuts(&path, SysDir) != OK ||
DBufPutc(&path, '/') != OK) {
r = E_NO_MEM;
goto bailout;
}
}
if (DBufLen(&path) == 0) {
s = DBufValue(&buf);

View File

@@ -314,6 +314,7 @@ static void DoReminders(void)
case T_EndIf: r=DoEndif(&p); break;
case T_Include:
case T_IncludeR:
case T_IncludeSys:
/* In purge mode, include closes file, so we
need to echo it here! */
if (PurgeMode) {

View File

@@ -107,6 +107,7 @@ Token TokArray[] = {
{ "skip", 4, T_Skip, SKIP_SKIP },
{ "special", 7, T_RemType, PASSTHRU_TYPE },
{ "sunday", 3, T_WkDay, 6 },
{ "sysinclude", 10, T_IncludeSys, 0 },
{ "tag", 3, T_Tag, 0 },
{ "third", 5, T_Ordinal, 2 },
{ "through", 7, T_Through, 0 },

View File

@@ -215,7 +215,7 @@ enum TokTypes
T_Date, T_DateTime, T_Day, T_Debug, T_Delta, T_Dumpvars, T_Duration,
T_Else, T_Empty, T_EndIf, T_ErrMsg, T_Exit, T_Expr,
T_Flush, T_Frename, T_Fset, T_Funset, T_If, T_IfTrig, T_In,
T_Include, T_IncludeCmd, T_IncludeR, T_LastBack, T_LongTime,
T_Include, T_IncludeCmd, T_IncludeR, T_IncludeSys, T_LastBack, T_LongTime,
T_MaybeUncomputable, T_Month, T_NoQueue, T_Number, T_Omit, T_OmitFunc,
T_Once, T_Ordinal, T_Pop, T_Preserve, T_Priority, T_Push,T_Rem,
T_RemType, T_Rep, T_Scanfrom, T_Sched, T_Set, T_Skip, T_Tag, T_Through,

View File

@@ -23942,6 +23942,7 @@ second
set
skip
special
sysinclude
tag
third
through