This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Guile docstrings---should Guile code be ANSI C compatible?


mstachow@alum.mit.edu writes:

 > I guess we still need to figure out a way to make the docstring editing
 > reasonable in the correct format, since they need to end up that way
 > eventually.
 > 
 > I guess this plan sounds reasonable, but I am wary of pervasive code
 > changes that are slated to happen "right before release". It sounds like
 > a great way to introduce last-minute bugs.

please find below some maintenance elisp that does docstring
ANSIfication, taking into account that files are under version control.
save it to maint.el at the top level, then from the shell you can say:

	emacs -batch -l maint.el -f batch-ansify-docstrings

this step could be added to RELEASE, which should probably be completely
codified so that one could do "M-x release-guile".

thi


----------------------------------
;;; maint.el
;;; author: ttn

(defun ansify-docstrings (file)
  (interactive "fFile: ")
  (edit-vc-file file "ANSI-fy docstrings."
    (goto-char (point-min))
    (while (re-search-forward "^SCM_DEFINE" (point-max) t)
      (forward-sexp 1)
      (forward-char -1)
      (let ((docstring-beg (save-excursion (forward-sexp -1) (point))))
	(while (< docstring-beg (point))
	  (beginning-of-line)
	  (forward-char -1)
	  (let ((p (point)))
	    (when (and (> p docstring-beg)
		       (not (string= (buffer-substring (- p 3) p) "\\n\\")))
	      (insert "\\n\\")))))))
  (kill-buffer (current-buffer)))

(defun batch-ansify-docstrings ()
  (mapcar 'ansify-docstrings
	  (split-string
	   (shell-command-to-string
	    "find . -name '*.c' -exec grep -l SCM_DEFINE {} \\;"))))

;;; maint.el ends here

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]