SlideShare a Scribd company logo
1 of 31
MACRO
First Macro Example:- #include <stdio.h> #define SquareOf(x) x*x void main() { int xin=3; printf(&quot;xin=%i&quot;,xin); printf(&quot;SquareOf(xin)=%i&quot;, SquareOf(xin) ); printf(&quot;SquareOf(xin+4)=%i&quot;, SquareOf(xin+4) ); printf(&quot;SquareOf(xin+xin)=%i&quot;, SquareOf(xin+xin) ); }
C Program for Swapping:- #include<stdio.h> void exchange(int i, int j) { int temp; temp = i; i = j; j = temp; printf(&quot;AFTER - %d %d&quot;, i, j); } main() { int i=1, j=3; printf(&quot;BEFORE - %d %d&quot;, i, j); exchange(i, j); }
Macro for Swapping:- #include<stdio.h> #define swap(i,j) { int temp; temp=i; i=j; j=temp; } void main() { int i=1, j=3; printf(&quot;BEFORE - %d %d&quot;, i, j); swap(i,j); printf(&quot;AFTER - %d %d&quot;, i, j); }
Macro:- A macro is a unit of specification for program generation through expansion. A macro consists of a name, a set of formal parameters and a body of code. The use of macro name with a set of actual parameters is replaced by code generated from its body.
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Macro header & End stmt
ADVANCED MACRO FACILITIES ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],REPRESENTING   SS If condition is true ( Y= X) then control will be transferred to  .ONLY
Expansion time variables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Example of EV ,[object Object],[object Object],[object Object],[object Object],[object Object]
Attributes of parameters An attribute is written using the syntax:- <attribute name>  ’  <formal parameter specification> T– type L – length S – size Example MACRO ME &A AIF  (L’&A EQ 1) .NEXT ------ -----
ALGORITHM OF MACRO PROCESSOR
EXAMPLE MACRO TEST &X, &N, &R=AREG LCL  &M &M SET  0 .PQ MOVEM &R, &X+&M &M SET  &M + 1 AIF (&M NE N) .PQ MEND
EXAMPLE MACRO TEST & X , & N ,  R =AREG LCL  & M   &M SET  0 .PQ MOVEM &R, &X+&M &M SET  &M + 1 AIF (&M NE N) .PQ MEND MACRO CALL TEST  S,10 REPRESENTS PARAMETER NAME REPRESENTS EXPAN. VAR.  NAME REPRESENTS SEQUENCING SYMBOL  NAME REPRESENTS ACTUAL PARAMETER  NAME
Tables of Macro Preprocessor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tables of Macro Preprocessor ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tables of Macro Preprocessor 7.  Actual Parameter Table (APT) FIELDS :- a) Value 8.  EV Table (EVTAB) FIELDS:- a) value 9.  SS Table (SSTAB) FIELDS :- a) MDT Entry #
EXAMPLE MACRO TEST & X , & N ,  R =AREG LCL  & M   &M SET  0 .PQ MOVEM &R, &X+&M &M SET  &M + 1 AIF (&M NE N) .PQ MEND MACRO CALL TEST  S,10 REPRESENTS PARAMETER NAME REPRESENTS EXPAN. VAR.  NAME REPRESENTS SEQUENCING SYMBOL  NAME REPRESENTS ACTUAL PARAMETER  NAME
PNTAB EVNTAB KPDTAB SSNTAB APTAB EVTAB SSTAB R N X M AREG R PQ AREG 10 S 0 27
MNT MDT SSTP KPDTP MDTP #EV #KP #PP Name 5 10 25 1 1 2 TEST 30 29 28 27 26 25 MEND AIF  (E,1) NE (P,2) (S,1) (E,1)  SET  (E,1) +1 MOVEM (P,3),(P,1)+(E,1) (E,1)  SET  0 LCL (E,1)
Steps for MNT Entry TEST & X , & N ,  R= AREG STRUCTURE OF MNT For each positional parameter (i) Enter  Parameter name in  PNTAB [PNTAB_ptr] (ii)PNTAB_ptr := PNTAB_Ptr + 1; (iii)# PP := # PP + 1 : PNTAB x #pp=1 N #pp=1+1=2 SSTP KPDTP MDTP #EV #KP #PP Name
Steps for MNT Entry TEST & X , & N ,  R= AREG STRUCTURE OF MNT 10 PNTAB For each keyword parameter (i)Enter  parameter name and default value  ( if any), in KPDTAB   (ii) Enter parameter name  in PNTAB [ PNTAB_Ptr}. (iii) KPDTAB_Ptr := KPDTAB _Ptr + 1 ; (iv) PNTAB_Ptr := PNTAB_Ptr  + 1; (v)# KP := # KP + 1 ; KPDTAB R R,  AREG # KP := 1 N x AREG R SSTP KPDTP MDTP #EV #KP #PP Name
MDT 5 SSTAB MNT 30 29 28 27 26 25 MEND AIF  (E,1) NE (P,2) (S,1) (E,1)  SET  (E,1) +1 MOVEM (P,3),(P,1)+(E,1) (E,1)  SET  0 LCL (E,1) 27 SSTP KPDTP MDTP #EV #KP #PP Name 5 10 25 1 1 2 TEST
LCL  & M EVNTAB M If an LCL statement then (i) Enter expansion time variable name in EVNTAB  (ii)# EV := # EV + 1 ; M
.PQ MOVEM &R, &X+&M SSNTAB a)  If  SS is present in SSNTAB then get index No. Else 1 Enter SS in SSNTAB, then get index No. and  2. Enter MDT_Ptr in SSTAB b) For a parameter , generate the specification ( p,#n). c) For an expansion variable,generate the  specification ( E, # m). . PQ SSTAB 5 27 .PQ MOVEM &R, &X+&M MOVEM  (P,3) , (P,1)+(E,1) Enter this line into MDT Steps for Model Stmt
(Processing of a macro definition) 1.  SSNTAB_Ptr :=1; SSTAB_PTR:=1;MDT_ptr:=1; PNTAB_ptr :=1;KPDTAB_PTR:=1; 2.  Process the macro prototype statement and from the MNT entry  (a)  name  := macro name ; (b) For each positional parameter (i)  Enter  Parameter name in  PNTAB [PNTAB_ptr] (ii)  PNTAB_ptr := PNTAB_Ptr + 1; (iii) # PP := # PP + 1 : (c) KPDTP := KPDTAB_ ptr ; (d) For each keyword parameter (i)Enter  parameter name and default value  ( if any), in  KPDTAB [KPDTAB_ptr + 1]; (ii) Enter parameter name  in PNTAB [ PNTAB_Ptr}. (iii) KPDTAB_Ptr := KPDTAB _Ptr + 1 ; (iv) PNTAB_Ptr := PNTAB_Ptr  + 1; (v) # KP := # KP + 1 ; (e) MDTP :=  MDT_Ptr, (f) #EV := 0 ; (g) SSTP :=  SSTAB_Ptr  ;
3. While not a MEND statement (a) If an LCL statement then (i)  Enter expansion time variable name in EVNTAB  (ii) # EV := # EV + 1 ; (b) If a model statement then (i) If a label field contains a sequencing symbol then If symbol is present in SSNTAB then q := entry number in SSNTAB;   else Enter symbol in SSNTAB [ SSNTAB_Ptr]. q:= SSNTAB_Ptr; SSNTAB_ptr := SSNTAB_Ptr + 1; SSTAB [ SSTP + q – 1] := MDT_ Ptr; (ii) For a parameter , generate the specification ( p,#n). (iii) For an expansion variable,generate the  specification ( E, # m). (iv) Record the IC in MDT [ MDt_ptr]; (v) MDT_Ptr := MDT_Ptr + 1 :
(c ) If a preprocessor statement then (i) If a SET statement Search each expansion time variable  name used in the statement in EVNTAB  and generate (E,#m) (ii) If an AIF  or Ago statement then If sequencing symbol used in the  statement is present is SSNTAB then q = entry number in SSNTAB else Enter symbol in SSNTAB [ SSNTAB _ Ptr] q :=  SSNTABPtr ; SSNTAB_ Ptr := SSNTAB_ Ptr + 1 : Replace the symbol by ( S, SSTP + q – 1 ) (iii) Record the  IC in MDT [MDT_Ptr]. (iv) MDT_Ptr := MDT_ Ptr + 1 :
4. (MEND Statement ) If SSNTAB_Ptr = 1 ( i,e, SSNTAB is empty ) then SSTP := 0; Else SSTAB_Ptr := SSTAB_ Ptr + SSNYAB_Ptr – 1 : If # KP = 0 then KPDTP =0;

More Related Content

What's hot

What's hot (20)

Single Pass Assembler
Single Pass AssemblerSingle Pass Assembler
Single Pass Assembler
 
Macros in system programing
Macros in system programingMacros in system programing
Macros in system programing
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite Automata
 
Preprocessors
PreprocessorsPreprocessors
Preprocessors
 
Intermediate code
Intermediate codeIntermediate code
Intermediate code
 
Unit 3
Unit 3Unit 3
Unit 3
 
Chap 8. Optimization for training deep models
Chap 8. Optimization for training deep modelsChap 8. Optimization for training deep models
Chap 8. Optimization for training deep models
 
Compiler Design lab manual for Computer Engineering .pdf
Compiler Design lab manual for Computer Engineering .pdfCompiler Design lab manual for Computer Engineering .pdf
Compiler Design lab manual for Computer Engineering .pdf
 
Unit 3 sp assembler
Unit 3 sp assemblerUnit 3 sp assembler
Unit 3 sp assembler
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Lexical analysis-using-lex
Lexical analysis-using-lexLexical analysis-using-lex
Lexical analysis-using-lex
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Issues in the design of Code Generator
Issues in the design of Code GeneratorIssues in the design of Code Generator
Issues in the design of Code Generator
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
 
Compiler construction
Compiler constructionCompiler construction
Compiler construction
 
Introduction to loaders
Introduction to loadersIntroduction to loaders
Introduction to loaders
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 

Similar to Macro

Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...
Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...
Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...Takahiro Katagiri
 
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework HelpC++ Homework Help
 
QTP Presentation2
QTP Presentation2QTP Presentation2
QTP Presentation2vucevic
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01tabish
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01tabish
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewAshish Kumar
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02tabish
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02wingsrai
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPatrick Allaert
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.pptebinazer1
 
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)Craig Chao
 
ATE Pattern Structure Basics
ATE Pattern Structure BasicsATE Pattern Structure Basics
ATE Pattern Structure Basicsstn_tkiller
 

Similar to Macro (20)

Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...
Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...
Towards Auto-tuning Facilities into Supercomputers in Operation - The FIBER a...
 
U3.pptx
U3.pptxU3.pptx
U3.pptx
 
unit 3 ppt.pptx
unit 3 ppt.pptxunit 3 ppt.pptx
unit 3 ppt.pptx
 
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizationsEgor Bogatov - .NET Core intrinsics and other micro-optimizations
Egor Bogatov - .NET Core intrinsics and other micro-optimizations
 
Best C++ Programming Homework Help
Best C++ Programming Homework HelpBest C++ Programming Homework Help
Best C++ Programming Homework Help
 
QTP Presentation2
QTP Presentation2QTP Presentation2
QTP Presentation2
 
L7 pointers
L7 pointersL7 pointers
L7 pointers
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01Chapter 1abapprogrammingoverview-091205081953-phpapp01
Chapter 1abapprogrammingoverview-091205081953-phpapp01
 
chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01chapter-1abapprogrammingoverview-091205081953-phpapp01
chapter-1abapprogrammingoverview-091205081953-phpapp01
 
Chapter 1 Abap Programming Overview
Chapter 1 Abap Programming OverviewChapter 1 Abap Programming Overview
Chapter 1 Abap Programming Overview
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02
 
Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02Abapprogrammingoverview 090715081305-phpapp02
Abapprogrammingoverview 090715081305-phpapp02
 
PHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & PinbaPHP applications/environments monitoring: APM & Pinba
PHP applications/environments monitoring: APM & Pinba
 
chapter1.ppt
chapter1.pptchapter1.ppt
chapter1.ppt
 
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)
Leveraging R in Big Data of Mobile Ads (R在行動廣告大數據的應用)
 
