;;; product.el --- Functions for product version information.
-;; Copyright (C) 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1999,2000 Free Software Foundation, Inc.
;; Author: Shuhei KOBAYASHI <shuhei@aqua.ocn.ne.jp>
;; Keiichi Suzuki <keiichi@nanap.org>
"Set code-name of PRODUCT to CODE-NAME."
(aset product 3 code-name))
(defun product-set-checkers (product checkers)
- "Set ckecker functions of PRODUCT to CHECKERS."
+ "Set checker functions of PRODUCT to CHECKERS."
(aset product 4 checkers))
(defun product-set-family-products (product products)
"Set family products of PRODUCT to PRODUCTS."
"Add checker function(s) to a product.
PRODUCT is a product structure which returned by `product-define'.
The rest arguments CHECKERS should be functions. These functions
-are regist to the product's checkers list, and will be called by
+are registered to the product's checkers list, and will be called by
`product-run-checkers'.
If a checker is `ignore' will be ignored all checkers after this."
(setq product (product-find product))
(defun product-find (product)
"Find product information.
-If PROCUCT is a product structure, then return PRODUCT itself.
+If PRODUCT is a product structure, then return PRODUCT itself.
If PRODUCT is a string, then find product by name and return a
product structure. If PRODUCT is symbol of feature, then return
the feature's product."
nil nil nil (, product-version-string)))))
(, feature-def)))))
+(defun product-version-as-string (product)
+ "Return version number of product as a string.
+PRODUCT is a product structure which returned by `product-define'.
+If optional argument UPDATE is non-nil, then regenerate
+`produce-version-string' from `product-version'."
+ (setq product (product-find product))
+ (or (product-version-string product)
+ (and (product-version product)
+ (product-set-version-string product
+ (mapconcat (function int-to-string)
+ (product-version product)
+ ".")))))
+
(defun product-string-1 (product &optional verbose)
"Return information of product as a string of \"NAME/VERSION\".
PRODUCT is a product structure which returned by `product-define'.
\"NAME/VERSION (CODE-NAME)\"."
(setq product (product-find product))
(concat (product-name product)
- (cond
- ((product-version-string product)
- (concat "/" (product-version-string product)))
- ((product-version product)
- (concat "/"
- (product-set-version-string
- product
- (mapconcat (function int-to-string)
- (product-version product)
- "."))))
- (""))
- (if (and verbose (product-code-name product))
- (concat " (" (product-code-name product) ")")
- "")))
+ (let ((version-string (product-version-as-string product)))
+ (and version-string
+ (concat "/" version-string)))
+ (and verbose (product-code-name product)
+ (concat " (" (product-code-name product) ")"))))
(defun product-for-each (product all function &rest args)
"Apply a function to a product and the product's family with args.