;;; Source file: c-mode.jl
;;; Compiled by <unknown username>@holly on Sat Feb 01 21:06:54 1997
;;; Jade 3.2

(provide (quote c-mode))

(defvar c-mode-tab 2 "Size of indentation for c-mode")

(defvar c-mode-keymap (make-keylist))

(bind-keys c-mode-keymap "{" (quote c-open-brace) "}" (quote c-close-brace) ";" (quote c-semi-colon) "RET" (quote split-line) "TAB" (quote indent-line))

"BS"

(quote back-space)

(defvar c-mode-ctrl-c-keymap (make-keylist))

(bind-keys c-mode-ctrl-c-keymap "Ctrl-\\" (quote c-backslash-region))

(defun c-mode nil "C Mode:

Simple mode for editing C source code. Its main feature is to be able to
indent lines to their (probably) correct depth.

Special commands are,

  `{', `}', `;'			Insert the character then indent the line
  `TAB'				Indent the current line
  `Ctrl-c Ctrl-\\'		Aligns backslash characters at the end
				of each line in the current block.
  `ESC Ctrl-b'			Move backwards one expression.
  `ESC Ctrl-f'			Move forward one expression." (interactive) (jade-byte-code " 	I
H#% &	&
&&&KF&H	" [major-mode-kill funcall "C" mode-name c-mode major-mode c-mode-kill c-insert-comment mode-comment-fun c-indent-line mode-indent-line c-forward-exp mode-forward-exp c-backward-exp mode-backward-exp c-mode-ctrl-c-keymap ctrl-c-keymap c-mode-keymap keymap-path eval-hook c-mode-hook] 3))

(defun c-mode-kill nil (jade-byte-code "I I!I\"I#I$I%I&I&	F&	" [mode-name major-mode major-mode-kill mode-comment-fun mode-indent-line mode-forward-exp mode-backward-exp ctrl-c-keymap c-mode-keymap keymap-path] 2))

(defun c-semi-colon nil (interactive) (jade-byte-code "	HH" [insert ";" indent-line split-line] 2))

(defun c-open-brace nil (interactive) (jade-byte-code "	HH" [insert "{" split-line indent-line] 2))

(defun c-close-brace nil (interactive) (jade-byte-code "	H" [insert "}" indent-line] 2))

(defun c-indent-line (&optional pos) "Indent the line at POS (or the cursor) assuming that it's C source code." (jade-byte-code "		" [set-indent-pos c-indent-pos pos] 3))

(defun c-indent-pos (&optional line-pos) "*Attempts* to guess the correct indentation for this line. Returns the
position for the first non-space in the line." (jade-byte-code "	F!HD	3	] 7
 %	 7

 6
 7IHE" [line-start line-pos c-indent-pos-empty ind-pos empty-line-p regexp-match-line "^[	 ]*({|}|case .*:|default *:)" prev-tab 1 c-mode-tab "^[	 ]*([a-zA-Z0-9_]*:|#)" set-pos-col 0] 4))

(defun c-indent-pos-empty (&optional line-pos) "Returns the position for the first non-space in the line. Bases its guess
upon the assumption that the line is empty.
All positions depend on the indentation of the previous line(s)." (jade-byte-code "	F!HD	
5	 
 +
 'I~H HD		6

	
H
 Q
 
 
H	 l
 |
 xI~H _H
 
] 
 
 
 

 
 

 
 

 IH
EE" [line-start line-pos prev-line 1 copy-pos p-line-pos empty-line-p regexp-match-line "^([a-zA-Z0-9_]+:|#)" indent-pos ind-pos set-pos-line pos-line "{|case .*:|default[	 ]*:|do($| )|else|(if|for|while|switch)[	 ]*\\(.*\\)" next-tab c-mode-tab ";" "do($| )|else|(if|for|while|switch)[	 ]*\\(.*\\)" " {[	 ]*(/\\*.*\\*/|)[	 ]*$" prev-tab "^[	 ]*/\\*" "\\*/" right-char 3 "^[	 ]*\\*/ *$" left-char] 4))

(defun c-backslash-area (start end) "Insert (or align) backslash characters at the end of each line in between
START and END except for the last line." (interactive "-m
M") (jade-byte-code "D	I345g 6		F#H		d )		F%H

F$H 	HhF%H[b OZhYF%H	
H
Hf 
 	F#H		d 	
 		f 	H	 I 		H	H	H

F$H _H	E" [0 copy-pos start tmp pos max-width end char-to-glyph-pos line-end pos-col next-line 1 tab-size set-pos-line pos-line set-pos-col regexp-match-line "\\\\ *$" match-start delete-area glyph-to-char-pos goto-char indent-to insert "\\"] 4))

(defun c-insert-comment nil (interactive) (jade-byte-code "H	H	" [find-comment-pos insert "/*  */" goto-left-char 3] 2))

(defun c-forward-exp (&optional number pos) (jade-byte-code " F Hdk
 P
 4
 +	
	HF% L	
F%Hd L		H H
 c	F%g
 pF%H
 F%H	` 
F%H qHD	6 

F% 	
	b 

F% 		H  		H
F%a	F%	 	H
F%a!$
%hF a\"4	#	aJ`$
HF%]%
F%X	&	HhF aIEHiF H H" [number 1 0 looking-at "[	 ]*$|[	 ]*/\\*.*$" pos "[	 ]*/\\*" find-next-regexp "\\*/" error "Comment doesn't end!" match-end next-line line-start buffer-end "End of buffer" regexp-match-line "^[	 ]*#" line-end "[	 ]+" "[!*~&<>/+%?:^-]+" next-char get-char c (34 39) find-next-char prev-char copy-pos 92 "String doesn't end!" (40 91 123) match-brackets "Expression doesn't end!" (44 59 58) (41 93 125) "End of containing expression" "[a-zA-Z0-9_]+" "[][a-zA-Z0-9_ 	()<>{}'\"]" "Can't classify expression"] 5))

(defun c-backward-exp (&optional number orig-pos no-blocks) (jade-byte-code " F H F\"HD	I56d	


F& 6	H
	
F%H
 y
F% [	H	


F% p	HF&H BH
 	F&D	6 c ] 	F& 	l


F&
	
	b


F& 	H 	l hF l!.\"	lJk#
Q$
F&N%	h&
F&c%	HhF lIH
	
	'

F&EHiF H HE" [number 1 orig-pos cursor-pos copy-pos tmp pos 0 find-prev-regexp "[^	 ]" prev-char error "No expression!" looking-at "\\*/" "/\\*" "Comment doesn't start!" "Beginning of buffer" regexp-match-line "^[	 ]*#" line-start get-char c (41 93 125) 125 no-blocks match-brackets "Brackets don't match" (34 39) find-prev-char 92 "String doesn't start!" (59 58 44) (40 91 123) "Start of containing expression" "[a-zA-Z0-9_]" "(^#[	 ]*|)[a-zA-Z0-9_]+" "Can't classify expression" "[][a-zA-Z0-9_ 	()<>{}'\"]" (33 42 45 126)] 5))
