From 4999ab33c45d7e5d11a7ef3a6a2e74e4a4aec57d Mon Sep 17 00:00:00 2001 From: David Aspinall Date: Sun, 9 Dec 2007 18:00:35 +0000 Subject: Fix some compile warnings: bug in pg-pgip-interpret-choice; move defsubsts to pg-xml.el --- generic/pg-pgip.el | 84 ++++++++++-------------------------------------------- 1 file changed, 15 insertions(+), 69 deletions(-) (limited to 'generic/pg-pgip.el') diff --git a/generic/pg-pgip.el b/generic/pg-pgip.el index 4a4dcccc..d2f1b68e 100644 --- a/generic/pg-pgip.el +++ b/generic/pg-pgip.el @@ -513,81 +513,27 @@ Also sets local proverid and srcid variables for buffer." (let (res) (while (and choices (not res)) (let ((type (car choices))) - ((eq (car-safe type) 'const) - (string-equal value (cadr type))) - (setq res (pg-pgip-interpret-const value 'const))) - ((and (eq type 'integer) - (string-match "[+-]?[0-9]+$" value)) - (setq res (pg-pgip-interpret-value value 'integer))) - ((and (eq type 'boolean) - (or (string-equal value "true") - (string-equal value "false") - (string-equal value "0") - (string-equal value "1"))) - (setq res (pg-pgip-interpret-value value 'boolean))) - ((eq type 'string) - (setq res (pg-pgip-interpret-value value 'string)))) + (cond + ((and (eq (car-safe type) 'const) + (string-equal value (cadr type))) + (setq res (pg-pgip-interpret-const value 'const))) + ((and (eq type 'integer) + (string-match "[+-]?[0-9]+$" value)) + (setq res (pg-pgip-interpret-value value 'integer))) + ((and (eq type 'boolean) + (or (string-equal value "true") + (string-equal value "false") + (string-equal value "0") + (string-equal value "1"))) + (setq res (pg-pgip-interpret-value value 'boolean))) + ((eq type 'string) + (setq res (pg-pgip-interpret-value value 'string))))) (setq choices (cdr choices))) (or res (pg-pgip-error "pg-pgip-interpret-choice: mismatching value %s for choices %s" value choices))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Auxiliary functions for parsing common bits of PGIP -;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(defun pg-pgip-get-icon (node &optional optional defaultval) - "Return the child of NODE, or nil if none." - (pg-xml-get-child 'icon node)) - -(defsubst pg-pgip-get-name (node &optional optional defaultval) - (pg-xml-get-attr 'name node optional defaultval)) - -(defsubst pg-pgip-get-version (node &optional optional defaultval) - (pg-xml-get-attr 'version node optional defaultval)) - -(defsubst pg-pgip-get-descr (node &optional optional defaultval) - (pg-xml-get-attr 'descr node optional defaultval)) - -(defsubst pg-pgip-get-thmname (node &optional optional defaultval) - (pg-xml-get-attr 'thmname node optional defaultval)) - -(defsubst pg-pgip-get-thyname (node &optional optional defaultval) - (pg-xml-get-attr 'thmname node optional defaultval)) - -(defsubst pg-pgip-get-url (node &optional optional defaultval) - (pg-xml-get-attr 'url node optional defaultval)) - -(defsubst pg-pgip-get-srcid (node &optional optional defaultval) - (pg-xml-get-attr 'srcid node optional defaultval)) - -(defsubst pg-pgip-get-proverid (node &optional optional defaultval) - (pg-xml-get-attr 'proverid node optional defaultval)) - -(defsubst pg-pgip-get-symname (node &optional optional defaultval) - (pg-xml-get-attr 'name node optional defaultval)) - -(defsubst pg-pgip-get-prefcat (node &optional optional defaultval) - (pg-xml-get-attr 'prefcategory node optional defaultval)) - -(defsubst pg-pgip-get-default (node &optional optional defaultval) - (pg-xml-get-attr 'default node optional defaultval)) - -(defsubst pg-pgip-get-objtype (node &optional optional defaultval) - (pg-xml-get-attr 'objtype node optional defaultval)) - -(defsubst pg-pgip-get-value (node) - (pg-xml-get-text-content node)) - -(defalias 'pg-pgip-get-displaytext 'pg-pgip-get-pgmltext) - -(defun pg-pgip-get-pgmltext (node) - ;; TODO: fetch text or markup XML with text properties - (pg-xml-get-text-content node)) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Sending PGIP commands to prover -- cgit v1.2.3