First commit 14/12/1995
This commit is contained in:
commit
819318450c
1546
MAKE_BO2.CPP
Normal file
1546
MAKE_BO2.CPP
Normal file
File diff suppressed because it is too large
Load Diff
1643
MAKE_BOT.CPP
Normal file
1643
MAKE_BOT.CPP
Normal file
File diff suppressed because it is too large
Load Diff
163
MAKE_BOT.H
Normal file
163
MAKE_BOT.H
Normal file
@ -0,0 +1,163 @@
|
||||
// ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
// Û Errores devueltos por las Funciones Û
|
||||
// ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
|
||||
|
||||
#define OK 1
|
||||
#define SIN_MEMORIA 5
|
||||
#define ERROR_ABRIENDO 6
|
||||
#define ERROR_CERRANDO 7
|
||||
|
||||
#define ON 1
|
||||
#define OFF 0
|
||||
|
||||
#define EOL 10 // Fin de linea
|
||||
|
||||
#define MB_TeclaPulsada() ( *(unsigned *) MK_FP(0x40,0x1A) != *(unsigned *) MK_FP(0x40,0x1C) )
|
||||
// ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
// Û Funciones propias de MAKE_BOTON Û
|
||||
// ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Carga los botones del fichero *f_datos, devolviendo los ±
|
||||
// ± errores indicados en #define xxxxx X ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
int carga_botones(char *f_datos);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Despliega los datos que fueron cargados. ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
void despliega_datos(void);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Imprime los botones estaticos de la secuencia Sec_st, en el ±
|
||||
// ± fichero file. ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
int Imprime_Estaticos(int Sec_st, char *file);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Imprime los botones din micos de la secuencia Sec_num. ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
void Imprime_Secuencia(int Sec_num);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± ±
|
||||
// ± Imprime un borde completo de color Color sobre el boton Boton, ±
|
||||
// ± de la secuencia n£mero Sec_num. ±
|
||||
// ± ±
|
||||
// ± NOTA: ±
|
||||
// ± Si color es negativo se imprimiran los bordes normales. ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
void Imprime_Bordes(int Sec_num, int Boton, int Color);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Comprueba la pulsaci¢n de los botones de la secuencia Sec_num ±
|
||||
// ± ±
|
||||
// ± Devuelve el n£mero de boton pulsado, 0 si no se pulso ninguno ±
|
||||
// ± y deja en el buffer las teclas pulsadas si no corresponden con ±
|
||||
// ± con las teclas asignadas a los botones. ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
int Comprueba_Secuencia(int Sec_num, int (far *UserPointer)(void) );
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± Libera la memoria que ha sido asignada por Make_Boton. ±
|
||||
// ± ±
|
||||
// ± NOTA: ±
|
||||
// ± DESPUES DE LIBERAR TODA LA MEMORIA DE M_B, NO SE DEBE ±
|
||||
// ± UTILIZAR NINGUNA FUNCION SIN RECARGAR PRIMERO LOS BOTONES DE ±
|
||||
// ± DE UN ARCHIVO CON ESTOS... ±
|
||||
// ± ±
|
||||
// ± FUNCION EXTRAIDA PARA USO COMUN, ESPECIALMENTE POR CD_out ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
void Libera_Memoria(void);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± ±
|
||||
// ± Si True_Push se pone a ON, cuando se pulse un boton se hundira ±
|
||||
// ± realmente, pero solo si hay suficiente memoria. ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
extern char True_Push;
|
||||
|
||||
// ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
// Û Funciones para el control de la Pantalla Û
|
||||
// ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± ±
|
||||
// ± Sirve para averiguar el tama¤o necesitado por GetImage para ±
|
||||
// ± obtener una imagen 256c, para los BGI no compatibles KERNEL. ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
unsigned long JD_imagesize(int left, int top, int right, int bottom);
|
||||
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
// ± ±
|
||||
// ± Igual a InitGraph, pero realiza un mayor numero de comproba_ ±
|
||||
// ± ciones, saliendo si ocurre algun error y mostrandolo... ±
|
||||
// ± ±
|
||||
// ±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
|
||||
void Initialize(int GraphDriver, int GraphMode); // Inicializa el Modo Gr fico
|
||||
|
||||
// ÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜÜ
|
||||
// Û Funciones para el control del Raton Û
|
||||
// ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Muestra el cursor del Raton. - No sirve con el raton animado °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
void activa_raton(void);
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Desactiva el cursor del Raton. No sirve con el raton animado °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
void desactiva_raton(void);
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Regresa con una pulsaci¢n de tecla o la posici¢n en la cual °
|
||||
// ° se pulso el raton. °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
int Espera_Tecla_o_Raton(void); // <->
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Sostiene el raton hasta que se suelte el boton presionado... °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
void Anclar_Raton(void);
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Libera la memoria asignada al Raton Animado. °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
void Libera_Raton_Animado(void);
|
||||
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
// ° °
|
||||
// ° Inicializa el Raton en el modo Gr fico... °
|
||||
// ° °
|
||||
// ° x1, y1, x2, y2. Son los topes del RATON °
|
||||
// ° °
|
||||
// ° °
|
||||
// ° °
|
||||
// °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
|
||||
void inicializa_raton_grafico(int x1, int y1, // Inicializa el Raton
|
||||
int x2, int y2); // devolviendo raton = 1
|
||||
|
||||
|
||||
|
||||
extern char Push;
|
||||
extern char raton; // Indica si hay un Raton = 1
|
||||
extern char PunteroRaton; // ¨ Se modifica el puntero ?
|
||||
extern int x_raton, y_raton; // Tras Espera_Tecla_o_Raton(); devuelve
|
||||
// extern int boton_izq, boton_der; // las coordenadas y botones pulsados...
|
||||
|
||||
extern unsigned char BLANCO, GRIS_CLARO, NEGRO, UNKNOW, AZUL;
|
493
MB_2_C.CPP
Normal file
493
MB_2_C.CPP
Normal file
@ -0,0 +1,493 @@
|
||||
#include <dos.h>
|
||||
#include <math.h>
|
||||
#include <ctype.h>
|
||||
#include <alloc.h>
|
||||
#include <conio.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <graphics.h>
|
||||
|
||||
#define OK 1
|
||||
#define SIN_MEMORIA 5
|
||||
#define ERROR_ABRIENDO 6
|
||||
#define ERROR_CERRANDO 7
|
||||
|
||||
#define EOL 10 // Fin de linea
|
||||
|
||||
int Secuencias;
|
||||
int *n_Botones_Secuencia;
|
||||
int memoria_asignada = 0, vez = 0;
|
||||
|
||||
struct Make_Boton {
|
||||
int Left, Up, Right, Down;
|
||||
int Cdf, Cb1, Cb2;
|
||||
int Ab, Pb;
|
||||
int Isc, Sc;
|
||||
};
|
||||
|
||||
struct Make_Boton far *Botones; // Puntero a estructura
|
||||
struct Make_Boton Bot_Static;
|
||||
|
||||
int Analiza_Fichero_Dinamicos(char *f_datos);
|
||||
int Analiza_Fichero_Estaticos(char *f_datos);
|
||||
|
||||
void ErrorOccurred(int errorcode);
|
||||
|
||||
int lee_objeto(FILE *); // Lee el objeto del disco
|
||||
|
||||
FILE *MB_out;
|
||||
|
||||
void main(int argc, char *argv[] ) {
|
||||
|
||||
char Buffer[80]; int len;
|
||||
char *ptr = argv[2];
|
||||
|
||||
if ( argc != 3 ) {
|
||||
|
||||
printf("\n");
|
||||
printf("FALTAN PARAMETROS\n");
|
||||
printf("\n");
|
||||
printf(" MB2SRC [Fichero_Fuente] [Destino_CPP.CPP]\n");
|
||||
printf("\n");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* open a file for update */
|
||||
if( (MB_out = fopen(argv[2], "w")) == NULL ) {
|
||||
printf("\nError Abriendo Archivo destino");
|
||||
return;
|
||||
}
|
||||
fprintf( MB_out, "/***************************************************************/\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/* Conversi¢n de fuentes de MAKE BOTON en ASCII a fuentes */\n");
|
||||
fprintf( MB_out, "/* para CPP, que pueden ser compilados junto al programa. */\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/***************************************************************/\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/* MAKE BOTON es un programa realizado por Jos‚ David Guill‚n */\n");
|
||||
fprintf( MB_out, "/* MB a CPP es una utilidad complementaria a Make Boton por */\n");
|
||||
fprintf( MB_out, "/* Jos‚ David Guill‚n... */\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/***************************************************************/\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/* GRACIAS POR UTILIZAR MI SOFTWARE... */\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/* JOS<4F> DAVID GUILL<4C>N (c) 1995 */\n");
|
||||
fprintf( MB_out, "/* */\n");
|
||||
fprintf( MB_out, "/***************************************************************/\n");
|
||||
fprintf( MB_out, "\n\n\n");
|
||||
fprintf( MB_out, "// Debe indicar el directorio exacto de la Cabecera de MAKE BOTON\n");
|
||||
fprintf( MB_out, "#include \"Make_bot.h\"\n");
|
||||
fprintf( MB_out, "#include \"stdlib.h\"\n");
|
||||
fprintf( MB_out, "#include \"alloc.h\"\n");
|
||||
fprintf( MB_out, "#include \"graphics.h\"\n");
|
||||
fprintf( MB_out, "\n\n\n");
|
||||
fprintf( MB_out, "extern int vez, memoria_asignada, Secuencias, *n_Botones_Secuencia;\n");
|
||||
fprintf( MB_out, " struct Make_Boton { int Up, Left, Down, Right; int Cdf, Cb1, Cb2; int Ab, Pb; int Isc, Sc; };\n");
|
||||
fprintf( MB_out, "extern struct Make_Boton far *Botones, Bot_Static;\n");
|
||||
|
||||
|
||||
|
||||
fprintf( MB_out, "\n\n\n");
|
||||
fprintf( MB_out, "extern void Libera_Memoria(void);");
|
||||
fprintf( MB_out, "extern void Imprime_Boton(int D_Bord, struct Make_Boton Bot_Imp);");
|
||||
fprintf( MB_out, "\n\n\n");
|
||||
fprintf( MB_out, "// Esta funci¢n debe ser llamada para la inicializacion de los\n");
|
||||
fprintf( MB_out, "// botones en lugar de CARGA_BOTONES(...). \n");
|
||||
|
||||
fprintf( MB_out, "// Para cargar los botones con parametro 0 y para imprimir \n");
|
||||
fprintf( MB_out, "// imprimir los estaticos con parametro [ n§ de secuencia ] \n");
|
||||
len = 0;
|
||||
while( *ptr++ != NULL && *ptr != '.' ) len++;
|
||||
strncpy( Buffer, argv[2], len+1 );
|
||||
Buffer[len+1] = '\0' ;
|
||||
|
||||
fprintf( MB_out, "int Fichero_%s(char Dinamicos_Estaticos);\n\n", Buffer );
|
||||
fprintf( MB_out, "int Fichero_%s(char Dinamicos_Estaticos) {\n", Buffer );
|
||||
|
||||
fprintf( MB_out, "\n");
|
||||
|
||||
fprintf( MB_out, " switch(Dinamicos_Estaticos) {\n");
|
||||
fprintf( MB_out, "\n");
|
||||
fprintf( MB_out, " case 0:\n");
|
||||
if ( Analiza_Fichero_Dinamicos(argv[1]) != OK ) { printf( "ERROR ANALIZANDO FICHERO EN SECCION DINAMICOS..." ); return; };
|
||||
|
||||
if ( Analiza_Fichero_Estaticos(argv[1]) != OK ) { printf( "ERROR ANALIZANDO FICHERO EN SECCION ESTATICOS..." ); return; };
|
||||
fprintf( MB_out, " break;\n");
|
||||
fprintf( MB_out, " default:\n");
|
||||
fprintf( MB_out, " break;\n");
|
||||
fprintf( MB_out, " }\n");
|
||||
fprintf( MB_out, "}\n");
|
||||
|
||||
fclose(MB_out);
|
||||
|
||||
}
|
||||
|
||||
int Analiza_Fichero_Dinamicos(char *f_datos){
|
||||
FILE *fichero;
|
||||
int error_lectura = OK;
|
||||
|
||||
fprintf( MB_out, " if( vez == 0 ) {\n");
|
||||
fprintf( MB_out, " vez = 1;\n");
|
||||
fprintf( MB_out, " atexit( Libera_Memoria );\n");
|
||||
fprintf( MB_out, " }\n");
|
||||
fprintf( MB_out, " if ( memoria_asignada == 1 ) { \n");
|
||||
fprintf( MB_out, " free(n_Botones_Secuencia);\n");
|
||||
fprintf( MB_out, " farfree(Botones);\n");
|
||||
fprintf( MB_out, " memoria_asignada = 0;\n");
|
||||
fprintf( MB_out, " }\n");
|
||||
|
||||
if ( (fichero=fopen(f_datos,"r"))==NULL ) return ERROR_ABRIENDO;
|
||||
|
||||
char ch/*, buffer[80]*/;
|
||||
int signo,numero, temp_num, temp_b;
|
||||
int inc_Botones = -1;
|
||||
fprintf( MB_out, " int SiZe_BoToN = 0;\n");
|
||||
fprintf( MB_out, " if ( (Botones = (struct Make_Boton far *)farcalloc(1, sizeof( struct Make_Boton ) )) == NULL)\n");
|
||||
fprintf( MB_out, " return SIN_MEMORIA;\n");
|
||||
fprintf( MB_out, " memoria_asignada = 1;\n");
|
||||
fprintf( MB_out, "\n");
|
||||
|
||||
|
||||
ch=fgetc(fichero); //Lee el primer caracter
|
||||
while (ch!=EOF) { //Lee hasta fin de fichero
|
||||
if (ch=='*') //Linea con comentario
|
||||
while (ch!=EOL && ch!=EOF) ch=fgetc(fichero);
|
||||
|
||||
if (ch=='#') { //Numero de secuencias
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF) {
|
||||
if (ch>='0' && ch<='9') numero= (numero*10+ch-48);
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Secuencias = %d;\n", numero);
|
||||
fprintf( MB_out, " if (( n_Botones_Secuencia = (int *) malloc( sizeof(int)*Secuencias ) ) == NULL) {\n");
|
||||
fprintf( MB_out, " printf(\"\\nNo Hay suficiente Memoria, ni para un Boton\\n\\n\");\n");
|
||||
fprintf( MB_out, " return SIN_MEMORIA;\n");
|
||||
fprintf( MB_out, " }\n");
|
||||
}
|
||||
|
||||
if (ch=='!') { //Numero de Botones en la secuencia
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero= (numero*10+ch-48);
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
temp_num = numero;
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero= (numero*10+ch-48);
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
// fprintf( MB_out, " }\n");
|
||||
fprintf( MB_out, " n_Botones_Secuencia[%d - 1] = %d;\n", temp_num, numero);
|
||||
fprintf( MB_out, " SiZe_BoToN += ( sizeof( struct Make_Boton ) * %d);\n", numero);
|
||||
fprintf( MB_out, " if ( (Botones = (struct Make_Boton far *)farrealloc(Botones, SiZe_BoToN )) == NULL) {\n");
|
||||
fprintf( MB_out, " Secuencias = %d;\n", temp_num);
|
||||
fprintf( MB_out, " return SIN_MEMORIA;\n");
|
||||
fprintf( MB_out, " }\n");
|
||||
fprintf( MB_out, " memoria_asignada = 1;\n");
|
||||
|
||||
}
|
||||
if (ch=='$') { //C lculos del boton
|
||||
inc_Botones++;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d].Left = %d; ", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, "Botones [%d].Up = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, "Botones [%d]. Right = %d;", inc_Botones, numero);
|
||||
// Botones [inc_Botones]. Right =numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, "Botones [%d]. Down = %d;\n", inc_Botones, numero);
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Cdf = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Cb1 = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Cb2 = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Ab = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Pb = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Isc = %d;", inc_Botones, numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Botones [%d]. Sc = %d;\n", inc_Botones, numero);
|
||||
|
||||
}
|
||||
|
||||
if (ch!=EOF) ch=fgetc(fichero);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( fclose(fichero) != 0 ) return ERROR_CERRANDO;
|
||||
|
||||
// despliega_datos();
|
||||
|
||||
// while (!kbhit()); // Espera a que se pulse una tecla
|
||||
|
||||
return error_lectura;
|
||||
}
|
||||
|
||||
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
//ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
|
||||
int Analiza_Fichero_Estaticos(char *f_datos){
|
||||
|
||||
char ch, Relleno = 1;
|
||||
int x, y, fuente, size, orientacion, color;
|
||||
char buffer[160];
|
||||
int signo,numero, temp_num, temp_b;
|
||||
int secuencia_activa=-1;
|
||||
|
||||
FILE* fichero; // Fichero con datos del obj.
|
||||
|
||||
if ( (fichero=fopen(f_datos,"r"))==NULL ) return ERROR_ABRIENDO;
|
||||
|
||||
ch=fgetc(fichero); //Lee el primer caracter
|
||||
while (ch!=EOF) { //Lee hasta fin de fichero
|
||||
|
||||
if (ch=='*') //Linea con comentario
|
||||
while (ch!=EOL && ch!=EOF) ch=fgetc(fichero);
|
||||
|
||||
if (ch=='') { //Numero de Botones en la secuencia
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
secuencia_activa = numero;
|
||||
fprintf( MB_out, " break;\n");
|
||||
fprintf( MB_out, " case %d:\n", secuencia_activa);
|
||||
}
|
||||
|
||||
if (ch=='&' /*&& secuencia_activa == Sec_st*/) { //C lculos del boton estatico
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Left = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Up = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Right = %d;", numero);
|
||||
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Down = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Cdf = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Cb1 = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Cb2 = %d;", numero);
|
||||
|
||||
numero=0; Relleno = 1;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48; else
|
||||
if(ch == '-' || ch == '-') Relleno = 0;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Ab = %d;", numero);
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fprintf( MB_out, " Bot_Static.Pb = %d;\n", numero);
|
||||
fprintf( MB_out, " Imprime_Boton(%d, Bot_Static);\n", Relleno);
|
||||
|
||||
}
|
||||
if (ch=='|' /*&& secuencia_activa == Sec_st*/) { //C lculos del texto
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
x = numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
y = numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
fuente = numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
size = numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
orientacion = numero;
|
||||
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',') {
|
||||
if (ch>='0' && ch<='9') numero=numero*10+ch-48;
|
||||
ch=fgetc(fichero);
|
||||
}
|
||||
color = numero;
|
||||
|
||||
buffer[0] = '\0';
|
||||
numero=0;
|
||||
ch=fgetc(fichero);
|
||||
while (ch!=EOL && ch!=EOF && ch!=',' && numero<150 ) {
|
||||
ch=fgetc(fichero);
|
||||
if(ch!=',') { buffer[numero] = ch; numero++; }
|
||||
}
|
||||
|
||||
buffer[numero] = '\0';
|
||||
fprintf( MB_out, " setcolor(%d);", color);
|
||||
|
||||
/* select the registered font */
|
||||
fprintf( MB_out, " settextstyle( %d, %d, %d);", fuente, orientacion, size);
|
||||
fprintf( MB_out, " outtextxy( %d, %d, \"%s\" );\n", x, y, buffer);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (ch!=EOF) ch=fgetc(fichero);
|
||||
}
|
||||
|
||||
if( fclose(fichero) != 0 ) return ERROR_CERRANDO;
|
||||
// if( fclose(fichero) != 0 ) return ERROR_CERRANDO;
|
||||
return OK;
|
||||
}
|
||||
|
||||
R |