1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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=11"/>
<meta name="generator" content="Doxygen 1.9.3"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Numericx: Numericx</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/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></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 id="projectrow">
<td id="projectalign">
<div id="projectname">Numericx
</div>
<div id="projectbrief">Translate a number from any numeral system into any numeral system</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</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><!-- top -->
<div><div class="header">
<div class="headertitle"><div class="title">Numericx </div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p >A console program that converts a number (or text) from one numerical system into another different numerical system.</p>
<h1><a class="anchor" id="autotoc_md1"></a>
Compiling</h1>
<p >This program create an executable (or many) that will convert a number from one numerical system into another one.</p>
<p >For example, you may want to convert a hexadecimal number into a ternary number. You may use this program.</p>
<p >You first need to define the proprieties of the numerical systems. These proprieties are defined in the compilation process (as compilation flags).</p>
<p >For example, let's make the hexdecimal numerical system with numerals from <code>0-f</code>, with a infinite 0 and it start counting on 1. So, our hexadecimal system will need the following compilation flags: </p><div class="fragment"><div class="line">-DFROM_NUMERICALS=\"0123456789abcdef\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE</div>
</div><!-- fragment --><p >if you want the units place of this numerical system to be on the right side, add <code>-DFROM_UNITS_ON_THE_END</code>.</p>
<p >Now, for the ternary system let's make with numerals from <code>1-3</code>, 1 is not infinite and it start counting on 1. Use this flags: </p><div class="fragment"><div class="line">-DTO_NUMERICALS=\"123\"</div>
</div><!-- fragment --><p >if you want the units place of this numerical system to be on the right side, use <code>-DTO_UNITS_ON_THE_END</code>.</p>
<p >Now, to create the executable to translate a number for these two numerical system, join all of this together and compile using this: </p><div class="fragment"><div class="line">$ c99 -DFROM_NUMERICALS=\"0123456789abcdef\" -DFROM_FIRST_NUMBER_VOID -DFROM_INFINITE_BASE -DFROM_UNITS_ON_THE_END -DTO_NUMERICALS=\"123\" -DTO_UNITS_ON_THE_END numericx.c -o hex-to-ternary</div>
</div><!-- fragment --><p >This creates the <code>hex-to-ternary</code> executable with can be used to convert numbers from hexadecimal to ternary!</p>
<h1><a class="anchor" id="autotoc_md2"></a>
Pre-defined executable compilation</h1>
<p >There are many pre-defined compilation of executables on the Makefile. Take a look at the Makefile to know them. Or you can run <code>make</code> to get all of the pre-defined executables. <code>make clean</code> to delete them.</p>
<h1><a class="anchor" id="autotoc_md3"></a>
Compilation flags meanings</h1>
<p >There are two categories for the compilation flags: the <code>FROM</code> category and the <code>TO</code> category.</p>
<p ><code>FROM</code> flags are the numerical system definitions of the argument number.</p>
<p ><code>TO</code> flags are the numerical system definitions of the number result.</p>
<p >Below, are the meanings of the <code>FROM</code> flags. The <code>TO</code> flags are the same as the <code>FROM</code> flags, with a switch of the <code>FROM_</code> to a <code>TO_</code>.</p>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">Flag </th><th class="markdownTableHeadNone">Meaning </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">FROM_NUMERALS </td><td class="markdownTableBodyNone">Define the numerical system numerals of the 'from' </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">FROM_UNITS_ON_THE_END </td><td class="markdownTableBodyNone">Defines the units case to be on the end (on the right) for the 'from' </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">FROM_FIRST_NUMBER_VOID </td><td class="markdownTableBodyNone">Defines the first number as a "not counting" for the 'from' </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">FROM_INFINITE_BASE </td><td class="markdownTableBodyNone">Defines the first number to be infinite, for the 'from' (for example, if the first numeral is 0, then 0 == 00 == 000 == 0000 ... . Or if the first numeral is 1, then 1 == 11 == 111 ...) </td></tr>
</table>
<p >There is also the <code>DEBUG</code> flag, which will show all the steps that you number walked through. Remember: you use <code>-DDEBUG</code> as an compiler argument.</p>
<h1><a class="anchor" id="autotoc_md4"></a>
License</h1>
<p >MIT</p>
<h1><a class="anchor" id="autotoc_md5"></a>
Author</h1>
<p >Daniel A. C. Santos </p>
</div></div><!-- contents -->
</div><!-- PageDoc -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.3
</small></address>
</body>
</html>
|