Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Se agregan los datos del alumno TAJES, Fernando #15

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions inc/alumnos.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ extern "C" {

/*=====[Definitions of public data types]====================================*/

/**
* @brief Estructura con los datos del alumno
*/
typedef struct alumno_s {
char apellidos[30];
char nombres[30];
Expand All @@ -39,6 +42,13 @@ typedef struct alumno_s {

/*=====[Prototypes (declarations) of public functions]=======================*/


/**
* @brief Función serializar alumno
* @param cadena
* @param espacio
* @return True o False
*/
bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno);

bool SerializarAlumnos(char * cadena, size_t espacio);
Expand Down
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ $(BIN_DIR): $(OUT_DIR)
$(OBJ_DIR): $(OUT_DIR)
@echo Creating output objects folder
@mkdir $(OBJ_DIR)

doc:
doxygen $(INC_DIR)/*.h $(SRC_DIR)/*.c
28 changes: 20 additions & 8 deletions src/alumnos.c
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*=====[Module Name]===========================================================
* Copyright 2019 Esteban Daniel VOLENTINI <evolentini@gmail.com>
* All rights reserved.
* License: BSD-3-Clause <https://opensource.org/licenses/BSD-3-Clause>)
*
* Version: 0.1.0
* Creation Date: 2019/03/01
*/
/**
* @file alumnos.c
* @brief Módulo que implementa las funciones...
* @author --------
* @date 19/12/2020
*/

/*=====[Inclusion of own header]=============================================*/

Expand All @@ -31,8 +29,16 @@ static const struct alumno_s ESTEBAN_VOLENTINI = {
.documento = "23.517.968",
};


static const struct alumno_s FERNANDO_TAJES = {
.apellidos = "TAJES",
.nombres = "Fernando",
.documento = "3.864.221-4",
};

const alumno_t ALUMNOS[] = {
&ESTEBAN_VOLENTINI,
&FERNANDO_TAJES,
};

const int CANTIDAD_ALUMNOS = (sizeof(ALUMNOS) / sizeof(alumno_t));
Expand All @@ -45,6 +51,9 @@ const int CANTIDAD_ALUMNOS = (sizeof(ALUMNOS) / sizeof(alumno_t));

/*=====[Implementations of interrupt functions]==============================*/

/**
* @brief Función que serializa al alumno
*/
bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno) {
int resultado;
const char FORMATO[] = "{"
Expand All @@ -59,6 +68,9 @@ bool SerializarAlumno(char * cadena, size_t espacio, const alumno_t alumno) {
return (resultado >= 0);
}

/**
* @brief Función que serializa a los alumnos
*/
bool SerializarAlumnos(char * cadena, size_t espacio) {
static const int cantidad = sizeof(ALUMNOS) / sizeof(alumno_t);
int posicion = snprintf(cadena, espacio, "[\r\n ");
Expand Down