Monday 2 March 2020

Procedure oriented program

Procedure Oriented Programming

2043 words (8 pages) Essay in Information Technology
Disclaimer: This work has been submitted by a student. This is not an example of the work produced by our Essay Writing Service. You can view samples of our professional work here.
Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of UK Essays.
 Submitted by: Gagandeep Singh Brar 
Procedure oriented programming is a set of functions. In this program Clanguage is used. To perform any particular task, set of function are compulsory. For example , a program may involve collecting data from user, performing some kind of calculation on that data and printing the data on screen when is requested. Calculating, reading or printing can be written in a program with the help of different functions on different tasks.
POP method also emphases the functions or the subroutines.
Difference between procedure oriented and object oriented programming
Structure of POP method
Here is some problems in POP method like its difficult to handling data because it gives no importance to data.  Dat means the information that are collected from user and after calculation new result come. If any one is familiar with C programming than he may recollect storage classes in C.  In C, data member is declared GLOBAL in order to make 2 or more functions in the program. What happen when 2 or functions on the same data member. For example,  when if there are 7 functions in a program and this become a global data member. Unfortunately,  if the value of any global data member or that may key element than it will affect the whole program. It is a big problem to identify that which function is causing the problem.
http://www.circuitstoday.com/wp-content/uploads/2012/09/global_data_in_C.png
Handling of data & functions in POP
One of the most important feature of C language is structure. Programmer use integer data, decimal point data(float), array data pack together  into single entity by using structure. The reason of the popularity of structure was introduced first by c language.

Sunday 23 February 2020

Microsoft(macroprocessor)

Microsoft is a US-based technology company. It was founded by Bill Gates and Paul Allen in 1975 and quickly grew to become the largest software company in the world. Today, Microsoft is still widely known for its software, but the company also develops hardware and provides a number of cloud services.
Microsoft's most recognizable software titles include Windows and Office. Microsoft Windows is the world's most popular desktop operating system and Office is the most popular productivity suite. Below is a list of some of the software, hardware, and cloud services provided by Microsoft.

Software

  • Windows - operating system for desktop computers, laptops, and tablets
  • Office - productivity suite including WordExcelPowerPoint, and Access
  • Outlook - email and calendar software
  • Visio - diagramming and vector drawing program
  • Visual Studio - multi-platform software development IDE for building apps
  • Skype - video conferencing application
  • Halo - popular series of video games for Xbox

Hardware

  • Xbox - video game console first launched in 2001; followed by Xbox 360, Xbox One, and Xbox One X
  • Surface - line of tablets and laptop computers
  • HoloLens - head-mounted smartglasses designed for augmented reality
  • Input devices - Microsoft branded keyboards and mice

Services

  • Bing - web search engine integrated into Windows 10
  • Outlook.com - free webmail service also used for Hotmail accounts
  • OneDrive - cloud storage with web-based access
  • Azure - cloud computing platform for hosting data and deploying applications
Microsoft's headquarters is located in Redmond, Washington, but the company has corporate offices and data centers around the world. Microsoft Corporation's ticker symbol is MSFT.



Macro Processor


A Macro instruction is the notational convenience for the programmer. For every occurrence of macro the whole macro body or macro block of statements gets expanded in the main source code. Thus Macro instructions makes writing code more convenient.
Silent features of Macro Processor:
  • Macro represents a group of commonly used statements in the source programming language.
  • Macro Processor replace each macro instruction with the corresponding group of source language statements. This is known as expansion of macros.
  • Using Macro instructions programmer can leave the mechanical details to be handled by the macro processor.
  • Macro Processor designs are not directly related to the computer architecture on which it runs.
  • Macro Processor involves definition, invocation and expansion.
Macro Definition and Expanstion:

Line                 Label                 Opcode                 Operand
  
5                    COPY                  START                  0
10                   RDBUFF                MACRO                  &INDEV, &BUFADR
15                   
.
.
90
95                                         MEND

  • Line 10:
    RDBUFF (Read Buffer) in the Label part is the name of the Macro or definition of the Macro. &INDEV and &BUFADR are the parameters present in the Operand part. Each parameter begins with the character &.
  • Line 15 – Line 90:
    From Line 15 to Line 90 Macro Body is present. Macro directives are the statements that make up the body of the macro definition.
  • Line 95:
    MEND is the assembler directive that means the end of the macro definition.
