Home » Archimedes archive » Zipped Apps » PipeDream » Custom/CF_sheets/c_DateFns

Custom/CF_sheets/c_DateFns

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Zipped Apps » PipeDream
Filename: Custom/CF_sheets/c_DateFns
Read OK:
File size: 064A bytes
Load address: 0000
Exec address: 0000
Duplicates

There is 1 duplicate copy of this file in the archive:

File contents
%OP%DP0
%OP%FX
%OP%FY
%OP%FS
%OP%NDmonth_table,b1b13
%OP%NDmon_loop,9
%OP%NDdigit,9
%OP%NDweekdays,c1c8
%OP%NDdaytext,c1
%OP%NDsuffix,"th "
%OP%NDmonthtext,b2
%OP%NDyeartext,2004
%OP%NDdate_text,"Sunday the 29th of February, 2004"
%OP%WC110,1416,716,1096,0,4,0,0
%OP%VS3.81 Test (Oct  8 1991), Colton Software - Development, R0123 4567 8901 2345
%CO:A,90,0%%V%%L%function("text_to_date","etext:reference")
%V%%L%trim(@etext)
%V%%L%find(" ",a2,1)
%V%%L%find(" ",a2,a3+1)
%V%%L%value(left(a2,a3-1))
%V%%L%mid(a2,a3+1,a4-a3-1)
%V%%L%if(a4+2<length(a2),value(right(a2,4)),value(right(a2,2))+1900)
%V%%L%set_name("month_table",b1b12)
%V%%L%for("mon_loop",1,12)
%V%%L%    if(length(a6)>9,result("Bad Month"),0)
%V%%L%    if(length(a6)>length(index(month_table,1,mon_loop)),goto(a13),0)
%V%%L%    if(a6=left(index(month_table,1,mon_loop),length(a6)), result(date(a7,mon_loop,a5)), 0)
%V%%L%next
%V%%L%result("Bad Month")


%V%%L%function("expand_date","when")
%V%%L%if(type(@when)<>"date",result("Bad Date"),)
%V%%L%year(@when)
%V%%L%set_name("month_table",b1b13)
%V%%L%set_name("weekdays",c1c8)
%V%%L%mod(day(@when),10)
%V%%L%if(a22=1,set_name("suffix","st "),set_name("suffix","th "))
%V%%L%if(a22=2,set_name("suffix","nd "),)
%V%%L%if(a22=3,set_name("suffix","rd "),)
%V%%L%index(month_table,1,month(@when))
%V%%L%index(weekdays,1,weekday(@when))
%V%%L%join(a27," the ",string(day(@when),0),suffix,"of ",a26,", ",string(a19,0))
%V%%L%result(a28)
%CO:B,12,24%January
February
March
April
May
June
July
August
September
October
November
December
%CO:C,12,12%Sunday
Monday
 Tuesday
