Compare commits

..

8 Commits

@ -1,2 +1,3 @@
# SQA-Homework # SQA-Homework
Dynamic Testing
实验报告存放在 Results 文件夹下

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

@ -0,0 +1,519 @@
/* All views: initial background and text color */
body
{
color: #000000;
background-color: #FFFFFF;
}
/* All views: standard link format*/
a:link
{
color: #284FA8;
text-decoration: underline;
}
/* All views: standard link - visited format */
a:visited
{
color: #00CB40;
text-decoration: underline;
}
/* All views: standard link - activated format */
a:active
{
color: #FF0040;
text-decoration: underline;
}
/* All views: main title format */
td.title
{
text-align: center;
padding-bottom: 10px;
font-family: sans-serif;
font-size: 20pt;
font-style: italic;
font-weight: bold;
}
/* All views: header item format */
td.headerItem
{
text-align: right;
padding-right: 6px;
font-family: sans-serif;
font-weight: bold;
vertical-align: top;
white-space: nowrap;
}
/* All views: header item value format */
td.headerValue
{
text-align: left;
color: #284FA8;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
}
/* All views: header item coverage table heading */
td.headerCovTableHead
{
text-align: center;
padding-right: 6px;
padding-left: 6px;
padding-bottom: 0px;
font-family: sans-serif;
font-size: 80%;
white-space: nowrap;
}
/* All views: header item coverage table entry */
td.headerCovTableEntry
{
text-align: right;
color: #284FA8;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
padding-left: 12px;
padding-right: 4px;
background-color: #DAE7FE;
}
/* All views: header item coverage table entry for high coverage rate */
td.headerCovTableEntryHi
{
text-align: right;
color: #000000;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
padding-left: 12px;
padding-right: 4px;
background-color: #A7FC9D;
}
/* All views: header item coverage table entry for medium coverage rate */
td.headerCovTableEntryMed
{
text-align: right;
color: #000000;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
padding-left: 12px;
padding-right: 4px;
background-color: #FFEA20;
}
/* All views: header item coverage table entry for ow coverage rate */
td.headerCovTableEntryLo
{
text-align: right;
color: #000000;
font-family: sans-serif;
font-weight: bold;
white-space: nowrap;
padding-left: 12px;
padding-right: 4px;
background-color: #FF0000;
}
/* All views: header legend value for legend entry */
td.headerValueLeg
{
text-align: left;
color: #000000;
font-family: sans-serif;
font-size: 80%;
white-space: nowrap;
padding-top: 4px;
}
/* All views: color of horizontal ruler */
td.ruler
{
background-color: #6688D4;
}
/* All views: version string format */
td.versionInfo
{
text-align: center;
padding-top: 2px;
font-family: sans-serif;
font-style: italic;
}
/* Directory view/File view (all)/Test case descriptions:
table headline format */
td.tableHead
{
text-align: center;
color: #FFFFFF;
background-color: #6688D4;
font-family: sans-serif;
font-size: 120%;
font-weight: bold;
white-space: nowrap;
padding-left: 4px;
padding-right: 4px;
}
span.tableHeadSort
{
padding-right: 4px;
}
/* Directory view/File view (all): filename entry format */
td.coverFile
{
text-align: left;
padding-left: 10px;
padding-right: 20px;
color: #284FA8;
background-color: #DAE7FE;
font-family: monospace;
}
/* Directory view/File view (all): bar-graph entry format*/
td.coverBar
{
padding-left: 10px;
padding-right: 10px;
background-color: #DAE7FE;
}
/* Directory view/File view (all): bar-graph outline color */
td.coverBarOutline
{
background-color: #000000;
}
/* Directory view/File view (all): percentage entry for files with
high coverage rate */
td.coverPerHi
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #A7FC9D;
font-weight: bold;
font-family: sans-serif;
}
/* Directory view/File view (all): line count entry for files with
high coverage rate */
td.coverNumHi
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #A7FC9D;
white-space: nowrap;
font-family: sans-serif;
}
/* Directory view/File view (all): percentage entry for files with
medium coverage rate */
td.coverPerMed
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #FFEA20;
font-weight: bold;
font-family: sans-serif;
}
/* Directory view/File view (all): line count entry for files with
medium coverage rate */
td.coverNumMed
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #FFEA20;
white-space: nowrap;
font-family: sans-serif;
}
/* Directory view/File view (all): percentage entry for files with
low coverage rate */
td.coverPerLo
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #FF0000;
font-weight: bold;
font-family: sans-serif;
}
/* Directory view/File view (all): line count entry for files with
low coverage rate */
td.coverNumLo
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #FF0000;
white-space: nowrap;
font-family: sans-serif;
}
/* File view (all): "show/hide details" link format */
a.detail:link
{
color: #B8D0FF;
font-size:80%;
}
/* File view (all): "show/hide details" link - visited format */
a.detail:visited
{
color: #B8D0FF;
font-size:80%;
}
/* File view (all): "show/hide details" link - activated format */
a.detail:active
{
color: #FFFFFF;
font-size:80%;
}
/* File view (detail): test name entry */
td.testName
{
text-align: right;
padding-right: 10px;
background-color: #DAE7FE;
font-family: sans-serif;
}
/* File view (detail): test percentage entry */
td.testPer
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #DAE7FE;
font-family: sans-serif;
}
/* File view (detail): test lines count entry */
td.testNum
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #DAE7FE;
font-family: sans-serif;
}
/* Test case descriptions: test name format*/
dt
{
font-family: sans-serif;
font-weight: bold;
}
/* Test case descriptions: description table body */
td.testDescription
{
padding-top: 10px;
padding-left: 30px;
padding-bottom: 10px;
padding-right: 30px;
background-color: #DAE7FE;
}
/* Source code view: function entry */
td.coverFn
{
text-align: left;
padding-left: 10px;
padding-right: 20px;
color: #284FA8;
background-color: #DAE7FE;
font-family: monospace;
}
/* Source code view: function entry zero count*/
td.coverFnLo
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #FF0000;
font-weight: bold;
font-family: sans-serif;
}
/* Source code view: function entry nonzero count*/
td.coverFnHi
{
text-align: right;
padding-left: 10px;
padding-right: 10px;
background-color: #DAE7FE;
font-weight: bold;
font-family: sans-serif;
}
/* Source code view: source code format */
pre.source
{
font-family: monospace;
white-space: pre;
margin-top: 2px;
}
/* Source code view: line number format */
span.lineNum
{
background-color: #EFE383;
}
/* Source code view: format for lines which were executed */
td.lineCov,
span.lineCov
{
background-color: #CAD7FE;
}
/* Source code view: format for Cov legend */
span.coverLegendCov
{
padding-left: 10px;
padding-right: 10px;
padding-bottom: 2px;
background-color: #CAD7FE;
}
/* Source code view: format for lines which were not executed */
td.lineNoCov,
span.lineNoCov
{
background-color: #FF6230;
}
/* Source code view: format for NoCov legend */
span.coverLegendNoCov
{
padding-left: 10px;
padding-right: 10px;
padding-bottom: 2px;
background-color: #FF6230;
}
/* Source code view (function table): standard link - visited format */
td.lineNoCov > a:visited,
td.lineCov > a:visited
{
color: black;
text-decoration: underline;
}
/* Source code view: format for lines which were executed only in a
previous version */
span.lineDiffCov
{
background-color: #B5F7AF;
}
/* Source code view: format for branches which were executed
* and taken */
span.branchCov
{
background-color: #CAD7FE;
}
/* Source code view: format for branches which were executed
* but not taken */
span.branchNoCov
{
background-color: #FF6230;
}
/* Source code view: format for branches which were not executed */
span.branchNoExec
{
background-color: #FF6230;
}
/* Source code view: format for the source code heading line */
pre.sourceHeading
{
white-space: pre;
font-family: monospace;
font-weight: bold;
margin: 0px;
}
/* All views: header legend value for low rate */
td.headerValueLegL
{
font-family: sans-serif;
text-align: center;
white-space: nowrap;
padding-left: 4px;
padding-right: 2px;
background-color: #FF0000;
font-size: 80%;
}
/* All views: header legend value for med rate */
td.headerValueLegM
{
font-family: sans-serif;
text-align: center;
white-space: nowrap;
padding-left: 2px;
padding-right: 2px;
background-color: #FFEA20;
font-size: 80%;
}
/* All views: header legend value for hi rate */
td.headerValueLegH
{
font-family: sans-serif;
text-align: center;
white-space: nowrap;
padding-left: 2px;
padding-right: 4px;
background-color: #A7FC9D;
font-size: 80%;
}
/* All views except source code view: legend format for low coverage */
span.coverLegendCovLo
{
padding-left: 10px;
padding-right: 10px;
padding-top: 2px;
background-color: #FF0000;
}
/* All views except source code view: legend format for med coverage */
span.coverLegendCovMed
{
padding-left: 10px;
padding-right: 10px;
padding-top: 2px;
background-color: #FFEA20;
}
/* All views except source code view: legend format for hi coverage */
span.coverLegendCovHi
{
padding-left: 10px;
padding-right: 10px;
padding-top: 2px;
background-color: #A7FC9D;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

@ -0,0 +1,107 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info</title>
<link rel="stylesheet" type="text/css" href="gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue">top level</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Directory <span class="tableHeadSort"><a href="index.html"><img src="updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></span></td>
</tr>
<tr>
<td class="coverFile"><a href="terminal-stg/index.html">terminal-stg</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1501 / 1501</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">112 / 112</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">623 / 623</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,107 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info</title>
<link rel="stylesheet" type="text/css" href="gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue">top level</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Directory <span class="tableHeadSort"><a href="index.html"><img src="updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="terminal-stg/index.html">terminal-stg</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1501 / 1501</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">112 / 112</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">623 / 623</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,107 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info</title>
<link rel="stylesheet" type="text/css" href="gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue">top level</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Directory <span class="tableHeadSort"><a href="index.html"><img src="updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="terminal-stg/index.html">terminal-stg</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1501 / 1501</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">112 / 112</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">623 / 623</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,107 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info</title>
<link rel="stylesheet" type="text/css" href="gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue">top level</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Directory <span class="tableHeadSort"><img src="glass.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="terminal-stg/index.html">terminal-stg</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1501 / 1501</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">112 / 112</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">623 / 623</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 B

@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/constants.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - constants.h<span style="font-size: 80%;"> (<a href="constants.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntryHi">-</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><a href="constants.h.func.html"><img src="../updown.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></a></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="constants.h.gcov.html#125">_Z14init_constantsv</a></td>
<td class="coverFnHi">1</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,85 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/constants.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - constants.h<span style="font-size: 80%;"> (<a href="constants.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntryHi">-</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><a href="constants.h.func-sort-c.html"><img src="../updown.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="constants.h.gcov.html#125">_Z14init_constantsv</a></td>
<td class="coverFnHi">1</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,294 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/constants.h</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - constants.h<span style="font-size: 80%;"> (source / <a href="constants.h.func-sort-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntry">77</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntry">1</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntry">0</td>
<td class="headerCovTableEntryHi">-</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Branch data Line data Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum"> 1 </span> : : // constants for both server and client</a>
<a name="2"><span class="lineNum"> 2 </span> : : #ifndef CONSTANTS_H</a>
<a name="3"><span class="lineNum"> 3 </span> : : #define CONSTANTS_H</a>
<a name="4"><span class="lineNum"> 4 </span> : : </a>
<a name="5"><span class="lineNum"> 5 </span> : : #define SCR_W 80</a>
<a name="6"><span class="lineNum"> 6 </span> : : #define SCR_H 23</a>
<a name="7"><span class="lineNum"> 7 </span> : : </a>
<a name="8"><span class="lineNum"> 8 </span> : : #define BATTLE_W 60</a>
<a name="9"><span class="lineNum"> 9 </span> : : #define BATTLE_H (SCR_H - 2)</a>
<a name="10"><span class="lineNum"> 10 </span> : : </a>
<a name="11"><span class="lineNum"> 11 </span> : : #define FFA_MAP_W BATTLE_W</a>
<a name="12"><span class="lineNum"> 12 </span> : : #define FFA_MAP_H BATTLE_H</a>
<a name="13"><span class="lineNum"> 13 </span> : : </a>
<a name="14"><span class="lineNum"> 14 </span> : : #define IPADDR_SIZE 24</a>
<a name="15"><span class="lineNum"> 15 </span> : : #define USERNAME_SIZE 12</a>
<a name="16"><span class="lineNum"> 16 </span> : : #define MSG_SIZE 96</a>
<a name="17"><span class="lineNum"> 17 </span> : : #define USER_CNT 14</a>
<a name="18"><span class="lineNum"> 18 </span> : : </a>
<a name="19"><span class="lineNum"> 19 </span> : : #define LANDMINE_COST 12</a>
<a name="20"><span class="lineNum"> 20 </span> : : </a>
<a name="21"><span class="lineNum"> 21 </span> : : #define INF 1e9</a>
<a name="22"><span class="lineNum"> 22 </span> : : </a>
<a name="23"><span class="lineNum"> 23 </span> : : #define PASSWORD_SIZE USERNAME_SIZE</a>
<a name="24"><span class="lineNum"> 24 </span> : : </a>
<a name="25"><span class="lineNum"> 25 </span> : : enum {</a>
<a name="26"><span class="lineNum"> 26 </span> : : ITEM_NONE,</a>
<a name="27"><span class="lineNum"> 27 </span> : : ITEM_MAGAZINE,</a>
<a name="28"><span class="lineNum"> 28 </span> : : ITEM_MAGMA,</a>
<a name="29"><span class="lineNum"> 29 </span> : : ITEM_GRASS,</a>
<a name="30"><span class="lineNum"> 30 </span> : : ITEM_BLOOD_VIAL,</a>
<a name="31"><span class="lineNum"> 31 </span> : : ITEM_END,</a>
<a name="32"><span class="lineNum"> 32 </span> : : ITEM_BULLET,</a>
<a name="33"><span class="lineNum"> 33 </span> : : ITEM_LANDMINE,</a>
<a name="34"><span class="lineNum"> 34 </span> : : ITEM_SIZE, // make it on the end!</a>
<a name="35"><span class="lineNum"> 35 </span> : : };</a>
<a name="36"><span class="lineNum"> 36 </span> : : </a>
<a name="37"><span class="lineNum"> 37 </span> : : enum {</a>
<a name="38"><span class="lineNum"> 38 </span> : : MAP_ITEM_NONE,</a>
<a name="39"><span class="lineNum"> 39 </span> : : MAP_ITEM_MY_BULLET,</a>
<a name="40"><span class="lineNum"> 40 </span> : : MAP_ITEM_OTHER_BULLET,</a>
<a name="41"><span class="lineNum"> 41 </span> : : MAP_ITEM_MAGAZINE,</a>
<a name="42"><span class="lineNum"> 42 </span> : : MAP_ITEM_BLOOD_VIAL,</a>
<a name="43"><span class="lineNum"> 43 </span> : : MAP_ITEM_MAGMA,</a>
<a name="44"><span class="lineNum"> 44 </span> : : MAP_ITEM_USER,</a>
<a name="45"><span class="lineNum"> 45 </span> : : MAP_ITEM_OTHER_USER,</a>
<a name="46"><span class="lineNum"> 46 </span> : : MAP_ITEM_GRASS,</a>
<a name="47"><span class="lineNum"> 47 </span> : : MAP_ITEM_LANDMINE,</a>
<a name="48"><span class="lineNum"> 48 </span> : : MAP_ITEM_END,</a>
<a name="49"><span class="lineNum"> 49 </span> : : };</a>
<a name="50"><span class="lineNum"> 50 </span> : : </a>
<a name="51"><span class="lineNum"> 51 </span> : : enum {</a>
<a name="52"><span class="lineNum"> 52 </span> : : DIR_UP,</a>
<a name="53"><span class="lineNum"> 53 </span> : : DIR_DOWN,</a>
<a name="54"><span class="lineNum"> 54 </span> : : DIR_LEFT,</a>
<a name="55"><span class="lineNum"> 55 </span> : : DIR_RIGHT,</a>
<a name="56"><span class="lineNum"> 56 </span> : : DIR_UP_LEFT,</a>
<a name="57"><span class="lineNum"> 57 </span> : : DIR_UP_RIGHT,</a>
<a name="58"><span class="lineNum"> 58 </span> : : DIR_DOWN_LEFT,</a>
<a name="59"><span class="lineNum"> 59 </span> : : DIR_DOWN_RIGHT,</a>
<a name="60"><span class="lineNum"> 60 </span> : : };</a>
<a name="61"><span class="lineNum"> 61 </span> : : </a>
<a name="62"><span class="lineNum"> 62 </span> : : enum {</a>
<a name="63"><span class="lineNum"> 63 </span> : : BATTLE_STATE_UNJOINED,</a>
<a name="64"><span class="lineNum"> 64 </span> : : BATTLE_STATE_LIVE,</a>
<a name="65"><span class="lineNum"> 65 </span> : : BATTLE_STATE_WITNESS,</a>
<a name="66"><span class="lineNum"> 66 </span> : : BATTLE_STATE_DEAD,</a>
<a name="67"><span class="lineNum"> 67 </span> : : };</a>
<a name="68"><span class="lineNum"> 68 </span> : : </a>
<a name="69"><span class="lineNum"> 69 </span> : : /* unused --&gt; not login --&gt; login &lt;-...-&gt; battle</a>
<a name="70"><span class="lineNum"> 70 </span> : : *</a>
<a name="71"><span class="lineNum"> 71 </span> : : * unused --&gt; not login --&gt; unused // login fail</a>
<a name="72"><span class="lineNum"> 72 </span> : : *</a>
<a name="73"><span class="lineNum"> 73 </span> : : * login &lt;--&gt; invited to battle &lt;--&gt; battle</a>
<a name="74"><span class="lineNum"> 74 </span> : : * */</a>
<a name="75"><span class="lineNum"> 75 </span> : : #define USER_STATE_UNUSED 0</a>
<a name="76"><span class="lineNum"> 76 </span> : : #define USER_STATE_NOT_LOGIN 1</a>
<a name="77"><span class="lineNum"> 77 </span> : : #define USER_STATE_LOGIN 2</a>
<a name="78"><span class="lineNum"> 78 </span> : : #define USER_STATE_BATTLE 3</a>
<a name="79"><span class="lineNum"> 79 </span> : : #define USER_STATE_WAIT_TO_BATTLE 4</a>
<a name="80"><span class="lineNum"> 80 </span> : : </a>
<a name="81"><span class="lineNum"> 81 </span> : : #define BLACK &quot;\e[0;30m&quot;</a>
<a name="82"><span class="lineNum"> 82 </span> : : #define L_BLACK &quot;\e[1;30m&quot;</a>
<a name="83"><span class="lineNum"> 83 </span> : : #define RED &quot;\e[0;31m&quot;</a>
<a name="84"><span class="lineNum"> 84 </span> : : #define L_RED &quot;\e[1;31m&quot;</a>
<a name="85"><span class="lineNum"> 85 </span> : : #define GREEN &quot;\e[0;32m&quot;</a>
<a name="86"><span class="lineNum"> 86 </span> : : #define L_GREEN &quot;\e[1;32m&quot;</a>
<a name="87"><span class="lineNum"> 87 </span> : : #define BROWN &quot;\e[0;33m&quot;</a>
<a name="88"><span class="lineNum"> 88 </span> : : #define YELLOW &quot;\e[1;33m&quot;</a>
<a name="89"><span class="lineNum"> 89 </span> : : #define BLUE &quot;\e[0;34m&quot;</a>
<a name="90"><span class="lineNum"> 90 </span> : : #define L_BLUE &quot;\e[1;34m&quot;</a>
<a name="91"><span class="lineNum"> 91 </span> : : #define PURPLE &quot;\e[0;35m&quot;</a>
<a name="92"><span class="lineNum"> 92 </span> : : #define L_PURPLE &quot;\e[1;35m&quot;</a>
<a name="93"><span class="lineNum"> 93 </span> : : #define CYAN &quot;\e[0;36m&quot;</a>
<a name="94"><span class="lineNum"> 94 </span> : : #define L_CYAN &quot;\e[1;36m&quot;</a>
<a name="95"><span class="lineNum"> 95 </span> : : #define GRAY &quot;\e[0;37m&quot;</a>
<a name="96"><span class="lineNum"> 96 </span> : : #define WHITE &quot;\e[1;37m&quot;</a>
<a name="97"><span class="lineNum"> 97 </span> : : #define BOLD &quot;\e[1m&quot;</a>
<a name="98"><span class="lineNum"> 98 </span> : : #define UNDERLINE &quot;\e[4m&quot;</a>
<a name="99"><span class="lineNum"> 99 </span> : : #define BLINK &quot;\e[5m&quot;</a>
<a name="100"><span class="lineNum"> 100 </span> : : #define REVERSE &quot;\e[7m&quot;</a>
<a name="101"><span class="lineNum"> 101 </span> : : #define HIDE &quot;\e[8m&quot;</a>
<a name="102"><span class="lineNum"> 102 </span> : : #define CLEAR &quot;\e[2J&quot;</a>
<a name="103"><span class="lineNum"> 103 </span> : : #define CLRLINE &quot;\r\e[K&quot;</a>
<a name="104"><span class="lineNum"> 104 </span> : : #define NONE &quot;\e[0m&quot;</a>
<a name="105"><span class="lineNum"> 105 </span> : : </a>
<a name="106"><span class="lineNum"> 106 </span> : : char* signal_name_s[128];</a>
<a name="107"><span class="lineNum"> 107 </span> : : char* color_s[128];</a>
<a name="108"><span class="lineNum"> 108 </span> : : char* map_s[128];</a>
<a name="109"><span class="lineNum"> 109 </span> : : char* item_s[128];</a>
<a name="110"><span class="lineNum"> 110 </span> : : char* dir_s[128];</a>
<a name="111"><span class="lineNum"> 111 </span> : : int item_to_map[128];</a>
<a name="112"><span class="lineNum"> 112 </span> : : int color_s_size;</a>
<a name="113"><span class="lineNum"> 113 </span> : : struct point_t {</a>
<a name="114"><span class="lineNum"> 114 </span> : : int x, y;</a>
<a name="115"><span class="lineNum"> 115 </span> : : };</a>
<a name="116"><span class="lineNum"> 116 </span> : : point_t dir_offset[] = {</a>
<a name="117"><span class="lineNum"> 117 </span> : : [DIR_UP] = {0, -1},</a>
<a name="118"><span class="lineNum"> 118 </span> : : [DIR_DOWN] = {0, 1},</a>
<a name="119"><span class="lineNum"> 119 </span> : : [DIR_LEFT] = {-1, 0},</a>
<a name="120"><span class="lineNum"> 120 </span> : : [DIR_RIGHT] = {1, 0},</a>
<a name="121"><span class="lineNum"> 121 </span> : : [DIR_UP_LEFT] = {-1, -1},</a>
<a name="122"><span class="lineNum"> 122 </span> : : [DIR_UP_RIGHT] = {1, -1},</a>
<a name="123"><span class="lineNum"> 123 </span> : : [DIR_DOWN_LEFT] = {-1, 1},</a>
<a name="124"><span class="lineNum"> 124 </span> : : [DIR_DOWN_RIGHT] = {1, 1},</a>
<a name="125"><span class="lineNum"> 125 </span> : : };</a>
<a name="126"><span class="lineNum"> 126 </span> : : </a>
<a name="127"><span class="lineNum"> 127 </span> :<span class="lineCov"> 1 : void init_constants() {</span></a>
<a name="128"><span class="lineNum"> 128 </span> :<span class="lineCov"> 1 : item_s[ITEM_NONE] = (char*)&quot;none&quot;;</span></a>
<a name="129"><span class="lineNum"> 129 </span> :<span class="lineCov"> 1 : item_s[ITEM_MAGAZINE] = (char*)&quot;magazine&quot;;</span></a>
<a name="130"><span class="lineNum"> 130 </span> :<span class="lineCov"> 1 : item_s[ITEM_MAGMA] = (char*)&quot;magma&quot;;</span></a>
<a name="131"><span class="lineNum"> 131 </span> :<span class="lineCov"> 1 : item_s[ITEM_GRASS] = (char*)&quot;grass&quot;;</span></a>
<a name="132"><span class="lineNum"> 132 </span> :<span class="lineCov"> 1 : item_s[ITEM_BLOOD_VIAL] = (char*)&quot;blood_vial&quot;;</span></a>
<a name="133"><span class="lineNum"> 133 </span> :<span class="lineCov"> 1 : item_s[ITEM_END] = (char*)&quot;end&quot;;</span></a>
<a name="134"><span class="lineNum"> 134 </span> :<span class="lineCov"> 1 : item_s[ITEM_BULLET] = (char*)&quot;bullet&quot;;</span></a>
<a name="135"><span class="lineNum"> 135 </span> :<span class="lineCov"> 1 : item_s[ITEM_LANDMINE] = (char*)&quot;landmine&quot;;</span></a>
<a name="136"><span class="lineNum"> 136 </span> : : </a>
<a name="137"><span class="lineNum"> 137 </span> :<span class="lineCov"> 1 : dir_s[DIR_UP] = (char*)&quot;up&quot;;</span></a>
<a name="138"><span class="lineNum"> 138 </span> :<span class="lineCov"> 1 : dir_s[DIR_DOWN] = (char*)&quot;down&quot;;</span></a>
<a name="139"><span class="lineNum"> 139 </span> :<span class="lineCov"> 1 : dir_s[DIR_LEFT] = (char*)&quot;left&quot;;</span></a>
<a name="140"><span class="lineNum"> 140 </span> :<span class="lineCov"> 1 : dir_s[DIR_RIGHT] = (char*)&quot;right&quot;;</span></a>
<a name="141"><span class="lineNum"> 141 </span> :<span class="lineCov"> 1 : dir_s[DIR_UP_LEFT] = (char*)&quot;up&amp;left&quot;;</span></a>
<a name="142"><span class="lineNum"> 142 </span> :<span class="lineCov"> 1 : dir_s[DIR_UP_RIGHT] = (char*)&quot;up&amp;right&quot;;</span></a>
<a name="143"><span class="lineNum"> 143 </span> :<span class="lineCov"> 1 : dir_s[DIR_DOWN_LEFT] = (char*)&quot;down&amp;left&quot;;</span></a>
<a name="144"><span class="lineNum"> 144 </span> :<span class="lineCov"> 1 : dir_s[DIR_DOWN_RIGHT] = (char*)&quot;down&amp;right&quot;;</span></a>
<a name="145"><span class="lineNum"> 145 </span> : : </a>
<a name="146"><span class="lineNum"> 146 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_NONE] = (char*)&quot; &quot;;</span></a>
<a name="147"><span class="lineNum"> 147 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_MAGAZINE] = (char*)&quot;+&quot;;</span></a>
<a name="148"><span class="lineNum"> 148 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_MAGMA] = (char*)&quot;X&quot;;</span></a>
<a name="149"><span class="lineNum"> 149 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_GRASS] = (char*)&quot;\033[2;37m█\033[0m&quot;;</span></a>
<a name="150"><span class="lineNum"> 150 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_BLOOD_VIAL] = (char*)&quot;*&quot;;</span></a>
<a name="151"><span class="lineNum"> 151 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_MY_BULLET] = (char*)&quot;.&quot;;</span></a>
<a name="152"><span class="lineNum"> 152 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_OTHER_BULLET] = (char*)&quot;.&quot;;</span></a>
<a name="153"><span class="lineNum"> 153 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_USER] = (char*)&quot;A&quot;;</span></a>
<a name="154"><span class="lineNum"> 154 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_LANDMINE] = (char*)&quot;o&quot;;</span></a>
<a name="155"><span class="lineNum"> 155 </span> :<span class="lineCov"> 1 : map_s[MAP_ITEM_END] = (char*)&quot; &quot;;</span></a>
<a name="156"><span class="lineNum"> 156 </span> : : </a>
<a name="157"><span class="lineNum"> 157 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_NONE] = MAP_ITEM_NONE;</span></a>
<a name="158"><span class="lineNum"> 158 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_MAGAZINE] = MAP_ITEM_MAGAZINE;</span></a>
<a name="159"><span class="lineNum"> 159 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_MAGMA] = MAP_ITEM_MAGMA;</span></a>
<a name="160"><span class="lineNum"> 160 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_GRASS] = MAP_ITEM_GRASS;</span></a>
<a name="161"><span class="lineNum"> 161 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_BLOOD_VIAL] = MAP_ITEM_BLOOD_VIAL;</span></a>
<a name="162"><span class="lineNum"> 162 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_LANDMINE] = MAP_ITEM_LANDMINE;</span></a>
<a name="163"><span class="lineNum"> 163 </span> :<span class="lineCov"> 1 : item_to_map[ITEM_END] = MAP_ITEM_END;</span></a>
<a name="164"><span class="lineNum"> 164 </span> : : </a>
<a name="165"><span class="lineNum"> 165 </span> :<span class="lineCov"> 1 : signal_name_s[SIGHUP ] = (char*)&quot;SIGHUP&quot;;</span></a>
<a name="166"><span class="lineNum"> 166 </span> :<span class="lineCov"> 1 : signal_name_s[SIGINT ] = (char*)&quot;SIGINT&quot;;</span></a>
<a name="167"><span class="lineNum"> 167 </span> :<span class="lineCov"> 1 : signal_name_s[SIGQUIT ] = (char*)&quot;SIGQUIT&quot;;</span></a>
<a name="168"><span class="lineNum"> 168 </span> :<span class="lineCov"> 1 : signal_name_s[SIGILL ] = (char*)&quot;SIGILL&quot; ;</span></a>
<a name="169"><span class="lineNum"> 169 </span> :<span class="lineCov"> 1 : signal_name_s[SIGABRT ] = (char*)&quot;SIGABRT&quot;;</span></a>
<a name="170"><span class="lineNum"> 170 </span> :<span class="lineCov"> 1 : signal_name_s[SIGFPE ] = (char*)&quot;SIGFPE&quot; ;</span></a>
<a name="171"><span class="lineNum"> 171 </span> :<span class="lineCov"> 1 : signal_name_s[SIGKILL ] = (char*)&quot;SIGKILL&quot;;</span></a>
<a name="172"><span class="lineNum"> 172 </span> :<span class="lineCov"> 1 : signal_name_s[SIGSEGV ] = (char*)&quot;SIGSEGV&quot;;</span></a>
<a name="173"><span class="lineNum"> 173 </span> :<span class="lineCov"> 1 : signal_name_s[SIGPIPE ] = (char*)&quot;SIGPIPE&quot;;</span></a>
<a name="174"><span class="lineNum"> 174 </span> :<span class="lineCov"> 1 : signal_name_s[SIGALRM ] = (char*)&quot;SIGALRM&quot;;</span></a>
<a name="175"><span class="lineNum"> 175 </span> :<span class="lineCov"> 1 : signal_name_s[SIGTERM ] = (char*)&quot;SIGTERM&quot;;</span></a>
<a name="176"><span class="lineNum"> 176 </span> :<span class="lineCov"> 1 : signal_name_s[SIGUSR1 ] = (char*)&quot;SIGUSR1&quot;;</span></a>
<a name="177"><span class="lineNum"> 177 </span> :<span class="lineCov"> 1 : signal_name_s[SIGUSR2 ] = (char*)&quot;SIGUSR2&quot;;</span></a>
<a name="178"><span class="lineNum"> 178 </span> :<span class="lineCov"> 1 : signal_name_s[SIGCHLD ] = (char*)&quot;SIGCHLD&quot;;</span></a>
<a name="179"><span class="lineNum"> 179 </span> :<span class="lineCov"> 1 : signal_name_s[SIGCONT ] = (char*)&quot;SIGCONT&quot;;</span></a>
<a name="180"><span class="lineNum"> 180 </span> :<span class="lineCov"> 1 : signal_name_s[SIGSTOP ] = (char*)&quot;SIGSTOP&quot;;</span></a>
<a name="181"><span class="lineNum"> 181 </span> :<span class="lineCov"> 1 : signal_name_s[SIGTSTP ] = (char*)&quot;SIGTSTP&quot;;</span></a>
<a name="182"><span class="lineNum"> 182 </span> :<span class="lineCov"> 1 : signal_name_s[SIGTTIN ] = (char*)&quot;SIGTTIN&quot;;</span></a>
<a name="183"><span class="lineNum"> 183 </span> :<span class="lineCov"> 1 : signal_name_s[SIGTTOU ] = (char*)&quot;SIGTTOU&quot;;</span></a>
<a name="184"><span class="lineNum"> 184 </span> :<span class="lineCov"> 1 : signal_name_s[SIGBUS ] = (char*)&quot;SIGBUS&quot; ;</span></a>
<a name="185"><span class="lineNum"> 185 </span> :<span class="lineCov"> 1 : signal_name_s[SIGPOLL ] = (char*)&quot;SIGPOLL&quot;;</span></a>
<a name="186"><span class="lineNum"> 186 </span> :<span class="lineCov"> 1 : signal_name_s[SIGPROF ] = (char*)&quot;SIGPROF&quot;;</span></a>
<a name="187"><span class="lineNum"> 187 </span> :<span class="lineCov"> 1 : signal_name_s[SIGSYS ] = (char*)&quot;SIGSYS&quot; ;</span></a>
<a name="188"><span class="lineNum"> 188 </span> :<span class="lineCov"> 1 : signal_name_s[SIGTRAP ] = (char*)&quot;SIGTRAP&quot;;</span></a>
<a name="189"><span class="lineNum"> 189 </span> :<span class="lineCov"> 1 : signal_name_s[SIGURG ] = (char*)&quot;SIGURG&quot; ;</span></a>
<a name="190"><span class="lineNum"> 190 </span> :<span class="lineCov"> 1 : signal_name_s[SIGVTALRM] = (char*)&quot;SIGVTALRM&quot;;</span></a>
<a name="191"><span class="lineNum"> 191 </span> :<span class="lineCov"> 1 : signal_name_s[SIGXCPU ] = (char*)&quot;SIGXCPU&quot;;</span></a>
<a name="192"><span class="lineNum"> 192 </span> :<span class="lineCov"> 1 : signal_name_s[SIGXFSZ ] = (char*)&quot;SIGXFSZ&quot;;</span></a>
<a name="193"><span class="lineNum"> 193 </span> :<span class="lineCov"> 1 : color_s[0] = (char*)NONE;</span></a>
<a name="194"><span class="lineNum"> 194 </span> :<span class="lineCov"> 1 : color_s[1] = (char*)L_GREEN;</span></a>
<a name="195"><span class="lineNum"> 195 </span> :<span class="lineCov"> 1 : color_s[2] = (char*)L_RED;</span></a>
<a name="196"><span class="lineNum"> 196 </span> :<span class="lineCov"> 1 : color_s[3] = (char*)YELLOW;</span></a>
<a name="197"><span class="lineNum"> 197 </span> :<span class="lineCov"> 1 : color_s[4] = (char*)L_BLUE;</span></a>
<a name="198"><span class="lineNum"> 198 </span> :<span class="lineCov"> 1 : color_s[5] = (char*)L_PURPLE;</span></a>
<a name="199"><span class="lineNum"> 199 </span> :<span class="lineCov"> 1 : color_s[6] = (char*)L_CYAN;</span></a>
<a name="200"><span class="lineNum"> 200 </span> :<span class="lineCov"> 1 : color_s[7] = (char*)(RED UNDERLINE);</span></a>
<a name="201"><span class="lineNum"> 201 </span> :<span class="lineCov"> 1 : color_s[8] = (char*)(GREEN UNDERLINE);</span></a>
<a name="202"><span class="lineNum"> 202 </span> :<span class="lineCov"> 1 : color_s[9] = (char*)(BROWN UNDERLINE);</span></a>
<a name="203"><span class="lineNum"> 203 </span> :<span class="lineCov"> 1 : color_s[10] = (char*)(BLUE UNDERLINE);</span></a>
<a name="204"><span class="lineNum"> 204 </span> :<span class="lineCov"> 1 : color_s[11] = (char*)(PURPLE UNDERLINE);</span></a>
<a name="205"><span class="lineNum"> 205 </span> :<span class="lineCov"> 1 : color_s[12] = (char*)(CYAN UNDERLINE);</span></a>
<a name="206"><span class="lineNum"> 206 </span> :<span class="lineCov"> 1 : color_s_size = 12;</span></a>
<a name="207"><span class="lineNum"> 207 </span> :<span class="lineCov"> 1 : };</span></a>
<a name="208"><span class="lineNum"> 208 </span> : : </a>
<a name="209"><span class="lineNum"> 209 </span> : : #endif</a>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,101 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/func.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - func.h<span style="font-size: 80%;"> (<a href="func.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><a href="func.h.func.html"><img src="../updown.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></a></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#12">_Z11probabilityii</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#4">_Z3minii</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#8">_Z3maxii</a></td>
<td class="coverFnHi">17</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#22">_Z7sformatPKcz</a></td>
<td class="coverFnHi">66</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#16">_Z7myclockv</a></td>
<td class="coverFnHi">7002</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,101 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/func.h - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - func.h<span style="font-size: 80%;"> (<a href="func.h.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><a href="func.h.func-sort-c.html"><img src="../updown.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#12">_Z11probabilityii</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#8">_Z3maxii</a></td>
<td class="coverFnHi">17</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#4">_Z3minii</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#16">_Z7myclockv</a></td>
<td class="coverFnHi">7002</td>
</tr>
<tr>
<td class="coverFn"><a href="func.h.gcov.html#22">_Z7sformatPKcz</a></td>
<td class="coverFnHi">66</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,126 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/func.h</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - func.h<span style="font-size: 80%;"> (source / <a href="func.h.func-sort-c.html">functions</a>)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntry">14</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntry">5</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntry">4</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td><br></td>
</tr>
<tr>
<td>
<pre class="sourceHeading"> Branch data Line data Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum"> 1 </span> : : #ifndef FUNC_H</a>
<a name="2"><span class="lineNum"> 2 </span> : : #define FUNC_H</a>
<a name="3"><span class="lineNum"> 3 </span> : : </a>
<a name="4"><span class="lineNum"> 4 </span> : : #include &lt;sys/time.h&gt;</a>
<a name="5"><span class="lineNum"> 5 </span> : : </a>
<a name="6"><span class="lineNum"> 6 </span> :<span class="lineCov"> 4 : int min(int a, int b) {</span></a>
<a name="7"><span class="lineNum"> 7 </span> [<span class="branchCov" title="Branch 0 was taken 1 time"> + </span><span class="branchCov" title="Branch 1 was taken 3 times"> + </span>]:<span class="lineCov"> 4 : return a &lt; b ? a : b;</span></a>
<a name="8"><span class="lineNum"> 8 </span> : : }</a>
<a name="9"><span class="lineNum"> 9 </span> : : </a>
<a name="10"><span class="lineNum"> 10 </span> :<span class="lineCov"> 17 : int max(int a, int b) {</span></a>
<a name="11"><span class="lineNum"> 11 </span> [<span class="branchCov" title="Branch 0 was taken 3 times"> + </span><span class="branchCov" title="Branch 1 was taken 14 times"> + </span>]:<span class="lineCov"> 17 : return a &gt; b ? a : b;</span></a>
<a name="12"><span class="lineNum"> 12 </span> : : }</a>
<a name="13"><span class="lineNum"> 13 </span> : : </a>
<a name="14"><span class="lineNum"> 14 </span> :<span class="lineCov"> 1 : bool probability(int x, int y) {</span></a>
<a name="15"><span class="lineNum"> 15 </span> :<span class="lineCov"> 1 : return (rand() % y) &lt;= (x - 1);</span></a>
<a name="16"><span class="lineNum"> 16 </span> : : }</a>
<a name="17"><span class="lineNum"> 17 </span> : : </a>
<a name="18"><span class="lineNum"> 18 </span> :<span class="lineCov"> 7002 : uint64_t myclock() {</span></a>
<a name="19"><span class="lineNum"> 19 </span> : : struct timeval tv;</a>
<a name="20"><span class="lineNum"> 20 </span> :<span class="lineCov"> 7002 : gettimeofday(&amp;tv, NULL);</span></a>
<a name="21"><span class="lineNum"> 21 </span> :<span class="lineCov"> 7002 : return tv.tv_sec * 1000 + tv.tv_usec / 1000;</span></a>
<a name="22"><span class="lineNum"> 22 </span> : : }</a>
<a name="23"><span class="lineNum"> 23 </span> : : </a>
<a name="24"><span class="lineNum"> 24 </span> :<span class="lineCov"> 66 : char* sformat(const char* format, ...) {</span></a>
<a name="25"><span class="lineNum"> 25 </span> : : static char text[1024];</a>
<a name="26"><span class="lineNum"> 26 </span> : : </a>
<a name="27"><span class="lineNum"> 27 </span> : : va_list ap;</a>
<a name="28"><span class="lineNum"> 28 </span> :<span class="lineCov"> 66 : va_start(ap, format);</span></a>
<a name="29"><span class="lineNum"> 29 </span> :<span class="lineCov"> 66 : int len = vsprintf(text, format, ap);</span></a>
<a name="30"><span class="lineNum"> 30 </span> :<span class="lineCov"> 66 : va_end(ap);</span></a>
<a name="31"><span class="lineNum"> 31 </span> : : </a>
<a name="32"><span class="lineNum"> 32 </span> : : </a>
<a name="33"><span class="lineNum"> 33 </span> : : /*</a>
<a name="34"><span class="lineNum"> 34 </span> : : if (len &gt;= (int)sizeof(text)){</a>
<a name="35"><span class="lineNum"> 35 </span> : : eprintf(&quot;buffer overflow\n&quot;);</a>
<a name="36"><span class="lineNum"> 36 </span> : : }</a>
<a name="37"><span class="lineNum"> 37 </span> : : */</a>
<a name="38"><span class="lineNum"> 38 </span> :<span class="lineCov"> 66 : return text;</span></a>
<a name="39"><span class="lineNum"> 39 </span> : : }</a>
<a name="40"><span class="lineNum"> 40 </span> : : </a>
<a name="41"><span class="lineNum"> 41 </span> : : #endif</a>
</pre>
</td>
</tr>
</table>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,131 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - terminal-stg</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Filename <span class="tableHeadSort"><a href="index.html"><img src="../updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="../updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="../updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></span></td>
</tr>
<tr>
<td class="coverFile"><a href="constants.h.gcov.html">constants.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">77 / 77</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1 / 1</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="func.h.gcov.html">func.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">14 / 14</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">5 / 5</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">4 / 4</td>
</tr>
<tr>
<td class="coverFile"><a href="server.cpp.gcov.html">server.cpp</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1410 / 1410</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">106 / 106</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">619 / 619</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,131 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - terminal-stg</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Filename <span class="tableHeadSort"><a href="index.html"><img src="../updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="../updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="../updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="constants.h.gcov.html">constants.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">77 / 77</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1 / 1</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="func.h.gcov.html">func.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">14 / 14</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">5 / 5</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">4 / 4</td>
</tr>
<tr>
<td class="coverFile"><a href="server.cpp.gcov.html">server.cpp</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1410 / 1410</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">106 / 106</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">619 / 619</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,131 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - terminal-stg</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Filename <span class="tableHeadSort"><a href="index.html"><img src="../updown.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></a></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="../updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="../updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="func.h.gcov.html">func.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">14 / 14</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">5 / 5</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">4 / 4</td>
</tr>
<tr>
<td class="coverFile"><a href="constants.h.gcov.html">constants.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">77 / 77</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1 / 1</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="server.cpp.gcov.html">server.cpp</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1410 / 1410</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">106 / 106</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">619 / 619</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,131 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - terminal-stg</td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntry">1501</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntry">112</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntry">623</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="80%" cellpadding=1 cellspacing=1 border=0>
<tr>
<td width="44%"><br></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
<td width="8%"></td>
</tr>
<tr>
<td class="tableHead">Filename <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by name" title="Sort by name" border=0></span></td>
<td class="tableHead" colspan=3>Line Coverage <span class="tableHeadSort"><a href="index-sort-l.html"><img src="../updown.png" width=10 height=14 alt="Sort by line coverage" title="Sort by line coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Functions <span class="tableHeadSort"><a href="index-sort-f.html"><img src="../updown.png" width=10 height=14 alt="Sort by function coverage" title="Sort by function coverage" border=0></a></span></td>
<td class="tableHead" colspan=2>Branches <span class="tableHeadSort"><a href="index-sort-b.html"><img src="../updown.png" width=10 height=14 alt="Sort by branch coverage" title="Sort by branch coverage" border=0></a></span></td>
</tr>
<tr>
<td class="coverFile"><a href="constants.h.gcov.html">constants.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">77 / 77</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1 / 1</td>
<td class="coverPerHi">-</td>
<td class="coverNumHi">0 / 0</td>
</tr>
<tr>
<td class="coverFile"><a href="func.h.gcov.html">func.h</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">14 / 14</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">5 / 5</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">4 / 4</td>
</tr>
<tr>
<td class="coverFile"><a href="server.cpp.gcov.html">server.cpp</a></td>
<td class="coverBar" align="center">
<table border=0 cellspacing=0 cellpadding=1><tr><td class="coverBarOutline"><img src="../emerald.png" width=100 height=10 alt="100.0%"></td></tr></table>
</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">1410 / 1410</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">106 / 106</td>
<td class="coverPerHi">100.0&nbsp;%</td>
<td class="coverNumHi">619 / 619</td>
</tr>
</table>
</center>
<br>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,505 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/server.cpp - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - server.cpp<span style="font-size: 80%;"> (<a href="server.cpp.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1410</td>
<td class="headerCovTableEntry">1410</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">106</td>
<td class="headerCovTableEntry">106</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">619</td>
<td class="headerCovTableEntry">619</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><a href="server.cpp.func.html"><img src="../updown.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></a></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></span></td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1909">_Z10run_battlePv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2234">_Z11EightQueen1v</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1744">_Z12init_handlerv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1914">_Z12server_startv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1861">_Z13close_sessionii</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2042">_Z13init_constantv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1994">_Z13init_handlersPc</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#267">_Z14save_user_listv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1730">_Z20client_message_fatali</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1461">_Z22client_command_fire_upi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1466">_Z24client_command_fire_downi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1471">_Z24client_command_fire_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1476">_Z25client_command_fire_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1534">_Z26client_command_fire_aoe_upi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1482">_Z27client_command_fire_up_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1538">_Z28client_command_fire_aoe_downi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1542">_Z28client_command_fire_aoe_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1487">_Z28client_command_fire_up_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1546">_Z29client_command_fire_aoe_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1492">_Z29client_command_fire_down_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1497">_Z30client_command_fire_down_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2381">_ZN15floyd_algorithm13displayAdjMatENS_6matrixE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2364">_ZN15floyd_algorithm14displayAdjListEPNS_4listE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2480">_ZN15floyd_algorithm5floydEv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2737">_ZN5Queue11EightQueen1Ev</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2597">_ZN7__floyd13displayAdjMatENS_6matrixE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2580">_ZN7__floyd14displayAdjListEPNS_4listE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2698">_ZN7__floyd5floydEv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2182">_Z10EightQueeni</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1866">_Z13session_startPv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1078">_Z14list_all_usersP16server_message_t</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#515">_Z18get_unused_sessionv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1989">_Z18terminate_entrancei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1551">_Z20client_command_meleei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1362">_Z22client_command_move_upi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1373">_Z24client_command_move_downi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1384">_Z24client_command_move_lefti</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1395">_Z25client_command_move_righti</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1201">_Z26client_command_invite_useri</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1189">_Z26client_command_quit_battlei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1217">_Z27client_command_send_messagei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1691">_Z28client_command_admin_controli</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1090">_Z30client_command_fetch_all_usersi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1109">_Z32client_command_fetch_all_friendsi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#277">_Z9save_useri</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2420">_ZN15floyd_algorithm11displayPathENS_6matrixEPA7_iS2_</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2339">_ZN15floyd_algorithm18createAdjListGraphERPNS_4listEPA7_iii</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2452">_ZN15floyd_algorithm5FloydENS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2400">_ZN15floyd_algorithm9ListToMatEPNS_4listERNS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2636">_ZN7__floyd11displayPathENS_6matrixEPA7_iS2_</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2555">_ZN7__floyd18createAdjListGraphERPNS_4listEPA7_iii</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2669">_ZN7__floyd5FloydENS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2616">_ZN7__floyd9ListToMatEPNS_4listERNS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1280">_Z25client_command_launch_ffai</a></td>
<td class="coverFnHi">3</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1327">_Z28client_command_reject_battlei</a></td>
<td class="coverFnHi">3</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1653">_Z14admin_ban_useriPPc</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1345">_Z19client_command_quiti</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#462">_Z27user_invited_to_join_battlejj</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1300">_Z28client_command_accept_battlei</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1158">_Z28client_command_launch_battlei</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1616">_Z12admin_set_hpiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1828">_Z14send_to_clientiiPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1569">_Z15admin_set_adminiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1596">_Z16admin_set_energyiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#835">_Z17check_who_is_deadi</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1957">_Z17terminate_processi</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#495">_Z20get_unalloced_battlev</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1503">_Z23client_command_fire_aoeii</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1249">_Z25client_command_create_ffai</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#369">_Z26client_command_user_logouti</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1406">_Z27client_command_put_landminei</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#285">_Z28client_command_user_registeri</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1851">_Z28send_to_client_with_usernameiiPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1011">_Z12battle_rulerPv</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1065">_Z13launch_battlei</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#536">_Z14inform_friendsii</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#225">_Z14load_user_listv</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1130">_Z23invite_friend_to_battleiiPc</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#447">_Z16user_join_battlejj</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1634">_Z13admin_set_posiPPc</a></td>
<td class="coverFnHi">9</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#321">_Z25client_command_user_logini</a></td>
<td class="coverFnHi">9</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#426">_Z28user_join_battle_common_partjjj</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#395">_Z16user_quit_battlejj</a></td>
<td class="coverFnHi">11</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1048">_Z21check_user_registeredPcS_</a></td>
<td class="coverFnHi">11</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#219">_ZN8battle_tC2Ev</a></td>
<td class="coverFnHi">14</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#214">_ZN8battle_t5resetEv</a></td>
<td class="coverFnHi">19</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1435">_Z19client_command_fireiiii</a></td>
<td class="coverFnHi">27</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#474">_Z21find_uid_by_user_namePKc</a></td>
<td class="coverFnHi">37</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#549">_Z21forced_generate_itemsiiiiii</a></td>
<td class="coverFnHi">49</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1838">_Z13say_to_clientiPc</a></td>
<td class="coverFnHi">66</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1819">_Z14send_to_clientii</a></td>
<td class="coverFnHi">67</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#176">_ZN6item_tC2ERKS_</a></td>
<td class="coverFnHi">73</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2284">_Z6outputPA8_Kii</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2787">_ZN5Queue6outputEPA8_Kii</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#184">_ZN6item_tC2Ev</a></td>
<td class="coverFnHi">109</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#382">_Z19query_session_builtj</a></td>
<td class="coverFnHi">338</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#948">_Z29inform_all_user_battle_playeri</a></td>
<td class="coverFnHi">366</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2255">_Z11eightQueensi</a></td>
<td class="coverFnHi">2057</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2758">_ZN5Queue11eightQueensEi</a></td>
<td class="coverFnHi">2057</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#575">_Z21random_generate_itemsi</a></td>
<td class="coverFnHi">3501</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#869">_Z11clear_itemsi</a></td>
<td class="coverFnHi">3502</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#825">_Z21check_all_user_statusi</a></td>
<td class="coverFnHi">3503</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#984">_Z28inform_all_user_battle_statei</a></td>
<td class="coverFnHi">3503</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#615">_Z12move_bulletsi</a></td>
<td class="coverFnHi">3525</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#909">_Z19render_map_for_useriP16server_message_t</a></td>
<td class="coverFnHi">9584</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#734">_Z17check_user_statusi</a></td>
<td class="coverFnHi">9599</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

@ -0,0 +1,505 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LCOV - test.info - terminal-stg/server.cpp - functions</title>
<link rel="stylesheet" type="text/css" href="../gcov.css">
</head>
<body>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="title">LCOV - code coverage report</td></tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr>
<td width="100%">
<table cellpadding=1 border=0 width="100%">
<tr>
<td width="10%" class="headerItem">Current view:</td>
<td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">terminal-stg</a> - server.cpp<span style="font-size: 80%;"> (<a href="server.cpp.gcov.html">source</a> / functions)</span></td>
<td width="5%"></td>
<td width="15%"></td>
<td width="10%" class="headerCovTableHead">Hit</td>
<td width="10%" class="headerCovTableHead">Total</td>
<td width="15%" class="headerCovTableHead">Coverage</td>
</tr>
<tr>
<td class="headerItem">Test:</td>
<td class="headerValue">test.info</td>
<td></td>
<td class="headerItem">Lines:</td>
<td class="headerCovTableEntry">1410</td>
<td class="headerCovTableEntry">1410</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td class="headerItem">Date:</td>
<td class="headerValue">2022-06-07 00:36:57</td>
<td></td>
<td class="headerItem">Functions:</td>
<td class="headerCovTableEntry">106</td>
<td class="headerCovTableEntry">106</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td class="headerItem">Branches:</td>
<td class="headerCovTableEntry">619</td>
<td class="headerCovTableEntry">619</td>
<td class="headerCovTableEntryHi">100.0 %</td>
</tr>
<tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
</td>
</tr>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
</table>
<center>
<table width="60%" cellpadding=1 cellspacing=1 border=0>
<tr><td><br></td></tr>
<tr>
<td width="80%" class="tableHead">Function Name <span class="tableHeadSort"><img src="../glass.png" width=10 height=14 alt="Sort by function name" title="Sort by function name" border=0></span></td>
<td width="20%" class="tableHead">Hit count <span class="tableHeadSort"><a href="server.cpp.func-sort-c.html"><img src="../updown.png" width=10 height=14 alt="Sort by hit count" title="Sort by hit count" border=0></a></span></td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2182">_Z10EightQueeni</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1909">_Z10run_battlePv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2234">_Z11EightQueen1v</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#869">_Z11clear_itemsi</a></td>
<td class="coverFnHi">3502</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2255">_Z11eightQueensi</a></td>
<td class="coverFnHi">2057</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1616">_Z12admin_set_hpiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1011">_Z12battle_rulerPv</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1744">_Z12init_handlerv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#615">_Z12move_bulletsi</a></td>
<td class="coverFnHi">3525</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1914">_Z12server_startv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1634">_Z13admin_set_posiPPc</a></td>
<td class="coverFnHi">9</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1861">_Z13close_sessionii</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2042">_Z13init_constantv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1994">_Z13init_handlersPc</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1065">_Z13launch_battlei</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1838">_Z13say_to_clientiPc</a></td>
<td class="coverFnHi">66</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1866">_Z13session_startPv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1653">_Z14admin_ban_useriPPc</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#536">_Z14inform_friendsii</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1078">_Z14list_all_usersP16server_message_t</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#225">_Z14load_user_listv</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#267">_Z14save_user_listv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1819">_Z14send_to_clientii</a></td>
<td class="coverFnHi">67</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1828">_Z14send_to_clientiiPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1569">_Z15admin_set_adminiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1596">_Z16admin_set_energyiPPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#447">_Z16user_join_battlejj</a></td>
<td class="coverFnHi">8</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#395">_Z16user_quit_battlejj</a></td>
<td class="coverFnHi">11</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#734">_Z17check_user_statusi</a></td>
<td class="coverFnHi">9599</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#835">_Z17check_who_is_deadi</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1957">_Z17terminate_processi</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#515">_Z18get_unused_sessionv</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1989">_Z18terminate_entrancei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1435">_Z19client_command_fireiiii</a></td>
<td class="coverFnHi">27</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1345">_Z19client_command_quiti</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#382">_Z19query_session_builtj</a></td>
<td class="coverFnHi">338</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#909">_Z19render_map_for_useriP16server_message_t</a></td>
<td class="coverFnHi">9584</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1551">_Z20client_command_meleei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1730">_Z20client_message_fatali</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#495">_Z20get_unalloced_battlev</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#825">_Z21check_all_user_statusi</a></td>
<td class="coverFnHi">3503</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1048">_Z21check_user_registeredPcS_</a></td>
<td class="coverFnHi">11</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#474">_Z21find_uid_by_user_namePKc</a></td>
<td class="coverFnHi">37</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#549">_Z21forced_generate_itemsiiiiii</a></td>
<td class="coverFnHi">49</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#575">_Z21random_generate_itemsi</a></td>
<td class="coverFnHi">3501</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1461">_Z22client_command_fire_upi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1362">_Z22client_command_move_upi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1503">_Z23client_command_fire_aoeii</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1130">_Z23invite_friend_to_battleiiPc</a></td>
<td class="coverFnHi">6</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1466">_Z24client_command_fire_downi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1471">_Z24client_command_fire_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1373">_Z24client_command_move_downi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1384">_Z24client_command_move_lefti</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1249">_Z25client_command_create_ffai</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1476">_Z25client_command_fire_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1280">_Z25client_command_launch_ffai</a></td>
<td class="coverFnHi">3</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1395">_Z25client_command_move_righti</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#321">_Z25client_command_user_logini</a></td>
<td class="coverFnHi">9</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1534">_Z26client_command_fire_aoe_upi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1201">_Z26client_command_invite_useri</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1189">_Z26client_command_quit_battlei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#369">_Z26client_command_user_logouti</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1482">_Z27client_command_fire_up_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1406">_Z27client_command_put_landminei</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1217">_Z27client_command_send_messagei</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#462">_Z27user_invited_to_join_battlejj</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1300">_Z28client_command_accept_battlei</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1691">_Z28client_command_admin_controli</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1538">_Z28client_command_fire_aoe_downi</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1542">_Z28client_command_fire_aoe_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1487">_Z28client_command_fire_up_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1158">_Z28client_command_launch_battlei</a></td>
<td class="coverFnHi">4</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1327">_Z28client_command_reject_battlei</a></td>
<td class="coverFnHi">3</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#285">_Z28client_command_user_registeri</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#984">_Z28inform_all_user_battle_statei</a></td>
<td class="coverFnHi">3503</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1851">_Z28send_to_client_with_usernameiiPc</a></td>
<td class="coverFnHi">5</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#426">_Z28user_join_battle_common_partjjj</a></td>
<td class="coverFnHi">10</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1546">_Z29client_command_fire_aoe_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1492">_Z29client_command_fire_down_lefti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#948">_Z29inform_all_user_battle_playeri</a></td>
<td class="coverFnHi">366</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1090">_Z30client_command_fetch_all_usersi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1497">_Z30client_command_fire_down_righti</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#1109">_Z32client_command_fetch_all_friendsi</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2284">_Z6outputPA8_Kii</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#277">_Z9save_useri</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2420">_ZN15floyd_algorithm11displayPathENS_6matrixEPA7_iS2_</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2381">_ZN15floyd_algorithm13displayAdjMatENS_6matrixE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2364">_ZN15floyd_algorithm14displayAdjListEPNS_4listE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2339">_ZN15floyd_algorithm18createAdjListGraphERPNS_4listEPA7_iii</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2452">_ZN15floyd_algorithm5FloydENS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2480">_ZN15floyd_algorithm5floydEv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2400">_ZN15floyd_algorithm9ListToMatEPNS_4listERNS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2737">_ZN5Queue11EightQueen1Ev</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2758">_ZN5Queue11eightQueensEi</a></td>
<td class="coverFnHi">2057</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2787">_ZN5Queue6outputEPA8_Kii</a></td>
<td class="coverFnHi">92</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#176">_ZN6item_tC2ERKS_</a></td>
<td class="coverFnHi">73</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#184">_ZN6item_tC2Ev</a></td>
<td class="coverFnHi">109</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2636">_ZN7__floyd11displayPathENS_6matrixEPA7_iS2_</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2597">_ZN7__floyd13displayAdjMatENS_6matrixE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2580">_ZN7__floyd14displayAdjListEPNS_4listE</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2555">_ZN7__floyd18createAdjListGraphERPNS_4listEPA7_iii</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2669">_ZN7__floyd5FloydENS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2698">_ZN7__floyd5floydEv</a></td>
<td class="coverFnHi">1</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#2616">_ZN7__floyd9ListToMatEPNS_4listERNS_6matrixE</a></td>
<td class="coverFnHi">2</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#214">_ZN8battle_t5resetEv</a></td>
<td class="coverFnHi">19</td>
</tr>
<tr>
<td class="coverFn"><a href="server.cpp.gcov.html#219">_ZN8battle_tC2Ev</a></td>
<td class="coverFnHi">14</td>
</tr>
</table>
<br>
</center>
<table width="100%" border=0 cellspacing=0 cellpadding=0>
<tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
<tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr>
</table>
<br>
</body>
</html>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

File diff suppressed because it is too large Load Diff

@ -0,0 +1,113 @@
#include <stdio.h>
#include "allocate.h"
int stack_size = 0;
int variables_size = 0;
int saved_stack_size = 0;
reg_list register_list;
void initialize_register_list(){
unsigned int i;
register_list.num_allocated = 0;
for(i = 0; i < NUM_REGISTERS; i++){
register_list.registers[i] = i;
register_list.positions[i] = i;
}
}
//For now, it's impossible to allocate anything but 4 bytes on the stack
//This is because I need to be able to cast values which are on the stack
//Doing so without everything aligned on the stack would require me to
//Know in advance if I need to give space around a value on the stack to
//allow it to be cast and replaced in the same spot.
data_entry allocate(unsigned char force_stack){
data_entry output;
if(force_stack || register_list.num_allocated >= NUM_REGISTERS){
output.type = data_stack;
output.prev_stack_size = stack_size;
output.stack_pos = stack_size;
stack_size += 4;
} else {
output.type = data_register;
output.reg = register_list.registers[register_list.num_allocated];
register_list.num_allocated++;
}
if(stack_size > saved_stack_size){
saved_stack_size = stack_size;
}
return output;
}
//Note that if we are allocating on the stack, block allocated last should be deallocated first
void deallocate(data_entry entry){
unsigned int temp;
if(entry.type == data_register){
register_list.num_allocated--;
temp = register_list.registers[register_list.num_allocated];
register_list.registers[register_list.num_allocated] = entry.reg;
register_list.registers[register_list.positions[entry.reg]] = temp;
register_list.positions[temp] = register_list.positions[entry.reg];
register_list.positions[entry.reg] = register_list.num_allocated;
} else if(entry.type == data_stack){
stack_size = entry.prev_stack_size;
}
}
int get_stack_pos(data_entry entry){
if(entry.type == data_stack){
return saved_stack_size - entry.stack_pos - 4;
}
return -1;
}
static void store_register(unsigned char reg, FILE *output_file){
if(output_file)
fprintf(output_file, "sw $s%d, %d($sp)\n", (int) reg, saved_stack_size - stack_size - 4);
stack_size += 4;
if(stack_size > saved_stack_size){
saved_stack_size = stack_size;
}
}
reg_list push_registers(FILE *output_file){
reg_list output;
int i;
output = register_list;
for(i = register_list.num_allocated - 1; i >= 0; i--){
store_register(register_list.registers[i], output_file);
}
register_list.num_allocated = 0;
return output;
}
int get_reg_stack_pos(reg_list regs, unsigned char reg){
int index;
index = regs.positions[reg];
return saved_stack_size - stack_size + REGISTER_SIZE*(index + 1) - 4;
}
static void load_register(unsigned char reg, FILE *output_file){
stack_size -= 4;
if(output_file)
fprintf(output_file, "lw $s%d, %d($sp)\n", (int) reg, saved_stack_size - stack_size - 4);
}
void pull_registers(reg_list regs, FILE *output_file){
unsigned int i;
for(i = 0; i < regs.num_allocated; i++){
load_register(regs.registers[i], output_file);
}
register_list = regs;
}

@ -0,0 +1,44 @@
#ifndef ALLOCATE_INCLUDED
#define ALLOCATE_INCLUDED
#define REGISTER_SIZE 4
#define NUM_REGISTERS 8
typedef enum{
data_register,
data_stack
} data_entry_type;
typedef struct reg_list reg_list;
struct reg_list{
unsigned int num_allocated;
unsigned char registers[NUM_REGISTERS];
unsigned char positions[NUM_REGISTERS];
};
typedef struct data_entry data_entry;
struct data_entry{
data_entry_type type;
union{
int reg;
int stack_pos;
};
unsigned int prev_stack_size;
};
extern int stack_size;
extern int variables_size;
extern int saved_stack_size;
extern reg_list register_list;
void initialize_register_list();
data_entry allocate(unsigned char force_stack);
void deallocate(data_entry entry);
int get_stack_pos(data_entry entry);
reg_list push_registers(FILE *output_file);
int get_reg_stack_pos(reg_list regs, unsigned char reg);
void pull_registers(reg_list regs, FILE *output_file);
#endif

@ -0,0 +1,649 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "dictionary.h"
#include "expression.h"
#include "allocate.h"
#include "compile.h"
#define MAX_SOURCEFILES 32
int num_vars = 0;
int num_args = 0;
int num_strs = 0;
int current_line;
type return_type;
static char *program;
static char *program_beginning;
static char *program_pointer;
static char *source_files[MAX_SOURCEFILES] = {NULL};
static char **current_source_file;
static FILE *output_file;
static int continue_label = -1;
static int break_label = -1;
static int loop_variables_size;
char warning_message[256] = {0};
char error_message[256] = {0};
enum cmd_argtype{
cmd_source_file,
cmd_output_file
};
static void print_line(){
char *line_pointer;
char *line_beginning;
line_pointer = program_pointer;
fprintf(stderr, "Line %d in %s:\n", current_line, *current_source_file);
while(line_pointer != program_beginning && line_pointer[-1] != '\n'){
line_pointer--;
}
while(*line_pointer && line_pointer != program_pointer && (*line_pointer == ' ' || *line_pointer == '\t')){
line_pointer++;
}
line_beginning = line_pointer;
while(*line_pointer && *line_pointer != '\n'){
fputc(*line_pointer, stderr);
line_pointer++;
}
fputc('\n', stderr);
while(line_beginning != program_pointer){
fputc(' ', stderr);
line_beginning++;
}
fprintf(stderr, "^\n");
}
void do_warning(){
if(do_print){
warning_message[255] = '\0';
print_line();
fprintf(stderr, "Warning: %s\n", warning_message);
}
}
void do_error(int status){
fclose(output_file);
error_message[255] = '\0';
print_line();
fprintf(stderr, "Error: %s\n", error_message);
free(program);
free_local_variables();
free_global_variables();
exit(status);
}
void compile_file(char *program, char *identifier_name, char *arguments, unsigned int identifier_length, unsigned int num_arguments, FILE *output_file){
int current_line_temp;
program_pointer = program;
program_beginning = program;
fprintf(output_file, ".data\n");
current_line = 1;
skip_whitespace(&program_pointer);
current_line_temp = current_line;
compile_string_constants(program_pointer, output_file);
current_line = current_line_temp;
fprintf(output_file, ".text\n\n");
while(*program_pointer){
compile_function(&program_pointer, identifier_name, arguments, identifier_length, num_arguments, output_file);
free_local_variables();
skip_whitespace(&program_pointer);
}
}
void compile_function(char **c, char *identifier_name, char *arguments, unsigned int identifier_length, unsigned int num_arguments, FILE *output_file){
variable *var;
variable *local_var;
unsigned int current_argument = 0;
num_vars = 0;
variables_size = 0;
return_type = EMPTY_TYPE;
parse_type(&return_type, c, identifier_name, arguments, identifier_length, num_arguments);
if(!identifier_name){
snprintf(error_message, sizeof(error_message), "Expected identifier name");
do_error(1);
}
skip_whitespace(c);
if(peek_type(&return_type) != type_function){
skip_whitespace(c);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';'");
do_error(1);
}
++*c;
var = read_dictionary(global_variables, identifier_name, 0);
if(var){
snprintf(error_message, sizeof(error_message), "Duplicate definitions of non-function data");
do_error(1);
}
var = malloc(sizeof(variable));
var->var_type = return_type;
var->varname = malloc(strlen(identifier_name) + 1);
var->leave_as_address = 0;
strcpy(var->varname, identifier_name);
write_dictionary(&global_variables, var->varname, var, 0);
fprintf(output_file, ".data\n.align 2\n%s:\n.space %d\n.text\n", identifier_name, align4(type_size(&return_type, 0)));
} else {
if(!*identifier_name){
snprintf(error_message, sizeof(error_message), "Expected function name");
do_error(1);
}
var = read_dictionary(global_variables, identifier_name, 0);
if(!var){
var = malloc(sizeof(variable));
var->var_type = return_type;
var->varname = malloc(strlen(identifier_name) + 1);
var->leave_as_address = 1;
strcpy(var->varname, identifier_name);
write_dictionary(&global_variables, var->varname, var, 0);
} else {
if(!types_equal(&(var->var_type), &return_type)){
snprintf(error_message, sizeof(error_message), "Incompatible function definitions");
do_error(1);
}
}
if(**c != '{'){
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected '{' or ';' instead of '%c'", **c);
do_error(1);
}
++*c;
return;
}
++*c;
local_variables[0] = malloc(sizeof(dictionary));
*local_variables[0] = create_dictionary(NULL);
fprintf(output_file, "\n.globl %s\n%s:\n", identifier_name, identifier_name);
pop_type(&return_type);
while(peek_type(&return_type) != type_returns){
if(current_argument >= num_arguments){
snprintf(error_message, sizeof(error_message), "Too many arguments!");
do_error(1);
}
if(read_dictionary(*local_variables[0], arguments, 0)){
snprintf(error_message, sizeof(error_message), "Duplicate argument names");
do_error(1);
}
local_var = malloc(sizeof(variable));
local_var->var_type = get_argument_type(&return_type);
local_var->varname = malloc(strlen(arguments) + 1);
strcpy(local_var->varname, arguments);
local_var->stack_pos = variables_size;
write_dictionary(local_variables[0], local_var->varname, local_var, 0);
variables_size += 4;
arguments += identifier_length;
current_argument++;
num_vars++;
}
pop_type(&return_type);
if(peek_type(&return_type) == type_function){
snprintf(error_message, sizeof(error_message), "Function cannot return function");
do_error(1);
}
num_args = num_vars;
compile_block(c, 1, output_file);
++*c;
var->num_args = num_vars;
fprintf(output_file, "lw $ra, %d($sp)\n", 4 + num_args*4);
fprintf(output_file, "jr $ra\n");
}
}
static void free_var(void *v){
variable *var;
var = (variable *) v;
free(var->varname);
free(var);
}
void compile_block(char **c, unsigned char function_beginning, FILE *output_file){
char *temp;
unsigned char new_scope = 0;
int variables_size_before;
variables_size_before = variables_size;
skip_whitespace(c);
temp = *c;
if(function_beginning || parse_datatype(NULL, &temp)){
new_scope = 1;
current_scope++;
if(current_scope >= MAX_SCOPE){
snprintf(error_message, sizeof(error_message), "Scope depth too large");
do_error(1);
}
if(!local_variables[current_scope]){
local_variables[current_scope] = malloc(sizeof(dictionary));
*local_variables[current_scope] = create_dictionary(NULL);
}
}
temp = *c;
while(parse_datatype(NULL, &temp)){
compile_variable_initializer(c);
skip_whitespace(c);
temp = *c;
num_vars++;
}
if(new_scope){
fprintf(output_file, "addi $sp, $sp, %d\n", -variables_size + variables_size_before);
}
while(**c != '}'){
compile_statement(c, output_file);
skip_whitespace(c);
}
if(new_scope){
fprintf(output_file, "addi $sp, $sp, %d\n", variables_size - variables_size_before);
free_dictionary(*local_variables[current_scope], free_var);
free(local_variables[current_scope]);
local_variables[current_scope] = NULL;
current_scope--;
variables_size = variables_size_before;
}
}
void compile_statement(char **c, FILE *output_file){
value expression_output;
unsigned int label_num0;
unsigned int label_num1;
unsigned int label_num2;
unsigned int label_num3;
int prev_break_label;
int prev_continue_label;
int prev_loop_variables_size;
skip_whitespace(c);
if(!strncmp(*c, "if", 2) && !alphanumeric((*c)[2])){
*c += 2;
skip_whitespace(c);
if(**c != '('){
snprintf(error_message, sizeof(error_message), "Expected '('");
do_error(1);;
}
++*c;
compile_root_expression(&expression_output, c, 1, 0, output_file);
cast(&expression_output, INT_TYPE, 0, output_file);
reset_stack_pos(&expression_output, output_file);
label_num0 = num_labels;
num_labels++;
if(expression_output.data.type == data_register){
fprintf(output_file, "beq $s%d, $zero, __L%d\n", expression_output.data.reg, label_num0);
} else if(expression_output.data.type == data_stack){
fprintf(output_file, "beq $t0, $zero, __L%d\n", label_num0);
}
deallocate(expression_output.data);
skip_whitespace(c);
if(**c != ')'){
snprintf(error_message, sizeof(error_message), "Expected ')'");
do_error(1);
}
++*c;
skip_whitespace(c);
compile_statement(c, output_file);
skip_whitespace(c);
if(!strncmp(*c, "else", 2) && !alphanumeric((*c)[4])){
*c += 4;
label_num1 = num_labels;
num_labels++;
fprintf(output_file, "j __L%d\n", label_num1);
fprintf(output_file, "\n__L%d:\n", label_num0);
skip_whitespace(c);
compile_statement(c, output_file);
fprintf(output_file, "\n__L%d:\n", label_num1);
} else {
fprintf(output_file, "\n__L%d:\n", label_num0);
}
} else if(!strncmp(*c, "while", 5) && !alphanumeric((*c)[5])){
*c += 5;
skip_whitespace(c);
if(**c != '('){
snprintf(error_message, sizeof(error_message), "Expected '('");
do_error(1);
}
++*c;
label_num0 = num_labels;
label_num1 = num_labels + 1;
num_labels += 2;
prev_break_label = break_label;
prev_continue_label = continue_label;
prev_loop_variables_size = loop_variables_size;
break_label = label_num1;
continue_label = label_num0;
loop_variables_size = variables_size;
fprintf(output_file, "\n__L%d:\n", label_num0);
compile_root_expression(&expression_output, c, 1, 0, output_file);
cast(&expression_output, INT_TYPE, 0, output_file);
reset_stack_pos(&expression_output, output_file);
if(expression_output.data.type == data_register){
fprintf(output_file, "beq $s%d, $zero, __L%d\n", expression_output.data.reg, label_num1);
} else if(expression_output.data.type == data_stack){
fprintf(output_file, "beq $t0, $zero, __L%d\n", label_num1);
}
deallocate(expression_output.data);
skip_whitespace(c);
if(**c != ')'){
snprintf(error_message, sizeof(error_message), "Expected ')'");
do_error(1);
}
++*c;
skip_whitespace(c);
compile_statement(c, output_file);
fprintf(output_file, "j __L%d\n", label_num0);
fprintf(output_file, "\n__L%d:\n", label_num1);
loop_variables_size = prev_loop_variables_size;
break_label = prev_break_label;
continue_label = prev_continue_label;
} else if(!strncmp(*c, "for", 3) && !alphanumeric((*c)[3])){
*c += 3;
skip_whitespace(c);
if(**c != '('){
snprintf(error_message, sizeof(error_message), "Expected '('");
do_error(1);
}
++*c;
label_num0 = num_labels;
label_num1 = num_labels + 1;
label_num2 = num_labels + 2;
label_num3 = num_labels + 3;
num_labels += 4;
prev_break_label = break_label;
prev_continue_label = continue_label;
prev_loop_variables_size = loop_variables_size;
break_label = label_num1;
continue_label = label_num3;
loop_variables_size = variables_size;
skip_whitespace(c);
if(**c != ';'){
compile_root_expression(&expression_output, c, 1, 0, output_file);
reset_stack_pos(&expression_output, output_file);
deallocate(expression_output.data);
skip_whitespace(c);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';'");
do_error(1);
}
}
++*c;
fprintf(output_file, "\n__L%d:\n", label_num0);
skip_whitespace(c);
if(**c != ';'){
compile_root_expression(&expression_output, c, 1, 0, output_file);
cast(&expression_output, INT_TYPE, 0, output_file);
reset_stack_pos(&expression_output, output_file);
if(expression_output.data.type == data_register){
fprintf(output_file, "beq $s%d, $zero, __L%d\n", expression_output.data.reg, label_num1);
} else if(expression_output.data.type == data_stack){
fprintf(output_file, "beq $t0, $zero, __L%d\n", label_num1);
}
deallocate(expression_output.data);
skip_whitespace(c);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';'");
do_error(1);
}
}
++*c;
fprintf(output_file, "j __L%d\n\n__L%d:\n", label_num2, label_num3);
skip_whitespace(c);
if(**c != ')'){
compile_root_expression(&expression_output, c, 1, 0, output_file);
reset_stack_pos(&expression_output, output_file);
deallocate(expression_output.data);
skip_whitespace(c);
if(**c != ')'){
snprintf(error_message, sizeof(error_message), "Expected '('");
do_error(1);
}
}
++*c;
fprintf(output_file, "j __L%d\n\n__L%d:\n", label_num0, label_num2);
skip_whitespace(c);
compile_statement(c, output_file);
fprintf(output_file, "j __L%d\n\n__L%d:\n", label_num3, label_num1);
loop_variables_size = prev_loop_variables_size;
break_label = prev_break_label;
continue_label = prev_continue_label;
} else if(!strncmp(*c, "return", 6) && !alphanumeric((*c)[6])){
*c += 6;
skip_whitespace(c);
if(types_equal(&return_type, &VOID_TYPE)){
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';' for return in void function");
do_error(1);
}
++*c;
} else {
compile_root_expression(&expression_output, c, 1, 0, output_file);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';'");
do_error(1);
}
++*c;
cast(&expression_output, return_type, 1, output_file);
reset_stack_pos(&expression_output, output_file);
if(expression_output.data.type == data_register){
fprintf(output_file, "sw $s%d, %d($sp)\n", expression_output.data.reg, variables_size);
} else if(expression_output.data.type == data_stack){
fprintf(output_file, "sw $t0, %d($sp)\n", variables_size);
}
deallocate(expression_output.data);
}
fprintf(output_file, "addi $sp, $sp, %d\n", variables_size - num_args*4);
fprintf(output_file, "lw $ra, %d($sp)\n", 4 + num_args*4);
fprintf(output_file, "jr $ra\n");
} else if(!strncmp(*c, "break", 5) && !alphanumeric((*c)[5])){
*c += 5;
skip_whitespace(c);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';' after break");
do_error(1);
}
if(break_label < 0){
snprintf(error_message, sizeof(error_message), "No loop to break out of");
do_error(1);
}
if(variables_size != loop_variables_size)
fprintf(output_file, "addi $sp, $sp, %d\n", variables_size - loop_variables_size);
fprintf(output_file, "j __L%d\n", break_label);
} else if(!strncmp(*c, "continue", 8) && !alphanumeric((*c)[8])){
*c += 8;
skip_whitespace(c);
if(**c != ';'){
snprintf(error_message, sizeof(error_message), "Expected ';' after continue");
do_error(1);
}
if(continue_label < 0){
snprintf(error_message, sizeof(error_message), "No loop to continue in");
do_error(1);
}
if(variables_size != loop_variables_size)
fprintf(output_file, "addi $sp, $sp, %d\n", variables_size - loop_variables_size);
fprintf(output_file, "j __L%d\n", continue_label);
} else if(**c == ';'){
//Empty statement, so pass
++*c;
} else if(**c == '{'){
++*c;
compile_block(c, 0, output_file);
if(**c != '}'){
snprintf(error_message, sizeof(error_message), "Expected '}'");
do_error(1);
}
++*c;
} else {
compile_root_expression(&expression_output, c, 1, 0, output_file);
reset_stack_pos(&expression_output, output_file);
deallocate(expression_output.data);
if(**c == ';'){
++*c;
} else {
snprintf(error_message, sizeof(error_message), "Expected ';'");
do_error(1);
}
}
}
void place_string_constant(char **c, FILE *output_file){
unsigned char ignore_next = 0;
char *beginning;
beginning = *c;
while(**c && (**c != '"' || ignore_next)){
fprintf(output_file, "%c", **c);
if(**c == '\\'){
ignore_next = 1;
} else {
ignore_next = 0;
}
if(**c == '\n'){
program_pointer = *c;
snprintf(error_message, sizeof(error_message), "Expected closing '\"'");
do_error(1);
}
++*c;
}
if(!**c){
program_pointer = beginning;
snprintf(error_message, sizeof(error_message), "Expected closing '\"'");
do_error(1);
}
fprintf(output_file, "\"");
++*c;
}
void compile_string_constants(char *c, FILE *output_file){
unsigned char ignore;
ignore = 0;
skip_whitespace(&c);
while(*c){
if(ignore || *c != '"'){
ignore = 0;
if(*c == '\\' || *c == '\''){
ignore = 1;
} else if(*c == '\n'){
current_line++;
}
c++;
} else {
c++;
fprintf(output_file, "__str%d:\n", num_strs);
fprintf(output_file, ".asciiz \"");
place_string_constant(&c, output_file);
fprintf(output_file, "\n");
num_strs++;
}
skip_whitespace(&c);
}
}
void parse_arguments(int argc, char **argv, char *filenames[], unsigned int num_filenames, char **output_filename){
unsigned int current_arg;
unsigned int current_filename = 0;
enum cmd_argtype argtype = cmd_source_file;
for(current_arg = 1; current_arg < argc; current_arg++){
switch(argtype){
case cmd_source_file:
if(argv[current_arg][0] == '-'){
if(argv[current_arg][1] == 'h' || (argv[current_arg][1] == '-' && argv[current_arg][2] == 'h')){//Display help message
printf("Arguments:\n-h --help Displays this help message\n-o Specify output file\n\nTo compile:\nmcc [SOURCE1] [SOURCE2] [SOURCE3] ... -o [OUTPUT_FILE]\n");
exit(1);
} else if(argv[current_arg][1] == 'o'){
argtype = cmd_output_file;
} else {
fprintf(stderr, "Unrecognized option '%s'\n", argv[current_arg]);
exit(1);
}
} else {
if(current_filename < num_filenames){
filenames[current_filename] = argv[current_arg];
current_filename++;
} else {
fprintf(stderr, "Too many source files\n");
exit(1);
}
}
break;
case cmd_output_file:
if(argv[current_arg][0] == '-'){
fprintf(stderr, "Expected output file name after '-o'\n");
exit(1);
}
*output_filename = argv[current_arg];
argtype = cmd_source_file;
break;
}
}
}
int main(int argc, char **argv){
char identifier_name[32];
char arguments[32*32];
FILE *fp;
unsigned int file_size;
char *output_filename = NULL;
if(argc < 2){
printf("Minimal C Compiler for MIPS\nby Ben Jones\n2/29/2020\n");
return 0;
}
parse_arguments(argc, argv, source_files, MAX_SOURCEFILES - 1, &output_filename);
if(!output_filename){
output_filename = "a.s";
}
output_file = fopen(output_filename, "w");
if(!output_file){
fprintf(stderr, "Could not open file '%s' for writing\n", output_filename);
exit(1);
}
global_variables = create_dictionary(NULL);
current_source_file = source_files;
current_scope = -1;
memset(local_variables, 0, sizeof(local_variables));
while(*current_source_file){
fp = fopen(*current_source_file, "rb");
if(!fp){
fprintf(stderr, "Could not open file '%s' for reading\n", *current_source_file);
free_global_variables();
exit(1);
}
fseek(fp, 0, SEEK_END);
file_size = ftell(fp);
rewind(fp);
program = calloc(file_size + 1, sizeof(char));
if(fread(program, sizeof(char), file_size, fp) < file_size){
fclose(fp);
fprintf(stderr, "Failed to read file '%s'\n", *current_source_file);
free_global_variables();
exit(1);
}
fclose(fp);
initialize_register_list();
compile_file(program, identifier_name, arguments, 32, 32, output_file);
free(program);
current_source_file++;
}
fclose(output_file);
free_global_variables();
return 0;
}

