Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 103370. ------------------------------------------------------------ revno: 103370 committer: Chong Yidong branch nick: trunk timestamp: Mon 2011-02-21 01:03:36 -0500 message: Merge some code from hexrgb.el into color.el. * lisp/color.el (color-name-to-rgb): Rename from color-rgb->normalize. Autoload. Add optional arg FRAME, and pass it to color-values. (color-complement): Caller changed. Doc fix. (color-gradient): Rewrite for better clarity and efficiency. (color-rgb-to-hex): Rename from color-rgb->hex. (color-rgb-to-hsv): Rename from color-rgb->hsv. Force hue and saturation to zero if the value is too small. (color-rgb-to-hsl): Rename from color-rgb->hsl. (color-srgb-to-xyz): Rename from color-srgb->xyz. Doc fix. (color-xyz-to-srgb): Rename from color-xyz->srgb. Doc fix. (color-xyz-to-lab): Rename from color-xyz->lab. Doc fix. (color-lab-to-xyz): Rename from color-lab->xyz. Doc fix. (color-lab-to-srgb): Rename from color-lab->srgb. Doc fix. (color-cie-de2000): Doc fix. * lisp/facemenu.el (color-rgb-to-hsv): Deleted; use the version in lisp/color.el instead. (list-colors-sort-key, list-colors-print): Use color-normalized-values. * lisp/faces.el (color-values): Use cond for clarity. Doc fix. * lisp/gnus/shr-color.el (shr-color->hexadecimal): Use renamed function names color-rgb-to-hex, color-name-to-rgb, color-srgb-to-lab, and color-lab-to-srgb. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-20 18:35:30 +0000 +++ lisp/ChangeLog 2011-02-21 06:03:36 +0000 @@ -1,3 +1,31 @@ +2011-02-21 Chong Yidong + + * color.el (color-name-to-rgb): Rename from color-rgb->normalize. + Autoload. Add optional arg FRAME, and pass it to color-values. + (color-complement): Caller changed. Doc fix. + (color-gradient): Rewrite for better clarity and efficiency. + + * faces.el (color-values): Use cond for clarity. Doc fix. + + * facemenu.el (color-rgb-to-hsv): Deleted; use the version in + color.el instead. + (list-colors-sort-key, list-colors-print): Use + color-normalized-values. + +2011-02-20 Drew Adams + + * color.el: First part of merge from hexrgb.el. + (color-rgb-to-hex): Rename from color-rgb->hex. + (color-rgb-to-hsv): Rename from color-rgb->hsv. Force hue and + saturation to zero if the value is too small. + (color-rgb-to-hsl): Rename from color-rgb->hsl. + (color-srgb-to-xyz): Rename from color-srgb->xyz. Doc fix. + (color-xyz-to-srgb): Rename from color-xyz->srgb. Doc fix. + (color-xyz-to-lab): Rename from color-xyz->lab. Doc fix. + (color-lab-to-xyz): Rename from color-lab->xyz. Doc fix. + (color-lab-to-srgb): Rename from color-lab->srgb. Doc fix. + (color-cie-de2000): Doc fix. + 2011-02-20 Alan Mackenzie * progmodes/cc-cmds.el (c-beginning-of-statement): Avoid loop in === modified file 'lisp/color.el' --- lisp/color.el 2011-02-01 23:46:27 +0000 +++ lisp/color.el 2011-02-21 06:03:36 +0000 @@ -1,9 +1,10 @@ -;;; color.el --- Color manipulation laboratory routines -*- coding: utf-8; -*- +;;; color.el --- Color manipulation library -*- coding: utf-8; -*- ;; Copyright (C) 2010-2011 Free Software Foundation, Inc. -;; Author: Julien Danjou -;; Keywords: html +;; Authors: Julien Danjou +;; Drew Adams +;; Keywords: lisp, faces, color, hex, rgb, hsv, hsl, cie-lab, background ;; This file is part of GNU Emacs. @@ -22,7 +23,13 @@ ;;; Commentary: -;; This package provides color manipulation functions. +;; This package provides functions for manipulating colors, including +;; converting between color representations, computing color +;; complements, and computing CIEDE2000 color distances. +;; +;; Supported color representations include RGB (red, green, blue), HSV +;; (hue, saturation, value), HSL (hue, saturation, luminence), sRGB, +;; CIE XYZ, and CIE L*a*b* color components. ;;; Code: @@ -34,15 +41,31 @@ (unless (boundp 'float-pi) (defconst float-pi (* 4 (atan 1)) "The value of Pi (3.1415926...)."))) -(defun color-rgb->hex (red green blue) - "Return hexadecimal notation for RED GREEN BLUE color. -RED GREEN BLUE must be values between 0 and 1 inclusively." +;;;###autoload +(defun color-name-to-rgb (color &optional frame) + "Convert COLOR string to a list of normalized RGB components. +COLOR should be a color name (e.g. \"white\") or an RGB triplet +string (e.g. \"#ff12ec\"). + +Normally the return value is a list of three floating-point +numbers, (RED GREEN BLUE), each between 0.0 and 1.0 inclusive. + +Optional arg FRAME specifies the frame where the color is to be +displayed. If FRAME is omitted or nil, use the selected frame. +If FRAME cannot display COLOR, return nil." + (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame))) + +(defun color-rgb-to-hex (red green blue) + "Return hexadecimal notation for the color RED GREEN BLUE. +RED GREEN BLUE must be numbers between 0.0 and 1.0 inclusive." (format "#%02x%02x%02x" (* red 255) (* green 255) (* blue 255))) -(defun color-complement (color) - "Return the color that is the complement of COLOR." - (let ((color (color-rgb->normalize color))) +(defun color-complement (color-name) + "Return the color that is the complement of COLOR-NAME. +COLOR-NAME should be a string naming a color (e.g. \"white\"), or +a string specifying a color's RGB components (e.g. \"#ff12ec\")." + (let ((color (color-name-to-rgb color-name))) (list (- 1.0 (car color)) (- 1.0 (cadr color)) (- 1.0 (caddr color))))) @@ -52,50 +75,62 @@ The color list builds a color gradient starting at color START to color STOP. It does not include the START and STOP color in the resulting list." - (loop for i from 1 to step-number - with red-step = (/ (- (car stop) (car start)) (1+ step-number)) - with green-step = (/ (- (cadr stop) (cadr start)) (1+ step-number)) - with blue-step = (/ (- (caddr stop) (caddr start)) (1+ step-number)) - collect (list - (+ (car start) (* i red-step)) - (+ (cadr start) (* i green-step)) - (+ (caddr start) (* i blue-step))))) + (let* ((r (nth 0 start)) + (g (nth 1 start)) + (b (nth 2 start)) + (r-step (/ (- (nth 0 stop) r) (1+ step-number))) + (g-step (/ (- (nth 1 stop) g) (1+ step-number))) + (b-step (/ (- (nth 2 stop) b) (1+ step-number))) + result) + (dotimes (n step-number) + (push (list (setq r (+ r r-step)) + (setq g (+ g g-step)) + (setq b (+ b b-step))) + result)) + (nreverse result))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." - (apply 'color-rgb->hex (color-complement color))) + (apply 'color-rgb-to-hex (color-complement color))) -(defun color-rgb->hsv (red green blue) - "Convert RED GREEN BLUE values to HSV representation. -Hue is in radians. Saturation and values are between 0 and 1 -inclusively." - (let* ((r (float red)) +(defun color-rgb-to-hsv (red green blue) + "Convert RED, GREEN, and BLUE color components to HSV. +RED, GREEN, and BLUE should each be numbers between 0.0 and 1.0, +inclusive. Return a list (HUE, SATURATION, VALUE), where HUE is +in radians and both SATURATION and VALUE are between 0.0 and 1.0, +inclusive." + (let* ((r (float red)) (g (float green)) (b (float blue)) (max (max r g b)) (min (min r g b))) - (list - (/ (* 2 float-pi - (cond ((and (= r g) (= g b)) 0) - ((and (= r max) - (>= g b)) - (* 60 (/ (- g b) (- max min)))) - ((and (= r max) - (< g b)) - (+ 360 (* 60 (/ (- g b) (- max min))))) - ((= max g) - (+ 120 (* 60 (/ (- b r) (- max min))))) - ((= max b) - (+ 240 (* 60 (/ (- r g) (- max min))))))) - 360) - (if (= max 0) - 0 - (- 1 (/ min max))) - (/ max 255.0)))) + (if (< (- max min) 1e-8) + (list 0.0 0.0 0.0) + (list + (/ (* 2 float-pi + (cond ((and (= r g) (= g b)) 0) + ((and (= r max) + (>= g b)) + (* 60 (/ (- g b) (- max min)))) + ((and (= r max) + (< g b)) + (+ 360 (* 60 (/ (- g b) (- max min))))) + ((= max g) + (+ 120 (* 60 (/ (- b r) (- max min))))) + ((= max b) + (+ 240 (* 60 (/ (- r g) (- max min))))))) + 360) + (if (= max 0) 0 (- 1 (/ min max))) + (/ max 255.0))))) -(defun color-rgb->hsl (red green blue) +(defun color-rgb-to-hsl (red green blue) "Convert RED GREEN BLUE colors to their HSL representation. -RED, GREEN and BLUE must be between 0 and 1 inclusively." +RED, GREEN, and BLUE should each be numbers between 0.0 and 1.0, +inclusive. + +Return a list (HUE, SATURATION, LUMINENCE), where HUE is in radians +and both SATURATION and LUMINENCE are between 0.0 and 1.0, +inclusive." (let* ((r red) (g green) (b blue) @@ -104,13 +139,13 @@ (delta (- max min)) (l (/ (+ max min) 2.0))) (list - (if (= max min) + (if (< (- max min) 1e-8) 0 (* 2 float-pi (/ (cond ((= max r) (+ (/ (- g b) delta) (if (< g b) 6 0))) ((= max g) - (+ (/ (- b r) delta) 2)) + (+ (/ (- b r) delta) 2)) (t (+ (/ (- r g) delta) 4))) 6))) @@ -121,9 +156,9 @@ (/ delta (+ max min)))) l))) -(defun color-srgb->xyz (red green blue) - "Converts RED GREEN BLUE colors from the sRGB color space to CIE XYZ. -RED, BLUE and GREEN must be between 0 and 1 inclusively." +(defun color-srgb-to-xyz (red green blue) + "Convert RED GREEN BLUE colors from the sRGB color space to CIE XYZ. +RED, BLUE and GREEN must be between 0 and 1, inclusive." (let ((r (if (<= red 0.04045) (/ red 12.95) (expt (/ (+ red 0.055) 1.055) 2.4))) @@ -137,8 +172,8 @@ (+ (* 0.21266729 r) (* 0.7151522 g) (* 0.0721750 b)) (+ (* 0.0193339 r) (* 0.1191920 g) (* 0.9503041 b))))) -(defun color-xyz->srgb (X Y Z) - "Converts CIE X Y Z colors to sRGB color space." +(defun color-xyz-to-srgb (X Y Z) + "Convert CIE X Y Z colors to sRGB color space." (let ((r (+ (* 3.2404542 X) (* -1.5371385 Y) (* -0.4985314 Z))) (g (+ (* -0.9692660 X) (* 1.8760108 Y) (* 0.0415560 Z))) (b (+ (* 0.0556434 X) (* -0.2040259 Y) (* 1.0572252 Z)))) @@ -158,10 +193,10 @@ (defconst color-cie-ε (/ 216 24389.0)) (defconst color-cie-κ (/ 24389 27.0)) -(defun color-xyz->lab (X Y Z &optional white-point) - "Converts CIE XYZ to CIE L*a*b*. -WHITE-POINT can be specified as (X Y Z) white point to use. If -none is set, `color-d65-xyz' is used." +(defun color-xyz-to-lab (X Y Z &optional white-point) + "Convert CIE XYZ to CIE L*a*b*. +WHITE-POINT specifies the (X Y Z) white point for the +conversion. If omitted or nil, use `color-d65-xyz'." (destructuring-bind (Xr Yr Zr) (or white-point color-d65-xyz) (let* ((xr (/ X Xr)) (yr (/ Y Yr)) @@ -180,10 +215,10 @@ (* 500 (- fx fy)) ; a (* 200 (- fy fz)))))) ; b -(defun color-lab->xyz (L a b &optional white-point) - "Converts CIE L*a*b* to CIE XYZ. -WHITE-POINT can be specified as (X Y Z) white point to use. If -none is set, `color-d65-xyz' is used." +(defun color-lab-to-xyz (L a b &optional white-point) + "Convert CIE L*a*b* to CIE XYZ. +WHITE-POINT specifies the (X Y Z) white point for the +conversion. If omitted or nil, use `color-d65-xyz'." (destructuring-bind (Xr Yr Zr) (or white-point color-d65-xyz) (let* ((fy (/ (+ L 16) 116.0)) (fz (- fy (/ b 200.0))) @@ -201,21 +236,18 @@ (* yr Yr) ; Y (* zr Zr))))) ; Z -(defun color-srgb->lab (red green blue) - "Converts RGB to CIE L*a*b*." - (apply 'color-xyz->lab (color-srgb->xyz red green blue))) - -(defun color-rgb->normalize (color) - "Normalize a RGB color to values between 0 and 1 inclusively." - (mapcar (lambda (x) (/ x 65535.0)) (x-color-values color))) - -(defun color-lab->srgb (L a b) - "Converts CIE L*a*b* to RGB." - (apply 'color-xyz->srgb (color-lab->xyz L a b))) +(defun color-srgb-to-lab (red green blue) + "Convert RGB to CIE L*a*b*." + (apply 'color-xyz-to-lab (color-srgb-to-xyz red green blue))) + +(defun color-lab-to-srgb (L a b) + "Convert CIE L*a*b* to RGB." + (apply 'color-xyz-to-srgb (color-lab-to-xyz L a b))) (defun color-cie-de2000 (color1 color2 &optional kL kC kH) - "Computes the CIEDE2000 color distance between COLOR1 and COLOR2. -Colors must be in CIE L*a*b* format." + "Return the CIEDE2000 color distance between COLOR1 and COLOR2. +Both COLOR1 and COLOR2 should be in CIE L*a*b* format, as +returned by `color-srgb-to-lab' or `color-xyz-to-lab'." (destructuring-bind (L₁ a₁ b₁) color1 (destructuring-bind (L₂ a₂ b₂) color2 (let* ((kL (or kL 1)) === modified file 'lisp/facemenu.el' --- lisp/facemenu.el 2011-01-25 04:08:28 +0000 +++ lisp/facemenu.el 2011-02-21 06:03:36 +0000 @@ -463,25 +463,6 @@ (defalias 'facemenu-read-color 'read-color) -(defun color-rgb-to-hsv (r g b) - "For R, G, B color components return a list of hue, saturation, value. -R, G, B input values should be in [0..65535] range. -Output values for hue are integers in [0..360] range. -Output values for saturation and value are integers in [0..100] range." - (let* ((r (/ r 65535.0)) - (g (/ g 65535.0)) - (b (/ b 65535.0)) - (max (max r g b)) - (min (min r g b)) - (h (cond ((= max min) 0) - ((= max r) (mod (+ (* 60 (/ (- g b) (- max min))) 360) 360)) - ((= max g) (+ (* 60 (/ (- b r) (- max min))) 120)) - ((= max b) (+ (* 60 (/ (- r g) (- max min))) 240)))) - (s (cond ((= max 0) 0) - (t (- 1 (/ min max))))) - (v max)) - (list (round h) (round s 0.01) (round v 0.01)))) - (defcustom list-colors-sort nil "Color sort order for `list-colors-display'. `nil' means default implementation-dependent order (defined in `x-colors'). @@ -508,6 +489,7 @@ "Return a list of keys for sorting colors depending on `list-colors-sort'. COLOR is the name of the color. When return value is nil, filter out the color from the output." + (require 'color) (cond ((null list-colors-sort) color) ((eq list-colors-sort 'name) @@ -517,12 +499,12 @@ ((eq (car-safe list-colors-sort) 'rgb-dist) (color-distance color (cdr list-colors-sort))) ((eq list-colors-sort 'hsv) - (apply 'color-rgb-to-hsv (color-values color))) + (apply 'color-rgb-to-hsv (color-name-to-rgb color))) ((eq (car-safe list-colors-sort) 'hsv-dist) - (let* ((c-rgb (color-values color)) + (let* ((c-rgb (color-name-to-rgb color)) (c-hsv (apply 'color-rgb-to-hsv c-rgb)) (o-hsv (apply 'color-rgb-to-hsv - (color-values (cdr list-colors-sort))))) + (color-name-to-rgb (cdr list-colors-sort))))) (unless (and (eq (nth 0 c-rgb) (nth 1 c-rgb)) ; exclude grayscale (eq (nth 1 c-rgb) (nth 2 c-rgb))) ;; 3D Euclidean distance (sqrt is not needed for sorting) @@ -638,7 +620,7 @@ 'mouse-face 'highlight 'help-echo (let ((hsv (apply 'color-rgb-to-hsv - (color-values (car color))))) + (color-name-to-rgb (car color))))) (format "H:%d S:%d V:%d" (nth 0 hsv) (nth 1 hsv) (nth 2 hsv))))) (when callback === modified file 'lisp/faces.el' --- lisp/faces.el 2011-02-12 23:40:43 +0000 +++ lisp/faces.el 2011-02-21 06:03:36 +0000 @@ -1653,18 +1653,28 @@ (defun color-values (color &optional frame) "Return a description of the color named COLOR on frame FRAME. -The value is a list of integer RGB values--(RED GREEN BLUE). -These values appear to range from 0 to 65280 or 65535, depending -on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\). +COLOR should be a string naming a color (e.g. \"white\"), or a +string specifying a color's RGB components (e.g. \"#ff12ec\"). + +Return a list of three integers, (RED GREEN BLUE), each between 0 +and either 65280 or 65535 (the maximum depends on the system). +Use `color-name-to-rgb' if you want RGB floating-point values +normalized to 1.0. + If FRAME is omitted or nil, use the selected frame. If FRAME cannot display COLOR, the value is nil. -If COLOR is the symbol `unspecified' or one of the strings -\"unspecified-fg\" or \"unspecified-bg\", the value is nil." - (if (member color '(unspecified "unspecified-fg" "unspecified-bg")) - nil - (if (memq (framep (or frame (selected-frame))) '(x w32 ns)) - (xw-color-values color frame) - (tty-color-values color frame)))) + +COLOR can also be the symbol `unspecified' or one of the strings +\"unspecified-fg\" or \"unspecified-bg\", in which case the +return value is nil." + (cond + ((member color '(unspecified "unspecified-fg" "unspecified-bg")) + nil) + ((memq (framep (or frame (selected-frame))) '(x w32 ns)) + (xw-color-values color frame)) + (t + (tty-color-values color frame)))) + (defalias 'x-color-values 'color-values) (declare-function xw-display-color-p "xfns.c" (&optional terminal)) === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-02-20 04:08:04 +0000 +++ lisp/gnus/ChangeLog 2011-02-21 06:03:36 +0000 @@ -1,3 +1,9 @@ +2011-02-20 Chong Yidong + + * shr-color.el (shr-color->hexadecimal): Use renamed function names + color-rgb-to-hex, color-name-to-rgb, color-srgb-to-lab, and + color-lab-to-srgb. + 2011-02-19 Glenn Morris * gnus.el (gnus-meta): Doc fix. === modified file 'lisp/gnus/shr-color.el' --- lisp/gnus/shr-color.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/shr-color.el 2011-02-21 06:03:36 +0000 @@ -259,7 +259,7 @@ (l (/ (string-to-number (match-string-no-properties 3 color)) 100.0))) (destructuring-bind (r g b) (shr-color-hsl-to-rgb-fractions h s l) - (color-rgb->hex r g b)))) + (color-rgb-to-hex r g b)))) ;; Color names ((cdr (assoc-string color shr-color-html-colors-alist t))) ;; Unrecognized color :( @@ -325,13 +325,13 @@ new background color will not be computed. Only the foreground color will be adapted to be visible on BG." ;; Convert fg and bg to CIE Lab - (let ((fg-norm (color-rgb->normalize fg)) - (bg-norm (color-rgb->normalize bg))) + (let ((fg-norm (color-name-to-rgb fg)) + (bg-norm (color-name-to-rgb bg))) (if (or (null fg-norm) (null bg-norm)) (list bg fg) - (let* ((fg-lab (apply 'color-srgb->lab fg-norm)) - (bg-lab (apply 'color-srgb->lab bg-norm)) + (let* ((fg-lab (apply 'color-srgb-to-lab fg-norm)) + (bg-lab (apply 'color-srgb-to-lab bg-norm)) ;; Compute color distance using CIE DE 2000 (fg-bg-distance (color-cie-de2000 fg-lab bg-lab)) ;; Compute luminance distance (substract L component) @@ -351,10 +351,10 @@ bg (apply 'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab->srgb bg-lab)))) + (apply 'color-lab-to-srgb bg-lab)))) (apply 'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab->srgb fg-lab)))))))))) + (apply 'color-lab-to-srgb fg-lab)))))))))) (provide 'shr-color) ------------------------------------------------------------ revno: 103369 committer: Chong Yidong branch nick: trunk timestamp: Mon 2011-02-21 00:59:20 -0500 message: * themes/tango-dark-theme.el: Tweak background on low-color terminals. diff: === modified file 'etc/ChangeLog' --- etc/ChangeLog 2011-02-17 21:47:18 +0000 +++ etc/ChangeLog 2011-02-21 05:59:20 +0000 @@ -1,3 +1,8 @@ +2011-02-21 Chong Yidong + + * themes/tango-dark-theme.el: Tweak background on low-color + terminals. + 2011-02-17 Ken Manheimer * etc/images/icons/allout-widgets/dark-bg, === modified file 'etc/themes/tango-dark-theme.el' --- etc/themes/tango-dark-theme.el 2011-01-25 04:08:28 +0000 +++ etc/themes/tango-dark-theme.el 2011-02-21 05:59:20 +0000 @@ -49,7 +49,13 @@ (custom-theme-set-faces 'tango-dark - `(default ((,class (:foreground ,alum-1 :background ,alum-6)))) + ;; Ensure sufficient contrast on low-color terminals. + `(default ((((class color) (min-colors 4096)) + (:foreground ,alum-1 :background ,alum-6)) + (((class color) (min-colors 256)) + (:foreground ,alum-1 :background "#222")) + (,class + (:foreground ,alum-1 :background "black")))) `(cursor ((,class (:foreground ,alum-6 :background ,butter-1)))) ;; Highlighting faces `(fringe ((,class (:background ,alum-7)))) ------------------------------------------------------------ revno: 103368 committer: Juanma Barranquero branch nick: trunk timestamp: Sun 2011-02-20 23:17:39 +0100 message: lib-src/makefile.w32-in (obj): Remove md5.o. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-18 22:28:09 +0000 +++ lib-src/ChangeLog 2011-02-20 22:17:39 +0000 @@ -1,3 +1,7 @@ +2011-02-20 Juanma Barranquero + + * makefile.w32-in (obj): Remove md5.o. + 2011-02-18 Karl Chen * emacsclient.c (main): Loop while `recv' return EINTR. === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2011-02-16 08:39:19 +0000 +++ lib-src/makefile.w32-in 2011-02-20 22:17:39 +0000 @@ -142,7 +142,7 @@ syntax.o bytecode.o \ process.o callproc.o unexw32.o \ region-cache.o sound.o atimer.o \ - doprnt.o intervals.o textprop.o composite.o md5.o + doprnt.o intervals.o textprop.o composite.o # # These are the lisp files that are loaded up in loadup.el ------------------------------------------------------------ revno: 103367 committer: Eli Zaretskii branch nick: trunk timestamp: Sun 2011-02-20 23:09:45 +0200 message: Followup for revision 103365. lib/makefile.w32-in ($(BLD)/md5.$(O)): Don't depend on $(EMACS_ROOT)/nt/inc/sys/stat.h. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-20 19:46:08 +0000 +++ ChangeLog 2011-02-20 21:09:45 +0000 @@ -1,3 +1,8 @@ +2011-02-20 Eli Zaretskii + + * lib/makefile.w32-in ($(BLD)/md5.$(O)): Don't depend on + $(EMACS_ROOT)/nt/inc/sys/stat.h. + 2011-02-20 Paul Eggert * configure.in (C_WARNINGS_SWITCH): Do not prepend -Wno-pointer-sign. === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2011-02-20 18:50:26 +0000 +++ lib/makefile.w32-in 2011-02-20 21:09:45 +0000 @@ -99,7 +99,6 @@ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/src/config.h \ - $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/lib/md5.h # The following dependencies are for supporting parallel builds, where ------------------------------------------------------------ revno: 103366 committer: Paul Eggert branch nick: trunk timestamp: Sun 2011-02-20 11:46:08 -0800 message: * configure.in (C_WARNINGS_SWITCH): Do not prepend -Wno-pointer-sign. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-20 18:50:26 +0000 +++ ChangeLog 2011-02-20 19:46:08 +0000 @@ -1,3 +1,13 @@ +2011-02-20 Paul Eggert + + * configure.in (C_WARNINGS_SWITCH): Do not prepend -Wno-pointer-sign. + This undoes the 2006-01-02 change. The -Wno-pointer-sign option + is no longer needed, due to the recent SSDATA and related changes. + Perhaps -Wno-pointer-sign should also be removed from + nextstep/Cocoa/Emacs.xcodeproj/project.pbxproj but I have no easy + way to test this so I left it alone. + * configure: Regenerate. + 2011-02-20 Christoph Scholtes * lib/makefile.w32-in ($(BLD)/md5.$(O)): New recipe, moved from === modified file 'configure' --- configure 2011-02-19 07:28:29 +0000 +++ configure 2011-02-20 19:46:08 +0000 @@ -6177,37 +6177,6 @@ test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" fi -### Use -Wno-pointer-sign if the compiler supports it -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wno-pointer-sign" >&5 -$as_echo_n "checking whether gcc understands -Wno-pointer-sign... " >&6; } -SAVE_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-pointer-sign" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - has_option=yes -else - has_option=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -if test $has_option = yes; then - C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5 -$as_echo "$has_option" >&6; } -CFLAGS="$SAVE_CFLAGS" -unset has_option -unset SAVE_CFLAGS - ### Use -Wdeclaration-after-statement if the compiler supports it { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wdeclaration-after-statement" >&5 $as_echo_n "checking whether gcc understands -Wdeclaration-after-statement... " >&6; } === modified file 'configure.in' --- configure.in 2011-02-18 07:44:39 +0000 +++ configure.in 2011-02-20 19:46:08 +0000 @@ -699,19 +699,6 @@ test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS" fi -### Use -Wno-pointer-sign if the compiler supports it -AC_MSG_CHECKING([whether gcc understands -Wno-pointer-sign]) -SAVE_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS -Wno-pointer-sign" -AC_TRY_COMPILE([], [], has_option=yes, has_option=no,) -if test $has_option = yes; then - C_WARNINGS_SWITCH="-Wno-pointer-sign $C_WARNINGS_SWITCH" -fi -AC_MSG_RESULT($has_option) -CFLAGS="$SAVE_CFLAGS" -unset has_option -unset SAVE_CFLAGS - ### Use -Wdeclaration-after-statement if the compiler supports it AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement]) SAVE_CFLAGS="$CFLAGS" ------------------------------------------------------------ revno: 103365 author: Christoph Scholtes committer: Eli Zaretskii branch nick: trunk timestamp: Sun 2011-02-20 20:50:26 +0200 message: Fix the MS-Windows build due to import of md5 from gnulib. src/makefile.w32-in: Remove md5.$(O). ($(BLD)/md5.$(O)): Remove prerequisites, moved to lib/makefile.w32-in. ($(BLD)/fns.$(O)): Depend on $(EMACS_ROOT)/lib/md5.h and on stamp_BLD. lib/makefile.w32-in ($(BLD)/md5.$(O)): New recipe, moved from src/makefile.w32-in. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-20 08:48:52 +0000 +++ ChangeLog 2011-02-20 18:50:26 +0000 @@ -1,3 +1,8 @@ +2011-02-20 Christoph Scholtes + + * lib/makefile.w32-in ($(BLD)/md5.$(O)): New recipe, moved from + src/makefile.w32-in. + 2011-02-20 Paul Eggert Import crypto/md5 and stdint modules from gnulib. === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2011-01-31 19:36:08 +0000 +++ lib/makefile.w32-in 2011-02-20 18:50:26 +0000 @@ -27,7 +27,8 @@ $(BLD)/getopt.$(O) \ $(BLD)/getopt1.$(O) \ $(BLD)/strftime.$(O) \ - $(BLD)/time_r.$(O) + $(BLD)/time_r.$(O) \ + $(BLD)/md5.$(O) # # Build the library @@ -93,11 +94,19 @@ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/src/config.h +$(BLD)/md5.$(O) : \ + $(EMACS_ROOT)/lib/md5.c \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/m/intel386.h \ + $(EMACS_ROOT)/src/config.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/lib/md5.h + # The following dependencies are for supporting parallel builds, where # we must make sure $(BLD) exists before any compilation starts. # $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD -$(BLD)/strftime.$(O) $(BLD)/time_r.$(O): stamp_BLD +$(BLD)/strftime.$(O) $(BLD)/time_r.$(O) $(BLD)/md5.$(O): stamp_BLD # # Headers we would preprocess if we could. === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-20 08:48:52 +0000 +++ src/ChangeLog 2011-02-20 18:50:26 +0000 @@ -1,3 +1,14 @@ +2011-02-20 Eli Zaretskii + + * makefile.w32-in ($(BLD)/fns.$(O)): Depend on + $(EMACS_ROOT)/lib/md5.h and on stamp_BLD. + +2011-02-20 Christoph Scholtes + + * makefile.w32-in: Remove md5.$(O). + ($(BLD)/md5.$(O)): Remove prerequisites, moved to + lib/makefile.w32-in. + 2011-02-20 Paul Eggert Import crypto/md5 and stdint modules from gnulib. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2011-02-09 20:50:17 +0000 +++ src/makefile.w32-in 2011-02-20 18:50:26 +0000 @@ -81,7 +81,6 @@ $(BLD)/lread.$(O) \ $(BLD)/macros.$(O) \ $(BLD)/marker.$(O) \ - $(BLD)/md5.$(O) \ $(BLD)/minibuf.$(O) \ $(BLD)/w32.$(O) \ $(BLD)/w32heap.$(O) \ @@ -221,7 +220,7 @@ syntax.c bytecode.c \ process.c callproc.c unexw32.c \ region-cache.c sound.c atimer.c \ - doprnt.c intervals.c textprop.c composite.c md5.c + doprnt.c intervals.c textprop.c composite.c SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o obj = $(GLOBAL_SOURCES:.c=.o) @@ -843,6 +842,7 @@ $(EMACS_ROOT)/nt/inc/nl_types.h \ $(EMACS_ROOT)/nt/inc/unistd.h \ $(EMACS_ROOT)/nt/inc/sys/time.h \ + $(EMACS_ROOT)/lib/md5.h \ $(LISP_H) \ $(SRC)/atimer.h \ $(SRC)/blockinput.h \ @@ -856,7 +856,6 @@ $(SRC)/intervals.h \ $(SRC)/keyboard.h \ $(SRC)/keymap.h \ - $(SRC)/md5.h \ $(SRC)/systime.h \ $(SRC)/w32gui.h \ $(SRC)/window.h @@ -1135,11 +1134,6 @@ $(SRC)/buffer.h \ $(SRC)/character.h -$(BLD)/md5.$(O) : \ - $(SRC)/md5.c \ - $(CONFIG_H) \ - $(SRC)/md5.h - $(BLD)/menu.$(O) : \ $(SRC)/menu.c \ $(CONFIG_H) \ ------------------------------------------------------------ revno: 103364 committer: Alan Mackenzie branch nick: trunk timestamp: Sun 2011-02-20 18:36:29 +0000 message: (c-end-of-statement): Set macro-end correctly at the end of a loop. diff: === modified file 'lisp/progmodes/cc-cmds.el' --- lisp/progmodes/cc-cmds.el 2011-01-31 23:54:50 +0000 +++ lisp/progmodes/cc-cmds.el 2011-02-20 18:36:29 +0000 @@ -2654,14 +2654,19 @@ ;; Are we about to move forward into or out of a ;; preprocessor command? (when (eq (cdr res) 'macro-boundary) - (save-excursion - (end-of-line) - (setq macro-fence - (and (not (eobp)) - (progn (c-skip-ws-forward) - (c-beginning-of-macro)) - (progn (c-end-of-macro) - (point)))))) + (setq macro-fence + (save-excursion + (if macro-fence + (progn + (end-of-line) + (and (not (eobp)) + (progn (c-skip-ws-forward) + (c-beginning-of-macro)) + (progn (c-end-of-macro) + (point)))) + (and (not (eobp)) + (c-beginning-of-macro) + (progn (c-end-of-macro) (point))))))) ;; Are we about to move forward into a literal? (when (memq (cdr res) '(macro-boundary literal)) (setq range (c-ascertain-following-literal))) ------------------------------------------------------------ revno: 103363 committer: Alan Mackenzie branch nick: trunk timestamp: Sun 2011-02-20 18:35:30 +0000 message: . diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-20 00:16:54 +0000 +++ lisp/ChangeLog 2011-02-20 18:35:30 +0000 @@ -1,3 +1,8 @@ +2011-02-20 Alan Mackenzie + + * progmodes/cc-cmds.el (c-beginning-of-statement): Avoid loop in + locating the beginning of a macro. (Bug#7595) + 2011-02-20 Glenn Morris * edmacro.el (edmacro-eight-bits): Make it a defcustom. @@ -836,7 +841,7 @@ * progmodes/cc-cmds.el (c-forward-over-illiterals): Continue parsing if we encounter a naked # (Bug#7595). (c-beginning-of-statement): Avoid loop in locating the beginning - of a macro. + of a macro. (Not actually committed until 2011-02-20, see above). 2011-01-31 Chong Yidong ------------------------------------------------------------ revno: 103362 [merge] committer: Ulf Jasper branch nick: trunk timestamp: Sun 2011-02-20 15:44:05 +0100 message: Convert test/icalendar-testsuite.el to ERT format. * automated/icalendar-tests.el: Move from icalendar-testsuite.el; convert to ERT format. diff: === modified file 'test/ChangeLog' --- test/ChangeLog 2011-02-14 21:21:42 +0000 +++ test/ChangeLog 2011-02-20 14:35:58 +0000 @@ -1,3 +1,8 @@ +2011-02-20 Ulf Jasper + + * automated/icalendar-tests.el: Move from icalendar-testsuite.el; + convert to ERT format. + 2011-02-14 Chong Yidong * automated/bytecomp-tests.el: Move from bytecomp-testsuite.el; === renamed file 'test/icalendar-testsuite.el' => 'test/automated/icalendar-tests.el' --- test/icalendar-testsuite.el 2011-01-25 04:08:28 +0000 +++ test/automated/icalendar-tests.el 2011-02-20 14:35:58 +0000 @@ -1,4 +1,4 @@ -;; icalendar-testsuite.el --- Test suite for icalendar.el +;; icalendar-tests.el --- Test suite for icalendar.el ;; Copyright (C) 2005, 2008-2011 Free Software Foundation, Inc. @@ -30,31 +30,33 @@ ;; Note: Watch the trailing blank that is added on import. ;;; Code: -(defun icalendar-testsuite-run () - "Run icalendar test suite." - (interactive) - (icalendar-testsuite--run-internal-tests) - (icalendar-testsuite--run-function-tests) - (icalendar-testsuite--run-import-tests) - (icalendar-testsuite--run-export-tests) - (icalendar-testsuite--run-cycle-tests) - (icalendar-testsuite--run-real-world-tests) - (message "All icalendar tests finished successfully.")) - -;; ====================================================================== -;; internal -;; ====================================================================== -(defun icalendar-testsuite--trim (string) + +(require 'ert) +(require 'icalendar) + +;; ====================================================================== +;; Helpers +;; ====================================================================== + +(defun icalendar-tests--get-ical-event (ical-string) + "Return icalendar event for ICAL-STRING." + (save-excursion + (with-temp-buffer + (insert ical-string) + (goto-char (point-min)) + (car (icalendar--read-element nil nil))))) + +(defun icalendar-tests--trim (string) "Remove leading and trailing whitespace from STRING." (replace-regexp-in-string "[ \t\n]+\\'" "" (replace-regexp-in-string "\\`[ \t\n]+" "" string))) -(defun icalendar-testsuite--compare-strings (str1 str2) +(defun icalendar-tests--compare-strings (str1 str2) "Compare strings STR1 and STR2. Return t if strings are equal, else return substring indicating first difference. FIXME: make this a little smarter." - (let* ((s1 (icalendar-testsuite--trim str1)) - (s2 (icalendar-testsuite--trim str2)) + (let* ((s1 (icalendar-tests--trim str1)) + (s2 (icalendar-tests--trim str2)) (result (compare-strings s1 0 nil s2 0 nil)) (len (length str2))) (if (numberp result) @@ -65,43 +67,317 @@ (min len (+ (- (+ result 1)) 3))) "...")) t))) -(defun icalendar-testsuite--run-internal-tests () - "Run icalendar-testsuite internal tests." - (assert (equal t (icalendar-testsuite--compare-strings " abcde" "abcde "))) - (assert +(ert-deftest icalendar-tests--compare-strings () + "Test icalendar-tests--compare-strings." + (should (equal t (icalendar-tests--compare-strings " abcde" "abcde "))) + (should (string= "...def..." - (icalendar-testsuite--compare-strings "abcxe" "abcdefghijklmn"))) - (assert (string= "...xe..." - (icalendar-testsuite--compare-strings "abcde" "abcxe"))) - (assert (string= "...ddd..." - (icalendar-testsuite--compare-strings "abc" "abcdddddd"))) - (assert (string= "......" - (icalendar-testsuite--compare-strings "abcdefghij" "abc")))) + (icalendar-tests--compare-strings "abcxe" "abcdefghijklmn"))) + (should (string= "...xe..." + (icalendar-tests--compare-strings "abcde" "abcxe"))) + (should (string= "...ddd..." + (icalendar-tests--compare-strings "abc" "abcdddddd"))) + (should (string= "......" + (icalendar-tests--compare-strings "abcdefghij" "abc")))) + +;; ====================================================================== +;; Tests of functions +;; ====================================================================== + +(ert-deftest icalendar--create-uid () + "Test for `icalendar--create-uid'." + (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s") + t-ct + (icalendar--uid-count 77) + (entry-full "30.06.1964 07:01 blahblah") + (hash (format "%d" (abs (sxhash entry-full)))) + (contents "DTSTART:19640630T070100\nblahblah") + (username (or user-login-name "UNKNOWN_USER")) + ) + (fset 't-ct (symbol-function 'current-time)) + (unwind-protect + (progn + (fset 'current-time (lambda () '(1 2 3))) + (should (= 77 icalendar--uid-count)) + (should (string= (concat "xxx-123-77-" hash "-" username "-19640630") + (icalendar--create-uid entry-full contents))) + (should (= 78 icalendar--uid-count))) + ;; restore 'current-time + (fset 'current-time (symbol-function 't-ct))) + (setq contents "blahblah") + (setq icalendar-uid-format "yyy%syyy") + (should (string= (concat "yyyDTSTARTyyy") + (icalendar--create-uid entry-full contents))))) + +(ert-deftest icalendar--calendar-style () + "Test for `icalendar--date-style'." + (dolist (calendar-date-style '(iso american european)) + (should (eq (icalendar--date-style) calendar-date-style))) + (let ((cds calendar-date-style) + (european-calendar-style t)) + (makunbound 'calendar-date-style) + (should (eq (icalendar--date-style) 'european)) + (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME + (should (eq (icalendar--date-style) 'american)) + (setq calendar-date-style cds))) + +(ert-deftest icalendar-convert-anniversary-to-ical () + "Test method for `icalendar--convert-anniversary-to-ical'." + (let* ((calendar-date-style 'iso) + result) + (setq result (icalendar--convert-anniversary-to-ical + "" "%%(diary-anniversary 1964 6 30) g")) + (should (= 2 (length result))) + (should (string= (concat + "\nDTSTART;VALUE=DATE:19640630" + "\nDTEND;VALUE=DATE:19640701" + "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30") + (car result))) + (should (string= "g" (cadr result))))) + +(ert-deftest icalendar--convert-cyclic-to-ical () + "Test method for `icalendar--convert-cyclic-to-ical'." + (let* ((calendar-date-style 'iso) + result) + (setq result (icalendar--convert-block-to-ical + "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) + (should (= 2 (length result))) + (should (string= (concat + "\nDTSTART;VALUE=DATE:20040719" + "\nDTEND;VALUE=DATE:20040828") + (car result))) + (should (string= "Sommerferien" (cadr result))))) + +(ert-deftest icalendar--convert-block-to-ical () + "Test method for `icalendar--convert-block-to-ical'." + (let* ((calendar-date-style 'iso) + result) + (setq result (icalendar--convert-block-to-ical + "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) + (should (= 2 (length result))) + (should (string= (concat + "\nDTSTART;VALUE=DATE:20040719" + "\nDTEND;VALUE=DATE:20040828") + (car result))) + (should (string= "Sommerferien" (cadr result))))) + +(ert-deftest icalendar--convert-yearly-to-ical () + "Test method for `icalendar--convert-yearly-to-ical'." + (let* ((calendar-date-style 'iso) + result + (calendar-month-name-array + ["January" "February" "March" "April" "May" "June" "July" "August" + "September" "October" "November" "December"])) + (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit")) + (should (= 2 (length result))) + (should (string= (concat + "\nDTSTART;VALUE=DATE:19000501" + "\nDTEND;VALUE=DATE:19000502" + "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1") + (car result))) + (should (string= "Tag der Arbeit" (cadr result))))) + +(ert-deftest icalendar--convert-weekly-to-ical () + "Test method for `icalendar--convert-weekly-to-ical'." + (let* ((calendar-date-style 'iso) + result + (calendar-day-name-array + ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" + "Saturday"])) + (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject")) + (should (= 2 (length result))) + (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000" + "\nDTEND;VALUE=DATE-TIME:20050103T093000" + "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO") + (car result))) + (should (string= "subject" (cadr result))))) + +(ert-deftest icalendar--parse-vtimezone () + "Test method for `icalendar--parse-vtimezone'." + (let (vtimezone result) + (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE +TZID:thename +BEGIN:STANDARD +DTSTART:16010101T040000 +TZOFFSETFROM:+0300 +TZOFFSETTO:+0200 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T030000 +TZOFFSETFROM:+0200 +TZOFFSETTO:+0300 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +")) + (setq result (icalendar--parse-vtimezone vtimezone)) + (should (string= "thename" (car result))) + (message (cdr result)) + (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" + (cdr result))) + (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE +TZID:anothername +BEGIN:STANDARD +DTSTART:16010101T040000 +TZOFFSETFROM:+0300 +TZOFFSETTO:+0200 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10 +END:STANDARD +BEGIN:DAYLIGHT +DTSTART:16010101T030000 +TZOFFSETFROM:+0200 +TZOFFSETTO:+0300 +RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3 +END:DAYLIGHT +END:VTIMEZONE +")) + (setq result (icalendar--parse-vtimezone vtimezone)) + (should (string= "anothername" (car result))) + (message (cdr result)) + (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" + (cdr result))))) + +(ert-deftest icalendar--convert-ordinary-to-ical () + "Test method for `icalendar--convert-ordinary-to-ical'." + (let* ((calendar-date-style 'iso) + result) + ;; without time + (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject")) + (should (= 2 (length result))) + (should (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216" + (car result))) + (should (string= "subject" (cadr result))) - -;; ====================================================================== -;; Test methods for functions -;; ====================================================================== -(defun icalendar-testsuite--run-function-tests () - "Perform tests for single icalendar functions." - (icalendar-testsuite--test-parse-summary-and-rest) - (icalendar-testsuite--test-format-ical-event) - (icalendar-testsuite--test-import-format-sample) - (icalendar-testsuite--test-first-weekday-of-year) - (icalendar-testsuite--test-datestring-to-isodate) - (icalendar-testsuite--test-datetime-to-diary-date) - (icalendar-testsuite--test-diarytime-to-isotime) - (icalendar-testsuite--test-convert-ordinary-to-ical) - (icalendar-testsuite--test-convert-weekly-to-ical) - (icalendar-testsuite--test-convert-yearly-to-ical) - (icalendar-testsuite--test-convert-block-to-ical) - (icalendar-testsuite--test-convert-cyclic-to-ical) - (icalendar-testsuite--test-convert-anniversary-to-ical) - (icalendar-testsuite--test-calendar-style) - (icalendar-testsuite--test-create-uid) - (icalendar-testsuite--test-parse-vtimezone)) - -(defun icalendar-testsuite--test-format-ical-event () + ;; with time + (setq result (icalendar--convert-ordinary-to-ical + "&?" "&2010 2 15 12:34-23:45 s")) + (should (= 2 (length result))) + (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400" + "\nDTEND;VALUE=DATE-TIME:20100215T234500") + (car result))) + (should (string= "s" (cadr result))) + + ;; with time, again -- test bug#5549 + (setq result (icalendar--convert-ordinary-to-ical + "x?" "x2010 2 15 0:34-1:45 s")) + (should (= 2 (length result))) + (should (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400" + "\nDTEND;VALUE=DATE-TIME:20100215T014500") + (car result))) + (should (string= "s" (cadr result))))) + +(ert-deftest icalendar--diarytime-to-isotime () + "Test method for `icalendar--diarytime-to-isotime'." + (should (string= (icalendar--diarytime-to-isotime "01:15" "") + "T011500")) + (should (string= (icalendar--diarytime-to-isotime "1:15" "") + "T011500")) + (should (string= (icalendar--diarytime-to-isotime "0:01" "") + "T000100")) + (should (string= (icalendar--diarytime-to-isotime "0100" "") + "T010000")) + (should (string= (icalendar--diarytime-to-isotime "0100" "am") + "T010000")) + (should (string= (icalendar--diarytime-to-isotime "0100" "pm") + "T130000")) + (should (string= (icalendar--diarytime-to-isotime "1200" "") + "T120000")) + (should (string= (icalendar--diarytime-to-isotime "17:17" "") + "T171700")) + (should (string= (icalendar--diarytime-to-isotime "1200" "am") + "T000000")) + (should (string= (icalendar--diarytime-to-isotime "1201" "am") + "T000100")) + (should (string= (icalendar--diarytime-to-isotime "1259" "am") + "T005900")) + (should (string= (icalendar--diarytime-to-isotime "1200" "pm") + "T120000")) + (should (string= (icalendar--diarytime-to-isotime "1201" "pm") + "T120100")) + (should (string= (icalendar--diarytime-to-isotime "1259" "pm") + "T125900"))) + +(ert-deftest icalendar--datetime-to-diary-date () + "Test method for `icalendar--datetime-to-diary-date'." + (let* ((datetime '(59 59 23 31 12 2008)) + (calendar-date-style 'iso)) + (should (string= (icalendar--datetime-to-diary-date datetime) + "2008 12 31")) + (setq calendar-date-style 'european) + (should (string= (icalendar--datetime-to-diary-date datetime) + "31 12 2008")) + (setq calendar-date-style 'american) + (should (string= (icalendar--datetime-to-diary-date datetime) + "12 31 2008")))) + +(ert-deftest icalendar--datestring-to-isodate () + "Test method for `icalendar--datestring-to-isodate'." + (let ((calendar-date-style 'iso)) + ;; numeric iso + (should (string= (icalendar--datestring-to-isodate "2008 05 11") + "20080511")) + (should (string= (icalendar--datestring-to-isodate "2008 05 31") + "20080531")) + (should (string= (icalendar--datestring-to-isodate "2008 05 31" 2) + "20080602")) + + ;; numeric european + (setq calendar-date-style 'european) + (should (string= (icalendar--datestring-to-isodate "11 05 2008") + "20080511")) + (should (string= (icalendar--datestring-to-isodate "31 05 2008") + "20080531")) + (should (string= (icalendar--datestring-to-isodate "31 05 2008" 2) + "20080602")) + + ;; numeric american + (setq calendar-date-style 'american) + (should (string= (icalendar--datestring-to-isodate "11 05 2008") + "20081105")) + (should (string= (icalendar--datestring-to-isodate "12 30 2008") + "20081230")) + (should (string= (icalendar--datestring-to-isodate "12 30 2008" 2) + "20090101")) + + ;; non-numeric + (setq calendar-date-style nil) ;not necessary for conversion + (should (string= (icalendar--datestring-to-isodate "Nov 05 2008") + "20081105")) + (should (string= (icalendar--datestring-to-isodate "05 Nov 2008") + "20081105")) + (should (string= (icalendar--datestring-to-isodate "2008 Nov 05") + "20081105")))) + +(ert-deftest icalendar--first-weekday-of-year () + "Test method for `icalendar-first-weekday-of-year'." + (should (eq 1 (icalendar-first-weekday-of-year "TU" 2008))) + (should (eq 3 (icalendar-first-weekday-of-year "WE" 2007))) + (should (eq 5 (icalendar-first-weekday-of-year "TH" 2006))) + (should (eq 7 (icalendar-first-weekday-of-year "FR" 2005))) + (should (eq 3 (icalendar-first-weekday-of-year "SA" 2004))) + (should (eq 5 (icalendar-first-weekday-of-year "SU" 2003))) + (should (eq 7 (icalendar-first-weekday-of-year "MO" 2002))) + (should (eq 3 (icalendar-first-weekday-of-year "MO" 2000))) + (should (eq 1 (icalendar-first-weekday-of-year "TH" 1970)))) + +(ert-deftest icalendar--import-format-sample () + "Test method for `icalendar-import-format-sample'." + (should (string= (icalendar-import-format-sample + (icalendar-tests--get-ical-event "BEGIN:VEVENT +DTSTAMP:20030509T043439Z +DTSTART:20030509T103000 +SUMMARY:a +ORGANIZER:d +LOCATION:c +DTEND:20030509T153000 +DESCRIPTION:b +END:VEVENT +")) + (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' " + "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")))) + +(ert-deftest icalendar--format-ical-event () "Test `icalendar--format-ical-event'." (let ((icalendar-import-format "%s%d%l%o%t%u%c") (icalendar-import-format-summary "SUM %s") @@ -111,7 +387,7 @@ (icalendar-import-format-status " STA %s") (icalendar-import-format-url " URL %s") (icalendar-import-format-class " CLA %s") - (event (icalendar-testsuite--get-ical-event "BEGIN:VEVENT + (event (icalendar-tests--get-ical-event "BEGIN:VEVENT DTSTAMP:20030509T043439Z DTSTART:20030509T103000 SUMMARY:sum @@ -121,12 +397,12 @@ DESCRIPTION:des END:VEVENT "))) - (assert (string= (icalendar--format-ical-event event) - "SUM sum DES des LOC loc ORG org") t) + (should (string= (icalendar--format-ical-event event) + "SUM sum DES des LOC loc ORG org")) (setq icalendar-import-format (lambda (&rest ignore) "helloworld")) - (assert (string= (icalendar--format-ical-event event) - "helloworld") t) + (should (string= (icalendar--format-ical-event event) + "helloworld")) (setq icalendar-import-format (lambda (e) (format "-%s-%s-%s-%s-%s-%s-%s-" @@ -137,10 +413,10 @@ (icalendar--get-event-property event 'STATUS) (icalendar--get-event-property event 'URL) (icalendar--get-event-property event 'CLASS)))) - (assert (string= (icalendar--format-ical-event event) - "-sum-des-loc-org-nil-nil-nil-") t))) + (should (string= (icalendar--format-ical-event event) + "-sum-des-loc-org-nil-nil-nil-")))) -(defun icalendar-testsuite--test-parse-summary-and-rest () +(ert-deftest icalendar--parse-summary-and-rest () "Test `icalendar--parse-summary-and-rest'." (let ((icalendar-import-format "%s%d%l%o%t%u%c") (icalendar-import-format-summary "SUM %s") @@ -152,329 +428,28 @@ (icalendar-import-format-class " CLA %s") (result)) (setq result (icalendar--parse-summary-and-rest "SUM sum ORG org")) - (assert (string= (cdr (assoc 'org result)) "org")) + (should (string= (cdr (assoc 'org result)) "org")) (setq result (icalendar--parse-summary-and-rest "SUM sum DES des LOC loc ORG org STA sta URL url CLA cla")) - (assert (string= (cdr (assoc 'des result)) "des")) - (assert (string= (cdr (assoc 'loc result)) "loc")) - (assert (string= (cdr (assoc 'org result)) "org")) - (assert (string= (cdr (assoc 'sta result)) "sta")) - (assert (string= (cdr (assoc 'cla result)) "cla")) + (should (string= (cdr (assoc 'des result)) "des")) + (should (string= (cdr (assoc 'loc result)) "loc")) + (should (string= (cdr (assoc 'org result)) "org")) + (should (string= (cdr (assoc 'sta result)) "sta")) + (should (string= (cdr (assoc 'cla result)) "cla")) (setq icalendar-import-format (lambda () "Hello world")) (setq result (icalendar--parse-summary-and-rest "blah blah ")) - (assert (not result)) - )) - -(defun icalendar-testsuite--get-ical-event (ical-string) - "Helper function for testing `icalendar-testsuite--test-format-ical-event'. -Return icalendar event for ICAL-STRING." - (save-excursion - (with-temp-buffer - (insert ical-string) - (goto-char (point-min)) - (car (icalendar--read-element nil nil))))) - -(defun icalendar-testsuite--test-import-format-sample () - "Test method for `icalendar-import-format-sample'." - (assert (string= (icalendar-import-format-sample - (icalendar-testsuite--get-ical-event "BEGIN:VEVENT -DTSTAMP:20030509T043439Z -DTSTART:20030509T103000 -SUMMARY:a -ORGANIZER:d -LOCATION:c -DTEND:20030509T153000 -DESCRIPTION:b -END:VEVENT -")) - (concat "SUMMARY=`a' DESCRIPTION=`b' LOCATION=`c' " - "ORGANIZER=`d' STATUS=`' URL=`' CLASS=`'")))) - -(defun icalendar-testsuite--test-first-weekday-of-year () - "Test method for `icalendar-first-weekday-of-year'." - (assert (eq 1 (icalendar-first-weekday-of-year "TU" 2008))) - (assert (eq 3 (icalendar-first-weekday-of-year "WE" 2007))) - (assert (eq 5 (icalendar-first-weekday-of-year "TH" 2006))) - (assert (eq 7 (icalendar-first-weekday-of-year "FR" 2005))) - (assert (eq 3 (icalendar-first-weekday-of-year "SA" 2004))) - (assert (eq 5 (icalendar-first-weekday-of-year "SU" 2003))) - (assert (eq 7 (icalendar-first-weekday-of-year "MO" 2002))) - (assert (eq 3 (icalendar-first-weekday-of-year "MO" 2000))) - (assert (eq 1 (icalendar-first-weekday-of-year "TH" 1970)))) - -(defun icalendar-testsuite--test-datestring-to-isodate () - "Test method for `icalendar--datestring-to-isodate'." - (let ((calendar-date-style 'iso)) - ;; numeric iso - (assert (string= (icalendar--datestring-to-isodate "2008 05 11") - "20080511")) - (assert (string= (icalendar--datestring-to-isodate "2008 05 31") - "20080531")) - (assert (string= (icalendar--datestring-to-isodate "2008 05 31" 2) - "20080602")) - - ;; numeric european - (setq calendar-date-style 'european) - (assert (string= (icalendar--datestring-to-isodate "11 05 2008") - "20080511")) - (assert (string= (icalendar--datestring-to-isodate "31 05 2008") - "20080531")) - (assert (string= (icalendar--datestring-to-isodate "31 05 2008" 2) - "20080602")) - - ;; numeric american - (setq calendar-date-style 'american) - (assert (string= (icalendar--datestring-to-isodate "11 05 2008") - "20081105")) - (assert (string= (icalendar--datestring-to-isodate "12 30 2008") - "20081230")) - (assert (string= (icalendar--datestring-to-isodate "12 30 2008" 2) - "20090101")) - - ;; non-numeric - (setq calendar-date-style nil) ;not necessary for conversion - (assert (string= (icalendar--datestring-to-isodate "Nov 05 2008") - "20081105")) - (assert (string= (icalendar--datestring-to-isodate "05 Nov 2008") - "20081105")) - (assert (string= (icalendar--datestring-to-isodate "2008 Nov 05") - "20081105")))) - -(defun icalendar-testsuite--test-datetime-to-diary-date () - "Test method for `icalendar--datetime-to-diary-date'." - (let* ((datetime '(59 59 23 31 12 2008)) - (calendar-date-style 'iso)) - (assert (string= (icalendar--datetime-to-diary-date datetime) - "2008 12 31")) - (setq calendar-date-style 'european) - (assert (string= (icalendar--datetime-to-diary-date datetime) - "31 12 2008")) - (setq calendar-date-style 'american) - (assert (string= (icalendar--datetime-to-diary-date datetime) - "12 31 2008")))) - -(defun icalendar-testsuite--test-diarytime-to-isotime () - "Test method for `icalendar--diarytime-to-isotime'." - (assert (string= (icalendar--diarytime-to-isotime "01:15" "") - "T011500")) - (assert (string= (icalendar--diarytime-to-isotime "1:15" "") - "T011500")) - (assert (string= (icalendar--diarytime-to-isotime "0:01" "") - "T000100")) - (assert (string= (icalendar--diarytime-to-isotime "0100" "") - "T010000")) - (assert (string= (icalendar--diarytime-to-isotime "0100" "am") - "T010000")) - (assert (string= (icalendar--diarytime-to-isotime "0100" "pm") - "T130000")) - (assert (string= (icalendar--diarytime-to-isotime "1200" "") - "T120000")) - (assert (string= (icalendar--diarytime-to-isotime "17:17" "") - "T171700")) - (assert (string= (icalendar--diarytime-to-isotime "1200" "am") - "T000000")) - (assert (string= (icalendar--diarytime-to-isotime "1201" "am") - "T000100")) - (assert (string= (icalendar--diarytime-to-isotime "1259" "am") - "T005900")) - (assert (string= (icalendar--diarytime-to-isotime "1200" "pm") - "T120000")) - (assert (string= (icalendar--diarytime-to-isotime "1201" "pm") - "T120100")) - (assert (string= (icalendar--diarytime-to-isotime "1259" "pm") - "T125900"))) - -(defun icalendar-testsuite--test-convert-ordinary-to-ical () - "Test method for `icalendar--convert-ordinary-to-ical'." - (let* ((calendar-date-style 'iso) - result) - ;; without time - (setq result (icalendar--convert-ordinary-to-ical "&?" "2010 2 15 subject")) - (assert (= 2 (length result))) - (assert (string= "\nDTSTART;VALUE=DATE:20100215\nDTEND;VALUE=DATE:20100216" - (car result))) - (assert (string= "subject" (cadr result))) - - ;; with time - (setq result (icalendar--convert-ordinary-to-ical - "&?" "&2010 2 15 12:34-23:45 s")) - (assert (= 2 (length result))) - (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T123400" - "\nDTEND;VALUE=DATE-TIME:20100215T234500") - (car result))) - (assert (string= "s" (cadr result))) - - ;; with time, again -- test bug#5549 - (setq result (icalendar--convert-ordinary-to-ical - "x?" "x2010 2 15 0:34-1:45 s")) - (assert (= 2 (length result))) - (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20100215T003400" - "\nDTEND;VALUE=DATE-TIME:20100215T014500") - (car result))) - (assert (string= "s" (cadr result))))) - -(defun icalendar-testsuite--test-convert-weekly-to-ical () - "Test method for `icalendar--convert-weekly-to-ical'." - (let* ((calendar-date-style 'iso) - result - (calendar-day-name-array - ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" - "Saturday"])) - (setq result (icalendar--convert-weekly-to-ical "" "Monday 8:30 subject")) - (assert (= 2 (length result))) - (assert (string= (concat "\nDTSTART;VALUE=DATE-TIME:20050103T083000" - "\nDTEND;VALUE=DATE-TIME:20050103T093000" - "\nRRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO") - (car result))) - (assert (string= "subject" (cadr result))))) - -(defun icalendar-testsuite--test-convert-yearly-to-ical () - "Test method for `icalendar--convert-yearly-to-ical'." - (let* ((calendar-date-style 'iso) - result - (calendar-month-name-array - ["January" "February" "March" "April" "May" "June" "July" "August" - "September" "October" "November" "December"])) - (setq result (icalendar--convert-yearly-to-ical "" "May 1 Tag der Arbeit")) - (assert (= 2 (length result))) - (assert (string= (concat - "\nDTSTART;VALUE=DATE:19000501" - "\nDTEND;VALUE=DATE:19000502" - "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1") - (car result))) - (assert (string= "Tag der Arbeit" (cadr result))))) - -(defun icalendar-testsuite--test-convert-block-to-ical () - "Test method for `icalendar--convert-block-to-ical'." - (let* ((calendar-date-style 'iso) - result) - (setq result (icalendar--convert-block-to-ical - "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) - (assert (= 2 (length result))) - (assert (string= (concat - "\nDTSTART;VALUE=DATE:20040719" - "\nDTEND;VALUE=DATE:20040828") - (car result))) - (assert (string= "Sommerferien" (cadr result))))) - -(defun icalendar-testsuite--test-convert-cyclic-to-ical () - "Test method for `icalendar--convert-cyclic-to-ical'." - (let* ((calendar-date-style 'iso) - result) - (setq result (icalendar--convert-block-to-ical - "" "%%(diary-block 2004 7 19 2004 8 27) Sommerferien")) - (assert (= 2 (length result))) - (assert (string= (concat - "\nDTSTART;VALUE=DATE:20040719" - "\nDTEND;VALUE=DATE:20040828") - (car result))) - (assert (string= "Sommerferien" (cadr result))))) - -(defun icalendar-testsuite--test-convert-anniversary-to-ical () - "Test method for `icalendar--convert-anniversary-to-ical'." - (let* ((calendar-date-style 'iso) - result) - (setq result (icalendar--convert-anniversary-to-ical - "" "%%(diary-anniversary 1964 6 30) g")) - (assert (= 2 (length result))) - (assert (string= (concat - "\nDTSTART;VALUE=DATE:19640630" - "\nDTEND;VALUE=DATE:19640701" - "\nRRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=30") - (car result))) - (assert (string= "g" (cadr result))))) - -(defun icalendar-testsuite--test-calendar-style () - "Test method for `icalendar--date-style'." - (dolist (calendar-date-style '(iso american european)) - (assert (eq (icalendar--date-style) calendar-date-style))) - (let ((cds calendar-date-style) - (european-calendar-style t)) - (makunbound 'calendar-date-style) - (assert (eq (icalendar--date-style) 'european)) - (with-no-warnings (setq european-calendar-style nil)) ;still get warning!?! FIXME - (assert (eq (icalendar--date-style) 'american)) - (setq calendar-date-style cds))) - -(defun icalendar-testsuite--test-create-uid () - "Test method for `icalendar--create-uid'." - (let* ((icalendar-uid-format "xxx-%t-%c-%h-%u-%s") - t-ct - (icalendar--uid-count 77) - (entry-full "30.06.1964 07:01 blahblah") - (hash (format "%d" (abs (sxhash entry-full)))) - (contents "DTSTART:19640630T070100\nblahblah") - (username (or user-login-name "UNKNOWN_USER")) - ) - ;; FIXME! If a test fails 'current-time is screwed. FIXME! - (fset 't-ct (symbol-function 'current-time)) - (fset 'current-time (lambda () '(1 2 3))) - (assert (= 77 icalendar--uid-count)) - (assert (string= (concat "xxx-123-77-" hash "-" username "-19640630") - (icalendar--create-uid entry-full contents))) - (assert (= 78 icalendar--uid-count)) - (fset 'current-time (symbol-function 't-ct)) - - (setq contents "blahblah") - (setq icalendar-uid-format "yyy%syyy") - (assert (string= (concat "yyyDTSTARTyyy") - (icalendar--create-uid entry-full contents))) - )) - -(defun icalendar-testsuite--test-parse-vtimezone () - "Test method for `icalendar--parse-vtimezone'." - (let (vtimezone result) - (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE -TZID:thename -BEGIN:STANDARD -DTSTART:16010101T040000 -TZOFFSETFROM:+0300 -TZOFFSETTO:+0200 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10 -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:16010101T030000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0300 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3 -END:DAYLIGHT -END:VTIMEZONE -")) - (setq result (icalendar--parse-vtimezone vtimezone)) - (assert (string= "thename" (car result))) - (message (cdr result)) - (assert (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00" - (cdr result))) - (setq vtimezone (icalendar-testsuite--get-ical-event "BEGIN:VTIMEZONE -TZID:anothername -BEGIN:STANDARD -DTSTART:16010101T040000 -TZOFFSETFROM:+0300 -TZOFFSETTO:+0200 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=10 -END:STANDARD -BEGIN:DAYLIGHT -DTSTART:16010101T030000 -TZOFFSETFROM:+0200 -TZOFFSETTO:+0300 -RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2MO;BYMONTH=3 -END:DAYLIGHT -END:VTIMEZONE -")) - (setq result (icalendar--parse-vtimezone vtimezone)) - (assert (string= "anothername" (car result))) - (message (cdr result)) - (assert (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00" (cdr result))))) - -;; ====================================================================== -;; Test methods for exporting from diary to icalendar -;; ====================================================================== - -(defun icalendar-testsuite--test-export (input-iso input-european input-american - expected-output) + (should (not result)) + )) + +;; ====================================================================== +;; Export tests +;; ====================================================================== + +(defun icalendar-tests--test-export (input-iso input-european input-american + expected-output) "Perform an export test. Argument INPUT-ISO iso style diary string. Argument INPUT-EUROPEAN european style diary string. @@ -483,52 +458,57 @@ European style input data must use german month names. American and ISO style input data must use english month names." - (message "--- icalendar-testsuite--test-export ---") - (let ((calendar-date-style 'iso) - (icalendar-recurring-start-year 2000)) - (set-time-zone-rule "CET") ;;FIXME: reset timezone! - (when input-iso - (let ((calendar-month-name-array - ["January" "February" "March" "April" "May" "June" "July" "August" - "September" "October" "November" "December"]) - (calendar-day-name-array - ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" - "Saturday"])) - (setq calendar-date-style 'iso) - (icalendar-testsuite--do-test-export input-iso expected-output))) - (when input-european - (let ((calendar-month-name-array - ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August" - "September" "Oktober" "November" "Dezember"]) - (calendar-day-name-array - ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag" - "Samstag"])) - (setq calendar-date-style 'european) - (icalendar-testsuite--do-test-export input-european expected-output))) - (when input-american - (let ((calendar-month-name-array - ["January" "February" "March" "April" "May" "June" "July" "August" - "September" "October" "November" "December"]) - (calendar-day-name-array - ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" - "Saturday"])) - (setq calendar-date-style 'american) - (icalendar-testsuite--do-test-export input-american expected-output))))) + (let ((tz (cadr (current-time-zone))) + (calendar-date-style 'iso) + (icalendar-recurring-start-year 2000)) + (unwind-protect + (progn + (set-time-zone-rule "CET") + (when input-iso + (let ((calendar-month-name-array + ["January" "February" "March" "April" "May" "June" "July" "August" + "September" "October" "November" "December"]) + (calendar-day-name-array + ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" + "Saturday"])) + (setq calendar-date-style 'iso) + (icalendar-tests--do-test-export input-iso expected-output))) + (when input-european + (let ((calendar-month-name-array + ["Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August" + "September" "Oktober" "November" "Dezember"]) + (calendar-day-name-array + ["Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag" + "Samstag"])) + (setq calendar-date-style 'european) + (icalendar-tests--do-test-export input-european expected-output))) + (when input-american + (let ((calendar-month-name-array + ["January" "February" "March" "April" "May" "June" "July" "August" + "September" "October" "November" "December"]) + (calendar-day-name-array + ["Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" + "Saturday"])) + (setq calendar-date-style 'american) + (icalendar-tests--do-test-export input-american expected-output)))) + ;; restore time-zone if something went terribly wrong + (set-time-zone-rule tz)))) -(defun icalendar-testsuite--do-test-export (input expected-output) +(defun icalendar-tests--do-test-export (input expected-output) "Actually perform export test. Argument INPUT input diary string. Argument EXPECTED-OUTPUT expected icalendar result string." - (let ((temp-file (make-temp-file "icalendar-testsuite-ics"))) - (with-temp-buffer - (insert input) - (icalendar-export-region (point-min) (point-max) temp-file)) - (save-excursion - (find-file temp-file) - (goto-char (point-min)) - (unless - (cond (expected-output - (and (re-search-forward "^\\s-*BEGIN:VCALENDAR + (let ((temp-file (make-temp-file "icalendar-tests-ics"))) + (unwind-protect + (progn + (with-temp-buffer + (insert input) + (icalendar-export-region (point-min) (point-max) temp-file)) + (save-excursion + (find-file temp-file) + (goto-char (point-min)) + (cond (expected-output + (should (re-search-forward "^\\s-*BEGIN:VCALENDAR PRODID:-//Emacs//NONSGML icalendar.el//EN VERSION:2.0 BEGIN:VEVENT @@ -537,48 +517,190 @@ END:VEVENT END:VCALENDAR \\s-*$" - nil t) - (string-match - (concat "^\\s-*" - (regexp-quote (buffer-substring-no-properties - (match-beginning 1) (match-end 1))) - "\\s-*$") - expected-output))) - (t - (re-search-forward "^\\s-*BEGIN:VCALENDAR + nil t)) + (should (string-match + (concat "^\\s-*" + (regexp-quote (buffer-substring-no-properties + (match-beginning 1) (match-end 1))) + "\\s-*$") + expected-output))) + (t + (should (re-search-forward "^\\s-*BEGIN:VCALENDAR PRODID:-//Emacs//NONSGML icalendar.el//EN VERSION:2.0 END:VCALENDAR \\s-*$" - nil t))) - (error - "Export test failed! Input: `%s'\nFound:\n\n%s\n\nbut expected\n\n%s\n%s" - input - (or (and (match-beginning 1) - (buffer-substring-no-properties (match-beginning 1) - (match-end 1))) - "") - (or expected-output "") - (icalendar-testsuite--compare-strings (or (and (match-beginning 1) - (buffer-substring-no-properties (match-beginning 1) - (match-end 1))) - "") - (or expected-output ""))))) - (kill-buffer (find-buffer-visiting temp-file)) - (delete-file temp-file))) - -;; ====================================================================== -;; Test methods for importing from icalendar to diary -;; ====================================================================== - -(defun icalendar-testsuite--test-import (input expected-iso expected-european - expected-american) + nil t)))))) + ;; cleanup!! + (kill-buffer (find-buffer-visiting temp-file)) + (delete-file temp-file)))) + +(ert-deftest icalendar-export-ordinary-no-time () + "Perform export test." + + (let ((icalendar-export-hidden-diary-entries nil)) + (icalendar-tests--test-export + "&2000 Oct 3 ordinary no time " + "&3 Okt 2000 ordinary no time " + "&Oct 3 2000 ordinary no time " + nil)) + + (icalendar-tests--test-export + "2000 Oct 3 ordinary no time " + "3 Okt 2000 ordinary no time " + "Oct 3 2000 ordinary no time " + "DTSTART;VALUE=DATE:20001003 +DTEND;VALUE=DATE:20001004 +SUMMARY:ordinary no time +")) + +(ert-deftest icalendar-export-ordinary () + "Perform export test." + + (icalendar-tests--test-export + "2000 Oct 3 16:30 ordinary with time" + "3 Okt 2000 16:30 ordinary with time" + "Oct 3 2000 16:30 ordinary with time" + "DTSTART;VALUE=DATE-TIME:20001003T163000 +DTEND;VALUE=DATE-TIME:20001003T173000 +SUMMARY:ordinary with time +") + (icalendar-tests--test-export + "2000 10 3 16:30 ordinary with time 2" + "3 10 2000 16:30 ordinary with time 2" + "10 3 2000 16:30 ordinary with time 2" + "DTSTART;VALUE=DATE-TIME:20001003T163000 +DTEND;VALUE=DATE-TIME:20001003T173000 +SUMMARY:ordinary with time 2 +") + + (icalendar-tests--test-export + "2000/10/3 16:30 ordinary with time 3" + "3/10/2000 16:30 ordinary with time 3" + "10/3/2000 16:30 ordinary with time 3" + "DTSTART;VALUE=DATE-TIME:20001003T163000 +DTEND;VALUE=DATE-TIME:20001003T173000 +SUMMARY:ordinary with time 3 +")) + +(ert-deftest icalendar-export-multiline () + "Perform export test." + + ;; multiline -- FIXME!!! + (icalendar-tests--test-export + "2000 October 3 16:30 multiline + 17:30 multiline continued FIXME" + "3 Oktober 2000 16:30 multiline + 17:30 multiline continued FIXME" + "October 3 2000 16:30 multiline + 17:30 multiline continued FIXME" + "DTSTART;VALUE=DATE-TIME:20001003T163000 +DTEND;VALUE=DATE-TIME:20001003T173000 +SUMMARY:multiline +DESCRIPTION: + 17:30 multiline continued FIXME +")) + +(ert-deftest icalendar-export-weekly-by-day () + "Perform export test." + + ;; weekly by day + (icalendar-tests--test-export + "Monday 1:30pm weekly by day with start time" + "Montag 13:30 weekly by day with start time" + "Monday 1:30pm weekly by day with start time" + "DTSTART;VALUE=DATE-TIME:20000103T133000 +DTEND;VALUE=DATE-TIME:20000103T143000 +RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO +SUMMARY:weekly by day with start time +") + + (icalendar-tests--test-export + "Monday 13:30-15:00 weekly by day with start and end time" + "Montag 13:30-15:00 weekly by day with start and end time" + "Monday 01:30pm-03:00pm weekly by day with start and end time" + "DTSTART;VALUE=DATE-TIME:20000103T133000 +DTEND;VALUE=DATE-TIME:20000103T150000 +RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO +SUMMARY:weekly by day with start and end time +")) + +(ert-deftest icalendar-export-yearly () + "Perform export test." + ;; yearly + (icalendar-tests--test-export + "may 1 yearly no time" + "1 Mai yearly no time" + "may 1 yearly no time" + "DTSTART;VALUE=DATE:19000501 +DTEND;VALUE=DATE:19000502 +RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1 +SUMMARY:yearly no time +")) + +(ert-deftest icalendar-export-anniversary () + "Perform export test." + ;; anniversaries + (icalendar-tests--test-export + "%%(diary-anniversary 1989 10 3) anniversary no time" + "%%(diary-anniversary 3 10 1989) anniversary no time" + "%%(diary-anniversary 10 3 1989) anniversary no time" + "DTSTART;VALUE=DATE:19891003 +DTEND;VALUE=DATE:19891004 +RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03 +SUMMARY:anniversary no time +") + (icalendar-tests--test-export + "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time" + "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time" + "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time" + "DTSTART;VALUE=DATE-TIME:19891003T190000 +DTEND;VALUE=DATE-TIME:19891004T200000 +RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03 +SUMMARY:anniversary with time +")) + +(ert-deftest icalendar-export-block () + "Perform export test." + ;; block + (icalendar-tests--test-export + "%%(diary-block 2001 6 18 2001 7 6) block no time" + "%%(diary-block 18 6 2001 6 7 2001) block no time" + "%%(diary-block 6 18 2001 7 6 2001) block no time" + "DTSTART;VALUE=DATE:20010618 +DTEND;VALUE=DATE:20010707 +SUMMARY:block no time +") + (icalendar-tests--test-export + "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time" + "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time" + "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time" + "DTSTART;VALUE=DATE-TIME:20010618T130000 +DTEND;VALUE=DATE-TIME:20010618T170000 +RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706 +SUMMARY:block with time +") + (icalendar-tests--test-export + "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time" + "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time" + "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time" + "DTSTART;VALUE=DATE-TIME:20010618T130000 +DTEND;VALUE=DATE-TIME:20010618T140000 +RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706 +SUMMARY:block no end time +")) + +;; ====================================================================== +;; Import tests +;; ====================================================================== + +(defun icalendar-tests--test-import (input expected-iso expected-european + expected-american) "Perform import test. Argument INPUT icalendar event string. Argument EXPECTED-ISO expected iso style diary string. Argument EXPECTED-EUROPEAN expected european style diary string. Argument EXPECTED-AMERICAN expected american style diary string." - (message "--- icalendar-testsuite--test-import ---") (let ((timezone (cadr (current-time-zone)))) (set-time-zone-rule "CET") (with-temp-buffer @@ -601,126 +723,54 @@ calendar-date-style) (when expected-iso (setq calendar-date-style 'iso) - (icalendar-testsuite--do-test-import input expected-iso)) + (icalendar-tests--do-test-import input expected-iso)) (when expected-european (setq calendar-date-style 'european) - (icalendar-testsuite--do-test-import input expected-european)) + (icalendar-tests--do-test-import input expected-european)) (when expected-american (setq calendar-date-style 'american) - (icalendar-testsuite--do-test-import input expected-american)))) + (icalendar-tests--do-test-import input expected-american)))) (set-time-zone-rule timezone))) -(defun icalendar-testsuite--do-test-import (input expected-output) +(defun icalendar-tests--do-test-import (input expected-output) "Actually perform import test. Argument INPUT input icalendar string. Argument EXPECTED-OUTPUT expected diary string." (let ((temp-file (make-temp-file "icalendar-test-diary"))) (icalendar-import-buffer temp-file t t) - (save-excursion - (find-file temp-file) - (let* ((result (buffer-substring-no-properties (point-min) (point-max))) - (difference - (icalendar-testsuite--compare-strings result - expected-output))) - (if (stringp difference) - (error "Import test failed! Found\n`%s'\nbut expected\n`%s'\n%s'" - result expected-output difference))) + (unwind-protect + (save-excursion + (find-file temp-file) + (let ((result (buffer-substring-no-properties (point-min) (point-max)))) + (should (icalendar-tests--compare-strings result + expected-output)))) (kill-buffer (find-buffer-visiting temp-file)) (delete-file temp-file)))) -;; ====================================================================== -;; Test methods for cycle... -;; ====================================================================== -(defun icalendar-testsuite--test-cycle (input) - "Perform cycle test. -Argument INPUT icalendar event string." - (with-temp-buffer - (if (string-match "^BEGIN:VCALENDAR" input) - (insert input) - (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") - (insert "VERSION:2.0\nBEGIN:VEVENT\n") - (insert input) - (unless (eq (char-before) ?\n) - (insert "\n")) - (insert "END:VEVENT\nEND:VCALENDAR\n")) - (let ((icalendar-import-format "%s%d%l%o%t%u%c") - (icalendar-import-format-summary "%s") - (icalendar-import-format-location "\n Location: %s") - (icalendar-import-format-description "\n Desc: %s") - (icalendar-import-format-organizer "\n Organizer: %s") - (icalendar-import-format-status "\n Status: %s") - (icalendar-import-format-url "\n URL: %s") - (icalendar-import-format-class "\n Class: %s")) - (dolist (calendar-date-style '(iso european american)) - (icalendar-testsuite--do-test-cycle))))) - -(defun icalendar-testsuite--do-test-cycle () - "Actually perform import/export cycle test." - (let ((temp-diary (make-temp-file "icalendar-test-diary")) - (temp-ics (make-temp-file "icalendar-test-ics")) - (org-input (buffer-substring-no-properties (point-min) (point-max)))) - - ;; step 1: import - (icalendar-import-buffer temp-diary t t) - - ;; step 2: export what was just imported - (save-excursion - (find-file temp-diary) - (icalendar-export-region (point-min) (point-max) temp-ics)) - - ;; compare the output of step 2 with the input of step 1 - (save-excursion - (find-file temp-ics) - (goto-char (point-min)) - (when (re-search-forward "\nUID:.*\n" nil t) - (replace-match "\n")) - (let ((cycled (buffer-substring-no-properties (point-min) (point-max)))) - (let ((difference (icalendar-testsuite--compare-strings cycled - org-input))) - (if (stringp difference) - (error "Import test failed! Found\n`%s'\nbut expected\n`%s'\n%s'" - cycled org-input difference))) - )) - - ;; clean up -- Note this is done only if test is passed - (kill-buffer (find-buffer-visiting temp-diary)) - (save-excursion - (set-buffer (find-buffer-visiting temp-ics)) - (set-buffer-modified-p nil) - (kill-buffer (current-buffer))) - (delete-file temp-diary) - (delete-file temp-ics))) - -;; ====================================================================== -;; Import tests -;; ====================================================================== -(defun icalendar-testsuite--run-import-tests () +(ert-deftest icalendar-import-non-recurring () "Perform standard import tests." - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:non-recurring DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000" "&2003/9/19 09:00-11:30 non-recurring" "&19/9/2003 09:00-11:30 non-recurring" "&9/19/2003 09:00-11:30 non-recurring") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:non-recurring allday DTSTART;VALUE=DATE-TIME:20030919" "&2003/9/19 non-recurring allday" "&19/9/2003 non-recurring allday" "&9/19/2003 non-recurring allday") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import ;; do not remove the trailing blank after "long"! - "SUMMARY:long + "SUMMARY:long summary DTSTART;VALUE=DATE:20030919" "&2003/9/19 long summary" "&19/9/2003 long summary" "&9/19/2003 long summary") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import "UID:748f2da0-0d9b-11d8-97af-b4ec8686ea61 SUMMARY:Sommerferien STATUS:TENTATIVE @@ -742,8 +792,7 @@ "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien Status: TENTATIVE Class: PRIVATE") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import "UID :04979712-3902-11d9-93dd-8f9f4afe08da SUMMARY @@ -772,7 +821,8 @@ "&11/23/2004 14:00-14:30 folded summary Status: TENTATIVE Class: PRIVATE") - (icalendar-testsuite--test-import + + (icalendar-tests--test-import "UID :6161a312-3902-11d9-b512-f764153bb28b SUMMARY @@ -798,9 +848,10 @@ Class: PRIVATE" "&11/23/2004 14:45-15:45 another example Status: TENTATIVE - Class: PRIVATE") + Class: PRIVATE")) - (icalendar-testsuite--test-import +(ert-deftest icalendar-import-rrule () + (icalendar-tests--test-import "SUMMARY:rrule daily DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -809,9 +860,8 @@ "&%%(and (diary-cyclic 1 2003 9 19)) 09:00-11:30 rrule daily" "&%%(and (diary-cyclic 1 19 9 2003)) 09:00-11:30 rrule daily" "&%%(and (diary-cyclic 1 9 19 2003)) 09:00-11:30 rrule daily") - ;; RRULE examples - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule daily DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -820,7 +870,7 @@ "&%%(and (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily" "&%%(and (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily" "&%%(and (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule daily with exceptions DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -830,8 +880,7 @@ "&%%(and (not (diary-date 2003 9 25)) (not (diary-date 2003 9 21)) (diary-cyclic 2 2003 9 19)) 09:00-11:30 rrule daily with exceptions" "&%%(and (not (diary-date 25 9 2003)) (not (diary-date 21 9 2003)) (diary-cyclic 2 19 9 2003)) 09:00-11:30 rrule daily with exceptions" "&%%(and (not (diary-date 9 25 2003)) (not (diary-date 9 21 2003)) (diary-cyclic 2 9 19 2003)) 09:00-11:30 rrule daily with exceptions") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule weekly DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -840,7 +889,7 @@ "&%%(and (diary-cyclic 7 2003 9 19)) 09:00-11:30 rrule weekly" "&%%(and (diary-cyclic 7 19 9 2003)) 09:00-11:30 rrule weekly" "&%%(and (diary-cyclic 7 9 19 2003)) 09:00-11:30 rrule weekly") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule monthly no end DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -849,7 +898,7 @@ "&%%(and (diary-date t t 19) (diary-block 2003 9 19 9999 1 1)) 09:00-11:30 rrule monthly no end" "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 1 1 9999)) 09:00-11:30 rrule monthly no end" "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 1 9999)) 09:00-11:30 rrule monthly no end") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule monthly with end DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -858,7 +907,7 @@ "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2005 8 19)) 09:00-11:30 rrule monthly with end" "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 8 2005)) 09:00-11:30 rrule monthly with end" "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 8 19 2005)) 09:00-11:30 rrule monthly with end") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "DTSTART;VALUE=DATE:20040815 DTEND;VALUE=DATE:20040816 SUMMARY:Maria Himmelfahrt @@ -868,7 +917,7 @@ "&%%(and (diary-anniversary 2004 8 15)) Maria Himmelfahrt" "&%%(and (diary-anniversary 15 8 2004)) Maria Himmelfahrt" "&%%(and (diary-anniversary 8 15 2004)) Maria Himmelfahrt") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule yearly DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -877,7 +926,7 @@ "&%%(and (diary-anniversary 2003 9 19)) 09:00-11:30 rrule yearly" ;FIXME "&%%(and (diary-anniversary 19 9 2003)) 09:00-11:30 rrule yearly" ;FIXME "&%%(and (diary-anniversary 9 19 2003)) 09:00-11:30 rrule yearly") ;FIXME - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count daily short DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -886,7 +935,7 @@ "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 9 19)) 09:00-11:30 rrule count daily short" "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 19 9 2003)) 09:00-11:30 rrule count daily short" "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 9 19 2003)) 09:00-11:30 rrule count daily short") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count daily long DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -895,7 +944,7 @@ "&%%(and (diary-cyclic 1 2003 9 19) (diary-block 2003 9 19 2003 10 2)) 09:00-11:30 rrule count daily long" "&%%(and (diary-cyclic 1 19 9 2003) (diary-block 19 9 2003 2 10 2003)) 09:00-11:30 rrule count daily long" "&%%(and (diary-cyclic 1 9 19 2003) (diary-block 9 19 2003 10 2 2003)) 09:00-11:30 rrule count daily long") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count bi-weekly 3 times DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -904,7 +953,7 @@ "&%%(and (diary-cyclic 14 2003 9 19) (diary-block 2003 9 19 2003 10 31)) 09:00-11:30 rrule count bi-weekly 3 times" "&%%(and (diary-cyclic 14 19 9 2003) (diary-block 19 9 2003 31 10 2003)) 09:00-11:30 rrule count bi-weekly 3 times" "&%%(and (diary-cyclic 14 9 19 2003) (diary-block 9 19 2003 10 31 2003)) 09:00-11:30 rrule count bi-weekly 3 times") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count monthly DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -913,7 +962,7 @@ "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 1 19)) 09:00-11:30 rrule count monthly" "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 1 2004)) 09:00-11:30 rrule count monthly" "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 1 19 2004)) 09:00-11:30 rrule count monthly") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count every second month DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -922,7 +971,7 @@ "&%%(and (diary-date t t 19) (diary-block 2003 9 19 2004 5 19)) 09:00-11:30 rrule count every second month" ;FIXME "&%%(and (diary-date 19 t t) (diary-block 19 9 2003 19 5 2004)) 09:00-11:30 rrule count every second month" ;FIXME "&%%(and (diary-date t 19 t) (diary-block 9 19 2003 5 19 2004)) 09:00-11:30 rrule count every second month") ;FIXME - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count yearly DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -931,7 +980,7 @@ "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2007 9 19)) 09:00-11:30 rrule count yearly" "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2007)) 09:00-11:30 rrule count yearly" "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2007)) 09:00-11:30 rrule count yearly") - (icalendar-testsuite--test-import + (icalendar-tests--test-import "SUMMARY:rrule count every second year DTSTART;VALUE=DATE-TIME:20030919T090000 DTEND;VALUE=DATE-TIME:20030919T113000 @@ -940,9 +989,11 @@ "&%%(and (diary-date t 9 19) (diary-block 2003 9 19 2011 9 19)) 09:00-11:30 rrule count every second year" ;FIXME!!! "&%%(and (diary-date 19 9 t) (diary-block 19 9 2003 19 9 2011)) 09:00-11:30 rrule count every second year" ;FIXME!!! "&%%(and (diary-date 9 19 t) (diary-block 9 19 2003 9 19 2011)) 09:00-11:30 rrule count every second year") ;FIXME!!! +) +(ert-deftest icalendar-import-duration () ;; duration - (icalendar-testsuite--test-import + (icalendar-tests--test-import "DTSTART;VALUE=DATE:20050217 SUMMARY:duration DURATION:P7D @@ -950,8 +1001,7 @@ "&%%(and (diary-block 2005 2 17 2005 2 23)) duration" "&%%(and (diary-block 17 2 2005 23 2 2005)) duration" "&%%(and (diary-block 2 17 2005 2 23 2005)) duration") - - (icalendar-testsuite--test-import + (icalendar-tests--test-import "UID:20041127T183329Z-18215-1001-4536-49109@andromeda DTSTAMP:20041127T183315Z LAST-MODIFIED:20041127T183329 @@ -968,10 +1018,11 @@ "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001)) Urlaub Class: PUBLIC" "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001)) Urlaub - Class: PUBLIC") + Class: PUBLIC")) +(ert-deftest icalendar-import-bug-6766 () ;;bug#6766 -- multiple byday values in a weekly rrule - (icalendar-testsuite--test-import + (icalendar-tests--test-import "CLASS:PUBLIC DTEND;TZID=America/New_York:20100421T120000 DTSTAMP:20100525T141214Z @@ -1010,160 +1061,97 @@ Status: CONFIRMED Class: PUBLIC &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking - Class: PUBLIC") -) - -;; ====================================================================== -;; Export tests -;; ====================================================================== -(defun icalendar-testsuite--run-export-tests () - "Perform standard export tests." - - (let ((icalendar-export-hidden-diary-entries nil)) - (icalendar-testsuite--test-export - "&2000 Oct 3 ordinary no time " - "&3 Okt 2000 ordinary no time " - "&Oct 3 2000 ordinary no time " - nil)) - - ;; "ordinary" events - (icalendar-testsuite--test-export - "2000 Oct 3 ordinary no time " - "3 Okt 2000 ordinary no time " - "Oct 3 2000 ordinary no time " - "DTSTART;VALUE=DATE:20001003 -DTEND;VALUE=DATE:20001004 -SUMMARY:ordinary no time -") - (icalendar-testsuite--test-export - "2000 Oct 3 16:30 ordinary with time" - "3 Okt 2000 16:30 ordinary with time" - "Oct 3 2000 16:30 ordinary with time" - "DTSTART;VALUE=DATE-TIME:20001003T163000 -DTEND;VALUE=DATE-TIME:20001003T173000 -SUMMARY:ordinary with time -") - (icalendar-testsuite--test-export - "2000 10 3 16:30 ordinary with time 2" - "3 10 2000 16:30 ordinary with time 2" - "10 3 2000 16:30 ordinary with time 2" - "DTSTART;VALUE=DATE-TIME:20001003T163000 -DTEND;VALUE=DATE-TIME:20001003T173000 -SUMMARY:ordinary with time 2 -") - - (icalendar-testsuite--test-export - "2000/10/3 16:30 ordinary with time 3" - "3/10/2000 16:30 ordinary with time 3" - "10/3/2000 16:30 ordinary with time 3" - "DTSTART;VALUE=DATE-TIME:20001003T163000 -DTEND;VALUE=DATE-TIME:20001003T173000 -SUMMARY:ordinary with time 3 -") - - ;; multiline -- FIXME!!! - (icalendar-testsuite--test-export - "2000 October 3 16:30 multiline - 17:30 multiline continued FIXME" - "3 Oktober 2000 16:30 multiline - 17:30 multiline continued FIXME" - "October 3 2000 16:30 multiline - 17:30 multiline continued FIXME" - "DTSTART;VALUE=DATE-TIME:20001003T163000 -DTEND;VALUE=DATE-TIME:20001003T173000 -SUMMARY:multiline -DESCRIPTION: - 17:30 multiline continued FIXME -") - - ;; weekly by day - (icalendar-testsuite--test-export - "Monday 1:30pm weekly by day with start time" - "Montag 13:30 weekly by day with start time" - "Monday 1:30pm weekly by day with start time" - "DTSTART;VALUE=DATE-TIME:20000103T133000 -DTEND;VALUE=DATE-TIME:20000103T143000 -RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO -SUMMARY:weekly by day with start time -") - - (icalendar-testsuite--test-export - "Monday 13:30-15:00 weekly by day with start and end time" - "Montag 13:30-15:00 weekly by day with start and end time" - "Monday 01:30pm-03:00pm weekly by day with start and end time" - "DTSTART;VALUE=DATE-TIME:20000103T133000 -DTEND;VALUE=DATE-TIME:20000103T150000 -RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO -SUMMARY:weekly by day with start and end time -") - - ;; yearly - (icalendar-testsuite--test-export - "may 1 yearly no time" - "1 Mai yearly no time" - "may 1 yearly no time" - "DTSTART;VALUE=DATE:19000501 -DTEND;VALUE=DATE:19000502 -RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=5;BYMONTHDAY=1 -SUMMARY:yearly no time -") - - ;; anniversaries - (icalendar-testsuite--test-export - "%%(diary-anniversary 1989 10 3) anniversary no time" - "%%(diary-anniversary 3 10 1989) anniversary no time" - "%%(diary-anniversary 10 3 1989) anniversary no time" - "DTSTART;VALUE=DATE:19891003 -DTEND;VALUE=DATE:19891004 -RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03 -SUMMARY:anniversary no time -") - (icalendar-testsuite--test-export - "%%(diary-anniversary 1989 10 3) 19:00-20:00 anniversary with time" - "%%(diary-anniversary 3 10 1989) 19:00-20:00 anniversary with time" - "%%(diary-anniversary 10 3 1989) 19:00-20:00 anniversary with time" - "DTSTART;VALUE=DATE-TIME:19891003T190000 -DTEND;VALUE=DATE-TIME:19891004T200000 -RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=10;BYMONTHDAY=03 -SUMMARY:anniversary with time -") - - ;; block - (icalendar-testsuite--test-export - "%%(diary-block 2001 6 18 2001 7 6) block no time" - "%%(diary-block 18 6 2001 6 7 2001) block no time" - "%%(diary-block 6 18 2001 7 6 2001) block no time" - "DTSTART;VALUE=DATE:20010618 -DTEND;VALUE=DATE:20010707 -SUMMARY:block no time -") - (icalendar-testsuite--test-export - "%%(diary-block 2001 6 18 2001 7 6) 13:00-17:00 block with time" - "%%(diary-block 18 6 2001 6 7 2001) 13:00-17:00 block with time" - "%%(diary-block 6 18 2001 7 6 2001) 13:00-17:00 block with time" - "DTSTART;VALUE=DATE-TIME:20010618T130000 -DTEND;VALUE=DATE-TIME:20010618T170000 -RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706 -SUMMARY:block with time -") - (icalendar-testsuite--test-export - "%%(diary-block 2001 6 18 2001 7 6) 13:00 block no end time" - "%%(diary-block 18 6 2001 6 7 2001) 13:00 block no end time" - "%%(diary-block 6 18 2001 7 6 2001) 13:00 block no end time" - "DTSTART;VALUE=DATE-TIME:20010618T130000 -DTEND;VALUE=DATE-TIME:20010618T140000 -RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20010706 -SUMMARY:block no end time -") - ) + Class: PUBLIC")) + + +;; ====================================================================== +;; Cycle +;; ====================================================================== +(defun icalendar-tests--test-cycle (input) + "Perform cycle test. +Argument INPUT icalendar event string." + (with-temp-buffer + (if (string-match "^BEGIN:VCALENDAR" input) + (insert input) + (insert "BEGIN:VCALENDAR\nPRODID:-//Emacs//NONSGML icalendar.el//EN\n") + (insert "VERSION:2.0\nBEGIN:VEVENT\n") + (insert input) + (unless (eq (char-before) ?\n) + (insert "\n")) + (insert "END:VEVENT\nEND:VCALENDAR\n")) + (let ((icalendar-import-format "%s%d%l%o%t%u%c") + (icalendar-import-format-summary "%s") + (icalendar-import-format-location "\n Location: %s") + (icalendar-import-format-description "\n Desc: %s") + (icalendar-import-format-organizer "\n Organizer: %s") + (icalendar-import-format-status "\n Status: %s") + (icalendar-import-format-url "\n URL: %s") + (icalendar-import-format-class "\n Class: %s")) + (dolist (calendar-date-style '(iso european american)) + (icalendar-tests--do-test-cycle))))) + +(defun icalendar-tests--do-test-cycle () + "Actually perform import/export cycle test." + (let ((temp-diary (make-temp-file "icalendar-test-diary")) + (temp-ics (make-temp-file "icalendar-test-ics")) + (org-input (buffer-substring-no-properties (point-min) (point-max)))) + + (unwind-protect + (progn + ;; step 1: import + (icalendar-import-buffer temp-diary t t) + + ;; step 2: export what was just imported + (save-excursion + (find-file temp-diary) + (icalendar-export-region (point-min) (point-max) temp-ics)) + + ;; compare the output of step 2 with the input of step 1 + (save-excursion + (find-file temp-ics) + (goto-char (point-min)) + (when (re-search-forward "\nUID:.*\n" nil t) + (replace-match "\n")) + (let ((cycled (buffer-substring-no-properties (point-min) (point-max)))) + (should (icalendar-tests--compare-strings cycled org-input))))) + ;; clean up + (kill-buffer (find-buffer-visiting temp-diary)) + (save-excursion + (set-buffer (find-buffer-visiting temp-ics)) + (set-buffer-modified-p nil) + (kill-buffer (current-buffer))) + (delete-file temp-diary) + (delete-file temp-ics)))) + +(ert-deftest icalendar-cycle () + "Perform cycling tests." + (icalendar-tests--test-cycle + "DTSTART;VALUE=DATE-TIME:20030919T090000 +DTEND;VALUE=DATE-TIME:20030919T113000 +SUMMARY:Cycletest +") + (icalendar-tests--test-cycle + "DTSTART;VALUE=DATE-TIME:20030919T090000 +DTEND;VALUE=DATE-TIME:20030919T113000 +SUMMARY:Cycletest +DESCRIPTION:beschreibung! +LOCATION:nowhere +ORGANIZER:ulf +") + (icalendar-tests--test-cycle + "DTSTART;VALUE=DATE:19190909 +DTEND;VALUE=DATE:19190910 +RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 +SUMMARY:and diary-anniversary +")) ;; ====================================================================== ;; Real world ;; ====================================================================== -(defun icalendar-testsuite--run-real-world-tests () +(ert-deftest icalendar-real-world () "Perform real-world tests, as gathered from problem reports." ;; 2003-05-29 - (icalendar-testsuite--test-import + (icalendar-tests--test-import "BEGIN:VCALENDAR METHOD:REQUEST PRODID:Microsoft CDO for Microsoft Exchange @@ -1231,7 +1219,7 @@ Status: CONFIRMED") ;; 2003-06-18 a - (icalendar-testsuite--test-import + (icalendar-tests--test-import "DTSTAMP:20030618T195512Z DTSTART;TZID=\"Mountain Time (US & Canada)\":20030623T110000 SUMMARY:Dress Rehearsal for XXXX-XXXX @@ -1273,9 +1261,8 @@ Location: 555 or TN 555-5555 ID 5555 & NochWas (see below) Organizer: MAILTO:xxx@xxxxx.com Status: CONFIRMED") - ;; 2003-06-18 b -- uses timezone - (icalendar-testsuite--test-import + (icalendar-tests--test-import "BEGIN:VCALENDAR METHOD:REQUEST PRODID:Microsoft CDO for Microsoft Exchange @@ -1342,9 +1329,8 @@ Location: 123 or TN 123-1234 ID abcd & SonstWo (see below) Organizer: MAILTO:bbb@bbbbb.com Status: CONFIRMED") - ;; export 2004-10-28 block entries - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "-*- mode: text; fill-column: 256;-*- @@ -1357,7 +1343,7 @@ DTEND;VALUE=DATE:20041111 SUMMARY:Nov 8-10 aa") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-block 12 13 2004 12 17 2004) Dec 13-17 bb" @@ -1365,7 +1351,7 @@ DTEND;VALUE=DATE:20041218 SUMMARY:Dec 13-17 bb") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-block 2 3 2005 2 4 2005) Feb 3-4 cc" @@ -1373,7 +1359,7 @@ DTEND;VALUE=DATE:20050205 SUMMARY:Feb 3-4 cc") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-block 4 24 2005 4 29 2005) April 24-29 dd" @@ -1381,7 +1367,7 @@ DTEND;VALUE=DATE:20050430 SUMMARY:April 24-29 dd ") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-block 5 30 2005 6 1 2005) may 30 - June 1: ee" @@ -1389,16 +1375,16 @@ DTEND;VALUE=DATE:20050602 SUMMARY:may 30 - June 1: ee") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-block 6 6 2005 6 8 2005) ff" "DTSTART;VALUE=DATE:20050606 DTEND;VALUE=DATE:20050609 SUMMARY:ff") - + ;; export 2004-10-28 anniversary entries - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil " @@ -1411,7 +1397,7 @@ SUMMARY:aa birthday (%d years old) ") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-anniversary 5 17 1957) bb birthday (%d years old)" @@ -1420,7 +1406,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=05;BYMONTHDAY=17 SUMMARY:bb birthday (%d years old)") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-anniversary 6 8 1997) cc birthday (%d years old)" @@ -1429,7 +1415,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=06;BYMONTHDAY=08 SUMMARY:cc birthday (%d years old)") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-anniversary 7 22 1983) dd (%d years ago...!)" @@ -1438,7 +1424,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=07;BYMONTHDAY=22 SUMMARY:dd (%d years ago...!)") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-anniversary 8 1 1988) ee birthday (%d years old)" @@ -1447,7 +1433,7 @@ RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=08;BYMONTHDAY=01 SUMMARY:ee birthday (%d years old)") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "%%(diary-anniversary 9 21 1957) ff birthday (%d years old)" @@ -1461,7 +1447,7 @@ ;; export 2004-10-28 monthly, weekly entries - ;; (icalendar-testsuite--test-export + ;; (icalendar-tests--test-export ;; nil ;; " ;; >>> ------------ monthly: @@ -1469,7 +1455,7 @@ ;; */27/* 10:00 blah blah" ;; "xxx") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil ">>> ------------ my week: @@ -1480,7 +1466,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO SUMMARY:MAC") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Monday 15:00 a1" @@ -1490,7 +1476,7 @@ SUMMARY:a1") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Monday 16:00-17:00 a2" @@ -1499,7 +1485,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=MO SUMMARY:a2") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Tuesday 11:30-13:00 a3" @@ -1508,7 +1494,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU SUMMARY:a3") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Tuesday 15:00 a4" @@ -1517,7 +1503,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=TU SUMMARY:a4") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Wednesday 13:00 a5" @@ -1526,7 +1512,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE SUMMARY:a5") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Wednesday 11:30-13:30 a6" @@ -1535,7 +1521,7 @@ RRULE:FREQ=WEEKLY;INTERVAL=1;BYDAY=WE SUMMARY:a6") - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil "Wednesday 15:00 s1" @@ -1546,7 +1532,7 @@ ;; export 2004-10-28 regular entries - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil " @@ -1558,7 +1544,7 @@ SUMMARY:Tue: [2004-10-12] q1") ;; 2004-11-19 - (icalendar-testsuite--test-import + (icalendar-tests--test-import "BEGIN:VCALENDAR VERSION :2.0 @@ -1733,7 +1719,7 @@ Class: PRIVATE") ;; 2004-09-09 pg - (icalendar-testsuite--test-export + (icalendar-tests--test-export "%%(diary-block 1 1 2004 4 1 2004) Urlaub" nil nil @@ -1742,7 +1728,7 @@ SUMMARY:Urlaub") ;; 2004-10-25 pg - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil "5 11 2004 Bla Fasel" nil @@ -1751,7 +1737,7 @@ SUMMARY:Bla Fasel") ;; 2004-10-30 pg - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil "2 Nov 2004 15:00-16:30 Zahnarzt" nil @@ -1760,7 +1746,7 @@ SUMMARY:Zahnarzt") ;; 2005-02-07 lt - (icalendar-testsuite--test-import + (icalendar-tests--test-import "UID :b60d398e-1dd1-11b2-a159-cf8cb05139f4 SUMMARY @@ -1792,7 +1778,7 @@ Class: PRIVATE") ;; 2005-03-01 lt - (icalendar-testsuite--test-import + (icalendar-tests--test-import "DTSTART;VALUE=DATE:20050217 SUMMARY:Hhhhhh Aaaaa ii Aaaaaaaa UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID @@ -1803,7 +1789,7 @@ "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa") ;; 2005-03-23 lt - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil "&%%(diary-cyclic 7 8 2 2005) 16:00-16:45 [WORK] Pppp" nil @@ -1814,7 +1800,7 @@ ") ;; 2005-05-27 eu - (icalendar-testsuite--test-export + (icalendar-tests--test-export nil nil ;; FIXME: colon not allowed! @@ -1827,32 +1813,5 @@ ") ) -(defun icalendar-testsuite--run-cycle-tests () - "Perform cycling tests." - (icalendar-testsuite--test-cycle - "DTSTART;VALUE=DATE-TIME:20030919T090000 -DTEND;VALUE=DATE-TIME:20030919T113000 -SUMMARY:Cycletest -") - - (icalendar-testsuite--test-cycle - "DTSTART;VALUE=DATE-TIME:20030919T090000 -DTEND;VALUE=DATE-TIME:20030919T113000 -SUMMARY:Cycletest -DESCRIPTION:beschreibung! -LOCATION:nowhere -ORGANIZER:ulf -") - - (icalendar-testsuite--test-cycle - "DTSTART;VALUE=DATE:19190909 -DTEND;VALUE=DATE:19190910 -RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09 -SUMMARY:and diary-anniversary -") - ) - - -(provide 'icalendar-testsuite) - -;;; icalendar-testsuite.el ends here +(provide 'icalendar-tests) +;;; icalendar-tests.el ends here ------------------------------------------------------------ revno: 103361 committer: Andreas Schwab branch nick: emacs timestamp: Sun 2011-02-20 12:59:44 +0100 message: Update autoloads diff: === modified file 'lisp/dired.el' --- lisp/dired.el 2011-02-19 20:36:54 +0000 +++ lisp/dired.el 2011-02-20 11:59:44 +0000 @@ -3613,7 +3613,7 @@ ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "281daa2642afe5c52ba09a29ea17dbd7") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "9d6333fab9c0f1b49e0bf2a536b8f245") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ @@ -4072,7 +4072,7 @@ ;;;*** ;;;### (autoloads (dired-do-relsymlink dired-jump) "dired-x" "dired-x.el" -;;;;;; "9e412288898d065e4ae92d106e0426c0") +;;;;;; "86d436093caa9ae80f7b73915c6a4b4c") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\ === modified file 'lisp/mail/rmail.el' --- lisp/mail/rmail.el 2011-02-19 19:40:59 +0000 +++ lisp/mail/rmail.el 2011-02-20 11:59:44 +0000 @@ -4306,7 +4306,7 @@ ;;;*** -;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "9c0902449733cabd5c7e7d17092a7c69") +;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "04902da045706fb7f2b0915529ed161b") ;;; Generated autoloads from rmailmm.el (autoload 'rmail-mime "rmailmm" "\ ------------------------------------------------------------ revno: 103360 [merge] committer: Paul Eggert branch nick: trunk timestamp: Sun 2011-02-20 00:48:52 -0800 message: Merge: Import crypto/md5 and stdint modules from gnulib. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-19 16:53:10 +0000 +++ ChangeLog 2011-02-20 08:48:52 +0000 @@ -1,3 +1,17 @@ +2011-02-20 Paul Eggert + + Import crypto/md5 and stdint modules from gnulib. + * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: + Regenerate. + * lib/md5.c, lib/md5.h: Rename from src/md5.h and lib/md5.h. + Import the new versions from gnulib; they assume a C99-style + , supplied by the stdint module. + * lib/stdint.in.h, m4/longlong.m4, m4/stdint.m4, m4/md5.m4: New files, + imported from gnulib. + * Makefile.in (MAKEFILE_MODULES): Add crypto/md5. + * admin/notes/copyright: Remove src/md5.c and src/md5.h as + special cases. + 2011-02-19 Eli Zaretskii * .bzrignore: Ignore cxxdefs.h and lib/*.in-h files. === modified file 'Makefile.in' --- Makefile.in 2011-02-16 00:33:44 +0000 +++ Makefile.in 2011-02-18 08:07:03 +0000 @@ -330,7 +330,8 @@ # Update modules from gnulib, for maintainers, who should have it in # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools # as per $(gnulib_srcdir)/DEPENDENCIES. -GNULIB_MODULES = dtoastr getloadavg getopt-gnu ignore-value mktime strftime +GNULIB_MODULES = \ + crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime GNULIB_TOOL_FLAGS = \ --import --no-changelog --no-vc-files --makefile-name=gnulib.mk sync-from-gnulib: $(gnulib_srcdir) === modified file 'aclocal.m4' --- aclocal.m4 2011-02-16 00:33:44 +0000 +++ aclocal.m4 2011-02-19 07:28:29 +0000 @@ -992,10 +992,13 @@ m4_include([m4/gl-comp.m4]) m4_include([m4/gnulib-common.m4]) m4_include([m4/include_next.m4]) +m4_include([m4/longlong.m4]) +m4_include([m4/md5.m4]) m4_include([m4/mktime.m4]) m4_include([m4/multiarch.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/stddef_h.m4]) +m4_include([m4/stdint.m4]) m4_include([m4/stdlib_h.m4]) m4_include([m4/strftime.m4]) m4_include([m4/time_h.m4]) === modified file 'admin/notes/copyright' --- admin/notes/copyright 2011-02-16 00:33:44 +0000 +++ admin/notes/copyright 2011-02-18 08:07:03 +0000 @@ -557,7 +557,7 @@ files I thought might be considered non-trivial (if one includes comment) in s/: aix4-1.h hpux10.h irix6-0.h irix6-5.h - ptx4.h sol2.h + ptx4.h sol2.h (everything with > 30 non-blank lines, which at least is _some_ kind of system) @@ -632,8 +632,6 @@ lib/*.[ch] lib/gnulib.mk src/gmalloc.c - src/md5.c - src/md5.h src/termcap.c src/tparam.c === modified file 'configure' --- configure 2011-02-18 07:41:43 +0000 +++ configure 2011-02-19 07:28:29 +0000 @@ -679,6 +679,30 @@ NEXT_TIME_H NEXT_AS_FIRST_DIRECTIVE_STDLIB_H NEXT_STDLIB_H +STDINT_H +WINT_T_SUFFIX +WCHAR_T_SUFFIX +SIG_ATOMIC_T_SUFFIX +SIZE_T_SUFFIX +PTRDIFF_T_SUFFIX +HAVE_SIGNED_WINT_T +HAVE_SIGNED_WCHAR_T +HAVE_SIGNED_SIG_ATOMIC_T +BITSIZEOF_WINT_T +BITSIZEOF_WCHAR_T +BITSIZEOF_SIG_ATOMIC_T +BITSIZEOF_SIZE_T +BITSIZEOF_PTRDIFF_T +HAVE_SYS_BITYPES_H +HAVE_SYS_INTTYPES_H +HAVE_STDINT_H +NEXT_AS_FIRST_DIRECTIVE_STDINT_H +NEXT_STDINT_H +HAVE_SYS_TYPES_H +HAVE_INTTYPES_H +HAVE_WCHAR_H +HAVE_UNSIGNED_LONG_LONG_INT +HAVE_LONG_LONG_INT NEXT_AS_FIRST_DIRECTIVE_STDDEF_H NEXT_STDDEF_H STDDEF_H @@ -2431,6 +2455,184 @@ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -2721,6 +2923,8 @@ gl_getopt_required=GNU as_fn_append ac_header_list " getopt.h" as_fn_append ac_func_list " alarm" +as_fn_append ac_header_list " wchar.h" +as_fn_append ac_header_list " stdint.h" as_fn_append ac_func_list " tzset" as_fn_append ac_header_list " sys/time.h" as_fn_append ac_func_list " localtime_r" @@ -5881,6 +6085,7 @@ # Code from module arg-nonnull: # Code from module c++defs: + # Code from module crypto/md5: # Code from module dtoastr: # Code from module extensions: @@ -5895,6 +6100,7 @@ # Code from module multiarch: # Code from module stdbool: # Code from module stddef: + # Code from module stdint: # Code from module stdlib: # Code from module strftime: # Code from module time: @@ -13201,6 +13407,274 @@ export LIBC_FATAL_STDERR_ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strtold conforms to C99" >&5 $as_echo_n "checking whether strtold conforms to C99... " >&6; } if ${gl_cv_func_c99_strtold+:} false; then : @@ -13964,48 +14438,6 @@ fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - GNULIB_MKTIME=0; GNULIB_NANOSLEEP=0; @@ -14206,6 +14638,127 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 +$as_echo_n "checking for unsigned long long int... " >&6; } +if ${ac_cv_type_unsigned_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_unsigned_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + ac_cv_type_unsigned_long_long_int=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 +$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } + if test $ac_cv_type_unsigned_long_long_int = yes; then + +$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + fi + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 +$as_echo_n "checking for long long int... " >&6; } +if ${ac_cv_type_long_long_int+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_type_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif +int +main () +{ +long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_type_long_long_int=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 +$as_echo "$ac_cv_type_long_long_int" >&6; } + if test $ac_cv_type_long_long_int = yes; then + +$as_echo "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + fi + + + + + + ac_fn_c_check_member "$LINENO" "struct tm" "tm_gmtoff" "ac_cv_member_struct_tm_tm_gmtoff" "#include " if test "x$ac_cv_member_struct_tm_tm_gmtoff" = xyes; then : @@ -14460,6 +15013,23 @@ gl_source_base='lib' # Code from module arg-nonnull: # Code from module c++defs: + # Code from module crypto/md5: + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS md5.$ac_objext" + + + + + : + # Code from module dtoastr: # Code from module extensions: @@ -15424,6 +15994,710 @@ fi + # Code from module stdint: + + + + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + + + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_stdint_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_stdint_h = yes; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_stdint_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/stdint.h#{ + s#.*"\(.*/stdint.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 +$as_echo "$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdint.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdint_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 +$as_echo_n "checking whether stdint.h conforms to C99... " >&6; } +if ${gl_cv_header_working_stdint_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + gl_cv_header_working_stdint_h=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if test "$cross_compiling" = yes; then : + gl_cv_header_working_stdint_h=yes + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include + + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; + +int +main () +{ + + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_header_working_stdint_h=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 +$as_echo "$gl_cv_header_working_stdint_h" >&6; } + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + for ac_header in sys/inttypes.h sys/bitypes.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + + + + + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include "; then : + +else + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +$as_echo_n "checking for bit size of $gltype... " >&6; } +if eval \${gl_cv_bitsizeof_${gltype}+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + +#include "; then : + +else + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + cat >>confdefs.h <<_ACEOF +#define BITSIZEOF_${GLTYPE} $result +_ACEOF + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 +$as_echo_n "checking whether $gltype is signed... " >&6; } +if eval \${gl_cv_type_${gltype}_signed+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + result=yes +else + result=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +eval ac_res=\$gl_cv_type_${gltype}_signed + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + cat >>confdefs.h <<_ACEOF +#define HAVE_SIGNED_${GLTYPE} 1 +_ACEOF + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if eval \${gl_cv_type_${gltype}_suffix+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +$as_echo_n "checking for $gltype integer literal suffix... " >&6; } +if eval \${gl_cv_type_${gltype}_suffix+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + cat >>confdefs.h <<_ACEOF +#define ${GLTYPE}_SUFFIX $result +_ACEOF + + done + + + + STDINT_H=stdint.h + fi + + # Code from module stdlib: @@ -17861,6 +19135,7 @@ Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi + gl_libobjs= gl_ltlibobjs= if test -n "$gl_LIBOBJS"; then === modified file 'lib/Makefile.in' --- lib/Makefile.in 2011-02-16 00:33:44 +0000 +++ lib/Makefile.in 2011-02-19 07:28:29 +0000 @@ -24,7 +24,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -53,13 +53,14 @@ $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ - $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/mktime.m4 \ + $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdlib_h.m4 \ - $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/time_h.m4 \ - $(top_srcdir)/m4/time_r.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \ - $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/wchar_t.m4 \ - $(top_srcdir)/configure.in + $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ + $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ + $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ + $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -95,6 +96,11 @@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ BLESSMAIL_TARGET = @BLESSMAIL_TARGET@ CANNOT_DUMP = @CANNOT_DUMP@ CC = @CC@ @@ -244,9 +250,11 @@ HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GRANTPT = @HAVE_GRANTPT@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ HAVE_MAKEINFO = @HAVE_MAKEINFO@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ @@ -267,7 +275,11 @@ HAVE_REALPATH = @HAVE_REALPATH@ HAVE_RPMATCH = @HAVE_RPMATCH@ HAVE_SETENV = @HAVE_SETENV@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ HAVE_STRPTIME = @HAVE_STRPTIME@ HAVE_STRTOD = @HAVE_STRTOD@ HAVE_STRTOLL = @HAVE_STRTOLL@ @@ -275,13 +287,18 @@ HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@ HAVE_SYMLINK = @HAVE_SYMLINK@ HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@ HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ HAVE_TIMEGM = @HAVE_TIMEGM@ HAVE_UNISTD_H = @HAVE_UNISTD_H@ HAVE_UNLINKAT = @HAVE_UNLINKAT@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ +HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_USLEEP = @HAVE_USLEEP@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_XSERVER = @HAVE_XSERVER@ HAVE__BOOL = @HAVE__BOOL@ @@ -350,11 +367,13 @@ M_FILE = @M_FILE@ NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ +NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ @@ -381,6 +400,7 @@ PRE_ALLOC_OBJ = @PRE_ALLOC_OBJ@ PROFILING_CFLAGS = @PROFILING_CFLAGS@ PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ RALLOC_OBJ = @RALLOC_OBJ@ RANLIB = @RANLIB@ REPLACE_CALLOC = @REPLACE_CALLOC@ @@ -427,9 +447,12 @@ RSVG_LIBS = @RSVG_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ START_FILES = @START_FILES@ STDBOOL_H = @STDBOOL_H@ STDDEF_H = @STDDEF_H@ +STDINT_H = @STDINT_H@ STRIP = @STRIP@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ S_FILE = @S_FILE@ @@ -443,8 +466,10 @@ UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ VERSION = @VERSION@ VMLIMIT_OBJ = @VMLIMIT_OBJ@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ WIDGET_OBJ = @WIDGET_OBJ@ WINDOW_SUPPORT = @WINDOW_SUPPORT@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ XFT_CFLAGS = @XFT_CFLAGS@ XFT_LIBS = @XFT_LIBS@ XMENU_OBJ = @XMENU_OBJ@ @@ -534,23 +559,25 @@ # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ - $(STDDEF_H) stdlib.h time.h unistd.h warn-on-use.h + $(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ - ftoastr.c ftoastr.h getloadavg.c getopt.c getopt.in.h \ - getopt1.c getopt_int.h intprops.h mktime-internal.h mktime.c \ - stdbool.in.h stddef.in.h stdlib.in.h strftime.c strftime.h \ - time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h + md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \ + getopt.in.h getopt1.c getopt_int.h intprops.h \ + mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ + stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \ + time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ - stdbool.h-t stddef.h stddef.h-t stdlib.h stdlib.h-t time.h \ - time.h-t unistd.h unistd.h-t warn-on-use.h warn-on-use.h-t + stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ + stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \ + warn-on-use.h-t noinst_LIBRARIES = libgnu.a DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h libgnu_a_LIBADD = $(gl_LIBOBJS) libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) -EXTRA_libgnu_a_SOURCES = ftoastr.c getloadavg.c getopt.c getopt1.c \ - mktime.c strftime.c time_r.c +EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \ + getopt1.c mktime.c strftime.c time_r.c ARG_NONNULL_H = arg-nonnull.h CXXDEFS_H = c++defs.h WARN_ON_USE_H = warn-on-use.h @@ -608,6 +635,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@ @@ -882,6 +910,41 @@ } > $@-t && \ mv $@-t $@ +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t && \ + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works with the given compiler. stdlib.h: stdlib.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2011-02-16 00:33:44 +0000 +++ lib/gnulib.mk 2011-02-19 07:28:29 +0000 @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files dtoastr getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime MOSTLYCLEANFILES += core *.stackdump @@ -69,6 +69,15 @@ ## end gnulib module c++defs +## begin gnulib module crypto/md5 + + +EXTRA_DIST += md5.c md5.h + +EXTRA_libgnu_a_SOURCES += md5.c + +## end gnulib module crypto/md5 + ## begin gnulib module dtoastr libgnu_a_SOURCES += dtoastr.c @@ -184,6 +193,50 @@ ## end gnulib module stddef +## begin gnulib module stdint + +BUILT_SOURCES += $(STDINT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdint.h: stdint.in.h + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''HAVE_LONG_LONG_INT''@/$(HAVE_LONG_LONG_INT)/g' \ + -e 's/@''HAVE_UNSIGNED_LONG_LONG_INT''@/$(HAVE_UNSIGNED_LONG_LONG_INT)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += stdint.h stdint.h-t + +EXTRA_DIST += stdint.in.h + +## end gnulib module stdint + ## begin gnulib module stdlib BUILT_SOURCES += stdlib.h === renamed file 'src/md5.c' => 'lib/md5.c' --- src/md5.c 2011-02-12 22:36:22 +0000 +++ lib/md5.c 2011-02-19 07:28:29 +0000 @@ -1,40 +1,36 @@ /* Functions to compute MD5 message digest of files or memory blocks. according to the definition of MD5 in RFC 1321 from April 1992. - Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2010 Free Software Foundation, Inc. - + Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software + Foundation, Inc. This file is part of the GNU C Library. - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. - The GNU C Library is distributed in the hope that it will be useful, + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with the GNU C Library; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Ulrich Drepper , 1995. */ -#ifdef HAVE_CONFIG_H -# include -#endif - +#include + +#include "md5.h" + +#include +#include +#include #include -#if STDC_HEADERS || defined _LIBC -# include -# include -#else -# ifndef HAVE_MEMCPY -# define memcpy(d, s, n) bcopy ((s), (d), (n)) -# endif +#if USE_UNLOCKED_IO +# include "unlocked-io.h" #endif #ifdef _LIBC @@ -53,15 +49,17 @@ # define md5_buffer __md5_buffer #endif -#include "md5.h" - #ifdef WORDS_BIGENDIAN -# define SWAP(n) \ +# define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif +#define BLOCKSIZE 32768 +#if BLOCKSIZE % 64 != 0 +# error "invalid BLOCKSIZE" +#endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ @@ -82,49 +80,51 @@ ctx->buflen = 0; } +/* Copy the 4 byte value from v into the memory location pointed to by *cp, + If your architecture allows unaligned access this is equivalent to + * (uint32_t *) cp = v */ +static inline void +set_uint32 (char *cp, uint32_t v) +{ + memcpy (cp, &v, sizeof v); +} + /* Put result from CTX in first 16 bytes following RESBUF. The result - must be in little endian byte order. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ + must be in little endian byte order. */ void * md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) { - ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); - ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); - ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); - ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); + char *r = resbuf; + set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); + set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); + set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); + set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual - prolog according to the standard and write the result to RESBUF. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ + prolog according to the standard and write the result to RESBUF. */ void * md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) { /* Take yet unprocessed bytes into account. */ - md5_uint32 bytes = ctx->buflen; - size_t pad; + uint32_t bytes = ctx->buflen; + size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; - pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; - memcpy (&ctx->buffer[bytes], fillbuf, pad); - /* Put the 64-bit file length in *bits* at the end of the buffer. */ - *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); - *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); + ctx->buffer[size - 2] = SWAP (ctx->total[0] << 3); + ctx->buffer[size - 1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); + + memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); /* Process last bytes. */ - md5_process_block (ctx->buffer, bytes + pad + 8, ctx); + md5_process_block (ctx->buffer, size * 4, ctx); return md5_read_ctx (ctx, resbuf); } @@ -135,12 +135,13 @@ int md5_stream (FILE *stream, void *resblock) { - /* Important: BLOCKSIZE must be a multiple of 64. */ -#define BLOCKSIZE 4096 struct md5_ctx ctx; - char buffer[BLOCKSIZE + 72]; size_t sum; + char *buffer = malloc (BLOCKSIZE + 72); + if (!buffer) + return 1; + /* Initialize the computation context. */ md5_init_ctx (&ctx); @@ -148,38 +149,56 @@ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the - computation function processes the whole buffer so that with the - next round of the loop another block can be read. */ + computation function processes the whole buffer so that with the + next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ - do - { - n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); - - sum += n; - } - while (sum < BLOCKSIZE && n != 0); - if (n == 0 && ferror (stream)) - return 1; - - /* If end of file is reached, end the loop. */ - if (n == 0) - break; + while (1) + { + n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); + + sum += n; + + if (sum == BLOCKSIZE) + break; + + if (n == 0) + { + /* Check for the error flag IFF N == 0, so that we don't + exit the loop after a partial read due to e.g., EAGAIN + or EWOULDBLOCK. */ + if (ferror (stream)) + { + free (buffer); + return 1; + } + goto process_partial_block; + } + + /* We've read at least one byte, so ignore errors. But always + check for EOF, since feof may be true even though N > 0. + Otherwise, we could end up calling fread after EOF. */ + if (feof (stream)) + goto process_partial_block; + } /* Process buffer with BLOCKSIZE bytes. Note that - BLOCKSIZE % 64 == 0 + BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } - /* Add the last bytes if necessary. */ +process_partial_block: + + /* Process any remaining bytes. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); + free (buffer); return 0; } @@ -206,8 +225,6 @@ void md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx) { - /* const void aligned_buffer = buffer; */ - /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) @@ -215,32 +232,44 @@ size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; - /* Only put full words in the buffer. */ - add -= add % sizeof (md5_uint32); - - memcpy (&ctx->buffer[left_over], buffer, add); + memcpy (&((char *) ctx->buffer)[left_over], buffer, add); ctx->buflen += add; if (ctx->buflen > 64) - { - md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); + { + md5_process_block (ctx->buffer, ctx->buflen & ~63, ctx); - ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ - memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], - ctx->buflen); - } + ctx->buflen &= 63; + /* The regions in the following copy operation cannot overlap. */ + memcpy (ctx->buffer, + &((char *) ctx->buffer)[(left_over + add) & ~63], + ctx->buflen); + } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ - if (len > 64) + if (len >= 64) { - md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); - len &= 63; +#if !_STRING_ARCH_unaligned +# define alignof(type) offsetof (struct { char c; type x; }, x) +# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) + if (UNALIGNED_P (buffer)) + while (len > 64) + { + md5_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); + buffer = (const char *) buffer + 64; + len -= 64; + } + else +#endif + { + md5_process_block (buffer, len & ~63, ctx); + buffer = (const char *) buffer + (len & ~63); + len &= 63; + } } /* Move remaining bytes in internal buffer. */ @@ -248,14 +277,14 @@ { size_t left_over = ctx->buflen; - memcpy (&ctx->buffer[left_over], buffer, len); + memcpy (&((char *) ctx->buffer)[left_over], buffer, len); left_over += len; if (left_over >= 64) - { - md5_process_block (ctx->buffer, 64, ctx); - left_over -= 64; - memcpy (ctx->buffer, &ctx->buffer[64], left_over); - } + { + md5_process_block (ctx->buffer, 64, ctx); + left_over -= 64; + memcpy (ctx->buffer, &ctx->buffer[16], left_over); + } ctx->buflen = left_over; } } @@ -276,14 +305,14 @@ void md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx) { - md5_uint32 correct_words[16]; - const md5_uint32 *words = buffer; - size_t nwords = len / sizeof (md5_uint32); - const md5_uint32 *endp = words + nwords; - md5_uint32 A = ctx->A; - md5_uint32 B = ctx->B; - md5_uint32 C = ctx->C; - md5_uint32 D = ctx->D; + uint32_t correct_words[16]; + const uint32_t *words = buffer; + size_t nwords = len / sizeof (uint32_t); + const uint32_t *endp = words + nwords; + uint32_t A = ctx->A; + uint32_t B = ctx->B; + uint32_t C = ctx->C; + uint32_t D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the @@ -296,123 +325,127 @@ the loop. */ while (words < endp) { - md5_uint32 *cwp = correct_words; - md5_uint32 A_save = A; - md5_uint32 B_save = B; - md5_uint32 C_save = C; - md5_uint32 D_save = D; + uint32_t *cwp = correct_words; + uint32_t A_save = A; + uint32_t B_save = B; + uint32_t C_save = C; + uint32_t D_save = D; /* First round: using the given function, the context and a constant - the next context is computed. Because the algorithms processing - unit is a 32-bit word and it is determined to work on words in - little endian byte order we perhaps have to change the byte order - before the computation. To reduce the work for the next steps - we store the swapped words in the array CORRECT_WORDS. */ + the next context is computed. Because the algorithms processing + unit is a 32-bit word and it is determined to work on words in + little endian byte order we perhaps have to change the byte order + before the computation. To reduce the work for the next steps + we store the swapped words in the array CORRECT_WORDS. */ -#define OP(a, b, c, d, s, T) \ - do \ - { \ - a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ - ++words; \ - CYCLIC (a, s); \ - a += b; \ - } \ +#define OP(a, b, c, d, s, T) \ + do \ + { \ + a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ + ++words; \ + CYCLIC (a, s); \ + a += b; \ + } \ while (0) /* It is unfortunate that C does not provide an operator for - cyclic rotation. Hope the C compiler is smart enough. */ + cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. - They are defined in RFC 1321 as - - T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + They are defined in RFC 1321 as + + T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 + + Here is an equivalent invocation using Perl: + + perl -e 'foreach(1..64){printf "0x%08x\n", int (4294967296 * abs (sin $_))}' */ /* Round 1. */ - OP (A, B, C, D, 7, 0xd76aa478); + OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); - OP (A, B, C, D, 7, 0xf57c0faf); + OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); - OP (A, B, C, D, 7, 0x698098d8); + OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); - OP (A, B, C, D, 7, 0x6b901122); + OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words - in CORRECT_WORDS. Redefine the macro to take an additional first - argument specifying the function to use. */ + in CORRECT_WORDS. Redefine the macro to take an additional first + argument specifying the function to use. */ #undef OP -#define OP(f, a, b, c, d, k, s, T) \ - do \ - { \ - a += f (b, c, d) + correct_words[k] + T; \ - CYCLIC (a, s); \ - a += b; \ - } \ +#define OP(f, a, b, c, d, k, s, T) \ + do \ + { \ + a += f (b, c, d) + correct_words[k] + T; \ + CYCLIC (a, s); \ + a += b; \ + } \ while (0) /* Round 2. */ - OP (FG, A, B, C, D, 1, 5, 0xf61e2562); - OP (FG, D, A, B, C, 6, 9, 0xc040b340); + OP (FG, A, B, C, D, 1, 5, 0xf61e2562); + OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); - OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); - OP (FG, A, B, C, D, 5, 5, 0xd62f105d); - OP (FG, D, A, B, C, 10, 9, 0x02441453); + OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); + OP (FG, A, B, C, D, 5, 5, 0xd62f105d); + OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); - OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); - OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); - OP (FG, D, A, B, C, 14, 9, 0xc33707d6); - OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); - OP (FG, B, C, D, A, 8, 20, 0x455a14ed); - OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); - OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); - OP (FG, C, D, A, B, 7, 14, 0x676f02d9); + OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); + OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); + OP (FG, D, A, B, C, 14, 9, 0xc33707d6); + OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); + OP (FG, B, C, D, A, 8, 20, 0x455a14ed); + OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); + OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); + OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ - OP (FH, A, B, C, D, 5, 4, 0xfffa3942); - OP (FH, D, A, B, C, 8, 11, 0x8771f681); + OP (FH, A, B, C, D, 5, 4, 0xfffa3942); + OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); - OP (FH, A, B, C, D, 1, 4, 0xa4beea44); - OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); - OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); + OP (FH, A, B, C, D, 1, 4, 0xa4beea44); + OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); + OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); - OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); - OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); - OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); - OP (FH, B, C, D, A, 6, 23, 0x04881d05); - OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); + OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); + OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); + OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); + OP (FH, B, C, D, A, 6, 23, 0x04881d05); + OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); - OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); + OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ - OP (FI, A, B, C, D, 0, 6, 0xf4292244); - OP (FI, D, A, B, C, 7, 10, 0x432aff97); + OP (FI, A, B, C, D, 0, 6, 0xf4292244); + OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); - OP (FI, B, C, D, A, 5, 21, 0xfc93a039); - OP (FI, A, B, C, D, 12, 6, 0x655b59c3); - OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); + OP (FI, B, C, D, A, 5, 21, 0xfc93a039); + OP (FI, A, B, C, D, 12, 6, 0x655b59c3); + OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); - OP (FI, B, C, D, A, 1, 21, 0x85845dd1); - OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); + OP (FI, B, C, D, A, 1, 21, 0x85845dd1); + OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); - OP (FI, C, D, A, B, 6, 15, 0xa3014314); + OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); - OP (FI, A, B, C, D, 4, 6, 0xf7537e82); + OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); - OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); - OP (FI, B, C, D, A, 9, 21, 0xeb86d391); + OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); + OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; === renamed file 'src/md5.h' => 'lib/md5.h' --- src/md5.h 2011-02-12 10:05:38 +0000 +++ lib/md5.h 2011-02-19 07:28:29 +0000 @@ -1,94 +1,74 @@ /* Declaration of functions and data types used for MD5 sum computing library functions. - Copyright (C) 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007 Free Software Foundation, Inc. - This file is part of GNU Emacs. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, + Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2011 Free Software + Foundation, Inc. + This file is part of the GNU C Library. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 3, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public - License along with the GNU C Library; see the file COPYING. If not, - write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _MD5_H #define _MD5_H 1 #include - -#if defined HAVE_LIMITS_H || _LIBC -# include -#endif - -/* The following contortions are an attempt to use the C preprocessor - to determine an unsigned integral type that is 32 bits wide. An - alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but - doing that would require that the configure script compile and *run* - the resulting executable. Locally running cross-compiled executables - is usually not possible. */ - -#ifdef _LIBC -# include -typedef u_int32_t md5_uint32; -#else -# if defined __STDC__ && __STDC__ -# define UINT_MAX_32_BITS 4294967295U -# else -# define UINT_MAX_32_BITS 0xFFFFFFFF -# endif - -/* If UINT_MAX isn't defined, assume it's a 32-bit type. - This should be valid for all systems GNU cares about because - that doesn't include 16-bit systems, and only modern systems - (that certainly have ) have 64+-bit integral types. */ - -# ifndef UINT_MAX -# define UINT_MAX UINT_MAX_32_BITS -# endif - -# if UINT_MAX == UINT_MAX_32_BITS - typedef unsigned int md5_uint32; -# else -# if USHRT_MAX == UINT_MAX_32_BITS - typedef unsigned short md5_uint32; -# else -# if ULONG_MAX == UINT_MAX_32_BITS - typedef unsigned long md5_uint32; -# else - /* The following line is intended to evoke an error. - Using #error is not portable enough. */ - "Cannot determine unsigned 32-bit data type." -# endif -# endif -# endif -#endif - - -#if HAVE_ATTRIBUTE_ALIGNED -# define ATTRIBUTE_ALIGNED(N) __attribute__ ((__aligned__ (N))) -#else -# define ATTRIBUTE_ALIGNED(N) -#endif +#include + +#define MD5_DIGEST_SIZE 16 +#define MD5_BLOCK_SIZE 64 + +#ifndef __GNUC_PREREQ +# if defined __GNUC__ && defined __GNUC_MINOR__ +# define __GNUC_PREREQ(maj, min) \ + ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) +# else +# define __GNUC_PREREQ(maj, min) 0 +# endif +#endif + +#ifndef __THROW +# if defined __cplusplus && __GNUC_PREREQ (2,8) +# define __THROW throw () +# else +# define __THROW +# endif +#endif + +#ifndef _LIBC +# define __md5_buffer md5_buffer +# define __md5_finish_ctx md5_finish_ctx +# define __md5_init_ctx md5_init_ctx +# define __md5_process_block md5_process_block +# define __md5_process_bytes md5_process_bytes +# define __md5_read_ctx md5_read_ctx +# define __md5_stream md5_stream +#endif + +# ifdef __cplusplus +extern "C" { +# endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { - md5_uint32 A; - md5_uint32 B; - md5_uint32 C; - md5_uint32 D; + uint32_t A; + uint32_t B; + uint32_t C; + uint32_t D; - md5_uint32 total[2]; - md5_uint32 buflen; - char buffer[128] ATTRIBUTE_ALIGNED (__alignof__ (md5_uint32)); + uint32_t total[2]; + uint32_t buflen; + uint32_t buffer[32]; }; /* @@ -98,51 +78,49 @@ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ -extern void md5_init_ctx (struct md5_ctx *ctx); +extern void __md5_init_ctx (struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ -extern void md5_process_block (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void __md5_process_block (const void *buffer, size_t len, + struct md5_ctx *ctx) __THROW; /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ -extern void md5_process_bytes (const void *buffer, size_t len, - struct md5_ctx *ctx); +extern void __md5_process_bytes (const void *buffer, size_t len, + struct md5_ctx *ctx) __THROW; /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted - ASCII representation of the message digest. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -extern void *md5_finish_ctx (struct md5_ctx *ctx, void *resbuf); + ASCII representation of the message digest. */ +extern void *__md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) __THROW; /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields - to the wanted ASCII representation of the message digest. - - IMPORTANT: On some systems it is required that RESBUF is correctly - aligned for a 32 bits value. */ -extern void *md5_read_ctx (const struct md5_ctx *ctx, void *resbuf); + to the wanted ASCII representation of the message digest. */ +extern void *__md5_read_ctx (const struct md5_ctx *ctx, void *resbuf) __THROW; /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ -extern int md5_stream (FILE *stream, void *resblock); +extern int __md5_stream (FILE *stream, void *resblock) __THROW; /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ -extern void *md5_buffer (const char *buffer, size_t len, - void *resblock); +extern void *__md5_buffer (const char *buffer, size_t len, + void *resblock) __THROW; + +# ifdef __cplusplus +} +# endif #endif /* md5.h */ === added file 'lib/stdint.in.h' --- lib/stdint.in.h 1970-01-01 00:00:00 +0000 +++ lib/stdint.in.h 2011-02-19 07:28:29 +0000 @@ -0,0 +1,592 @@ +/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +#ifndef _GL_STDINT_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* When including a system file that in turn includes , + use the system , not our substitute. This avoids + problems with (for example) VMS, whose includes + . */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + /* Other systems may have an incomplete or buggy . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _GL_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _GL_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _GL_STDINT_H + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. + MacOS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @NEXT_STDINT_H@. */ +#if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +#endif + +/* Get LONG_MIN, LONG_MAX, ULONG_MAX. */ +#include + +#if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +#elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +#endif + +#if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +#endif + +#undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for a integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +#define _STDINT_MIN(signed, bits, zero) \ + ((signed) ? (- ((zero) + 1) << ((bits) ? (bits) - 1 : 0)) : (zero)) + +#define _STDINT_MAX(signed, bits, zero) \ + ((signed) \ + ? ~ _STDINT_MIN (signed, bits, zero) \ + : /* The expression for the unsigned case. The subtraction of (signed) \ + is a nop in the unsigned case and avoids "signed integer overflow" \ + warnings in the signed case. */ \ + ((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +#if !GNULIB_defined_stdint_types + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef int8_t +#undef uint8_t +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +#define int8_t gl_int8_t +#define uint8_t gl_uint8_t + +#undef int16_t +#undef uint16_t +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +#define int16_t gl_int16_t +#define uint16_t gl_uint16_t + +#undef int32_t +#undef uint32_t +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +#define int32_t gl_int32_t +#define uint32_t gl_uint32_t + +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +#ifdef INT64_MAX +# define GL_INT64_T +#else +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +typedef long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif @HAVE_LONG_LONG_INT@ +# undef int64_t +typedef long long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# endif +#endif + +#ifdef UINT64_MAX +# define GL_UINT64_T +#else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# undef uint64_t +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif +#endif + +/* Avoid collision with Solaris 2.5.1 etc. */ +#define _UINT8_T +#define _UINT32_T +#define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef int_least8_t +#undef uint_least8_t +#undef int_least16_t +#undef uint_least16_t +#undef int_least32_t +#undef uint_least32_t +#undef int_least64_t +#undef uint_least64_t +#define int_least8_t int8_t +#define uint_least8_t uint8_t +#define int_least16_t int16_t +#define uint_least16_t uint16_t +#define int_least32_t int32_t +#define uint_least32_t uint32_t +#ifdef GL_INT64_T +# define int_least64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_least64_t uint64_t +#endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. Assume that 'long int' + is fast enough for all narrower integers. */ + +#undef int_fast8_t +#undef uint_fast8_t +#undef int_fast16_t +#undef uint_fast16_t +#undef int_fast32_t +#undef uint_fast32_t +#undef int_fast64_t +#undef uint_fast64_t +typedef long int gl_int_fast8_t; +typedef unsigned long int gl_uint_fast8_t; +typedef long int gl_int_fast16_t; +typedef unsigned long int gl_uint_fast16_t; +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +#define int_fast8_t gl_int_fast8_t +#define uint_fast8_t gl_uint_fast8_t +#define int_fast16_t gl_int_fast16_t +#define uint_fast16_t gl_uint_fast16_t +#define int_fast32_t gl_int_fast32_t +#define uint_fast32_t gl_uint_fast32_t +#ifdef GL_INT64_T +# define int_fast64_t int64_t +#endif +#ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +#endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +#undef intptr_t +#undef uintptr_t +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +#define intptr_t gl_intptr_t +#define uintptr_t gl_uintptr_t + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +#undef intmax_t +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t +#elif defined GL_INT64_T +# define intmax_t int64_t +#else +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t +#endif + +#undef uintmax_t +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +#elif defined GL_UINT64_T +# define uintmax_t uint64_t +#else +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +#endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) + ? 1 : -1]; + +#define GNULIB_defined_stdint_types 1 +#endif /* !GNULIB_defined_stdint_types */ + +/* 7.18.2. Limits of specified-width integer types */ + +#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +#undef INT8_MIN +#undef INT8_MAX +#undef UINT8_MAX +#define INT8_MIN (~ INT8_MAX) +#define INT8_MAX 127 +#define UINT8_MAX 255 + +#undef INT16_MIN +#undef INT16_MAX +#undef UINT16_MAX +#define INT16_MIN (~ INT16_MAX) +#define INT16_MAX 32767 +#define UINT16_MAX 65535 + +#undef INT32_MIN +#undef INT32_MAX +#undef UINT32_MAX +#define INT32_MIN (~ INT32_MAX) +#define INT32_MAX 2147483647 +#define UINT32_MAX 4294967295U + +#if defined GL_INT64_T && ! defined INT64_MAX +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +#endif + +#if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +#endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +#undef INT_LEAST8_MIN +#undef INT_LEAST8_MAX +#undef UINT_LEAST8_MAX +#define INT_LEAST8_MIN INT8_MIN +#define INT_LEAST8_MAX INT8_MAX +#define UINT_LEAST8_MAX UINT8_MAX + +#undef INT_LEAST16_MIN +#undef INT_LEAST16_MAX +#undef UINT_LEAST16_MAX +#define INT_LEAST16_MIN INT16_MIN +#define INT_LEAST16_MAX INT16_MAX +#define UINT_LEAST16_MAX UINT16_MAX + +#undef INT_LEAST32_MIN +#undef INT_LEAST32_MAX +#undef UINT_LEAST32_MAX +#define INT_LEAST32_MIN INT32_MIN +#define INT_LEAST32_MAX INT32_MAX +#define UINT_LEAST32_MAX UINT32_MAX + +#undef INT_LEAST64_MIN +#undef INT_LEAST64_MAX +#ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +#endif + +#undef UINT_LEAST64_MAX +#ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +#undef INT_FAST8_MIN +#undef INT_FAST8_MAX +#undef UINT_FAST8_MAX +#define INT_FAST8_MIN LONG_MIN +#define INT_FAST8_MAX LONG_MAX +#define UINT_FAST8_MAX ULONG_MAX + +#undef INT_FAST16_MIN +#undef INT_FAST16_MAX +#undef UINT_FAST16_MAX +#define INT_FAST16_MIN LONG_MIN +#define INT_FAST16_MAX LONG_MAX +#define UINT_FAST16_MAX ULONG_MAX + +#undef INT_FAST32_MIN +#undef INT_FAST32_MAX +#undef UINT_FAST32_MAX +#define INT_FAST32_MIN LONG_MIN +#define INT_FAST32_MAX LONG_MAX +#define UINT_FAST32_MAX ULONG_MAX + +#undef INT_FAST64_MIN +#undef INT_FAST64_MAX +#ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +#endif + +#undef UINT_FAST64_MAX +#ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +#endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +#undef INTPTR_MIN +#undef INTPTR_MAX +#undef UINTPTR_MAX +#define INTPTR_MIN LONG_MIN +#define INTPTR_MAX LONG_MAX +#define UINTPTR_MAX ULONG_MAX + +/* 7.18.2.5. Limits of greatest-width integer types */ + +#undef INTMAX_MIN +#undef INTMAX_MAX +#ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +#else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +#endif + +#undef UINTMAX_MAX +#ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +#else +# define UINTMAX_MAX UINT32_MAX +#endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +#undef PTRDIFF_MIN +#undef PTRDIFF_MAX +#if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_MIN (1, 64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_MIN (1, 32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif +#else +# define PTRDIFF_MIN \ + _STDINT_MIN (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +#endif + +/* sig_atomic_t limits */ +#undef SIG_ATOMIC_MIN +#undef SIG_ATOMIC_MAX +#define SIG_ATOMIC_MIN \ + _STDINT_MIN (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) +#define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +#undef SIZE_MAX +#if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif +#else +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +#endif + +/* wchar_t limits */ +/* Get WCHAR_MIN, WCHAR_MAX. + This include is not on the top, above, because on OSF/1 4.0 we have a + sequence of nested includes + -> -> -> , and the latter includes + and assumes its types are already defined. */ +#if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ +# include +# include +# include +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +#endif +#undef WCHAR_MIN +#undef WCHAR_MAX +#define WCHAR_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +#define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +#undef WINT_MIN +#undef WINT_MAX +#define WINT_MIN \ + _STDINT_MIN (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +#define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) + +#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */ + +/* 7.18.4. Macros for integer constants */ + +#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +#undef INT8_C +#undef UINT8_C +#define INT8_C(x) x +#define UINT8_C(x) x + +#undef INT16_C +#undef UINT16_C +#define INT16_C(x) x +#define UINT16_C(x) x + +#undef INT32_C +#undef UINT32_C +#define INT32_C(x) x +#define UINT32_C(x) x ## U + +#undef INT64_C +#undef UINT64_C +#if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +#elif defined _MSC_VER +# define INT64_C(x) x##i64 +#elif @HAVE_LONG_LONG_INT@ +# define INT64_C(x) x##LL +#endif +#if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +#elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +#elif @HAVE_UNSIGNED_LONG_LONG_INT@ +# define UINT64_C(x) x##ULL +#endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +#undef INTMAX_C +#if @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +#elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +#else +# define INTMAX_C(x) x##L +#endif + +#undef UINTMAX_C +#if @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +#elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +#else +# define UINTMAX_C(x) x##UL +#endif + +#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */ + +#endif /* _GL_STDINT_H */ +#endif /* !defined _GL_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ === modified file 'm4/gl-comp.m4' --- m4/gl-comp.m4 2011-02-16 00:33:44 +0000 +++ m4/gl-comp.m4 2011-02-19 07:28:29 +0000 @@ -28,6 +28,7 @@ AC_REQUIRE([AC_PROG_RANLIB]) # Code from module arg-nonnull: # Code from module c++defs: + # Code from module crypto/md5: # Code from module dtoastr: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) @@ -42,6 +43,7 @@ # Code from module multiarch: # Code from module stdbool: # Code from module stddef: + # Code from module stdint: # Code from module stdlib: # Code from module strftime: # Code from module time: @@ -68,6 +70,8 @@ gl_source_base='lib' # Code from module arg-nonnull: # Code from module c++defs: + # Code from module crypto/md5: + gl_MD5 # Code from module dtoastr: AC_REQUIRE([gl_C99_STRTOLD]) # Code from module extensions: @@ -95,6 +99,8 @@ AM_STDBOOL_H # Code from module stddef: gl_STDDEF_H + # Code from module stdint: + gl_STDINT_H # Code from module stdlib: gl_STDLIB_H # Code from module strftime: @@ -261,10 +267,13 @@ lib/gettext.h lib/ignore-value.h lib/intprops.h + lib/md5.c + lib/md5.h lib/mktime-internal.h lib/mktime.c lib/stdbool.in.h lib/stddef.in.h + lib/stdint.in.h lib/stdlib.in.h lib/strftime.c lib/strftime.h @@ -278,10 +287,13 @@ m4/getopt.m4 m4/gnulib-common.m4 m4/include_next.m4 + m4/longlong.m4 + m4/md5.m4 m4/mktime.m4 m4/multiarch.m4 m4/stdbool.m4 m4/stddef_h.m4 + m4/stdint.m4 m4/stdlib_h.m4 m4/strftime.m4 m4/time_h.m4 === added file 'm4/longlong.m4' --- m4/longlong.m4 1970-01-01 00:00:00 +0000 +++ m4/longlong.m4 2011-02-19 07:28:29 +0000 @@ -0,0 +1,113 @@ +# longlong.m4 serial 16 +dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# Define HAVE_LONG_LONG_INT if 'long long int' works. +# This fixes a bug in Autoconf 2.61, and can be faster +# than what's in Autoconf 2.62 through 2.68. + +# Note: If the type 'long long int' exists but is only 32 bits large +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be +# defined. In this case you can treat 'long long int' like 'long int'. + +AC_DEFUN([AC_TYPE_LONG_LONG_INT], +[ + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], + [ac_cv_type_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int + if test $ac_cv_type_long_long_int = yes; then + dnl Catch a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug is not important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [], + [ac_cv_type_long_long_int=no], + [:]) + fi + fi]) + if test $ac_cv_type_long_long_int = yes; then + AC_DEFINE([HAVE_LONG_LONG_INT], [1], + [Define to 1 if the system has the type `long long int'.]) + fi +]) + +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, and can be faster +# than what's in Autoconf 2.62 through 2.68. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [ac_cv_type_unsigned_long_long_int=yes + if test "x${ac_cv_prog_cc_c99-no}" = xno; then + AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [], + [ac_cv_type_unsigned_long_long_int=no]) + fi]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], + [Define to 1 if the system has the type `unsigned long long int'.]) + fi +]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], +[ + AC_LANG_PROGRAM( + [[/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) +]) === added file 'm4/md5.m4' --- m4/md5.m4 1970-01-01 00:00:00 +0000 +++ m4/md5.m4 2011-02-18 08:07:03 +0000 @@ -0,0 +1,15 @@ +# md5.m4 serial 11 +dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MD5], +[ + AC_LIBOBJ([md5]) + + dnl Prerequisites of lib/md5.c. + AC_REQUIRE([gl_BIGENDIAN]) + AC_REQUIRE([AC_C_INLINE]) + : +]) === added file 'm4/stdint.m4' --- m4/stdint.m4 1970-01-01 00:00:00 +0000 +++ m4/stdint.m4 2011-02-19 07:28:29 +0000 @@ -0,0 +1,479 @@ +# stdint.m4 serial 39 +dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert and Bruno Haible. +dnl Test whether is supported or must be substituted. + +AC_DEFUN([gl_STDINT_H], +[ + AC_PREREQ([2.59])dnl + + dnl Check for long long int and unsigned long long int. + AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) + if test $ac_cv_type_long_long_int = yes; then + HAVE_LONG_LONG_INT=1 + else + HAVE_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_LONG_LONG_INT]) + AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + HAVE_UNSIGNED_LONG_LONG_INT=1 + else + HAVE_UNSIGNED_LONG_LONG_INT=0 + fi + AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT]) + + dnl Check for , in the same way as gl_WCHAR_H does. + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h. + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + AC_SUBST([HAVE_INTTYPES_H]) + + dnl Check for . + dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h. + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + AC_SUBST([HAVE_SYS_TYPES_H]) + + gl_CHECK_NEXT_HEADERS([stdint.h]) + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + AC_SUBST([HAVE_STDINT_H]) + + dnl Now see whether we need a substitute . + if test $ac_cv_header_stdint_h = yes; then + AC_CACHE_CHECK([whether stdint.h conforms to C99], + [gl_cv_header_working_stdint_h], + [gl_cv_header_working_stdint_h=no + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif +] +gl_STDINT_INCLUDES +[ +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0 / ia64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + ]])], + [dnl Determine whether the various *_MIN, *_MAX macros are usable + dnl in preprocessor expression. We could do it by compiling a test + dnl program for each of these macros. It is faster to run a program + dnl that inspects the macro expansion. + dnl This detects a bug on HP-UX 11.23/ia64. + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ +#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +] +gl_STDINT_INCLUDES +[ +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; +]], [[ + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; +]])], + [gl_cv_header_working_stdint_h=yes], + [], + [dnl When cross-compiling, assume it works. + gl_cv_header_working_stdint_h=yes + ]) + ]) + ]) + fi + if test "$gl_cv_header_working_stdint_h" = yes; then + STDINT_H= + else + dnl Check for , and for + dnl (used in Linux libc4 >= 4.6.7 and libc5). + AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + else + HAVE_SYS_INTTYPES_H=0 + fi + AC_SUBST([HAVE_SYS_INTTYPES_H]) + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + else + HAVE_SYS_BITYPES_H=0 + fi + AC_SUBST([HAVE_SYS_BITYPES_H]) + + gl_STDINT_TYPE_PROPERTIES + STDINT_H=stdint.h + fi + AC_SUBST([STDINT_H]) +]) + +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) +dnl Determine the size of each of the given types in bits. +AC_DEFUN([gl_STDINT_BITSIZEOF], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to the number of bits in type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], + [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], + [$2 +#include ], [result=unknown]) + eval gl_cv_bitsizeof_${gltype}=\$result + ]) + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, + dnl do a syntax check even on unused #if conditions and give an error + dnl on valid C code like this: + dnl #if 0 + dnl # if > 32 + dnl # endif + dnl #endif + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) + eval BITSIZEOF_${GLTYPE}=\$result + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) +dnl Determine the signedness of each of the given types. +dnl Define HAVE_SIGNED_TYPE if type is signed. +AC_DEFUN([gl_CHECK_TYPES_SIGNED], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to 1 if ']gltype[' is a signed integer type.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], + result=yes, result=no) + eval gl_cv_type_${gltype}_signed=\$result + ]) + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) +dnl Determine the suffix to use for integer constants of the given types. +dnl Define t_SUFFIX for each such type. +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], + [Define to l, ll, u, ul, ull, etc., as suitable for + constants of type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for $gltype integer literal suffix], + [gl_cv_type_${gltype}_suffix], + [eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + extern $gltype foo; + extern $gltype1 foo;]])], + [eval gl_cv_type_${gltype}_suffix=\$glsuf]) + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done]) + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) + done + m4_foreach_w([gltype], [$1], + [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) +]) + +dnl gl_STDINT_INCLUDES +AC_DEFUN([gl_STDINT_INCLUDES], +[[ + /* BSD/OS 4.0.1 has a bug: , and must be + included before . */ + #include + #include + #if HAVE_WCHAR_H + # include + # include + # include + #endif +]]) + +dnl gl_STDINT_TYPE_PROPERTIES +dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t +dnl of interest to stdint.in.h. +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], +[ + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_STDINT_BITSIZEOF([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) +]) + +dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in. +dnl Remove this when we can assume autoconf >= 2.61. +m4_ifdef([AC_COMPUTE_INT], [], [ + AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])]) +]) + +# Hey Emacs! +# Local Variables: +# indent-tabs-mode: nil +# End: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-19 19:56:29 +0000 +++ src/ChangeLog 2011-02-20 08:48:52 +0000 @@ -1,3 +1,13 @@ +2011-02-20 Paul Eggert + + Import crypto/md5 and stdint modules from gnulib. + * Makefile.in (base_obj): Remove md5.o, since this file + is in lib now. + * config.in: Regenerate. + * md5.h, md5.h: Move to ../lib. + * deps.mk (md5.o): Remove. + (fns.o): Depend on ../lib/md5.h, not md5.h. + 2011-02-19 Eli Zaretskii * termcap.c (tputs): Don't declare baud_rate. === modified file 'src/Makefile.in' --- src/Makefile.in 2011-02-19 19:40:59 +0000 +++ src/Makefile.in 2011-02-20 08:48:52 +0000 @@ -354,7 +354,7 @@ syntax.o $(UNEXEC_OBJ) bytecode.o \ process.o gnutls.o callproc.o \ region-cache.o sound.o atimer.o \ - doprnt.o intervals.o textprop.o composite.o md5.o xml.o \ + doprnt.o intervals.o textprop.o composite.o xml.o \ $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) obj = $(base_obj) $(NS_OBJC_OBJ) === modified file 'src/config.in' --- src/config.in 2011-02-16 00:33:44 +0000 +++ src/config.in 2011-02-19 07:28:29 +0000 @@ -31,6 +31,21 @@ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD +/* Define to the number of bits in type 'ptrdiff_t'. */ +#undef BITSIZEOF_PTRDIFF_T + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#undef BITSIZEOF_SIG_ATOMIC_T + +/* Define to the number of bits in type 'size_t'. */ +#undef BITSIZEOF_SIZE_T + +/* Define to the number of bits in type 'wchar_t'. */ +#undef BITSIZEOF_WCHAR_T + +/* Define to the number of bits in type 'wint_t'. */ +#undef BITSIZEOF_WINT_T + /* Define if Emacs cannot be dumped on your system. */ #undef CANNOT_DUMP @@ -440,6 +455,9 @@ /* Define to 1 if you support file names longer than 14 characters. */ #undef HAVE_LONG_FILE_NAMES +/* Define to 1 if the system has the type `long long int'. */ +#undef HAVE_LONG_LONG_INT + /* Define to 1 if you have the `lrand48' function. */ #undef HAVE_LRAND48 @@ -596,6 +614,15 @@ /* Define to 1 if you have the `shutdown' function. */ #undef HAVE_SHUTDOWN +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#undef HAVE_SIGNED_SIG_ATOMIC_T + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +#undef HAVE_SIGNED_WCHAR_T + +/* Define to 1 if 'wint_t' is a signed integer type. */ +#undef HAVE_SIGNED_WINT_T + /* Define to 1 if the system has the type `size_t'. */ #undef HAVE_SIZE_T @@ -665,6 +692,12 @@ /* Define to 1 if you have the `sysinfo' function. */ #undef HAVE_SYSINFO +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INTTYPES_H + /* Define to 1 if you have the header file. */ #undef HAVE_SYS_LOADAVG_H @@ -745,6 +778,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if the system has the type `unsigned long long int'. */ +#undef HAVE_UNSIGNED_LONG_LONG_INT + /* Define to 1 if you have the header file. */ #undef HAVE_UTIL_H @@ -763,6 +799,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + /* Define if you have the 'wchar_t' type. */ #undef HAVE_WCHAR_T @@ -915,6 +954,10 @@ /* Define to 1 if the C compiler supports function prototypes. */ #undef PROTOTYPES +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#undef PTRDIFF_T_SUFFIX + /* Define REL_ALLOC if you want to use the relocating allocator for buffer space. */ #undef REL_ALLOC @@ -922,6 +965,14 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#undef SIG_ATOMIC_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#undef SIZE_T_SUFFIX + /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. @@ -985,6 +1036,14 @@ /* Version number of package */ #undef VERSION +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#undef WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#undef WINT_T_SUFFIX + /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD === modified file 'src/deps.mk' --- src/deps.mk 2011-02-16 00:33:44 +0000 +++ src/deps.mk 2011-02-19 09:51:59 +0000 @@ -9,17 +9,17 @@ ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation, either version 3 of the License, or ## (at your option) any later version. -## +## ## GNU Emacs is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. -## +## ## You should have received a copy of the GNU General Public License ## along with GNU Emacs. If not, see . ## Commentary: -## +## ## This file is inserted in src/Makefile if AUTO_DEPEND=no. ## It defines static dependencies between the various source files. @@ -144,7 +144,6 @@ ralloc.o: ralloc.c lisp.h $(config_h) vm-limit.o: vm-limit.c mem-limits.h lisp.h globals.h $(config_h) marker.o: marker.c buffer.h character.h lisp.h globals.h $(config_h) -md5.o: md5.c md5.h $(config_h) minibuf.o: minibuf.c syntax.h frame.h window.h keyboard.h systime.h \ buffer.h commands.h character.h msdos.h $(INTERVALS_H) keymap.h \ termhooks.h lisp.h globals.h $(config_h) coding.h @@ -283,7 +282,7 @@ msdos.h floatfns.o: floatfns.c syssignal.h lisp.h globals.h $(config_h) fns.o: fns.c commands.h lisp.h $(config_h) frame.h buffer.h character.h \ - keyboard.h keymap.h window.h $(INTERVALS_H) coding.h md5.h \ + keyboard.h keymap.h window.h $(INTERVALS_H) coding.h ../lib/md5.h \ blockinput.h atimer.h systime.h xterm.h ../lib/unistd.h globals.h print.o: print.c process.h frame.h window.h buffer.h keyboard.h character.h \ lisp.h globals.h $(config_h) termchar.h $(INTERVALS_H) msdos.h termhooks.h \ ------------------------------------------------------------ revno: 103359 author: Gnus developers committer: Katsumi Yamaoka branch nick: trunk timestamp: Sun 2011-02-20 04:08:04 +0000 message: nnimap.el (nnimap-wait-for-response): Ensure that we get the entire line we're waiting for. gnus-art.el (gnus-article-next-page-1): Because customized mode-line face with line-width greater than zero will cause RET in gnus summary buffer to scroll down article page-wise because auto vscroll happens, it should be temporalily disabled when doing a scroll-up. diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-02-19 19:40:59 +0000 +++ lisp/gnus/ChangeLog 2011-02-20 04:08:04 +0000 @@ -7,6 +7,18 @@ * nnfolder.el (nnfolder-save-buffer): Don't let-bind copyright-update, in case it's not yet loaded. +2011-02-20 Lars Ingebrigtsen + + * nnimap.el (nnimap-wait-for-response): Ensure that we get the entire + line we're waiting for. + +2011-02-19 Darren Hoo (tiny change) + + * gnus-art.el (gnus-article-next-page-1): Because customized mode-line + face with line-width greater than zero will cause RET in gnus summary + buffer to scroll down article page-wise because auto vscroll happens, + it should be temporalily disabled when doing a scroll-up. + 2011-02-19 Lars Ingebrigtsen * nnimap.el (nnimap-parse-copied-articles): Allow for " OK" === modified file 'lisp/gnus/gnus-art.el' --- lisp/gnus/gnus-art.el 2011-02-19 09:45:07 +0000 +++ lisp/gnus/gnus-art.el 2011-02-20 04:08:04 +0000 @@ -6322,7 +6322,8 @@ (defun gnus-article-next-page-1 (lines) (condition-case () - (let ((scroll-in-place nil)) + (let ((scroll-in-place nil) + (auto-window-vscroll nil)) (scroll-up lines)) (end-of-buffer ;; Long lines may cause an end-of-buffer error. === modified file 'lisp/gnus/nnimap.el' --- lisp/gnus/nnimap.el 2011-02-19 09:45:07 +0000 +++ lisp/gnus/nnimap.el 2011-02-20 04:08:04 +0000 @@ -1641,7 +1641,7 @@ (progn (forward-line -1) (looking-at "\\*")))) - (not (looking-at (format "%d " sequence))))) + (not (looking-at (format "%d .*\n" sequence))))) (when messagep (nnheader-message 7 "nnimap read %dk" (/ (buffer-size) 1000))) (nnheader-accept-process-output process) ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.