This repository has been archived on 2022-08-01. You can view files and clone it, but cannot push or open issues or pull requests.
150ASM-Emulator/doc/html/mystring_8h.html

307 lines
15 KiB
HTML
Executable File

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>SCC.150 Assembler Emulator: /home/rumperuu/Documents/University/University Work/SCC.150 Digital Systems/Coursework/unr-C/SCC.150 Assembler Emulator/source/mystring.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">SCC.150 Assembler Emulator
</div>
<div id="projectbrief">A compiler for a simple assembler language</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Functions</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_b2f33c71d4aa5e7af42a1ca61ff5af1b.html">source</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#func-members">Functions</a> </div>
<div class="headertitle">
<div class="title">mystring.h File Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;stddef.h&gt;</code><br/>
</div>
<p><a href="mystring_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aa231246d7f6f97231aa18689cc2ea20a"><td class="memItemLeft" align="right" valign="top">size_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mystring_8h.html#aa231246d7f6f97231aa18689cc2ea20a">mystrlen</a> (const char *s)</td></tr>
<tr class="separator:aa231246d7f6f97231aa18689cc2ea20a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3dab99f21a63ee803be3e9344efda0a0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mystring_8h.html#a3dab99f21a63ee803be3e9344efda0a0">mystrcmp</a> (const char *s1, const char *s2)</td></tr>
<tr class="separator:a3dab99f21a63ee803be3e9344efda0a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a70913f883a62585fb8fe025aa1e56749"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mystring_8h.html#a70913f883a62585fb8fe025aa1e56749">mystrncmp</a> (const char *s1, const char *s2, int n)</td></tr>
<tr class="separator:a70913f883a62585fb8fe025aa1e56749"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1a18457ecefaaafb354de326065b86f9"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mystring_8h.html#a1a18457ecefaaafb354de326065b86f9">mystrchr</a> (char *haystack, const char needle)</td></tr>
<tr class="separator:a1a18457ecefaaafb354de326065b86f9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac650f6f569951713296a17edd496f7a5"><td class="memItemLeft" align="right" valign="top">char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="mystring_8h.html#ac650f6f569951713296a17edd496f7a5">mystrstr</a> (char *haystack, const char *needle)</td></tr>
<tr class="separator:ac650f6f569951713296a17edd496f7a5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><dl class="section author"><dt>Author</dt><dd>Ben Goldsworthy (rumps) <a href="#" onclick="location.href='mai'+'lto:'+'bgo'+'ld'+'swo'+'rt'+'hy9'+'6@'+'gma'+'il'+'.co'+'m'; return false;">bgold<span style="display: none;">.nosp@m.</span>swor<span style="display: none;">.nosp@m.</span>thy96<span style="display: none;">.nosp@m.</span>@gma<span style="display: none;">.nosp@m.</span>il.co<span style="display: none;">.nosp@m.</span>m</a> </dd></dl>
<dl class="section version"><dt>Version</dt><dd>1.0</dd></dl>
<h1><a class="anchor" id="LICENSE"></a>
LICENSE</h1>
<p>This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
<p>This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
<p>You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p>
<h1><a class="anchor" id="DESCRIPTION"></a>
DESCRIPTION</h1>
<p>Header file for <code><a class="el" href="mystring_8c.html">mystring.c</a></code>. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a1a18457ecefaaafb354de326065b86f9"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mystrchr </td>
<td>(</td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>haystack</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char&#160;</td>
<td class="paramname"><em>needle</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A function to find if a character exists in a string.</p>
<p>Goes through the string <code>haystack</code> looking for the character <code>needle</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">haystack</td><td>the string to search </td></tr>
<tr><td class="paramname">needle</td><td>the character to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>haystack</code> if successful, 0 if not </dd></dl>
</div>
</div>
<a class="anchor" id="a3dab99f21a63ee803be3e9344efda0a0"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mystrcmp </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s2</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A function to compare two strings.</p>
<p>Compares two strings, returning -1 if <code>s1</code> &lt; <code>s2</code>, 1 if <code>s1</code> &gt; <code>s2</code> and 0 if <code>s1</code> == <code>s2</code>.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s1</td><td>the string to compare </td></tr>
<tr><td class="paramname">s2</td><td>the string to compare <code>s1</code> to </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-1 if the <code>s1</code> &lt; <code>s2</code>; 1 if <code>s1</code> &gt; <code>s2</code>; 0 if <code>s1</code> == <code>s2</code> </dd></dl>
</div>
</div>
<a class="anchor" id="aa231246d7f6f97231aa18689cc2ea20a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">size_t mystrlen </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A function to measure the length of a valid C string.</p>
<p>Goes through the null-terminated (i.e. valid C) string <code>s</code> character-by-character, returning the length of the string (sans the null terminator).</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s</td><td>the string to measure </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the length of the string as an <code>unsigned int</code> (<code>size_t</code> because apparently that's the done thing as of C99, which I'm using because I love for loop initial declarations to bits) </dd></dl>
</div>
</div>
<a class="anchor" id="a70913f883a62585fb8fe025aa1e56749"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int mystrncmp </td>
<td>(</td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s1</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>s2</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A function to compare two strings up to a certain point.</p>
<p>Goes through <code>n</code> characters of <code>s1</code>, comparing them to the matching characters of <code>s2</code>. If the characters are different, it returns -1 if <code>s1</code> &lt; <code>s2</code> and 1 if <code>s1</code> &gt; <code>s2</code>.</p>
<p>If they're the same, it returns 0 if <code>s1</code> is the same length as <code>s2</code> (i.e. the same characters are both <code>NUL</code>). If the function reaches the <code>n</code>th character of <code>s1</code> and it remains the same as <code>s2</code>, it returns 0 also.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">s1</td><td>the string to compare </td></tr>
<tr><td class="paramname">s2</td><td>the string to compare <code>s1</code> to </td></tr>
<tr><td class="paramname">n</td><td>the length of <code>s1</code> to compare </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>-1/1 if the strings don't match, 0 if they do </dd></dl>
</div>
</div>
<a class="anchor" id="ac650f6f569951713296a17edd496f7a5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">char* mystrstr </td>
<td>(</td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>haystack</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>needle</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>A function to find if a string exists as a subset or totality of another.</p>
<p>Goes through the string <code>haystack</code> looking for the string <code>needle</code> by executing <code>mystrchr</code> on each character in turn.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">haystack</td><td>the string to search </td></tr>
<tr><td class="paramname">needle</td><td>the (sub)string to search for </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><code>haystack</code> if successful, 0 if not </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue May 19 2015 20:34:54 for SCC.150 Assembler Emulator by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>