Crunch CRiSP File Editor 6 User Manual

Browse online or download User Manual for Routers Crunch CRiSP File Editor 6. Crunch CRiSP File Editor 6 User Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 92
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 0
Page 1
CRiSP File Editor
Programmers Guide
Version 6
© 1998 Foxtrot Systems Ltd
www.pacemaker.co.uk
Page view 0
1 2 3 4 5 6 ... 91 92

Summary of Contents

Page 1 - Programmers Guide

Page 1CRiSP File EditorProgrammers GuideVersion 6© 1998 Foxtrot Systems [email protected]@crisp.demon.co.uk

Page 2

Page 10the usability features of CRiSP but also contain useful real-life examples of various aspects of CRiSPmacro programming.3. Where possibly, try

Page 3

Page 11crtags [switches] file1 file2 ...You can use Unix style wild cards for the filenames, even on the Windows platforms.The command line switches

Page 4

Page 12included on the command line. This allows you to generate a list of files and store them ina file rather than being exposed to the command line

Page 5

Page 13These switches allow you to specify the output file format.-tags Output is compatible with the Unix ctags program and hence the tags database c

Page 6

Page 14SQL .sqlTeX .texPerl .pl, .pmVerilog .v, .verilogVHD .vhd, .vhdlYacc grammars .yNote that crtags uses a fuzzy-parsingfuzzy parsing mechanism to

Page 7 - Disclaimer

Page 15ready for loading into CRiSP. The crunch program uses its own internal preprocessor which is very ANSI-Clike. By doing this gives the user more

Page 8

Page 16int(pg.21).32-bit signed integer.float(pg.21).64-bit floating point value.string(pg. 21).Variable length string.list(pg.22).Arbitrary collectio

Page 9 - Writing your own macros

Page 17{button See Also, ALink(crunch,,,)} ScopingAll variables created have a scope of visibility. CRiSP supports a number of scopes of visibility:

Page 10 - <Alt-F10>

Page 18not found, CRiSP then searches the current block level - 1. At this block level, the definitions are found.When a variable is accessed, CRiSP n

Page 11 - General switches

