Sie sind auf Seite 1von 34

MAHARAJA AGRASEN INSTITUTE OF

TECHNOLOGY
(Guru Gobind Singh Indraprastha University)

SUMMER INTERNSHIP REPORT


Undertaken at

R Systems International Limited


IN
Scientific Calculator using .NET

Submitted by:
Pavas Sah
04796402710

PROJECT
Scientific Calculator using .NET
SUBMITTED IN PARTIAL FULFILLMENT OF THE DEGREE
OF
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE ENGINEERING

MAHARAJA AGRASEN INSTITUTE OF


TECHNOLOGY, GGSIPU
Summer Training after Third Year
Year-2014
Under the guidance of:
Mr.
(Guide)
R Systems International Limited

CONTENTS
1. Acknowledgement
2. Company Profile
3. Activities
4. About Embedded Linux with ARM
5. About Linux
6. C with data structures
7. Shell scripting
8. Linux internals & system programming
9. Project: Multiple data compression and
encryption Using Iterative method
10. Source code of Project

ACKNOWLEDGEMENT
I hereby take this opportunity to thank all those people whose knowledge
and experience helped me bring this report in its present form. It would
have been a tough task for me to complete report without their help.
I express my sincere thanks and gratitude to My Guide Mr. (Project
Manager), R Systems International Ltd. for providing me the opportunity
to pursue my training at the institute.
I would like to express my gratitude to my group member, for helping me
in every aspect during the training phase as well as in carrying out the
whole project.
Finally I would like to express my deep appreciation to my family and
friends who have been a constant source of inspiration. I am internally
grateful to them for always encouraging me wherever and whenever I
needed them.

Pavas Sah
04796402710

INSTITUTE PROFILE
ABOUT RSI
R Systems (founded in 1993) is a specialized IT Services &
Solutions and IT-enabled Services provider catering to a wide
range of global customers. We are endowed with some of the
industrys highest quality certifications and standards, including
SEI CMMI Level 5, PCMM Level 5, ISO 27001:2005 and ISO
9001:2008. Our IT services and solutions span five major verticals
which include Telecom & Digital Media, Banking & Finance,
HealthCare, Manufacturing & Logistics, and Government
Services.
Ever since our inception, we have grown in size and capability
and currently operate from 13 development and service centers
spread across Asia Pacific, Europe, and North America. We serve
customers worldwide using our global delivery model and 2500+
expert resources. We have won countless accolades from global
customers for our benchmarked delivery track record, quality
standards, and adaptability to technological challenges.
Our strength lies in our quality procedures, delivery and
operational excellence, customer-centric approach, intellectual
capital, and culture of innovation. With a rich legacy spread over
two decades, we generate Value that helps organizations
transcend to higher levels of efficiency and growth. Quite like the
Oyster Delivering the Pearl!

VISION, MISSION & VALUES


VISION
To generate Value through Technology, like the Oyster delivering the
Pearl.
MISSION
Our mission is to emerge as the World's leading solutions and
services provider by leveraging on the entrepreneurial spirit of our
employees, on cutting-edge technologies and niche verticals, through
constant innovation and learning.
VALUES
Caring

We care for our employees, customers, investors and


all those who are associated with us. We walk the
extra mile and nurture our relationships to build an
association that is meaningful, long-term, and
sustainable.

Innovating

We stay ahead by embracing innovation in all that we


think and do. Our innovation spreads across the entire
value chain and includes people, processes, and
technologies.

Transforming

We see ourselves as transformation agents. Our caring


and innovation-driven culture seeks to transform
individuals, businesses, and Society, for the better.

The Oyster and the Pearl


The Story of R Systems

The story of R Systems is a fascinating journey best captured by


the Shakespearean Oyster in which the English writer saw a
world of endless opportunity. It is a story of the pearl that
traverses the oceans, cocooned in the oyster and delivering great
value. The Oyster withstands all hardships, yet nurtures within it,
the beautiful Pearl. For us, the oyster and pearl metaphor defines
our historic past, our dynamic present, and our promising future.
We generate value for our employees, customers and all those
who are associated with us, like the Oyster that delivers the Pearl.
Our value-centric business model is broad-based and embraces
all our stakeholders. For our employees, we generate value by
helping them realize a better lifestyle and purposeful living. We
encourage an entrepreneurship spirit in our employees so that
they in turn can generate value for our global customers.
For our customers, we are like the Oyster, easy to access and
work with. We walk the extra mile with our customers and
collaborate with them as partners. This helps us ensure that they
grow, are able to meet their business requirements and stay
competitive. Like the Oyster that delivers value in the form of the
Pearl, we also see ourselves as an institution, responsible for
bringing about a meaningful change in our society.
Like the Oyster, we are Caring, Innovating and Transforming!
That's
our
story
and
thats
why
we
exist.
Welcome to the Oyster. Discover the Pearl!

