Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,92 +0,0 @@
with Gtk.Main;
with Gtk.Handlers;
with Gtk.Label;
with Gtk.Button;
with Gtk.Window;
with Glib.Main;
procedure Animation is
Scroll_Forwards : Boolean := True;
package Button_Callbacks is new Gtk.Handlers.Callback
(Gtk.Button.Gtk_Button_Record);
package Label_Timeout is new Glib.Main.Generic_Sources
(Gtk.Label.Gtk_Label);
package Window_Callbacks is new Gtk.Handlers.Return_Callback
(Gtk.Window.Gtk_Window_Record, Boolean);
-- Callback for click event
procedure On_Button_Click
(Object : access Gtk.Button.Gtk_Button_Record'Class);
-- Callback for delete event
function On_Main_Window_Delete
(Object : access Gtk.Window.Gtk_Window_Record'Class)
return Boolean;
function Scroll_Text (Data : Gtk.Label.Gtk_Label) return Boolean;
procedure On_Button_Click
(Object : access Gtk.Button.Gtk_Button_Record'Class)
is
pragma Unreferenced (Object);
begin
Scroll_Forwards := not Scroll_Forwards;
end On_Button_Click;
function On_Main_Window_Delete
(Object : access Gtk.Window.Gtk_Window_Record'Class)
return Boolean
is
pragma Unreferenced (Object);
begin
Gtk.Main.Main_Quit;
return True;
end On_Main_Window_Delete;
function Scroll_Text (Data : Gtk.Label.Gtk_Label) return Boolean is
Text : constant String := Gtk.Label.Get_Text (Data);
begin
if Scroll_Forwards then
Gtk.Label.Set_Text
(Label => Data,
Str => Text (Text'First + 1 .. Text'Last) & Text (Text'First));
else
Gtk.Label.Set_Text
(Label => Data,
Str => Text (Text'Last) & Text (Text'First .. Text'Last - 1));
end if;
return True;
end Scroll_Text;
Main_Window : Gtk.Window.Gtk_Window;
Text_Button : Gtk.Button.Gtk_Button;
Scrolling_Text : Gtk.Label.Gtk_Label;
Timeout_ID : Glib.Main.G_Source_Id;
pragma Unreferenced (Timeout_ID);
begin
Gtk.Main.Init;
Gtk.Window.Gtk_New (Window => Main_Window);
Gtk.Label.Gtk_New (Label => Scrolling_Text, Str => "Hello World! ");
Gtk.Button.Gtk_New (Button => Text_Button);
Gtk.Button.Add (Container => Text_Button, Widget => Scrolling_Text);
Button_Callbacks.Connect
(Widget => Text_Button,
Name => "clicked",
Marsh => Button_Callbacks.To_Marshaller (On_Button_Click'Access));
Timeout_ID :=
Label_Timeout.Timeout_Add
(Interval => 125,
Func => Scroll_Text'Access,
Data => Scrolling_Text);
Gtk.Window.Add (Container => Main_Window, Widget => Text_Button);
Window_Callbacks.Connect
(Widget => Main_Window,
Name => "delete_event",
Marsh => Window_Callbacks.To_Marshaller (On_Main_Window_Delete'Access));
Gtk.Window.Show_All (Widget => Main_Window);
Gtk.Main.Main;
end Animation;

View file

@ -1,54 +0,0 @@
(defun animation-start ()
(interactive)
(make-thread
(lambda ()
(let ()
(setq **animation-state** (make-hash-table))
(puthash 'offset 0 **animation-state**)
(puthash 'sleep-cnt 5 **animation-state**)
(puthash 'len 20 **animation-state**)
(puthash 'buffer (make-string (gethash 'len **animation-state**) ? )
**animation-state**)
(puthash 'text "Hello World!" **animation-state**)
(puthash 'forward 't **animation-state**)
(switch-to-buffer-other-window "**animation**")
(erase-buffer)
(insert "\n")
(insert-button
"Revert Direction"
'action (lambda (x)
(let ((forward (gethash 'forward **animation-state**)))
(puthash 'forward (not forward) **animation-state**)))
'follow-link 't)
(while 't
(let ((offset (gethash 'offset **animation-state**))
(len (gethash 'len **animation-state**))
(txt (gethash 'text **animation-state**))
(buff (gethash 'buffer **animation-state**))
(is-forward (gethash 'forward **animation-state**)))
(fillarray buff ? )
(seq-map-indexed (lambda (ch idx)
(aset buff (% (+ offset idx) len) ch))
txt)
(puthash 'buffer buff **animation-state**)
(if is-forward
(puthash 'offset (1+ offset) **animation-state**)
(puthash 'offset (% (+ len (1- offset)) len) **animation-state**))
;;(erase-buffer)
(beginning-of-buffer)
(delete-region (line-beginning-position) (line-end-position))
(insert buff)
;;(message buff)
)
(sleep-for 0 500)
)
)
)
"animation thread")
)
(animation-start)

View file

@ -1,43 +0,0 @@
REBOL [
Title: "Basic Animation"
URL: http://rosettacode.org/wiki/Basic_Animation
]
message: "Hello World! " how: 1
roll: func [
"Shifts a text string right or left by one character."
text [string!] "Text to shift."
direction [integer!] "Direction to shift -- right: 1, left: -1."
/local h t
][
either direction > 0 [
h: last text t: copy/part text ((length? text) - 1)
][
h: copy skip text 1 t: text/1
]
rejoin [h t]
]
; This next bit specifies the GUI panel. The window will have a
; gradient backdrop, over which will be composited the text, in a
; monospaced font with a drop-shadow. A timer (the 'rate' bit) is set
; to update 24 times per second. The 'engage' function in the 'feel'
; block listens for events on the text face. Time events update the
; animation and mouse-down change the animation's direction.
view layout [
backdrop effect [gradient 0x1 coal black]
vh1 as-is message ; 'as-is' prevents text trimming.
font [name: font-fixed]
rate 24
feel [
engage: func [f a e] [
case [
'time = a [set-face f message: roll message how] ; Animate.
'down = a [how: how * -1] ; Change direction.
]
]
]
]