![]() |
|||||||
WIN-PROLOG 4.7 - DetailsWIN-PROLOG 4.7 is the latest version of LPA's true 32-bit Prolog compiler, and is available for all recent versions of Microsoft Windows, including WinXP, Win2k, WinNT, WinME and Win98. Key features of WIN-PROLOG include:
WIN-PROLOG: Easy to Install!The entire WIN-PROLOG 4.7 system comes on a single CD-ROM, which is packed with useful goodies. These include all current versions of LPA toolkits, such as the flex expert system, the object-oriented Prolog++, the Intelligence Server, and more. All current documentation is included, Acrobat 3 format (.PDF): we even include a free copy of the Acrobat Reader in case you are presently without this excellent piece of software. You can read any or all of the documents directly from the CD-ROM, even before you install your softwareWhen you order your WIN-PROLOG system, you will be sent the CD-ROM, complete with a unique serial number and set of "key codes" and "CD locks": when you type these into the SETUP program, you will be able to gain instant access to those parts of the LPA software range that you have licensed. Should you decide to upgrade your software level (say, from Programmer to Developer edition), or to add additional toolkits to your library, all you require is a revised CD lock code from LPA, which means that you can gain access to the additional resources instantly, without waiting for new disks to arrive by post.
WIN-PROLOG: for Windows Vista, XP, 2000, NT, ME and 98In this section we will look a little more closely at some of the special features of WIN-PROLOG. The system is a true 32-bit application, which nonetheless runs under the older Windows systems (98 onwards) as well as having specially designed enhancements for Windows XP. It is totally integrated with the Windows operating system, and utilises a Multiple Document Interface (MDI) environment for editing, compiling, debugging and running programs.The development environment permits any number of program edit windows to be open at any one time, and you can cut and paste text between them. Standard search and replace edit facilities, together with special Prolog-related ones (such as "goto definition") make the maintenance of large, complex systems easy. You can compile or optimise program edit windows individually or all together, and save your work as and when you want to. If you forget to save edit windows before attempting to exit from WIN-PROLOG, you are prompted to do so before quitting. A full source-level debugger utilises a special dialog in which you can scroll through program source code, variable bindings, and other information. A multi-level break facility allows you to escape from the debugger to run supplementary queries before returning. A traditional box model debugger, together with a collection of small, special purpose debuggers, complements the source-level debugger to provide unprecedented flexibility in program testing.
Rich Syntax ColouringMaking use of the Rich Edit 3.0 subsystem, contained within the two Microsoft DLLs, RICHED20.DLL and MSLS31.DLL, WIN-PROLOG supports a powerful form of syntax colouring which goes well beyond the usual keyword identification of other editors. Its "Rich Syntax Colouring" recognises many special cases, for example, distinguishing between single-use and multi-use variables, and between operators, built-in predicate names, compiled and uncompiled user predicate names.Rich Syntax Colouring is not limited to source code windows: console queries are also coloured, as is the code window in the Source Level Debugger; printed text is fully coloured too, and it is easy to export fully coloured program text as Rich Text (RTF) files, for loading into a wird processor for inclusion in reports and documents.
Unicode and Other Text FormatsBy employing a custom text encoding format, known as "UTF-BS", WIN-PROLOG manages to support a full 32-bit character set, and hence Unicode, ISO/IEC 8859-1 and ASCII, with minimal space or processing overheads compared to previous 8-bit character support (typical text applications have no overhead at all, while 8-bit binary text requires an average of only 1.5% more storage than before).Character-level filtering of input and output is supported on a file-by-file basis, allowing applications to handle multiple character sets simultaneously and transparently, in any of 11 file formats, including ASCII, ISO/IEC 8859-1, UTF-8, UTF-16BE, UTF-16LE, UTF-32BE and UTF-32LE among others. External API calls can be made with text in four formats, including WIDE (Windows Unicode), ANSI (Windows Multibyte) and ISO/IEC 8859-1. Altogether, WIN-PROLOG's text handling is second to none.
The Windows InterfaceMany features of the Windows GUI are directly programmable and controllable from within WIN-PROLOG. Using built in predicates, you can create and destroy windows, modal and modeless dialogs, control items, menus and fonts. Windows can be renamed, resized, repositioned, hidden or shown, enabled or disabled. List boxes, combo boxes and menus can be added to, deleted from and inserted into. Text in edit controls can be selected by offset or line number, searched, scrolled, replaced, deleted and inserted into. Buttons can be restyled, grouped, checked or unchecked, selected or deselected, greyed or enabled. Fonts of any face, size and style can be applied to any control window, including edit, button, static, list box and combobox controls. Initialisation files can be created, written, read, added to and deleted from.Links can be found from any given window to its parents, siblings and children, and top level windows can be searched for by class and name. All of the above operations can be applied to any window whose handle is known. You can read or write text from and to any window: thanks to the special string data type, the passing of large amounts of data between Prolog and Windows is both simple and efficient.
Powerful Graphics FunctionsIn addition its rich GUI features, WIN-PROLOG includes a comprehensive and carefully integrated Graphics subsystem. This provides both the graphics functions needed to draw lines, ellipses, rectangles, polygons, bitmaps, icons, metafiles and cursors, and those needed to maintain resources. Each graphic resource, be it a bitmap, icon, or whatever, is given a Prolog name which is maintained, automatically, in a dictionary. When such a resource is no longer required, it can be deleted simply to free up system memory. Icons, bitmaps and metafiles can be loaded direct from disk, and in the case of icons, extracted from any Windows executable file. Metafiles can also be created within WIN-PROLOG for exporting to other applications, such as Word for Windows or CorelDRAW!The repainting of graphics windows is handled elegantly through the use of message handlers (see below), and all necessary housekeeping is carried out "behind the scenes". Graphics can be painted into any window, but special support is given both for buttons (allowing the creation of graphical toolboxes) and special "grafix" control windows.
Message Handlers and HooksAs well as being able to create and manipulate highly complex dialogs and menus, WIN-PROLOG includes sophisticated ways to handle the messages generated by these and other GUI objects. Once you have created a dialog, filled it with controls, and placed initial data into them, you can use the dialog as often as you wish, either in a modal or modeless fashion. All button clicks, list and combo box selections, edit control changes, and scroll bar movements are reported to a special handler program whose job it is to process the dialog. Each dialog can have its own handler, or they can share handlers. You write these handlers, entirely in Prolog, to perform any actions you like.Similarly, when you have built a menu, with or without submenus, you can install it on the main menu bar. Whenever selections are made, messages are sent to a special menu handler, again which you have written in Prolog, and which can perform any actions you like. As well as the user dialog and menu handlers, several message "hooks" are provided to enable you to capture and process certain messages from the predefined modeless dialogs, DLL modules and the keyboard.
Direct Windows API InterfaceAs well as providing high-level access to around 100 Windows API (Application Programming Interface) functions, not to mention numerous subfunctions, WIN-PROLOG includes a special interface which allows your programs to call virtually any C function directly, whether defined in the Windows API or in a DLL or other module. The winapi/3 predicate allows any function, defined in any 32-bit module, to be called with any number of parameters. The parameters may be integers, string pointers, or arbitrary structures, and facilities exist for defining named "memory files". All memory allocation and stack frame creation is carried out automatically, so your only job as a programmer is to provide the relevant data and call the function.The Windows API function means that your programs are no longer "limited" to using the 100-plus API functions built into WIN-PROLOG by LPA, but can add additional functions yourself as and when you need them. It also provides a direct way to invoke code in DLLs, without having to write parameter-translating ("glue") code in C/C++.
Memory FilesAs well as creating or opening files on disk, WIN-PROLOG has the powerful ability to open "virtual" files in memory: these have no disk image, and can be of any size within available resources. Ideal as temporary scratchpads during complex data operations, they are both extremely fast (no need to bother the hard disk) and avoid the usual worries about how best to name a temporary file: they don't have external names!Modelled on the original buffers that implemented to provide storage for use in conjunction with the winapi/3 predicate, these new memory files can be used with any and all of the standard Prolog input/output predicates, as well as to store virtually any data directly. Applications which require the storage of large numbers of small data items (such as bit tables) are especially helped by this feature.
True 32-bit Assembler-coded ImplementationThe WIN-PROLOG kernel is implemented entirely in 32-bit assembler to provide the best overall performance possible on 386, 486, Pentium or Pentium Pro platforms, with just enough 32-bit C to interface it to the Win32 API of Windows Vista, XP, 2000, NT, ME and 98. Thanks to its tight implementation, the entire WIN-PROLOG system requires under 2Mb of disk space, and can be installed without having to modify any Windows or System directories, although two Microsoft files, RICHED20.DLL and MSLS31.DLL are updated with later versions on older versions of Windows.
32-bit Memory Access: the 4 Gigabyte "Limit"A significant advantage of the true 32-bit implementation is that all pointers and integers are 32 bits wide, giving WIN-PROLOG the ability directly to address up to 4 gigabytes (4096 megabytes) of memory. You can divide memory in any way you like between program, text and dynamic data: there are no built-in limits or restrictions. WIN-PROLOG can directly use every single byte of memory on your computer.
Thorough Quintus Prolog CompatibilityWIN-PROLOG has been designed from scratch for Quintus Prolog (QP) compatibility. This extends well beyond the obvious requirement of duplicating the built in predicates of QP, as it includes special features such as logical file names, background housekeeping of predicates/file relationships, and much more. Most applications will port directly from QP to WIN-PROLOG, as the file management support isolates user programs from the intricacies of the host operating system.
Linear Garbage CollectionWith all the memory available to the designers, it would have been tempting to skimp on garbage collection features. However, the garbage collection and memory management within WIN-PROLOG is more complete and advanced than in any other commercial Prolog system.The evaluation stacks and heap are managed by a linear garbage collector: doubling the size of evaluation space roughly doubles the time taken to collect garbage on any one occasion, but garbage collection occurs only half as often. The result is that there is no degradation of performance, when even vastly different sizes of evaluation space are used. A fixed size cell allocation scheme avoids any risk of memory fragmentation. Text space is used to store the bodies of atoms and strings, and is managed as a special heap. It too is fully garbage collectable. Program space is used to store clauses and optimised programs, and is totally reclaimable when these programs are abolished. Both text and program spaces use a special segmented heap format which guarantees that every last byte of memory can be used, with no fragmentation or degradation problems, however many times items have been added or removed.
The Incremental CompilerWIN-PROLOG is based on an incremental compiler, whereby all clauses in a program are compiled at all times. Because the compiler is incremental, individual clauses can be added by programs - just as in a conventional interpreter. In fact, assert/1 is implemented as a call to the compiler. But WIN-PROLOG goes beyond simple clause level compilation, maintaining dynamic first argument indexing (even into compound terms), which can result in considerable runtime performance improvements over previous LPA Prologs.Programs can be incrementally decompiled too, allowing predicates like clause/1 and retract/1 (and even listing/1) to be implemented. Both the incremental compilation and decompilation routines are written in assembler code, and are very fast, matching the speed of their interpreter equivalents - but the clauses they manage run some 3-4 times faster than they would in an interpreter.
The Optimising CompilerThe incremental compiler/decompiler does not perform multi-argument indexing, or the space-saving last clause and other optimisations - they would simply be too complex to change on the fly during assert/1 or retract/1. With this in mind, WIN-PROLOG provides an alternative optimising compiler.The optimising compiler can perform all the optimisations just mentioned, and more. There is full support for multiple-argument indexing, which enable the very fast matching of clauses on any arbitrary argument (as opposed to the single first-argument indexing the incremental compiler and other Prolog systems), and a complete analysis of variable usage is performed on relations. Any variables which can be left in situ between calls are left so, substantially reducing the data traffic in most programs. Optimised programs can run some 2-3 or more times faster than incrementally compiled ones, and use less space during execution. Decompilation of these programs is not possible, so your source code will remain completely hidden in applications.
64-bit Floating Point and 32-bit Integer ArithmeticA fully-featured, 64-bit double precision floating point arithmetic library is built in to WIN-PROLOG. This is accessed directly by the is/2 predicate, which in turn is implemented entirely in 32-bit assembler. The library provides high-speed, high-precision arithmetic computations, and includes support for standard "calculator" functions, trigonometric and logarithmic functions, floating point to integer conversion and truncation functions, maximum and minimum functions, and pseudo random numbers. Direct support is also provided for 32-bit integer style shift, rotate and bitwise logical functions. The most common use of the is/2 predicate is for the simple adding or subtracting of two integers, and this case is specially optimised, being handled entirely in the integer domain wherever possible.For special systems applications, a 32-bit integer, reverse polish notation evaluator is provided, once again implemented in 32-bit assembler. This evaluator provides very high speed computation of integer expressions, and supports the standard "calculator" functions, bitwise logical functions, and pseudo random numbers. The carefully researched, pseudo random number generator is useful in a variety of applications, including games, simulations and data encryption. For speed, it is implemented in integer arithmetic, and uses a very high potency linear congruential algorithm, with a period of 2^64. The single, seedable generator is shared between the floating point and integer evaluators, so switching portions of code between these two domains will not violate the integrity of a pseudo random sequence.
Powerful Input and Output FeaturesOne of WIN-PROLOG's great strengths is its powerful collection input and output subsystems. As well as the standard see/1, tell/1, read/1 and write/1 style predicates, support is given for formatted I/O, binary I/O, and the manipulation of a number of special I/O streams, including device and string streams as well as disk files.Formatted I/O primitives provide complete control of the output of atoms, strings, numbers and other items. Fixed field display, with left or right justification, optional truncation, and free field formats are all supported. Numbers can be output in fixed point, signed or unsigned integer, and even non-decimal base formats (anything from base 2 (binary), through base 16 (hexadecimal) right up to base 36). Matching formatted input allows structured records to be read in with automatic type checking. As well as the obvious applications such as writing or reading data in tabular formats, the formatted I/O predicates make it easy to build interfaces to ASCII files from other applications.
Input and Output Streams and DevicesAs well as disk files and the standard "user" device (the console), WIN-PROLOG supports a number of special streams and devices. For a start, "user" need not be a simple teletype console: in WIN-PROLOG, this device is a specially programmed window which supports full Windows cut/paste editing, and yet which can still be used with standard Prolog input and output predicates.Memory files (see above) permit newly-allocated or even existing memory to be mapped to an internal Prolog filename, so that data can easily be safely read from or written to any memory address. Raw keyboard input is also supported by WIN-PROLOG, allowing for the single-key control of applications. When a mouse is attached to the system, the buttons are treated as keys in their own right during raw input, a feature which can be useful in debugging, or even for the (relatively) remote control of demonstrations. For special systems applications, a secondary MDA monitor can be controlled in addition to the primary CGA, EGA, VGA or SVGA monitor. This feature is especially useful in the debugging of graphics programs, where diagnostic messages displayed on the main screen would disrupt the graphical output being tested.
Text String Data TypeWhile the traditional Prolog "string", namely a list of 8-bit integers, is a powerful means by which to manipulate small pieces of text, it is extremely inefficient as a way of storing text. This inefficiency would be compounded in a 32-bit Prolog system, where each one-character element of the list would need 10 bytes of storage on the dynamic heap. To enable bulk text handling applications, WIN-PROLOG includes a true text string type. Any number of such strings may exist in Prolog terms, and each may contain up to 64Kb of text. Because of the way these strings are stored, garbage collection is still quick and efficient, and even string space cannot become fragmented.Many built in predicates use strings as a means of passing large amounts of text or binary data around, for example between a window buffer and a disk file. In addition, strings may be used as input and output streams: for example, the call:
?- listing ~> String.
Strings provide a data type with a high bandwidth for communications between WIN-PROLOG and low-level data types, such as files and screen buffers. They are of particular importance as parameters in WIN-PROLOG's extensive library of Windows GUI predicates.
LZSS Data CompressionAn interesting feature in WIN-PROLOG is the provision of a pair of routines for LZSS data compression and decompression. These are used internally by the system state save and restore predicates, but are also available for general use in user programs through two special I/O predicates. A modified version of the original LZ77 algorithm, LZSS uses a sliding window to hold processed data, while a look-ahead buffer peeks into the stream of data yet to be compressed. Depending upon the sizes of sliding window and look-ahead buffer, compression ratios of up to 64:1 are theoretically possible for highly patterned data; in practice, ratios of 2:1 to 4:1 are more usual.There are many potential applications of LZSS compression: these include the creation of stuffed archive files, which contain an accumulation of compressed files with their names, creation dates/times and attributes, the simple stuffing of individual files, such as bitmaps, which normally use large amounts of disk space, or the compacting of data which needs to be transmitted by modem or some other slow device. More advanced uses might include the creation of mixed database files consisting of uncompressed index information, and compressed data records.
MZSS Data EncryptionAs its name suggests, MZSS encryption makes use of a Marsaglia/Zaman pseudo random number generator (PRANG), which has the primary benefit of offering a very large key size (1185 bits, compared with just 64 bits in WIN-PROLOG's existing linear-congruential PRANG!). The MZ/PRANG is seeded by a user-specified password of up to 148 characters, and successive numbers are then combined (XOR) with the plaintext in order to encrypt it, or with the cyphertext in order to decrypt it. Two special features of MZSS encryption make it especially secure: "comb filtering" and "sequence variation".Although having excellent random properties, and a massively long cycle (well over 2^1180 numbers in the sequence), there is a weakness in the pure MZ/PRANG. If a history of the previous 37 numbers is visible, it is possible to guess the next one +/- 1 bit: if the first 37 characters of a document's plaintext are known, this is quite sufficient for an intelligent attack to decrypt the rest of the document. MZSS encryption prevents such an attack with the help of "comb filtering", in which only a random sample of numbers from the MZ/PRANG sequence are actually used. Another common attack on simple cyphertext is to find some other document to which both the encrypted and decrypted version are available. Suppose that a document, VULNERABLE, is to be attacked, and the attacker has access to the PLAINTEXT and CYPHERTEXT versions of another document: on the (fairly reasonable) assumption that same password has been used to encode both VULNERABLE and CYPHERTEXT, it is possible to decode the former, at least as far as length of the PLAINTEXT document, by combinding PLAINTTEXT and CYPHERTEXT to obtain an intermediate KEYSEQUENCE, then combining this with VULNERABLE to generate the desired DISCOVERED document. MZSS encryption prevents such an attack by adding additional data to the user's password: this results in "sequence variation", so that even if the same password is used on more than one occasion, the random sequence it generates is completely different each time.
Term and Data ManagementThere are many special features in WIN-PROLOG geared towards term and data management. An assembler-coded, high speed list/merge sort algorithm gives truly stunning performance. Displaying ln2(X) performance characteristics, it is capable of sorting lists of 10,000 elements in around two seconds on a 25MHz 386. The sort/3 predicate goes beyond the functionality sort/2, by allowing you to define a sort key of arbitrary depth: if the elements in the list you are sorting are complex compound terms, you can uniquely identify which subterm you want to use for sorting. This powerful feature allows you, for example, to sort a given list of names and addresses by surname, street name, town or post code, simply by changing the search key parameter.
The Operating System InterfaceAs you would expect from LPA's Prolog implementations, WIN-PROLOG has a huge library of operating system interface functions, providing for disk file and directory management, program execution, the reading of environment variable strings, and time and date functions.Predicates allow you to create, rename and remove files or directories, and you can test and modify file attributes and timestamps. File directories can be read according to file name and attribute matching, returning information about each file's size, time and date. For specialist time and date applications, a built in predicate allows you to compute absolute day numbers for any given date, or vice versa, allowing days between dates, lunar phases, and other such calculations to be made.
Programmable Interrupt TimersFor special purposes, up to 64 completely independent, programmable timers may be set or tested. When a timer expires, it interrupts the execution of WIN-PROLOG, and calls a specially defined user "hook" predicate. This predicate can perform various operations, before resetting the timer. Because of the design of the timers, real-time synchronisation is maintained, even if an individual hook is delayed in its operation. Uses for timers include timeouts on user input, periodic updating of clock or calendar displays, the writing of sophisticated profile tools, and so on.
Try before you Buy!You can try all of the features mentioned above, and many more, by downloading the special Free Trial version of WIN-PROLOG. All you need to do is enter your full name and email address, and optionally some other details about you and your work, and your own customised copy of the software is just a couple of mouse clicks away!
|