Wednesday
Thursday
Friday
Saturday
00000000  25 4f 50 25 44 50 30 0a  25 4f 50 25 46 58 0a 25  |%OP%DP0.%OP%FX.%|
00000010  4f 50 25 46 59 0a 25 4f  50 25 46 53 0a 25 4f 50  |OP%FY.%OP%FS.%OP|
00000020  25 4e 44 6d 6f 6e 74 68  5f 74 61 62 6c 65 2c 62  |%NDmonth_table,b|
00000030  31 62 31 33 0a 25 4f 50  25 4e 44 6d 6f 6e 5f 6c  |1b13.%OP%NDmon_l|
00000040  6f 6f 70 2c 39 0a 25 4f  50 25 4e 44 64 69 67 69  |oop,9.%OP%NDdigi|
00000050  74 2c 39 0a 25 4f 50 25  4e 44 77 65 65 6b 64 61  |t,9.%OP%NDweekda|
00000060  79 73 2c 63 31 63 38 0a  25 4f 50 25 4e 44 64 61  |ys,c1c8.%OP%NDda|
00000070  79 74 65 78 74 2c 63 31  0a 25 4f 50 25 4e 44 73  |ytext,c1.%OP%NDs|
00000080  75 66 66 69 78 2c 22 74  68 20 22 0a 25 4f 50 25  |uffix,"th ".%OP%|
00000090  4e 44 6d 6f 6e 74 68 74  65 78 74 2c 62 32 0a 25  |NDmonthtext,b2.%|
000000a0  4f 50 25 4e 44 79 65 61  72 74 65 78 74 2c 32 30  |OP%NDyeartext,20|
000000b0  30 34 0a 25 4f 50 25 4e  44 64 61 74 65 5f 74 65  |04.%OP%NDdate_te|
000000c0  78 74 2c 22 53 75 6e 64  61 79 20 74 68 65 20 32  |xt,"Sunday the 2|
000000d0  39 74 68 20 6f 66 20 46  65 62 72 75 61 72 79 2c  |9th of February,|
000000e0  20 32 30 30 34 22 0a 25  4f 50 25 57 43 31 31 30  | 2004".%OP%WC110|
000000f0  2c 31 34 31 36 2c 37 31  36 2c 31 30 39 36 2c 30  |,1416,716,1096,0|
00000100  2c 34 2c 30 2c 30 0a 25  4f 50 25 56 53 33 2e 38  |,4,0,0.%OP%VS3.8|
00000110  31 20 54 65 73 74 20 28  4f 63 74 20 20 38 20 31  |1 Test (Oct  8 1|
00000120  39 39 31 29 2c 20 43 6f  6c 74 6f 6e 20 53 6f 66  |991), Colton Sof|
00000130  74 77 61 72 65 20 2d 20  44 65 76 65 6c 6f 70 6d  |tware - Developm|
00000140  65 6e 74 2c 20 52 30 31  32 33 20 34 35 36 37 20  |ent, R0123 4567 |
00000150  38 39 30 31 20 32 33 34  35 0a 25 43 4f 3a 41 2c  |8901 2345.%CO:A,|
00000160  39 30 2c 30 25 25 56 25  25 4c 25 66 75 6e 63 74  |90,0%%V%%L%funct|
00000170  69 6f 6e 28 22 74 65 78  74 5f 74 6f 5f 64 61 74  |ion("text_to_dat|
00000180  65 22 2c 22 65 74 65 78  74 3a 72 65 66 65 72 65  |e","etext:refere|
00000190  6e 63 65 22 29 0a 25 56  25 25 4c 25 74 72 69 6d  |nce").%V%%L%trim|
000001a0  28 40 65 74 65 78 74 29  0a 25 56 25 25 4c 25 66  |(@etext).%V%%L%f|
000001b0  69 6e 64 28 22 20 22 2c  61 32 2c 31 29 0a 25 56  |ind(" ",a2,1).%V|
000001c0  25 25 4c 25 66 69 6e 64  28 22 20 22 2c 61 32 2c  |%%L%find(" ",a2,|
000001d0  61 33 2b 31 29 0a 25 56  25 25 4c 25 76 61 6c 75  |a3+1).%V%%L%valu|
000001e0  65 28 6c 65 66 74 28 61  32 2c 61 33 2d 31 29 29  |e(left(a2,a3-1))|
000001f0  0a 25 56 25 25 4c 25 6d  69 64 28 61 32 2c 61 33  |.%V%%L%mid(a2,a3|
00000200  2b 31 2c 61 34 2d 61 33  2d 31 29 0a 25 56 25 25  |+1,a4-a3-1).%V%%|
00000210  4c 25 69 66 28 61 34 2b  32 3c 6c 65 6e 67 74 68  |L%if(a4+2<length|
00000220  28 61 32 29 2c 76 61 6c  75 65 28 72 69 67 68 74  |(a2),value(right|
00000230  28 61 32 2c 34 29 29 2c  76 61 6c 75 65 28 72 69  |(a2,4)),value(ri|
00000240  67 68 74 28 61 32 2c 32  29 29 2b 31 39 30 30 29  |ght(a2,2))+1900)|
00000250  0a 25 56 25 25 4c 25 73  65 74 5f 6e 61 6d 65 28  |.%V%%L%set_name(|
00000260  22 6d 6f 6e 74 68 5f 74  61 62 6c 65 22 2c 62 31  |"month_table",b1|
00000270  62 31 32 29 0a 25 56 25  25 4c 25 66 6f 72 28 22  |b12).%V%%L%for("|
00000280  6d 6f 6e 5f 6c 6f 6f 70  22 2c 31 2c 31 32 29 0a  |mon_loop",1,12).|
00000290  25 56 25 25 4c 25 20 20  20 20 69 66 28 6c 65 6e  |%V%%L%    if(len|
000002a0  67 74 68 28 61 36 29 3e  39 2c 72 65 73 75 6c 74  |gth(a6)>9,result|
000002b0  28 22 42 61 64 20 4d 6f  6e 74 68 22 29 2c 30 29  |("Bad Month"),0)|
000002c0  0a 25 56 25 25 4c 25 20  20 20 20 69 66 28 6c 65  |.%V%%L%    if(le|
000002d0  6e 67 74 68 28 61 36 29  3e 6c 65 6e 67 74 68 28  |ngth(a6)>length(|
000002e0  69 6e 64 65 78 28 6d 6f  6e 74 68 5f 74 61 62 6c  |index(month_tabl|
000002f0  65 2c 31 2c 6d 6f 6e 5f  6c 6f 6f 70 29 29 2c 67  |e,1,mon_loop)),g|
00000300  6f 74 6f 28 61 31 33 29  2c 30 29 0a 25 56 25 25  |oto(a13),0).%V%%|
00000310  4c 25 20 20 20 20 69 66  28 61 36 3d 6c 65 66 74  |L%    if(a6=left|
00000320  28 69 6e 64 65 78 28 6d  6f 6e 74 68 5f 74 61 62  |(index(month_tab|
00000330  6c 65 2c 31 2c 6d 6f 6e  5f 6c 6f 6f 70 29 2c 6c  |le,1,mon_loop),l|
00000340  65 6e 67 74 68 28 61 36  29 29 2c 20 72 65 73 75  |ength(a6)), resu|
00000350  6c 74 28 64 61 74 65 28  61 37 2c 6d 6f 6e 5f 6c  |lt(date(a7,mon_l|
00000360  6f 6f 70 2c 61 35 29 29  2c 20 30 29 0a 25 56 25  |oop,a5)), 0).%V%|
00000370  25 4c 25 6e 65 78 74 0a  25 56 25 25 4c 25 72 65  |%L%next.%V%%L%re|
00000380  73 75 6c 74 28 22 42 61  64 20 4d 6f 6e 74 68 22  |sult("Bad Month"|
00000390  29 0a 0a 0a 25 56 25 25  4c 25 66 75 6e 63 74 69  |)...%V%%L%functi|
000003a0  6f 6e 28 22 65 78 70 61  6e 64 5f 64 61 74 65 22  |on("expand_date"|
000003b0  2c 22 77 68 65 6e 22 29  0a 25 56 25 25 4c 25 69  |,"when").%V%%L%i|
000003c0  66 28 74 79 70 65 28 40  77 68 65 6e 29 3c 3e 22  |f(type(@when)<>"|
000003d0  64 61 74 65 22 2c 72 65  73 75 6c 74 28 22 42 61  |date",result("Ba|
000003e0  64 20 44 61 74 65 22 29  2c 29 0a 25 56 25 25 4c  |d Date"),).%V%%L|
000003f0  25 79 65 61 72 28 40 77  68 65 6e 29 0a 25 56 25  |%year(@when).%V%|
00000400  25 4c 25 73 65 74 5f 6e  61 6d 65 28 22 6d 6f 6e  |%L%set_name("mon|
00000410  74 68 5f 74 61 62 6c 65  22 2c 62 31 62 31 33 29  |th_table",b1b13)|
00000420  0a 25 56 25 25 4c 25 73  65 74 5f 6e 61 6d 65 28  |.%V%%L%set_name(|
00000430  22 77 65 65 6b 64 61 79  73 22 2c 63 31 63 38 29  |"weekdays",c1c8)|
00000440  0a 25 56 25 25 4c 25 6d  6f 64 28 64 61 79 28 40  |.%V%%L%mod(day(@|
00000450  77 68 65 6e 29 2c 31 30  29 0a 25 56 25 25 4c 25  |when),10).%V%%L%|
00000460  69 66 28 61 32 32 3d 31  2c 73 65 74 5f 6e 61 6d  |if(a22=1,set_nam|
00000470  65 28 22 73 75 66 66 69  78 22 2c 22 73 74 20 22  |e("suffix","st "|
00000480  29 2c 73 65 74 5f 6e 61  6d 65 28 22 73 75 66 66  |),set_name("suff|
00000490  69 78 22 2c 22 74 68 20  22 29 29 0a 25 56 25 25  |ix","th ")).%V%%|
000004a0  4c 25 69 66 28 61 32 32  3d 32 2c 73 65 74 5f 6e  |L%if(a22=2,set_n|
000004b0  61 6d 65 28 22 73 75 66  66 69 78 22 2c 22 6e 64  |ame("suffix","nd|
000004c0  20 22 29 2c 29 0a 25 56  25 25 4c 25 69 66 28 61  | "),).%V%%L%if(a|
000004d0  32 32 3d 33 2c 73 65 74  5f 6e 61 6d 65 28 22 73  |22=3,set_name("s|
000004e0  75 66 66 69 78 22 2c 22  72 64 20 22 29 2c 29 0a  |uffix","rd "),).|
000004f0  25 56 25 25 4c 25 69 6e  64 65 78 28 6d 6f 6e 74  |%V%%L%index(mont|
00000500  68 5f 74 61 62 6c 65 2c  31 2c 6d 6f 6e 74 68 28  |h_table,1,month(|
00000510  40 77 68 65 6e 29 29 0a  25 56 25 25 4c 25 69 6e  |@when)).%V%%L%in|
00000520  64 65 78 28 77 65 65 6b  64 61 79 73 2c 31 2c 77  |dex(weekdays,1,w|
00000530  65 65 6b 64 61 79 28 40  77 68 65 6e 29 29 0a 25  |eekday(@when)).%|
00000540  56 25 25 4c 25 6a 6f 69  6e 28 61 32 37 2c 22 20  |V%%L%join(a27," |
00000550  74 68 65 20 22 2c 73 74  72 69 6e 67 28 64 61 79  |the ",string(day|
00000560  28 40 77 68 65 6e 29 2c  30 29 2c 73 75 66 66 69  |(@when),0),suffi|
00000570  78 2c 22 6f 66 20 22 2c  61 32 36 2c 22 2c 20 22  |x,"of ",a26,", "|
00000580  2c 73 74 72 69 6e 67 28  61 31 39 2c 30 29 29 0a  |,string(a19,0)).|
00000590  25 56 25 25 4c 25 72 65  73 75 6c 74 28 61 32 38  |%V%%L%result(a28|
000005a0  29 0a 25 43 4f 3a 42 2c  31 32 2c 32 34 25 4a 61  |).%CO:B,12,24%Ja|
000005b0  6e 75 61 72 79 0a 46 65  62 72 75 61 72 79 0a 4d  |nuary.February.M|
000005c0  61 72 63 68 0a 41 70 72  69 6c 0a 4d 61 79 0a 4a  |arch.April.May.J|
000005d0  75 6e 65 0a 4a 75 6c 79  0a 41 75 67 75 73 74 0a  |une.July.August.|
000005e0  53 65 70 74 65 6d 62 65  72 0a 4f 63 74 6f 62 65  |September.Octobe|
000005f0  72 0a 4e 6f 76 65 6d 62  65 72 0a 44 65 63 65 6d  |r.November.Decem|
00000600  62 65 72 0a 25 43 4f 3a  43 2c 31 32 2c 31 32 25  |ber.%CO:C,12,12%|
00000610  53 75 6e 64 61 79 0a 4d  6f 6e 64 61 79 0a 20 54  |Sunday.Monday. T|
00000620  75 65 73 64 61 79 0a 57  65 64 6e 65 73 64 61 79  |uesday.Wednesday|
00000630  0a 54 68 75 72 73 64 61  79 0a 46 72 69 64 61 79  |.Thursday.Friday|
00000640  0a 53 61 74 75 72 64 61  79 0a                    |.Saturday.|
0000064a