Page 19int sum(){ int arg_no = 0; int sum = 0; int arg; while (get_parm(arg_no, sum) > 0) sum

Page 12 - Filename filtering

Page 2Introduction 7777Disclaimer 7777Getting started with Macro programming 7777An Overview of the Programming Facilities 8888Writing your own macros

Page 13 - Languages

Page 20 Variable argument listsCRiSP supports a variety of mechanisms which allow for variable numbers of arguments to be passed tomacros. As descri

Page 14 - The crunch compiler

Page 21{d = max(a, b, c);}Note the ampersand after the type specifier for the last parameter in the list. Variables which are passed byreference are n

Page 15 - Data types

Page 22string length. string:definitionStorage for strings is dynamically allocated so no space needs to be preallocated for them.Strings may be combi

Page 16

Page 23The following sections describe various aspects of list management in more detail:List assignment(pg. 23).Making lists(pg. 23).Manipulating lis

Page 17 - Scoping

Page 24The make_list primitive is similar to quote_list() but each argument is evaluated in turn. For example:list qlst. mlst;qlst = quote_list(1, qls

Page 18 - Argument Passing

Page 25PrimitiveDescriptionbookmark_listList of bookmarks (placeholders).command_listList of primitives built into CRiSP.dict_listList of all symbols

Page 19

Page 26→ Function definitions(pg. 27).→ Expressions(pg. 27).→ Loop constructs(pg. 28).→ Conditional test - if(pg. 29).→ Selection: switch(pg. 29).{but

Page 20 - Variable argument lists

Page 27list l = { "Item-1", {1, 2, 3}, "Item-2", "hello mum","Item-3", 3.14159, /* Trailing c

Page 21 - The string datatype

Page 28binary | l -> rbinary && l -> rbinary

Page 22 - The list (array) datatype

Page 29The init-expr is evaluated first. Next the while-expr is evaluated, and if it evaluates to TRUE, then statementis executed. After statement is

Page 23 - Making Lists

Page 3List assignment 23Making Lists 23Manipulating List Items 24Sorting Lists 24Searching Lists 24Informational Lists 24The declare datatype 25Struct

Page 24 - Informational Lists

Page 30 case 1: case 2: do_something(); break; case 3: case 4: do_som

Page 25 - Language Grammar

Page 31messages on <stdout>. This function is only really useful if you are using a GUI version ofCRiSP, since otherwise the printf() output wil

Page 26 - Declarations

Page 32:/home/fox/bin:/usr/openwin/bin:/usr/openwin/demo:/usr/local/crisp/bin.sun4:/develop/sun4/bin:/develop/scripts:/develop/scripts:/develop/script

Page 27 - Expressions

Page 33switch is at the end of the command Debug bufferingOutput written to the crisp.log file is normally performed using buffered I/O. Sometimes it

Page 28

Page 34files which many other editors or standard utilities cannot cope with. Buffer AttributesEach buffer has a number of attributes or modes associa

Page 29 - Selection: switch

Page 35these files, CRiSP breaks up binary files into lines containing only 32 characters. To avoid problems if thefile is modified and written away,

Page 30 - Debugging macros

Page 36frequently annoying problem with vi(1)). The user can clear the read-only bit for a buffer by calling themake_writable macro (available from th

Page 31 - Macro tracing

Page 37All undo information is undoable itself. This is termed redo. Character MapsA character map is a way of viewing data through a window. Characte

Page 32 - Debug on startup

Page 38associated with it. When they are displayed in a window the character map associated with the window isused to view the buffer. (Windows always

Page 33 - Buffers, Files and Windows

Page 39timer(pg.45).CriSP supports callbacks based on an elapsed real-time clock.window(pg.33).A window is a character mode window with a view on to a

Page 34 - The Binary Flag

Page 4Current cursor position 35Modified Flag 35Permissions & Read-only Flag 35Process Buffers 36Region Markers 36Symbol Table 36System Buffers 36

Page 35

Page 40Autosaving is a feature enabled by default, whereby any modified files (buffers) within the current editingsession are saved at 60 second inter

Page 36

Page 41KeyDescription<Alt-L> Drops a line marker. When a cut or copy command is issued, whole lines will beaffected in the operation.<Alt-C&g

Page 37 - Character Maps

Page 42Static macros are very useful, as they are in the C language, to hide private macros in a large macro so thatname conflicts do not occur either

Page 38 - Objects supported by CRiSP

Page 43An arbitrary number of macros may be registered for the same event. If more than one macro is registeredfor the same event, then the macros are

Page 39 - Autosaving

Page 44new file.17 (REG_FILE_MOD) This is the modified file trigger. It is called when Crisp detects thatthe corresponding file on disk for a buffer h

Page 40 - Regions and markers

Page 45undoing back to the point where the buffer no longer needs saving. You should call theinq_modified() primitive to determine which of the two st

Page 41 - Global and Static macros

Page 46Note that this timer mechanism is independent of the idle timer mechanism described elsewhere. The idletimer mechanism is specifically designed

Page 42 - Registered Macros

Page 4715COL_BG_STRINGSBackground color for string literals.16COL_FG_KEYWORDSForeground color for language keywords.17COL_BG_KEYWORDSBackground color

Page 43

Page 48<, %, ^ matches the beginning of a line.>, $ matches the end of a line.? matches any single character.* matches zero or more characters[.

Page 44

Page 49For example, the following expression:cat*dogmatches any line which contains the word cat followed by somewhere else on the line, the word dog.

Page 45 - Timer functions

Page 5GUI Based Objects 55551111Terminology 52Windowing Systems Programming 52Overview of the Dialog box system 53Overview of an Object 54Creating a D

Page 46 - Color Support

Page 50[A-Za-z]]+ matches the final word in a sentence. The '.' matches the full-stop after it. The expression [ ]@matches zero or more spac

Page 47

Page 51backward matching.The search macros - search_fwd, search_back, translate, search_string and search_list have a parameter,labelled 're&apos

Page 48 - Character Escaping

Page 52functionality because this can help to increase performance whilst keeping the macro interface fairly simple.One of the design goals of the mac

Page 49 - Repetition: @ and +

Page 53years, such organisations as Microsoft, IBM, and the OSF have strived to achieve the ultimate userinterface. None of these organisations has pr

Page 50 - Minimal and Maximal Matching

Page 54creating a dialog box.1. Firstly, we sketch or conjure up a mental model of what the dialog box is going to look like. E.g. weconsider the user

Page 51 - GUI Based Objects

Page 55it. At various times you need to refer to the individual objects within the dialog box, e.g. so that you canretrieve the current status of the

Page 52 - Terminology

Page 56 ...object-2 attributes for object-2 ... ...object-n attributes for object-n ...You will notice i

Page 53

Page 57oriented implementation.DBOX_DIRECTORY An list type object which contains semantics forimplementing a selection from a set of valid files ordir

Page 54 - Overview of an Object

Page 58DBOX_PANED_WINDOW A container object used to contain two child objects.The real-estate allocated to the children can bechanged by using a slide

Page 55 - Creating a Dialog Box

Page 59DBOX_TREE A tree-like widget which supports outlining views ofdata. A tree widget is a bit like a DBOX_LISTwidget but you can control the visib

Page 56 - Object Types

Page 6Case study #2: Fortran colorizer 78Interprocess Communication and CRiSP 77779999IPC Mechanisms 79IPC Primitives 80IPC Callbacks 80TCP/UDP Commun

Page 57

Page 60 DBOX_CENTERED, DBOX_BUTTON, " Apply ", DBOX_NEXT_COLUMN, TRUE, DBOX_CENTERED,

Page 58

Page 61When laying out a dialog box, CRiSP tries hard to avoid objects from overlapping, so it is normally safe touse the DBOX_ANCHOR attributes even

Page 59 - Geometry Layout

Page 62 /* The first object is an input field, */ /* and we have a label to the left of the */ /* input field. */ DBOX_FIE

Page 60

Page 63as children of a DBOX_TOOL_BAR.For the DBOX_MENU_BAR case, only DBOX_MENU_BUTTON or DBOX_DROP_SITE types arereasonable children. For DBOX_TOOL_

Page 61

Page 64dialog box.There is a solution to this, and it is called object-grouping. Object-grouping is a mechanism where youcreate a collection of object

Page 62

Page 65group is very similar to a normal group, but was designed to solve a different problem, and first came to lifewith the implementation of the DB

Page 63

Page 66every time you click that button, the number is incremented. Where do you store the current value of thelabel? (You can use the label itself, b

Page 64 - Sub-groups

Page 67CRiSP takes a Microsoft Windows style approach. CRiSP is an interpreter and the macro language can bestbe considered as a very powerful languag

Page 65 - Properties (private symbols)

Page 68This is a piece of CRiSP macro code. The CRiSP macro code looks and feels a lot like C. Withoutnecessarily knowing any of the details of the ma

Page 66 - Dialog boxes and Callbacks

Page 69definition is needed to tell CRiSP how to perform colorization of keywords for files of a particular type.CRiSP comes with a variety of support

Page 67 - Platform Specific Issues

Page 7. IntroductionDocument version: 1.002, date 24 November 1997This guide discusses how to write macros in the CRiSP extension language, known as

Page 68 - Keyword Builder

Page 70New Clears the dialog in preparation for typing in a new definition. You are prompted to saveany changes before the dialog box is cleared out.S

Page 69 - Dialog box buttons

Page 71colorizers available, based on the filename not the section name. The flags= DirectiveColorization:flags directiveThe flags= entry in a keywor

Page 70 - .KWD Keyword File Format

Page 72spell_textFor most languages, you would not spell check all the types of entities in your files. You wouldnormally restrict spell checking to t

Page 71 - The flags= Directive

Page 73Defines the characters which can form the 2nd and subsequent characters in a keyword or variablename. This may be different from the char_start

Page 72 - Character Class Directives

Page 74char_backslash=This class is used to redefined the backslash character. In many languages, backslash character isused to turn off (or escape) t

Page 73

Page 75→ More than one keyword can be specified on each line; each keyword is enclosed in double quotes.Backslashes are used inside the quotes to esca

Page 74 - Keyword Directives

Page 76 Keyword Regular ExpressionsColorization:keyword regular expressionsKeyword regular expressions are away of allowing generic styles of strings

Page 75 - Keyword Flags

Page 77inside the string, or any other non-printable character, you can use a backslash to affect the followingcharacters.In many languages, string co

Page 76 - Colorization:limitations

Page 78operator= "+=" "-=" "*=" "/=" "|=" "&=" "^=" "==" "!=&

Page 77 - Case study #1: C colorizer

Page 79keyword="union"keyword="while" "write" Interprocess Communication and CRiSPInterprocess communication is the mea

Page 78

Page 8# include <crisp.h>voidmymacro(){message("This is my macro!");}The #include statement is something you will need sooner or later

Page 79 - IPC Mechanisms

Page 80support these pipes. Windows/32 named pipes are more like TCP connection which allowtwo tasks on different machines to communicate.PTYs(pg. 84)

Page 80 - IPC Callbacks

Page 81The key to writing non-blocking macros is to write them based on callbacks, using the ipc_register() function.There are four conditions for whi

Page 81

Page 82Client Side Programming IssuesWhen using TCP to connect to a remote site, there may be some considerable delay in the connection beingaccepted,

Page 82 - IPC_TRIGGER_WRITE

Page 83/* We have either successfully or unsuccessfully *//* connected to the remote host. *//* We can tell the difference by whether the ipc_write */

Page 83

Page 84 Pipe CommunicationsThere are two forms of pipes which can be used: anonymous pipes and named pipes. Both types are verysimilarly - the differ

Page 84 - PTYPseudo

Page 85zero bytes, then the other end of the pipe has most likely terminated. Alternatively you may use theipc_register() callback to register notific

Page 85 - DDEProgram Manager

Page 86Client Side operationTo make a client request, you need to create an IPC channel and specify the name of the service and topicyou wish to conne

Page 86 - Signals Communications

Page 87mechanism.SignalsSIGUSR1SIGUSR2register_macroREG_SIGNALasync.crSignal based communicationThe SIGUSR1 and SIGUSR2 IPC mechanism is probably the

Page 87 - Keyboard objects

Page 88keyboard. When you press a key, CRiSP looks at the current buffer and looks to see if a local keyboard hasbeen defined for this buffer. If so,

Page 88 - Character based terminals

Page 89Scan CodesAs described above, CRiSP uses a set of key definitions which allow you to create macros which are notdependent on the keyboard and s

Page 89 - Scan Codes

Page 9→Writing your own macros(pg. 9).→The .m language(pg. 90).→The crunch language(pg. 14). Writing your own macrosPrivate macros can be loosely cat

Page 90 - The cm compiler

Page 90This populates the current keyboard with all the normal typeable characters (A..Z, a..z, 0..9, etc) sothat they are self-inserting (see self_in

Page 91

Page 91files are compiled directly into loadable files with a .cm extension).CRiSP can load .m files directly without any need for compilation, but th

Page 92

Page 92

Comments to this Manuals

No comments