Current area: HOME ->

Zip File view

Ezasm for linux 1.0


This page allows you to view the contents of a file contained inside a ZIP archive available at Programmer's Heaven. This means you can view the code and find what you need from it without having to download the ZIP file first. If the file contains source code for a language we recognize, we have syntax highlighted it.

Filename displayed: ezasm\macro.cpp
Found in file: 40439.zip

Download: IM SDK Instant Messaging Software Development Kit v4.0 IM SDK Product Overview: Integrate Instant Messaging features into any application (user-to-user or application-to-application) including VOIP and Voice Video Chat in minutes.Communicate with the mai...
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
char name[10][10];
char deftab[10][10][30];       
int mac_line[10];   
int expanded[10];     
int beg=0;       
int mac=0;       
int def_count;       
int line;       
int m_c=0;
int sp=0;
char macro1[]=".macro";
extern FILE * f1,*f2,*f3;
extern int line_count;
extern int err_count;
char * get_line()
{
        static char c;
        int i=0;
        char l[30];
                while(!feof(f1))       
                {       
                        if(feof(f1)) break;
                        c=fgetc(f1);           
                        if(c=='\n')
                        {
                                l[i]='\0';
                                i=0;
                                //line_count++;
                                return l;
                        }
                        else l[i++]=c; 
                }
        beg=2;
}
int  split(char a[])
{
        int i=0,l,j=0,z=0;
        char t[20];
        char c[10][10];
        l=strlen(a);
        while(i<l)
        {
                if(isalpha(a[i]) || isdigit(a[i]))
                {
                        t[j++]=a[i++];
                }
                else if(a[i]==' ')
                {
                        t[j]='\0';
                        j=0;
                        while(a[i]==' ') i++;
                        strcpy(c[z++],t);
                }
                else i++;
        }
        t[j]='\0';
        strcpy(c[z++],t);
        if(z==2 && strcmp(c[1],"macro")==0) return 1;
        return 0;
}
void split_key(char a[])
{
        int i,j=0,z=0
        char t[30];
        char s[10][30];
        int error=0;
        int len=strlen(a);
        for(i=0;i<len;i++)
        {
                if(a[i]==' ')
                {                     
                        t[j]='\0';     
                        strcpy(s[z++],t);
                        j=0;
                }
                else if(isalpha(a[i])) t[j++]=a[i];
                else error=1;
        }
        t[j]='\0';
        strcpy(s[z++],t);
        if(error==1) printf("\nError\n");
        if(z==2)       
        {
        strcpy(name[def_count],s[0]);
        mac=1;
        }
        else printf("error");
}
void add_lineto_buffer(char l[])
{
        strcpy(deftab[def_count][line++],l);
}
void macro_parse()
{
        int i=0,len;
        char *a,c;
        char b[]="xxxxxxxxxxxxxxxxxxxxxxx";
        a=get_line();
        if(beg==2) return ;
        i=0;
        c=*(a+i);
        while(c!='\0')
        {
        b[i++]=c;
        c=*(a+i);
        }
        b[i]='\0';
        if(strcmp(b,macro1)==0)  beg=1;
        while(beg==1)
        {
                a=get_line();
                i=0;
                c=*(a+i);
                while(c!='\0')
                {
                b[i++]=c;
                c=*(a+i);
                }
                b[i]='\0';
                if(strcmp(b,"endm")==0 && m_c==1 && split(b)==0) {mac=0;mac_line[def_count++]=line;line=0;m_c--;sp=0;}
                else if(m_c==1 && split(b)==0) add_lineto_buffer(b);
                else if(strcmp(b,".endmacro")==0 && m_c==0) {beg=0;break;}
                else
                {
                        if(m_c==0)
                        {
                                if(split(b)==1)
                                split_key(b);
                                m_c++;sp=1;
                                mac=1;
       
                        }
                        else {printf("\nUnclosed Macro (%d)",line_count);err_count++;}
                }
        }
        if(beg==0 && mac==0 )
        {
        if(strcmp(b,".endmacro")!=0)
        fprintf(f2,"%s\n",b);
        macro_parse();
        }
}
void expand(char n[])
{
        f3=fopen(n,"a");
        char c,b[20],d[20];
        int i,j;
        beg=3;
        char *a=get_line();
        i=0;
        c=*(a+i);
        while(c!='\0')
        {
                b[i++]=c;
                c=*(a+i);
        }
        b[i]='\0';

        if(b[0]=='&')
        {
                i=0;
                while(b[i]!='\0')
                d[i++]=b[i+1];
                d[i]='\0';
                for(i=0;i<def_count;i++)
                {
                        if(strcmp(d,name[i])==0)
                        {
                        for(j=0;j<mac_line[i];j++)     
                                fprintf(f3,"%s\n",deftab[i][j]);
                        }       
                }
        }
        else if(beg!=2) fprintf(f3,"%s\n",b);
        fclose(f3);
        if(beg!=2)     
        expand(n);     
}


Network Icon Collection 1.0
316 Unique graphic Unit Eye catching colors Normal, Hot, Disabled states Give a unique look to your software, projects.. Designed for internet enabled applications, or any software that features ...
DS CrossFade - Enhance your wbe site with this cool effect v1.0
This applet displays a crossfade effect between as many images as you like. Over the animation you can also insert an image and a scroll-text. The applets is interactive and includes a HTML cod...
IM SDK Instant Messaging Software Development Kit v4.0
IM SDK Product Overview: Integrate Instant Messaging features into any application (user-to-user or application-to-application) including VOIP and Voice Video Chat in minutes.Communicate with the mai...
Download Network Icon Collection 1.0 316 Unique graphic Unit Eye catching colors Normal, Hot, Disabled states Give a unique look to your software, projects.. Designed for internet enabled applications, or any software that features ... Download DS CrossFade - Enhance your wbe site with this cool effect v1.0 This applet displays a crossfade effect between as many images  as you like. Over the animation you can also insert an image  and a scroll-text. The applets is interactive and includes a  HTML cod... Download IM SDK Instant Messaging Software Development Kit v4.0 IM SDK Product Overview: Integrate Instant Messaging features into any application (user-to-user or application-to-application) including VOIP and Voice Video Chat in minutes.Communicate with the mai...







Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Localize Delphi software in three simple steps
Localize Delphi VCL & .Net apps visually. Plus HTML, HTML Help, XML & databases. Try Sisulizer now!
Web based bug tracking - AdminiTrack.com
AdminiTrack offers an effective web-based bug tracking system designed for professional software development teams.


Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.