<commit_before>#include <ctype.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "src/graphics.h"
#include "src/input.h"
#include "tests/3dscene.h"
#include "tests/cube.h"
#include "tests/fpp.h"
#include "tests/linedraw.h"
#include "tests/project.h"
#include "tests/rtargets.h"
#include "tests/texmap.h"
#include "tests/tris.h"

void printMenu()
{
    gfx_setMode(0x03);
    printf("*** DOS3D software renderer test suite ***\n");
    printf("1. Bresenham line drawing\n");
    printf("2. Perspective projection\n");
    printf("3. Triangle rendering\n");
    printf("4. Render targets\n");
    printf("5. Texture mapping\n");
    printf("6. Rotating cube\n");
    printf("7. First person WASD camera\n");
    printf("8. Test 3D scene\n");
    printf("\nq. Exit!\n");
    printf("\nInput:\n");
}

// main test program
int main(int argc, char **argv)
{
    int demoFinished = 0;
    const unsigned short *keysPressed = kbd_getInput();

    printMenu();
  
    while(1)
    {
        if (!demoFinished)
        {
            if(keysPressed[KEY_1])
            {
                gfx_setMode(0x13);
                testBresenham(160, 103, 90);
                demoFinished = 1;
            }
            if(keysPressed[KEY_2])
            {
                gfx_setMode(0x13);
                testPerspective();
                demoFinished = 1;
            }
            if(keysPressed[KEY_3])
            {
                gfx_setMode(0x13);
                testTriangles();
                demoFinished = 1;
            }
            if(keysPressed[KEY_4])
            {
                gfx_setMode(0x13);
                testRenderTargets();
                demoFinished = 1;
            }
            if(keysPressed[KEY_5])
            {
                gfx_setMode(0x13);
                testTextureMapping();
                demoFinished = 1;
            }
            if(keysPressed[KEY_6])
            {
                gfx_setMode(0x13);
                testRotatingCube();
                demoFinished = 1;
            }
            if(keysPressed[KEY_7])
            {
                gfx_setMode(0x13);
                testFirstPerson();
                demoFinished = 1;
            }
            if(keysPressed[KEY_8])
            {
                gfx_setMode(0x13);
                test3DScene();
                demoFinished = 1;
            }
            if(keysPressed[KEY_Q])
            {
                gfx_setMode(0x03);
                exit(0);
            }
            
            keysPressed = kbd_getInput();
        }
        else
        {
            printMenu();
            demoFinished = 0;
        }
    }
}<commit_msg>proper program termination<commit_after>#include <ctype.h>
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "src/graphics.h"
#include "src/input.h"
#include "tests/3dscene.h"
#include "tests/cube.h"
#include "tests/fpp.h"
#include "tests/linedraw.h"
#include "tests/project.h"
#include "tests/rtargets.h"
#include "tests/texmap.h"
#include "tests/tris.h"

void printMenu()
{
    gfx_setMode(0x03);
    printf("*** DOS3D software renderer test suite ***\n");
    printf("1. Bresenham line drawing\n");
    printf("2. Perspective projection\n");
    printf("3. Triangle rendering\n");
    printf("4. Render targets\n");
    printf("5. Texture mapping\n");
    printf("6. Rotating cube\n");
    printf("7. First person WASD camera\n");
    printf("8. Test 3D scene\n");
    printf("\nq. Exit!\n");
    printf("\nInput:\n");
}

// main test program
int main(int argc, char **argv)
{
    int demoFinished = 0;
    const unsigned short *keysPressed = kbd_getInput();

    printMenu();
  
    while(1)
    {
        if (!demoFinished)
        {
            if(keysPressed[KEY_1])
            {
                gfx_setMode(0x13);
                testBresenham(160, 103, 90);
                demoFinished = 1;
            }
            if(keysPressed[KEY_2])
            {
                gfx_setMode(0x13);
                testPerspective();
                demoFinished = 1;
            }
            if(keysPressed[KEY_3])
            {
                gfx_setMode(0x13);
                testTriangles();
                demoFinished = 1;
            }
            if(keysPressed[KEY_4])
            {
                gfx_setMode(0x13);
                testRenderTargets();
                demoFinished = 1;
            }
            if(keysPressed[KEY_5])
            {
                gfx_setMode(0x13);
                testTextureMapping();
                demoFinished = 1;
            }
            if(keysPressed[KEY_6])
            {
                gfx_setMode(0x13);
                testRotatingCube();
                demoFinished = 1;
            }
            if(keysPressed[KEY_7])
            {
                gfx_setMode(0x13);
                testFirstPerson();
                demoFinished = 1;
            }
            if(keysPressed[KEY_8])
            {
                gfx_setMode(0x13);
                test3DScene();
                demoFinished = 1;
            }
            if(keysPressed[KEY_Q])
            {
                gfx_setMode(0x03);
                break;
            }
            
            keysPressed = kbd_getInput();
        }
        else
        {
            printMenu();
            demoFinished = 0;
        }
    }

    return 0;
}
{'fraction_non_alphanumeric': 0.1224302496328928, 'fraction_numerical': 0.02569750367107195, 'mean_word_length': 1.3588744588744588, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4171411', 'n_tokens_mistral': 1816, 'n_tokens_neox': 1688, 'n_words': 292}