ABOUT EMBEDDED LINUX WITH ARM


Objective
This course is designed to ensure that students of Engineering College with
academic capabilities will have the skill set needed to deal with the
challenges involved in real-world embedded technologies to meet the
needs of industries both today and in the future.
The course considers programming techniques which can help to ensure
that single-processor embedded systems are reliable.
The course is taught mainly using the C programming language, with a
ARM Board and PC emulated as an embedded device.
Introduction
Embedded Linux is the use of Linux in embedded computer systems such
as mobile phones, personal digital assistants, media players, set-top boxes,
and other consumer electronics devices, networking equipment, machine
control, industrial automation, navigation equipment and medical
instruments. According to survey conducted by Venture Development
Corporation, Linux was used by 18% of embedded engineers.
Linux is the version of Linux running on processors with a Memory
Management Unit (MMU). Processors without MMU can run a modified
version of Linux called uClinux. The uClinux tab provides pre-built
uClinux images for specific ARM processors
Key benefits of Linux on ARM

Complete scalable operating system providing a reliable multitasking environment


Based on an open source model (GPL)
Leverage a wide range of UNIX and open source applications
Early availability on ARM processor-based platforms
Used in many ARM technology-based designs including networking
and wireless space
Broad support through open discussion forums

The course is split into Six modules:

Data Structures with C


Shell Scripts
Linux Internals and System Programming
Linux Device Drivers
Embedded & Network Protocols
Embedded Linux with ARM

The Duration of the Training is:

60 Sessions of 2 hrs each (About 1.5 years).


(In 6 weeks training, I have covered the top three modules of the
training.)

LINUX
Linux is a Unix-like computer operating system assembled under the
model of free and open source software development and distribution. The
defining component of any Linux system is the Linux kernel, an operating
system kernel first released October 5, 1991 by Linus Torvalds. Linux
system distributions may vary in many details of system operation,
configuration, and software package selections.
Linux runs on a wide variety of computer hardware, including mobile
phones, tablet computers, network routers, televisions, video game
consoles, desktop computers, mainframes and supercomputers. Linux is a
leading server operating system, and runs the 10 fastest supercomputers in
the world. In addition, more than 90% of today's supercomputers run some
variant of Linux.
Most Linux distributions support dozens of programming languages. The
original development tools used for building both Linux applications and
operating system programs are found within the GNU toolchain, which
includes the GNU Compiler Collection (GCC) and the GNU build system.
Amongst others, GCC provides compilers for Ada, C, C++, Java, and
Fortran. The whole Linux kernel is written in C language.

C with DATA STRUCTURES


C is a general-purpose computer programming language developed
in 1972 by Dennis at the Bell Telephone Laboratories for use with the UNIX
operating system.
Although C was designed for implementing system software, it is also
widely used for developing portable application software. It is one of the
most popular programming languages and there are very few computer
architectures for which a C compiler does not exist. C has greatly
influenced many other popular programming languages, most notably
C++, which originally began as an extension to C.
Objective
This short course is designed to ensure that we, the students of Engineering
College with academic Capabilities will have the skill set needed to deal
with the challenges involved in real-world Programming using c,
Advanced C or System C, to meet the needs of industries both today and in
the future.
The course is taught mainly using the GCC compiler, with Linux operating
system.
In this course, following contents are taught:

Introduction and Programming Strategies


o Features of C language, Broad structure of C.
o Understanding C syntax, Data types, Escape sequences.
o Operators, C conventions, Error Handling.
o Some Programming Language Notes.
Structured Programming Strategies
o Decision Making and Looping
Decision Structures
Looping Structures.
Break and Continue statements.
o Functions
Function prototypes, function calling, function body, Arguments, by value
and by Reference, Steps Involved In invoking a function, Recursive
Functions, Types of functions, Functions Returning Pointers.

Arrays, Structures and Unions


