Compare commits

...

20 Commits

Author SHA1 Message Date
Dianne Skoll
291f648d2e Update WHATSNEW 2025-11-02 09:00:07 -05:00
Dianne Skoll
351088fd4b Proper key names. 2025-11-02 08:49:11 -05:00
Dianne Skoll
ed57f62911 Add navigation to the Agenda Mode window. 2025-11-02 08:48:16 -05:00
Dianne Skoll
53dcce6a91 Use a macro instead of repeating myself. 2025-11-01 21:15:24 -04:00
Dianne Skoll
d12d327e35 Include ')' in non-illegal char set. 2025-11-01 21:09:19 -04:00
Dianne Skoll
a2f760fb91 Better diagnostics for errors like: SET a 3 * * 4 2025-11-01 21:07:39 -04:00
Dianne Skoll
4a9b4ff6e4 Show errors in weekly view too; use fixd-width font for error window. 2025-11-01 20:10:22 -04:00
Dianne Skoll
ce6061a29b Add test for bug fixed in commit 878a5d9bed 2025-11-01 20:00:14 -04:00
Dianne Skoll
878a5d9bed Avoid spurious parse error if there's trailing space after the end of an expression. 2025-11-01 19:58:46 -04:00
Dianne Skoll
d1b55bae8d Add keyboard shortcuts to change view. 2025-11-01 18:46:51 -04:00
Dianne Skoll
c13817015f Allow editing and the subsequent running of (possibly edited) print command. 2025-11-01 15:46:46 -04:00
Dianne Skoll
bf74ad1eb7 Reword error message. 2025-11-01 13:07:38 -04:00
Dianne Skoll
f2eb06c752 Refresh view on date rollover. 2025-11-01 00:01:34 -04:00
Dianne Skoll
8172acf102 Tidy up print dialog to get rid of rem2ps artifacts. 2025-10-31 17:00:29 -04:00
Dianne Skoll
949e00219d Update man page to remove references to rem2ps 2025-10-31 16:54:36 -04:00
Dianne Skoll
1fd19b89e2 Remove support for rem2ps - we use rem2pdf to print. 2025-10-31 16:51:59 -04:00
Dianne Skoll
22d6c0583a Make PANGO @x,y positioning consistent between monthly and weekly calendars. 2025-10-31 16:40:07 -04:00
Dianne Skoll
12fac555b6 When printing, print the same view as what we're viewing. 2025-10-31 16:10:53 -04:00
Dianne Skoll
085b781114 Prevent segfault. 2025-10-31 12:51:05 -04:00
Dianne Skoll
c9d7fbf479 Trim reminders so we don't inadvertantly think they've been changed. 2025-10-31 12:45:42 -04:00
10 changed files with 330 additions and 196 deletions

View File

@@ -6,16 +6,34 @@ CHANGES TO REMIND
calendar view from the following choices: Entire month, 1 week, 2
weeks or 4 weeks.
- CHANGE: TkRemind: If you hand-edit a reminder in the "Preview Reminder"
dialog box, it is marked as non-editable by TkRemind.
- IMPROVEMENT: TkRemind: The Print dialog now allows you to preview
(and if you wish, adjust) the command used to print a calendar.
- IMPROVEMENT: TkRemind: The Agenda Mode window ("Show Today's
Reminders") has navigation buttons for moving back or forward one
day at a time.
- CHANGE: TkRemind: If you hand-edit a reminder in the "Preview
Reminder" dialog box, it is marked as non-editable by TkRemind.
- CHANGE: TkRemind: Remove support for rem2ps. All printing is now
done using rem2pdf.
- IMPROVEMENT: remind: Improve error reporting if there's extraneous
content after an expression.
- BUG FIX: TkRemind: Bind the Home/End/PgUp/PgDn keys on the numeric
keyboard for navigation.
- FIX: Don't enable -ffat-lto-objects on FreeBSD.
- IMPROVEMENT: remind: Improve error reporting if there's extraneous content
after an expression.
- BUG FIX: remind: Don't segfault if we can't open a .purged output
file in purge mode.
- BUG FIX: rem2pdf: Make PANGO @x,y positioning consistent between
weekly and monthly calendars. NOTE: If you use absolute PANGO
positioning, you might need to adjust your script because positions
are now relative to the centers of the grid lines.
* VERSION 06.01.08 - 2025-10-27

View File

@@ -61,7 +61,7 @@ box appears completely full.
.SH NAVIGATING
To change to the previous or next month, click the \fB<\-\fR
or \fB\->\fR button, respectively. You can also use the left/right arrow
keys or PageUp/PageDown to navigate.
keys or PgUp/PgDn to navigate.
To change back to the current month, click \fBToday\fR or press the
Home key. To go to a specific month, click \fBGo To Date...\fR. This
@@ -82,6 +82,10 @@ In the monthly view, the Next and Previous navigation buttons and keyboard
shortcuts move by one month. In all other views, they move by one week.
This is true even for views that display multiple weeks.
You can press the keys \fB1\fR, \fB2\fR, \fB4\fR or \fBm\fR over the
main calendar window to change the view to one week, two weeks, four weeks
or one month, respectively.
.SH ADDING REMINDERS
To add a reminder, click button 1 in any day number in the calendar.
The \fBAdd Reminder...\fR dialog will pop up, with values preselected for
@@ -146,19 +150,25 @@ You will have to hand-edit it to change it.
.SH SEEING A SINGLE DAY'S REMINDERS
Right-click on any day number in the calendar to pop up a window with
that day's reminders in Agenda Mode. You can left- or right-click the
current date and time indicator at the bottom of the window to see today's
reminders in Agenda Mode.
current date and time indicator at the bottom of the calendar window
to see today's reminders in Agenda Mode.
In the Agenda Mode display, hovering over a reminder will show ancillary
information such as a Location, URL or Description. Clicking on a reminder
will open an editor on the REM command that created the reminder.
will open an editor on the REM command that created the reminder. You can
also navigate in the Agenda Mode window one day at a time using the
forward and back arrow buttons or left/right arrow keys or PgUp/PgDn.
You can get back to today by clicking \fBToday\fR or pressing the
Home key.
.SH PRINTING
To print the current month's calendar, click \fBPrint...\fR on the
main calendar window. This brings up the print dialog. Printing
either produces a PostScript file or sends PostScript to a UNIX command.
(If you have \fBrem2pdf\fR installed, you can choose to produce
PDF output rather than PostScript.)
either produces a PostScript or PDF file, or sends PostScript or PDF
to a UNIX command.
Note that you must have \fBrem2pdf\fR installed in order to be
able to print.
Select the print destination by choosing either \fBTo file:\fR or
\fBTo command:\fR in the print dialog. Press \fBBrowse...\fR to bring
@@ -175,7 +185,7 @@ the directory.
Select the appropriate paper size and orientation. Activate
\fBFill page\fR if you want the calendar to fill the page. This should
be the normal case unless you have many reminders in a particular
day. (See the \fBRem2PS\fR or \fBrem2pdf\fR documentation.)
day. (See the \fBrem2pdf\fR documentation.)
Finally, click \fBPrint\fR to print or \fBCancel\fR to cancel. Note
that during printing, \fBRemind\fR is called with the
@@ -186,9 +196,9 @@ is also supplied to \fBRemind\fR.
If you click on \fBShow Command\fR rather than \fBPrint\fR, then
\fBTkRemind\fR won't actually print anything. Instead, it will pop
up a text window with the command that it \fIwould have used\fR to print
the calendar. You can cut-and-paste the command into a shell prompt and
adjust as needed if you want to use any \fBrem2pdf\fR or \fBrem2ps\fR
options that are not directly supported by \fBTkRemind\fR.
the calendar. You can adjust the command as needed and then click \fBRun\fR
to run the modified command. This lets you specify \fBrem2pdf\fR options
that are not directly supported by \fBTkRemind\fR.
.SH EDITING REMINDERS
@@ -572,5 +582,5 @@ $HOME/.config/tkremindrc -- \fBTkRemind\fR saved options.
.SH HOME PAGE
https://dianne.skoll.ca/projects/remind/
.SH SEE ALSO
\fBremind\fR, \fBrem2ps\fR, \fBrem2pdf\fR, \fBrem2html\fR
\fBremind\fR, \fBrem2pdf\fR, \fBrem2html\fR

View File

@@ -683,7 +683,10 @@ of the right side of the calendar box.
A positive I<y> value positions the top edge of the text I<y> points
below the top of the calendar box, while a negative I<y> value
positions the bottom edge of the text I<y> points above the bottom of
the calendar box.
the calendar box. Note that the coordinates are relative to the center
of the lines that delineate the boxes; you should use an I<x> value
whose absolute value is at least 2 and a I<y> value whose absolute
value is at least 4 to avoid colliding with the lines.
If you use absolutely-positioned text, it's up to you to make sure it
doesn't overlap other text; B<rem2pdf> takes no special precautions to
@@ -692,7 +695,7 @@ prevent this.
As an example, this places Sunrise and Sunset times at the bottom left
of each calendar box:
REM SPECIAL PANGO @1,-1 <span size="4800"><i>Rise [sunrise($U)] Set [sunset($U)]</i></span>
REM SPECIAL PANGO @2,-4 <span size="4800"><i>Rise [sunrise($U)] Set [sunset($U)]</i></span>
(Note that Pango expresses font sizes in 1024's of a point, so a size of
4800 works out to about 4.6 points.)

View File

@@ -628,7 +628,7 @@ sub col_box_coordinates
$settings->{margin_left} + $cell * $col,
$so_far,
$settings->{margin_left} + $cell * ($col + 1),
$so_far + $height + $settings->{border_size},
$so_far + $height + 2* $settings->{border_size},
);
}
@@ -663,7 +663,7 @@ sub draw_day
$cr->set_source_rgb($shade->{r} / 255,
$shade->{g} / 255,
$shade->{b} / 255);
$cr->rectangle($x1, $y1, $x2 - $x1, $y2 - $y1 + $settings->{border_size});
$cr->rectangle($x1, $y1, $x2 - $x1, $y2 - $y1);
$cr->fill();
$cr->restore;
}

