Plain English is a programming language created in 2018 by Gerry Rzeppa and Dan Rzeppa.
#2284on PLDB | 6Years Old |
The background is a picture.
A button has a box and a name.
To clear the status:
Clear the status' string.
Show everything.
To create the background:
Draw the screen's box with the white color.
Loop.
Pick a spot anywhere in the screen's box.
Pick a color between the lightest gray color and the white color.
Dab the color on the spot.
If a counter is past 80000, break.
If the counter is evenly divisible by 1000, refresh the screen.
Repeat.
Extract the background given the screen's box. \or Create the background from the screen. Or something.
To create a work given a URL:
Allocate memory for the work.
Put the URL into the work's URL.
To create some works given a buffer:
Destroy the works.
Put nil into the current work.
Slap a rider on the buffer.
Loop.
Move the rider (Googley image rules).
If the rider's token is blank, exit.
Create a work given the rider's token.
Append the work to the works.
Repeat.
The current work is a work.
To dab a color on a spot:
Pick an ellipse's left-top within 1/16 inch of the spot.
Pick the ellipse's right-bottom within 1/16 inch of the spot.
Draw the ellipse with the color.
To decide if a spot is in a button:
If the spot is in the button's box, say yes.
Say no.
To decide if a work is finished:
If the work is nil, say yes.
If the work's painting is not nil, say yes.
Say no.
To draw a button:
Draw the button's name in the button's box.
To draw the status:
Draw the status' string in the center of the status' box.
To draw a string in a box in the center: \ needed in sausage
draw the string in the box with "center".
To draw the text:
Put the text's string then "_" into a string.
Draw the string in the text's box.
To draw a work:
If the work is nil, exit.
If the work is not finished, exit.
Draw the work's painting.
To finalize our stuff:
Destroy the background.
Destroy the works.
To finish a work:
If the work is nil, exit.
If the work is finished, exit.
Create a picture given the work's URL.
If the picture is nil, exit.
Resize the picture to 5-1/2 inches by 5-1/2 inches.
Center the picture in the screen's box.
Draw the background.
Draw the picture.
Loop.
Pick a spot anywhere near the picture's box.
Mix a color given the spot.
Dab the color on the spot.
If a counter is past 20000, break.
Repeat.
Extract the work's painting given the picture's box.
Destroy the picture.
To go to a work:
If the work is nil, exit.
Show "Working..." in the status.
Put the work into the current work.
Finish the current work.
Clear the status.
Show everything.
To handle any events:
Deque an event.
If the event is nil, exit.
Handle the event.
Repeat.
To handle an event:
If the event's kind is "set cursor", handle the event (set cursor); exit.
If the event's kind is "refresh", handle the event (refresh); exit.
If the event's kind is "left click", handle the event (left click); exit.
If the event's kind is "key down", handle the event (key down); exit.
To handle an event (backspace):
If the text's string is blank, cluck; exit.
Remove the last byte from the text's string.
Show everything.
To handle an event (end):
If the current work is nil, cluck; exit.
If the current work is the works' last, cluck; exit.
Go to the works' last.
To handle an event (enter):
If the text's string is blank, cluck; exit.
Show "Working..." in the status.
Put "http://images.google.com/images?q=" into a URL.
\ Put "http://images.google.com/images?safe=active&q=" into a URL.
Convert the text's string to a query string.
Append the query string to the URL.
Read the URL into a buffer.
If the i/o error is not blank, show the i/o error in the status; exit.
Create the works given the buffer.
If the works are empty, show "Huh?" in the status; exit.
Go to the works' first.
To handle an event (escape):
Clear the text's string.
Show everything.
To handle an event (home):
If the current work is nil, cluck; exit.
If the current work is the works' first, cluck; exit.
Go to the works' first.
To handle an event (key down):
Clear the status.
If the event is modified, handle the event (shortcut); exit.
If the event's byte is printable, handle the event (printable); exit.
Put the event's key into a key.
If the key is the escape key, handle the event (escape); exit.
If the key is the backspace key, handle the event (backspace); exit.
If the key is the enter key, handle the event (enter); exit.
If the key is the home key, handle the event (home); exit.
If the key is the end key, handle the event (end); exit.
If the key is the page-up key, handle the event (page-up); exit.
If the key is the page-down key, handle the event (page-down); exit.
To handle an event (left click):
Clear the status.
If the event's spot is in the print button, print.
If the event's spot is in the quit button, quit.
To handle an event (page-down):
If the current work is nil, cluck; exit.
If the current work's next is nil, cluck; exit.
Go to the current work's next.
To handle an event (page-up):
If the current work is nil, cluck; exit.
If the current work's previous is nil, cluck; exit.
Go to the current work's previous.
To handle an event (printable):
Append the event's byte to the text's string.
Show everything.
To handle an event (refresh):
Show everything.
To handle an event (set cursor):
Show the arrow cursor.
To handle an event (shortcut):
If the event's key is the q-key, quit; exit.
If the event's key is the p-key, print; exit.
To initialize the buttons:
Put the screen's bottom minus 1/2 inch into a spot's y.
Put the screen's right minus 1/2 inch into the spot's x.
Make the quit button given the spot and "Quit".
Put the quit button's left minus 1/2 inch into the spot's x.
Make the print button given the spot and "Print".
To initialize our stuff:
Create the background.
Initialize the status.
Initialize the buttons.
Initialize the text.
Show "Hello, World!" in the status.
To initialize the status:
Put the screen's center into a spot.
Put the spot's x minus 1 inch into the status' left.
Put the spot's x plus 1 inch into the status' right.
Put the screen's bottom minus 3/4 inch into the status' top.
Put the screen's bottom minus 1/2 inch into the status' bottom.
To initialize the text:
Put the screen's left plus 1/2 inch into the text's left.
Put the text's left plus 2 inches into the text's right.
Put the screen's bottom minus 3/4 inch into the text's top.
Put the screen's bottom minus 1/2 inch into the text's bottom.
To make a button given a spot and a name:
Put the spot's x minus the name's width into the button's left.
Put the spot's y minus 1/4 inch into the button's top.
Put the spot into the button's right-bottom.
Put the name into the button's name.
To mix a color given a spot:
Get the color given the spot.
If the color is not very very light, exit.
Pick the color between the lightest gray color and the white color.
To move a rider (Googley image rules):
Clear the rider's token.
Loop.
If the rider's source is blank, exit.
If the rider's source starts with "src=""http://t", break.
Add 1 to the rider's source's first.
Repeat.
Add "src="""'s length to the rider's source's first.
Position the rider's token on the rider's source.
Move the rider (HTML attribute rules).
To move a rider (HTML attribute rules):
If the rider's source is blank, exit.
If the rider's source's first's target is the right-alligator byte, exit.
If the rider's source's first's target is the double-quote byte, exit.
Bump the rider.
Repeat.
A painting is a picture.
To pick a spot anywhere near a box:
Privatize the box.
Outdent the box given 1/8 inch.
Pick the spot anywhere in the box.
To print:
If the current work is nil, cluck; exit.
Show "Printing..." in the status.
Begin printing.
Begin a sheet.
Center the current work's painting in the sheet.
Draw the current work's painting.
Center the current work's painting in the screen's box.
End the sheet.
End printing.
Show "Printed" in the status.
The print button is a button.
To quit:
Relinquish control.
The quit button is a button.
To run:
Start up.
Initialize our stuff.
Handle any events.
Finalize our stuff.
Shut down.
To show everything:
Hide the cursor.
Draw the background.
Draw the status.
Draw the print button.
Draw the quit button.
Draw the text.
Draw the current work.
Refresh the screen.
To show a string in the status:
Put the string into the status' string.
Show everything.
The status has a box and a string.
The text has a box and a string.
A work is a thing with a URL and a painting.
The works are some works.