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"
"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

@@ -19,6 +19,14 @@ CHANGES TO REMIND
- 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"
under a top-level directory rather than trying and failing with a
confusing error.

View File

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

View File

@@ -16,10 +16,10 @@ if !defined("__autolang__")
IF autolang != ""
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
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

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