Annotation of ADD_ver_10/GUI.c, revision 1.1

1.1     ! rico        1: /********************************************************************/
        !             2: /*  GUI.c                                                           */
        !             3: /*                                                                  */
        !             4: /*  Copyright (c) 1997-2006 Rafael Rico      (rafael.rico@uah.es)   */
        !             5: /*                                                                  */
        !             6: /*  This file is part of ADD version 5.10.                          */
        !             7: /*                                                                  */
        !             8: /*  ADD is free software; you can redistribute it and/or modify     */
        !             9: /*  it under the terms of the GNU General Public License as         */
        !            10: /*  published by the Free Software Foundation; either version 2 of  */
        !            11: /*  the License, or (at your option) any later version.             */
        !            12: /*                                                                  */
        !            13: /*  ADD is distributed in the hope that it will be useful,          */
        !            14: /*  but WITHOUT ANY WARRANTY; without even the implied warranty of  */
        !            15: /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   */
        !            16: /*  GNU General Public License for more details.                    */
        !            17: /*                                                                  */
        !            18: /*  You should have received a copy of the GNU General Public       */
        !            19: /*  License along with ADD; if not, write to the Free Software      */
        !            20: /*  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA        */
        !            21: /*  02111-1307  USA                                                 */
        !            22: /*                                                                  */
        !            23: /*  --------------------------- History --------------------------- */
        !            24: /*                                                                  */
        !            25: /*  Revision 1.2. 01/2006                                           */
        !            26: /*  Added GPL License and JavaDoc style documentation               */
        !            27: /*                                                                  */
        !            28: /*  Revision 1.1. 09/2005                                           */
        !            29: /*  Initial Revision                                                */
        !            30: /*                                                                  */
        !            31: /********************************************************************/
        !            32: 
        !            33: 
        !            34: /******************************************************************************/
        !            35: /* MÓDULO: GUI.c                                                              */
        !            36: /*                                                                            */
        !            37: /* Este módulo contiene las funciones de presentación visual.                 */
        !            38: /******************************************************************************/
        !            39: /* Fecha: 16 de septiembre de 2005                                            */
        !            40: /******************************************************************************/
        !            41: 
        !            42: #include <stdio.h>
        !            43: #include <string.h>
        !            44: 
        !            45: #include "defines.h"
        !            46: #include "tipos.h"
        !            47: #include "gui.h"
        !            48: 
        !            49: 
        !            50: /* configuración */
        !            51: extern struct argumentos configuracion;
        !            52: 
        !            53: /* contadores de instrucciones y ventanas */
        !            54: extern unsigned long instruccion, ventana;
        !            55: 
        !            56: 
        !            57: /* esta función muestra en la pantalla la información de la tarjeta de operandos */
        !            58: 
        !            59: void MostrarTarjeta(fichainstruccion *tarjetaoperandos)
        !            60: {
        !            61:        /* imprimo la tarjeta de la instrucción para ver si funciona bien */
        !            62:     
        !            63:        int i;
        !            64:        unsigned long total;
        !            65:        char cadena[MAX_LINE];
        !            66: 
        !            67:     /* todo esto no funciona aquí */
        !            68:     /* printf("\x01B[2J"); */   /* código de escape ANSI para borrar la pantalla */
        !            69:     /* printf("\027[2J");  */   /* código de escape ANSI para borrar la pantalla */
        !            70:     /* printf("%c[2J", 27);*/   /* código de escape ANSI para borrar la pantalla */
        !            71:     /* printf("\033[2J");  */ 
        !            72: 
        !            73:     printf("\n");
        !            74:        total = configuracion.ultima - configuracion.primera + 1;
        !            75:        i = printf("-| instruccion %lu de %lu (%.2f%%) |", instruccion, total, 100.00*instruccion/total);
        !            76:        /* parece que '.2' redondea algo hacia arriba (llegamos al 100% cuando estamos en 99.99%) */
        !            77:        i += printf("-| ventana %lu de %lu (%d ins/ven) |", ventana, total/configuracion.ventana, configuracion.ventana);
        !            78:     for(i; i<80; i++) printf("-");
        !            79: 
        !            80:     printf("%-14s  ", tarjetaoperandos->hexadecimal);
        !            81: 
        !            82:     /* formato de instrucción (notación de INTEL) */
        !            83:     /*
        !            84:        printf("%s%s", tarjetaoperandos->prefijo, tarjetaoperandos->prefijo[0]!='\0' ? " ":"");
        !            85: 
        !            86:     printf("%s", tarjetaoperandos->nemonico);
        !            87:     printf("%s%s", tarjetaoperandos->op1[0]!='\0' ? " ":"", tarjetaoperandos->op1);
        !            88:     printf("%s%s%s", (tarjetaoperandos->op1[0]!='\0' && tarjetaoperandos->op2[0]!='\0') ? ",":"", tarjetaoperandos->op2[0]!='\0' ? " ":"", tarjetaoperandos->op2);
        !            89:        */
        !            90:        /* igual con la función del módulo 'Auxiliares.c' */
        !            91:        CadenaEnsamblador(tarjetaoperandos->prefijo, tarjetaoperandos->nemonico, tarjetaoperandos->op1, tarjetaoperandos->op2, INTEL, cadena);
        !            92:        printf("%s", cadena);
        !            93: 
        !            94:     printf("   ");
        !            95:     
        !            96:     printf("(long:%d", tarjetaoperandos->longitud);
        !            97:        switch(tarjetaoperandos->salto)
        !            98:        {
        !            99:                case INCONDICIONAL:
        !           100:                printf(" salto:INCONDICIONAL");
        !           101:                break;
        !           102: 
        !           103:                case NO_SALTO:
        !           104:                printf(" salto:NO SALTO");
        !           105:                break;
        !           106: 
        !           107:                case TOMADO:
        !           108:                printf(" salto:TOMADO");
        !           109:                break;
        !           110: 
        !           111:                case NOTOMADO:
        !           112:                printf(" salto:NO TOMADO");
        !           113:                break;
        !           114:        }
        !           115: 
        !           116:        printf(" ALU=%d", tarjetaoperandos->ciclosALU);
        !           117:     printf(" BIU=%d)\n", tarjetaoperandos->ciclosBIU);
        !           118: 
        !           119:     printf("\nExpl leido datos:    %s", tarjetaoperandos->leidoexpldatos);
        !           120:     printf("\nExpl leido dir:      %s", tarjetaoperandos->leidoexpldir);
        !           121:     printf("\nExpl leido pila:     %s", tarjetaoperandos->leidoexplpila);
        !           122:     printf("\nExpl leido estado:   %s", tarjetaoperandos->leidoexplestado);
        !           123:     printf("\nExpl escrito datos:  %s", tarjetaoperandos->escritoexpldatos);
        !           124:     printf("\nExpl escrito dir:    %s", tarjetaoperandos->escritoexpldir);
        !           125:     printf("\nExpl escrito pila:   %s", tarjetaoperandos->escritoexplpila);
        !           126:     printf("\nExpl escrito estado: %s", tarjetaoperandos->escritoexplestado);
        !           127:     printf("\nImpl leido datos:    %s", tarjetaoperandos->leidoimpldatos);
        !           128:     printf("\nImpl leido dir:      %s", tarjetaoperandos->leidoimpldir);
        !           129:     printf("\nImpl leido pila:     %s", tarjetaoperandos->leidoimplpila);
        !           130:     printf("\nImpl leido estado:   %s", tarjetaoperandos->leidoimplestado);
        !           131:     printf("\nImpl escrito datos:  %s", tarjetaoperandos->escritoimpldatos);
        !           132:     printf("\nImpl escrito dir:    %s", tarjetaoperandos->escritoimpldir);
        !           133:     printf("\nImpl escrito pila:   %s", tarjetaoperandos->escritoimplpila);
        !           134:     printf("\nImpl escrito estado: %s", tarjetaoperandos->escritoimplestado);
        !           135: 
        !           136:     printf("\n");
        !           137: 
        !           138:        getchar();
        !           139: }
        !           140: 
        !           141: 
        !           142: 
        !           143: /* esta función muestra en la pantalla la información relativa a la ventana en curso */
        !           144: 
        !           145: void MostrarVentana()
        !           146: {
        !           147:        printf("\nEsta función no ha sido implementada\n");
        !           148: }
        !           149: 
        !           150: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>