当前位置: 首页 > news >正文

GNU/Linux - 宏处理工具M4

GNU M4
M4 = "Macro Processor, Version 4".
1, Introduction to GNU M4
GNU M4 是传统 Unix 宏处理器的实现。它主要与 SVR4 兼容,但也有一些扩展功能(例如,处理超过 9 个位置参数的宏命令)。GNU M4 还内置了包含文件、运行 shell 命令、运算等功能。
GNU M4 is an implementation of the traditional Unix macro processor. It is mostly SVR4 compatible although it has some extensions (for example, handling more than 9 positional parameters to macros). GNU M4 also has built-in functions for including files, running shell commands, doing arithmetic, etc.
GNU M4 是一个宏处理器,它可以将输入复制到输出,并不断扩展宏。宏可以是内置的,也可以是用户自定义的,并且可以接受任意数量的参数。除了进行宏扩展外,m4 还具有内置函数,可用于包含已命名文件、运行 UNIX 命令、进行整数运算、以各种方式处理文本、递归等......m4 既可用作编译器的前端,也可单独用作宏处理器。
GNU M4 is a macro processor in the sense that it copies its input to the output expanding macros as it goes. Macros are either builtin or user-defined and can take any number of arguments. Besides just doing macro expansion, m4 has builtin functions for including named files, running UNIX commands, doing integer arithmetic, manipulating text in various ways, recursion etc... m4 can be used either as a front-end to a compiler or as a macro processor in its own right.
GNU M4 的最大用户之一是 GNU Autoconf 项目。
One of the biggest users of GNU M4 is the GNU Autoconf project.
2, Downloading M4
最新的稳定版本是 1.4.19,可在 Index of /gnu/m4 [通过 http] 和 ftp://ftp.gnu.org/gnu/m4/ [通过 FTP]上找到。也可以在我们的 FTP 镜像 ( GNU Mirror List- GNU Project - Free Software Foundation) 中找到。稳定版开发分支也可以通过以下任一方式从 git 签出:
The latest stable version is 1.4.19, and can be found on Index of /gnu/m4  [via http] and ftp://ftp.gnu.org/gnu/m4/  [via FTP]. It can also be found on one of our FTP mirrors ( GNU Mirror List- GNU Project - Free Software Foundation). The stable development branch can also be checked out from git, using either of:
git clone git://git.sv.gnu.org/m4
git clone http://git.savannah.gnu.org/r/m4.git
followed by:
git checkout -b branch-1.4 origin/branch-1.4
3, Documentation
GNU M4 文档有多种格式,请访问 GNU M4 - GNU macro processor - GNU Project - Free Software Foundation。您也可以通过查看本地文档找到更多有关 GNU M4 的信息。例如,您可以尝试查看 /usr/share/doc/m4/,或在 shell 提示下使用 info m4。
GNU M4 documentation can be found in several formats at GNU M4 - GNU macro processor - GNU Project - Free Software Foundation. You may also find more information about GNU M4 by looking at your local documentation. For example, you might try looking in /usr/share/doc/m4/, or use info m4 at the shell prompt.
GNU M4 - GNU macro processor - GNU Project - Free Software Foundation
GNU M4 1.4.19 macro processor
4, Mailing Lists
GNU M4 有多个邮件列表: < bug-m4@gnu.org>、< m4-discuss@gnu.org>、< m4-patches@gnu.org> 和 < m4-announce@gnu.org>。这些邮件列表都有存档;请参阅每个邮件列表的详细信息以获取存档链接。
GNU M4 has several mailing lists: < bug-m4@gnu.org >, < m4-discuss@gnu.org >, < m4-patches@gnu.org >, and < m4-announce@gnu.org >. Archives of these lists are available; see the details of each list for a link to the archives.
您可以如下所述通过网络订阅任何 GNU 邮件列表。或者,您也可以向相关请求列表发送一封空邮件,在邮件标题行注明 “订阅”。例如,要订阅 bug-m4 列表,您可以向 < bug-m4-request@gnu.org> 发送一封没有正文、标题行仅为 “订阅 ”的邮件。
You can subscribe to any GNU mailing list via the web as described below. Or you can send an empty mail with a Subject: header line of just "subscribe" to the relevant request list. For example, to subscribe yourself to the bug-m4 list, you would send mail to < bug-m4-request@gnu.org > with no body and a Subject: header line of just "subscribe".
为防止垃圾邮件泛滥,有必要对 GNU M4 邮件列表进行管理。向邮件列表发布的内容由列表版主负责发布。有时,版主会在短时间内无法工作。请耐心等待。如果您在列表存档中没有看到该邮件,则说明该邮件没有被发布。
It has been necessary to moderate the GNU M4 mailing lists to prevent the flood of spam. Postings to the lists are held for release by the list moderator. Sometimes the moderators are unavailable for brief periods of time. Please be patient when posting. If you don't see the message in the list archive then it did not get posted.
5, Announcements
低容量邮件列表 m4-announce 包含有关 GNU M4 的所有公告。有关 M4 和大多数其他 GNU 软件的重要公告也在 < info-gnu@gnu.org> 上发布。
The low-volume mailing list m4-announce contains all announcements about GNU M4. Important announcements about M4 and most other GNU Software are also made on < info-gnu@gnu.org >.
6, Tracking Development
中型邮件列表 bug-m4 跟踪所有错误报告。有关提交错误报告的更多信息,请参阅下面的 “报告错误 ”部分。
The moderate-volume mailing list bug-m4 tracks all bug reports. For more information on submitting bugs, please see the section Report a Bug below.
中型邮件列表 m4-patches 用于提出和跟踪所有重要补丁。GNU M4 正在积极开发中,2.0 版本将有许多新功能,如更好的输入控制、多精度运算和可加载模块。有关 GNU M4 未来发展的更多信息,请访问 GNU M4 - Summary [Savannah]。您可以使用 git 跟踪开发进程:
The moderate-volume mailing list m4-patches is used to propose and track all significant patches. GNU M4 is being actively developed, and version 2.0 will have many new features, such as better input control, multiple precision arithmetic and loadable modules. More information about the future of GNU M4 is at GNU M4 - Summary [Savannah]. You can track development in git, using:
git clone git://git.sv.gnu.org/m4
git clone http://git.savannah.gnu.org/r/m4.git
You can also view the git tree on the web. ( http://git.sv.gnu.org/gitweb/?p=m4.git)
另外,这里还有一个只读的 CVS 镜像:
Alternatively, there is a read-only CVS mirror here:
cvs -d :pserver:anonymous@pserver.git.sv.gnu.org:/m4.git \
  co -d m4 HEAD

M4的使用和学习
Here’s a simple usage guide for GNU M4 with basic examples:
Step-by-Step: Example 1  Simple Usage of GNU M4
1. Install GNU M4
Make sure M4 is installed. You can check by typing:
m4 --version
If not installed, install it via your package manager (as described earlier).
2. Creating a Simple M4 Script
Let's create a basic file `example.m4` with simple macros.
define(`PI', `3.14159')
define(`greeting', `Hello, World!')
PI is the value of pi.
greeting
This file contains two macros:
- `PI` with the value `3.14159`
- `greeting` with the value `Hello, World!`
3. Running the M4 Script
To process the file using M4, open a terminal and run:
m4 example.m4
The output will be:
3.14159 is the value of pi.
Hello, World!
Example 2: Using Arguments in Macros
You can pass arguments to macros. In this example, let's define a macro that takes a name as an argument.
1. Create a file `greet.m4`:
define(`greet', `Hello, $1!')
greet(`Alice')
greet(`Bob')
2. Run the M4 script:
m4 greet.m4
The output will be:
Hello, Alice!
Hello, Bob!
Example 3: Simple Conditional with `ifelse`
You can use simple conditionals with `ifelse`.
1. Create a file `condition.m4`:
ifelse(`yes', `yes', `The answer is yes.', `The answer is no.')
2. Run the M4 script:
m4 condition.m4
Output:
The answer is yes.
这些是如何使用 GNU M4 定义宏、使用参数和条件的简单示例。它是一个非常通用的文本处理工具!
These are simple examples of how to define macros, use arguments, and conditionals with GNU M4. It’s a very versatile tool for text processing!
参考:
GNU M4 - GNU Project - Free Software Foundation

相关文章:

GNU/Linux - 宏处理工具M4

GNU M4 M4 "Macro Processor, Version 4". 1, Introduction to GNU M4 GNU M4 是传统 Unix 宏处理器的实现。它主要与 SVR4 兼容&#xff0c;但也有一些扩展功能&#xff08;例如&#xff0c;处理超过 9 个位置参数的宏命令&#xff09;。GNU M4 还内置了包含文件、…...

Oracle权限安全管理

实验内容 本次实验先使用system用户连接 温馨提示&#xff1a;题目要求切换账户登录的时候自己记得切换&#xff0c;本文章只提供相应的SQL语句 在表空间BOOKTBS1&#xff08;实验4第1题已创建&#xff09;创建一张表BOOKS,其字段如下&#xff1a;&#xff1a; SQL> create…...

C++笔记之静态多态和动态多态

C++笔记之静态多态和动态多态 code review! 在C++中,多态(Polymorphism)是面向对象编程的一个核心概念,允许对象以多种形式存在。多态性主要分为静态多态(Static Polymorphism)和动态多态(Dynamic Polymorphism)。下面将详细解释这两种多态及其在C++中的实现方式、优缺…...

Axure RP电商系统商城PC+app+后台买家卖端高保真原型模板及元件库

AxureRP电商商城PCapp后台买家卖端高保真原型模板本套包含三份原型图素材 APP买家端原型简介&#xff1a; 包含了用户中心、会员成长、优惠券、积分、互动社区、运营推广、内容推荐、商品展示、订单流程、订单管理、售后及服务等完整的电商体系功能架构和业务流程。 本模板由…...

RTX3070的yolo训练模型迁移到NVIDIA JETSON XAVIER NX 上的踩坑经验,时机部署避雷点

NVIDIA JETSON XAVIER NX 的yolo环境部署 首先为了保证yolo的权重模型pt文件可以顺利迁移过去&#xff0c;要保证torch和cuda的版本一致 如何在NX上安装torch? 1.用 jtop工具 实时查看和控制板子状态 安装: sudo -H pip3 install jetson-stats使用: sudo jtop 在这里是为…...

带你学习如何编写一篇API详设文档以及给新人提点建议

文章目录 前言先认清一个问题详设文档如何写先看文档脉络详设文档分析需求背景方案概述API定义安全设计性能设计缓存与数据库 总结 前言 这篇文章带读者了解软件开发项目中一个需求的开发详设文档主要包括哪些内容&#xff0c;其中重点会给读者分析API设计的规范&#xff0c;相…...

【Python爬虫实战】正则:多字符匹配、开头与结尾定位、分组技术详解

&#x1f308;个人主页&#xff1a;https://blog.csdn.net/2401_86688088?typeblog &#x1f525; 系列专栏&#xff1a;https://blog.csdn.net/2401_86688088/category_12797772.html 目录 前言 一、匹配多个字符 &#xff08;一&#xff09;匹配任意多个字符 &#xff0…...

DOIP协议介绍-1

1.DOIP中的GID和EID是什么&#xff1f; 在DOIP&#xff08;Diagnostics over IP&#xff09;中&#xff0c;GID&#xff08;Group Identification&#xff09;和EID&#xff08;Entity Identification&#xff09;是两个重要的标识符&#xff0c;它们各自承担着不同的角色和功…...

探索Python中的多线程与多进程

在Python编程中&#xff0c;多线程和多进程是两个重要的概念&#xff0c;它们被用来提高程序的执行效率。本文将深入探讨这两个概念&#xff0c;并对比它们在Python中的实现方式。 一、多线程 多线程是一种并发执行的程序设计方法。在Python中&#xff0c;我们可以使用thread…...

paypal php 实现详细攻略

一、准备工作 登录 https://www.paypal.com/ 注册一个主账号&#xff08;选择个人账号、企业账后都可&#xff09; 申请完成后登录https://developer.paypal.com/ 在后台右侧菜地点击“Accounts”&#xff0c;可以看到系统自动给分配的两个沙箱环境的账号。类型为Personal是个人…...

深入理解Dubbo原理鱼实现,提升职场竞争力

小熊学Java全能学习面试指南&#xff1a;https://www.javaxiaobear.cn 1、RPC RPC(Remote Procedure Call)远程过程调用&#xff0c;它是一种通过网络从远程计算机程序上请求服务。 大白话理解就是&#xff1a;RPC让你用别人家的东西就像自己家的一样。 RPC两个作用&#xff1…...

自动化测试与敏捷开发的重要性

敏捷开发与自动化测试是现代软件开发中两个至关重要的实践&#xff0c;它们相互补充&#xff0c;共同促进了软件质量和开发效率的提升。 敏捷开发的重要性 敏捷开发是一种以人为核心、迭代、循序渐进的软件开发方法。它强调以下几个核心价值观和原则&#xff1a; 个体和交互…...

气膜:冰雪产业的创新解决方案—轻空间

随着冰雪运动的普及和发展&#xff0c;如何在不同季节和地区有效开展冰雪项目&#xff0c;成为了行业内的一个重要课题。气膜作为一种新兴的建筑形式&#xff0c;凭借其独特的优势&#xff0c;正在逐渐成为冰雪产业的创新解决方案。 优越的建筑特性 气膜建筑以其轻便、快速搭建…...

期货配资网/分仓多元化/配资系统服务商

提供期货配资服务的网络平台搭建服务。这些平台致力于为投资者提供高效、便捷的期货投资渠道&#xff0c;通过配资的方式放大投资者的资金杠杆&#xff0c;从而增加其盈利机会。期货配资网一般具有以下特点&#xff1a; 专业服务&#xff1a;提供期货交易、投资管理及信息咨询…...

「漏洞复现」百易云资产管理运营系统 ufile.api.php SQL注入漏洞

0x01 免责声明 请勿利用文章内的相关技术从事非法测试&#xff0c;由于传播、利用此文所提供的信息而造成的任何直接或者间接的后果及损失&#xff0c;均由使用者本人负责&#xff0c;作者不为此承担任何责任。工具来自网络&#xff0c;安全性自测&#xff0c;如有侵权请联系删…...

Vue 3 和 Vue Router 使用 createWebHistory 配置

在 Vue 3 项目中&#xff0c;如果使用 Vue Router 并希望启用 HTML5 History 模式&#xff0c;需要在创建路由器实例时传入 createWebHistory 作为历史模式的配置。此外&#xff0c;还需要确保在生产环境中设置正确的基本路径&#xff08;base&#xff09;&#xff0c;这样才能…...

Nginx:rewrite指令之flag标志

Nginx 的 rewrite 指令用于根据正则表达式来匹配请求的 URI&#xff0c;并将其重写为新的 URI。rewrite 指令可以包含一个可选的 flag&#xff08;标志&#xff09;&#xff0c;该标志用于控制重写操作后的行为。 rewrite regex replacement [flag] 一. 常用四种 flag redir…...

C#从零开始学习(如何构建应用)

开始使用 C# 开发使用的软件Visual Studio 2019 文章所有的代码都放在 https://github.com/hikinazimi/head-first-Csharp 创建一个控制台应用 打开Visual Studio 2019 创建项目 选择控制台应用程序 创建后点击运行,就可以在控制台打印Hello World 构建一个游戏(创建WPF项目…...

FCoE简介

数据中心融合网络的发展趋势 如图1所示&#xff0c;传统数据中心组网中&#xff0c;以太网LAN&#xff08;Local Area Network&#xff09;用于服务器与服务器、客户端与服务器之间通信&#xff0c;存储区域网络SAN&#xff08;Storage Area Network&#xff09;用于服务器与存…...

论文笔记:Template-Based Named Entity Recognition Using BART

论文来源&#xff1a;ACL 2021 Finding 论文链接&#xff1a;https://aclanthology.org/2021.findings-acl.161.pdf 论文代码&#xff1a;GitHub - Nealcly/templateNER: Source code for template-based NER 笔记仅供参考&#xff0c;撰写不易&#xff0c;请勿恶意转载抄袭…...

(LeetCode 每日一题) 3442. 奇偶频次间的最大差值 I (哈希、字符串)

题目&#xff1a;3442. 奇偶频次间的最大差值 I 思路 &#xff1a;哈希&#xff0c;时间复杂度0(n)。 用哈希表来记录每个字符串中字符的分布情况&#xff0c;哈希表这里用数组即可实现。 C版本&#xff1a; class Solution { public:int maxDifference(string s) {int a[26]…...

设计模式和设计原则回顾

设计模式和设计原则回顾 23种设计模式是设计原则的完美体现,设计原则设计原则是设计模式的理论基石, 设计模式 在经典的设计模式分类中(如《设计模式:可复用面向对象软件的基础》一书中),总共有23种设计模式,分为三大类: 一、创建型模式(5种) 1. 单例模式(Sing…...

Linux 文件类型,目录与路径,文件与目录管理

文件类型 后面的字符表示文件类型标志 普通文件&#xff1a;-&#xff08;纯文本文件&#xff0c;二进制文件&#xff0c;数据格式文件&#xff09; 如文本文件、图片、程序文件等。 目录文件&#xff1a;d&#xff08;directory&#xff09; 用来存放其他文件或子目录。 设备…...

【Redis技术进阶之路】「原理分析系列开篇」分析客户端和服务端网络诵信交互实现(服务端执行命令请求的过程 - 初始化服务器)

服务端执行命令请求的过程 【专栏简介】【技术大纲】【专栏目标】【目标人群】1. Redis爱好者与社区成员2. 后端开发和系统架构师3. 计算机专业的本科生及研究生 初始化服务器1. 初始化服务器状态结构初始化RedisServer变量 2. 加载相关系统配置和用户配置参数定制化配置参数案…...

Cilium动手实验室: 精通之旅---20.Isovalent Enterprise for Cilium: Zero Trust Visibility

Cilium动手实验室: 精通之旅---20.Isovalent Enterprise for Cilium: Zero Trust Visibility 1. 实验室环境1.1 实验室环境1.2 小测试 2. The Endor System2.1 部署应用2.2 检查现有策略 3. Cilium 策略实体3.1 创建 allow-all 网络策略3.2 在 Hubble CLI 中验证网络策略源3.3 …...

深入理解JavaScript设计模式之单例模式

目录 什么是单例模式为什么需要单例模式常见应用场景包括 单例模式实现透明单例模式实现不透明单例模式用代理实现单例模式javaScript中的单例模式使用命名空间使用闭包封装私有变量 惰性单例通用的惰性单例 结语 什么是单例模式 单例模式&#xff08;Singleton Pattern&#…...

JDK 17 新特性

#JDK 17 新特性 /**************** 文本块 *****************/ python/scala中早就支持&#xff0c;不稀奇 String json “”" { “name”: “Java”, “version”: 17 } “”"; /**************** Switch 语句 -> 表达式 *****************/ 挺好的&#xff…...

【HTTP三个基础问题】

面试官您好&#xff01;HTTP是超文本传输协议&#xff0c;是互联网上客户端和服务器之间传输超文本数据&#xff08;比如文字、图片、音频、视频等&#xff09;的核心协议&#xff0c;当前互联网应用最广泛的版本是HTTP1.1&#xff0c;它基于经典的C/S模型&#xff0c;也就是客…...

基于IDIG-GAN的小样本电机轴承故障诊断

目录 🔍 核心问题 一、IDIG-GAN模型原理 1. 整体架构 2. 核心创新点 (1) ​梯度归一化(Gradient Normalization)​​ (2) ​判别器梯度间隙正则化(Discriminator Gradient Gap Regularization)​​ (3) ​自注意力机制(Self-Attention)​​ 3. 完整损失函数 二…...

淘宝扭蛋机小程序系统开发:打造互动性强的购物平台

淘宝扭蛋机小程序系统的开发&#xff0c;旨在打造一个互动性强的购物平台&#xff0c;让用户在购物的同时&#xff0c;能够享受到更多的乐趣和惊喜。 淘宝扭蛋机小程序系统拥有丰富的互动功能。用户可以通过虚拟摇杆操作扭蛋机&#xff0c;实现旋转、抽拉等动作&#xff0c;增…...