View File

@@ -252,9 +252,6 @@ set DateToWinOffset [dict create]
# Remind program to execute -- supply full path if you want
set Remind "remind"
# Rem2PS program to execute -- supply full path if you want
set Rem2PS "rem2ps"
# Rem2PDF program to execute -- supply full path if you want
set Rem2PDF "rem2pdf"
@@ -351,17 +348,14 @@ set Option(WrapCal) 0
set OptDescr(PrintDaysRight) "(0/1) If 1, put day numbers in the top-right of each calendar box"
set Option(PrintDaysRight) 1
set OptDescr(PrintEncoding) "(0/1) If 1, apply ISO-8859-1 encoding to PostScript output"
set Option(PrintEncoding) 0
set OptDescr(PrintMargins) "Print margins: One of 24pt, 36pt or 48pt"
set Option(PrintMargins) 36pt
set OptDescr(PrintSmallCalendars) "(0/1) If 1, print small calendars in PostScript output"
set Option(PrintSmallCalendars) 1
set OptDescr(PrintFormat) "Print format: pdf, ps or ps1 - ps1 means PostScript using rem2pdf"
set Option(PrintFormat) ps
set OptDescr(PrintFormat) "Print format: pdf or ps"
set Option(PrintFormat) pdf
set WarningHeaders [list "# Lines starting with REM TAG TKTAGnnn ... were created by tkremind" "# Do not edit them by hand or results may be unpredictable."]
@@ -440,9 +434,12 @@ proc Initialize {} {
set TodayMonth [expr [string trim [clock format $now -format %N]] - 1]
set TodayYear [clock format $now -format %Y]
set TodayDay [string trim [clock format $now -format %e]]
set CurMonth $TodayMonth
set CurYear $TodayYear
set CurDay $TodayDay
set CommandLine "$Remind -itkremind=1 -ppp%WEEKS% -y -l %EXTRA%"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l %EXTRA%"
set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp%WEEKS% -l %EXTRA%"
set i 0
while {$i < $argc} {
if {[regexp -- {-[bgxim].*} [lindex $argv $i]]} {
@@ -874,11 +871,19 @@ proc CreateCalWindow { dayNames } {
wm protocol . WM_DELETE_WINDOW Quit
wm deiconify .
bind . <Control-KeyPress-q> Quit
bind . <Control-KeyPress-p> ".b.print flash; .b.print invoke"
bind . <KeyPress-F1> ".b.help flash; .b.help invoke"
bind . <KeyPress-h> ".b.help flash; .b.help invoke"
bind . <KeyPress-question> ".b.help flash; .b.help invoke"
bind . <KeyPress-Left> ".b.prev flash; .b.prev invoke"
bind . <KeyPress-Right> ".b.next flash; .b.next invoke"
bind . <KeyPress-Prior> ".b.prev flash; .b.prev invoke"
bind . <KeyPress-Next> ".b.next flash; .b.next invoke"
bind . <KeyPress-Home> ".b.this flash; .b.this invoke"
bind . <KeyPress-1> "SetView Week-1"
bind . <KeyPress-2> "SetView Week-2"
bind . <KeyPress-4> "SetView Week-4"
bind . <KeyPress-m> "SetView Month"
catch { bind . <KeyPress-KP_Home> ".b.this flash; .b.this invoke" }
catch { bind . <KeyPress-KP_Prior> ".b.prev flash; .b.prev invoke" }
catch { bind . <KeyPress-KP_Next> ".b.next flash; .b.next invoke" }
@@ -1172,6 +1177,22 @@ proc WriteOptionsToFile {} {
return
}
# Make sure View option is sane
if { "$Option(View)" != "Month" &&
"$Option(View)" != "Week-1" &&
"$Option(View)" != "Week-2" &&
"$Option(View)" != "Week-4" } {
set Option(View) "Month"
}
# We no longer support rem2ps
if { "$Option(PrintFormat)" == "ps1" } {
set Option(PrintFormat) ps
}
# Delete obsolete option
catch { unset Option(PrintEncoding) }
puts $f "# TkRemind option file -- created automatically"
puts $f "# [clock format [clock seconds]]"
puts $f "# Format of each line is 'key value' where 'key'"
@@ -1212,7 +1233,9 @@ proc LoadOptions {} {
}
foreach {key val} $line {}
if {![info exists Option($key)]} {
puts stderr "Unknown option in $ConfigFile: $key"
if { "$key" != "PrintEncoding" } {
puts stderr "Unknown option in $ConfigFile: $key"
}
continue
}
set Option($key) $val
@@ -1232,6 +1255,14 @@ proc LoadOptions {} {
"$Option(View)" != "Week-4" } {
set Option(View) "Month"
}
# We no longer support rem2ps
if { "$Option(PrintFormat)" == "ps1" } {
set Option(PrintFormat) ps
}
# Delete obsolete option
catch { unset Option(PrintEncoding) }
}
@@ -1303,7 +1334,7 @@ proc get_num_weeks {} {
#---------------------------------------------------------------------------
proc FillCalWindowWeekly { nweeks } {
global DayNames CurYear CurMonth CurDay MonthNames CommandLine Option TagToObj SynToObj RemindErrors MondayFirst Hostname
global TodayYear TodayMonth TodayDay Option
global TodayYear TodayMonth TodayDay Option RemindErrors
array unset TagToObj
array unset SynToObj
@@ -1384,6 +1415,10 @@ proc FillCalWindowWeekly { nweeks } {
} else {
wm title . "$title - TkRemind @VERSION@"
}
if {$problem} {
set RemindErrors [unique_lines $errmsg]
set_button_to_errors
}
DisplayTime
}
@@ -1611,7 +1646,8 @@ proc MoveMonth {delta} {
} else {
set dt [format "%04d-%02d-%02d" $CurYear [expr $CurMonth+1] $CurDay]
set dt [clock scan $dt -format "%Y-%m-%d"]
set dt [expr $dt + 7 * 24 * 60 * 60 * $delta]
# Move to noon to avoid Daylight Saving Time issues!
set dt [expr $dt + 7 * 24 * 60 * 60 * $delta + 43200]
set CurYear [clock format $dt -format %Y]
set CurMonth [expr [string trim [clock format $dt -format %N]] - 1]
set CurDay [string trim [clock format $dt -format %e] ]
@@ -1662,10 +1698,16 @@ proc DoPrint {} {
}
proc DoPrintHelper {} {
global Rem2PS Rem2PDF HaveRem2PDF PSCmd Option PrintStatus RemindErrors
global CudRday CurMonth CurYear MonthNames
global Rem2PDF HaveRem2PDF PSCmd Option PrintStatus RemindErrors
global CurDay CurMonth CurYear MonthNames
catch {destroy .p}
if {! $HaveRem2PDF} {
tk_messageBox -message "rem2pdf was not found, but is required to print calendars" -icon error -type ok
return
}
toplevel .p
bind .p <ButtonPress-1> [list raise .p]
@@ -1687,13 +1729,10 @@ proc DoPrintHelper {} {
entry .p.command
.p.command insert end "lpr"
if { $HaveRem2PDF } {
frame .p.ff -relief sunken -bd 2
label .p.format -text "Output Format:"
radiobutton .p.pdf -text "PDF" -variable Option(PrintFormat) -value pdf
radiobutton .p.ps -text "PostScript (using rem2ps)" -variable Option(PrintFormat) -value ps
radiobutton .p.ps1 -text "PostScript (using rem2pdf)" -variable Option(PrintFormat) -value ps1
}
frame .p.ff -relief sunken -bd 2
label .p.format -text "Output Format:"
radiobutton .p.pdf -text "PDF" -variable Option(PrintFormat) -value pdf
radiobutton .p.ps -text "PostScript" -variable Option(PrintFormat) -value ps
label .p.size -text "Paper Size:"
radiobutton .p.letter -text "Letter" -variable Option(PrintSize) -value letter
@@ -1709,9 +1748,8 @@ proc DoPrintHelper {} {
radiobutton .p.portrait -text "Portrait" -variable Option(PrintOrient) -value portrait
checkbutton .p.fill -text "Fill page" -variable Option(PrintFill)
checkbutton .p.wrap -text "Use at most 5 rows (rem2pdf only)" -variable Option(WrapCal)
checkbutton .p.wrap -text "Use at most 5 rows" -variable Option(WrapCal)
checkbutton .p.right -text "Day numbers at top-right" -variable Option(PrintDaysRight)
checkbutton .p.encoding -text "ISO 8859-1 PostScript encoding" -variable Option(PrintEncoding)
checkbutton .p.calendars -text "Print small calendars" -variable Option(PrintSmallCalendars)
button .p.print -text "Print" -command {set PrintStatus print}
@@ -1719,24 +1757,15 @@ proc DoPrintHelper {} {
button .p.cancel -text "Cancel" -command {set PrintStatus cancel}
wm protocol .p WM_DELETE_WINDOW { .p.cancel flash; .p.cancel invoke }
if {$HaveRem2PDF} {
pack .p.f1 .p.ff .p.f2 .p.f2a .p.f3 .p.f3a \
-side top -fill both -expand 1 -anchor w
pack .p.fill .p.wrap .p.right .p.encoding .p.calendars -in .p.f3a \
-side top -anchor w -fill none -expand 0
} else {
pack .p.f1 .p.f2 .p.f2a .p.f3 .p.f3a \
-side top -fill both -expand 1 -anchor w
pack .p.fill .p.right .p.encoding .p.calendars -in .p.f3a \
-side top -anchor w -fill none -expand 0
}
pack .p.f1 .p.ff .p.f2 .p.f2a .p.f3 .p.f3a \
-side top -fill both -expand 1 -anchor w
pack .p.fill .p.wrap .p.right .p.calendars -in .p.f3a \
-side top -anchor w -fill none -expand 0
pack .p.f4 -side top -fill both -expand 1 -anchor w
pack .p.f11 .p.f12 -in .p.f1 -side top -fill none -expand 0 -anchor w
pack .p.tofile .p.filename .p.browse -in .p.f11 -side left -fill none -expand 0 -anchor w
pack .p.tocmd .p.command -in .p.f12 -side left -fill none -expand 0 -anchor w
if { $HaveRem2PDF } {
pack .p.format .p.pdf .p.ps .p.ps1 -in .p.ff -side top -fill none -expand 0 -anchor w
}
pack .p.format .p.pdf .p.ps -in .p.ff -side top -fill none -expand 0 -anchor w
pack .p.size .p.letter .p.a4 -in .p.f2 -side top -fill none -expand 0 -anchor w
pack .p.margin .p.24pt .p.36pt .p.48pt -in .p.f2a -side top -anchor w -fill none -expand 0
pack .p.orient .p.landscape .p.portrait -in .p.f3 -side top -fill none -expand 0 -anchor w
@@ -1780,56 +1809,35 @@ proc DoPrintHelper {} {
set fname "| $cmd"
}
if {$HaveRem2PDF && $Option(PrintFormat) == "pdf"} {
set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF"
} elseif {$HaveRem2PDF && $Option(PrintFormat) == "ps1"} {
set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --ps"
set p $PSCmd
if {"$Option(View)" == "Month"} {
set p [regsub %WEEKS% $PSCmd ""]
} else {
set p [regsub %EXTRA% $PSCmd $Option(ExtraRemindArgs)]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS"
set Option(PrintFormat) ps
set p [regsub %WEEKS% $PSCmd "+[get_num_weeks]"]
}
if {$Option(PrintSize) == "letter"} {
if {$Option(PrintFormat) == "ps"} {
append cmd " -m Letter"
} else {
append cmd " --media=Letter"
}
if {$Option(PrintFormat) == "pdf"} {
set p [regsub %EXTRA% $p "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --weeks-per-page=[get_num_weeks]"
} else {
if {$Option(PrintFormat) == "ps"} {
append cmd " -m A4"
} else {
append cmd " --media=A4"
}
set p [regsub %EXTRA% $p "-itkpdf=1 $Option(ExtraRemindArgs)"]
set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --ps --weeks-per-page=[get_num_weeks]"
}
if {$Option(PrintSize) == "letter"} {
append cmd " --media=Letter"
} else {
append cmd " --media=A4"
}
if {$Option(PrintMargins) == "24pt"} {
if {$Option(PrintFormat) == "ps"} {
append cmd " -or 24 -ol 24 -ot 24 -ob 24"
} else {
append cmd " --margin-right=24 --margin-left=24 --margin-top=24 --margin-bottom=24"
}
append cmd " --margin-right=24 --margin-left=24 --margin-top=24 --margin-bottom=24"
} elseif {$Option(PrintMargins) == "36pt"} {
if {$Option(PrintFormat) == "ps"} {
append cmd " -or 36 -ol 36 -ot 36 -ob 36"
} else {
append cmd " --margin-right=36 --margin-left=36 --margin-top=36 --margin-bottom=36"
}
append cmd " --margin-right=36 --margin-left=36 --margin-top=36 --margin-bottom=36"
} else {
if {$Option(PrintFormat) == "ps"} {
append cmd " -or 48 -ol 48 -ot 48 -ob 48"
} else {
append cmd " --margin-right=48 --margin-left=48 --margin-top=48 --margin-bottom=48"
}
append cmd " --margin-right=48 --margin-left=48 --margin-top=48 --margin-bottom=48"
}
if {$Option(WrapCal)} {
if {$Option(PrintFormat) == "pdf" || $Option(PrintFormat) == "ps1"} {
append cmd " --wrap"
}
append cmd " --wrap"
}
if {$Option(PrintOrient) == "landscape"} {
append cmd " -l"
@@ -1842,12 +1850,6 @@ proc DoPrintHelper {} {
if {!$Option(PrintDaysRight)} {
append cmd " -x"
}
if {$Option(PrintEncoding)} {
if {$Option(PrintFormat) == "ps"} {
append cmd " -i"
}
}
if {$Option(PrintSmallCalendars)} {
append cmd " -c3"
} else {
@@ -1856,25 +1858,7 @@ proc DoPrintHelper {} {
append cmd " $fname"
if {$PrintStatus == "showcmd"} {
puts "SHOWING COMMAND"
catch { destroy .pc }
toplevel .pc -background $Option(WinBackground)
text .pc.t -width 80 -height 10 -font TkFixedFont -foreground $Option(TextColor) -background $Option(BackgroundColor) -yscrollcommand ".pc.sb set" -wrap word
scrollbar .pc.sb -orient vertical -command ".pc.t yview"
button .pc.ok -text "OK" -command "destroy .pc" -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
grid .pc.t -row 0 -column 0 -sticky nsew
grid .pc.sb -row 0 -column 1 -sticky ns
grid .pc.ok -row 1 -column 0 -sticky w
grid columnconfigure .pc 0 -weight 1
grid columnconfigure .pc 1 -weight 0
grid rowconfigure .pc 0 -weight 1
grid rowconfigure .pc 1 -weight 0
CenterWindow .pc .
.pc.t insert end "Command for printing calendar follows; cut-and-paste and adjust as needed:\n\n"
.pc.t insert end $cmd
.pc.t configure -state disabled
wm deiconify .pc
puts "DONE SHOWING COMMAND"
ShowPrintCommand $cmd
} else {
Status "Printing..."
if {[catch {exec /bin/sh "-c" $cmd} err]} {
@@ -1885,6 +1869,45 @@ proc DoPrintHelper {} {
}
}
proc ShowPrintCommand { cmd } {
global Option
catch { destroy .pc }
toplevel .pc -background $Option(WinBackground)
frame .pc.f -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0 -background $Option(BackgroundColor)
frame .pc.tf -padx 0 -pady 0 -highlightthickness 0 -relief flat -bd 0 -background $Option(BackgroundColor)
message .pc.m -width 600 -foreground $Option(TextColor) -background $Option(BackgroundColor) -text "Below is the command that would be used to print a calendar. Edit it as desired and click Run to run the command, or click Cancel to close this window."
text .pc.t -width 80 -height 5 -font TkFixedFont -foreground $Option(TextColor) -background $Option(BackgroundColor) -yscrollcommand ".pc.sb set" -wrap word -insertbackground $Option(TextColor)
.pc.t insert end $cmd
scrollbar .pc.sb -orient vertical -command ".pc.t yview"
button .pc.run -text "Run" -command "RunPrintCommand" -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
button .pc.cancel -text "Cancel" -command "destroy .pc" -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
pack .pc.m -side top -fill x -expand 0
pack .pc.tf -side top -fill both -expand 1
pack .pc.f -side top -fill x -expand 0
pack .pc.t -in .pc.tf -side left -expand 1 -fill both
pack .pc.sb -in .pc.tf -side left -expand 0 -fill y
pack .pc.run .pc.cancel -in .pc.f -side left -expand 0 -fill none
.pc.t configure -state normal
CenterWindow .pc .
wm deiconify .pc
}
proc RunPrintCommand {} {
global RemindErrors
set cmd [.pc.t get 1.0 end]
set cmd [string trim $cmd]
catch { destroy .pc }
set cmd [regsub -all "\n" $cmd " "]
if { "$cmd" != "" } {
Status "Printing..."
if {[catch {exec /bin/sh "-c" $cmd} err]} {
set RemindErrors [unique_lines $err]
set_button_to_errors
}
DisplayTime
}
}
#---------------------------------------------------------------------------
# PrintFileBrowse -- browse for a filename for Print dialog
# Arguments: none
@@ -2516,6 +2539,7 @@ proc ModifyDayHelper {i} {
show_error $err
raise .mod
} else {
set rem [string trim $rem]
if {$ModifyDialogResult == 3} {
set newrem [EditReminder $rem Cancel "Add reminder"]
if {$ModifyDialogResult == 1 || $ModifyDialogResult == -2} {
@@ -2926,6 +2950,7 @@ proc EditReminder {rem args} {
bind .edit <Destroy> ""
destroy .edit
}
set rem [string trim $rem]
return $rem
}
@@ -4186,12 +4211,9 @@ proc EditTaggedReminder { w i } {
return
}
set InModalDialog 1
set problem [catch { EditTaggedReminderHelper $w $i } err more]
catch { EditTaggedReminderHelper $w $i } result options
set InModalDialog 0
if {$problem} {
puts $err
puts $more
}
return -options $options $result
}
proc EditTaggedReminderHelper { w i } {
@@ -4242,6 +4264,7 @@ proc EditTaggedReminderHelper { w i } {
show_error "$err"
continue
}
set rem [string trim $rem]
set edited 0
if {$ModifyDialogResult == 4} {
set newrem [EditReminder $rem "Cancel" "Replace reminder"]
@@ -4653,6 +4676,61 @@ proc daily_rem_enter { lines } {
set Balloon(HelpId) [after $Balloon(HelpTime) [list details_popup $lines]]
}
proc MakeTodaysRemindersWindow { w date } {
global Option
if {[winfo exists $w]} {
foreach t [$w.text tag names] {
$w.text tag delete $t
}
if {"$date" == ""} {
set wtitle "Today's Reminders"
} else {
set wtitle "Reminders for $date"
}
raise $w
return
}
catch { destroy $w }
toplevel $w -background $Option(WinBackground)
if {"$date" == ""} {
set wtitle "Today's Reminders"
} else {
set wtitle "Reminders for $date"
}
wm iconname $w "Reminders"
frame $w.buttons -background $Option(LineColor)
text $w.text -width 80 -height 20 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalboxFont -spacing1 3
scrollbar $w.sb -orient vertical -command "$w.text yview"
button $w.ok -text "OK" -command "destroy $w" -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
button $w.next -text "\u2b9e" -command [list MoveTodaysReminders $w 1] -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
balloon_add_help $w.next "Move forward one day"
button $w.prev -text "\u2b9c" -command [list MoveTodaysReminders $w -1] -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
button $w.today -text "Today" -command { ShowTodaysReminders 1 [clock format [clock seconds] -format "%Y-%m-%d"] } -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
balloon_add_help $w.today "Move to today"
balloon_add_help $w.prev "Move backward one day"
balloon_add_help $w.ok "Dismiss this window"
grid $w.text -row 0 -column 0 -sticky nsew
grid $w.sb -row 0 -column 1 -sticky ns
pack $w.ok $w.prev $w.today $w.next -in $w.buttons -side left -expand 0 -fill none
grid $w.buttons -row 1 -column 0 -sticky w
grid rowconfigure $w 0 -weight 1
grid rowconfigure $w 1 -weight 0
grid columnconfigure $w 0 -weight 1
grid columnconfigure $w 1 -weight 0
bind $w <KeyPress-Left> "$w.prev flash; $w.prev invoke"
bind $w <KeyPress-Right> "$w.next flash; $w.next invoke"
bind $w <KeyPress-Prior> "$w.prev flash; $w.prev invoke"
bind $w <KeyPress-Next> "$w.next flash; $w.next invoke"
bind $w <KeyPress-Home> "$w.today flash; $w.today invoke"
catch { bind $w <KeyPress-KP_Prior> "$w.prev flash; $w.prev invoke" }
catch { bind $w <KeyPress-KP_Next> "$w.next flash; $w.next invoke" }
catch { bind $w <KeyPress-KP_Left> "$w.prev flash; $w.prev invoke" }
catch { bind $w <KeyPress-KP_Right> "$w.next flash; $w.next invoke" }
catch { bind $w <KeyPress-KP_Home> "$w.today flash; $w.today invoke" }
CenterWindow $w .
}
#***********************************************************************
# %PROCEDURE: ShowTodaysReminders
# %ARGUMENTS:
@@ -4673,26 +4751,9 @@ proc ShowTodaysReminders { force date } {
}
set w .today
catch { destroy $w }
toplevel $w -background $Option(WinBackground)
if {"$date" == ""} {
set wtitle "Today's Reminders"
} else {
set wtitle "Reminders for $date"
}
wm iconname $w "Reminders"
text $w.text -width 80 -height 20 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalboxFont -spacing1 3
scrollbar $w.sb -orient vertical -command "$w.text yview"
button $w.ok -text "OK" -command "destroy $w" -foreground $Option(LabelColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
grid $w.text -row 0 -column 0 -sticky nsew
grid $w.sb -row 0 -column 1 -sticky ns
grid $w.ok -row 1 -column 0 -sticky w
grid rowconfigure $w 0 -weight 1
grid rowconfigure $w 1 -weight 0
grid columnconfigure $w 0 -weight 1
grid columnconfigure $w 1 -weight 0
CenterWindow $w .
MakeTodaysRemindersWindow $w $date
$w.text configure -state normal
$w.text delete 1.0 end
# Grab the reminders
set stuff ""
@@ -4702,11 +4763,13 @@ proc ShowTodaysReminders { force date } {
}
append cmdline $Option(ExtraRemindArgs)
append cmdline " $ReminderFile"
if {"$date" != ""} {
append cmdline " $date"
} else {
if { "$date" == "" } {
set date [clock format [clock seconds] -format "%Y-%m-%d" -locale C]
}
append cmdline " $date"
set_win_prop $w date $date
append cmdline " 2>/dev/null"
set f [open $cmdline r]
while {[gets $f line] >= 0} {
@@ -4831,15 +4894,21 @@ proc ShowTodaysReminders { force date } {
$w.text insert end [dict get $thing body] $tags
$w.text insert end "\n"
}
#$w.text insert end "\n\n$stuff\n"
$w.text configure -state disabled
}
proc MoveTodaysReminders { w amt } {
set date [get_win_prop $w date]
set dt [clock scan $date -format "%Y-%m-%d"]
# We move to noon to avoid dayligh saving time issues!
incr dt [expr 86400 * $amt + 43200]
set date [clock format $dt -format "%Y-%m-%d"]
ShowTodaysReminders 1 $date
}
proc compare_reminders { a b } {
set a_date [dict get $a date]
set b_date [dict get $b date]
#puts "Comparing $a_date $b_date"
if {"$a_date" < "$b_date"} {
return -1
}
@@ -5135,9 +5204,9 @@ proc FindConfigFile {} {
# Migrate .tkremindrc to $confighome/tkremindrc
if {[file exists [home "/.tkremindrc"]]} {
if {![file exists "$confighome/tkreminderc"]} {
puts "Migrating ~/.tkremindrc to $confighome/tkremindrc"
catch { puts "Migrating ~/.tkremindrc to $confighome/tkremindrc" }
if {[catch { file copy [home "/.tkremindrc"] "$confighome/tkremindrc"}]} {
puts "FAILED!\n"
catch { puts "FAILED!\n" }
set ConfigFile [home "/.tkremindrc"]
return
}
@@ -5398,7 +5467,7 @@ proc ShowErrors {} {
set w ".errors"
catch { destroy $w }
toplevel $w -background $Option(WinBackground)
text $w.t -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font CalBoxFont
text $w.t -width 80 -height 30 -wrap word -yscrollcommand "$w.sb set" -foreground $Option(TextColor) -background $Option(BackgroundColor) -font [font actual TkFixedFont]
scrollbar $w.sb -orient vertical -command "$w.t yview"
button $w.ok -text OK -command DoneShowingErrors -foreground $Option(TextColor) -background $Option(BackgroundColor) -highlightthickness 1 -highlightcolor $Option(LineColor) -highlightbackground $Option(WinBackground)
grid $w.t -row 0 -column 0 -sticky nsew

View File

@@ -138,6 +138,8 @@
#define E_BAD_MB_SEQ 114
#define E_EXPR_NODES_EXCEEDED 115
#define E_EXPECTING_EOXPR 116
#define E_EXPECTING_ATOM 117
#ifdef MK_GLOBALS
#undef EXTERN
#define EXTERN
@@ -271,7 +273,8 @@ EXTERN char *ErrMsg[]
/* E_NO_MB */ "C library does not support multibyte characters",
/* E_BAD_MB_SEQ */ "Invalid multibyte sequence",
/* E_EXPR_NODES_EXCEEDED */ "Maximum expression complexity exceeded",
/* E_EXPECTING_EOXPR */ "Expecting end-of-expression",
/* E_EXPECTING_EOXPR */ "Expecting operator or end-of-expression",
/* E_EXPECTING_ATOM */ "Expecting constant, variable, function call or (expression)",
}
#endif /* MK_GLOBALS */
;

View File

@@ -170,6 +170,8 @@ static expr_node *expr_node_free_list = NULL;
/* Maximum parse level before we bail (to avoid SEGV from filling stack)*/
#define MAX_PARSE_LEVEL 2000
/* Legal punctuation characters in an expression */
#define LEGAL_CHARS "+-*/%&|=<>!)"
static int parse_level_high_water = 0;
#define CHECK_PARSE_LEVEL() do { if (level > parse_level_high_water) { parse_level_high_water = level; if (level > MAX_PARSE_LEVEL) { *r = E_OP_STK_OVER; return NULL; } } } while(0)
@@ -2228,9 +2230,15 @@ static int set_constant_value(expr_node *atom)
atom->u.value.v.val = val;
return OK;
}
atom->u.value.type = ERR_TYPE;
Eprint("`%s': %s", DBufValue(&ExprBuf), GetErr(E_ILLEGAL_CHAR));
return E_ILLEGAL_CHAR;
if (strchr(LEGAL_CHARS, *s) != NULL) {
r = E_EXPECTING_ATOM;
} else {
r = E_ILLEGAL_CHAR;
}
Eprint("`%s': %s", DBufValue(&ExprBuf), GetErr(r));
return r;
}
/***************************************************************/
@@ -2346,8 +2354,13 @@ static expr_node *parse_atom(char const **e, int *r, Var *locals, int level)
*s != '$' &&
*s != '"' &&
*s != '\'') {
Eprint("%s `%c'", GetErr(E_ILLEGAL_CHAR), *s);
*r = E_ILLEGAL_CHAR;
if (strchr(LEGAL_CHARS, *s) != NULL) {
*r = E_EXPECTING_ATOM;
Eprint("%s", GetErr(*r));
} else {
*r = E_ILLEGAL_CHAR;
Eprint("%s `%c'", GetErr(*r), *s);
}
return NULL;
}
@@ -2761,6 +2774,9 @@ expr_node *parse_expression(char const **e, int *r, Var *locals)
}
orig = o2;
}
while (**e && isempty(**e)) {
(*e)++;
}
if (**e && (**e != ']')) {
if (DebugFlag & DB_PARSE_EXPR) {
fprintf(ErrFp, " Unparsed: %s\n", *e);
@@ -2787,6 +2803,7 @@ expr_node *parse_expression(char const **e, int *r, Var *locals)
*r == E_BAD_NUMBER ||
*r == E_BAD_DATE ||
*r == E_BAD_TIME ||
*r == E_EXPECTING_ATOM ||
*r == E_ILLEGAL_CHAR) {
end_of_expr = find_end_of_expr(orig);
while (**e && isempty(**e)) {

View File

@@ -225,8 +225,9 @@ static void OpenPurgeFile(char const *fname, char const *mode)
if (!PurgeFP) {
fprintf(ErrFp, tr("Cannot open `%s' for writing: %s"), DBufValue(&fname_buf), strerror(errno));
fprintf(ErrFp, "\n");
} else {
set_cloexec(fileno(PurgeFP));
}
set_cloexec(fileno(PurgeFP));
DBufFree(&fname_buf);
}

View File

@@ -5042,7 +5042,7 @@ set a 7 * "Cabbage! "
set pqxya 1+2)
1+2)
^-- here
../tests/test.rem(1014): Expecting end-of-expression
../tests/test.rem(1014): Expecting operator or end-of-expression
# Should result in an error
REM Tue OMIT 2024-01-01 MSG Wookie
@@ -16427,9 +16427,14 @@ eval("1/0") => 1 / 0 => Division by zero
../tests/test.rem(1590): `/': Division by zero
Division by zero
set a eval("1 / / 2")
eval("1 / / 2") => ../tests/test.rem(1591): Illegal character `/'
eval("1 / / 2") => ../tests/test.rem(1591): Expecting constant, variable, function call or (expression)
1 / / 2
^-- here
Expecting constant, variable, function call or (expression)
set a eval("1 / # 2")
eval("1 / # 2") => ../tests/test.rem(1592): Illegal character `#'
1 / # 2
^-- here
Illegal character
set a catch(eval("1 +"), 33)
eval("1 +") => Unexpected end of line
@@ -16439,7 +16444,10 @@ eval("1/0") => 1 / 0 => Division by zero
Division by zero
catch(*Division by zero*, 34) => 34
set a catch(eval("1 / / 2"), 35)
eval("1 / / 2") => Illegal character
eval("1 / / 2") => Expecting constant, variable, function call or (expression)
catch(*Expecting constant, variable, function call or (expression)*, 35) => 35
set a catch(eval("1 / # 2"), 35)
eval("1 / # 2") => Illegal character
catch(*Illegal character*, 35) => 35
# Ensure RUN is disabled in eval
@@ -16447,7 +16455,7 @@ set a shell("echo foo")
shell("echo foo") => "foo"
set a eval("shell(\"echo foo\")")
eval("shell(\"echo foo\")") => shell("echo foo") => RUN disabled
../tests/test.rem(1598): shell(): RUN disabled
../tests/test.rem(1600): shell(): RUN disabled
RUN disabled
set a shell("echo foo")
shell("echo foo") => "foo"
@@ -16460,8 +16468,8 @@ Leaving UserFN i() => "foo"
set a eval("i()")
eval("i()") => Entering UserFN i()
shell("echo foo") => RUN disabled
../tests/test.rem(1603): shell(): RUN disabled
../tests/test.rem(1601): [#0] In function `i'
../tests/test.rem(1605): shell(): RUN disabled
../tests/test.rem(1603): [#0] In function `i'
Leaving UserFN i() => RUN disabled
RUN disabled
set a i()
@@ -16474,19 +16482,19 @@ set b eval(a)
a => "eval(\"1\")+ shell(\"ls\")"
eval("eval(\"1\")+ shell(\"ls\")") => eval("1") => 1
shell("ls") => RUN disabled
../tests/test.rem(1607): shell(): RUN disabled
../tests/test.rem(1609): shell(): RUN disabled
RUN disabled
# "value" should use lazy evaluation
set a value(4:33)
value(04:33) => Type mismatch
../tests/test.rem(1610): Type mismatch
../tests/test.rem(1612): Type mismatch
set a value('2020-01-01', 42)
value(2020-01-01, ?) => Type mismatch
../tests/test.rem(1611): Type mismatch
../tests/test.rem(1613): Type mismatch
set a value("nosuchvar")
value("nosuchvar") => Undefined variable
../tests/test.rem(1612): Undefined variable
../tests/test.rem(1614): Undefined variable
set a value("nosuchvar", 42)
value("nosuchvar", 42) => 42
set a value("a", 42)
@@ -16496,11 +16504,11 @@ value("a") => 42
DEBUG -x
DEBUG -e
../tests/test.rem(1622): eval(): Too many recursive function calls
../tests/test.rem(1624): eval(): Too many recursive function calls
Base: 1991-02-09
Base: 1991-02-09
../tests/test.rem(1630): Expired
../tests/test.rem(1631): Expired
../tests/test.rem(1632): Expired
../tests/test.rem(1633): Expired
trigvalid = 1; trigdate = 1991-01-14
trigvalid = 0; trigdate = 0
daysinmon(2, 2000) => 29
@@ -16512,36 +16520,36 @@ daysinmon("Feb", 2001) => 28
daysinmon("March", 2000) => 31
daysinmon("March", 2001) => 31
daysinmon("Cabbage", 2001) => Invalid month name
../tests/test.rem(1658): daysinmon(): Invalid month name
../tests/test.rem(1660): daysinmon(): Invalid month name
daysinmon(2000-02-14) => 29
daysinmon(2001-02-14) => 28
daysinmon(2000-04-14) => 30
daysinmon(2001-04-14) => 30
date(2020, "April", 15) => 2020-04-15
date(2020, "Carrot", 12) => Invalid month name
../tests/test.rem(1666): date(): Invalid month name
../tests/test.rem(1668): date(): Invalid month name
datetime(2020, "April", 13, 04:44) => 2020-04-13@04:44
datetime(2020, "April", 13, 4, 44) => 2020-04-13@04:44
datetime(2020, "Lettuce", 13, 04:44) => Invalid month name
../tests/test.rem(1669): datetime(): Invalid month name
../tests/test.rem(1671): datetime(): Invalid month name
datetime(2020, "Lettuce", 13, 4, 44) => Invalid month name
../tests/test.rem(1670): datetime(): Invalid month name
../tests/test.rem(1672): datetime(): Invalid month name
wkdaynum("Tue") => 2
wkdaynum("Wednesday") => 3
wkdaynum("telephone") => Invalid weekday name
../tests/test.rem(1674): wkdaynum(): Invalid weekday name
../tests/test.rem(1685): Cannot modify system variable: `$NumTrig'
../tests/test.rem(1686): POP-VARS without matching PUSH-VARS
../tests/test.rem(1676): wkdaynum(): Invalid weekday name
../tests/test.rem(1687): Cannot modify system variable: `$NumTrig'
../tests/test.rem(1688): POP-VARS without matching PUSH-VARS
FUNSET a
FSET b(x, y) x*y
FSET c() 33
set a a(2)
../tests/test.rem(1695): Undefined function: `a'
../tests/test.rem(1697): Undefined function: `a'
set a b(2)
b(?) => Not enough arguments
../tests/test.rem(1696): b(): Not enough arguments
../tests/test.rem(1698): b(): Not enough arguments
set a b(2, 3)
Entering UserFN b(2, 3)
x => 2
@@ -16563,7 +16571,7 @@ Entering UserFN a(2)
Leaving UserFN a(2) => 42
set a b(2)
b(?) => Not enough arguments
../tests/test.rem(1707): b(): Not enough arguments
../tests/test.rem(1709): b(): Not enough arguments
set a b(2, 3)
Entering UserFN b(2, 3)
x => 2
@@ -16578,10 +16586,10 @@ Leaving UserFN c() => 66
POP-FUNCS
set a a(2)
../tests/test.rem(1713): Undefined function: `a'
../tests/test.rem(1715): Undefined function: `a'
set a b(2)
b(?) => Not enough arguments
../tests/test.rem(1714): b(): Not enough arguments
../tests/test.rem(1716): b(): Not enough arguments
set a b(2, 3)
Entering UserFN b(2, 3)
x => 2
@@ -16596,7 +16604,7 @@ DEBUG -xe
Overridden: subst_colon subst_bang subst_question subst_at subst_hash
bad => "ÿ"
mbstrlen("ÿ") => Invalid multibyte sequence
../tests/test.rem(1734): mbstrlen(): Invalid multibyte sequence
../tests/test.rem(1736): mbstrlen(): Invalid multibyte sequence
bad => "ÿ"
strlen("ÿ") => 1
faces => "ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
@@ -16610,7 +16618,7 @@ index("🙂🙂🙂🙂🙂xyzçççéfoo", "ç") => 24
bad => "ÿ"
bad => "ÿ"
mbindex("ÿ", "ÿ") => Invalid multibyte sequence
../tests/test.rem(1742): mbindex(): Invalid multibyte sequence
../tests/test.rem(1744): mbindex(): Invalid multibyte sequence
faces => "ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
mbindex("ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo", "ç", 11) => 11
faces => "ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
@@ -16629,10 +16637,10 @@ faces => "🙂🙂🙂🙂🙂xyzçççéfoo"
mbsubstr("ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo", 2, 9) => "ðŸ™ðŸ™ðŸ™ðŸ™xyzç"
bad => "ÿ"
mbsubstr("ÿ", 1) => Invalid multibyte sequence
../tests/test.rem(1754): mbsubstr(): Invalid multibyte sequence
../tests/test.rem(1756): mbsubstr(): Invalid multibyte sequence
bad => "ÿ"
mbsubstr("ÿ", 1, 20) => Invalid multibyte sequence
../tests/test.rem(1755): mbsubstr(): Invalid multibyte sequence
../tests/test.rem(1757): mbsubstr(): Invalid multibyte sequence
faces => "ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
substr("ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo", 2) => "Ÿ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
faces => "ðŸ™ðŸ™ðŸ™ðŸ™ðŸ™xyzçççéfoo"
@@ -16642,13 +16650,13 @@ codepoint("🙂🙂🙂🙂🙂xyzçççéfoo") => 128578
mbchar(128578, 162, 122) => "ðŸ™Â¢z"
bad => "ÿ"
codepoint("ÿ") => Invalid multibyte sequence
../tests/test.rem(1762): codepoint(): Invalid multibyte sequence
../tests/test.rem(1764): codepoint(): Invalid multibyte sequence
codepoint("") => 0
mbchar(0) => ""
mbchar(0, 120) => Number too low
../tests/test.rem(1765): mbchar(): Number too low
../tests/test.rem(1767): mbchar(): Number too low
mbchar(120, 0) => Number too low
../tests/test.rem(1766): mbchar(): Number too low
../tests/test.rem(1768): mbchar(): Number too low
Variable hash table statistics:
Entries: 100146; Buckets: 87719; Non-empty Buckets: 66303
Maxlen: 5; Minlen: 0; Avglen: 1.142; Stddev: 0.878; Avg nonempty len: 1.510
@@ -16670,7 +16678,7 @@ Expression nodes high-water: 302076
Expression nodes leaked: 0
Parse level high-water: 34
Max expr node evaluations per line: 2001
Total expression node evaluations: 106464
Total expression node evaluations: 106471
Test 2
@@ -23908,7 +23916,7 @@ Parsed expression: 2
Unparsed: , 3
2, 3
^-- here
../tests/expr.rem(15): Expecting end-of-expression
../tests/expr.rem(15): Expecting operator or end-of-expression
Parsed expression: iif(0, "foo", 0, "bar", 1, "blech", 0, "quux", 1, "borhy", "wacka")
=> (Iif 0 "foo" 0 "bar" 1 "blech" 0 "quux" 1 "borhy" "wacka")
iif(0, ?, 0, ?, 1, "blech", ?, ?, ?, ?, ?) => "blech"
@@ -25066,7 +25074,8 @@ TRANSLATE "TZ specified for non-timed reminder" ""
TRANSLATE "C library does not support multibyte characters" ""
TRANSLATE "Invalid multibyte sequence" ""
TRANSLATE "Maximum expression complexity exceeded" ""
TRANSLATE "Expecting end-of-expression" ""
TRANSLATE "Expecting operator or end-of-expression" ""
TRANSLATE "Expecting constant, variable, function call or (expression)" ""
# Other Messages
TRANSLATE "%s function `%s' defined at %s(%s) does not use its argument" ""

View File

@@ -1589,9 +1589,11 @@ dump -c a
set a eval("1 +")
set a eval("1/0")
set a eval("1 / / 2")
set a eval("1 / # 2")
set a catch(eval("1 +"), 33)
set a catch(eval("1/0"), 34)
set a catch(eval("1 / / 2"), 35)
set a catch(eval("1 / # 2"), 35)
# Ensure RUN is disabled in eval
set a shell("echo foo")
@@ -1765,6 +1767,8 @@ set a mbchar(0)
set a mbchar(0, 120)
set a mbchar(120, 0)
# Make sure trailing space doesn't cause a diagnostic.
set a "foo"
DEBUG -x
# Don't want Remind to queue reminders
EXIT