1
0
This commit is contained in:
2025-10-10 02:17:07 +02:00
commit ee9f86004b
48 changed files with 2161 additions and 0 deletions

31
P1/P1.sln Normal file
View File

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35303.130
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "smt4497-P1", "smt4497-P1\smt4497-P1.vcxproj", "{BE550ACF-1308-4287-B9D9-01ACC6935D03}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Debug|x64.ActiveCfg = Debug|x64
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Debug|x64.Build.0 = Debug|x64
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Debug|x86.ActiveCfg = Debug|Win32
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Debug|x86.Build.0 = Debug|Win32
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Release|x64.ActiveCfg = Release|x64
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Release|x64.Build.0 = Release|x64
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Release|x86.ActiveCfg = Release|Win32
{BE550ACF-1308-4287-B9D9-01ACC6935D03}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FB74D9CC-E610-4A76-B2DB-3A3BA54988C8}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,24 @@
#include "smt4497-P1.h"
void LeeFabricanteCPU(char fabricante[], int tamfabricante)
{
int info[4];
__cpuid(info, 0);
int* p;
p = (int*) fabricante;
//usando puntero interpretando como int
p[0] = info[1];
p[1] = info[3];
p[2] = info[2];
//p[3] = 0; // puede ser un error porque "rellena mas 0's"
//usando memcpy interpretando como char
//memcpy(&fabricante[0], &info[1], 4); // == &fabricante
//memcpy(&fabricante[4], &info[3], 4);
//memcpy(&fabricante[8], &info[2], 4);
fabricante[12] = 0;
}

View File

@@ -0,0 +1,30 @@
#include "smt4497-P1.h"
#define TAM_NOMBRE_FABRICANTE 37
/*int main(int argc, char* argv[], char* emvp[])
{
setlocale(LC_ALL, "Spanish");
char nombreFabricante[TAM_NOMBRE_FABRICANTE];
LeeFabricanteCPU(nombreFabricante, TAM_NOMBRE_FABRICANTE);
printf("Fabricante: %s\n", nombreFabricante);
printf("Por favor pulse la tecla ENTER para terminar ... \n");
(void)getchar();
return 0;
}*/
int main(int argc, char* argv[], char* emvp[])
{
setlocale(LC_ALL, "Spanish");
for (int i = 0; i < argc; i++)
{
printf("Arg %d: %s\n", i, argv[i]);
}
printf("Por favor pulse la tecla ENTER para terminar ... \n");
(void)getchar();
return 0;
}

View File

@@ -0,0 +1,11 @@
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include <intrin.h>
#include <locale.h>
int esperaPulseTecla(int toutMs);
void LeeFabricanteCPU(char fabricante[], int tamfabricante);

View File

@@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{be550acf-1308-4287-b9d9-01acc6935d03}</ProjectGuid>
<RootNamespace>smt4497P1</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="smt4497-P1-matrices.cpp" />
<ClCompile Include="smt4497-P1.cpp" />
<ClCompile Include="smt4497-P1a.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="smt4497-P1.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Archivos de origen">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Archivos de encabezado">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Archivos de recursos">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="smt4497-P1a.cpp">
<Filter>Archivos de origen</Filter>
</ClCompile>
<ClCompile Include="smt4497-P1.cpp">
<Filter>Archivos de origen</Filter>
</ClCompile>
<ClCompile Include="smt4497-P1-matrices.cpp">
<Filter>Archivos de origen</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="smt4497-P1.h">
<Filter>Archivos de encabezado</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>
</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,21 @@
#include "smt4497-P1.h"
int esperaPulseTecla(int toutMs)
{
int res = 0;
int antes = GetTickCount();
int ahora;
do {
if (_kbhit())
{
res = _getch();
break;
}
if (toutMs > 0)
Sleep(1);
ahora = GetTickCount();
} while (ahora - antes < toutMs);
return res;
}

View File

@@ -0,0 +1,14 @@
#include "smt4497-P1.h"
int ej1_8()
{
printf("Pulsa una tecla para salir \n");
int contador = 0;
int tecla = 0;
printf("Tam. contador: %d bytes\n", sizeof(contador));
while (tecla = 0)
{
printf("\r%d ", ++contador);
tecla = esperaPulseTecla(0);
}
}