I could be wrong, but I think the first use of "macro" in a
programming/computer context was introduced in Assembler languages: A
macro invocation statement basically looked like an assembly statement
with parameters, but instead of generating a single machine instruction
or data definition could generate a whole series of assembly
instructions. The Macro definition typically includes both Assembly
statements and special macro control statements. I was first introduced
to them in IBM 1410 Assembler, where they were used to generate the
relatively complex interfaces required to do I/O. In 360/370/etc
Assembler, macros are extensively used to enforce the conventions for
requesting any service from the Operating System, not just I/O. As
hardware architectures became more complex, programmers quickly
discovered there were many repetitive instruction sequences in a typical
assembler program, and macros were designed to allow a single statement
to generate the entire sequence with minimal effort. In order to
perform that role, Assembler Macros definitely are required to include
statements that support conditional logic and looping and symbolic
values; but it is a pretty restrictive language, as its only intended
capability is to generate, perhaps conditionally, other Assembly
language statements, not to solve general purpose problems.
CDC 6000 Assembly Language included not only "macros" but "micros". A
"micro" allowed you do create a definition of a new "machine
instruction" that would create a 15-bit, 30-bit, or 60-bit "instruction"
with binary sub-fields and parameter rules similar to actual machine
instructions statements, with a one-to-one correspondence between a
statement and an "instruction". Could be used for "new" hardware
instructions not yet supported by the Assembler, for creating a
customized version of an instruction where some fields were desired to
be constrained, and possibly other bizarre applications.
The main distinction between a macro language and a full programming
language seems to be the context in which it is executed. Macros are
embedded with statements of another language and "executed" when
processing or pre-processing those statements to generate additional
statements in that language to generate the complete program. They are
part of the process of generating the statements for the full program,
not actually part of the final program.
Joel C Ewing
On 1/7/22 06:57, Rony G. Flatscher wrote:
On 07.01.2022 03:00, Bob Bridges wrote:
I usually include JCL under the ~very~ general rubric of "programming
language", but even mentally I think that's a stretch. It's more like a macro
language, sort of like .bat I guess.
I may as well take this opportunity to include a mild rant. I've often heard the programs you can
write for automating some applications referred to as "macros"; I have in mind VBA, for
example, and what WordPerfect used to have if WordPerfect is still around. It always seemed to me
that VBA qualifies just fine as a programming language, and what I write in VBA is not a
"macro", just a program.
But then what is a macro? In searching for some sort of distinction that would
justify there being two different words, I've concluded to my own satisfaction
that a macro is a set of instructions that have no decision-making capability,
maybe no if-then syntax and definitely no looping, probably no arithmetic,
possibly some rudimentary logic operators like NOT (and may only NOT). The old
.bat language would fit this description; so would JCL, especially before they
added IF statements. So, if I remember right, are the instruction sets I used
to write for QMF. But not VBA; not even TECO. (Anyone remember TECO?)
Now I sit back and wait for someone more knowledgeable to correct me either on the
capabilities of the languages I named, or on the definition of "macro".
Most of the time Wikipedia is a quite good starting point, e.g.
<https://en.wikipedia.org/wiki/Macro_(computer_science)>.
The distinction between a macro/script (a set of statements allowing for
executing repetitively in
the context of a hosting application) and a stand-alone program can be even
totally blurred, e.g.
the following ooRexx program can be run from the macro menu of OpenOffice
(OOO)/LibreOffice (LO) or
as a stand-alone program from the command line:
#!/usr/bin/env rexx
use arg slotArg /* if called as a macro, we can access the document for
which we were called */
scriptContext=uno.getScriptContext(slotArg) /* get the xScriptContext
object */
if scriptContext<>.nil then /* o.k., we are invoked as a
macro from OOo/LO */
do
xContext=scriptContext~getComponentContext /* get the context (a
XComponentContext) object */
xDesktop=scriptContext~getDesktop /* get the desktop (a
XDesktop) object */
oDoc=scriptContext~getInvocationContext /* get the document for
which this macro got invoked */
end
else /* this program was called from outside of OOo, e.g. from the
commandline */
do
xContext = UNO.connect() /* get a connection to the
OOo/LO server */
xDesktop = UNO.createDesktop(xContext) /* create the XDesktop
from xContext */
/* create a word processor document: */
oDoc=xDesktop~XComponentLoader~loadComponentFromURL("private:factory/swriter",
"_blank", 0, .UNO~noProps)
end
str="Hello IBM-Main ["date() time()"], this is ooRexx (cf.
<https://www.RexxLA.org>) speaking ! "
oDoc~XTextDocument~getText~getEnd~setString(str)
::requires UNO.CLS /* load UNO support (OpenOffice/LibreOffice) for
ooRexx */
This ooRexx macro/script/program runs unchanged on Windows, MacOS and Linux and
will add a string at
the end of an OOO/LO word document that greets the members of this list and
supplies the date and
time of its invocation.
A few remarks:
* ooRexx allows for the "USE ARG" keyword in addition to "PARSE ARG": "USE
ARG" fetches arguments
by reference and can be used to fetch stems by reference
* The tilde (~) is the ooRexx message operator; one can send messages to any
value/object/instance
in an ooRexx program. Left of the tilde is the receiving
value/object/instance/receiver (these
are synonyms), right of it the name of a method routine that conceptually
the receiver is
supposed to look up and invoke on behalf of the programmer. If the invoked
method routine
returns a result one can immediately send it a message too, if needed.
* At the end of the program you see an ooRexx directive led in by the
double-colons, in this case
the "requires" directive. The ooRexx interpreter will first syntax check
the entire REXX program
and if no syntax errors were found it will proceed carrying out all
directives, in this case it
will call the ooRexx program named UNO.CLS which is a package of useful
public routines and
public ooRexx classes to ease interfacing with OpenOffice/LibreOffice.
After all directives got
carried out by the interpreter the execution of the program starts having
all resources
available at that point in time that got brought in by the directives.
o "UNO" is the acronym for "universal network objects" (cf.
<https://wiki.openoffice.org/wiki/Uno>) the c++ class model OOo/LO got
built upon, using as
protocol "urp" (uno remote protocol) which is a client/server protocol.
* The macro/script/program checks whether it got called as a macro and if
so, gets the document
for which the macro should get invoked; if not, then the program was
started from outside of a
running OOO/LO and therefore starts up OOO/LO and creates a new word
document to work on. After
having a reference to the OOO/LO word document it realizes the necessary
UNO interface to allow
setting (adding) a new string at the end of the word document.
---rony
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
--
Joel C. Ewing
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN