search
HomeCommon Problemwhat is macro
what is macroJun 01, 2019 pm 05:22 PM
Macro

The so-called macro is a series of commands that are organized together and used as a single command to complete a specific task; Microsoft Word defines macros as "A macro is a series of word commands that can be organized together and used as an independent command. , it makes everyday tasks easier”.

what is macro

The operating environment of this tutorial: Windows 7 system, Dell G3 computer.

What is a macro

The so-called macro is a group of commands organized together to complete a specific task as a single command. The definition of macro in Microsoft Word is: "A macro is a series of word commands that can be organized together as an independent command to make daily work easier." Word uses the macro language Visual Basic to write macros as a series of instructions.

A macro in computer science is an abstraction that replaces a certain text pattern according to a series of predefined rules. The Excel office software automatically integrates the "VBA" high-level programming language, and the program compiled in this language is called a "macro". Using "VBA" requires a certain programming foundation and consumes a lot of time. Therefore, the vast majority of users only use the general tabulation function of Excel and rarely use "VBA".

The interpreter or compiler will automatically perform this pattern replacement when encountering a macro. For compiled languages, macro expansion occurs at compile time, and the tool that performs macro expansion is often called a macro expander. The term macro is often used in many similar contexts, derived from the concept of macro expansion, including keyboard macros and macro languages. Most of the time, the use of the word "macro" implies the conversion of small commands or actions into a series of instructions.

The purpose of macros is to automate frequently used sequences or to gain a more powerful abstraction capability - but this is often the same thing.

Computer languages ​​such as C or assembly language have simple macro systems, which are implemented by the preprocessor of the compiler or assembler. The job of C's macro preprocessor is just simple text search and replacement. Using additional text processing languages ​​such as M4, C programmers can obtain more sophisticated macros.

Lisp-like languages ​​such as Common Lisp and Scheme have more sophisticated macro systems: macros behave like functions that transform their own program text, and all languages ​​can be used to express this transformation. A C macro can define a grammatical replacement, but a Lisp macro can control the calculation of a section of code. Gained the ability to control the order of execution of code (see lazy evaluation and unrestricted functions), making newly created syntax constructs indistinguishable from the language's built-in syntax constructs.

For example, if a Lisp dialect has cond but not if, you can use macros to define the latter from the former. Major extensions to Lisp syntax, such as the object-oriented CLOS system, can be defined by macros.

Typical applications of macros

Speed ​​up daily editing and formatting. Combine multiple commands to make options in dialog boxes more accessible and automate a range of complex tasks.

Applications can also use a system similar to macros to allow users to customize a series of (usually the most commonly used operations) into a step. That is, the user performs a series of operations and lets the application "remember" these operations and their order. More advanced users can directly access the functionality of those applications through built-in macro programming. When programming in an unfamiliar macro language, a more effective method is to record a series of operations that the user hopes to obtain, and then understand the structure of the macro commands by reading the macro file recorded by the application.

Recommended courses: PHP Tutorial.

The above is the detailed content of what is macro. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
什么是宏什么是宏Jun 01, 2019 pm 05:22 PM

所谓宏,就是一些命令组织在一起,作为一个单独命令完成一个特定任务;Microsoft Word中对宏定义为“宏就是能组织到一起作为一独立的命令使用的一系列word命令,它能使日常工作变得更容易”。

C++ 函数重载中如何使用宏来简化代码?C++ 函数重载中如何使用宏来简化代码?Apr 13, 2024 am 11:21 AM

宏简化C++函数重载:创建宏,将通用代码提取到单个定义中。在每个重载函数中使用宏替换通用的代码部分。实际应用包括创建打印输入数据类型信息的函数,分别处理int、double和string数据类型。

宏读不到u盘宏读不到u盘Mar 18, 2024 am 11:01 AM

★故障现象★:每次打开工作表,提示找不到宏?打开EXCEL后无故关闭,同时出现发送错误报告。打不开Excel文件提示发送错误报告★解决方案★:下载宏病毒专杀软件,对电脑进行查杀。宏病毒专杀软件特别提示为确保本专杀更好的查毒和清除病毒,请在扫描时注意以下几点:1、请先将360关闭或删除(否则360删除资料问题自负。)2、本专杀不支持加密文档的病毒查杀(请将密码去除后再查。)3、设置为只读的文档,会导致清除失败(请去除只读再查。)4、专杀会在你的资料文档不损坏的前提下清除病毒。5、专杀会杀毒前会备份

探讨Golang中宏的概念和应用探讨Golang中宏的概念和应用Mar 05, 2024 pm 10:00 PM

在Golang中,宏(Macro)是一种高级编程技术,它可以帮助程序员简化代码结构并提高代码的可维护性。宏是一种源代码级别的文本替换机制,可以在编译过程中将宏代码片段替换为实际代码片段。在本文中,我们将探讨Golang中宏的概念和应用,并提供具体的代码示例。一、宏的概念在Golang中,宏并不是原生支持的特性,因为Golang的设计初衷是保持语言的简洁和清晰

C++ 内联函数与宏的对比C++ 内联函数与宏的对比Apr 17, 2024 am 09:18 AM

内联函数展开为代码,消除调用开销,但避免函数体过大和递归调用;宏是文本替换,轻量级但难维护,用于常量和简短代码片段。实战案例:内联函数实现斐波那契数列,宏定义常量PI。

能自动运行宏的名称为什么能自动运行宏的名称为什么Jul 28, 2022 pm 03:21 PM

打开数据库时能自动运行宏的名称为“Autoexec”。AutoExec宏可以在首次打开数据库时执行执行一个或一系列的指定操作。在打开数据库时,Access将查找一个名为AutoExec的宏,如果找到,就自动运行它。

C++ 函数与宏的区别和优缺点对比C++ 函数与宏的区别和优缺点对比Apr 11, 2024 pm 04:03 PM

函数是运行时执行的代码块,可返回结果;宏是预处理时展开的常量或代码片段,不可返回结果。函数易读、可重用、代码可读性高,但效率低;宏编译开销小、性能优,但代码可读性差、难以调试。

深入探索Golang中宏的使用场景深入探索Golang中宏的使用场景Mar 05, 2024 pm 03:33 PM

Golang是一种开源的编程语言,它在近年来越来越受到程序员的欢迎。作为一种静态类型的语言,Golang提供了许多强大的特性,其中之一就是宏(Macro)。在本文中,我们将深入探索Golang中宏的使用场景,并通过具体的代码示例来说明宏的作用和优势。什么是宏(Macro)?宏是一种编程语言中的一种功能,可以在编译时被替换成最终的代码。它可以帮助简化代码、提高

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor