Although this was added primarily to support Newt development, you can also use it just for keyboard entry to any text field. When you check Inspect?, the Sloup view shrinks to a smaller size (and leaves the connection open (if already open). When connected, keyboard input (& desktop Paste) will be directed to the current Newton "key view". If Newt is installed (its icon will be visible below Inspect?), the output from the global Print function, Newt's :print method, GetRoot's :Notify method, and Newt's :notify & :error methods will be directed to the terminal emulator while Sloup is connected (in both Inspect and regular transfer modes).
Tap the Paste button to send the current highlighted selection or entire field to the desktop.
For keyboard entry, just tap in a field on the Newton and start to type. Different terminal emulator programs may map characters differently, but the basic alphanumerics and punctuation keystrokes should work fine (check your configuration settings). On the Macintosh (at least), the left and right arrow keys should work. Backspace seems to work, though it doesn't erase the first character in Notepad. If you are connected and a view is selected, you should hear a keyclick sound.
Pasting large strings can be inefficient/slow since it posts/pastes a single character at a time. However, if you're in Inspect mode, in a "regular" input field/paragraph (not the Notepad), have a range selected or an empty field, and then enter a series of complete lines (usually via a Paste from the desktop or a Send Text File), text will appear 3-6x faster than before. This bypasses the usual entry mechanism which uses P-o-s-t-K-e-y-S-t-r-i-n-g. As it inserts lines, Sloup keeps an extra last space highlighted for the next line. When you type single characters or partial lines (no Return), this uses the usual PostKeyString method (and eliminates any selected range). This particular trade-off (kludge) allows much faster input, while still allowing special keystrokes like backspace/ delete, arrow keys, etc. to work.
Here is a potential scenario for how to make effective use of Sloup for developing and testing Newt-based applications. (I've used it for Newt's many application examples, plus associated bitmap, sound and IR resources). Because of coordination between Sloup and Newt, you should obtain the latest version of each.
On the desktop, prepare application and resource files using a simple text editor, e.g., BBEdit Lite on Mac; Notepad on Windows.
Start Sloup. You can do this by tapping the Sloup icon in Extras, or from Newt, select Sloup from Newt's overview list.
Transfer any .bit, .snd, .cmd resources with Sloup. Check bitmaps and sounds using bitsound.nwt (example utility); if any are wrong, remove manually with bitsound (or other soup utility like StewPot); or make sure your resource file uses REPLACE!name. Re-transfer.
For the program source (.nwt) file, check/pick a folder for development. Add an ERASE! command so that everything will be removed before new entries are added, or REPLACE!title. Otherwise, you may clutter up your Newton with duplicate entries, though Newt will warn about these while using the most recent. To speed up transfer (and minimize storage), you may want to remove "readme comments" in your copy of original source.
Notes {labels: 'Test, viewFont: 10241} ERASE! .... BYE!
Transfer the .nwt file using Sloup. Alternatively, if you have a relatively static source file, you can convert the .nwt file into a Paperback application, and download this as a package; then Select it as a Library and Copy All into a folder (this can be a convenient way to manage multiple project sources without cluttering up folders, especially for large or relatively static source objects).
When finished, tap on Newt's icon from Sloup (or open Extras and open Newt from there).
Newt automatically checks objects and methods in its current folder (you may need to change folders, e.g., Test, for your current application. If there are any Newt structure or NewtonScript syntax errors, these are reported to both Newt's Eval Log and the desktop terminal emulator. For syntax errors, Newt will provide the line of source referred to in the error message.
If you plan to edit locally, check the Inspect? box. This keeps the serial connection open, but changes input modes (see Inspector). Fix any syntax errors, either directly in Newt (you can use the Inspector for keyboard input and to Save entries) [possibly, making changes in parallel in your text editor], or if there are many changes to be made, you could make the edits in the desktop editor, uncheck Inspect? and re-transfer the file with Sloup.
Build your application: "Build(App)" action command, or
:doObj('build,'myApp)
.
Start using/testing your app.
If Inspect? is on, any Print expressions or errors will output to the terminal emulator. Of course, if you are developing an application involving serial or IR communication, you will have to Disconnect Sloup before attempting to initialize a new protoEndPoint. (See inspterm.nwt example for other debugging strategies).
Continue editing, testing...
Tap Save to save current running application as a package.
To transfer the package to the desktop, see tools page: ExtractPackage and Newton Connection Kit for 1.x; Package Buddy for 2.x; Sloup and NewtonLink for 2.x and Unix.
If you have made many changes in your Newton and wish to keep a backup copy on your desktop system, you can do a DUMP! and capture the current folder as a log file. (Or, if you want to save the source on the Newton as a library, see the Newt documentation for how to build a "folder library")
You can use Sloup to
You can also use Newt's Cape to transfer a Sloup-format file via TCP/IP (if you have NIE installed on a 2.x Newton), and give it to Sloup for processing. For example, helpslpi.htm provides an HTML form that allows you to select some standard Sloup file extensions (.nwt, .bit, ...) and register these with Newt's Cape. When you access a URL for one of these files, Sloup will receive the file via Newt's Cape. This helper app stays in effect until you de-install via the page (or reboot). See addFile API (next).
You could also do this installation of extensions directly via a Sloup spec, e.g.,
Sloup {dummy: GetRoot().|Newtscape:Newtscape|:installHelperApp(\ "text/plain", '|Sloup:TKnollSys|, {extensions: [".tab", ".nwt", ".slp"]})} // install
And to deinstall:
Sloup {dummy: GetRoot().|Newtscape:Newtscape|:installHelperApp(\ "text/plain", '|Sloup:TKnollSys|, NIL)} // de-install
Enter a URL into Newt's Cape and tap Open:Location. Two demo URLs you can try (assumes you installed .tab and .nwt extensions):
the :addFile API is compatible with Newt's Cape helperApp mechanism, but Newt's Cape does not have to be installed for it to be accessed directly by another application. addFile has the following 4 parameters:
Generally, you cannot use NTK Inspector and Sloup at the same time since NTK Inspector is using the serial or ADSP port. However, if you do not Connect Sloup, but access it via addFile API, you can send "small" Sloup files directly from the NTK Inspector window.
DUMPed results are Printed. (This has advantage that if you use Inspector and get Sloup errors, you can do a stack trace and help me track them down!). For example,
GetRoot().|Sloup:TKnollSys|:addFile("text/plain", "foo.slp", "Notes {labels: 'Personal} DUMP!", nil)
Some additional "types" to simplify the documentation (though these are not Sloup types)
I need to look more closely at soups to determine exact types, especially on strings. In 2.0, there are more options and Sloup may have to use the application API for each soup to ensure that these are set correctly.
In the abbreviated descriptions below (I hope I am consistent), I use the following notation:
All soups have several slots in common. In general, you should not try to set these slots. However, there might be situations where it might be useful to DUMP! these, or to use with REPLACE!
text object:
polygon object:
ink object:
Sloup currently recognizes just labels, height, and viewFont, and creates a single para object.
In addition to CasioNam.tab and Names20.tab, here are several Names examples, followed by documentation on Names fields.Note use of line continuations to make entryspec and data more readable. There are 19 top-level fields in this example -- you can have only 20 before ordering is lost. Other possible fields to add: addresses[array], companies[array], emailAddresses[array]; you can add more specific-type info on things like email addresses, e.g., string.email.internet. One way to learn by example is to modify the very first soup entry (check StewPot on Internal Names -- it's probably Royce Walthrop); add the kind of info that you'd like your entries to have; do a DUMP! on Names and look at the entrySpec info printed out -- match up spec and first entry.
Names {labels: 'symbol,\ name: {class: 'person, honorific: "string", first: "string", last: "string", },\ title: "string", company: "string",\ address: "string", address2: "string", city: "string",\ region: "string", country: "string", postal_code: "string",\ phones: ["homePhone", "workPhone", "mobilePhone", "faxPhone"],\ pagers: [{pagerNum: "string.pager", pagerPin: "string"}, ],\ email: "string.email", anniversary: "date", bday: "date",\ names: [{honorific: "string", first: "string", last: "string", title: "string",}],\ notes: ["para"], cardType: 0, sortOn: "stringWithClass"} Business person Dr. Royce Walthroop \ Grand VIP Amalgamated Consolidated \ 217 Crocker Lane Hillsdale OH 44704 \ (419)555-3543 (419)555-3544 (419)555-3545 (419)555-3546 \ (123)456-7890 6666 foo@bar.com 8/25/76 12/12/46 \ Ms. Grace Mertins Relative \ hi, this is a note 0 name BYE!
The following example leaves out some of the other fields, but adds a second address:
Names {labels: 'symbol,\ name: {class: 'person, last: "string", first: "string", },\ address: "string", address2: "string", city: "string",\ region: "string", postal_code: "string",\ company: "string",\ addresses: [{\ address: "string", address2: "string", city: "string",\ region: "string", postal_code: "string", }],\ phones: ["homePhone", "mobilePhone", "workPhone", "faxPhone"],\ cardType: 0, sortOn: "stringWithClass"} Business person Walthump Royce \ 227 Clunker Lane Hallsdale OH 44704 \ Amalgamated Unlimited \ 217 Clacker St. Hellsdale OH 44704 \ (419)555-3543 (419)555-3544 (419)555-3545 (419)555-3546 \ 0 name Business person Walthrip Royce \ 217 Crisper Ave. Apt. 3B Hollsdale OH 44704 \ Aggregated Mergers \ 217 Crimper Lane Hullsdale OH 44704 \ (419)555-3543 (419)555-3544 (419)555-3545 (419)555-3546 \ 0 name BYE!
The following slots are common to all Names objects. Each class may have additional slots.
There are additional slots depending on the class. For 1.x, the slots are for Person, and the "class" could be inferred from context (whether name or company is optional).
Additional slots for 2.x only
Very similar to Person
Same as Person, but in addition:
Calendar {viewStationery: 'Meeting, mtgStartDate: "time", mtgDuration: "int",\ mtgText: "rich", mtgStopDate: "time", repeatType: "int", mtgInfo: "int",\ mtgAlarm: "time", mtgIconType: "int",\ mtgInvitees: [{name: {first: "string", last: "string"},}], version: "int",} DUMP!
To Do List {class: 'todo, Date: "time", repeatInfo: {mtgStartDate: "time",\ mtgStopDate: "time", repeatType: "int", mtgInfo: "int",},\ topics: [{level: "int", mtgDone: "boolean", mtgPriority: "int",\ hideCount: "int", text: "string"}],} DUMP!