Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
49a8fe51
Commit
49a8fe51
authored
13 years ago
by
Yang Tse
Browse files
Options
Downloads
Patches
Plain Diff
xc-translit.m4 provides transliteration macros with well defined behavior.
parent
8fc4be9e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
m4/xc-translit.m4
+130
-0
130 additions, 0 deletions
m4/xc-translit.m4
with
130 additions
and
0 deletions
m4/xc-translit.m4
0 → 100644
+
130
−
0
View file @
49a8fe51
#---------------------------------------------------------------------------
#
# xc-translit.m4
#
# Copyright (c) 2011 Daniel Stenberg <daniel@haxx.se>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
#---------------------------------------------------------------------------
# File version for 'aclocal' use. Keep it a single number.
# serial 1
dnl XC_SH_TR_SH (expression)
dnl -------------------------------------------------
dnl Shell execution time transliteration of 'expression'
dnl argument, where all non-alfanumeric characters are
dnl converted to the underscore '_' character.
dnl Normal shell expansion and substitution takes place
dnl for given 'expression' at shell execution time before
dnl transliteration is applied to it.
AC_DEFUN([XC_SH_TR_SH],
[`echo "$1" | sed 's/[[^a-zA-Z0-9_]]/_/g'`])
dnl XC_SH_TR_SH_EX (expression, [extra])
dnl -------------------------------------------------
dnl Like XC_SH_TR_SH but transliterating characters
dnl given in 'extra' argument to lowercase 'p'. For
dnl example [*+], [*], and [+] are valid 'extra' args.
AC_DEFUN([XC_SH_TR_SH_EX],
[ifelse([$2], [],
[XC_SH_TR_SH([$1])],
[`echo "$1" | sed 's/[[$2]]/p/g' | sed 's/[[^a-zA-Z0-9_]]/_/g'`])])
dnl XC_M4_TR_SH (expression)
dnl -------------------------------------------------
dnl m4 execution time transliteration of 'expression'
dnl argument, where all non-alfanumeric characters are
dnl converted to the underscore '_' character.
AC_DEFUN([XC_M4_TR_SH],
[patsubst([$1], [[^a-zA-Z0-9_]], [_])])
dnl XC_M4_TR_SH_EX (expression, [extra])
dnl -------------------------------------------------
dnl Like XC_M4_TR_SH but transliterating characters
dnl given in 'extra' argument to lowercase 'p'. For
dnl example [*+], [*], and [+] are valid 'extra' args.
AC_DEFUN([XC_M4_TR_SH_EX],
[ifelse([$2], [],
[XC_M4_TR_SH([$1])],
[patsubst(patsubst([[$1]], [[$2]], [p]), [[^a-zA-Z0-9_]], [_])])])
dnl XC_SH_TR_CPP (expression)
dnl -------------------------------------------------
dnl Shell execution time transliteration of 'expression'
dnl argument, where all non-alfanumeric characters are
dnl converted to the underscore '_' character and alnum
dnl characters are converted to uppercase.
dnl Normal shell expansion and substitution takes place
dnl for given 'expression' at shell execution time before
dnl transliteration is applied to it.
AC_DEFUN([XC_SH_TR_CPP],
[`echo "$1" | dnl
sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | dnl
sed 's/[[^A-Z0-9_]]/_/g'`])
dnl XC_SH_TR_CPP_EX (expression, [extra])
dnl -------------------------------------------------
dnl Like XC_SH_TR_CPP but transliterating characters
dnl given in 'extra' argument to uppercase 'P'. For
dnl example [*+], [*], and [+] are valid 'extra' args.
AC_DEFUN([XC_SH_TR_CPP_EX],
[ifelse([$2], [],
[XC_SH_TR_CPP([$1])],
[`echo "$1" | dnl
sed 's/[[$2]]/P/g' | dnl
sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' | dnl
sed 's/[[^A-Z0-9_]]/_/g'`])])
dnl XC_M4_TR_CPP (expression)
dnl -------------------------------------------------
dnl m4 execution time transliteration of 'expression'
dnl argument, where all non-alfanumeric characters are
dnl converted to the underscore '_' character and alnum
dnl characters are converted to uppercase.
AC_DEFUN([XC_M4_TR_CPP],
[patsubst(translit([[$1]],
[abcdefghijklmnopqrstuvwxyz],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ]),
[[^A-Z0-9_]], [_])])
dnl XC_M4_TR_CPP_EX (expression, [extra])
dnl -------------------------------------------------
dnl Like XC_M4_TR_CPP but transliterating characters
dnl given in 'extra' argument to uppercase 'P'. For
dnl example [*+], [*], and [+] are valid 'extra' args.
AC_DEFUN([XC_M4_TR_CPP_EX],
[ifelse([$2], [],
[XC_M4_TR_CPP([$1])],
[patsubst(translit(patsubst([[[$1]]], [[$2]], [P]),
[abcdefghijklmnopqrstuvwxyz],
[ABCDEFGHIJKLMNOPQRSTUVWXYZ]),
[[^A-Z0-9_]], [_])])])
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment