mirror of
https://github.com/lukaszraczylo/filepuff-mcp.git
synced 2026-06-09 22:53:44 +00:00
Ho hum.
This commit is contained in:
Vendored
+55
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* @file header.h
|
||||
* @brief Sample header file for testing.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_H
|
||||
#define HEADER_H
|
||||
|
||||
/**
|
||||
* @brief Maximum buffer size.
|
||||
*/
|
||||
#define MAX_BUFFER_SIZE 1024
|
||||
|
||||
/**
|
||||
* @brief Status codes for operations.
|
||||
*/
|
||||
typedef enum {
|
||||
STATUS_OK = 0,
|
||||
STATUS_ERROR = 1,
|
||||
STATUS_NOT_FOUND = 2
|
||||
} Status;
|
||||
|
||||
/**
|
||||
* @brief Buffer structure for data storage.
|
||||
*/
|
||||
typedef struct {
|
||||
char data[MAX_BUFFER_SIZE];
|
||||
int length;
|
||||
} Buffer;
|
||||
|
||||
/**
|
||||
* @brief Initialize a buffer.
|
||||
* @param buf Pointer to the buffer
|
||||
*/
|
||||
void buffer_init(Buffer* buf);
|
||||
|
||||
/**
|
||||
* @brief Write data to the buffer.
|
||||
* @param buf Pointer to the buffer
|
||||
* @param data Data to write
|
||||
* @param len Length of data
|
||||
* @return Status code
|
||||
*/
|
||||
Status buffer_write(Buffer* buf, const char* data, int len);
|
||||
|
||||
/**
|
||||
* @brief Read data from the buffer.
|
||||
* @param buf Pointer to the buffer
|
||||
* @param out Output buffer
|
||||
* @param max_len Maximum length to read
|
||||
* @return Number of bytes read
|
||||
*/
|
||||
int buffer_read(Buffer* buf, char* out, int max_len);
|
||||
|
||||
#endif /* HEADER_H */
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @file valid.c
|
||||
* @brief Sample C file for testing.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* @brief A simple point structure.
|
||||
*/
|
||||
struct Point {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Creates a new point.
|
||||
* @param x The x coordinate
|
||||
* @param y The y coordinate
|
||||
* @return A new Point structure
|
||||
*/
|
||||
struct Point create_point(int x, int y) {
|
||||
struct Point p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
return p;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Calculates the distance from origin.
|
||||
* @param p The point
|
||||
* @return The squared distance from origin
|
||||
*/
|
||||
int distance_squared(struct Point p) {
|
||||
return p.x * p.x + p.y * p.y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Prints a point to stdout.
|
||||
* @param p The point to print
|
||||
*/
|
||||
void print_point(struct Point p) {
|
||||
printf("Point(%d, %d)\n", p.x, p.y);
|
||||
}
|
||||
|
||||
// Simple helper function
|
||||
int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
struct Point p = create_point(3, 4);
|
||||
print_point(p);
|
||||
printf("Distance squared: %d\n", distance_squared(p));
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user