* License header formatting change

* New IFF chunk formats supported: CST, FBMP, CATS
* Rebranded libfar to simply far
* Started preliminary work on the hitutils package
This commit is contained in:
Fatbag 2012-05-21 23:27:44 -05:00
parent 55659f43b5
commit bc51bb4aad
96 changed files with 2321 additions and 424 deletions

View file

@ -1,5 +1,8 @@
/*
iff2html.c - Copyright (c) 2012 Fatbag <X-Fi6@phppoll.org>
iff2html - iff web page description generator
iff2html.c - Copyright (c) 2012 Niotso Project <http://niotso.org/>
Author(s): Fatbag <X-Fi6@phppoll.org>
Ahmed El-Mahdawy <aa.mahdawy.10@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -140,7 +143,7 @@ int main(int argc, char *argv[]){
printf("%sChunk data is corrupt.", "iff2html: error: ");
return -1;
}
/* Calculate the MD5, and then we can free the IFF data because we're done with it */
MD5Init(&md5c);
MD5Update(&md5c, IFFData, FileSize);
@ -269,7 +272,6 @@ int main(int argc, char *argv[]){
fprintf(hFile, "\n");
for(i=1, ChunkData = IFFFileInfo->Chunks; i <= IFFFileInfo->ChunkCount; i++, ChunkData++){
IFF_STR * StringData = (IFF_STR*) ChunkData->FormattedData;
fprintf(hFile, "<h2 id=\"chunk%u_%.4x\">%u [%s] (%.4X)%s%s <a href=\"#chunk%u_%.4x\">(Jump)</a></h2>\n",
i, ChunkData->ChunkID, i, ChunkData->Type, ChunkData->ChunkID,
(ChunkData->Label[0] != 0x00) ? " &ndash; " : "", ChunkData->Label,
@ -281,11 +283,13 @@ int main(int argc, char *argv[]){
}else if(!strcmp(ChunkData->Type, "STR#") ||
!strcmp(ChunkData->Type, "CTSS") ||
!strcmp(ChunkData->Type, "FAMs") ||
!strcmp(ChunkData->Type, "TTAs") ){
!strcmp(ChunkData->Type, "TTAs") ||
!strcmp(ChunkData->Type, "CST") ){
/****
** STR# parsing
*/
IFFString * StringData = ChunkData->FormattedData;
fprintf(hFile, "<table>\n");
fprintf(hFile, "<tr><td>Format:</td><td>");
switch(StringData->Format){
@ -346,23 +350,71 @@ int main(int argc, char *argv[]){
fprintf(hFile, "</table>\n");
}
}else if(!strcmp(ChunkData->Type, "CATS")){
/****
** CATS parsing
*/
IFFStringPair * Pair = ChunkData->FormattedData;
fprintf(hFile, "<table class=\"center\">\n");
fprintf(hFile, "<tr><th>Key</th><th>Value</th></tr>\n");
fprintf(hFile, "<tr><td>%s</td><td>%s</td></tr>\n",
(Pair->Key) != NULL ? Pair->Key : "",
(Pair->Value) != NULL ? Pair->Value : "");
fprintf(hFile, "</table>\n");
}else if(!strcmp(ChunkData->Type, "FWAV")){
/****
** Regular string
*/
fprintf(hFile, "<table class=\"center\">\n");
fprintf(hFile, "<tr><th>String</th></tr>\n");
fprintf(hFile, "<tr><td>%s</td></tr>\n", ChunkData->FormattedData ? (char*) ChunkData->FormattedData : "");
fprintf(hFile, "</table>\n");
}else if(!strcmp(ChunkData->Type, "BCON")){
/****
** BCON parsing
*/
IFF_BCON * BCONData = (IFF_BCON*) ChunkData->FormattedData;
IFF_BCON * BCONData = ChunkData->FormattedData;
fprintf(hFile, "<table>\n");
fprintf(hFile, "<tr><td>Flags:</td><td><tt>%02X</tt> (%d)</td></tr>\n", BCONData->Flags, BCONData->Flags);
fprintf(hFile, "</table>\n");
if(BCONData->ConstantCount > 0){
unsigned ConstantIndex;
unsigned i;
fprintf(hFile, "<br />\n");
fprintf(hFile, "<table class=\"center\">\n");
fprintf(hFile, "<tr><th colspan=\"2\">Constant Value</th></tr>\n");
for(ConstantIndex=0; ConstantIndex<BCONData->ConstantCount; ConstantIndex++)
fprintf(hFile, "<tr><td>%u</td><td>%u</td></tr>\n", ConstantIndex+1, BCONData->Constants[ConstantIndex]);
for(i=0; i<BCONData->ConstantCount; i++)
fprintf(hFile, "<tr><td>%u</td><td>%u</td></tr>\n", i+1, BCONData->Constants[i]);
fprintf(hFile, "</table>\n");
}
}else if(!strcmp(ChunkData->Type, "TRCN")){
/****
** TRCN parsing
*/
IFFRangeSet * RangeSet = ChunkData->FormattedData;
fprintf(hFile, "<table>\n");
fprintf(hFile, "<tr><td>Version:</td><td>%u</td></tr>\n", RangeSet->Version);
fprintf(hFile, "</table>\n");
if(RangeSet->RangeCount > 0){
unsigned i;
IFFRangeEntry * Range;
fprintf(hFile, "<br />\n");
fprintf(hFile, "<table class=\"center\">\n");
fprintf(hFile, "<tr><th>Used yet</th><th>Default value</th><th>Name</th>"
"<th>Comment</th><th>Range is enforced</th><th>Minimum</th><th>Maximum</th></tr>\n");
for(i=0, Range=RangeSet->Ranges; i<RangeSet->RangeCount; i++, Range++)
fprintf(hFile, "<tr><td>%s</td><td>%u</td><td>%s</td><td>%s</td><td>%s</td><td>%u</td><td>%u</td></tr>\n",
Range->IsUnused ? "No" : "Yes", Range->DefaultValue,
Range->Name ? Range->Name : "",
Range->Comment ? Range->Comment : "",
Range->Enforced ? "Yes" : "No",
Range->RangeMin, Range->RangeMax);
fprintf(hFile, "</table>\n");
}
}
@ -377,7 +429,7 @@ int main(int argc, char *argv[]){
fprintf(hFile, "</body>\n");
fprintf(hFile, "</html>");
fclose(hFile);
printf("Wrote contents to '%s'.\n", OutFile);
return 0;
}

View file

@ -1,125 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css; charset=utf-8" />
<meta http-equiv="Content-Language" content="en" />
<meta name="description" content="behavior.iff (iff2html)" />
<meta name="generator" content="iff2html" />
<title>behavior.iff (iff2html)</title>
<style type="text/css" media="all">
html, body {
background: #fff;
color: #000;
font-family: sans-serif;
}
a:link, a:visited, a:hover, a:active { color: #00f; }
a:link, a:visited { text-decoration: none; }
a:hover, a:active { text-decoration: underline; }
#attributes {
border-left: 2px solid #888; padding-left: 4px; margin-bottom: 1em;
}
#toc {
display: table-cell;
margin-top: 1em;
background: #eee; border: 1px solid #bbb;
padding: .25em;
}
#toc div {
border-bottom: 1px solid #aaa;
}
#toc ul {
list-style-type: none;
padding: 0;
}
ul ul {
padding: 2em;
}
h2 {
border-bottom: 1px solid #888;
margin: 2em 0 0.25em 0;
}
h2 a {
font-size: 9pt;
}
table {
border: 1px #aaa solid;
border-collapse: collapse;
}
th, td {
border: 1px #aaa solid;
padding: 0.2em;
}
.center {
margin: auto auto;
}
#footer {
margin-top: 1.75em;
text-align: center;
}
</style>
</head>
<body>
<h1>behavior.iff</h1>
<div id="attributes">
<div>9809b96803833f2891ddd31e474795a9 (md5), 42.4kB (43,446 bytes)</div>
<div>Dumped by iff2html.</div></div>
<div id="toc"><div><b>Contents</b> &ndash; x chunks</div>
<ul>
<li><a href="#chunk1_00dd">1 [STR#] (00DD) &ndash; neighbor data labels</a></li>
<li><a href="#chunk2_00ea">2 [STR#] (00EA) &ndash; build mode types</a></li>
</ul>
</div>
<h2 id="chunk1_00dd">1 [STR#] (00DD) &ndash; neighbor data labels <a href="#chunk1_00dd">(Jump)</a></h2>
<div>
<table>
<tr><td>Format:</td><td><tt>FC FF</tt> (&minus;4)</td></tr>
</table><br />
<table class="center">
<tr><th>Language</th><th colspan="3">String pairs</th></tr>
<tr><td rowspan="10">English (US)</td>
<td>1</td><td>person instance id</td><td>4</td></tr>
<tr><td>2</td><td>belongs in house</td><td>4</td></tr>
<tr><td>3</td><td>person age</td><td>4</td></tr>
<tr><td>4</td><td>relationship raw score</td><td>4</td></tr>
<tr><td>5</td><td>relationship score</td><td>4</td></tr>
<tr><td>6</td><td>friend count</td><td>4</td></tr>
<tr><td>7</td><td>house number</td><td>4</td></tr>
<tr><td>8</td><td>has telephone</td><td>4</td></tr>
<tr><td>9</td><td>has baby</td><td>4</td></tr>
<tr><td>10</td><td>family friend count</td><td>4</td></tr>
</table>
</div>
<h2 id="chunk2_00ea">2 [STR#] (00EA) &ndash; build mode types <a href="#chunk2_00ea">(Jump)</a></h2>
<div>
<table>
<tr><td>Format:</td><td><tt>FC FF</tt> (&minus;4)</td></tr>
</table><br />
<table class="center">
<tr><th>Language</th><th colspan="3">String pairs</th></tr>
<tr><td rowspan="8">English (US)</td>
<td>1</td><td>none</td><td>4</td></tr>
<tr><td>2</td><td>door</td><td>4</td></tr>
<tr><td>3</td><td>window</td><td>4</td></tr>
<tr><td>4</td><td>stair</td><td>4</td></tr>
<tr><td>5</td><td>plant</td><td>4</td></tr>
<tr><td>6</td><td>fireplace</td><td>4</td></tr>
<tr><td>7</td><td>column</td><td>4</td></tr>
<tr><td>8</td><td>pool equipment</td><td>4</td></tr>
</table>
</div>
<div id="footer">This page was generated by the use of <a href="http://www.niotso.org/">iff2html</a>.
The content of this page may be subject to copyright by the author(s) of the original iff file.</div>
</body>
</html>

View file

@ -107,7 +107,7 @@ void MD5Update(ctx, buf, len)
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void MD5Final(digest, ctx)

View file

@ -9,7 +9,7 @@
the byteReverse function in md5.c must be invoked. However,
byteReverse is coded in such a way that it is an identity
function when run on a little-endian machine, so calling it
on such a platform causes no harm apart from wasting time.
on such a platform causes no harm apart from wasting time.
If the platform is known to be little-endian, we speed
things up by undefining HIGHFIRST, which defines
byteReverse as a null macro. Doing things in this manner