Definition of Arrays, Comparison between arrays and pointers, Single
Dimension Array, Two Dimensional Arrays, Structures & Unions,
Memory layout, Bit fields in structure, functions and structures
o Pointers
Declaration of pointers, Rules valid for pointers, Pointer usage, Pointers,
addressing, referencing and dereferencing, Passing pointers to a function,
Strings with Pointers.
o String IO
Accessing individual characters, Printing strings with printf, Printing
strings with puts, Inputting strings with scanf, Inputting strings with gets,
String Library (strcpy(), strcat(), strcmp(), strchr(), strstr(), spintf(),
sscanf(), atoi()).
o Memory Allocation
Overview of memory management, Allocating new heap memory, _
Deallocating heap memory, Checking for successful memory allocation,
Memory errors, Using memory you dont own, Faulty heap management.
o Operation in C
Files, File naming, Opening a file, Writing and reading a file, Character
input and output, Direct file input and output operations, Closing and
flushing of files, Sequential and random files.
Data Structures
o Array and pointer:
Array creation, Array notation (pointer, direct etc), Review of pointer
fundamentals, Review of Pointer operations, Parameter passing as
pointers.
o Sorting and searching methods
Various sorting techniques, Bubble sort, Merge sort, Quick sort, various
search techniques: Sequential search, Binary search, Radix search.
o Stack and queue
Stack Fundamentals, Stack implementation, Queue Fundamentals, Queue
Implementation.
o Linked list Fundamentals
Link list basics, Elementary link list functions.
o Linked list Advanced
Reversing link list (different methods), by swapping, By recursion,
Doubly link list, Basics of doubly link list, Circular link list.

SHELL SCRIPTING
A shell script is a script written for the shell, or command line interpreter,
of an operating system. It is often considered a simple domain-specific
programming language. Typical operations performed by shell scripts
include file manipulation, program execution, and printing text.
Many shell script interpreters double as command line interface, such as
the various Unix shells, C Shell and bash shell etc.
In their most basic form, a shell script can provide a convenient variation of
a system command where special environment settings, command options,
or post processing is applied automatically, but in a way that allows the
new script to still act as a fully normal LINUX command.
Objective
This short course is designed to ensure that we, the students of Engineering
College with academic capabilities will have the skill set needed to deal
with the challenges involved in real-world Scripting to meet the needs of
industries both today and in the future.
Contents:

Introduction to shells and scripts:


o Shells, Usage, Types, entering and editing commands, Shell scripts, tools for
editing, writing scripts.
Running and Controlling Scripts:
o Referencing variables, loops and iterations, conditionals, if, test, case, examining
environment variables, customizing accounts, handling CLI, executing.
Shell Scripting Functions:
o Defining and Using Functions, arguments, return codes, variable scope, and
global, local recursion.
Debugging Shell Scripts:
o Deciphering Error Messages, Debugging Techniques and Running Scripts in
Debugging Mode.

LINUX INTERNALS
AND
SYSTEM PROGRAMMING
This is advanced/internals-based knowledge required for the true
understanding of the advanced topics and supporting a UNIX or Linux
system. It consists, how the internals of the operating system hangs
together - it is intended to assist with the administration of the operating
system itself and the theory can be applied to both the UNIX and the Linux
operating systems.
Linux is a freely distributed implementation of UNIX-like kernel, low-level
core of an operating system. All programs written for UNIX can be
compiled and run on Linux. Linux applications are represented by two
special types of files: executable and scripts.
Executable files are programs that can be run directly by the compiler; they
correspond to windows .exe files.
Scripts are collections of instructions for another program, an interpreter, to
follow. There correspond to Windows .bat or .cmd files, or interpreted
BASIC programs.
Linux does not require executables or scripts to have a specific filename or
any extension whatsoever. File system attributes, are used to indicate that a
file is a program that may be run.
In linux, we can replace scripts with compiled programs without affecting
other programs, is comes under the system programming in which user
prepares software for system or kernel of operating systems.
Objective
This short course is designed to ensure that we, the students of Engineering
College with academic Capabilities will have the skill set needed to deal
with the challenges involved in real-world Programming to meet the needs
of industries both today and in the future.
The course is taught mainly using the gcc compiler, with Linux operating
system.

Course Contents:

Introduction to Linux and Terminals


Development Tools in Linux
Process Management: Duplicating Processes, Replacing Processes.
Signals and Handlers
Inter-Process Communication: Pipes and FIFOs
Synchronization Techniques
Inter-Process Communication: Message Queues & Shared Memory
Communication Endpoints : Sockets
POSIX Threads

