[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

XyPy: XyWrite + Python



Some months ago, for reasons unrelated to XyWrite, I became
interested in Python, a popular programming language with a friendly,
"plain-English" syntax. After I learned the basics and a bit more, I
started to do what comes naturally: explore how Python might be used
to enhance our favorite word-processor. After months of
experimentation and tinkering, I believe I've come up with something
promising: a suite of U2 frames and Python routines that grafts
Python onto XyWrite 4, allowing Python to be used as an extension of
XPL. I call it "XyPy".

Python's many strengths include text processing and Web/Internet
access, and the routines included in XyPy suggest how these
capabilities can be harnessed to the XyWrite command line. For
example, it takes all of two lines of code to launch a web page or
perform Google searches from the CMline. A rudimentary e-mail routine
lets you download and read your messages in XyWrite.

On the text-manipulation side, there's a routine to count the unique
words in a XyWrite document and calculate the average word length. My
personal favorite, though, is an adjunct to Stack, Robert's command-
history utility. It allows unlimited archiving of Stacked commands,
with the ability to pop commands from the archive by supplying a
"hint", or substring of the desired command. (In my torture tests of
this routine, I was able to archive 130,000+ commands; a hint that
returned more than 2,000 matching commands executed instantaneously.
As demonstrated by these numbers, Python isn't hampered by the severe
memory constraints inherent in XPL. You can assign a megabyte of data
to a Python variable, no problem; whereas in XPL, 5 or 10 kilobytes
can break the memory bank.)

Other XyPy routines demonstrate how Python can be used to manufacture
and manipulate XyWrite's basic building blocks, including functions,
SEarch wildcards, and other control characters.

A detailed description of XyPy can be viewed here:
http://users.datarealm.com/xywwweb/xypydoc.htm

XyPy can be downloaded here:
http://users.datarealm.com/xywwweb/XYPY.ZIP
(Unzip XYPY.ZIP into the directory that contains EDITOR.EXE, then
follow the instructions in XYPY.TXT.)

XyPy requires Python v3 and XyWrite 4 for DOS. Feedback welcome.

(Thanks to Harry B. for testing an earlier version of XyPy.)

--
Carl Distefano
cld@xxxxxxxx