@ -0,0 +1,23 @@
#ifndef MCC_INCLUDE_COMPILE
#define MCC_INCLUDE_COMPILE
#include <stdio.h>
void compile_function(char **c, char *identifier_name, char *arguments, unsigned int identifier_length, unsigned int num_arguments, FILE *output_file);
void compile_block(char **c, unsigned char do_variable_initializers, FILE *output_file);
void compile_statement(char **c, FILE *output_file);
void compile_string_constants(char *c, FILE *output_file);
void place_string_constant(char **c, FILE *output_file);
void do_error(int status);
void do_warning();
extern int current_line;
extern char warning_message[256];
extern char error_message[256];
#endif

@ -0,0 +1,121 @@
#include "dictionary.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
dictionary create_dictionary(void *value){
dictionary output = (dictionary) {.value = value};
memset(output.next_chars, 0, sizeof(dictionary *)*8);
return output;
}
static void free_dictionary_recursive(dictionary *dict, void (*free_value)(void *)){
unsigned char i;
for(i = 0; i < 8; i++){
if(dict->next_chars[i]){
free_dictionary_recursive(dict->next_chars[i], free_value);
free(dict->next_chars[i]);
}
}
if(dict->value){
free_value(dict->value);
}
}
void free_dictionary(dictionary dict, void (*free_value)(void *)){
unsigned char i;
for(i = 0; i < 8; i++){
if(dict.next_chars[i]){
free_dictionary_recursive(dict.next_chars[i], free_value);
free(dict.next_chars[i]);
}
}
if(dict.value){
free_value(dict.value);
}
}
void *read_dictionary(dictionary dict, char *string, unsigned char offset){
unsigned char zeros = 0;
unsigned char c;
while(*string){
c = (*string)>>offset | (*(string + 1))<<(8 - offset);
zeros = 0;
if(!(c&15)){
zeros += 4;
c>>=4;
}
if(!(c&3)){
zeros += 2;
c>>=2;
}
if(!(c&1)){
zeros++;
}
offset += zeros + 1;
string += (offset&0x08)>>3;
offset = offset&0x07;
if(dict.next_chars[zeros]){
dict = *(dict.next_chars[zeros]);
} else {
return (void *) 0;
}
}
return dict.value;
}
void write_dictionary(dictionary *dict, char *string, void *value, unsigned char offset){
unsigned char zeros = 0;
unsigned char c;
while(*string){
c = (*string)>>offset | (*(string + 1))<<(8 - offset);
zeros = 0;
if(!(c&15)){
zeros += 4;
c>>=4;
}
if(!(c&3)){
zeros += 2;
c>>=2;
}
if(!(c&1)){
zeros++;
}
offset += zeros + 1;
string += (offset&0x08)>>3;
offset = offset&0x07;
if(!dict->next_chars[zeros]){
dict->next_chars[zeros] = malloc(sizeof(dictionary));
*(dict->next_chars[zeros]) = create_dictionary((void *) 0);
}
dict = dict->next_chars[zeros];
}
dict->value = value;
}
void iterate_dictionary(dictionary dict, void (*func)(void *)){
unsigned char i;
if(dict.value){
func(dict.value);
}
for(i = 0; i < 8; i++){
if(dict.next_chars[i]){
iterate_dictionary(*dict.next_chars[i], func);
}
}
}

