Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,51 +0,0 @@
|
|||
with Ada.Calendar.Formatting;
|
||||
with Ada.Characters.Latin_1;
|
||||
with Ada.Command_Line;
|
||||
with Ada.IO_Exceptions;
|
||||
with Ada.Text_IO;
|
||||
procedure Notes is
|
||||
Notes_Filename : constant String := "notes.txt";
|
||||
Notes_File : Ada.Text_IO.File_Type;
|
||||
Argument_Count : Natural := Ada.Command_Line.Argument_Count;
|
||||
begin
|
||||
if Argument_Count = 0 then
|
||||
begin
|
||||
Ada.Text_IO.Open
|
||||
(File => Notes_File,
|
||||
Mode => Ada.Text_IO.In_File,
|
||||
Name => Notes_Filename);
|
||||
while not Ada.Text_IO.End_Of_File (File => Notes_File) loop
|
||||
Ada.Text_IO.Put_Line (Ada.Text_IO.Get_Line (File => Notes_File));
|
||||
end loop;
|
||||
exception
|
||||
when Ada.IO_Exceptions.Name_Error =>
|
||||
null;
|
||||
end;
|
||||
else
|
||||
begin
|
||||
Ada.Text_IO.Open
|
||||
(File => Notes_File,
|
||||
Mode => Ada.Text_IO.Append_File,
|
||||
Name => Notes_Filename);
|
||||
exception
|
||||
when Ada.IO_Exceptions.Name_Error =>
|
||||
Ada.Text_IO.Create (File => Notes_File, Name => Notes_Filename);
|
||||
end;
|
||||
Ada.Text_IO.Put_Line
|
||||
(File => Notes_File,
|
||||
Item => Ada.Calendar.Formatting.Image (Date => Ada.Calendar.Clock));
|
||||
Ada.Text_IO.Put (File => Notes_File, Item => Ada.Characters.Latin_1.HT);
|
||||
for I in 1 .. Argument_Count loop
|
||||
Ada.Text_IO.Put
|
||||
(File => Notes_File,
|
||||
Item => Ada.Command_Line.Argument (I));
|
||||
if I /= Argument_Count then
|
||||
Ada.Text_IO.Put (File => Notes_File, Item => ' ');
|
||||
end if;
|
||||
end loop;
|
||||
Ada.Text_IO.Flush (File => Notes_File);
|
||||
end if;
|
||||
if Ada.Text_IO.Is_Open (File => Notes_File) then
|
||||
Ada.Text_IO.Close (File => Notes_File);
|
||||
end if;
|
||||
end Notes;
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
notes: "notes.txt"
|
||||
if? empty? arg [
|
||||
switch empty? arg [
|
||||
if exists? notes -> print read notes
|
||||
]
|
||||
else [
|
||||
][
|
||||
output: (to :string now) ++ "\n" ++
|
||||
"\t" ++ (join.with:" " to [:string] arg) ++ "\n"
|
||||
write.append notes output
|
||||
write.append output notes
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,78 +0,0 @@
|
|||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. NOTES.
|
||||
|
||||
ENVIRONMENT DIVISION.
|
||||
INPUT-OUTPUT SECTION.
|
||||
FILE-CONTROL.
|
||||
SELECT OPTIONAL notes ASSIGN TO "NOTES.TXT"
|
||||
ORGANIZATION LINE SEQUENTIAL
|
||||
FILE STATUS note-status.
|
||||
|
||||
DATA DIVISION.
|
||||
FILE SECTION.
|
||||
FD notes.
|
||||
01 note-record PIC X(256).
|
||||
|
||||
LOCAL-STORAGE SECTION.
|
||||
01 note-status PIC 99.
|
||||
88 notes-ok VALUE 0 THRU 9.
|
||||
|
||||
01 date-now.
|
||||
03 current-year PIC 9(4).
|
||||
03 current-month PIC 99.
|
||||
03 current-day PIC 99.
|
||||
|
||||
01 time-now.
|
||||
03 current-hour PIC 99.
|
||||
03 current-min PIC 99.
|
||||
03 current-sec PIC 99.
|
||||
|
||||
01 args PIC X(256).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
DECLARATIVES.
|
||||
note-error SECTION.
|
||||
USE AFTER STANDARD ERROR PROCEDURE ON notes.
|
||||
|
||||
DISPLAY "Error using NOTES.TXT. Error code: " note-status
|
||||
.
|
||||
END DECLARATIVES.
|
||||
|
||||
main.
|
||||
ACCEPT args FROM COMMAND-LINE
|
||||
|
||||
* *> If there are no args, display contents of NOTES.TXT.
|
||||
IF args = SPACES
|
||||
OPEN INPUT notes
|
||||
|
||||
PERFORM FOREVER
|
||||
* *> READ has no syntax highlighting, but END-READ does.
|
||||
* *> Go figure.
|
||||
READ notes
|
||||
AT END
|
||||
EXIT PERFORM
|
||||
|
||||
NOT AT END
|
||||
DISPLAY FUNCTION TRIM(note-record)
|
||||
END-READ
|
||||
END-PERFORM
|
||||
ELSE
|
||||
OPEN EXTEND notes
|
||||
|
||||
* *> Write date and time to file.
|
||||
ACCEPT date-now FROM DATE YYYYMMDD
|
||||
ACCEPT time-now FROM TIME
|
||||
STRING current-year "-" current-month "-" current-day
|
||||
" " current-hour ":" current-min ":" current-sec
|
||||
INTO note-record
|
||||
WRITE note-record
|
||||
|
||||
* *> Write arguments to file as they were passed.
|
||||
STRING X"09", args INTO note-record
|
||||
WRITE note-record
|
||||
END-IF
|
||||
|
||||
CLOSE notes
|
||||
|
||||
GOBACK
|
||||
.
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
constant cmd = command_line()
|
||||
constant filename = "notes.txt"
|
||||
integer fn
|
||||
object line
|
||||
sequence date_time
|
||||
|
||||
if length(cmd) < 3 then
|
||||
fn = open(filename,"r")
|
||||
if fn != -1 then
|
||||
while 1 do
|
||||
line = gets(fn)
|
||||
if atom(line) then
|
||||
exit
|
||||
end if
|
||||
puts(1,line)
|
||||
end while
|
||||
close(fn)
|
||||
end if
|
||||
else
|
||||
fn = open(filename,"a") -- if such file doesn't exist it will be created
|
||||
date_time = date()
|
||||
date_time = date_time[1..6]
|
||||
date_time[1] += 1900
|
||||
printf(fn,"%d-%02d-%02d %d:%02d:%02d\n",date_time)
|
||||
line = "\t"
|
||||
for n = 3 to length(cmd) do
|
||||
line &= cmd[n] & ' '
|
||||
end for
|
||||
line[$] = '\n'
|
||||
puts(fn,line)
|
||||
close(fn)
|
||||
end if
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
$notes = "notes.txt"
|
||||
if (($args).length -eq 0) {
|
||||
if(Test-Path $notes) {
|
||||
Get-Content $notes
|
||||
}
|
||||
} else {
|
||||
Get-Date | Add-Content $notes
|
||||
"`t" + $args -join " " | Add-Content $notes
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
REBOL [
|
||||
Title: "Notes"
|
||||
URL: http://rosettacode.org/wiki/Take_notes_on_the_command_line
|
||||
]
|
||||
|
||||
notes: %notes.txt
|
||||
|
||||
either any [none? args: system/script/args empty? args] [
|
||||
if exists? notes [print read notes]
|
||||
] [
|
||||
write/binary/append notes rejoin [now lf tab args lf]
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue