Streszczenie treści zawartej na stronie nr. 1
CRiSP File Editor
Programmers Guide
Version 6
© 1998 Foxtrot Systems Ltd
www.pacemaker.co.uk
sales@pacemaker.co.uk
fox@crisp.demon.co.uk
Page 1
Streszczenie treści zawartej na stronie nr. 2
Introduction 7 77 7 Disclaimer 7 77 7 Getting started with Macro programming 7 77 7 An Overview of the Programming Facilities 8888 99 Writing your own macros 99 110 0 Tools Overview 110 0 crtags: cross-referencing source files 10 File formats 11 Specifying Directories 11 Language Mapping switches 11 General switches 11 Filename filtering 12 Output file format 12 Language specifications" 13 Language element feature selection 13 Languages 13 The CRUNCH Language 11114 4 4 4 The crunch compiler 14 D
Streszczenie treści zawartej na stronie nr. 3
List assignment 23 Making Lists 23 Manipulating List Items 24 Sorting Lists 24 Searching Lists 24 Informational Lists 24 The declare datatype 25 Structures 25 Language Grammar 25 Declarations 26 Function definitions 27 Loading a macro: main, _init 27 Expressions 27 Loop constructs: for, while, do 28 Testing expressions: if 29 Selection: switch 29 330 0 Debugging macros 330 0 Primitives for showing output 30 Macro tracing 31 Debug applied to a function 32 Debug on startup 32 Debug buffering 33 Th
Streszczenie treści zawartej na stronie nr. 4
Current cursor position 35 Modified Flag 35 Permissions & Read-only Flag 35 Process Buffers 36 Region Markers 36 Symbol Table 36 System Buffers 36 Tab Settings 36 Undo Information 36 Character Maps 37 Objects supported by CRiSP 33338888 File Types -- Text files and Binary Files 39 Backing up Files 39 Autosaving 39 Core dumping 40 Regions and markers 40 Macros 41 Global and Static macros 41 Modules and static macros 42 Registered Macros 42 Timer functions 45 Color Support 46 Searching for text --
Streszczenie treści zawartej na stronie nr. 5
GUI Based Objects 55551111 Terminology 52 Windowing Systems Programming 52 Overview of the Dialog box system 53 Overview of an Object 54 Creating a Dialog Box 55 Object Types 56 Geometry Layout 59 Resizing dialog boxes, and Constraint management 60 Object hierarchies: menu bars, tool bars, status panels 62 Object hierarchies and grouping 63 Sub-groups 64 Groups and the DBOX_CONTAINER object 65 Properties (private symbols) 65 Dialog boxes and Callbacks 66 Platform Specific Issues 67 6677 How to c
Streszczenie treści zawartej na stronie nr. 6
Case study #2: Fortran colorizer 78 Interprocess Communication and CRiSP 7 77 79999 IPC Mechanisms 79 IPC Primitives 80 IPC Callbacks 80 TCP/UDP Communications 81 Pipe Communications 84 PTY Communications 84 DDE Communications 85 Signals Communications 86 Keyboard objects 88887 77 7 CRUNCH: Things to watch out for 99990 0 0 0 The cm compiler 99990 0 0 0 Page 6
Streszczenie treści zawartej na stronie nr. 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 ma
Streszczenie treści zawartej na stronie nr. 8
# include void mymacro() { message("This is my macro!"); } The #include statement is something you will need sooner or later in the macros you write. Although it is not needed for this simple macro, you may need it as you extend your macro. The crisp.h file contains numerous constant definitions which you need for some of the builtin functions of CRiSP. This macro file contains a single macro, called mymacro. You can execute this macro after you have compiled and loaded the macro. On m
Streszczenie treści zawartej na stronie nr. 9
→Writing your own macros(pg. 9). →The .m language(pg. 90). →The crunch language(pg. 14). Writing your own macros Private macros can be loosely categorized into two types: small one-off macros which are used to make some piece of functionality easier to use (e.g. mapping certain editing commands to special keystrokes), or major projects in their own right. The entirety of the CRiSP product can be broken down into major subsystems (Unix mail, the setup dialog boxes) or simple value-added service
Streszczenie treści zawartej na stronie nr. 10
the usability features of CRiSP but also contain useful real-life examples of various aspects of CRiSP macro programming. 3. Where possibly, try and maintain a macro programming style. Do not write throwaway macros - treat them with respect. For example, format them nicely, comment them, lay them out well. You will find it so much easier to revisit your macros at a later date, or if you need to pass them on to people, they will actually understand your code. Of course, this is what you should be
Streszczenie treści zawartej na stronie nr. 11
crtags [switches] file1 file2 .... You can use Unix style wild cards for the filenames, even on the Windows platforms. The command line switches can be grouped into three types: - general purpose switches affecting the crtags program, - output file format switches - language sensitive element switches File formats crtags creates a tags file. Two file formats are supported: text and binary. The binary format is smaller and contains more information needed by CRiSP's cross-referencing facility (th
Streszczenie treści zawartej na stronie nr. 12
included on the command line. This allows you to generate a list of files and store them in a file rather than being exposed to the command line limitations of certain operating systems. Multiple -I switches can be specified on the command line and can be intermingled with normal files. If you use this switch is must be the last switch on the command line. -ignorecase When sorting the tags file during the output stage, ignore the case of data elements. -len nnn Specifies the length of the contex
Streszczenie treści zawartej na stronie nr. 13
These switches allow you to specify the output file format. -tags Output is compatible with the Unix ctags program and hence the tags database can be used with other editors such as vi. -text Output file in textual format. Useful for diagnosing the output. -crtags (Default) Proprietary file format designed to be used in conjunction with CRiSP. Although this file format is liable to change in the future, it provides more information in the tags file which at some point in the future will be used
Streszczenie treści zawartej na stronie nr. 14
SQL .sql TeX .tex Perl .pl, .pm Verilog .v, .verilog VHD .vhd, .vhdl Yacc grammars .y Note that crtags uses a fuzzy-parsingfuzzy parsing mechanism to scan source files. This has the advantage of working in spite of any syntax errors and avoids the complexity of worrying about compile-time constant definitions which may affect the flow of the parsing (e.g. in the presence of #ifdef constructs). The down-side of this is that the parsing may not be 100% correct as seen from the point of view of the
Streszczenie treści zawartej na stronie nr. 15
ready for loading into CRiSP. The crunch program uses its own internal preprocessor which is very ANSI-C like. By doing this gives the user more portability of macros and avoids common differences between standard preprocessors. Next the intermediate file is converted directly to the binary output file. Crunch has a number of switches: -c Compiles the source file to a .m file. This is useful for understanding the translation process or to check for bugs in the compiler. If you have any problems
Streszczenie treści zawartej na stronie nr. 16
int(pg. 32-bit signed integer. 21). float(pg. 64-bit floating point value. 21). string(p Variable length string. g. 21). list(pg. Arbitrary collection of objects, similar to an array. Lists may contain nested lists, and 22). can be used like a structure or array. declare( Used to define a polymorphic variable - one that can contain a value of any type. pg. 25). As well as these primitive data types, CRiSP also supports complex data types(pg. 38). used to refer to particular instances of objects
Streszczenie treści zawartej na stronie nr. 17
{button See Also, ALink(crunch,,,)} Scoping All variables created have a scope of visibility. CRiSP supports a number of scopes of visibility: static, local, global and buffer-local. Global variables are always available to macros and retain their values from one function to another. Local variables exist from the point at which they are defined to the end of the current block. The current block is defined as the current level of curly brackets. Static variables are variables which are local
Streszczenie treści zawartej na stronie nr. 18
not found, CRiSP then searches the current block level - 1. At this block level, the definitions are found. When a variable is accessed, CRiSP needs to locate the symbol definition dynamically. The order of processing is as follows: 1. First a check is made for a static variable definition in the current function. 2. If no value is found as a buffer local variable, then CRiSP will try the current local variables of a function. 3. If no value is found as a static variable then CRiSP will try a bu
Streszczenie treści zawartej na stronie nr. 19
int sum() { int arg_no = 0; int sum = 0; int arg; while (get_parm(arg_no, sum) > 0) sum += arg; return sum; } Crunch performs limited prototype validation and this is designed to catch inconsistent coding errors. You should therefore always specify prototypes for external functions so that CRUNCH can check that arguments agree. (CRUNCH cannot perform a complete type-safe check because variables can be declared as polymorphic, in w
Streszczenie treści zawartej na stronie nr. 20
Variable argument lists CRiSP supports a variety of mechanisms which allow for variable numbers of arguments to be passed to macros. As described above the get_parm() and put_parm() primitives are used to access arguments to macros. A useful addition to these primitives is the arg_list() primitive. This primitive returns a list representing the arguments passed to the calling macro. This list can then normally be used as an argument to further macros to allow for the fact that the called macr