amath
1.8.5
Simple command line calculator
|
C functions for manipulating strings and memory. More...
Go to the source code of this file.
Classes | |
struct | texttag |
Functions | |
void * | AllocMemSafe (size_t) |
Allocate memory and add it to the global memory list. More... | |
void | FreeMemSafe (void *) |
Deallocate memory from the global memory list. More... | |
void | DetachMemSafe (void *) |
Detach an allocated memory from the global memory list. More... | |
void | FreeAllSafe () |
Deallocate all memory in the global memory list. More... | |
void | MemUsage (long *, long *, long *) |
Get memory usage in the global memory list. More... | |
int | StrLen (const char *string) |
Get the length of a null terminated string. More... | |
bool | StrIsEqual (const char *s1, const char *s2) |
Compare two null terminated strings to each other. More... | |
void | MemSet (void *destination, int c0, unsigned int length) |
Fill block of memory with a constant value. More... | |
void | MemCopy (void *destination, const void *source, unsigned int length) |
Copy a block of memory, handling overlap. More... | |
unsigned int | AllocAndCopy (char **destination, const char *source) |
Allocate memory and copy a string into the array. More... | |
void | Untag (char *destination, const char *source, texttag tags[], unsigned int tagcount) |
C functions for manipulating strings and memory.
Definition in file amathc.h.
unsigned int AllocAndCopy | ( | char ** | destination, |
const char * | source | ||
) |
Allocate memory and copy a string into the array.
Definition at line 40 of file alloccpy.c.
Referenced by AnsiConoleEngine::AnsiConoleEngine(), CharBuffer::ClearAndCopy(), ConsoleBase::ConsoleBase(), AnsiConoleEngine::CopyLine(), DeleteStatement::DeleteStatement(), DrawStatement::DrawStatement(), ErrorNode::ErrorNode(), ExecuteStatement::ExecuteStatement(), FunctionNode::FunctionNode(), HelpStatement::HelpStatement(), Lexer::Lexer(), ListStatement::ListStatement(), StandardLanguage::LoadCatalog(), LoadStatement::LoadStatement(), PlotStatement::PlotStatement(), PromptStatement::PromptStatement(), SaveStatement::SaveStatement(), PreferencesBase::SetDefaults(), PreferencesBase::SetPrompt(), AnsiConoleEngine::SetPrompt(), ConsoleBase::SetPrompt(), AnsiConoleEngine::ShowLast(), ShowStatement::ShowStatement(), StatementNode::StatementNode(), Token::Token(), UserFunction::UserFunction(), and Variable::Variable().
void* AllocMemSafe | ( | size_t | ) |
Allocate memory and add it to the global memory list.
Definition at line 86 of file mem.c.
References MemoryBlock::address, alloc_error(), MemoryList::count, MemoryList::first, list, MemoryBlock::next, MemoryList::peak, MemoryBlock::size, and MemoryList::size.
void DetachMemSafe | ( | void * | block | ) |
Detach an allocated memory from the global memory list.
The memory block is only detached, not deallocated.
Definition at line 209 of file mem.c.
References RemoveMemSafe().
void FreeAllSafe | ( | ) |
Deallocate all memory in the global memory list.
Definition at line 217 of file mem.c.
References MemoryBlock::address, MemoryList::first, list, and MemoryBlock::next.
Referenced by main().
void FreeMemSafe | ( | void * | ) |
Deallocate memory from the global memory list.
Definition at line 200 of file mem.c.
References RemoveMemSafe().
void MemCopy | ( | void * | destination, |
const void * | source, | ||
unsigned int | length | ||
) |
Copy a block of memory, handling overlap.
Definition at line 75 of file memcpy.c.
Referenced by CharBuffer::EnsureSize(), Lexer::GetDigitValue(), Lexer::GetLiteral(), Lexer::GetQuotedIdent(), DecimalSystem::GetText(), and Language::UntagText().
void MemSet | ( | void * | destination, |
int | c0, | ||
unsigned int | length | ||
) |
void MemUsage | ( | long * | , |
long * | , | ||
long * | |||
) |
Get memory usage in the global memory list.
Definition at line 242 of file mem.c.
References MemoryList::count, list, MemoryList::peak, and MemoryList::size.
Referenced by MemoryStatement::Execute().
bool StrIsEqual | ( | const char * | s1, |
const char * | s2 | ||
) |
Compare two null terminated strings to each other.
Definition at line 50 of file strcmp.c.
Referenced by VariableList::CreateVariable(), FunctionList::Delete(), FunctionList::FindAlias(), Language::FindAlias(), FunctionList::GetFunctionCall(), FunctionList::GetFunctionDef(), Language::GetHelpText(), FunctionList::GetSystemFunction(), VariableList::GetVariable(), StandardProgram::Initialize(), CharBuffer::Is(), StandardFilesystem::ListDirectory(), CharBuffer::RemoveTrailing(), and StandardLanguage::StrIsEqualLoc().
int StrLen | ( | const char * | string | ) |
Get the length of a null terminated string.
Definition at line 34 of file strlen.c.
Referenced by ErrorNode::ErrorNode(), SaveStatement::Execute(), MemoryStatement::Execute(), EvalStatement::Execute(), InputStatement::Execute(), OutputStatement::Execute(), DigitsStatement::Execute(), DeleteStatement::Execute(), ErrorNode::Execute(), StatementBlockNode::Execute(), PreferencesBase::GetDescription(), PositionalNumeralSystem::GetName(), UnaryNode::GetText(), FunctionNode::GetText(), AbsoluteNode::GetText(), FactorialNode::GetText(), NumericOperator::GetText(), StandardProgram::Initialize(), FunctionList::ListContent(), VariableList::ListContent(), StandardFilesystem::ListDirectory(), CharBuffer::RemoveTrailing(), AnsiConoleEngine::ShowLast(), AnsiConoleEngine::ShowNext(), and Language::UntagText().
void Untag | ( | char * | destination, |
const char * | source, | ||
texttag | tags[], | ||
unsigned int | tagcount | ||
) |
Definition at line 32 of file untag.c.
References texttag::tag, and texttag::text.
Referenced by Language::UntagText().