PROJECT
MULTIPLE DATA COMPRESSION
AND
ENCRYPTION
USING
ITERATIVE METHOD
Description :
It is a C program developed for COMPRESSION & ENCRYPTION of a
text file. Whole code is written in C language (GNU standard) using GCC
compiler in LINUX environment. It should required to work on Terminal
(Linux based Shell) for invoking this project.
Scope:
Scope of this project is in the field of communication where the
same information can be transmitted in less number of Bytes as
compared to original text. Since the information is also in the encrypted
format so no one can understand the actual information contained in
the text. So it has many application in the Military Forces where
information should be secured also in the transmission from one site to
another.

How to invoke :
For invoking this project we required the executable file of this
project only. NO need of whole C program.
I have named the compiled code as compress which is a
executable file.
You should run this file in terminal as:
$ ./compress <your file name>

It will compress and also encrypt your file. The new compressed file
named as
<your file name>.7zip
Now if we want to decompress this file on another location or site we
should required again only the executable code compress only. We
can decompress and de-encrypt our compressed file named as
<your file name>.7zip just by writing in terminal as:
$ ./compress <your file name>.7zip -d
(here we need to pass an argument -d for decompressing it.)

Mutliple compression:
By the use of multiple compression, we can compress our file to
many levels (limited). We can compress our pre-compressed file to
another level. The new file will get another .7zip extension. Means
number of times .7zip extension tells you the level of compression.
--> <your file name>.7zip.7zip
(contains two level of compression)
But you can compress under a certain limit because after a certain
limit the compressed file size can be more than the normal file size.
For example:
Open the terminal.
$ cd compress_project
$ ls

(nik is a text file to compress)

Compiled the code for generating executable file.

$ vi nik
(show the content of nik)

$ ./compress nik

(compress and encrypt the file)

$ vi nik.7zip

(file is compressed and in the encrypted format as shown)


$ ./compress nik.7zip

(Multiple compression)

Decompressing the file using an argument -d.

Showing the content of decompressed file (hemnew) as:


$ vi hemnew

(It is the new file generated contains the original information as in


the file nik ).

