* lib/m4sugar/m4sugar.m4 (m4_qlen, m4_qdelta): New macros.

* lib/autotest/general.m4 (AT_SETUP): Use m4_qdelta.
This commit is contained in:
Paul Eggert 2004-12-19 14:40:36 +00:00
parent 20efa599ff
commit b788fb9a74
3 changed files with 23 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2004-12-18 Noah Misch <noah@cs.caltech.edu>
* lib/m4sugar/m4sugar.m4 (m4_qlen, m4_qdelta): New macros.
* lib/autotest/general.m4 (AT_SETUP): Use m4_qdelta.
2004-12-18 Noah Misch <noah@cs.caltech.edu>
* lib/autotest/general.m4 (_AT_DECIDE_TRACEABLE): New macro.

View File

@ -1048,8 +1048,8 @@ m4_divert_push([TESTS])dnl
AT_ordinal ) @%:@ AT_ordinal. m4_defn([AT_line]): $1
at_setup_line='m4_defn([AT_line])'
at_desc='$1'
$at_quiet $ECHO_N "m4_format([[%3d: %-45s]],
AT_ordinal, [$1])[]$ECHO_C"
$at_quiet $ECHO_N "m4_format([%3d: %-]m4_eval(47 - m4_qdelta([$1]))[s],
AT_ordinal, [[$1]])[]$ECHO_C"
m4_divert_push([TEST_SCRIPT])dnl
])

View File

@ -3,7 +3,7 @@ divert(-1)# -*- Autoconf -*-
# Base M4 layer.
# Requires GNU M4.
#
# Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
# Inc.
#
# This program is free software; you can redistribute it and/or modify
@ -1615,6 +1615,21 @@ m4_define([m4_text_box],
])
# m4_qlen(STRING)
# ---------------
# Expands to the length of STRING after autom4te converts all quadrigraphs.
m4_define([m4_qlen],
[m4_len(m4_bpatsubsts([[$1]], [@\(<:\|:>\|S|\|%:\)@], [P], [@&t@]))])
# m4_qdelta(STRING)
# -----------------
# Expands to the net change in the length of STRING from autom4te converting the
# quadrigraphs in STRING. This number is always negative or zero.
m4_define([m4_qdelta],
[m4_eval(m4_qlen([$1]) - m4_len([$1]))])
## ----------------------- ##
## 10. Number processing. ##