@ -0,0 +1,19 @@
#ifndef DICTIONARY_INCLUDED
#define DICTIONARY_INCLUDED
typedef struct dictionary dictionary;
struct dictionary{
dictionary *next_chars[8];
void *value;
};
dictionary create_dictionary(void *value);
void free_dictionary(dictionary dict, void (*free_value)(void *));
void *read_dictionary(dictionary dict, char *string, unsigned char offset);
void write_dictionary(dictionary *dict, char *string, void *value, unsigned char offset);
void iterate_dictionary(dictionary dict, void (*func)(void *));
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,72 @@
#include "allocate.h"
#include "types.h"
#define MAX_SCOPE 32
#define VOID_SIZE 1
#define CHAR_SIZE 1
#define INT_SIZE 4
#define POINTER_SIZE 4
enum operation{
operation_none,
operation_add,
operation_subtract,
operation_multiply,
operation_divide,
operation_assign,
operation_less_than,
operation_greater_than,
operation_less_than_or_equal,
operation_greater_than_or_equal,
operation_equals,
operation_not_equals,
operation_and,
operation_or,
operation_modulo,
operation_logical_and,
operation_logical_or,
operation_shift_left,
operation_shift_right
};
typedef enum operation operation;
typedef struct variable variable;
struct variable{
char *varname;
type var_type;
union{
unsigned int stack_pos;
struct{
unsigned char leave_as_address;
unsigned int num_args;
};
};
};
typedef struct value value;
struct value{
data_entry data;
type data_type;
unsigned char is_reference;
};
extern dictionary *local_variables[MAX_SCOPE];
extern dictionary global_variables;
void free_local_variables();
void free_global_variables();
extern unsigned int num_labels;
int type_size(type *t, unsigned int start_entry);
void initialize_variables();
unsigned int align4(unsigned int size);
void compile_variable_initializer(char **c);
void cast(value *v, type t, unsigned char do_warn, FILE *output_file);
void compile_expression(value *first_value, char **c, unsigned char dereference, unsigned char force_stack, FILE *output_file);
void compile_root_expression(value *first_value, char **c, unsigned char dereference, unsigned char force_stack, FILE *output_file);
void reset_stack_pos(value *first_value, FILE *output_file);
extern int current_scope;
extern unsigned char do_print;