SOURCE CODE
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *compress_name;
/**************Function declarations**************/
void compress2(unsigned char*,int);
void compress3(unsigned char*,int);
void compress4(unsigned char*,int);
void compress5(unsigned char*,int);
void compress6(unsigned char*,int);
void compress7(unsigned char*,int);
void decompress2(unsigned char*,char*);
void decompress3(unsigned char*,char*);
void decompress4(unsigned char*,char*);
void decompress5(unsigned char*,char*);
void decompress6(unsigned char*,char*);
void decompress7(unsigned char*,char*);
/****************start of Main********************/
int main(int argc, char* argv[])
{
char *p,*m,*m1,*ar,*co,ch;
int i,j,l1,l,l2,k,flag,*as;
FILE *fd,*f,*fopen();
int SIZE;
SIZE=0;
if(argv[2]==NULL)
{
fd= fopen(argv[1],"r");
if(fd==NULL)
{
printf("error : No such file or directory.\n");
exit(EXIT_FAILURE);
}
while((ch=getc(fd))!=EOF)
{
SIZE++;
}
m=malloc(sizeof(char)*127); //master array
p=malloc(sizeof(char)*SIZE); //main string
ar=malloc(sizeof(char)*SIZE);
i=0;
fclose(fd);
fd=fopen(argv[1],"r");
while((ch=getc(fd))!=EOF)
{

*(p+i)=ch;
i++;
}
i--;
l=strlen(p);
compress_name=malloc(sizeof(char)*50);
compress_name=argv[1];
strcat(compress_name,".7zip");
/****************************Generating master array*****************/
for(i=0,j=0;i<l;i++)
{
flag=0;
for(k=0;k<j;k++)
{
if(*(p+i)==*(m+k))
{
flag=1;
break;
}
}
if(flag==0)
{
*(m+j)=*(p+i);
j++;
}
}
l1=strlen(m);
//length of master array
char lm;
lm=(char)l1;
f=fopen(compress_name,"w");
putc(lm,f);
for(i=0;i<l1;i++)
{
putc(*(m+i),f);
}
fclose(f);
/**************generating original array with ASCII values**************/
for(i=0;i<l;i++)
{
for(j=0;j<l1;j++)
{
if(*(m+j)==*(p+i))
*(ar+i)=j+1;
}
}
fclose(fd);

/****************************calling of function*******************/
if(l1>=2 && l1<=4)
compress2(ar,l-1);
if(l1>=5 && l1<=8)
compress3(ar,l-1);
if(l1>=9 && l1<=16)
compress4(ar,l-1);
if(l1>=17 && l1<=32)
compress5(ar,l-1);
if(l1>=33 && l1<=64)
compress6(ar,l-1);
if(l1>=65 && l1<=128)
compress7(ar,l-1);
if(l1>128)
printf("Hey you, file should be in ASCII characters\n");
printf("File compressed successfully with the extension of
.7zip...\n");
}
/**********************Reading of file for decompression**************/
else
{
FILE *fd1,*fopen();
char lm2;
fd1=fopen(argv[1],"r");
if(fd1==NULL)
{
printf("error : No such file or directory.\n");
exit(EXIT_FAILURE);
}
SIZE=0;
while((ch=getc(fd1))!=EOF)
{
SIZE++;
}
fclose(fd1);
co=malloc(sizeof(char)*SIZE);
m1=malloc(sizeof(char)*127);
i=0;
fd1=fopen(argv[1],"r");
lm2=getc(fd1);
for(i=0;i<lm2;i++)
{
ch=getc(fd1);
*(m1+i)=ch;
}
*(m1+i)='\0';
i=0;
while((ch=getc(fd1))!=EOF)

{
*(co+i)=ch;
i++;
}
i--;
fclose(fd1);
/**************************Decompression***********************/
if(lm2>=2 && lm2<=4)
decompress2(co,m1);
if(lm2>=5 && lm2<=8)
decompress3(co,m1);
if(lm2>=9 && lm2<=16)
decompress4(co,m1);
if(lm2>=17 && lm2<=32)
decompress5(co,m1);
if(lm2>=33 && lm2<=64)
decompress6(co,m1);
if(lm2>=65 && lm2<=128)
decompress7(co,m1);
if(lm2>128)
printf("Hey you, file should be in ASCII characters\n");
printf("File decompressed successfully.\n File name is :
hemnew\n");
}
return 0;
}
//end of main
/***********************compression functions***************************/
void compress2(unsigned char *temp,int len)
{
int i;
FILE *f,*fopen();
f = fopen(compress_name,"a");
for(i=0;i<len;i=i+4)
//performing compression
{
unsigned char a,b,c,d,e;
d=*(temp+i)<<6;
c=(*(temp+i+1)<<4)&(48);
b=(*(temp+i+2)<<2)&(12);
a=(*(temp+i+3))&(3);
e=a|b|c|d;
putc(e,f);
}
fclose(f);
}

//put e(ORed result) to f file

void compress3(unsigned char *temp,int len)


{
FILE *f,*fopen();
f=fopen(compress_name,"a");
int i;
unsigned char c;
for(i=0;i<len;i+=7)
{
c=((*(temp+i)<<5)&(224))|((*(temp+i+1)<<2)&(28))|((*(temp+i+2)
>>1)&(3));
putc(c,f);
c=((*(temp+i+2)<<7)&(128))|((*(temp+i+3)<<4)&(112))|((*(temp+i
+4)<<1)&(14))|((*(temp+i+5)>>2)&(1));
putc(c,f);
c=((*(temp+i+5)<<6)&(192))|((*(temp+i+6)<<3)&(56));
putc(c,f);
}
fclose(f);
}
void compress4(unsigned char *temp,int len)
{
int i;
unsigned char c;
FILE *f,*fopen();
f=fopen(compress_name,"a");
for(i=0;i<len;i+=2)
{
c=((*(temp+i)<<4)&(240))|(*(temp+i+1)&(15));
putc(c,f);
}
fclose(f);
}
void compress5(unsigned char *temp,int len)
{
int i;
unsigned char c;
FILE *f,*fopen();
f=fopen(compress_name,"a");
for(i=0;i<len;i=i+8)
{
c=(*(temp+i)<<3)|((*(temp+i+1)>>2)&7);
putc(c,f);
c=((*(temp+i+1)<<6))|((*(temp+i+2)<<1)&62)|((*(temp+i+3)>
>4)&1);
putc(c,f);
c=((*(temp+i+3)<<4))|((*(temp+i+4)>>1)&15);
putc(c,f);

c=((*(temp+i+4)<<7))|((*(temp+i+5)<<2)&124)|((*(temp+i+6)
>>3)&3);
putc(c,f);
c=((*(temp+i+6)<<5))|((*(temp+i+7)&31));
putc(c,f);
}
fclose(f);
}
void compress6(unsigned char *temp,int len)
{
int i;
unsigned char c,d,e;
FILE *f,*fopen();
f=fopen(compress_name,"a");
for (i=0;i<len;i+=4)
{
c= ((*(temp+i)<<2)&(252)|(*(temp+i+3))&(3));
putc(c,f);
d=((*(temp+i+1)<<2)&(252)|(*(temp+i+3)>>2)&(3));
putc(d,f);
e=((*(temp+i+2)<<2)&(252)|(*(temp+i+3)>>4)&(3));
putc(e,f);
}
fclose(f);
}
void compress7(unsigned char *temp,int len)
{
int i;
unsigned char c;
FILE *f,*fopen();
f=fopen(compress_name,"a");
for(i=0;i<len;i+=8)
{
c= ((*(temp+i)<<1)&(254)|(*(temp+i+7)>>6)&(1));
putc(c,f);
c= ((*(temp+i+1)<<1)&(254)|(*(temp+i+7)>>5)&(1));
putc(c,f);
c= ((*(temp+i+2)<<1)&(254)|(*(temp+i+7)>>4)&(1));
putc(c,f);
c= ((*(temp+i+3)<<1)&(254)|(*(temp+i+7)>>3)&(1));
putc(c,f);
c= ((*(temp+i+4)<<1)&(254)|(*(temp+i+7)>>2)&(1));
putc(c,f);
c= ((*(temp+i+5)<<1)&(254)|(*(temp+i+7)>>1)&(1));
putc(c,f);
c= ((*(temp+i+6)<<1)&(254)|(*(temp+i+7))&(1));
putc(c,f);

}
fclose(f);
}
/************************Decompression function**********************/
void decompress2(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);
l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");
for(i=0;i<l;i++)
{
ch=*(temp+i)>>6;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i)>>4)&(3);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i)>>2)&(3);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i)&(3);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}

