Añadimos todo el "util" :)

This commit is contained in:
Víctor Román Archidona 2003-01-22 07:50:04 +00:00
parent 82213e5389
commit ce6561c6a6
13 changed files with 1353 additions and 0 deletions

4
util/bin/clean.bat Normal file
View file

@ -0,0 +1,4 @@
@echo off
del *.exp
del *.lib
del *.pdb

160
util/src/bmp2fnt/b2f.c Normal file
View file

@ -0,0 +1,160 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _WIN32
#error Este archivo aun NO ha sido portado a otras plataformas.
#endif
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
#include <stdlib.h>
#include <SDL/SDL.h>
struct _fuente_control_s {
int offset_imagen ;
int size_imagen ;
int w , h , bytespp ;
SDL_Rect rect[256] ;
SDL_Surface *imagen ;
};
int main(int argc, char* argv[])
{
FILE *fp, *out;
char tras[3], none[3];
char *pool, *px;
struct _fuente_control_s fuente_control_s;
SDL_Surface *imagen ;
int i, x, y;
fpos_t pos;
out = fopen("stdout.txt", "w" );
imagen = SDL_LoadBMP("fuente.bmp");
SDL_LockSurface(imagen);
// Se calculan los rects
px = imagen->pixels ;
// Color de borde ( El primero k se encuentra
none[0] = *(px + 0);
none[1] = *(px + 1);
none[2] = *(px + 2);
// Colo trasparente ( Fila 1, Columna1, corresponde al caracter 0 )
tras[0] = *(px + imagen->pitch + 3 + 0);
tras[1] = *(px + imagen->pitch + 3 + 1);
tras[2] = *(px + imagen->pitch + 3 + 2);
i = 1;
x = 3;
y = 0;
for ( x = 3 ; x < imagen->w ; x++ )
{
for ( y = 0 ; y < imagen->h ; y++ )
{
if (*(px + imagen->pitch*y + x*3 + 0) != none[0] ||
*(px + imagen->pitch*y + x*3 + 1) != none[1] ||
*(px + imagen->pitch*y + x*3 + 2) != none[2] )
{
fuente_control_s.rect[i].x = x ;
fuente_control_s.rect[i].y = y ;
for ( ; y < imagen->h ; y++ )
{
if (*(px + imagen->pitch*y + x*3 + 0) == none[0] &&
*(px + imagen->pitch*y + x*3 + 1) == none[1] &&
*(px + imagen->pitch*y + x*3 + 2) == none[2] )
break ;
}
y--;
fuente_control_s.rect[i].h = y - fuente_control_s.rect[i].y + 1;
for ( ; x < imagen->w ; x++ )
{
if (*(px + imagen->pitch*y + x*3 + 0) == none[0] &&
*(px + imagen->pitch*y + x*3 + 1) == none[1] &&
*(px + imagen->pitch*y + x*3 + 2) == none[2] )
break ;
}
x--;
fuente_control_s.rect[i].w = x - fuente_control_s.rect[i].x + 1;
x++;
fprintf(out, "%i: %i,%i-%i,%i\n" ,
i ,
fuente_control_s.rect[i].x ,
fuente_control_s.rect[i].y ,
fuente_control_s.rect[i].w ,
fuente_control_s.rect[i].h );
i++;
break ;
}
}
if ( i > 255)
break ;
}
fp = fopen("fuente.fnt" , "w" );
fuente_control_s.offset_imagen = sizeof( fuente_control_s );
fuente_control_s.size_imagen = imagen->w * imagen->h * imagen->format->BytesPerPixel;
fuente_control_s.w = imagen->w ;
fuente_control_s.h = imagen->h ;
fuente_control_s.bytespp = imagen->format->BytesPerPixel;
printf("Sizeof control: %i\nOffset imagen: %i\nSizeof imagen: %i" ,
fuente_control_s.offset_imagen, fuente_control_s.offset_imagen ,
fuente_control_s.size_imagen );
getchar();
if(!(pool = malloc(fuente_control_s.size_imagen + 1) ) )
printf("ERROR: Memoria insuficiente\n");
for ( x = 0 ; x < imagen->w ; x++ )
for ( y = 0 ; y < imagen->h ; y++ )
for ( i = 0 ; i < imagen->format->BytesPerPixel ; i++ )
pool[ ( x + y * imagen->w ) * imagen->format->BytesPerPixel + i ] = *(px + ( y * imagen->pitch ) + ( x * imagen->format->BytesPerPixel ) + i );
SDL_UnlockSurface( imagen );
printf("\nescribe: %i" , fwrite( &fuente_control_s , 1 , sizeof(fuente_control_s) , fp ) );
pos = fuente_control_s.offset_imagen;
fsetpos(fp , &pos );
printf( "\n%i\n" , ftell( fp ) );
getchar();
fwrite( pool , 1 , fuente_control_s.size_imagen , fp );
free(pool);
exit (EXIT_SUCCESS);
}

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2fnt", "bmp2fnt.vcproj", "{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.ActiveCfg = Debug|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.Build.0 = Debug|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.ActiveCfg = Release|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="bmp2fnt"
ProjectGUID="{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdl.lib sdlmain.lib"
OutputFile="$(OutDir)/bmp2fnt.exe"
LinkIncremental="2"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/bmp2fnt.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="sdlmain.lib sdl.lib"
OutputFile="$(OutDir)/bmp2fnt.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\b2f.c">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

569
util/src/doku/doku.c Normal file
View file

@ -0,0 +1,569 @@
/*
* eDiv Compiler
* Copyleft (C) 2000-2002 Sion Entertainment
* http://www.sion-e.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
/*
* esta es la tabla donde se almacenan los nombres de las directivas y los textos
* por los que deben ser sustituidas, definidos en template.txt
*/
struct _sust {
char de[20];
char a[1024];
} sust[20];
/*
* esta funcion recibe un nombre de fichero (actual) y, consultando el index.dok,
* devuelve el documento anterior, el siguiente y el superior. Evidentemente esto
* se usa para generar los enlaces de navegacion.
*/
void situame(char* actual, char* ant, char* sig, char* sup);
/* esta funcion abre el fichero indicado en fixero1 y busca en el el texto
* encerrado entre las directivas <%title%> y <%/title%>, y lo devuelve en
* el puntero "titulo"
*/
void lee_titulo(char* fixero1, char* titulo);
/*
* esta es llamada cuando nos encontramos con la directiva <%index%>. Parsea
* el arbolito ese con los signos '+' y genera una unordered list mu potita.
*/
void procesa_indice();
/*
* esta es llamada cuando encontramos <%subindex%>. Se le indica el fichero
* actual y busca la entrada correspondiente en el index.dok. Entonces parsea
* la porcion de arbol que engloba y genera un subíndice como los de SGML.
*/
void procesa_subindice(char* actual);
FILE *f;
int i,tamano;
char* buffer;
int main(int argc, char* argv[])
{
int c,num=-1,j,sw;
char nomfich[256];
char tag[20];
int flag=0;
if(argc!=2) {
printf("Modo de uso: %s <fichero>\n",argv[0]);
exit(1);
}
for(i=0;i<strlen(argv[1]);i++)
if(argv[1][i]=='.') {
argv[1][i]=0;
break;
}
if((f=fopen("template.txt","r"))==NULL) {
printf("Error abriendo fichero template.txt\n");
exit(2);
}
fseek(f,0,SEEK_END);
tamano=ftell(f);
fseek(f,0,SEEK_SET);
if((buffer=(char*)malloc(tamano))==NULL) {
printf("Error: memoria insuficiente\n");
exit(3);
}
fread(buffer,1,tamano,f);
fclose(f);
for(i=0;i<tamano;i++) {
if(buffer[i]=='<' && buffer[i+1]=='%') {
if(num!=-1) sust[num].a[c]=0;
num++; i+=2; c=0;
while(buffer[i]==' ') i++;
while(buffer[i]!=' ' && buffer[i]!='%')
sust[num].de[c++]=buffer[i++];
sust[num].de[c]=0;
while(buffer[i]==' ') i++;
if(buffer[i]=='%' && buffer[i+1]=='>') i+=2;
c=0;
if(!strcmp(sust[num].de,"index") || !strcmp(sust[num].de,"/index") ||
!strcmp(sust[num].de,"subindex")) {
printf("Error en template.txt: \"%s\" es una directiva reservada\n",sust[num].de);
exit(10);
}
}
if(buffer[i]=='"') {
i++;
while(1) {
if(buffer[i]=='"' && buffer[i-1]!='\\') break;
if(buffer[i]=='\\' && buffer[i+1]=='n')
buffer[++i]='\n';
else if(buffer[i]=='\\' && buffer[i+1]=='"')
buffer[++i]='"';
sust[num].a[c++]=buffer[i++];
}
}
}
free(buffer);
strcpy(nomfich,argv[1]);
strcat(nomfich,".dok");
if((f=fopen(nomfich,"r"))==NULL) {
printf("Error abriendo fichero %s\n",nomfich);
exit(4);
}
fseek(f,0,SEEK_END);
tamano=ftell(f);
fseek(f,0,SEEK_SET);
if((buffer=(char*)malloc(tamano+1))==NULL) {
printf("Error: memoria insuficiente\n");
exit(5);
}
tamano=fread(buffer,1,tamano,f);
fclose(f);
buffer[tamano]=0;
strcpy(nomfich,argv[1]);
strcat(nomfich,".html");
if((f=fopen(nomfich,"w"))==NULL) {
printf("Error creando fichero %s\n",nomfich);
exit(7);
}
printf("Procesando...\n");
fprintf(f,"<!-- Generado con Sion Doku - http://www.sionhq.com -->\n");
for(i=0;i<tamano;i++) {
if(buffer[i]=='<' && buffer[i+1]=='%') {
buffer[i]=0;
fwrite(&buffer[flag],1,strlen(&buffer[flag]),f);
c=0; i+=2;
while(buffer[i]==' ') i++;
while(buffer[i]!=' ' && buffer[i]!='%')
tag[c++]=buffer[i++];
tag[c]=0;
while(buffer[i]==' ') i++;
if(buffer[i]=='%' && buffer[i+1]=='>') i+=2;
else {
fclose(f);
printf("Error en tag %s, byte %d\n",tag,i);
exit(8);
}
flag=i;
sw=0;
for(j=0;j<=num;j++)
if(!strcmp(sust[j].de,tag)) {
sw=1;
fwrite(sust[j].a,1,strlen(sust[j].a),f);
break;
}
if(!sw) {
if(!strcmp(tag,"index")) {
procesa_indice();
flag=i;
}
else if(!strcmp(tag,"subindex")) {
procesa_subindice(argv[1]);
}
else {
fclose(f);
printf("Error: tag no reconocido %s en byte %d\n",tag,i);
exit(9);
}
}
if(!strcmp(tag,"/title") && strcmp(argv[1],"index")) {
char ant[256], sig[256], sup[256];
char tant[512], tsig[512], tsup[512], tidx[512];
situame(argv[1],ant,sig,sup);
lee_titulo(ant,tant);
lee_titulo(sig,tsig);
lee_titulo(sup,tsup);
lee_titulo("index",tidx);
fprintf(f,"<table border=\"0\" width=\"100%%\">\n<tr><td align=\"left\" width=\"25%%\">");
if(*ant!=0) fprintf(f,"<a href=\"%s.html\">Anterior</a><br>%s",ant,tant);
else fprintf(f,"Anterior<br>&nbsp;");
fprintf(f,"</td>\n<td align=\"center\" width=\"25%%\">");
if(*sup!=0) fprintf(f,"<a href=\"%s.html\">Subir</a><br>%s",sup,tsup);
else fprintf(f,"<a href=\"index.html\">Subir</a><br>%s",tidx);
fprintf(f,"</td>\n<td align=\"center\" width=\"25%%\"><a href=\"index.html\">Contenido</a>"
"<br>%s</td>\n<td align=\"right\" width=\"25%%\">",tidx);
if(*sig!=0) fprintf(f,"<a href=\"%s.html\">Siguiente</a><br>%s",sig,tsig);
else fprintf(f,"Siguiente<br>&nbsp;");
fprintf(f,"</td></tr>\n</table><hr>\n");
}
}
}
fwrite(&buffer[flag],1,strlen(&buffer[flag]),f);
fclose(f);
printf("Guardado %s\n",nomfich);
return 0;
}
void situame(char* actual, char* ant, char* sig, char* sup)
{
FILE* fi;
char* buf,tag[20],fixero[256];
int tam,p,c;
int nivel=0,ni;
char anterior[256],superior[20][256];
const char fin[]="<%/index%>";
int j,sw=0,pillasig=0;
*ant=0; *sig=0; *sup=0;
if((fi=fopen("index.dok","r"))==NULL) {
printf("Error: no puedo abrir index.dok\n");
exit(13);
}
fseek(fi,0,SEEK_END);
tam=ftell(fi);
fseek(fi,0,SEEK_SET);
if((buf=(char*)malloc(tam+1))==NULL) {
printf("Error: memoria insuficiente\n");
exit(14);
}
tam=fread(buf,1,tam,fi);
fclose(fi);
buf[tam]=0;
for(p=0;p<tam;p++) {
if(buf[p]=='<' && buf[p+1]=='%') {
c=0; p+=2;
while(buf[p]==' ') p++;
while(buf[p]!=' ' && buf[p]!='%')
tag[c++]=buf[p++];
tag[c]=0;
while(buf[p]==' ') p++;
if(buf[p]=='%' && buf[p+1]=='>') p+=2;
else {
printf("Error en fichero index.dok, tag %s, byte %d\n",tag,p);
exit(15);
}
if(!strcmp(tag,"index")) {
sw=1;
break;
}
}
}
if(!sw) {
printf("Error: no se encuentra directiva <%index%> en index.dok\n");
exit(16);
}
memset(fixero,0,256);
memset(anterior,0,256);
memset(superior,0,256*20);
for(;p<tam;p++) {
while(buf[p]=='<')
while(buf[p-1]!='>' && p<tam) p++;
while(buf[p]<33) p++;
ni=0;
for(j=0;j<10;j++)
if(buf[p+j]!=fin[j]) break;
if(j==10) {
break;
}
if(buf[p]==';') {
while(buf[p]>31 && p<tam) p++;
continue;
}
while(buf[p]=='+') { ni++; p++; }
if(ni>nivel) {
if(ni==20) {
printf("Error: el indice no puede tener mas de 20 niveles\n");
exit(17);
}
if(!pillasig) { nivel=ni; strcpy(superior[nivel],fixero); }
}
if(ni<nivel) {
if(!pillasig) nivel=ni;
}
c=0;
while(buf[p]>31 && buf[p]!='<')
fixero[c++]=buf[p++];
fixero[c]=0;
if(buf[p]=='<') p--;
if(pillasig) {
strcpy(ant,anterior);
strcpy(sig,fixero);
strcpy(sup,superior[nivel]);
fclose(fi);
free(buf);
return;
}
if(!strcmp(actual,fixero)) pillasig=1;
else strcpy(anterior,fixero);
}
if(pillasig) {
strcpy(ant,anterior);
strcpy(sup,superior[nivel]);
fclose(fi);
free(buf);
return;
}
printf("Error: el documento no esta listado en el indice\n");
exit(18);
}
void lee_titulo(char* fixero1, char* titulo)
{
FILE* fi;
char* buf,tag[20],fixero[256];
int tam,p,c;
strcpy(fixero,fixero1);
strcat(fixero,".dok");
if((fi=fopen(fixero,"rb"))==NULL) {
sprintf(titulo,"[Error al abrir \"%s\"]",fixero);
return;
}
fseek(fi,0,SEEK_END);
tam=ftell(fi);
fseek(fi,0,SEEK_SET);
if((buf=(char*)malloc(tam+1))==NULL) {
printf("Error: memoria insuficiente\n");
exit(11);
}
tam=fread(buf,1,tam,fi);
fclose(fi);
buf[tam]=0;
for(p=0;p<tam;p++) {
if(buf[p]=='<' && buf[p+1]=='%') {
c=0; p+=2;
while(buf[p]==' ') p++;
while(buf[p]!=' ' && buf[p]!='%')
tag[c++]=buf[p++];
tag[c]=0;
while(buf[p]==' ') p++;
if(buf[p]=='%' && buf[p+1]=='>') p+=2;
else {
printf("Error en fichero %s, tag %s, byte %d\n",fixero,tag,p);
exit(13);
}
if(!strcmp(tag,"title")) {
c=0;
while(p<tam) {
if(buf[p]=='<' && buf[p+1]=='%') break;
titulo[c++]=buf[p++];
}
titulo[c]=0;
free(buf);
return;
}
}
}
}
void procesa_indice()
{
int nivel=0,c,ni;
char fixero[256];
char titulo[512];
const char fin[]="<%/index%>";
int j;
fprintf(f,"\n");
for(;i<tamano;i++) {
while(buffer[i]=='<' && buffer[i+1]!='%')
while(buffer[i-1]!='>' && i<tamano) i++;
while(buffer[i]<33) i++;
ni=0;
for(j=0;j<10;j++)
if(buffer[i+j]!=fin[j]) break;
if(j==10) {
for(j=0;j<nivel;j++)
fprintf(f,"</ul>");
fprintf(f,"\n");
i+=10;
return;
}
if(buffer[i]==';') {
while(buffer[i]>31 && i<tamano) i++;
continue;
}
while(buffer[i]=='+') { ni++; i++; }
if(ni>nivel) {
if(ni==20) {
printf("Error: el indice no puede tener mas de 20 niveles\n");
exit(25);
}
for(j=nivel;j<ni;j++)
fprintf(f,"<ul>");
fprintf(f,"\n");
nivel=ni;
}
if(ni<nivel) {
for(j=ni;j<nivel;j++)
fprintf(f,"</ul>");
fprintf(f,"\n");
nivel=ni;
}
c=0;
while(buffer[i]>31 && buffer[i]!='<')
fixero[c++]=buffer[i++];
fixero[c]=0;
if(buffer[i]=='<') i--;
lee_titulo(fixero,titulo);
if(nivel==0)
fprintf(f,"<p class=\"indexheader\"><a href=\"%s.html\">%s</a></p>\n",fixero,titulo);
else
fprintf(f,"<li><a href=\"%s.html\">%s</a></li>\n",fixero,titulo);
}
}
void procesa_subindice(char* actual)
{
FILE* fi;
char* buf,tag[20],fixero[256],titulo[512];
int tam,p,c;
int nivel=0,ni,iniv;
const char fin[]="<%/index%>";
int j,sw=0,pilla=0;
if((fi=fopen("index.dok","r"))==NULL) {
printf("Error: no puedo abrir index.dok\n");
exit(19);
}
fseek(fi,0,SEEK_END);
tam=ftell(fi);
fseek(fi,0,SEEK_SET);
if((buf=(char*)malloc(tam+1))==NULL) {
printf("Error: memoria insuficiente\n");
exit(20);
}
tam=fread(buf,1,tam,fi);
fclose(fi);
buf[tam]=0;
for(p=0;p<tam;p++) {
if(buf[p]=='<' && buf[p+1]=='%') {
c=0; p+=2;
while(buf[p]==' ') p++;
while(buf[p]!=' ' && buf[p]!='%')
tag[c++]=buf[p++];
tag[c]=0;
while(buf[p]==' ') p++;
if(buf[p]=='%' && buf[p+1]=='>') p+=2;
else {
printf("Error en fichero index.dok, tag %s, byte %d\n",tag,p);
exit(21);
}
if(!strcmp(tag,"index")) {
sw=1;
break;
}
}
}
if(!sw) {
printf("Error: no se encuentra directiva <%index%> en index.dok\n");
exit(22);
}
for(;p<tam;p++) {
while(buf[p]=='<')
while(buf[p-1]!='>' && p<tam) p++;
while(buf[p]<33) p++;
ni=0;
for(j=0;j<10;j++)
if(buf[p+j]!=fin[j]) break;
if(j==10) {
break;
}
if(buf[p]==';') {
while(buf[p]>31 && p<tam) p++;
continue;
}
while(buf[p]=='+') { ni++; p++; }
if(ni>nivel) {
if(ni==20) {
printf("Error: el indice no puede tener mas de 20 niveles\n");
exit(23);
}
if(pilla && ni==iniv+1) {
fprintf(f,"<ul>");
fprintf(f,"\n");
}
nivel=ni;
}
if(ni<nivel) {
nivel=ni;
if(pilla && nivel<=iniv)
break;
}
c=0;
while(buf[p]>31 && buf[p]!='<')
fixero[c++]=buf[p++];
fixero[c]=0;
if(buf[p]=='<') p--;
if(!strcmp(actual,fixero)) {
pilla=1;
fprintf(f,"<ul>");
iniv=nivel;
}
if(pilla && nivel<=iniv+1) {
lee_titulo(fixero,titulo);
fprintf(f,"<li><a href=\"%s.html\">%s</a></li>\n",fixero,titulo);
}
}
if(pilla) {
fprintf(f,"</ul>");
fprintf(f,"</ul>");
fprintf(f,"\n");
return;
}
printf("Error: el documento no esta listado en el indice\n");
exit(24);
}

View file

@ -0,0 +1,11 @@
<%title%> "<html>\n<head>\n<title>eDIV docs - "
<%/title%> "</title>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">"
"<link rel=\"stylesheet\" href=\"ediv-docs.css\" type=\"text/css\">\n</head>\n\n"
"<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0033FF\" vlink=\"#3333CC\">"
<%end%> "<p><font size=\"-2\">Esta documentaci&oacute;n ha sido escrita por el equipo de\n"
"Sion Entertainment y forma parte del proyecto eDIV. Las actualizaciones de esta\n"
"documentaci&oacute;n pueden obtenerse en <a href=\"http://www.edivcentral.com\" "
"target=\"_blank\">www.edivcentral.com</a>.\nSi ve alg&uacute;n error o anomal&iacute;a "
"en cualquiera de los documentos que\nse incluyen en este proyecto, por favor "
"comun&iacute;quenoslo a <a href=\"mailto:bugs@edivcentral.com\">bugs@edivcentral.com</a>.\n"
"Gracias.<br>\n&copy; Copyleft Sion Entertainment, 2001</font></p>\n</body>\n</html>\n"

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "doku.vcproj", "{729B5997-F7D8-446A-AE12-6E4E801B323D}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.ActiveCfg = Debug|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.Build.0 = Debug|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.ActiveCfg = Release|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,112 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="doku"
ProjectGUID="{729B5997-F7D8-446A-AE12-6E4E801B323D}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/doku.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/doku.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/doku.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\doku.c">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View file

@ -0,0 +1,144 @@
/* IconChanger
* Pequeña utilidad-complemento para eDIV que permite sustituir el icono del stub de
* win32 por otro. El icono nuevo debe ser exactamente igual que el original del stub,
* es decir, tiene que cumplir las siguientes condiciones:
* - Contener 6 imágenes en total:
* + 16x16 a 4, 8 y 24 bits de color
* + 32x32 a 4, 8 y 24 bits de color
* - "Pesar" exactamente 8.854 bytes.
* Este programa es muy simple así que no se molesta en comprobar el formato del fichero,
* únicamente comprueba su tamaño. Si metes un icono que no es adecuado.. allá ..
* Puede ser útil en el futuro currarnos un programa decente que soporte cualquier tipo
* de iconos, que cambiara el tamaño del exe, etc etc, ya sería la reostia, pero por
* ahora con esto nos sobra.
* Pekeño inconveniente: sólo se puede cambiar el icono 1 vez :p Si se kiere cambiar el
* icono por segunda vez, hay que recompilar el programa. En realidad no importa, ya que
* en verdad es lo que pasa en todos los compiladores...
* Si se kiere cambiar el icono y un virus te ha comido el ediv.exe o el .prg, pos tiras
* de Resource Hacker y a kaxkarla...
*
* Er_Makina
*/
#ifndef _WIN32
#error IconChanger es sólamente para Win32
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "iconchanger.h"
#define ICO_SIZE 8854 // Tamaño que debe tener el .ico
#define ICO_START 0x66 // Offset donde se empieza a leer el .ico
#define ICO_LEN 0x2230 // Tamaño del bloque a copiar del .ico al .exe
void* e_malloc(size_t size)
{
void* ret;
if(!(ret = malloc(size))) {
printf("ERROR: Memoria insuficiente.\n\n");
exit(1);
}
return ret;
}
int main(int argc, char* argv[])
{
FILE* f;
unsigned char *exe,*ico;
int tamanyo;
int i,j;
int ok=0;
printf("eDIV IconChanger - Copyright (c) Sion Ltd. 2002\n\n");
if(argc!=3) {
printf("Modo de uso:\n\n %s <programa.exe> <icono.ico>\n\n",argv[0]);
exit(2);
}
if((f=fopen(argv[2],"rb"))==NULL) {
printf("ERROR: No puedo abrir %s\n\n",argv[2]);
exit(3);
}
fseek(f,0,SEEK_END);
tamanyo=ftell(f);
if(tamanyo!=ICO_SIZE) {
fclose(f);
printf("ERROR: El icono no es del formato válido\n\n");
printf("Te refrescaré la memoria:\nEl icono (.ico) DEBE contener 6 imágenes en total, a saber:\n");
printf(" - 3 imágenes de 16x16 (a 4, 8 y 24 bits de color).\n");
printf(" - 3 imágenes de 32x32 (a 4, 8 y 24 bits de color).\n");
printf("No puede faltar ninguna, ya que el archivo debe ocupar EXACTAMENTE %d bytes.\n\n",ICO_SIZE);
exit(4);
}
ico=(unsigned char*)e_malloc(tamanyo);
fseek(f,0,SEEK_SET);
fread(ico,tamanyo,1,f);
fclose(f);
if((f=fopen(argv[1],"rb"))==NULL) {
printf("ERROR: No puedo abrir %s\n\n",argv[1]);
exit(5);
}
fseek(f,0,SEEK_END);
tamanyo=ftell(f);
fseek(f,0,SEEK_SET);
exe=(unsigned char*)e_malloc(tamanyo); /* no creo ke pase nada por unos 125 kb...
eso si, cuando se puedan meter el PAK y
las DLL's en el exe, va a haber ke cambiar
esto... */
fread(exe,tamanyo,1,f);
fclose(f);
// BUSKEDA
printf("Buscando sitio donde meter mano en el exe...\n");
for(i=20;i<tamanyo-sizeof(image);i++) {
if(exe[i]==image[0]) {
ok=1;
for(j=1;j<sizeof(image);j++) {
if(exe[i+j]!=image[j]) {
ok=0;
break;
}
}
if(ok) break;
}
}
if(!ok) {
free(ico);
free(exe);
printf("ERROR: El ejecutable no parece haber sido compilado con eDIV, o bien ya se le ha cambiado el icono.\n\n");
exit(6);
}
// "parcheamos" el exe en memoria
memcpy(&exe[i],&ico[ICO_START],ICO_LEN);
free(ico);
// y escribimos el exe enterito al disco duro.. lo mio si es optimizar eh? xDD
if((f=fopen(argv[1],"wb"))==NULL) {
free(exe);
printf("ERROR: No tengo acceso de escritura a %s\n\n",argv[1]);
exit(7);
}
fwrite(exe,tamanyo,1,f);
fclose(f);
free(exe);
printf("Completado :)\n\n");
return 0;
}

View file

@ -0,0 +1,23 @@
/*
* Esto contiene la imagen del icono por defecto del stub en su versión
* 16x16x16 (obtenida con Resource Hacker y gif2h), la cual se busca en el
* stub para saber dónde hay que escribir el nuevo icono.
*/
static unsigned char image[]={
40,0,0,0,16,0,0,0,32,0,0,0,1,0,4,0,0,0,0,0,
192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,128,0,0,128,0,0,0,128,128,0,128,0,0,0,
128,0,128,0,128,128,0,0,192,192,192,0,128,128,128,0,0,0,255,0,
0,255,0,0,0,255,255,0,255,0,0,0,255,0,255,0,255,255,0,0,
255,255,255,0,0,0,0,0,0,0,0,0,15,127,127,127,127,127,127,120,
7,247,247,0,0,247,247,248,15,127,112,243,243,15,127,120,7,247,15,48,
15,48,247,248,15,112,243,243,240,0,127,120,7,240,63,0,63,48,247,248,
15,112,243,240,3,240,127,120,7,240,63,63,63,48,247,248,15,127,3,243,
243,0,127,120,7,247,240,0,0,247,247,248,15,127,127,127,127,127,127,120,
7,247,247,247,247,247,247,248,15,153,251,191,170,255,255,248,15,153,251,191,
170,255,255,248,7,119,119,119,119,119,119,120,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

View file

@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iconchanger", "iconchanger.vcproj", "{97770962-E34D-47AB-AD97-F1BECDD66601}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.ActiveCfg = Debug|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.Build.0 = Debug|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.ActiveCfg = Release|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="iconchanger"
ProjectGUID="{97770962-E34D-47AB-AD97-F1BECDD66601}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/iconchanger.exe"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/iconchanger.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="../../../bin"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
OmitFramePointers="TRUE"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/iconchanger.exe"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
RelativePath="..\iconchanger.c">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc">
<File
RelativePath="..\iconchanger.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

33
util/src/win32/util.sln Normal file
View file

@ -0,0 +1,33 @@
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bmp2fnt", "..\bmp2fnt\win32\bmp2fnt.vcproj", "{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doku", "..\doku\win32\doku.vcproj", "{729B5997-F7D8-446A-AE12-6E4E801B323D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iconchanger", "..\iconchanger\win32\iconchanger.vcproj", "{97770962-E34D-47AB-AD97-F1BECDD66601}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.ActiveCfg = Debug|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Debug.Build.0 = Debug|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.ActiveCfg = Release|Win32
{CDA8C3EC-7C1F-4427-B7B2-DDAE02F18D52}.Release.Build.0 = Release|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.ActiveCfg = Debug|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Debug.Build.0 = Debug|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.ActiveCfg = Release|Win32
{729B5997-F7D8-446A-AE12-6E4E801B323D}.Release.Build.0 = Release|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.ActiveCfg = Debug|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Debug.Build.0 = Debug|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.ActiveCfg = Release|Win32
{97770962-E34D-47AB-AD97-F1BECDD66601}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal