Perl is a popular scripting language for text processing. Perl originated in the UNIX environment and has since been ported to DOS and Windows environments. Perl's power and flexibility have made it a widely used language for Web-based programming. Perl has several advantages over regular programming languages:
1) Perl compilation is extremely fast for reasonable size scripts, making it a good fit for the kind of iterative programming required when writing an import or export script. 2) Perl was originally created for text processing and report generation, so it simplifies many tasks associated with file and text processing. Most waveform files are stored in an ASCII (text) format. Perl also has more than adequate support for binary file formats. Perl's text processing capabilities also make it an excellent language for writing code generators such as TestBencher Pro. 3) Perl is object-oriented. This makes it possible to do a direct mapping from WaveFormer's internal functions (written in C++) to Perl functions. Of course, it also means you can write your own objects in Perl! 4) Perl is extensible. Many Perl modules have already been placed in the public domain that extend the capabilities of Perl, and more are being written all the time. See the Perl documentation for information on available Perl modules. 5) Perl is fun! Although Perl syntax may first appear cryptic due to the use of $, @, and % in variable names, you will quickly come to appreciate the ease with which you can write code that would require hours or even days in C or C++. |
Why a Scripting Language?
1) The built-in scripting language makes it possible for WaveFormer Pro to potentially import/export any waveform format, because the user can write a script to support it. 2) Scripts make it easier for SynaptiCAD to upgrade WaveFormer Pro capabilities and distribute the upgrades to you, the end-user. 3) End-users can change scripts as desired to meet their own particular needs. |
Perl Interface
SynaptiCAD makes a large number of functions available to its embedded perl interpreter. These functions provide access to TestBencher Pro's internal data structures, and allow you to manipulate signals, delays, parameters, and the like. Many of the file export and import scripts are written entirely as perl scripts.
In the Help subdirectory, we include the file twf.xs, which is used to generate the perl functions. This file is always kept up-to-date, so you can use it as a listing of all current functions available to the perl interpreter, and their parameters. We're in the process of documenting that file, so it may be your best reference.
There are also two other files of interest: waveperl.txt and twfapi.txt. Both of these are quite out-of-date and will probably be removed or rewritten as soon as we finish documenting twf.xs, but until then they may provide useful information.
Finally, SynaptiCAD ships scores of perl scripts which you can examine. These scripts can be found in the perl subdirectory.