@ -0,0 +1,441 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "types.h"
#include "compile.h"
type INT_TYPE = {.d0 = 0, .d1 = 1, .d2 = 0, .list_indicies = {0}, .current_index = 0};
type VOID_TYPE = {.d0 = 1, .d1 = 0, .d2 = 0, .list_indicies = {0}, .current_index = 0};
type CHAR_TYPE = {.d0 = 1, .d1 = 1, .d2 = 0, .list_indicies = {0}, .current_index = 0};
type EMPTY_TYPE = {.d0 = 0, .d1 = 0, .d2 = 0, .list_indicies = {0}, .current_index = 0};
unsigned char alpha(char c){
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
}
unsigned char alphanumeric(char c){
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_';
}
unsigned char digit(char c){
return c >= '0' && c <= '9';
}
void add_type_entry(type *t, type_entry entry){
t->d0 <<= 1;
if(entry&1){
t->d0 |= 1;
}
t->d1 <<= 1;
if(entry&2){
t->d1 |= 1;
}
t->d2 <<= 1;
if(entry&4){
t->d2 |= 1;
}
}
void poke_type_entry(type *t, type_entry entry, unsigned int position){
if(entry&1){
t->d0 |= 1ULL<<position;
}
if(entry&2){
t->d1 |= 1ULL<<position;
}
if(entry&4){
t->d2 |= 1ULL<<position;
}
}
void append_type(type *t, type d){
uint64_t d_mask;
int shift_amount = 1;
d_mask = d.d0 | d.d1 | d.d2;
if(!d_mask){
return;
}
if(d_mask&0xFFFFFFFF00000000ULL){
shift_amount += 32;
d_mask >>= 32;
}
if(d_mask&0xFFFF0000U){
shift_amount += 16;
d_mask >>= 16;
}
if(d_mask&0xFF00U){
shift_amount += 8;
d_mask >>= 8;
}
if(d_mask&0xF0U){
shift_amount += 4;
d_mask >>= 4;
}
if(d_mask&0xCU){
shift_amount += 2;
d_mask >>= 2;
}
if(d_mask&0x2){
shift_amount++;
}
t->d0 = (t->d0<<shift_amount) | d.d0;
t->d1 = (t->d1<<shift_amount) | d.d1;
t->d2 = (t->d2<<shift_amount) | d.d2;
while(d.current_index){
d.current_index--;
t->list_indicies[t->current_index] = d.list_indicies[d.current_index];
t->current_index++;
}
}
unsigned char parse_identifier(char **c, char *identifier_name, unsigned int identifier_length){
if(!alpha(**c)){
return 0;
}
if(!strncmp(*c, "void", 4) && !alphanumeric((*c)[4])){
return 0;
}
if(!strncmp(*c, "int", 3) && !alphanumeric((*c)[3])){
return 0;
}
if(!strncmp(*c, "char", 4) && !alphanumeric((*c)[4])){
return 0;
}
if(identifier_length){
identifier_length--;
}
while(alphanumeric(**c)){
if(identifier_length && identifier_name){
*identifier_name = **c;
identifier_name++;
identifier_length--;
}
++*c;
}
if(identifier_name){
*identifier_name = '\0';
}
return 1;
}
unsigned char parse_datatype(type *t, char **c){
if(!strncmp(*c, "void", 4) && !alphanumeric((*c)[4])){
if(t){
add_type_entry(t, type_void);
}
*c += 4;
return 1;
} else if(!strncmp(*c, "int", 3) && !alphanumeric((*c)[3])){
if(t){
add_type_entry(t, type_int);
}
*c += 3;
return 1;
} else if(!strncmp(*c, "char", 4) && !alphanumeric((*c)[4])){
if(t){
add_type_entry(t, type_char);
}
*c += 4;
return 1;
} else {
return 0;
}
}
unsigned char is_whitespace(char *c){
return *c == ' ' || *c == '\t' || *c == '\n' || *c == '\r' || (*c == '/' && (c[1] == '/' || c[1] == '*'));
}
//Here we treat comments from "//..." and "/*...*/" as whitespace, skipping everything until the next newline character
void skip_whitespace(char **c){
while(**c == ' ' || **c == '\t' || **c == '\n' || **c == '\r' || (**c == '/' && ((*c)[1] == '/' || (*c)[1] == '*'))){
if(**c == '/' && (*c)[1] == '/'){
while(**c && **c != '\n'){
++*c;
}
} else if(**c == '/' && (*c)[1] == '*'){
while(**c && (**c != '*' || (*c)[1] != '/')){
if(**c == '\n'){
current_line++;
}
++*c;
}
++*c;
}
if(**c == '\n'){
current_line++;
}
if(**c){
++*c;
}
}
}
int peek_type(type *t){
int output = 0;
if(t->d0&1){
output |= 1;
}
if(t->d1&1){
output |= 2;
}
if(t->d2&1){
output |= 4;
}
return output;
}
int pop_type(type *t){
int output = 0;
if(t->d0&1){
output |= 1;
}
if(t->d1&1){
output |= 2;
}
if(t->d2&1){
output |= 4;
}
t->d0 >>= 1;
t->d1 >>= 1;
t->d2 >>= 1;
return output;
}
unsigned char types_equal(type *t0, type *t1){
unsigned char i;
unsigned int t0_index;
unsigned int t1_index;
if(t0->d0 != t1->d0 || t0->d1 != t1->d1 || t0->d2 != t1->d2){
return 0;
}
if(t0->current_index == 0 && t1->current_index != 0 && t1->list_indicies[t1->current_index - 1] != 0){
return 0;
}
if(t1->current_index == 0 && t0->current_index != 0 && t0->list_indicies[t0->current_index - 1] != 0){
return 0;
}
if(!t0->current_index || !t1->current_index){
return 1;
}
t0_index = t0->current_index;
t1_index = t1->current_index;
for(i = 0; i < 8; i++){
t0_index--;
t1_index--;
if(t0->list_indicies[t0_index] != t1->list_indicies[t1_index]){
return 0;
}
if(t0_index == 0 && t1_index != 0 && t1->list_indicies[t1_index - 1] != 0){
return 0;
}
if(t1_index == 0 && t0_index != 0 && t0->list_indicies[t0_index - 1] != 0){
return 0;
}
if(!t0_index || !t1_index){
break;
}
}
return 1;
}
type get_argument_type(type *t){
type_entry next_type_entry;
type output;
unsigned int function_count = 0;
unsigned int current_entry_index = 0;
output = EMPTY_TYPE;
output.current_index = MAX_LISTS - 1;//Have to put indicies in reverse order
while((next_type_entry = pop_type(t)) >= 4 || function_count){
poke_type_entry(&output, next_type_entry, current_entry_index);
current_entry_index++;
if(next_type_entry == type_function){
function_count++;
} else if(function_count && next_type_entry == type_returns){
function_count--;
}
if(next_type_entry == type_list){
t->current_index--;
output.list_indicies[output.current_index] = t->list_indicies[t->current_index];
output.current_index--;
}
}
poke_type_entry(&output, next_type_entry, current_entry_index);
output.current_index = MAX_LISTS;
return output;
}
void print_type(type *t){
uint64_t d0;
uint64_t d1;
uint64_t d2;
unsigned int index;
unsigned int type_entry_int;
d0 = t->d0;
d1 = t->d1;
d2 = t->d2;
index = t->current_index;
while(d0 | d1 | d2){
type_entry_int = 0;
if(d0&1){
type_entry_int |= 1;
}
if(d1&1){
type_entry_int |= 2;
}
if(d2&1){
type_entry_int |= 4;
}
switch(type_entry_int){
case type_void:
printf("void, ");
break;
case type_int:
printf("int, ");
break;
case type_char:
printf("char, ");
break;
case type_pointer:
printf("pointer to ");
break;
case type_function:
printf("function ( ");
break;
case type_returns:
printf(") returning ");
break;
case type_list:
index--;
printf("list of length %d of ", t->list_indicies[index]);
break;
default:
printf("unknown ");
}
d0 >>= 1;
d1 >>= 1;
d2 >>= 1;
}
}
static void parse_type_recursive(type *t, char **c, char *identifier_name, char *argument_names, unsigned int identifier_length, unsigned int num_arguments);
void parse_type(type *t, char **c, char *identifier_name, char *argument_names, unsigned int identifier_length, unsigned int num_arguments){
skip_whitespace(c);
if(!parse_datatype(t, c)){
snprintf(error_message, sizeof(error_message), "Expected 'void', 'int', or 'char'");
do_error(1);
}
skip_whitespace(c);
parse_type_recursive(t, c, identifier_name, argument_names, identifier_length, num_arguments);
}
void parse_type_arguments(type *t, char **c, char *argument_names, unsigned int identifier_length, unsigned int num_arguments){
type temp_type = (type) {.d0 = 0, .d1 = 0, .d2 = 0};
if(**c == ')'){
return;
}
if(argument_names && !num_arguments){
snprintf(error_message, sizeof(error_message), "Too many arguments!");
do_error(1);;
}
parse_type(&temp_type, c, argument_names, NULL, identifier_length, 0);
if(peek_type(&temp_type) == type_list){
pop_type(&temp_type);
temp_type.current_index--;
add_type_entry(&temp_type, type_pointer);
}
skip_whitespace(c);
if(**c == ','){
++*c;
skip_whitespace(c);
if(argument_names && num_arguments){
num_arguments--;
argument_names += identifier_length;
}
parse_type_arguments(t, c, argument_names, identifier_length, num_arguments);
} else if(**c != ')'){
snprintf(error_message, sizeof(error_message), "Expected ',' or ')'\n");
do_error(1);
}
append_type(t, temp_type);
}
static void parse_type_recursive(type *t, char **c, char *identifier_name, char *argument_names, unsigned int identifier_length, unsigned int num_arguments){
type inner_type = EMPTY_TYPE;
type list_type = EMPTY_TYPE;
skip_whitespace(c);
while(**c == '*'){
add_type_entry(t, type_pointer);
++*c;
skip_whitespace(c);
}
if(!parse_identifier(c, identifier_name, identifier_length) && **c == '('){
++*c;
skip_whitespace(c);
parse_type_recursive(&inner_type, c, identifier_name, argument_names, identifier_length, num_arguments);
if(**c != ')'){
snprintf(error_message, sizeof(error_message), "Expected ')'");
do_error(1);
}
++*c;
}
skip_whitespace(c);
if(**c == '('){
add_type_entry(t, type_returns);
++*c;
skip_whitespace(c);
parse_type_arguments(t, c, argument_names, identifier_length, num_arguments);
++*c;
add_type_entry(t, type_function);
if(**c == '(' || **c == '['){
snprintf(error_message, sizeof(error_message), "Invalid type");
do_error(1);
}
} else if(**c == '['){
while(**c == '['){
add_type_entry(&list_type, type_list);
++*c;
list_type.list_indicies[list_type.current_index] = strtol(*c, c, 10);
list_type.current_index++;
skip_whitespace(c);
if(**c != ']'){
snprintf(error_message, sizeof(error_message), "Expected ']'");
do_error(1);
}
++*c;
}
}
append_type(t, list_type);
append_type(t, inner_type);
}

