Acme-ExtUtils-XSOne-Test-Calculator
view release on metacpan or search on metacpan
Calculator.xs view on Meta::CPAN
/*
* THIS FILE IS AUTO-GENERATED BY ExtUtils::XSOne
* DO NOT EDIT DIRECTLY - edit files in lib/Acme/ExtUtils/XSOne/Test/ instead
*
* Generated from:
* _header.xs
* Calculator/Basic.xs
* Calculator/Memory.xs
* Calculator/Scientific.xs
* Calculator/Trig.xs
* _footer.xs
*/
/* ========== COMBINED C PREAMBLE ========== */
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#include <math.h>
#include <stdlib.h>
#define PERL_NO_GET_CONTEXT
#define MAX_MEMORY_SLOTS 10
#define MAX_HISTORY 100
/* C code from: _header.xs */
#line 1 "lib/Acme/ExtUtils/XSOne/Test/_header.xs"
/*
* Acme::ExtUtils::XSOne::Test::Calculator - A demonstration of ExtUtils::XSOne
*
* This header file contains shared state and helper functions
* accessible from all Calculator submodules.
*/
/* ========== Shared State ========== */
/* Memory for storing calculation results */
static double memory_slots[MAX_MEMORY_SLOTS];
static int memory_initialized = 0;
/* Calculation history */
typedef struct {
char operation; /* +, -, *, /, ^, r (root), etc. */
double operand1;
double operand2;
double result;
} HistoryEntry;
static HistoryEntry history[MAX_HISTORY];
static int history_count = 0;
/* Last result (ANS functionality) */
static double last_result = 0.0;
/* ========== Helper Functions ========== */
static void init_memory(void) {
if (!memory_initialized) {
for (int i = 0; i < MAX_MEMORY_SLOTS; i++) {
memory_slots[i] = 0.0;
}
( run in 0.639 second using v1.01-cache-2.11-cpan-13bb782fe5a )