コード例 #1
0
void naji_gen_unicode_html_pages(void)
{
int i = 0;
int unicode_max = 0xFFFF;  /* max is 65535 - 0xFFFF */
int unicode_min = 0;
int unicode_last = 60000;

int addby=1000;

int x = unicode_min;
int y = addby;

int n = 1;


    /* todo: arab2uni */

    while(1)
    {

    if (y > unicode_last) break;

    sprintf(fnamebuf, "ucode%02i.htm", n);
    najout(fnamebuf);


    naji_unicode_html_header(n);


    for (i=x; i<y; i++)
    fprintf(naji_output, "&#%i; %i<p>", i, i);

    naji_unicode_html_end();
    najoutclose();
    n++;
    
    x+=addby;

    y+=addby;
    }

    sprintf(fnamebuf, "ucode%02i.htm", n);
    najout(fnamebuf);

    naji_unicode_html_header(n);

    for (i=x; i<=unicode_max; i++)
    fprintf(naji_output, "&#%i; %i<p>", i, i);

    naji_unicode_html_end();
    najoutclose();

}
コード例 #2
0
void e2ahtml(char *namein, char *nameout)
{
int letter;

najin(namein);
najout(nameout);

        loop
        {
        letter = fgetc(naji_input);
        
        if (letter == EOF)
        endloop;

        letter = naji_e2a_unicode(letter);
        
        if (letter == '\n')
        fprintf(naji_output, "\n<br>");
        else
        fprintf(naji_output, "&#%i;", letter);
        }

najinclose();
najoutclose();
}
コード例 #3
0
void unblankc(char *namein, char *nameout, char ch1, char ch2)
{
int a;
int i=0;


najin(namein);
najout(nameout);


	while(1)
	{
	a = fgetc(naji_input);

	if (a == EOF)
	break;

	if (a == ch1)
	i++;

		if ((a == ch2) && (i != 0))
		{
		fputc((i-1), naji_output);
		i = 0;
		}

	}


najinclose();
najoutclose();
}
コード例 #4
0
ファイル: makemiss.c プロジェクト: cokyazici/ecere-docs
int main()
{
char temp[4096];
char buffer[4096];

char *p = NULL;
int i = 0;

najin("index.html");


	while (1)
	{
	
	
		if (feof(naji_input))
		break;

		najifgets(temp, 4095, naji_input);
	
		p = strstr(temp, "<a href=\"");

			
		if (p != NULL)
		{

		i  = 0;
		p += 9;
		
			while (1)
			{
				
				if ( (*p == '\0') || (*p == '\"') )
				{
				buffer[i] = '\0';
				printf("Making empty file: \"%s\"\n", buffer);
				najout(buffer);
				najoutclose();
				break;
				}

				buffer[i] = *p;
				i++;
				p++;
	
			}
		
		
		}
	
	}	


najinclose();
}
コード例 #5
0
void hmakerf(char *namein, char *nameout)
{
char buffer[402];

najin(namein);
najout(nameout);

    loop
    {

    fgets(buffer, 400, naji_input); 

    if (feof(naji_input))
    endloop;

    if (!strncmp("int", buffer, 3))       fprintf(naji_output, buffer);

    if (!strncmp("FILE", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("void", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("char", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("long", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("uint", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("UINT", buffer, 4))      fprintf(naji_output, buffer);
    if (!strncmp("auto", buffer, 4))      fprintf(naji_output, buffer);

    if (!strncmp("uchar", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("ulong", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("UCHAR", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("ULONG", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("short", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("float", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("class", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("union", buffer, 5))     fprintf(naji_output, buffer);
    if (!strncmp("const", buffer, 5))     fprintf(naji_output, buffer);

    if (!strncmp("double", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("struct", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("signed", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("static", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("extern", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("size_t", buffer, 6))    fprintf(naji_output, buffer);
    if (!strncmp("time_t", buffer, 6))    fprintf(naji_output, buffer);

    if (!strncmp("wchar_t", buffer, 7))   fprintf(naji_output, buffer);
    if (!strncmp("typedef", buffer, 7))   fprintf(naji_output, buffer);

    if (!strncmp("unsigned", buffer, 8))  fprintf(naji_output, buffer);
    if (!strncmp("register", buffer, 8))  fprintf(naji_output, buffer);
    if (!strncmp("volatile", buffer, 8))  fprintf(naji_output, buffer);
    if (!strncmp("#include", buffer, 8))  fprintf(naji_output, buffer);
    }

najinclose();
najoutclose();
}
コード例 #6
0
void strfile(char *nameout, unsigned long int howmany, char *string)
{
unsigned long int i=0;

najout(nameout);

 for (i=0; i<howmany; i++)
 fprintf(naji_output, "%s", string);

najoutclose();
}
コード例 #7
0
void charfile(char *nameout, unsigned long int size, int c)
{
unsigned long int i=0;

najout(nameout);

for (i=0; i<size; i++)
fputc(c, naji_output);

najoutclose();
}
コード例 #8
0
void rndtfile(char *nameout, unsigned long int size)
{
unsigned long int i=0;

najout(nameout);

rand_init();
for (i=0; i<size; i++)
fputc(((rand() % 95)+' '), naji_output);

najoutclose();
}
コード例 #9
0
void _8bit256(char *nameout, unsigned long rep)
{
int i;
int ii;

najout(nameout);

    for (ii=0; ii<=rep; ii++)
    for (i=0; i<=255; i++)
    fputc(i, naji_output);

najoutclose();
}
コード例 #10
0
void makarray(char *namein, char *nameout, char *namevar)
{
/* Don't worry, the memory taken up by variables in functions
 * are freed when the function ends, in case you didn't know.
 */
   char buffer[1050];

int i;

najin(namein);
najout(nameout);


 fprintf(naji_output, "char *%s[] = {\n", namevar);

   while(1)
   {
   fgets(buffer, 1024, naji_input);

   if (feof(naji_input))
   break;

           for (i=0; buffer[i] != 0; i++)
           {

                if (buffer[i] == '\n')
                {
                buffer[i] = '\0';
                break;
                }

                if (buffer[i] == '\r')
                {
                buffer[i] = '\0';
                break;
                }
           }

   fprintf(naji_output, "\"%s\",\n", buffer);
   }

   najinclose();
   najoutclose();

   najed(nameout);
   fseek(naji_edit, -2, SEEK_END);
   fprintf(naji_edit, "\n};\n");
   najedclose();

}
コード例 #11
0
void naji_genlic()
{
najout("LICENSE");
fprintf(naji_output, "\nTHIS PROGRAM IS NON-COPYRIGHTED PUBLIC DOMAIN AND DISTRIBUTED IN THE\n");
fprintf(naji_output, "HOPE THAT IT WILL BE USEFUL BUT THERE IS NO WARRANTY FOR THE PROGRAM,\n");
fprintf(naji_output, "THE PROGRAM IS PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER\n");
fprintf(naji_output, "EXPRESSED  OR  IMPLIED, INCLUDING, BUT  NOT  LIMITED TO, THE IMPLIED\n");
fprintf(naji_output, "WARRANTIES  OF  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n");
fprintf(naji_output, "THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM  IS\n");
fprintf(naji_output, "WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\n");
fprintf(naji_output, "ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n");
najoutclose();

unix2dos("LICENSE", "license.txt");
}
コード例 #12
0
void bin2c(char *namein, char *nameout, char *array_name)
{
int a;
int i=0;
int end=15;
int fsize_var=0;
int fsize_max=0;

najin(namein);
najout(nameout);

fsize_max = najinsize();
fsize_var = fsize_max;

fprintf(naji_output, "\n/*  converted with najitool with the command:  */\n");
fprintf(naji_output, "\n/*  najitool bin2c %s %s %s  */\n\n", namein, nameout, array_name);
fprintf(naji_output, "/*  please  keep  these  comments  here  so  others  can  use  */\n");
fprintf(naji_output, "/*  najitool the completely free tool for doing this as well.  */\n");
fprintf(naji_output, "/*  you can get najitool here: http://najitool.sf.net/         */\n\n");

    fprintf(naji_output,"unsigned char %s[%i] = \n{\n", array_name, fsize_max);

    loop
    {
    a = fgetc(naji_input);

    if (fsize_var == 1) endloop;

    if (i == end) { fprintf(naji_output, "\n"); i=0; }

    fprintf(naji_output, "0x%02X,", a);
    i++;
    
    fsize_var--;
    }

fprintf(naji_output, "\n0x%02X", a);
fprintf(naji_output, "};\n\n");

najinclose();
najoutclose();
}
コード例 #13
0
void leetfile(char *namein, char *nameout)
{
int a;

najin(namein);
najout(nameout);

     loop
     {
     a = fgetc(naji_input);

     if (a == EOF)
     endloop;

     elite_char_fprint((char)a, naji_output);
     }

najinclose();
najoutclose();
}
コード例 #14
0
void arab2eng(char *namein, char *nameout)
{
int letter;

najin(namein);
najout(nameout);

        loop
        {
        letter = fgetc(naji_input);
        
        if (letter == EOF)
        endloop;

        letter = naji_a2e(letter);
        fputc(letter, naji_output);
        }

najinclose();
najoutclose();
}
コード例 #15
0
void file2oct(char *namein, char *nameout)
{
    int a;

    najin(namein);
    najout(nameout);

    while (1)
    {
        a = fgetc(naji_input);

        if (a == EOF)
            break;

        fprintf(naji_output, "%o\n", a);
    }

    najinclose();
    najoutclose();

}
コード例 #16
0
void allfiles_genfile(char *filename, short file_contents[], unsigned long int filesize)
{
	unsigned long int i;
	char buffer[4096];


	/* NOTE: This will make the filenames start with a dot,
        	 because on Windows/DOS systems you can't use
	         CON, NUL, AUX, PRN, as filenames */

	sprintf(buffer, ".%s", filename);


	najout(buffer);
	
	for (i=0; i<filesize; i++)
	fputc(file_contents[i], naji_output);

	najoutclose();

	printf("Made file :%s:\n", buffer);

}
コード例 #17
0
void blankc(char *namein, char *nameout, char ch1, char ch2)
{
int a;
int i;

najin(namein);
najout(nameout);

	while(1)
	{
	a = fgetc(naji_input);

	if (a == EOF)
	break;

	for (i=0; i<=a; i++)
	fputc(ch1, naji_output);

	fputc(ch2, naji_output);
	}

najinclose();
najoutclose();
}
コード例 #18
0
void printftx(char *namein, char *nameout)
{
char buffer[1050];

int i;

najin(namein);
najout(nameout);



   while(1)
   {
   fgets(buffer, 1024, naji_input);

   if (feof(naji_input))
   break;

           for (i=0; buffer[i] != 0; i++)
           {

                if (buffer[i] == '\n')
                {
                buffer[i] = '\0';
                break;
                }

                if (buffer[i] == '\r')
                {
                buffer[i] = '\0';
                break;
                }
           }

   fprintf(naji_output, "printf(\"");



       for (i=0; buffer[i] != 0; i++)
       {

           if (buffer[i] == '\"')
           {
           fputc('\\', naji_output);
           fputc('\"', naji_output);
           }

           else if (buffer[i] == '\\')
           {
           fputc('\\', naji_output);
           fputc('\\', naji_output);
           }

       else
       fputc(buffer[i], naji_output);
       }

   fprintf(naji_output, "\\n\");\n");
   }


   najinclose();
   najoutclose();
}
コード例 #19
0
void mkpatch(char *original, char *patched, char *patchfile)
{
int a;
int b;

unsigned long offset = 0;
unsigned long bytes  = 0;

long insize = 0;
long in2size = 0;

najin(original);
najin2(patched);
najout(patchfile);

insize = najinsize();
in2size = najin2size();

if (insize != in2size)
{
fprintf(stderr, "Error, orginal file and patched file must be the same size for the patch to be made.\n");
return;
}


offset--;

    loop
    {
    
      a = fgetc(naji_input);
      b = fgetc(naji_input2);
    
      if (a == EOF)
      break;

      offset++;
    
      if (a != b)
      {
      fprintf(naji_output, "%lu\n", offset);
      fprintf(naji_output, "%lu\n", (unsigned long)b);
      bytes++;
      }

    }


printf("\n");
printf("Patch file %s successfully made which patches %lu bytes.\n", patchfile, bytes);
printf("\n");
printf("Feel free to bundle najitool with your patch file,\n");
printf("if you are releasing it or backing it up to CD or floppy etc.\n");
printf("\n");
printf("You might want to make a patch.bat or patch.sh file containing:\n");
printf("najitool qpatch %s %s\n", original, patchfile);
printf("\n");

najinclose();
najin2close();
najoutclose();
}
コード例 #20
0
void maxxnewl(char *namein, char *nameout, int maxnl)
{
int a;
int putnl;

putnl = 0;

najin(namein);
najout(nameout);


	while(1)
	{
	a = fgetc(naji_input);
	
	if (a == EOF)
	break;
	
		if (a == '\n')
		{
		fputc(a, naji_output);
			
			while (1)
			{
				
				a = fgetc(naji_input);

				if (a == EOF)
				break;
	
				else if (a == '\n')
				{
					
					if (putnl < maxnl)
					{
					fputc(a, naji_output);
					putnl++;
					}
				
				}
				else	
				{
				fputc(a, naji_output);
		 		putnl=0;
				break;
				}
			}	
	
		}
	
		else fputc(a, naji_output);
	
	
	}




najinclose();
najoutclose();
}