@ -0,0 +1,38 @@
#include <stdint.h>
#define MAX_LISTS 8
typedef enum {
type_none = 0,
type_void = 1,
type_int = 2,
type_char = 3,
type_pointer = 4,
type_function = 5,
type_returns = 6,
type_list = 7} type_entry;
typedef struct {
uint64_t d0;
uint64_t d1;
uint64_t d2;
unsigned int list_indicies[MAX_LISTS];
unsigned int current_index;
} type;
unsigned char alpha(char c);
unsigned char alphanumeric(char c);
unsigned char digit(char c);
void add_type_entry(type *t, type_entry entry);
unsigned char is_whitespace(char *c);
void skip_whitespace(char **c);
int peek_type(type *t);
int pop_type(type *t);
unsigned char types_equal(type *t0, type *t1);
unsigned char parse_datatype(type *t, char **c);
type get_argument_type(type *t);
void print_type(type *t);
void parse_type(type *t, char **c, char *identifier_name, char *argument_names, unsigned int identifier_length, unsigned int num_arguments);
extern type INT_TYPE;
extern type CHAR_TYPE;
extern type VOID_TYPE;
extern type EMPTY_TYPE;

@ -0,0 +1,273 @@
#ifndef COMMON_H
#define COMMON_H
#pragma GCC diagnostic ignored "-Wstringop-truncation"
#pragma GCC diagnostic ignored "-Wunused-result"
const char* version = (char*)"v2.8.5";
#include <cstdio>
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <termios.h>
/* output style: 16 color mode */
#define VT100_STYLE_NORMAL "0"
#define VT100_STYLE_BOLD "1"
#define VT100_STYLE_DARK "2"
#define VT100_STYLE_BACKGROUND "3"
#define VT100_STYLE_UNDERLINE "4"
/* output color: 16 color mode */
#define VT100_COLOR_BLACK "30"
#define VT100_COLOR_RED "31"
#define VT100_COLOR_GREEN "32"
#define VT100_COLOR_YELLOW "33"
#define VT100_COLOR_BLUE "34"
#define VT100_COLOR_PURPLE "35"
#define VT100_COLOR_SKYBLUE "36"
#define VT100_COLOR_WHITE "37"
#define VT100_COLOR_NORMAL "38"
#define log(fmt, ...) \
fprintf(stderr, \
"\033[" VT100_STYLE_NORMAL ";" VT100_COLOR_BLUE "m[LOG] \033[0m" \
"\033[" VT100_STYLE_DARK ";" VT100_COLOR_NORMAL "m%s:%d: \033[0m" \
fmt "\n", __func__, __LINE__, ## __VA_ARGS__)
#define logw(fmt, ...) \
fprintf(stderr, \
"\033[" VT100_STYLE_NORMAL ";" VT100_COLOR_YELLOW "m[WARN] \033[0m" \
"\033[" VT100_STYLE_DARK ";" VT100_COLOR_NORMAL "m%s:%d: \033[0m" \
fmt "\n", __func__, __LINE__, ## __VA_ARGS__)
#define loge(fmt, ...) \
fprintf(stderr, \
"\033[" VT100_STYLE_NORMAL ";" VT100_COLOR_RED "m[ERROR] \033[0m" \
"\033[" VT100_STYLE_DARK ";" VT100_COLOR_NORMAL "m%s:%d: \033[0m" \
fmt "\n", __func__, __LINE__, ## __VA_ARGS__)
// inner log
#define logi(fmt, ...) \
fprintf(stderr, \
"\033[" VT100_STYLE_NORMAL ";" VT100_COLOR_BLUE "m[LOG] \033[0m" \
"\033[" VT100_STYLE_DARK ";" VT100_COLOR_NORMAL "m%s:%d: \033[0m" \
"==> " fmt "\n", __func__, __LINE__, ## __VA_ARGS__)
#define eprintf(...) do { \
loge(__VA_ARGS__); \
exit(0); \
} while(0)
/* detects the width and height of local screen firstly by `ioctl`
*
* usage of ioctl:
* struct winsize ws;
* ioctl(STDIN_FILENO, TIOCGWINSZ, &size);
* ws.ws_col;
* ws.ws_row;
*/
struct pos_t {
uint8_t x;
uint8_t y;
};
// format of messages sended from client to server
typedef struct client_message_t {
uint8_t command;
char user_name[USERNAME_SIZE]; // last byte must be zero
union
{
char message[MSG_SIZE];
char password[PASSWORD_SIZE];
};
} client_message_t;
// format of messages sended from server to client
typedef struct server_message_t {
union {
uint8_t response;
uint8_t message;
};
union {
// support at most five users
char friend_name[USERNAME_SIZE];
struct {
char user_name[USERNAME_SIZE];
uint8_t user_state;
} all_users[USER_CNT];
struct {
uint16_t life, index, bullets_num, color;
pos_t user_pos[USER_CNT];
uint8_t user_color[USER_CNT];
uint8_t map[BATTLE_H][BATTLE_W / 2 + 1];
//pos_t item_pos[MAX_ITEM];
//uint8_t item_kind[MAX_ITEM];
};
struct {
char name[USERNAME_SIZE];
uint8_t namecolor;
uint8_t kill;
uint8_t death;
uint8_t score;
uint16_t life;
} users[USER_CNT];
struct {
char from_user[USERNAME_SIZE];
char msg[MSG_SIZE];
}; // for message
};
} server_message_t;
enum {
CLIENT_COMMAND_USER_QUIT,
CLIENT_COMMAND_USER_REGISTER,
CLIENT_COMMAND_USER_LOGIN,
CLIENT_COMMAND_USER_LOGOUT,
CLIENT_MESSAGE_FATAL,
CLIENT_COMMAND_FETCH_ALL_USERS,
CLIENT_COMMAND_FETCH_ALL_FRIENDS,
CLIENT_COMMAND_LAUNCH_BATTLE,
CLIENT_COMMAND_LAUNCH_FFA,
CLIENT_COMMAND_QUIT_BATTLE,
CLIENT_COMMAND_ACCEPT_BATTLE,
CLIENT_COMMAND_REJECT_BATTLE,
CLIENT_COMMAND_INVITE_USER,
CLIENT_COMMAND_SEND_MESSAGE,
CLIENT_COMMAND_MOVE_UP,
CLIENT_COMMAND_MOVE_DOWN,
CLIENT_COMMAND_MOVE_LEFT,
CLIENT_COMMAND_MOVE_RIGHT,
CLIENT_COMMAND_FIRE_UP,
CLIENT_COMMAND_FIRE_DOWN,
CLIENT_COMMAND_FIRE_LEFT,
CLIENT_COMMAND_FIRE_RIGHT,
CLIENT_COMMAND_FIRE_UP_LEFT,
CLIENT_COMMAND_FIRE_UP_RIGHT,
CLIENT_COMMAND_FIRE_DOWN_LEFT,
CLIENT_COMMAND_FIRE_DOWN_RIGHT,
CLIENT_COMMAND_FIRE_AOE_UP,
CLIENT_COMMAND_FIRE_AOE_DOWN,
CLIENT_COMMAND_FIRE_AOE_LEFT,
CLIENT_COMMAND_FIRE_AOE_RIGHT,
CLIENT_COMMAND_ADMIN_CONTROL,
CLIENT_COMMAND_PUT_LANDMINE,
CLIENT_COMMAND_MELEE,
CLIENT_COMMAND_END,
};
enum {
SERVER_SAY_NOTHING,
SERVER_RESPONSE_REGISTER_SUCCESS,
SERVER_RESPONSE_REGISTER_FAIL,
SERVER_RESPONSE_YOU_HAVE_REGISTERED,
SERVER_RESPONSE_LOGIN_SUCCESS,
SERVER_RESPONSE_YOU_HAVE_LOGINED,
SERVER_RESPONSE_YOU_HAVE_NOT_LOGIN,
SERVER_RESPONSE_LOGIN_FAIL_UNREGISTERED_USERID,
SERVER_RESPONSE_LOGIN_FAIL_ERROR_PASSWORD,
SERVER_RESPONSE_LOGIN_FAIL_DUP_USERID, // user id has been registered by other users
SERVER_RESPONSE_LOGIN_FAIL_SERVER_LIMITS, // server unable to handle more users
SERVER_RESPONSE_ALL_USERS_INFO,
SERVER_RESPONSE_ALL_FRIENDS_INFO,
SERVER_RESPONSE_LAUNCH_BATTLE_FAIL,
SERVER_RESPONSE_LAUNCH_BATTLE_SUCCESS,
SERVER_RESPONSE_YOURE_NOT_IN_BATTLE,
SERVER_RESPONSE_YOURE_ALREADY_IN_BATTLE,
SERVER_RESPONSE_INVITATION_SENT,
SERVER_RESPONSE_NOBODY_INVITE_YOU,
/* ----------------------------------------------- */
SERVER_MESSAGE,
SERVER_STATUS_QUIT,
SERVER_STATUS_FATAL,
SERVER_MESSAGE_DELIM,
SERVER_MESSAGE_FRIEND_LOGIN,
SERVER_MESSAGE_FRIEND_LOGOUT,
SERVER_MESSAGE_FRIEND_ACCEPT_BATTLE,
SERVER_MESSAGE_FRIEND_REJECT_BATTLE,
SERVER_MESSAGE_FRIEND_NOT_LOGIN,
SERVER_MESSAGE_FRIEND_ALREADY_IN_BATTLE,
SERVER_MESSAGE_INVITE_TO_BATTLE,
SERVER_MESSAGE_FRIEND_MESSAGE,
SERVER_MESSAGE_USER_QUIT_BATTLE,
SERVER_MESSAGE_BATTLE_DISBANDED, // since no other users in this battle
SERVER_MESSAGE_BATTLE_INFORMATION,
SERVER_MESSAGE_BATTLE_PLAYER,
SERVER_MESSAGE_YOU_ARE_DEAD,
SERVER_MESSAGE_YOU_ARE_SHOOTED,
SERVER_MESSAGE_YOU_ARE_TRAPPED_IN_MAGMA,
SERVER_MESSAGE_YOU_GOT_BLOOD_VIAL,
SERVER_MESSAGE_YOU_GOT_MAGAZINE,
SERVER_MESSAGE_YOUR_MAGAZINE_IS_EMPTY,
};
/* some special characters(terminal graph):
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* */
// output colored text
// for example:
// printf("\033[{style};{color}mHello World!\n\033[0m");
//
// where {style} is interger range from 0 to 4, {color} is a
// interger range from 30 to 38
//
//
// 256 color support:
// control code: "\033[48;5;{color}m" or "\033[38;5;{color}m"
//
// where {color} is a interger range from 0 to 255, see more
// details in 256-colors.py
//
//
// cursor move:
// control code: "\033" (\033 is ascii code of <esc>)
//
// cursor up: "\033[{count}A"
// moves the cursor up by count rows;
// the default count is 1.
//
// cursor down: "\033[{count}B"
// moves the cursor down by count rows;
// the default count is 1.
//
// cursor forward: "\033[{count}C"
// moves the cursor forward by count columns;
// the default count is 1.
//
// cursor backward: "\033[{count}D"
// moves the cursor backward by count columns;
// the default count is 1.
//
// set cursor position: "\033[{row};{column}f"
//
#endif

@ -0,0 +1,209 @@
// constants for both server and client
#ifndef CONSTANTS_H
#define CONSTANTS_H
#define SCR_W 80
#define SCR_H 23
#define BATTLE_W 60
#define BATTLE_H (SCR_H - 2)
#define FFA_MAP_W BATTLE_W
#define FFA_MAP_H BATTLE_H
#define IPADDR_SIZE 24
#define USERNAME_SIZE 12
#define MSG_SIZE 96
#define USER_CNT 14
#define LANDMINE_COST 12
#define INF 1e9
#define PASSWORD_SIZE USERNAME_SIZE
enum {
ITEM_NONE,
ITEM_MAGAZINE,
ITEM_MAGMA,
ITEM_GRASS,
ITEM_BLOOD_VIAL,
ITEM_END,
ITEM_BULLET,
ITEM_LANDMINE,
ITEM_SIZE, // make it on the end!
};
enum {
MAP_ITEM_NONE,
MAP_ITEM_MY_BULLET,
MAP_ITEM_OTHER_BULLET,
MAP_ITEM_MAGAZINE,
MAP_ITEM_BLOOD_VIAL,
MAP_ITEM_MAGMA,
MAP_ITEM_USER,
MAP_ITEM_OTHER_USER,
MAP_ITEM_GRASS,
MAP_ITEM_LANDMINE,
MAP_ITEM_END,
};
enum {
DIR_UP,
DIR_DOWN,
DIR_LEFT,
DIR_RIGHT,
DIR_UP_LEFT,
DIR_UP_RIGHT,
DIR_DOWN_LEFT,
DIR_DOWN_RIGHT,
};
enum {
BATTLE_STATE_UNJOINED,
BATTLE_STATE_LIVE,
BATTLE_STATE_WITNESS,
BATTLE_STATE_DEAD,
};
/* unused --> not login --> login <-...-> battle
*
* unused --> not login --> unused // login fail
*
* login <--> invited to battle <--> battle
* */
#define USER_STATE_UNUSED 0
#define USER_STATE_NOT_LOGIN 1
#define USER_STATE_LOGIN 2
#define USER_STATE_BATTLE 3
#define USER_STATE_WAIT_TO_BATTLE 4
#define BLACK "\e[0;30m"
#define L_BLACK "\e[1;30m"
#define RED "\e[0;31m"
#define L_RED "\e[1;31m"
#define GREEN "\e[0;32m"
#define L_GREEN "\e[1;32m"
#define BROWN "\e[0;33m"
#define YELLOW "\e[1;33m"
#define BLUE "\e[0;34m"
#define L_BLUE "\e[1;34m"
#define PURPLE "\e[0;35m"
#define L_PURPLE "\e[1;35m"
#define CYAN "\e[0;36m"
#define L_CYAN "\e[1;36m"
#define GRAY "\e[0;37m"
#define WHITE "\e[1;37m"
#define BOLD "\e[1m"
#define UNDERLINE "\e[4m"
#define BLINK "\e[5m"
#define REVERSE "\e[7m"
#define HIDE "\e[8m"
#define CLEAR "\e[2J"
#define CLRLINE "\r\e[K"
#define NONE "\e[0m"
char* signal_name_s[128];
char* color_s[128];
char* map_s[128];
char* item_s[128];
char* dir_s[128];
int item_to_map[128];
int color_s_size;
struct point_t {
int x, y;
};
point_t dir_offset[] = {
[DIR_UP] = {0, -1},
[DIR_DOWN] = {0, 1},
[DIR_LEFT] = {-1, 0},
[DIR_RIGHT] = {1, 0},
[DIR_UP_LEFT] = {-1, -1},
[DIR_UP_RIGHT] = {1, -1},
[DIR_DOWN_LEFT] = {-1, 1},
[DIR_DOWN_RIGHT] = {1, 1},
};
void init_constants() {
item_s[ITEM_NONE] = (char*)"none";
item_s[ITEM_MAGAZINE] = (char*)"magazine";
item_s[ITEM_MAGMA] = (char*)"magma";
item_s[ITEM_GRASS] = (char*)"grass";
item_s[ITEM_BLOOD_VIAL] = (char*)"blood_vial";
item_s[ITEM_END] = (char*)"end";
item_s[ITEM_BULLET] = (char*)"bullet";
item_s[ITEM_LANDMINE] = (char*)"landmine";
dir_s[DIR_UP] = (char*)"up";
dir_s[DIR_DOWN] = (char*)"down";
dir_s[DIR_LEFT] = (char*)"left";
dir_s[DIR_RIGHT] = (char*)"right";
dir_s[DIR_UP_LEFT] = (char*)"up&left";
dir_s[DIR_UP_RIGHT] = (char*)"up&right";
dir_s[DIR_DOWN_LEFT] = (char*)"down&left";
dir_s[DIR_DOWN_RIGHT] = (char*)"down&right";
map_s[MAP_ITEM_NONE] = (char*)" ";
map_s[MAP_ITEM_MAGAZINE] = (char*)"+";
map_s[MAP_ITEM_MAGMA] = (char*)"X";
map_s[MAP_ITEM_GRASS] = (char*)"\033[2;37m█\033[0m";
map_s[MAP_ITEM_BLOOD_VIAL] = (char*)"*";
map_s[MAP_ITEM_MY_BULLET] = (char*)".";
map_s[MAP_ITEM_OTHER_BULLET] = (char*)".";
map_s[MAP_ITEM_USER] = (char*)"A";
map_s[MAP_ITEM_LANDMINE] = (char*)"o";
map_s[MAP_ITEM_END] = (char*)" ";
item_to_map[ITEM_NONE] = MAP_ITEM_NONE;
item_to_map[ITEM_MAGAZINE] = MAP_ITEM_MAGAZINE;
item_to_map[ITEM_MAGMA] = MAP_ITEM_MAGMA;
item_to_map[ITEM_GRASS] = MAP_ITEM_GRASS;
item_to_map[ITEM_BLOOD_VIAL] = MAP_ITEM_BLOOD_VIAL;
item_to_map[ITEM_LANDMINE] = MAP_ITEM_LANDMINE;
item_to_map[ITEM_END] = MAP_ITEM_END;
signal_name_s[SIGHUP ] = (char*)"SIGHUP";
signal_name_s[SIGINT ] = (char*)"SIGINT";
signal_name_s[SIGQUIT ] = (char*)"SIGQUIT";
signal_name_s[SIGILL ] = (char*)"SIGILL" ;
signal_name_s[SIGABRT ] = (char*)"SIGABRT";
signal_name_s[SIGFPE ] = (char*)"SIGFPE" ;
signal_name_s[SIGKILL ] = (char*)"SIGKILL";
signal_name_s[SIGSEGV ] = (char*)"SIGSEGV";
signal_name_s[SIGPIPE ] = (char*)"SIGPIPE";
signal_name_s[SIGALRM ] = (char*)"SIGALRM";
signal_name_s[SIGTERM ] = (char*)"SIGTERM";
signal_name_s[SIGUSR1 ] = (char*)"SIGUSR1";
signal_name_s[SIGUSR2 ] = (char*)"SIGUSR2";
signal_name_s[SIGCHLD ] = (char*)"SIGCHLD";
signal_name_s[SIGCONT ] = (char*)"SIGCONT";
signal_name_s[SIGSTOP ] = (char*)"SIGSTOP";
signal_name_s[SIGTSTP ] = (char*)"SIGTSTP";
signal_name_s[SIGTTIN ] = (char*)"SIGTTIN";
signal_name_s[SIGTTOU ] = (char*)"SIGTTOU";
signal_name_s[SIGBUS ] = (char*)"SIGBUS" ;
signal_name_s[SIGPOLL ] = (char*)"SIGPOLL";
signal_name_s[SIGPROF ] = (char*)"SIGPROF";
signal_name_s[SIGSYS ] = (char*)"SIGSYS" ;
signal_name_s[SIGTRAP ] = (char*)"SIGTRAP";
signal_name_s[SIGURG ] = (char*)"SIGURG" ;
signal_name_s[SIGVTALRM] = (char*)"SIGVTALRM";
signal_name_s[SIGXCPU ] = (char*)"SIGXCPU";
signal_name_s[SIGXFSZ ] = (char*)"SIGXFSZ";
color_s[0] = (char*)NONE;
color_s[1] = (char*)L_GREEN;
color_s[2] = (char*)L_RED;
color_s[3] = (char*)YELLOW;
color_s[4] = (char*)L_BLUE;
color_s[5] = (char*)L_PURPLE;
color_s[6] = (char*)L_CYAN;
color_s[7] = (char*)(RED UNDERLINE);
color_s[8] = (char*)(GREEN UNDERLINE);
color_s[9] = (char*)(BROWN UNDERLINE);
color_s[10] = (char*)(BLUE UNDERLINE);
color_s[11] = (char*)(PURPLE UNDERLINE);
color_s[12] = (char*)(CYAN UNDERLINE);
color_s_size = 12;
};
#endif

@ -0,0 +1,41 @@
#ifndef FUNC_H
#define FUNC_H
#include <sys/time.h>
int min(int a, int b) {
return a < b ? a : b;
}
int max(int a, int b) {
return a > b ? a : b;
}
bool probability(int x, int y) {
return (rand() % y) <= (x - 1);
}
uint64_t myclock() {
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
}
char* sformat(const char* format, ...) {
static char text[1024];
va_list ap;
va_start(ap, format);
int len = vsprintf(text, format, ap);
va_end(ap);
/*
if (len >= (int)sizeof(text)){
eprintf("buffer overflow\n");
}
*/
return text;
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,27 @@
// constants only for server
#ifndef SERVER_H
#define SERVER_H
static int INIT_BULLETS = 12;
static int MAX_BULLETS = 480;
static int BULLETS_PER_MAGAZINE = 12;
static int INIT_LIFE = 5;
static int MAX_LIFE = 20;
static int LIFE_PER_VIAL = 5;
#define INIT_GRASS 5
#define MAGMA_INIT_TIMES 3
#define MAX_OTHER 20
static int BULLETS_LASTS_TIME = 100;
static int OTHER_ITEM_LASTS_TIME = 1000;
#define GLOBAL_SPEED 20
#define BULLET_SPEED 2
#define ADMIN_COMMAND_LEN 32
#endif
Loading…
Cancel
Save