Re: [AC21.5] Give precise version information in Help->About XEmacs

"Stephen J. Turnbull" <[email protected]> Mon, 11 Oct 2004 11:45:27 +0900
Newsgroups gmane.emacs.xemacs.patches,gmane.emacs.xemacs.design
Organization Graduate School of Systems and Information Engineering University of Tsukuba
Message-ID <[email protected]>
Reply-To set to xemacs-design.

>>>>> "APA" == Adrian Aichner <[email protected]> writes:

    APA> Whenever changes to version.sh or Installation file contents
    APA> or formats a designed, let's please take it's implications on
    APA> build-report.el into account.

There should be no backward-incompatible effects of version.sh changes
if build-report is coded defensively.  Just use a dictionary instead
of a fixed ordered list of variables when parsing the file.  We have
been careful only to add fields in that file so far, and I see no
reason why that can't be imposed as a restriction on future formats
for the file.  So if you do something like

(defconst b-r-p-v-s-regexp "^\\([^=]*\\)=\\(.*\\)$"
  "Since that's actually shell assignments, the RE should chomp WS.")

(defun b-r-p-v-s-handle-parse-error ()
  "Dunno what this should do, ask Adrian."
  (warn "Unparsable input from version.sh; are you sure XEmacs is OK?"))

(defun build-report-parse-version-sh-1 (filename)
  (find-file filename)
  (let ((dict ()))
    (while (not (eobp))
      (unless (looking-at "^#")
        (if (not (looking-at b-r-p-v-s-regexp))
            (b-r-p-v-s-handle-parse-error)
          (push (cons (match-string 1) (match-string 2)) dict)))
      (forward-line 1))
      dict))

and access the fields by name instead of hard-coding variables, you'll
have no problem.  You could also use `intern' to create those
variables on the fly:

(defsubst build-report-define-version-variable (name val)
  (set (intern (subst-char-in-string ?_ ?- name))
       val))

(defun build-report-parse-version-sh-2 (filename)
  (find-file filename)
  (while (not (eobp))
    (unless (looking-at "^#")
      (if (not (looking-at b-r-p-v-s-regexp))
          (b-r-p-v-s-handle-parse-error)
        (build-report-define-version-variable (match-string 1)
                                              (match-string 2)))
      (forward-line 1))))

although IMO this makes build-report harder to code and understand.

As for Installation, what does build-report.el need to parse out of
that?  I thought build-report just copied the whole thing into the
report.

If you still need special consideration for build-report, please add
comments specifying what build-report can and can't handle in the
appropriate places to version.sh and Installation so other developers
will know.


-- 
Graduate School of Systems and Information Engineering   University of Tsukuba
http://turnbull.sk.tsukuba.ac.jp/        Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
        Economics of Information Communication and Computation Systems
          Experimental Economics, Microeconomic Theory, Game Theory