(eval-when-compile
(let ((load-path
(if (and (boundp 'byte-compile-dest-file)
(stringp byte-compile-dest-file))
(cons (file-name-directory byte-compile-dest-file) load-path)
load-path)))
(load "cc-bytecomp" nil t)))
(cc-require 'cc-defs)
(cc-require 'cc-vars)
(cc-require 'cc-styles)
(cc-require 'cc-engine)
(defvar c-indent-level 2
"*Indentation of C statements with respect to containing block.")
(defvar c-brace-imaginary-offset 0
"*Imagined indentation of a C open brace that actually follows a statement.")
(defvar c-brace-offset 0
"*Extra indentation for braces, compared with other text in same context.")
(defvar c-argdecl-indent 5
"*Indentation level of declarations of C function arguments.")
(defvar c-label-offset -2
"*Offset of C label lines and case statements relative to usual indentation.")
(defvar c-continued-statement-offset 2
"*Extra indent for lines not starting new statements.")
(defvar c-continued-brace-offset 0
"*Extra indent for substatements that start with open-braces.
This is in addition to c-continued-statement-offset.")
(let* ((offsets '(c-offsets-alist .
((defun-block-intro . cc-block-intro-offset)
(statement-block-intro . cc-block-intro-offset)
(defun-open . 0)
(class-open . 0)
(inline-open . c-brace-offset)
(block-open . c-brace-offset)
(block-close . cc-block-close-offset)
(brace-list-open . c-brace-offset)
(substatement-open . cc-substatement-open-offset)
(substatement . c-continued-statement-offset)
(knr-argdecl-intro . c-argdecl-indent)
(case-label . c-label-offset)
(access-label . c-label-offset)
(label . c-label-offset)
))))
(c-add-style "BOCM" offsets))
(defun cc-block-intro-offset (langelem)
(save-excursion
(c-backward-syntactic-ws)
(if (eq (char-before) ?{)
(forward-char -1)
(goto-char (cdr langelem)))
(let* ((curcol (save-excursion
(goto-char (cdr langelem))
(current-column)))
(bocm-lossage
(+ (if (and (bolp) (zerop c-indent-level))
(+ c-brace-offset c-continued-statement-offset)
c-indent-level)
(progn (skip-chars-backward " \t")
(if (bolp) 0 c-brace-imaginary-offset))
(progn
(if (eq (char-before) ?\))
(c-forward-sexp -1))
(current-indentation)))))
(- bocm-lossage curcol))))
(defun cc-block-close-offset (langelem)
(save-excursion
(let* ((here (point))
bracep
(curcol (progn
(goto-char (cdr langelem))
(current-column)))
(bocm-lossage (progn
(goto-char (cdr langelem))
(if (eq (char-after) ?{)
(setq bracep t)
(goto-char here)
(beginning-of-line)
(backward-up-list 1)
(forward-char 1)
(c-forward-syntactic-ws))
(current-column))))
(- bocm-lossage curcol
(if bracep 0 c-indent-level)))))
(defun cc-substatement-open-offset (langelem)
(+ c-continued-statement-offset c-continued-brace-offset))
(cc-provide 'cc-compat)