Introduction, Disclaimer, Getting started with macro programming – Crunch CRiSP File Editor 6 User Manual

Page 7

Advertising
background image

Page 7

.

Introduction

Document version: 1.002, date 24 November 1997

This guide discusses how to write macros in the CRiSP extension language, known as CRUNCH. The
CRiSP software package is a highly flexible file editor for use by people who need to edit files, whether they
be programmers, or engineers. CRiSP is designed to be easy to use and have a familiar user interface.
Underlying all this power is a powerful macro language which implements the things you use and see in the
user interface.

You may want to write your own personal macros for CRiSP in order to make private tweaks to keyboard
bindings, or to write your own subsystems to do more complex actions. The CRiSP binary itself is a program
interpreter, interpreting the steps in the macros in order to perform some well defined action. As an
interpreter it has a lot of power and allows such things as keyboard mappings to be set up, editing of files,
creating dialog boxes, configuring colors, etc. Just about everything you see within the CRiSP user interface
is built up from macros, and there is therefore a lot of expressive power in the software.

This programming guide covers the following areas:

Getting started with macro programming (pg. 7).

General introduction to macro programming(pg. 8).

CRUNCH compiler,.(pg. 14).

CRUNCH language,.(pg. 14).

Macro debugging(pg. 30).

High-level data objects (e.g. windows, buffers)(pg. 38).

How to create custom colorization languages(pg. 67).

Interprocess communication(pg. 79).

Description of the Dialog Box subsystem.(pg. 51).

Macro Primitives Guide

Disclaimer

This manual and the CRiSP Macro Primitives manual describe how to use the facilities in CRiSP for
extending its facilities. Foxtrot Systems Ltd makes no guarantee on the validity of the information contained
herein. In addition, any errors in the macro language (compiler or CRiSP) may or may not be fixed at a later
date. Although the facilities described have been extensively tested, the language and tools have been
designed to provide an efficient and portable user interface to the editor. Any private use of these facilities
which lead to core dumps, crashing of machines, or loss of files will not be construed as a deficiency in the
software supplied.

Where possible, errors leading to core dumps or machine crashes will be fixed if a suitable bug report form
(see User Guide for a copy) is enclosed. Due to the nature of programming it is not possible to guarantee
that every combination of primitives will lead to expected behaviour.

Getting started with Macro programming

This section is designed to introduce the basic things you need to know to write your own macro. If you
require further information, consult the introduction at the top of the Programmers Guide on-line help.

If you have never programmed a macro in CRiSP before then here are some tips to get you started:

The macro language (known as crunch) is an ANSI-C like macro language, e.g. you define functions which
are callable (from the Command: prompt, for example), and which can be assigned to keys. The macro
language provides numerous data types and internal builtin functions. The most common data types are
strings and integers. (crunch does not provide support for pointers, but you will find you do not need these
anyhow).

Macro files end in the file extension .cr. To create a macro file, edit a new file with the appropriate extension.
For example, create a macro file called mymacro.cr. Insert the following into the buffer:

Advertising