home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- INTRODUCTION
- ────────────
-
-
- The translator is provided as an aide for converting from
- Brief to Sageedit. It produces Polyawk compilable code.
- There are several Brief primitives that cannot be translated
- to one line of Polyawk code. This usually occurs when Brief
- macros pass parameters by reference. Polyawk only allows
- passing parameters by value. The macros in question are
- listed below in the sections entitled "Untranslated Brief
- Macros" and "Notable Brief Macros".
-
- The translator is only intended to translate valid Brief
- macro code. It performs very little syntax checking and
- unexpected code may be produced for invalid input. Press
- Ctrl-C any time during the translation to halt execution.
-
- There is not a one-to-one mapping between the function of
- the Brief and SPE macro languages. Translation can
- therefore be difficult. To ease the process, many Brief
- macros are translated by replacing the Brief primitive name
- with a SPE function name. The SPE functions are located in
- an additional ".pel" file named "bsupport.pel".
-
-
-
-
-
-
-
-
- Notable Brief Macros
- ─────────────────────
-
- Below is a list of macros that deserve special attention.
- They will be translated accurately under certain circumstances
- but not when a parameter pass-by-reference is required. The
- description of each macro describes aspects of which you
- should be aware.
-
-
- (get_parm [parm_no] variable [prompt] [length])
-
- Polyawk declares its parameters in the function heading
- as opposed to Brief's method of retrieving them. Below
- is a sample of both forms. The first is written in
- brief and the second is the translated form.
-
- 1) (macro test
- (
- (int a)
- (get_parm 0 a)
- )
- )
-
- 2) function test( _parm_0 ){
- local a;
- a = _parm_0
- }
-
- Obviously, the translated form could be optimized
- further. Also note that if get_parm is called using a
- variable for parm_no, the _parm_ will be followed by the
- variable name. This must be corrected manually. For
- example:
-
- (get_parm j a) <==> a = _parm_j
-
- Which is an invalid translation.
-
-
- (int_to_key key_integer)
-
- This function converts an integer to a key string. The
- key string format may often be different from that
- defined by brief. Brief's int_to_key function
- performed on 11779 will return "<CTRL-C>" whereas the
- same call in SPE will return "#11779". This is supplied
- for future expansion. However, the SPE function
- "key_name()" will return the desired result.
-
-
- (key_to_int key_string)
-
- This function converts a string to an integer. The key
- string format may often be different from that defined
- by brief. This will result in the function returning
- 0.
-
-
-
-
-
-
-
-
- Untranslatable Brief Macros
- ────────────────────────────
-
- Below is a list of Brief macros that cannot be translated to
- Polyawk functions for one reason or another. Each macro
- details the reasons why; in several instances a work around
- is suggested.
-
- These particular functions remain untranslated and must be
- corrected manually.
-
-
- (find_file [name] [size] [date] [time] [attribute])
-
- This command can be translated fully except for
- the format of date and time.
-
- (inq_assignment convert_str [convert_to_key])
-
- This command can only be partially translated. If
- convert_to_key is absent or 0, then the Sageedit
- function keymap_binding() is called, otherwise the
- convert_str must be converted to a key string manually.
-
- Be aware that if it is translated, the format of
- convert_str may be different from that required by
- Sageedit. Errors will occur at run time. Consult your
- manual for the differences between Brief's key names
- and Polyawk's.
-
- (inq_brief_level)
-
- Sageedit does not keep track of multiple or nested
- invocations of the editor. There is therefore no
- translation for (inq_brief_level). There is, however, an
- inq_brief_level() function in bsupport.pel that always
- returns zero.
-
- (inq_scrap [last_newline] [mark_type])
-
- In Sageedit, the scrap is a magic buffer and there is no
- buffer id associated with it.
-
-
- (put_parm parm_no value)
-
- Polyawk provides no way to pass values by reference.
- Therefore, there is no way to set passed by reference
- values from within a called function.
-
-
-
- (set_calling_name name)
-
- The closest function to this that Sageedit has are the
- variable prev_command and current_command. However, both
- of these are read-only variables so there is no built-in
- way of redefining the function caller.
-
-
- (set_scrap_info insert_newline [mark_type])
-
- Sageedit does not support copying text directly to the
- scrap buffer. However, the simplest way to do this is
- by using the following sequence of commands:
-
- str = "<text to be inserted>"
- drop_anchor( 1 )
- insert_string( str )
- delete_to_scrap()
-
- (search_string pattern string [length] [re] [case])
-
- search_string requires more than one line of code to
- translate so it can't be done. The functions necessary
- to duplicate the processing follow (note that [case] is
- ignored):
-
- if (re)
- pattern = bsupport_new_regex_pattern( pattern, 0 )
- else
- pattern = quote_regex( pattern );
- match( string, pattern );
- length = search_string_length;
-
-
-
-
-
- Conversion of C-Brief
- ─────────────────────
-
-
-
- Although there is not a C-Brief-to-Polyawk translator, Brief
- does provide a means of translating their own C macros to the
- old LISP-like format. The command
-
- cb.exe -c -i <filename>.cb
-
- will produce a "<filename>.ci" file. This file will contain the
- macros in the old LISP-like format.
-