ATE Pattern Structure Basics
ATE Pattern Structure BasicsATE Pattern Structure Basics
ATE Pattern Structure Basics
 
Unit3 C
Unit3 C Unit3 C
Unit3 C
 
R console
R consoleR console
R console
 
iit c prog.ppt
iit c prog.pptiit c prog.ppt
iit c prog.ppt
 

Recently uploaded

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 

Recently uploaded (20)

Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 

Macro

  • 2. First Macro Example:- #include <stdio.h> #define SquareOf(x) x*x void main() { int xin=3; printf(&quot;xin=%i&quot;,xin); printf(&quot;SquareOf(xin)=%i&quot;, SquareOf(xin) ); printf(&quot;SquareOf(xin+4)=%i&quot;, SquareOf(xin+4) ); printf(&quot;SquareOf(xin+xin)=%i&quot;, SquareOf(xin+xin) ); }
  • 3. C Program for Swapping:- #include<stdio.h> void exchange(int i, int j) { int temp; temp = i; i = j; j = temp; printf(&quot;AFTER - %d %d&quot;, i, j); } main() { int i=1, j=3; printf(&quot;BEFORE - %d %d&quot;, i, j); exchange(i, j); }
  • 4. Macro for Swapping:- #include<stdio.h> #define swap(i,j) { int temp; temp=i; i=j; j=temp; } void main() { int i=1, j=3; printf(&quot;BEFORE - %d %d&quot;, i, j); swap(i,j); printf(&quot;AFTER - %d %d&quot;, i, j); }
  • 5. Macro:- A macro is a unit of specification for program generation through expansion. A macro consists of a name, a set of formal parameters and a body of code. The use of macro name with a set of actual parameters is replaced by code generated from its body.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Attributes of parameters An attribute is written using the syntax:- <attribute name> ’ <formal parameter specification> T– type L – length S – size Example MACRO ME &A AIF (L’&A EQ 1) .NEXT ------ -----
  • 14. ALGORITHM OF MACRO PROCESSOR
  • 15. EXAMPLE MACRO TEST &X, &N, &R=AREG LCL &M &M SET 0 .PQ MOVEM &R, &X+&M &M SET &M + 1 AIF (&M NE N) .PQ MEND
  • 16. EXAMPLE MACRO TEST & X , & N , R =AREG LCL & M &M SET 0 .PQ MOVEM &R, &X+&M &M SET &M + 1 AIF (&M NE N) .PQ MEND MACRO CALL TEST S,10 REPRESENTS PARAMETER NAME REPRESENTS EXPAN. VAR. NAME REPRESENTS SEQUENCING SYMBOL NAME REPRESENTS ACTUAL PARAMETER NAME
  • 17.
  • 18.
  • 19. Tables of Macro Preprocessor 7. Actual Parameter Table (APT) FIELDS :- a) Value 8. EV Table (EVTAB) FIELDS:- a) value 9. SS Table (SSTAB) FIELDS :- a) MDT Entry #
  • 20. EXAMPLE MACRO TEST & X , & N , R =AREG LCL & M &M SET 0 .PQ MOVEM &R, &X+&M &M SET &M + 1 AIF (&M NE N) .PQ MEND MACRO CALL TEST S,10 REPRESENTS PARAMETER NAME REPRESENTS EXPAN. VAR. NAME REPRESENTS SEQUENCING SYMBOL NAME REPRESENTS ACTUAL PARAMETER NAME
  • 21. PNTAB EVNTAB KPDTAB SSNTAB APTAB EVTAB SSTAB R N X M AREG R PQ AREG 10 S 0 27
  • 22. MNT MDT SSTP KPDTP MDTP #EV #KP #PP Name 5 10 25 1 1 2 TEST 30 29 28 27 26 25 MEND AIF (E,1) NE (P,2) (S,1) (E,1) SET (E,1) +1 MOVEM (P,3),(P,1)+(E,1) (E,1) SET 0 LCL (E,1)
  • 23. Steps for MNT Entry TEST & X , & N , R= AREG STRUCTURE OF MNT For each positional parameter (i) Enter Parameter name in PNTAB [PNTAB_ptr] (ii)PNTAB_ptr := PNTAB_Ptr + 1; (iii)# PP := # PP + 1 : PNTAB x #pp=1 N #pp=1+1=2 SSTP KPDTP MDTP #EV #KP #PP Name
  • 24. Steps for MNT Entry TEST & X , & N , R= AREG STRUCTURE OF MNT 10 PNTAB For each keyword parameter (i)Enter parameter name and default value ( if any), in KPDTAB (ii) Enter parameter name in PNTAB [ PNTAB_Ptr}. (iii) KPDTAB_Ptr := KPDTAB _Ptr + 1 ; (iv) PNTAB_Ptr := PNTAB_Ptr + 1; (v)# KP := # KP + 1 ; KPDTAB R R, AREG # KP := 1 N x AREG R SSTP KPDTP MDTP #EV #KP #PP Name
  • 25. MDT 5 SSTAB MNT 30 29 28 27 26 25 MEND AIF (E,1) NE (P,2) (S,1) (E,1) SET (E,1) +1 MOVEM (P,3),(P,1)+(E,1) (E,1) SET 0 LCL (E,1) 27 SSTP KPDTP MDTP #EV #KP #PP Name 5 10 25 1 1 2 TEST
  • 26. LCL & M EVNTAB M If an LCL statement then (i) Enter expansion time variable name in EVNTAB (ii)# EV := # EV + 1 ; M
  • 27. .PQ MOVEM &R, &X+&M SSNTAB a) If SS is present in SSNTAB then get index No. Else 1 Enter SS in SSNTAB, then get index No. and 2. Enter MDT_Ptr in SSTAB b) For a parameter , generate the specification ( p,#n). c) For an expansion variable,generate the specification ( E, # m). . PQ SSTAB 5 27 .PQ MOVEM &R, &X+&M MOVEM (P,3) , (P,1)+(E,1) Enter this line into MDT Steps for Model Stmt
  • 28. (Processing of a macro definition) 1. SSNTAB_Ptr :=1; SSTAB_PTR:=1;MDT_ptr:=1; PNTAB_ptr :=1;KPDTAB_PTR:=1; 2. Process the macro prototype statement and from the MNT entry (a) name := macro name ; (b) For each positional parameter (i) Enter Parameter name in PNTAB [PNTAB_ptr] (ii) PNTAB_ptr := PNTAB_Ptr + 1; (iii) # PP := # PP + 1 : (c) KPDTP := KPDTAB_ ptr ; (d) For each keyword parameter (i)Enter parameter name and default value ( if any), in KPDTAB [KPDTAB_ptr + 1]; (ii) Enter parameter name in PNTAB [ PNTAB_Ptr}. (iii) KPDTAB_Ptr := KPDTAB _Ptr + 1 ; (iv) PNTAB_Ptr := PNTAB_Ptr + 1; (v) # KP := # KP + 1 ; (e) MDTP := MDT_Ptr, (f) #EV := 0 ; (g) SSTP := SSTAB_Ptr ;
  • 29. 3. While not a MEND statement (a) If an LCL statement then (i) Enter expansion time variable name in EVNTAB (ii) # EV := # EV + 1 ; (b) If a model statement then (i) If a label field contains a sequencing symbol then If symbol is present in SSNTAB then q := entry number in SSNTAB; else Enter symbol in SSNTAB [ SSNTAB_Ptr]. q:= SSNTAB_Ptr; SSNTAB_ptr := SSNTAB_Ptr + 1; SSTAB [ SSTP + q – 1] := MDT_ Ptr; (ii) For a parameter , generate the specification ( p,#n). (iii) For an expansion variable,generate the specification ( E, # m). (iv) Record the IC in MDT [ MDt_ptr]; (v) MDT_Ptr := MDT_Ptr + 1 :
  • 30. (c ) If a preprocessor statement then (i) If a SET statement Search each expansion time variable name used in the statement in EVNTAB and generate (E,#m) (ii) If an AIF or Ago statement then If sequencing symbol used in the statement is present is SSNTAB then q = entry number in SSNTAB else Enter symbol in SSNTAB [ SSNTAB _ Ptr] q := SSNTABPtr ; SSNTAB_ Ptr := SSNTAB_ Ptr + 1 : Replace the symbol by ( S, SSTP + q – 1 ) (iii) Record the IC in MDT [MDT_Ptr]. (iv) MDT_Ptr := MDT_ Ptr + 1 :
  • 31. 4. (MEND Statement ) If SSNTAB_Ptr = 1 ( i,e, SSNTAB is empty ) then SSTP := 0; Else SSTAB_Ptr := SSTAB_ Ptr + SSNYAB_Ptr – 1 : If # KP = 0 then KPDTP =0;