Added a way to print out instead of stdout but to a file (everything about the process but errors (those still go to stderr) and made it so now someone can actually use echo -e "" | ./bin/stergios (prior this was impossible to do due to readline quirks)
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 7s
Stergios Upload Compile Checker / Explore-Gitea-Actions (push) Successful in 7s
This commit is contained in:
10 files changed
+191
-63
No files matched your search
@@ -6,6 +6,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* @brief Prompts the user for a line of input, handling both interactive and non-interactive modes.
|
||||
* @param prompt The message to display to the user before reading input
|
||||
* @return A dynamically allocated string containing the user's input. The caller is responsible for freeing this.
|
||||
*/
|
||||
char* prompt_line(const char* prompt);
|
||||
|
||||
/**
|
||||
* @brief Reads a line from the given stream, dynamically allocating memory for the line.
|
||||
* The line is terminated by a newline character or EOF. If a '#' character is encountered, the rest of the line is ignored (treated as a comment).
|
||||
@@ -33,6 +40,13 @@ int read_int128_triplet(const char* prompt, int128_t* a, int128_t* b, int128_t*
|
||||
*/
|
||||
int128_t str_to_int128(const char* s);
|
||||
|
||||
/**
|
||||
* @brief Prints a 128 bit integer
|
||||
* @param output The file pointer to print to (e.g., stdout or a file)
|
||||
* @param n The integer to print
|
||||
*/
|
||||
void fprint_int128(FILE* output, int128_t n);
|
||||
|
||||
/**
|
||||
* @brief Prints a 128 bit integer
|
||||
* @param n The integer to print
|
||||
|
||||
+4
-1
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/**
|
||||
* @brief Checks if a 128 bit integer is a prime number
|
||||
* @param n The integer to check
|
||||
@@ -91,9 +93,10 @@ int128_t power(int128_t b, int128_t ex);
|
||||
* @param values Pointer to the array of values
|
||||
* @param n1 The first integer
|
||||
* @param print_mode The mode for printing the results
|
||||
* @param output The file pointer for output (can be NULL)
|
||||
*/
|
||||
void generate_factor_pairs(int128_t* sum, int32_t prime_index, int32_t* exponents,
|
||||
int128_t* values, int128_t n1, int print_mode);
|
||||
int128_t* values, int128_t n1, int print_mode, FILE* output);
|
||||
|
||||
/**
|
||||
* @brief Calculates the square root of an unsigned 128 bit integer
|
||||
|
||||
+2
-6
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct Node {
|
||||
int128_t a, b, c;
|
||||
char move;
|
||||
@@ -16,12 +18,6 @@ typedef struct Node {
|
||||
*/
|
||||
void node_pool_init(int32_t max_nodes);
|
||||
|
||||
/**
|
||||
* @brief Allocates a node from the pool
|
||||
* @return A pointer to the allocated node, or NULL if the pool is exhausted
|
||||
*/
|
||||
Node* node_pool_alloc();
|
||||
|
||||
/**
|
||||
* @brief Resets the node pool without freeing memory
|
||||
*/
|
||||
|
||||
+2
-1
@@ -17,8 +17,9 @@ void try_push_children(Node* curr);
|
||||
* @param b0 The initial value of b
|
||||
* @param c0 The initial value of c
|
||||
* @param print_mode The mode for printing the results (1 for full, 2 for minimal)
|
||||
* @param output The file pointer for output (can be NULL)
|
||||
* @return 1 if a solution is found, 0 otherwise
|
||||
*/
|
||||
bool solve(int128_t* sum, int128_t a0, int128_t b0, int128_t c0, int print_mode);
|
||||
bool solve(int128_t* sum, int128_t a0, int128_t b0, int128_t c0, int print_mode, FILE* output);
|
||||
|
||||
#endif /* SOLVE_H */
|
||||
Reference in new issue
Block a user