fclose(f);
}
void decompress3(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);
l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");
for(i=0;i<l;i+=3)
{
ch=*(temp+i)>>5;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i)>>2)&(7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch= (*(temp+i)<<1)&(6)|(*(temp+i+1)>>7)&(1);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i+1)>>4)&(7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i+1)>>1)&(7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))

putc(*(m+j),f);
break;

}
}
ch=(*(temp+i+1)<<2)&(4)|(*(temp+i+2)>>6)&(3);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}

ch=(*(temp+i+2)>>3)&(7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch= *(temp+i+2)&(7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}
fclose(f);
}
void decompress4(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);
l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");
for(i=0;i<l;i++)
{
ch=(*(temp+i)>>4)&(15);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;

}
}
ch=*(temp+i)&(15);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}
fclose(f);
}
void decompress5(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);
l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");
for(i=0;i<l;i+=5)
{
ch=(*(temp+i)>>3);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=((*(temp+i)&7)<<2)|((*(temp+i+1)>>6));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i+1)>>1)&(31);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}

ch=(*(temp+i+1)<<4)&(16)|((*(temp+i+2)>>4));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=((*(temp+i+2)<<1)&(31))|(*(temp+i+3)>>7);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=((*(temp+i+3)>>2)&(31));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=((*(temp+i+3)<<3)&(31))|((*(temp+i+4)>>5));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=((*(temp+i+4)&(31)));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}
fclose(f);
}
void decompress6(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);

l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");
for(i=0;i<l;i+=3)
{
ch=*(temp+i)>>2;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch =*(temp+i+1)>>2;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i+2)>>2;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i)&(3))|(*(temp+i+1)<<2)&(12)|(*(temp+i+2)<<4)&(48);
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}
fclose(f);
}
void decompress7(unsigned char *temp,char *m)
{
int l,l1,i,j;
unsigned char ch;
l=strlen(temp);
l1=strlen(m);
FILE *f,*fopen();
f=fopen("hemnew","w");

for(i=0;i<l;i+=7)
{
ch=*(temp+i)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i+1)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch= *(temp+i+2)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i+3)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i+4)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=*(temp+i+5)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}

ch=*(temp+i+6)>>1;
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
ch=(*(temp+i)<<6)&(64)|(*(temp+i+1)<<5)&(32)|(*(temp+i+2)<<4)&(16)|(
*(temp+i+3)<<3)&(8)|(*(temp+i+4)<<2)&(4)|(*(temp+i+5)<<1)&(2)|(*(temp+i+6)
&(1));
for(j=0;j<l1;j++)
{
if(ch==(j+1))
{
putc(*(m+j),f);
break;
}
}
}
fclose(f);
}
//*****************End of decompressing functions***************//