summaryrefslogtreecommitdiffstats
path: root/include/syntax_essentials.h
diff options
context:
space:
mode:
authorFilip Wandzio <contact@philw.dev>2026-03-01 01:03:39 +0100
committerFilip Wandzio <contact@philw.dev>2026-03-01 01:03:39 +0100
commitbf0d77d7d448e964e9716d5af67c48f3d014f090 (patch)
treee55f1e91a8c20cd737dfb01dc12a954c25711e01 /include/syntax_essentials.h
downloadembedded_guardian-bf0d77d7d448e964e9716d5af67c48f3d014f090.tar.gz
embedded_guardian-bf0d77d7d448e964e9716d5af67c48f3d014f090.zip
Scaffold basic project tree, implement benchmarking logic
Implement unit testing guardian
Diffstat (limited to '')
-rw-r--r--include/syntax_essentials.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/include/syntax_essentials.h b/include/syntax_essentials.h
new file mode 100644
index 0000000..181cb99
--- /dev/null
+++ b/include/syntax_essentials.h
@@ -0,0 +1,81 @@
1#pragma once
2
3/**
4 *
5 * TASK 1: validate_first_name
6 * ---------------------------
7 * Check if the first name is valid.
8 * - Cannot be NULL or empty
9 * - Only letters (a-z, A-Z)
10 * - Minimum length: 2
11 */
12int validate_first_name(const char *first_name);
13
14/**
15 * TASK 2: validate_last_name
16 * --------------------------
17 * Check if the last name is valid.
18 * - Cannot be NULL or empty
19 * - Only letters (a-z, A-Z)
20 * - Minimum length: 2
21 */
22int validate_last_name(const char *last_name);
23
24/**
25 * TASK 3: validate_full_name
26 * --------------------------
27 * Check if a full name "First Last" is valid.
28 * Use TASK 1 and TASK 2 internally.
29 */
30int validate_full_name(const char *full_name);
31
32/**
33 * TASK 4: validate_index
34 * ----------------------
35 * Check if a student index is valid.
36 * - Exactly 6 digits
37 */
38int validate_index(const char *index);
39
40/**
41 * TASK 5: register_student
42 * ------------------------
43 * Register a student given full name and index.
44 * Return codes:
45 * 0 -> valid
46 * 1 -> invalid name
47 * 2 -> invalid index
48 */
49int register_student(const char *full_name, const char *index);
50
51/**
52 * TASK 6: name_length
53 * ------------------
54 * Return length of the string (do not use strlen).
55 */
56int name_length(const char *name);
57
58/**
59 * TASK 7: student struct
60 * ---------------------
61 * Simple student structure
62 */
63typedef struct {
64 char full_name[64];
65 char index[16];
66} Student;
67
68/**
69 * TASK 8: add_student
70 * -------------------
71 * Add a student to an array of Student. Return 0 if added.
72 */
73int add_student(Student *array, int max_size, const char *name,
74 const char *index);
75
76/**
77 * TASK 9: get_error_message
78 * ------------------------
79 * Return error message string for code returned by register_student
80 */
81const char *get_error_message(int code);