Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

btm won't run in ver. 17 but works in ver. 16

Jun
15
1
I have a command line calendar (like Unix "cal") back in 2008 that for some reason isn't working with:

TCC 17.00.71 x64 Windows 8.1 [Version 6.3.9600]
TCC Build 71 Windows 8.1 Build 9600​

I'm getting the following error:

C:\Util\TCMD17x64\clc.btm [109] Usage : SCRPUT row col [BRIght] fg ON BRIght] bg text

Line 109 reads:

scrput %row %c bla on whi %z

Where
%row = the row number
%c = the column number
edited to
%z = %@char[32] (the only way I know of to get a leading blank space printed to screen.)
from
%z = ASCII 255

If I run it with different parameters I will eventually get scrput errors for other lines.

Except for the directory names the ini files are the same.

If wanted I can post files and pictures on a web page.


In another btm ver. 17 is also not showing ASCII boxes as lines.
 
Last edited:
Here's the command line calendar (CLC) code. The parameters are explained at the bottom (help section).

The problem line is 110 here I made a spacing change to the code.

Sorry about not using a code box, I don't see the option in my browser.

::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: Command Line Calendar (CLC) is is an emulation ::
:: the Unix/Linux cal utility. ::
:: ::
:: Written by Robin Douglas, it's a modified port ::
:: of an old BASIC program, and distributed as is ::
:: for whom ever wants it. It comes with no ::
:: guarantees or warranties to not be harmful or ::
:: be useful in any way, shape, or form. ::
:: ::
::::::::::::::::::::::::::::::::::::::::::::::::::::

@echo off
setlocal
set FDay=0
if %1 = s set FDay=1 %+ goto Use.Today
if !%1==! goto Use.Today
if %@numeric[%1] eq 0 .or. %1 lt 1 .or. %@len[%1] lt 1 .or. %@len[%1] eq 3 .or. %@len[%1] gt 4 goto Get.Help
iff %@len[%1] eq 4 .and. %1 ge 1583 then
if %2 = s set FDay=1
goto Make.Year
endiff
if %1 lt 1 .or. %1 gt 12 goto Get.Help
set b=%1
if %2 = s set FDay=1
if !%2==! .or. %2 = s set a=%_year
if %@len[%2] = 4 set a=%2
if %@len[%a] ne 4 .or. %a lt 1583 goto Get.Help
if %3 = s set FDay=1
goto Make.Month

:Make.Year
set a=%1
set b=1
set e=%_day
set row=%@eval[%_row + 2]
if %row gt %@eval[%_rows - 36] set row=1
if %row eq 1 cls
set d=1
set m=%b
set y=%a
set nm=%m
do mr = 1 to 4

set col=2
do cm = 1 to 3
gosub Make.Cal
set nm=%@inc[%nm]
set m=%nm
set row=%@eval[%row-8]
set col=%@eval[%col+23]
enddo
set row=%@eval[%row+9]
enddo
goto Done

:Use.Today
set a=%_year
set b=%_month

:Make.Month
set e=%_day
set row=%@eval[%_row + 2]
: if %row gt %@eval[%_rows - 10] set row=1
: if %row eq 1 cls
set d=1
set m=%b
set y=%a
set col=25
gosub Make.Cal

:Done
set row=%@dec[%row]
screen %row 0 %z
endlocal
quit

:Make.Cal
set z=%@char[32]
gosub Zeller's.congruence
set n2=%n
gosub Day.Of.Year
(set n1=%n %+ set m1=%m)
set m=%@inc[%m]
iff %m gt 12 then
set n3=31
else
(gosub Day.Of.Year %+ set n3=%@eval[%n - %n1])
endiff
set n=%@substr[JanFebMarAprMayJunJulAugSepOctNovDec,%@eval[3 * %m1 - 3],3]
scrput %row %col bla on whi %n %y
set row=%@inc[%row]
iff %FDay=1 then

scrput %row %col red on whi %z Su
scrput %row %@eval[%col + 3] bla on whi %z Mo Tu We Th Fr
scrput %row %@eval[%col +18] red on whi %z Sa
else
scrput %row %col bla on whi Mo Tu We Th Fr
scrput %row %@eval[%col +15] red on whi %z Sa Su
endiff
set row=%@inc[%row]
set l=0

do i = 1 to 6
set c=%col
set g=1
set wkd=0

do j = 1 to 7
set s=%c
iff %g lt %@eval[%n2 + 1] .and. %i eq 1 .or. %l ge %n3 then