Macro Invocation:

Line                 Label                 Opcode                 Operand
  
180                  FIRST                 STL                    RETADR
190                  CLOOP                 RDBUFF                 F1, BUFFER
15                   
.
.
255                                         END                    FIRST
Line 190:
RDBUFF is the Macro invocation or Macro Call that gives the name of the macro instruction being invoked and F1, BUFFER are the arguments to be used in expanding the macro. The statement that form the expansion of a macro are generated each time the macro is invoked.

One Pass Macro processor program in C


"C" program for the implementation of a one pass macro processor
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<stdlib.h>
void main()
{
FILE *f1,*f2,*f3,*f4,*f5;
int len,i,pos=1;
char arg[20],mne[20],opnd[20],la[20],name[20],mne1[20],opnd1[20],pos1[10],pos2[10];
clrscr();
f1=fopen("input.txt","r");
f2=fopen("namtab.txt","w+");
f3=fopen("deftab.txt","w+");
f4=fopen("argtab.txt","w+");
f5=fopen("op.txt","w+");
fscanf(f1,"%s%s%s",la,mne,opnd);
while(strcmp(mne,"END")!=0)
{
if(strcmp(mne,"MACRO")==0)
{
fprintf(f2,"%s\n",la);
fseek(f2,SEEK_SET,0);
fprintf(f3,"%s\t%s\n",la,opnd);
fscanf(f1,"%s%s%s",la,mne,opnd);
while(strcmp(mne,"MEND")!=0)
{
if(opnd[0]=='&')
{
itoa(pos,pos1,5);
strcpy(pos2,"?");
strcpy(opnd,strcat(pos2,pos1));
pos=pos+1;
}
fprintf(f3,"%s\t%s\n",mne,opnd);
fscanf(f1,"%s%s%s",la,mne,opnd);
}
fprintf(f3,"%s",mne);
}
else
{
fscanf(f2,"%s",name);
if(strcmp(mne,name)==0)
{
len=strlen(opnd);
for(i=0;i<len;i++)
{
if(opnd[i]!=',')
fprintf(f4,"%c",opnd[i]);
else
fprintf(f4,"\n");
}
fseek(f3,SEEK_SET,0);
fseek(f4,SEEK_SET,0);
fscanf(f3,"%s%s",mne1,opnd1);
fprintf(f5,".\t%s\t%s\n",mne1,opnd);
fscanf(f3,"%s%s",mne1,opnd1);
while(strcmp(mne1,"MEND")!=0)
{
if((opnd[0]=='?'))
{
fscanf(f4,"%s",arg);
fprintf(f5,"-\t%s\t%s\n",mne1,arg);
}
else
fprintf(f5,"-\t%s\t%s\n",mne1,opnd1);
fscanf(f3,"%s%s",mne1,opnd1);
}
}
else
fprintf(f5,"%s\t%s\t%s\n",la,mne,opnd);
}
fscanf(f1,"%s%s%s",la,mne,opnd);
}
fprintf(f5,"%s\t%s\t%s",la,mne,opnd);
fclose(f1);
fclose(f2);
fclose(f3);
fclose(f4);
fclose(f5);
printf("files to be viewed \n");
printf("1. argtab.txt\n");
printf("2. namtab.txt\n");
printf("3. deftab.txt\n");
printf("4. op.txt\n");
getch();
}

    



Input.txt

EX1 MACRO &A,&B
- LDA &A
- STA &B
- MEND -
SAMPLE START 1000
- EX1 N1,N2
N1 RESW 1
N2 RESW 1
- END -

Argtab.txt

N1
N2

Op.txt

SAMPLE START 1000
. EX1 N1,N2
- LDA ?1
- STA ?2
N1 RESW 1
N2 RESW 1
- END -

Deftab.txt

EX1 &A,&B
LDA ?1
STA ?2
MEND


Namtab.txt

EX1