diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..2bfa787 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,16 @@ +{ + "configurations": [ + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**" + ], + "defines": [], + "compilerPath": "/usr/bin/clang", + "cStandard": "c11", + "cppStandard": "c++14", + "intelliSenseMode": "linux-clang-x64" + } + ], + "version": 4 +} \ No newline at end of file diff --git a/inc/alumnos.h b/inc/alumnos.h index 44f2867..fcbba1a 100644 --- a/inc/alumnos.h +++ b/inc/alumnos.h @@ -43,6 +43,16 @@ bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno); bool FedericoMeghinasso(char * cadena, size_t espacio); +bool MatiasMeghinasso(char * cadena, size_t espacio); + +bool MartinDuarte(char * cadena, size_t espacio); + +bool AlejandroPermingeat(char * cadena, size_t espacio); + +bool EstebanVolentini(char * cadena, size_t espacio); + +bool LucasOrsi(char * cadena, size_t espacio); + /*=====[Prototypes (declarations) of public interrupt functions]=============*/ /*=====[C++ - end]===========================================================*/ diff --git a/makefile b/makefile index 6e5d9a6..4c2270a 100644 --- a/makefile +++ b/makefile @@ -24,8 +24,8 @@ $(OUT_DIR): $(BIN_DIR): $(OUT_DIR) @echo Creating output binaries folder - @mkdir $(BIN_DIR) +# @mkdir $(BIN_DIR) $(OBJ_DIR): $(OUT_DIR) @echo Creating output objects folder - @mkdir $(OBJ_DIR) +# @mkdir $(OBJ_DIR) diff --git a/src/alumnos.c b/src/alumnos.c index 9eb9844..ea6d9c6 100644 --- a/src/alumnos.c +++ b/src/alumnos.c @@ -6,7 +6,7 @@ * Version: 0.1.0 * Creation Date: 2019/06/21 */ - + /*=====[Inclusion of own header]=============================================*/ #include "alumnos.h" @@ -32,16 +32,17 @@ /*=====[Implementations of interrupt functions]==============================*/ -bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno) { +bool SerializarAlumno(char *cadena, size_t espacio, const alumno_t alumno) +{ int resultado; const char FORMATO[] = "{" - "\"documento\":\"%s\"," - "\"apellidos\":\"%s\"," - "\"nombres\":\"%s\"" - "}"; + "\"documento\":\"%s\"," + "\"apellidos\":\"%s\"," + "\"nombres\":\"%s\"" + "}"; - resultado = snprintf(cadena, espacio, FORMATO, - alumno->documento, alumno->apellidos, alumno->nombres); + resultado = snprintf(cadena, espacio, FORMATO, + alumno->documento, alumno->apellidos, alumno->nombres); return (resultado >= 0); } @@ -56,4 +57,63 @@ bool FedericoMeghinasso(char * cadena, size_t espacio) { return SerializarAlumno(cadena, espacio, &alumno); } +bool MatiasMeghinasso(char *cadena, size_t espacio) +{ + const struct alumno_s alumno = { + .apellidos = "Matias", + .nombres = "Matias Gino", + .documento = "36.806.968", + }; + + return SerializarAlumno(cadena, espacio, &alumno); +} + +bool MartinDuarte(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "DUARTE", + .nombres = "Martin Nicolás", + .documento = "38.170.436", + }; + + return SerializarAlumno(cadena, espacio, &alumno); +} + +bool AlejandroPermingeat(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "PERMINGEAT", + .nombres = "Alejandro", + .documento = "00.000.000", + }; + + return SerializarAlumno(cadena, espacio, &alumno); +} + +bool EstebanVolentini(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "VOLENTINI", + .nombres = "Esteban Daniel", + .documento = "23.517.968", + }; + + return SerializarAlumno(cadena, espacio, &alumno); +} + +bool LucasOrsi(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "ORSI", + .nombres = "Lucas", + .documento = "38.492.146", + }; + return SerializarAlumno(cadena, espacio, &alumno); +} + +/*=====[Implementations of private functions]================================*/ +bool JosueElias(char * cadena, size_t espacio) { + const struct alumno_s alumno = { + .apellidos = "Velardez", + .nombres = "German", + .documento = "37.165.604", + }; + return SerializarAlumno(cadena, espacio, &alumno); +} /*=====[Implementations of private functions]================================*/ diff --git a/src/main.c b/src/main.c index 319e58f..da86642 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ * Version: 0.1.0 * Creation Date: 2019/06/21 */ - + /*=====[Inclusion of own header]=============================================*/ #include "alumnos.h" @@ -34,13 +34,60 @@ /*=====[Implementations of private functions]================================*/ + + int main(int argc, char *argv[]) { char cadena[128]; - - if (FedericoMeghinasso(cadena, sizeof(cadena))) { + + if (AlejandroPermingeat(cadena, sizeof(cadena))) { + printf("Alumno: %s\r\n", cadena); + } else { + printf("No se pudo serializar el alumno\r\n"); + } + + if (AlejandroPermingeat(cadena, sizeof(cadena))) { + printf("Alumno: %s\r\n", cadena); + } else { + printf("No se pudo serializar el alumno\r\n"); + } + + if (EstebanVolentini(cadena, sizeof(cadena))) { + printf("Alumno: %s\r\n", cadena); + } + else { + printf("No se pudo serializar el alumno\r\n"); + } + + if (LucasOrsi(cadena, sizeof(cadena))) { printf("Alumno: %s\r\n", cadena); } else { printf("No se pudo serializar el alumno\r\n"); } + + if (MartinDuarte(cadena, sizeof(cadena))) { + printf("Alumno: %s\r\n", cadena); + } else { + printf("No se pudo serializar el alumno\r\n"); + } + + if (MatiasMeghinasso(cadena, sizeof(cadena))) + { + printf("Alumno: %s\r\n", cadena); + } + else + { + printf("No se pudo serializar el alumno\r\n"); + } + + if (FedericoMeghinasso(cadena, sizeof(cadena))) + { + printf("Alumno: %s\r\n", cadena); + } + else + { + printf("No se pudo serializar el alumno\r\n"); + } + + return 0; -} +} \ No newline at end of file