scrput %row %c bla on whi %z
elseiff %m1 eq %_month .and. %y eq %_year .and. %@inc[%l] eq %e then
set l=%@inc[%l]
if %l le 9 set s=%@inc[%s]

scrput %row %s cya on whi %l
elseiff (%FDay = 1 .and. %wkd = 0 .or. %wkd = 6) .or. (%FDay = 0 .and. %wkd ge 5) then
set l=%@inc[%l]
if %l le 9 set s=%@inc[%s]

scrput %row %s red on whi %l
elseiff %m1 ne %_month .or. %y ne %_year .or. %@inc[%l] ne %e then
set l=%@inc[%l]
if %l le 9 set s=%@inc[%s]

scrput %row %s bla on whi %l
endiff
set wkd=%@inc[%wkd]
set c=%@eval[%c+3]
set g=%@inc[%g]
enddo
set row=%@inc[%row]
enddo
return

:Zeller's.Congruence
iff %m gt 2 then

(set mz=%@eval[%m - 2] %+ set yz=%y)
else
(set mz=%@eval[%m + 10] %+ set yz=%@eval[%y - 1])
endiff
(set cz=%@eval[%yz \ 100] %+ set dz=%@eval[%yz - 100 * %cz])
set n=%@eval[((13 * %mz -1) \ 5) + %d + %dz + (%dz \ 4) + (%cz \ 4) - %cz - %cz + 77]
set n=%@eval[%n - 7 * (%n \ 7)]
if %FDay = 0 (set n=%@dec[%n] %+ if %n lt 0 set n=6)
return

:Day.Of.Year
set n=%@eval[(3055 * (%m + 2) \ 100) - 91]
gosub leap.year
if %m gt 2 set n=%@eval[%n - 2 + %lp]
set n=%@eval[%n + %d]
return

:Leap.Year
set lp=0
if %@eval[%y %% 4] == 0 set lp=1
if %@eval[%y %% 100] == 0 set lp=0
if %@eval[%y %% 400] == 0 set lp=1
return

:Get.Help
text

----------------------------------------------------------------------

NOTE: CLC will not do years prior to 1583 or after 9999, this was
done intentionally as an error prevention measure.

For years prior to 1583 this is technically correct. The Gregorian or the
current solar calendar was Decreed by Pope Gregory XIII in a papal bull
in February 1582, to correct an error in the Julian calendar by suppressing
10 days, causing Oct 5 to become Oct 15. It was not adopted by Great
Britain and the American colonies until 1752.

See http://calendopedia.com/gregory.htm for a list of when the different
countries adopted the this calendar.

As for after 9999, it my be my limited sense of reality, but I don't
really think it's necessary.
----------------------------------------------------------------------

The correct format for CLC is:

CLC s - the week starts on Sunday (must be first)

CLC month - i.e. CLC 5 - for May of the current year.

or:

CLC month year - i.e. CLC 5 1957 - for May 1957

or:

CLC year - i.e. CLC 1957 - for the entire year of 1957

months need to be between 1 an 12
years need to have 4 digits i.e. 1957
----------------------------------------------------------------------

endtext
set row=%_row
goto Done
 
Last edited:
The .BTM works with no errors on my
Code:
TCC  16.03.55  Windows Vista [Version 6.0.6002]
TCC Build 55  Windows Vista Build 6002  Service Pack 2

but gives the same error that op got on my
Code:
TCC  17.00.71  Windows Vista [Version 6.0.6002]
TCC Build 71  Windows Vista Build 6002  Service Pack 2

Joe
 
A simple test is OK here. Could it depend on what @CHAR[255] is?
upload_2015-1-30_20-27-13.png
 
vefatica, Thank you, you pointed out a mistake in my message I hadn't realized, z=%@char[32] assignment is on line 79
 
TCC (in both v16 and v17) strips trailing spaces from the line. In v16, SCRPUT with no text argument does nothing. In v17, SCRPUT complains.

The question is whether you would rather have SCRPUT not do anything (and not tell you that it's not doing anything), or return an error in this case?
 
TCC (in both v16 and v17) strips trailing spaces from the line. In v16, SCRPUT with no text argument does nothing. In v17, SCRPUT complains.

The question is whether you would rather have SCRPUT not do anything (and not tell you that it's not doing anything), or return an error in this case?

Then the question is, is there a way to print a blank space (%@char[32]) as the last character in v 17 without the error message without asking you to do a rewrite?
 
I would change lines like
Code:
scrput %row %c bla on whi %z
to
Code:
scrput %row %c bla on whi ` `
(a space between two strong quotes).
 

Similar threads

Back
Top