;ELC ;;; compiled by jwz@thalidomide on Mon Nov 8 12:22:44 1993 ;;; from file /th/jwz/emacs19/lisp/utils/regi.el ;;; emacs version 19.9 Lucid. ;;; bytecomp version 2.20; 20-oct-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (fset 'regi-pos #[(&optional position col-p) "ŠÁ=«…Âyˆª¡Ã=«…Ä ˆª—Å=«…ÆyˆªÇ=«…ÈyˆªƒÉˆ\n«ƒiª`)‡" [position bol 0 boi back-to-indentation bonl 1 bopl -1 nil col-p] 2 "\ Return the character position at various buffer positions. Optional POSITION can be one of the following symbols: `bol' == beginning of line `boi' == beginning of indentation `eol' == end of line [default] `bonl' == beginning of next line `bopl' == beginning of previous line Optional COL-P non-nil returns `current-column' instead of character position."]) (fset 'regi-mapcar #[(predlist func &optional negate-p case-fold-search-p) "À‰ ¬ƒ «ƒ C «†Å C\"«¡@D «‡Å \"Å\nC\"A)ª[\n*‡" [nil tail frame negate-p case-fold-search-p append predlist func element] 3 "\ Build a regi frame where each element of PREDLIST appears exactly once. The frame contains elements where each member of PREDLIST is associated with FUNC, and optionally NEGATE-P and CASE-FOLD-SEARCH-P."]) (fset 'regi-interpret #[(frame &optional start end) "ŠŒÀ‰‰‰‰‰«¥«¡ ^‰]‰bˆÊË!bˆÊÌ!}ˆ+ÍÎ\"ˆÐ!ˆ\n ¬¬m¬© @‰@A@Ô8Ö8ÀÙÚˆ.Ð !ˆªQÐ !.‡" [nil donep working-frame current-frame every-tag end-tag begin-tag start end tstart regi-pos bonl bol mapcar #[(entry) "@A@‰Ã=«… ‰ªŸ\nÅ=«† ‰ª”\nÇ=«† ‰ª‰É\nC\"‰\n*‡" [entry func pred begin begin-tag end end-tag every every-tag append working-frame] 4] frame eval entry pred func 2 negate-p 3 case-fold-search match-p regi-throw-top (byte-code "¬Œ ÂyˆÃÄÅ\"ˆªÆ!‰;«†É!\n«…?«ÎËÌ!ËÍ!{Æ!ÔžA®ÂÕž«†ÕžAÖ>«…Aª†yˆ ×>«ˆÅÃÄÅ\"ˆ-ªƒA‡" [current-frame working-frame 1 throw regi-throw-top t eval pred match-p looking-at negate-p regi-pos bol eol curline curframe entry curentry func result step frame continue abort donep] 3)] 7 "\ Interpret the regi frame FRAME. If optional START and END are supplied, they indicate the region of interest, and the buffer is narrowed to the beginning of the line containing START, and beginning of the line after the line containing END. Otherwise, point and mark are not set and processing continues until your FUNC returns the `abort' symbol (see below). Beware! Not supplying a START or END could put you in an infinite loop. A regi frame is a list of entries of the form: (PRED FUNC [NEGATE-P [CASE-FOLD-SEARCH]]) PRED is a predicate against which each line in the region is tested, and if a match occurs, FUNC is `eval'd. Point is then moved to the beginning of the next line, the frame is reset and checking continues. If a match doesn't occur, the next entry is checked against the current line until all entries in the frame are checked. At this point, if no match occurred, the frame is reset and point is moved to the next line. Checking continues until every line in the region is checked. Optional NEGATE-P inverts the result of PRED before FUNC is called and `case-fold-search' is bound to the optional value of CASE-FOLD-SEARCH for the PRED check. PRED can be a string, variable, function or one of the following symbols: t, nil, `begin', `end', and `every'. If PRED is a string, or a variable or list that evaluates to a string, it is interpreted as a regular expression and is matched against the current line (from the beginning) using `looking-at'. If PRED does not evaluate to a string, it is interpreted as a binary value (nil or non-nil). PRED can also be one of the following symbols: t -- always produces a true outcome `begin' -- always executes before anything else `end' -- always executes after everything else `every' -- execute after frame is matched on a line Note that NEGATE-P and CASE-FOLD-SEARCH are meaningless if PRED is one of these special symbols. Only the first occurance of each symbol in a frame entry is used, the rest are ignored. Your FUNC can return values which control regi processing. If a list is returned from your function, it can contain any combination of the following elements: the symbol `continue' Tells regi to continue processing frame-entries after a match, instead of resetting to the first entry and advancing to the next line, as is the default behavior. When returning this symbol, you must take care not to enter an infinite loop. the symbol `abort' Tells regi to terminate processing this frame. any end frame-entry is still processed. the list `(frame . NEWFRAME)' Tells regi to use NEWFRAME as its current frame. In other words, your FUNC can modify the executing regi frame on the fly. the list `(step . STEP)' Tells regi to move STEP number of lines forward during normal processing. By default, regi moves forward 1 line. STEP can be negative, but be careful of infinite loops. You should usually take care to explicitly return nil from your function if no action is to take place. Your FUNC will always be `eval'ed. The following variables will be temporarily bound to some useful information: `curline' the current line in the buffer, as a string `curframe' the full, current frame being executed `curentry' the current frame entry being executed."]) (provide 'regi)