Files and Filenames
|
Introduction
|
|
•
|
Maple handles a variety of files. The two main categories of files are those used implicitly by Maple and those used explicitly with Maple I/O functions. Files used implicitly by Maple are described in this help page. For information on files used explicitly, see file_types.
|
|
For information regarding filenames, see the Filenames section in this help page.
|
|
|
Maple Language Files
|
|
•
|
A Maple language file contains statements conforming to the syntax of the Maple language. These are the same as statements that can be entered interactively. Any filename can be used for a Maple language file, but the name cannot end with the two characters .m (or .M on platforms such as MS-DOS or MS-Windows, where filenames are not case-sensitive). The standard file extension for Maple language files is .mpl.
|
•
|
Maple language files can be created using a text editor or the save statement. Maple procedures and complex scripts of commands are usually written in a text editor. The save statement is used to save results or procedures that were entered into Maple interactively.
|
•
|
Maple language files may be read using the read statement. The statements within the file are read as if they were being entered into Maple interactively, except that they are not echoed to the screen unless interface(echo) has been set to 2 or higher. For information on the interface command, see interface.
|
•
|
Because the Maple language may change from release to release, a Maple language file that was saved by one release may not be readable by the next release. However, each new release is shipped with a conversion utility that translates Maple language files from the previous release to the current one. For more information, see updtsrc.
|
•
|
Maple includes a preprocessor modeled on the C preprocessor. Maple language files may include preprocessor directives ($include, $define).
|
|
|
Internal Format Files
|
|
•
|
Maple internal format files are used to store procedures and objects in a more compact, easy-for-Maple-to-read format. Objects stored in internal format can be read by Maple faster than objects stored in Maple language format.
|
•
|
Maple internal format files are identified by filenames ending with the two characters .m (or .M on platforms where filenames are not case sensitive).
|
•
|
Maple internal format files are created using the save statement with a filename parameter (see save) ending in .m.
|
|
Note: Because "." is a special character, the filename must be enclosed in quotes, either double quotes or left single quotes (backquotes).
|
•
|
Maple internal format files are read using the read statement. The fact that the specified filename ends in ".m" tells Maple that the file is in internal format.
|
•
|
Generally, the format of internal files changes with each new release of Maple in order to accommodate new features. However, any given release of Maple is able to read at least the previous release's internal file format.
|
•
|
All versions of Maple released in 1995 or later have an internal format consisting entirely of printable characters. This enables internal format files to be transferred by such media as electronic mail.
|
|
|
Library Archives
|
|
•
|
Because Maple internal format files are generally rather small, and because the Maple library consists of thousands of such files, keeping the library as a large number of separate files does not make good use of disk space (since most disks allocate a large minimum amount of space to a file). Therefore, the library is kept in a small number of Maple library archive (.mla) files.
|
|
.mla files
|
|
•
|
The main archive consists of the single maple.mla file. There are other archives, including maplets, sc, and units. Maple .mla files contain Maple code and are self-contained. In Windows and Macintosh, an archive file can be opened by double-clicking it. In UNIX, the file can be opened from the command line by entering xmaple filename.mla.
|
•
|
When files are read from the library, they are automatically read directly from the archive into Maple. Likewise, when internal format files are written to a library directory, they are automatically written directly into an archive if one exists. Library archives can be further manipulated using the march utility. For details, see march.
|
|
|
.lib files
|
|
•
|
The Maple .lib file is similar to a .mla file. However, unlike .mla files, which are self-contained, .lib files have an associated .ind file. All commands used with .mla files may also be used with .lib files.
|
|
|
|
Help Databases
|
|
•
|
A Maple help database (.hdb file) is a file that stores a collection of files that represent help pages in the Maple online help system. It contains the information required to index, navigate, and search the help system. For more information, see About Help Databases in Maple.
|
|
|
Maplet Files
|
|
•
|
Maple worksheets can be saved as .maplet files. The MapletViewer runs .maplet files independent of the Maple worksheet environment. For more information, see MapletViewer and Save a Worksheet As.
|
|
|
Worksheet Files
|
|
•
|
If you are using Maple with a graphical user interface, you can save your worksheet. In the Standard Worksheet interface, files are identified by names ending with .mw. In the Classic Worksheet interface, files end in .mws. Both types of files are portable between the graphical user interfaces on different platforms.
|
|
|
Filenames
|
|
•
|
In most places where Maple expects a filename, a string should be used; however, a Maple symbol may also be used in most cases. If there are no special characters in the filename, neither left single nor double quotes are necessary: all three of MyFile, `MyFile` and "MyFile" represent the same filename. If a filename contains unusual characters (for example, "/", ".") then the name must be enclosed in double quotes (") or left single quotes (`).
|
•
|
Some typical Maple filenames are "lib/f.m", temp, "temp.m", and `foo/bar`.
|
•
|
Consult your system documentation for details on file naming rules and conventions for your computer platform.
|
|
|
Examples
|
|
Open a file for reading on a UNIX or Macintosh system.
>
|
|
A similar example on a Windows system.
>
|
|
>
|
|
|
|
See Also
|
|
About Help Databases in Maple, backslash, file_types, fopen, interface, MapletViewer, march, Preprocessor, read, save, Save a Worksheet As, trademark, updtsrc
|
|