Compare commits

...

3 Commits

Author SHA1 Message Date
Dianne Skoll
4e7cfc20ce Make use of SYSINCLUDE.
All checks were successful
Remind unit tests / tests (push) Successful in 32s
2024-12-13 08:28:14 -05:00
Dianne Skoll
0c9a35a584 Add SYSINCLUDE to release notes. 2024-12-13 08:22:43 -05:00
Dianne Skoll
5e333f6162 Add the SYSINCLUDE directive. 2024-12-13 08:18:22 -05:00
11 changed files with 40 additions and 13 deletions

View File

@@ -117,7 +117,8 @@
"NOQUEUE" "OMIT" "OMITFUNC" "ONCE" "POP" "POP-OMIT-CONTEXT" "PRESERVE" "NOQUEUE" "OMIT" "OMITFUNC" "ONCE" "POP" "POP-OMIT-CONTEXT" "PRESERVE"
"PRIORITY" "PS" "PSFILE" "PUSH" "PUSH-OMIT-CONTEXT" "REM" "RUN" "PRIORITY" "PS" "PSFILE" "PUSH" "PUSH-OMIT-CONTEXT" "REM" "RUN"
"SATISFY" "SCAN" "SCANFROM" "SCHED" "SECOND" "SET" "SKIP" "SPECIAL" "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))))) #'(lambda (a b) (> (length a) (length b)))))

View File

@@ -19,6 +19,14 @@ CHANGES TO REMIND
- MINOR FEATURE: Add standard include/sun.rem file for sunrise/sunset. - MINOR FEATURE: Add standard include/sun.rem file for sunrise/sunset.
- MINOR FEATURE: The SYSINCLUDE command has been added. The command:
SYSINCLUDE foo/bar.rem
is equivalent to:
INCLUDE [$SysInclude]/foo/bar.rem
- IMPROVEMENT: remind: Refuse to open subdirectories named "*.rem" - IMPROVEMENT: remind: Refuse to open subdirectories named "*.rem"
under a top-level directory rather than trying and failing with a under a top-level directory rather than trying and failing with a
confusing error. confusing error.

View File

@@ -54,8 +54,8 @@ advance warning of holidays:
FSET msgsuffix(x) char(8) + dosubst(" is %b.%", $T) FSET msgsuffix(x) char(8) + dosubst(" is %b.%", $T)
# Include your holiday files here... # Include your holiday files here...
INCLUDE [$SysInclude]/holidays/us.rem SYSINCLUDE holidays/us.rem
INCLUDE [$SysInclude]/holidays/us/ny.rem SYSINCLUDE holidays/us/ny.rem
# Restore old version of msgsuffix and $DefaultDelta # Restore old version of msgsuffix and $DefaultDelta
FRENAME saved_msgsuffix msgsuffix FRENAME saved_msgsuffix msgsuffix

View File

@@ -16,10 +16,10 @@ if !defined("__autolang__")
IF autolang != "" IF autolang != ""
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 5)) + ".rem", "r") == 0 IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 5)) + ".rem", "r") == 0
INCLUDE [$SysInclude]/lang/[lower(substr(autolang, 1, 5))].rem SYSINCLUDE lang/[lower(substr(autolang, 1, 5))].rem
ELSE ELSE
IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 2)) + ".rem", "r") == 0 IF access($SysInclude + "/lang/" + lower(substr(autolang, 1, 2)) + ".rem", "r") == 0
INCLUDE [$SysInclude]/lang/[lower(substr(autolang, 1, 2))].rem SYSINCLUDE lang/[lower(substr(autolang, 1, 2))].rem
ENDIF ENDIF
ENDIF ENDIF
ENDIF ENDIF

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 Finally, the \fBAFTER\fR keyword will keep moving the reminder forward
until it has passed any holidays specified with global \fBOMIT\fR until it has passed any holidays specified with global \fBOMIT\fR
commands. commands.
.SH THE DO AND INCLUDE COMMANDS .SH THE DO, INCLUDE AND SYSINCLUDE COMMANDS
.PP .PP
\fBRemind\fR allows you to include other files in your reminder script, \fBRemind\fR allows you to include other files in your reminder script,
similar to the C preprocessor #include directive. For example, your 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 resolve the real path of symbolic links, so you should avoid using
symbolic links to files. symbolic links to files.
.PP .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 .SH THE RUN COMMAND
.PP .PP
If you include other files in your reminder script, you may not always 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: the top of your reminders file:
.PP .PP
.nf .nf
INCLUDE [$SysInclude]/lang/de.rem SYSINCLUDE lang/de.rem
.fi .fi
.PP .PP
If you want \fBRemind\fR to try to find the language pack appropriate If you want \fBRemind\fR to try to find the language pack appropriate
for your locale settings, use: for your locale settings, use:
.PP .PP
.nf .nf
INCLUDE [$SysInclude]/lang/auto.rem SYSINCLUDE lang/auto.rem
.fi .fi
.PP .PP
You are encouraged to study the language packs to see how to translate 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_EndIf: r=DoEndif(&p); break;
case T_Include: case T_Include:
case T_IncludeSys:
case T_IncludeR: r=DoInclude(&p, tok.type); break; case T_IncludeR: r=DoInclude(&p, tok.type); break;
case T_IncludeCmd: r=DoIncludeCmd(&p); break; case T_IncludeCmd: r=DoIncludeCmd(&p); break;

View File

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

View File

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

View File

@@ -107,6 +107,7 @@ Token TokArray[] = {
{ "skip", 4, T_Skip, SKIP_SKIP }, { "skip", 4, T_Skip, SKIP_SKIP },
{ "special", 7, T_RemType, PASSTHRU_TYPE }, { "special", 7, T_RemType, PASSTHRU_TYPE },
{ "sunday", 3, T_WkDay, 6 }, { "sunday", 3, T_WkDay, 6 },
{ "sysinclude", 10, T_IncludeSys, 0 },
{ "tag", 3, T_Tag, 0 }, { "tag", 3, T_Tag, 0 },
{ "third", 5, T_Ordinal, 2 }, { "third", 5, T_Ordinal, 2 },
{ "through", 7, T_Through, 0 }, { "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_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_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_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_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_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, T_RemType, T_Rep, T_Scanfrom, T_Sched, T_Set, T_Skip, T_Tag, T_Through,

View File

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