remote TABs in doc/ and test/
This commit is contained in:
parent
b9ea77b185
commit
7445550831
97 changed files with 5956 additions and 5963 deletions
|
@ -32,7 +32,7 @@ more information.
|
|||
<sect>Binary format<p>
|
||||
|
||||
The standard binary file format generated by the linker for the
|
||||
Apple ][ target is an <url name="AppleSingle"
|
||||
Apple ][ target is an <url name="AppleSingle"
|
||||
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
|
||||
The default load address is $803.
|
||||
|
||||
|
@ -580,18 +580,18 @@ url="ca65.html" name="assembler manual">.
|
|||
ProDOS associates a file type and an auxiliary type with each file.
|
||||
These type specifications are separate from the file's name, unlike
|
||||
Windows which uses the file name's suffix (a.k.a.
|
||||
extension) to specify the file type. For example, <tt/.exe/,
|
||||
extension) to specify the file type. For example, <tt/.exe/,
|
||||
<tt/.doc/, or <tt/.bat/.
|
||||
The ProDOS low-level
|
||||
Machine-Language Interface (MLI) functions for creating and opening
|
||||
The ProDOS low-level
|
||||
Machine-Language Interface (MLI) functions for creating and opening
|
||||
files require these types to be specified. And if they don't match
|
||||
with the file being opened, the operation may fail.
|
||||
|
||||
In contrast, the ISO C function <tt/fopen()/ and the POSIX function
|
||||
<tt/open()/ have no parameter to specify either a file type or an
|
||||
auxiliary type. Therefore, some additional mechanism for specifying
|
||||
the file types is needed.
|
||||
|
||||
the file types is needed.
|
||||
|
||||
<tag>Specifying the File Type and Auxiliary Type</tag>
|
||||
|
||||
There are two global variables provided that allow the file type
|
||||
|
@ -603,7 +603,7 @@ url="ca65.html" name="assembler manual">.
|
|||
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
|
||||
extern unsigned int _auxtype; /* Default: 0 */
|
||||
</verb>
|
||||
</tscreen>
|
||||
</tscreen>
|
||||
|
||||
The header file <tt/apple2_filetype.h/ also defines many values
|
||||
that can be used to set these variables. It is included in
|
||||
|
@ -614,26 +614,26 @@ url="ca65.html" name="assembler manual">.
|
|||
<tag>Example</tag>
|
||||
|
||||
A text file cannot be created with just the
|
||||
standard C functions because they default to the binary type
|
||||
standard C functions because they default to the binary type
|
||||
<tt/PRODOS_T_BIN/. The <tt/_filetype/ variable must be set to
|
||||
<tt/PRODOS_T_TXT/ to create a text file.
|
||||
|
||||
For a text file,
|
||||
<tt/PRODOS_T_TXT/ to create a text file.
|
||||
|
||||
For a text file,
|
||||
<tt/_auxtype/ specifies the record length. A zero record
|
||||
length text file is referred to as a sequential text file.
|
||||
This is equivalent to text files on
|
||||
This is equivalent to text files on
|
||||
other operating systems, except that the line terminator is a
|
||||
carriage return instead of a line-feed (Linux/BSD/MacOS) or
|
||||
carriage return instead of a line-feed (Linux/BSD/MacOS) or
|
||||
carriage return, line-feed pair (Windows).
|
||||
|
||||
The "sequential" text file terminology is in contrast to a
|
||||
|
||||
The "sequential" text file terminology is in contrast to a
|
||||
"random-access" text file which would
|
||||
have a fixed-length, non-zero record length, so that the
|
||||
have a fixed-length, non-zero record length, so that the
|
||||
file position of any individual record can be calculated.
|
||||
|
||||
|
||||
For this example, the
|
||||
<tt/_auxtype/ does not need to be set because it defaults to
|
||||
the desired value, which is zero. To be more explicit,
|
||||
the desired value, which is zero. To be more explicit,
|
||||
<tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
|
||||
which is defined as zero.
|
||||
|
||||
|
@ -670,7 +670,7 @@ url="ca65.html" name="assembler manual">.
|
|||
}
|
||||
}
|
||||
</verb>
|
||||
</tscreen>
|
||||
</tscreen>
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
@ -686,14 +686,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -32,7 +32,7 @@ more information.
|
|||
<sect>Binary format<p>
|
||||
|
||||
The standard binary file format generated by the linker for the
|
||||
enhanced Apple //e target is an <url name="AppleSingle"
|
||||
enhanced Apple //e target is an <url name="AppleSingle"
|
||||
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
|
||||
The default load address is $803.
|
||||
|
||||
|
@ -586,18 +586,18 @@ url="ca65.html" name="assembler manual">.
|
|||
ProDOS associates a file type and an auxiliary type with each file.
|
||||
These type specifications are separate from the file's name, unlike
|
||||
Windows which uses the file name's suffix (a.k.a.
|
||||
extension) to specify the file type. For example, <tt/.exe/,
|
||||
extension) to specify the file type. For example, <tt/.exe/,
|
||||
<tt/.doc/, or <tt/.bat/.
|
||||
The ProDOS low-level
|
||||
Machine-Language Interface (MLI) functions for creating and opening
|
||||
The ProDOS low-level
|
||||
Machine-Language Interface (MLI) functions for creating and opening
|
||||
files require these types to be specified. And if they don't match
|
||||
with the file being opened, the operation may fail.
|
||||
|
||||
In contrast, the ISO C function <tt/fopen()/ and the POSIX function
|
||||
<tt/open()/ have no parameter to specify either a file type or an
|
||||
auxiliary type. Therefore, some additional mechanism for specifying
|
||||
the file types is needed.
|
||||
|
||||
the file types is needed.
|
||||
|
||||
<tag>Specifying the File Type and Auxiliary Type</tag>
|
||||
|
||||
There are two global variables provided that allow the file type
|
||||
|
@ -609,7 +609,7 @@ url="ca65.html" name="assembler manual">.
|
|||
extern unsigned char _filetype; /* Default: PRODOS_T_BIN */
|
||||
extern unsigned int _auxtype; /* Default: 0 */
|
||||
</verb>
|
||||
</tscreen>
|
||||
</tscreen>
|
||||
|
||||
The header file <tt/apple2_filetype.h/ also defines many values
|
||||
that can be used to set these variables. It is included in
|
||||
|
@ -620,26 +620,26 @@ url="ca65.html" name="assembler manual">.
|
|||
<tag>Example</tag>
|
||||
|
||||
A text file cannot be created with just the
|
||||
standard C functions because they default to the binary type
|
||||
standard C functions because they default to the binary type
|
||||
<tt/PRODOS_T_BIN/. The <tt/_filetype/ variable must be set to
|
||||
<tt/PRODOS_T_TXT/ to create a text file.
|
||||
|
||||
For a text file,
|
||||
<tt/PRODOS_T_TXT/ to create a text file.
|
||||
|
||||
For a text file,
|
||||
<tt/_auxtype/ specifies the record length. A zero record
|
||||
length text file is referred to as a sequential text file.
|
||||
This is equivalent to text files on
|
||||
This is equivalent to text files on
|
||||
other operating systems, except that the line terminator is a
|
||||
carriage return instead of a line-feed (Linux/BSD/MacOS) or
|
||||
carriage return instead of a line-feed (Linux/BSD/MacOS) or
|
||||
carriage return, line-feed pair (Windows).
|
||||
|
||||
The "sequential" text file terminology is in contrast to a
|
||||
|
||||
The "sequential" text file terminology is in contrast to a
|
||||
"random-access" text file which would
|
||||
have a fixed-length, non-zero record length, so that the
|
||||
have a fixed-length, non-zero record length, so that the
|
||||
file position of any individual record can be calculated.
|
||||
|
||||
|
||||
For this example, the
|
||||
<tt/_auxtype/ does not need to be set because it defaults to
|
||||
the desired value, which is zero. To be more explicit,
|
||||
the desired value, which is zero. To be more explicit,
|
||||
<tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
|
||||
which is defined as zero.
|
||||
|
||||
|
@ -676,7 +676,7 @@ url="ca65.html" name="assembler manual">.
|
|||
}
|
||||
}
|
||||
</verb>
|
||||
</tscreen>
|
||||
</tscreen>
|
||||
|
||||
</descrip><p>
|
||||
|
||||
|
@ -692,14 +692,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -30,14 +30,14 @@ for the cc65 compiler. ar65 is part of this suite.
|
|||
The archiver is called as follows:
|
||||
|
||||
<tscreen><verb>
|
||||
Usage: ar65 <operation ...> lib file|module ...
|
||||
Operations are some of:
|
||||
r Add modules
|
||||
d Delete modules
|
||||
t List library table
|
||||
v Increase verbosity (put before other operation)
|
||||
x Extract modules
|
||||
V Print the archiver version
|
||||
Usage: ar65 <operation ...> lib file|module ...
|
||||
Operations are some of:
|
||||
r Add modules
|
||||
d Delete modules
|
||||
t List library table
|
||||
v Increase verbosity (put before other operation)
|
||||
x Extract modules
|
||||
V Print the archiver version
|
||||
</verb></tscreen>
|
||||
|
||||
You may add modules to a library using the <tt/'r'/ command ('a' is deprecated). If the library
|
||||
|
@ -52,7 +52,7 @@ has a newer timestamp than the one to add.
|
|||
Here's an example:
|
||||
|
||||
<tscreen><verb>
|
||||
ar65 r mysubs.lib sub1.o sub2.o
|
||||
ar65 r mysubs.lib sub1.o sub2.o
|
||||
</verb></tscreen>
|
||||
|
||||
This will add two modules to the library 'mysubs.lib' creating the
|
||||
|
@ -62,7 +62,7 @@ sub2.o, they are replaced by the new ones.
|
|||
Modules names in the library are stored without the path, so, using
|
||||
|
||||
<tscreen><verb>
|
||||
ar65 v v r mysubs.lib ofiles/sub1.o ofiles/sub2.o
|
||||
ar65 v v r mysubs.lib ofiles/sub1.o ofiles/sub2.o
|
||||
</verb></tscreen>
|
||||
|
||||
will verbose add two modules named 'sub1.o' and 'sub2.o' to the library.
|
||||
|
@ -73,7 +73,7 @@ give a path when naming the modules.
|
|||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
ar65 d mysubs.lib sub1.o
|
||||
ar65 d mysubs.lib sub1.o
|
||||
</verb></tscreen>
|
||||
|
||||
This will delete the module named 'sub1.o' from the library, printing an
|
||||
|
@ -86,7 +86,7 @@ Any module names on the command line are ignored.
|
|||
Example:
|
||||
|
||||
<tscreen><verb>
|
||||
ar65 tv mysubs.lib
|
||||
ar65 tv mysubs.lib
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
@ -103,7 +103,7 @@ this is not a problem.
|
|||
Example for extracting a module from the library:
|
||||
|
||||
<tscreen><verb>
|
||||
ar65 x mysubs.lib sub1.o
|
||||
ar65 x mysubs.lib sub1.o
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
@ -131,17 +131,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -109,14 +109,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -184,14 +184,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -279,14 +279,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -397,14 +397,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
16
doc/c16.sgml
16
doc/c16.sgml
|
@ -259,14 +259,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
16
doc/c64.sgml
16
doc/c64.sgml
|
@ -481,14 +481,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
772
doc/ca65.sgml
772
doc/ca65.sgml
File diff suppressed because it is too large
Load diff
|
@ -322,14 +322,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -304,14 +304,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -102,14 +102,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -236,14 +236,14 @@ package, it tries to be smart about several things.
|
|||
|
||||
<itemize>
|
||||
|
||||
<item> If you don't give a target system on the command line, cl65
|
||||
defaults to the C64.
|
||||
<item> If you don't give a target system on the command line, cl65
|
||||
defaults to the C64.
|
||||
|
||||
<item> When linking, cl65 will supply the name of the library file for
|
||||
the target system to the linker; so, you don't have to do that.
|
||||
|
||||
<item> If the final step is the linker, and the name of the output file was
|
||||
not explicitly given, cl65 will use the name of the first input file
|
||||
<item> If the final step is the linker, and the name of the output file was
|
||||
not explicitly given, cl65 will use the name of the first input file
|
||||
without the extension, provided that the name of that file has an
|
||||
extension. So, you don't need to give the executable name in most
|
||||
cases; just give the name of your "main" file as the first input file.
|
||||
|
@ -284,24 +284,24 @@ assembler file (irq.s) will need the following separate steps to compile
|
|||
into an executable named morse:
|
||||
|
||||
<tscreen><verb>
|
||||
cc65 -g -Oi -t c64 morse.c
|
||||
ca65 -g morse.s
|
||||
ca65 -g irq.s
|
||||
ld65 -o morse -t c64 c64.o morse.o irq.o c64.lib
|
||||
cc65 -g -Oi -t c64 morse.c
|
||||
ca65 -g morse.s
|
||||
ca65 -g irq.s
|
||||
ld65 -o morse -t c64 c64.o morse.o irq.o c64.lib
|
||||
</verb></tscreen>
|
||||
|
||||
When using cl65, this is simplified to
|
||||
|
||||
<tscreen><verb>
|
||||
cl65 -g -Oi morse.c irq.s
|
||||
cl65 -g -Oi morse.c irq.s
|
||||
</verb></tscreen>
|
||||
|
||||
As a general rule, you may use cl65 instead of cc65 at most times,
|
||||
especially in makefiles to build object files directly from C files. Use
|
||||
|
||||
<tscreen><verb>
|
||||
.c.o:
|
||||
cl65 -g -Oi $<
|
||||
.c.o:
|
||||
cl65 -g -Oi $<
|
||||
</verb></tscreen>
|
||||
|
||||
to do this.
|
||||
|
@ -323,14 +323,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ segment. Use the assembler to generate an object file from the assembler
|
|||
output.
|
||||
|
||||
<tscreen><verb>
|
||||
co65 --code-label _c64_hi c64-hi.tgi
|
||||
co65 --code-label _c64_hi c64-hi.tgi
|
||||
ca65 c64-hi.s
|
||||
</verb></tscreen>
|
||||
|
||||
|
@ -293,7 +293,7 @@ Next, change your C code to declare a variable that is actually the address
|
|||
of the driver:
|
||||
|
||||
<tscreen><verb>
|
||||
extern void c64_hi[];
|
||||
extern void c64_hi[];
|
||||
</verb></tscreen>
|
||||
|
||||
Instead of loading and unloading the driver, change the code to install and
|
||||
|
@ -329,14 +329,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -127,17 +127,17 @@ and predecrement operators if you don't need the resulting value. That means,
|
|||
use
|
||||
|
||||
<tscreen><verb>
|
||||
...
|
||||
++i;
|
||||
...
|
||||
...
|
||||
++i;
|
||||
...
|
||||
</verb></tscreen>
|
||||
|
||||
instead of
|
||||
|
||||
<tscreen><verb>
|
||||
...
|
||||
i++;
|
||||
...
|
||||
...
|
||||
i++;
|
||||
...
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
@ -148,24 +148,24 @@ The compiler produces optimized code, if the value of a pointer is a constant.
|
|||
So, to access direct memory locations, use
|
||||
|
||||
<tscreen><verb>
|
||||
#define VDC_STATUS 0xD601
|
||||
*(char*)VDC_STATUS = 0x01;
|
||||
#define VDC_STATUS 0xD601
|
||||
*(char*)VDC_STATUS = 0x01;
|
||||
</verb></tscreen>
|
||||
|
||||
That will be translated to
|
||||
|
||||
<tscreen><verb>
|
||||
lda #$01
|
||||
sta $D601
|
||||
lda #$01
|
||||
sta $D601
|
||||
</verb></tscreen>
|
||||
|
||||
The constant value detection works also for struct pointers and arrays, if the
|
||||
subscript is a constant. So
|
||||
|
||||
<tscreen><verb>
|
||||
#define VDC ((unsigned char*)0xD600)
|
||||
#define STATUS 0x01
|
||||
VDC[STATUS] = 0x01;
|
||||
#define VDC ((unsigned char*)0xD600)
|
||||
#define STATUS 0x01
|
||||
VDC[STATUS] = 0x01;
|
||||
</verb></tscreen>
|
||||
|
||||
will also work.
|
||||
|
@ -182,14 +182,14 @@ Initialization of local variables when declaring them gives shorter and faster
|
|||
code. So, use
|
||||
|
||||
<tscreen><verb>
|
||||
int i = 1;
|
||||
int i = 1;
|
||||
</verb></tscreen>
|
||||
|
||||
instead of
|
||||
|
||||
<tscreen><verb>
|
||||
int i;
|
||||
i = 1;
|
||||
int i;
|
||||
i = 1;
|
||||
</verb></tscreen>
|
||||
|
||||
But beware: To maximize your savings, don't mix uninitialized and initialized
|
||||
|
@ -201,18 +201,18 @@ variables, you force the compiler to allocate space for the uninitialized
|
|||
variables each time, it parses an initialized one. So do this:
|
||||
|
||||
<tscreen><verb>
|
||||
int i, j;
|
||||
int a = 3;
|
||||
int b = 0;
|
||||
int i, j;
|
||||
int a = 3;
|
||||
int b = 0;
|
||||
</verb></tscreen>
|
||||
|
||||
instead of
|
||||
|
||||
<tscreen><verb>
|
||||
int i;
|
||||
int a = 3;
|
||||
int j;
|
||||
int b = 0;
|
||||
int i;
|
||||
int a = 3;
|
||||
int j;
|
||||
int b = 0;
|
||||
</verb></tscreen>
|
||||
|
||||
The latter will work, but will create larger and slower code.
|
||||
|
@ -228,17 +228,17 @@ common cases.
|
|||
Don't use
|
||||
|
||||
<tscreen><verb>
|
||||
char* a;
|
||||
char b, c;
|
||||
char b = *(a + c);
|
||||
char* a;
|
||||
char b, c;
|
||||
char b = *(a + c);
|
||||
</verb></tscreen>
|
||||
|
||||
Use
|
||||
|
||||
<tscreen><verb>
|
||||
char* a;
|
||||
char b, c;
|
||||
char b = a[c];
|
||||
char* a;
|
||||
char b, c;
|
||||
char b = a[c];
|
||||
</verb></tscreen>
|
||||
|
||||
instead.
|
||||
|
|
|
@ -168,14 +168,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -109,7 +109,7 @@ Load your program, then enter the monitor and use the "<tt/ll/" command to
|
|||
load your label file like this:
|
||||
|
||||
<tscreen><verb>
|
||||
ll "hello.lbl"
|
||||
ll "hello.lbl"
|
||||
</verb></tscreen>
|
||||
|
||||
You will get lots of warnings and even a few errors. You may ignore safely all
|
||||
|
@ -120,7 +120,7 @@ After loading the labels, they are used by VICE in the disassembler listing,
|
|||
and you may use them whereever you need to specify an address. Try
|
||||
|
||||
<tscreen><verb>
|
||||
d ._main
|
||||
d ._main
|
||||
</verb></tscreen>
|
||||
|
||||
as an example (note that VICE needs a leading dot before all labels, and that
|
||||
|
@ -134,14 +134,14 @@ Load your program, then enter the monitor and use the "<tt/sl/" command to
|
|||
load your label file like this:
|
||||
|
||||
<tscreen><verb>
|
||||
sl hello.sym
|
||||
sl hello.sym
|
||||
</verb></tscreen>
|
||||
|
||||
After loading the labels, they are used by Oricutron in the disassembler listing,
|
||||
and you may use them whereever you need to specify an address. Try
|
||||
|
||||
<tscreen><verb>
|
||||
d ._main
|
||||
d ._main
|
||||
</verb></tscreen>
|
||||
|
||||
as an example (note that VICE needs a leading dot before all labels, and that
|
||||
|
|
|
@ -138,14 +138,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
110
doc/geos.sgml
110
doc/geos.sgml
|
@ -68,19 +68,19 @@ programs.
|
|||
The software needed:
|
||||
<itemize>
|
||||
<item><em/cc65/ Excellent package containing a C crosscompiler, a crossassembler and a linker, you
|
||||
can get it from: <url url="https://cc65.github.io/">.
|
||||
can get it from: <url url="https://cc65.github.io/">.
|
||||
<item><em/VICE/ This is a portable C64, C128 and few other Commodore computers emulator, you
|
||||
can obtain it from: <url url="http://vice-emu.sourceforge.net/">.
|
||||
The VICE package contains the <em/c1541/ program that is able
|
||||
to convert/unconvert GEOS files to disk images.
|
||||
can obtain it from: <url url="http://vice-emu.sourceforge.net/">.
|
||||
The VICE package contains the <em/c1541/ program that is able
|
||||
to convert/unconvert GEOS files to disk images.
|
||||
<item><em/The Star Commander/ This tool is only for DOS. You will need it for transferring
|
||||
object files from a PC to a 1541. There's also one important ability of this
|
||||
tool - it automatically un-converts .cvt files into GEOS native format on
|
||||
disk image files. Check out: <url url="http://sta.c64.org/sc.html">.
|
||||
object files from a PC to a 1541. There's also one important ability of this
|
||||
tool - it automatically un-converts .cvt files into GEOS native format on
|
||||
disk image files. Check out: <url url="http://sta.c64.org/sc.html">.
|
||||
<item><em/opencbm/ A package that allows for communication directly with a 1541 and
|
||||
other Commodore IEC bus drives. It can be a replacement for Star Commander if
|
||||
you only want to transfer files to a disk and unconvert using GEOS program for
|
||||
this purpose. Check out: <url url="https://spiro.trikaliotis.net/opencbm">.
|
||||
other Commodore IEC bus drives. It can be a replacement for Star Commander if
|
||||
you only want to transfer files to a disk and unconvert using GEOS program for
|
||||
this purpose. Check out: <url url="https://spiro.trikaliotis.net/opencbm">.
|
||||
</itemize>
|
||||
<p>
|
||||
VICE and cc65 are portable - they run on variety of platforms - DOS, Win32 and UNIX. GEOSLib only
|
||||
|
@ -387,7 +387,7 @@ and the number of rows to skip from the top if it.
|
|||
<sect3>BitOtherClip
|
||||
<p>
|
||||
<tt/void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, unsigned skipTop,
|
||||
struct iconpic *myPic)/
|
||||
struct iconpic *myPic)/
|
||||
<p>
|
||||
Similar to the previous one with some extension. <tt/proc1/ is called before reading a byte (it
|
||||
returns in .A the next value), and <tt/proc2/ is called every time the parser reads a byte which is
|
||||
|
@ -1390,9 +1390,9 @@ has the following fields:
|
|||
<itemize>
|
||||
<item><tt/char number/ - total number of icons declared here
|
||||
<item><tt/struct pixel mousepos/ - after finishing <tt/DoIcons/ the mouse pointer will be placed in
|
||||
this point allowing you to have a hint for the user what the default action is
|
||||
this point allowing you to have a hint for the user what the default action is
|
||||
<item><tt/struct icondef tab[&rsqb/ - this table of size equal to <tt/icontab.number/ contains
|
||||
descriptions for all icons
|
||||
descriptions for all icons
|
||||
</itemize>
|
||||
|
||||
<sect1>File and Disk
|
||||
|
@ -1452,9 +1452,9 @@ void example = {
|
|||
Which will be compiled to following string of bytes:
|
||||
<tscreen><verb>
|
||||
_example:
|
||||
.byte 3
|
||||
.word 3
|
||||
.byte 0
|
||||
.byte 3
|
||||
.word 3
|
||||
.byte 0
|
||||
</verb></tscreen>
|
||||
As you see this way it is possible to define data of any type in any order. You must remember to
|
||||
cast each member to proper type.
|
||||
|
@ -1474,21 +1474,21 @@ just in the content.
|
|||
Here is how a single descriptor looks like:
|
||||
<tscreen><verb>
|
||||
void myMenu = {
|
||||
(char)top, (char)bottom, // this is the size of the menubox
|
||||
(unsigned)left, (unsigned)right, // counting all items in the current descriptor
|
||||
(char)number_of_items | type_of_menu, // number of following items ORed with
|
||||
// type of this menu, it can be either
|
||||
// HORIZONTAL or VERTICAL if you will have also bit 6 set then menu won't be closed
|
||||
// after moving mouse pointer outside the menubox. You can have at most 31 items.
|
||||
(char)top, (char)bottom, // this is the size of the menubox
|
||||
(unsigned)left, (unsigned)right, // counting all items in the current descriptor
|
||||
(char)number_of_items | type_of_menu, // number of following items ORed with
|
||||
// type of this menu, it can be either
|
||||
// HORIZONTAL or VERTICAL if you will have also bit 6 set then menu won't be closed
|
||||
// after moving mouse pointer outside the menubox. You can have at most 31 items.
|
||||
</verb></tscreen>
|
||||
This is followed by <tt/number_of_items/ of following item description.
|
||||
<tscreen><verb>
|
||||
...
|
||||
"menuitemname", (char)item_type, (unsigned)pointer,
|
||||
"nextitemname", (char)item_type, (unsigned)pointer,
|
||||
...
|
||||
"lastitemname", (char)item_type, (unsigned)pointer };
|
||||
// Note that there isn't ending <tt/NULL/ or something like that.
|
||||
...
|
||||
"menuitemname", (char)item_type, (unsigned)pointer,
|
||||
"nextitemname", (char)item_type, (unsigned)pointer,
|
||||
...
|
||||
"lastitemname", (char)item_type, (unsigned)pointer };
|
||||
// Note that there isn't ending <tt/NULL/ or something like that.
|
||||
</verb></tscreen>
|
||||
<tt/pointer/ is a pointer to something, what it points for depends from <tt/item_type/. This one
|
||||
can have following values:
|
||||
|
@ -1521,16 +1521,16 @@ The first element can be specified in two ways - by using the default size and p
|
|||
your own. The first case results in
|
||||
<tscreen><verb>
|
||||
const dlgBoxStr example = {
|
||||
DB_DEFPOS (pattern_of_shadow),
|
||||
... // commands
|
||||
DB_END };
|
||||
DB_DEFPOS (pattern_of_shadow),
|
||||
... // commands
|
||||
DB_END };
|
||||
</verb></tscreen>
|
||||
And the own size and position would be:
|
||||
<tscreen><verb>
|
||||
const dlgBoxStr example = {
|
||||
DB_SETPOS (pattern, top, bottom, left, right)
|
||||
... // commands
|
||||
DB_END };
|
||||
DB_SETPOS (pattern, top, bottom, left, right)
|
||||
... // commands
|
||||
DB_END };
|
||||
</verb></tscreen>
|
||||
|
||||
<sect3>Commands
|
||||
|
@ -1539,9 +1539,9 @@ The next element of the <tt/DoDlgBox/ command string are the commands themselves
|
|||
default icons and the number of the selected icon will be returned from window processor. The icons are
|
||||
<tt/OK, CANCEL, YES, NO, OPEN/, and <tt/DISK/. You can use predefined macros for using them, e.g.:
|
||||
<tscreen><verb>
|
||||
...
|
||||
DB_ICON(OK, DBI_X_0, DBI_Y_0),
|
||||
...
|
||||
...
|
||||
DB_ICON(OK, DBI_X_0, DBI_Y_0),
|
||||
...
|
||||
</verb></tscreen>
|
||||
Note that the position is counted from top left corner of window, not entire screen and that the 'x'
|
||||
position is counted in cards (8-pixel) and not in pixels. This is also true for all following commands.
|
||||
|
@ -1555,11 +1555,11 @@ where the address of the text is stored. This is useful for information windows
|
|||
is variable. Consider following:
|
||||
<tscreen><verb>
|
||||
char text = "foo";
|
||||
...
|
||||
r15=(unsigned)text; // in code just before call to DoDlgBox
|
||||
...
|
||||
DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &r15),
|
||||
...
|
||||
...
|
||||
r15=(unsigned)text; // in code just before call to DoDlgBox
|
||||
...
|
||||
DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &r15),
|
||||
...
|
||||
</verb></tscreen>
|
||||
will cause the word ''foo'' to appear in the window, but you may store the pointer to any text in
|
||||
<tt/r15/ (in this case) before the call to DoDlgBox.
|
||||
|
@ -1596,10 +1596,10 @@ command has to be <tt/GSTR_END/. There is a custom type defined for the command
|
|||
Here is an example for clearing the screen:
|
||||
<tscreen><verb>
|
||||
const graphicStr example = {
|
||||
MOVEPENTO(0,0),
|
||||
NEWPATTERN(0),
|
||||
RECTANGLETO(319,199)
|
||||
GSTR_END };
|
||||
MOVEPENTO(0,0),
|
||||
NEWPATTERN(0),
|
||||
RECTANGLETO(319,199)
|
||||
GSTR_END };
|
||||
</verb></tscreen>
|
||||
|
||||
<sect2>InitRam table
|
||||
|
@ -1623,17 +1623,17 @@ It is possible to intercept events and hook into the GEOS Kernal using vectors.
|
|||
void_func oldVector;
|
||||
|
||||
void NewVectorHandler(void) {
|
||||
// do something and at the end call the old vector routine
|
||||
oldVector();
|
||||
// do something and at the end call the old vector routine
|
||||
oldVector();
|
||||
}
|
||||
|
||||
void hook_into_system(void) {
|
||||
oldVector = mouseVector;
|
||||
mouseVector = NewVectorHandler;
|
||||
oldVector = mouseVector;
|
||||
mouseVector = NewVectorHandler;
|
||||
}
|
||||
|
||||
void remove_hook(void) {
|
||||
mouseVector = oldVector;
|
||||
mouseVector = oldVector;
|
||||
}
|
||||
</verb></tscreen>
|
||||
<p>
|
||||
|
@ -1655,10 +1655,10 @@ That little example above intercepts <tt/mouseVector/. The <tt/NewVectorHandler/
|
|||
called every time the mouse button changes status. Other important vectors you should know about
|
||||
are:
|
||||
<itemize>
|
||||
<item><tt/appMain/ - this is called from within the <tt/MainLoop/ system loop
|
||||
<item><tt/keyVector/ - called whenever a keypress occurs
|
||||
<item><tt/intTopVector/ - called at the start of the IRQ routine
|
||||
<item><tt/intBotVector/ - called at the end of the IRQ routine
|
||||
<item><tt/appMain/ - this is called from within the <tt/MainLoop/ system loop
|
||||
<item><tt/keyVector/ - called whenever a keypress occurs
|
||||
<item><tt/intTopVector/ - called at the start of the IRQ routine
|
||||
<item><tt/intBotVector/ - called at the end of the IRQ routine
|
||||
</itemize>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -381,11 +381,11 @@ HEADER APPLICATION "MyFirstApp" "Class Name" "V1.0"
|
|||
; file named MyFirstApp with the Class-string "Class Name V1.0"
|
||||
{
|
||||
; Not all fields are required, default and current values will be used.
|
||||
author "Maciej Witkowiak" ; always in quotes!
|
||||
info "Information text" ; always in quotes!
|
||||
; date yy mm dd hh ss ; always 5 fields!
|
||||
; dostype seq ; can be: PRG, SEQ, USR (only all UPPER- or lower-case)
|
||||
; structure seq ; can be: SEQ, VLIR (only UPPER- or lower-case)
|
||||
mode c64only ; can be: any, 40only, 80only, c64only
|
||||
author "Maciej Witkowiak" ; always in quotes!
|
||||
info "Information text" ; always in quotes!
|
||||
; date yy mm dd hh ss ; always 5 fields!
|
||||
; dostype seq ; can be: PRG, SEQ, USR (only all UPPER- or lower-case)
|
||||
; structure seq ; can be: SEQ, VLIR (only UPPER- or lower-case)
|
||||
mode c64only ; can be: any, 40only, 80only, c64only
|
||||
}</verb></tscreen>
|
||||
</article>
|
||||
|
|
|
@ -24,21 +24,21 @@ It complements the features that are built into the ca65 macroassembler:
|
|||
|
||||
<itemize>
|
||||
|
||||
<item> Accept any number of segments to form an executable module.
|
||||
<item> Accept any number of segments to form an executable module.
|
||||
|
||||
<item> Resolve arbitrary expressions stored in the object files.
|
||||
<item> Resolve arbitrary expressions stored in the object files.
|
||||
|
||||
<item> In case of errors, use the meta information stored in the object files
|
||||
to produce helpful error messages. In case of undefined symbols,
|
||||
expression range errors, or symbol type mismatches, ld65 is able to
|
||||
tell you the exact location in the original assembler source, where
|
||||
the symbol was referenced.
|
||||
<item> In case of errors, use the meta information stored in the object files
|
||||
to produce helpful error messages. In case of undefined symbols,
|
||||
expression range errors, or symbol type mismatches, ld65 is able to
|
||||
tell you the exact location in the original assembler source, where
|
||||
the symbol was referenced.
|
||||
|
||||
<item> Flexible output. The output of ld65 is highly configurable by a config
|
||||
file. Some more-common platforms are supported by default configurations
|
||||
that may be activated by naming the target system. The output
|
||||
generation was designed with different output formats in mind, so
|
||||
adding other formats shouldn't be a great problem.
|
||||
<item> Flexible output. The output of ld65 is highly configurable by a config
|
||||
file. Some more-common platforms are supported by default configurations
|
||||
that may be activated by naming the target system. The output
|
||||
generation was designed with different output formats in mind, so
|
||||
adding other formats shouldn't be a great problem.
|
||||
|
||||
</itemize>
|
||||
|
||||
|
@ -1148,14 +1148,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
|
||||
|
|
|
@ -228,14 +228,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -337,14 +337,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
19
doc/nes.sgml
19
doc/nes.sgml
|
@ -179,17 +179,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -200,15 +200,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
||||
|
|
16
doc/osi.sgml
16
doc/osi.sgml
|
@ -217,14 +217,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
16
doc/pet.sgml
16
doc/pet.sgml
|
@ -242,14 +242,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -260,14 +260,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -27,19 +27,19 @@ binary needs to be compiled with <tt/--target sim6502/ or <tt/--target sim65c02/
|
|||
The simulator is called as follows:
|
||||
|
||||
<tscreen><verb>
|
||||
Usage: sim65 [options] file [arguments]
|
||||
Short options:
|
||||
-h Help (this text)
|
||||
-c Print amount of executed CPU cycles
|
||||
-v Increase verbosity
|
||||
-V Print the simulator version number
|
||||
-x <num> Exit simulator after <num> cycles
|
||||
Usage: sim65 [options] file [arguments]
|
||||
Short options:
|
||||
-h Help (this text)
|
||||
-c Print amount of executed CPU cycles
|
||||
-v Increase verbosity
|
||||
-V Print the simulator version number
|
||||
-x <num> Exit simulator after <num> cycles
|
||||
|
||||
Long options:
|
||||
--help Help (this text)
|
||||
--cycles Print amount of executed CPU cycles
|
||||
--verbose Increase verbosity
|
||||
--version Print the simulator version number
|
||||
Long options:
|
||||
--help Help (this text)
|
||||
--cycles Print amount of executed CPU cycles
|
||||
--verbose Increase verbosity
|
||||
--version Print the simulator version number
|
||||
</verb></tscreen>
|
||||
|
||||
|
||||
|
@ -120,14 +120,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
12
doc/smc.sgml
12
doc/smc.sgml
|
@ -470,7 +470,7 @@ SMC instructions.
|
|||
|
||||
Example:
|
||||
<tscreen><verb>
|
||||
SMC_OperateOnValue ASL, LoadMask ; shift mask to left
|
||||
SMC_OperateOnValue ASL, LoadMask ; shift mask to left
|
||||
...
|
||||
SMC LoadMask, { LDA #$20 }
|
||||
</verb></tscreen>
|
||||
|
@ -555,14 +555,14 @@ allowing reuse of some instructions.
|
|||
5: SMC StoreAccuFirstSection, { sta SMC_AbsAdr, Y }
|
||||
6: ...
|
||||
7: RestoreCodeBranchBaseAdr:
|
||||
8: SMC FirstIncHighByte, { SMC_OperateOnHighByte inc, StoreAccuFirstSection } ; code will be overwritten to 'beq RestoreCode' (*)
|
||||
8: SMC FirstIncHighByte, { SMC_OperateOnHighByte inc, StoreAccuFirstSection } ; code will be overwritten to 'beq RestoreCode' (*)
|
||||
9: ...
|
||||
10: SMC_TransferOpcode FirstIncHighByte, OPC_BEQ , x ; change code marked above with (*)
|
||||
11: SMC_TransferValue FirstIncHighByte, #(restoreCode - RestoreCodeBranchBaseAdr-2), x ; set relative address to 'RestoreCode'
|
||||
10: SMC_TransferOpcode FirstIncHighByte, OPC_BEQ , x ; change code marked above with (*)
|
||||
11: SMC_TransferValue FirstIncHighByte, #(restoreCode - RestoreCodeBranchBaseAdr-2), x ; set relative address to 'RestoreCode'
|
||||
12: ...
|
||||
13: restoreCode:
|
||||
14: SMC_TransferOpcode FirstIncHighByte, OPC_INC_abs , x ; restore original code...
|
||||
15: SMC_TransferValue FirstIncHighByte, #(<(StoreToFirstSection+2)), x ; (second byte of inc contained low-byte of address)
|
||||
14: SMC_TransferOpcode FirstIncHighByte, OPC_INC_abs , x ; restore original code...
|
||||
15: SMC_TransferValue FirstIncHighByte, #(<(StoreToFirstSection+2)), x ; (second byte of inc contained low-byte of address)
|
||||
16: ...
|
||||
</verb></tscreen>
|
||||
|
||||
|
|
|
@ -403,14 +403,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
|
||||
|
|
|
@ -148,14 +148,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -16,8 +16,8 @@ An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org
|
|||
|
||||
<sect>Overview<p>
|
||||
|
||||
This file contains an overview of the Telestrat runtime system as it comes
|
||||
with the cc65 C compiler. It describes the memory layout, Telestrat-specific
|
||||
This file contains an overview of the Telestrat runtime system as it comes
|
||||
with the cc65 C compiler. It describes the memory layout, Telestrat-specific
|
||||
header files, available drivers, and any pitfalls specific to that platform.
|
||||
|
||||
Please note that Telestrat-specific functions are just mentioned here, they are
|
||||
|
@ -27,13 +27,13 @@ more than one platform. Please see the function reference for more
|
|||
information.
|
||||
|
||||
Oric Telestrat is the last Oric computer (Released in 1986, mainly in France).
|
||||
This computer is an Atmos with extra hardware: RS232, cardridge(banking system),
|
||||
This computer is an Atmos with extra hardware: RS232, cardridge(banking system),
|
||||
joysticks (2 ports) or mouse (on joystick port), FDC.
|
||||
|
||||
Video chip, CPU, keyboard management, tape hardware are the same than Atmos.
|
||||
|
||||
Telestrat can start in Atmos mode with Atmos Cardridge (which is only the atmos
|
||||
Basic 1.1 ROM).
|
||||
Telestrat can start in Atmos mode with Atmos Cardridge (which is only the atmos
|
||||
Basic 1.1 ROM).
|
||||
|
||||
Telestrat can start in Sedoric (Atmos OS) and Atmos mode with Stratoric Cardridge.
|
||||
This Cardridge has 3 banks of 16KB of rom with:
|
||||
|
@ -43,15 +43,15 @@ This Cardridge has 3 banks of 16KB of rom with:
|
|||
<item>a Basic 1.0 ROM (Oric-1).
|
||||
</itemize>
|
||||
|
||||
The main Telestrat's configuration is the Telemon/Hyperbasic Cardridge inserted
|
||||
The main Telestrat's configuration is the Telemon/Hyperbasic Cardridge inserted
|
||||
with Stratsed in floppy drive.
|
||||
|
||||
Anyway, there is no way to load a tape file in Telemon/Hyperbasic mode without
|
||||
Anyway, there is no way to load a tape file in Telemon/Hyperbasic mode without
|
||||
alternative program.
|
||||
|
||||
There is also no software to write a Stratsed dsk file on PC.
|
||||
|
||||
This Telestrat target build an Orix binary file. But, in the future, it will be possible
|
||||
This Telestrat target build an Orix binary file. But, in the future, it will be possible
|
||||
to build a Stratsed disk. Orix uses the same systems calls than Telemon mode.
|
||||
|
||||
That is why if you need to do software for telestrat target, you have the choice to:
|
||||
|
@ -74,12 +74,12 @@ name="here" url="http://orix.oric.org/orix-header/">
|
|||
|
||||
This header is used for Telemon 3.0.
|
||||
|
||||
Anyway, for Telemon 2.4, there is no file management, there is no TAPE routine
|
||||
Anyway, for Telemon 2.4, there is no file management, there is no TAPE routine
|
||||
in Telemon, there is no way to load a binary easily.
|
||||
|
||||
Stratsed (the Telestrat operating system) handles files management. Stratsed
|
||||
Stratsed (the Telestrat operating system) handles files management. Stratsed
|
||||
is loaded to memory from floppy disk. Stratsed vector are declared in asminc/telestrat.inc.
|
||||
But, reverse engineering is required to find how theses vectors works. Please, note that
|
||||
But, reverse engineering is required to find how theses vectors works. Please, note that
|
||||
Stratsed is located in overlay memory (bank 0)
|
||||
|
||||
There is no tool to insert a binary in a Stratsed floppy disk.
|
||||
|
@ -88,8 +88,8 @@ The only way to load a binary (for Telemon 2.4) is to:
|
|||
<itemize>
|
||||
<item>remove the 20 bytes header
|
||||
<item>download <url name="osdk" url="http://osdk.defence-force.org/index?page=download">
|
||||
<item>use Floppybuilder in OSDK to insert the binary with the tool (please read
|
||||
FloppyBuilder manual to learn how to insert your binary and how to start Microdisc boot sector
|
||||
<item>use Floppybuilder in OSDK to insert the binary with the tool (please read
|
||||
FloppyBuilder manual to learn how to insert your binary and how to start Microdisc boot sector
|
||||
when Telestrat starts)
|
||||
</itemize>
|
||||
|
||||
|
@ -183,13 +183,13 @@ TGI drivers is available on Oric Telestrat with some functions:
|
|||
|
||||
<sect1>Extended memory drivers<p>
|
||||
|
||||
No extended memory drivers are currently available for the Telestrat.
|
||||
This feature could be done because telestrat can manage RAM inserted in his
|
||||
port cardridge.
|
||||
No extended memory drivers are currently available for the Telestrat.
|
||||
This feature could be done because telestrat can manage RAM inserted in his
|
||||
port cardridge.
|
||||
|
||||
<sect1>Joystick drivers<p>
|
||||
|
||||
Telemon 2.4 & 3.0 manages joysticks but it had been handled yet. This means that
|
||||
Telemon 2.4 & 3.0 manages joysticks but it had been handled yet. This means that
|
||||
joysticks driver could be written easily.
|
||||
|
||||
Telemon 2.4 returns in keyboard buffer the direction of the joysticks. This means that
|
||||
|
@ -197,12 +197,12 @@ if you get input from keyboard by conio cgetc function, you will get direction f
|
|||
|
||||
<sect1>Mouse drivers<p>
|
||||
|
||||
Telestrat manages also mouse, but it had been no handled yet in this version.
|
||||
Telestrat manages also mouse, but it had been no handled yet in this version.
|
||||
Telestrat mouse is really difficult to find.
|
||||
|
||||
<sect1>RS232 device drivers<p>
|
||||
|
||||
Telestrat has a RS232 port, but it's not usable in cc65. It is possible to use
|
||||
Telestrat has a RS232 port, but it's not usable in cc65. It is possible to use
|
||||
RS232 port with Telemon calls (see XSOUT primitive for example)
|
||||
|
||||
<sect>Limitations<label id="limitations"><p>
|
||||
|
@ -236,14 +236,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -76,13 +76,13 @@ ifneq ($(MAKECMDGOALS),clean)
|
|||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
$(PROGRAM): $(SOURCES:.c=.o)
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
$(CC) $(LDFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
|
||||
$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
|
||||
</verb></tscreen>
|
||||
|
||||
<bf/Important:/ When using the sample Makefile above via copy & paste it is
|
||||
|
|
|
@ -264,14 +264,14 @@ including commercial applications, and to alter it and redistribute it
|
|||
freely, subject to the following restrictions:
|
||||
|
||||
<enum>
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
<item> The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
<item> Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
<item> This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
</enum>
|
||||
|
||||
</article>
|
||||
|
|
|
@ -5,25 +5,25 @@
|
|||
*/
|
||||
|
||||
main() {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
nested(a,b) {
|
||||
if ((a<4 && b == 'r')
|
||||
|| (a == 1 && (b == 'h' || b == 'i'))
|
||||
|| (a == 2 && (b == 'o' || b == 'y'))
|
||||
) a=b;
|
||||
if ((a<4 && b == 'r')
|
||||
|| (a == 1 && (b == 'h' || b == 'i'))
|
||||
|| (a == 2 && (b == 'o' || b == 'y'))
|
||||
) a=b;
|
||||
}
|
||||
|
||||
/* type name scope */
|
||||
|
||||
void s(struct D *d) {} /* this struct D differs from the one below */
|
||||
void s(struct D *d) {} /* this struct D differs from the one below */
|
||||
typedef struct D D;
|
||||
struct D {int x, y;} Dy={0};
|
||||
D Dz={1};
|
||||
Dfunc(){
|
||||
D a; a.y=1;
|
||||
s(&Dy); /* error */
|
||||
D a; a.y=1;
|
||||
s(&Dy); /* error */
|
||||
}
|
||||
|
||||
/* qualifiers */
|
||||
|
@ -33,39 +33,39 @@ const int a, *x; int b, *y;
|
|||
volatile unsigned z;
|
||||
|
||||
f() {
|
||||
x = y;
|
||||
z = z + z; /* should be 2 references to z's r-value */
|
||||
x = y;
|
||||
z = z + z; /* should be 2 references to z's r-value */
|
||||
}
|
||||
f1() {
|
||||
x = &a;
|
||||
x = &b;
|
||||
y = &a; /* error */
|
||||
y = &b;
|
||||
x = &a;
|
||||
x = &b;
|
||||
y = &a; /* error */
|
||||
y = &b;
|
||||
}
|
||||
f2(int **a, int **b) {
|
||||
f(&x, &y);
|
||||
**a = 0;
|
||||
return **b;
|
||||
f(&x, &y);
|
||||
**a = 0;
|
||||
return **b;
|
||||
}
|
||||
g(const int *p) {
|
||||
g(&a);
|
||||
g(&b);
|
||||
return *p;
|
||||
g(&a);
|
||||
g(&b);
|
||||
return *p;
|
||||
}
|
||||
h(int *p) {
|
||||
f(&a);
|
||||
f(&b);
|
||||
return *p;
|
||||
f(&a);
|
||||
f(&b);
|
||||
return *p;
|
||||
}
|
||||
h1(const int x, int y) {
|
||||
h1(a,b);
|
||||
h1(b,a);
|
||||
return x + y;
|
||||
h1(a,b);
|
||||
h1(b,a);
|
||||
return x + y;
|
||||
}
|
||||
h2() {
|
||||
char *b; const void *p;
|
||||
p = b;
|
||||
b = p; /* error (incompatible pointer type) */
|
||||
char *b; const void *p;
|
||||
p = b;
|
||||
b = p; /* error (incompatible pointer type) */
|
||||
}
|
||||
|
||||
/* static naming */
|
||||
|
@ -120,14 +120,14 @@ extern int strcmp(const char*, const char*);
|
|||
extern void qsort(void*, int, int, int (*)(const void*, const void*));
|
||||
extern int cmp(char**a, char**b) { return strcmp(*a,*b); }
|
||||
sort() {
|
||||
int n; char *a[100];
|
||||
qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp);
|
||||
int n; char *a[100];
|
||||
qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp);
|
||||
qsort(a, n, sizeof(char*), cmp); /* error (incompatible pointer type) */
|
||||
}
|
||||
|
||||
/* nasty calls */
|
||||
|
||||
onearg(){
|
||||
int a,b,c,d;
|
||||
f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */
|
||||
int a,b,c,d;
|
||||
f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@ main()
|
|||
#ifdef REFCC
|
||||
#include <stdint.h>
|
||||
struct foo {
|
||||
int16_t a;
|
||||
char b;
|
||||
int16_t x : 12, y : 4;
|
||||
int16_t zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
int16_t a;
|
||||
char b;
|
||||
int16_t x : 12, y : 4;
|
||||
int16_t zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { uint16_t a:2, b:4, c:16;} y = { 7, 8, 9};
|
||||
|
@ -33,11 +33,11 @@ int16_t i = 8;
|
|||
#else
|
||||
|
||||
struct foo {
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4;
|
||||
int zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4;
|
||||
int zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { unsigned int a:2, b:4, c:16;} y = { 7, 8, 9};
|
||||
|
@ -46,10 +46,10 @@ int i = 8;
|
|||
|
||||
#else
|
||||
struct foo {
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4, : 0, : 4, z : 3;
|
||||
char c;
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9};
|
||||
|
@ -63,32 +63,32 @@ f2(struct baz *p);
|
|||
|
||||
main()
|
||||
{
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
x.y = i;
|
||||
x.z = 070;
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
y.a = 2;
|
||||
y.c = i;
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
x.y = i;
|
||||
x.z = 070;
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
y.a = 2;
|
||||
y.c = i;
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
#ifdef CAST_STRUCT_PTR
|
||||
f2((struct baz *)&x);
|
||||
f2((struct baz *)&x);
|
||||
#else
|
||||
f2(&x);
|
||||
f2(&x);
|
||||
#endif
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
f1(struct baz *p) {
|
||||
p->a = p->b = 0;
|
||||
if (p->b)
|
||||
printf("p->b != 0!\n");
|
||||
p->a = 0x3; p->b = 0xf;
|
||||
printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b);
|
||||
p->a = p->b = 0;
|
||||
if (p->b)
|
||||
printf("p->b != 0!\n");
|
||||
p->a = 0x3; p->b = 0xf;
|
||||
printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b);
|
||||
}
|
||||
f2(struct baz *p) {
|
||||
p->a = (i==0);
|
||||
p->b = (f1(p),0);
|
||||
p->a = (i==0);
|
||||
p->b = (f1(p),0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define SSHRT_MAX SHRT_MAX
|
||||
#define SINT_MAX INT_MAX
|
||||
#define SLONG_MAX LONG_MAX
|
||||
#define SSHRT_MAX SHRT_MAX
|
||||
#define SINT_MAX INT_MAX
|
||||
#define SLONG_MAX LONG_MAX
|
||||
|
||||
#define UCHAR_MIN 0
|
||||
#define USHRT_MIN 0
|
||||
|
|
2770
test/misc/sitest.c
2770
test/misc/sitest.c
File diff suppressed because it is too large
Load diff
|
@ -12,38 +12,38 @@ void print(void);
|
|||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 15; i++)
|
||||
up[i] = down[i] = 1;
|
||||
for (i = 0; i < 8; i++)
|
||||
rows[i] = 1;
|
||||
queens(0);
|
||||
return 0;
|
||||
int i;
|
||||
for (i = 0; i < 15; i++)
|
||||
up[i] = down[i] = 1;
|
||||
for (i = 0; i < 8; i++)
|
||||
rows[i] = 1;
|
||||
queens(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void queens(int c)
|
||||
{
|
||||
int r;
|
||||
int r;
|
||||
|
||||
for (r = 0; r < 8; r++)
|
||||
if (rows[r] && up[r-c+7] && down[r+c]) {
|
||||
rows[r] = up[r-c+7] = down[r+c] = 0;
|
||||
x[c] = r;
|
||||
if (c == 7)
|
||||
print();
|
||||
else
|
||||
queens(c + 1);
|
||||
rows[r] = up[r-c+7] = down[r+c] = 1;
|
||||
}
|
||||
for (r = 0; r < 8; r++)
|
||||
if (rows[r] && up[r-c+7] && down[r+c]) {
|
||||
rows[r] = up[r-c+7] = down[r+c] = 0;
|
||||
x[c] = r;
|
||||
if (c == 7)
|
||||
print();
|
||||
else
|
||||
queens(c + 1);
|
||||
rows[r] = up[r-c+7] = down[r+c] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void print(void)
|
||||
{
|
||||
int k;
|
||||
int k;
|
||||
|
||||
for (k = 0; k < 8; k++) {
|
||||
printf("%c", x[k]+'1');
|
||||
if(k<7) printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
for (k = 0; k < 8; k++) {
|
||||
printf("%c", x[k]+'1');
|
||||
if(k<7) printf(" ");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -14,49 +14,49 @@ int g(int x[][4],int *y[]);
|
|||
int x[3][4], *y[3];
|
||||
|
||||
main() {
|
||||
int z[3][4];
|
||||
int i, j, *p;
|
||||
int z[3][4];
|
||||
int i, j, *p;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 4; j++)
|
||||
x[i][j] = 1000*i + j;
|
||||
y[i] = x[i];
|
||||
}
|
||||
f();
|
||||
for (i = 0; i < 3; i++) {
|
||||
y[i] = p = &z[i][0];
|
||||
for (j = 0; j < 4; j++)
|
||||
p[j] = x[i][j];
|
||||
}
|
||||
g(z, y);
|
||||
|
||||
return 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 4; j++)
|
||||
x[i][j] = 1000*i + j;
|
||||
y[i] = x[i];
|
||||
}
|
||||
f();
|
||||
for (i = 0; i < 3; i++) {
|
||||
y[i] = p = &z[i][0];
|
||||
for (j = 0; j < 4; j++)
|
||||
p[j] = x[i][j];
|
||||
}
|
||||
g(z, y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
f() {
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", x[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", x[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
g(x, y)
|
||||
int x[][4], *y[];
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", x[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", x[i][j]);
|
||||
printf("\n");
|
||||
for (i = 0; i < 3; i++)
|
||||
for (j = 0; j < 4; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
|
||||
typedef signed int TypA[3];
|
||||
typedef struct TypB {
|
||||
TypA Data[2];
|
||||
TypA Data[2];
|
||||
} sTypB;
|
||||
sTypB Bs[10];
|
||||
TypA * APtr;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
Bs[7].Data[1][2]=11;
|
||||
APtr=&(Bs[7].Data[1]);
|
||||
printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] );
|
||||
return 0;
|
||||
Bs[7].Data[1][2]=11;
|
||||
APtr=&(Bs[7].Data[1]);
|
||||
printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,26 +17,26 @@ typedef RecordType *RecordPtr;
|
|||
|
||||
void Proc3(RecordPtr *PtrParOut)
|
||||
{
|
||||
/* whatever */
|
||||
/* whatever */
|
||||
}
|
||||
|
||||
void Proc1(RecordPtr PtrParIn)
|
||||
{
|
||||
#define NextRecord (*(PtrParIn->PtrComp))
|
||||
Proc3((RecordPtr *)NextRecord.PtrComp);
|
||||
Proc3(&NextRecord.PtrComp);
|
||||
Proc3(&PtrParIn->PtrComp->PtrComp);
|
||||
Proc3((RecordPtr *)NextRecord.PtrComp);
|
||||
Proc3(&NextRecord.PtrComp);
|
||||
Proc3(&PtrParIn->PtrComp->PtrComp);
|
||||
|
||||
#ifdef CAST_STRUCT_PTR
|
||||
Proc3((RecordPtr *) PtrParIn->PtrComp->PtrComp);
|
||||
Proc3((RecordPtr *) (*(PtrParIn->PtrComp)).PtrComp);
|
||||
Proc3((RecordPtr *) NextRecord.PtrComp);
|
||||
Proc3((RecordPtr *) PtrParIn->PtrComp->PtrComp);
|
||||
Proc3((RecordPtr *) (*(PtrParIn->PtrComp)).PtrComp);
|
||||
Proc3((RecordPtr *) NextRecord.PtrComp);
|
||||
#else
|
||||
Proc3(PtrParIn->PtrComp->PtrComp);
|
||||
Proc3((*(PtrParIn->PtrComp)).PtrComp);
|
||||
Proc3(NextRecord.PtrComp);
|
||||
Proc3(PtrParIn->PtrComp->PtrComp);
|
||||
Proc3((*(PtrParIn->PtrComp)).PtrComp);
|
||||
Proc3(NextRecord.PtrComp);
|
||||
#endif
|
||||
|
||||
|
||||
#undef NextRecord
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ with compiler option -O but does _not_ show up with -Oi.
|
|||
|
||||
unsigned htons(unsigned val)
|
||||
{
|
||||
return (((unsigned) (val)) << 8) | (((unsigned) (val)) >> 8);
|
||||
return (((unsigned) (val)) << 8) | (((unsigned) (val)) >> 8);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
|
|
@ -25,7 +25,7 @@ int foo=0,bar=2;
|
|||
int main(void)
|
||||
{
|
||||
while(foo<bar)
|
||||
label: ++foo;
|
||||
label: ++foo;
|
||||
|
||||
printf("foo: %d bar: %d\n",foo,bar);
|
||||
|
||||
|
|
|
@ -33,9 +33,9 @@ int argc;
|
|||
char *argv[];
|
||||
#endif
|
||||
{
|
||||
int i, c, nc;
|
||||
int i, c, nc;
|
||||
#ifndef NO_FLOATS
|
||||
float cutoff, atof();
|
||||
float cutoff, atof();
|
||||
#else
|
||||
signed cutoff;
|
||||
#endif
|
||||
|
@ -45,22 +45,22 @@ char *argv[];
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (argc <= 1)
|
||||
if (argc <= 1)
|
||||
#ifndef NO_FLOATS
|
||||
cutoff = 0.0;
|
||||
cutoff = 0.0;
|
||||
#else
|
||||
cutoff = 0;
|
||||
#endif
|
||||
else
|
||||
else
|
||||
#ifndef NO_FLOATS
|
||||
cutoff = atof(argv[1])/100;
|
||||
cutoff = atof(argv[1])/100;
|
||||
#else
|
||||
cutoff = atoi(argv[1])/100;
|
||||
#endif
|
||||
for (i = 0; i < 0x100; )
|
||||
for (i = 0; i < 0x100; )
|
||||
{
|
||||
#ifndef NO_FLOATS
|
||||
f[i++] = 0.0;
|
||||
f[i++] = 0.0;
|
||||
#else
|
||||
f[i++] = 0;
|
||||
#endif
|
||||
|
@ -87,13 +87,13 @@ char *argv[];
|
|||
printf("a-z char:freq\n\n");
|
||||
|
||||
/* first round ... lowercase characters */
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
{
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
{
|
||||
if ((i >= 'a') && (i <= 'z'))
|
||||
if ((i >= 'a') && (i <= 'z'))
|
||||
{
|
||||
printf("%c", i);
|
||||
printf("%c", i);
|
||||
#ifndef NO_FLOATS
|
||||
printf(":%.1f\n", 100*f[i]/nc);
|
||||
#else
|
||||
|
@ -101,19 +101,19 @@ char *argv[];
|
|||
#endif
|
||||
f[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("A-Z char:freq\n\n");
|
||||
|
||||
/* second round ... uppercase characters */
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
{
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
{
|
||||
if ((i >= 'A') && (i <= 'Z'))
|
||||
if ((i >= 'A') && (i <= 'Z'))
|
||||
{
|
||||
printf("%c", i);
|
||||
printf("%c", i);
|
||||
#ifndef NO_FLOATS
|
||||
printf(":%.1f\n", 100*f[i]/nc);
|
||||
#else
|
||||
|
@ -121,19 +121,19 @@ char *argv[];
|
|||
#endif
|
||||
f[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("0-9 char:freq\n\n");
|
||||
|
||||
/* third round ... numbers */
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
{
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
{
|
||||
if ((i >= '0') && (i <= '9'))
|
||||
if ((i >= '0') && (i <= '9'))
|
||||
{
|
||||
printf("%c", i);
|
||||
printf("%c", i);
|
||||
#ifndef NO_FLOATS
|
||||
printf(":%.1f\n", 100*f[i]/nc);
|
||||
#else
|
||||
|
@ -141,19 +141,19 @@ char *argv[];
|
|||
#endif
|
||||
f[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("isprint char:freq\n\n");
|
||||
|
||||
/* second last round ... remaining printable characters */
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
{
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
{
|
||||
if(isprint(i))
|
||||
if(isprint(i))
|
||||
{
|
||||
printf("%c", i);
|
||||
printf("%c", i);
|
||||
#ifndef NO_FLOATS
|
||||
printf(":%.1f\n", 100*f[i]/nc);
|
||||
#else
|
||||
|
@ -161,30 +161,30 @@ char *argv[];
|
|||
#endif
|
||||
f[i]=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("rest char:freq\n\n");
|
||||
|
||||
/* last round ... remaining non printable characters */
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
for (i = 0; i < 0x100; ++i)
|
||||
{
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
if ((f[i]) && ((f[i]/nc) >= cutoff))
|
||||
{
|
||||
if(i=='\n')
|
||||
{
|
||||
printf("newline");
|
||||
printf("newline");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("%03o", i);
|
||||
printf("%03o", i);
|
||||
}
|
||||
#ifndef NO_FLOATS
|
||||
printf(":%.1f\n", 100*f[i]/nc);
|
||||
#else
|
||||
printf(":%d\n", 100*f[i]/nc);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(in);
|
||||
return 0;
|
||||
|
|
|
@ -14,23 +14,23 @@ void backslash(unsigned char c)
|
|||
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
c = '\b';
|
||||
case 'f':
|
||||
c = '\f';
|
||||
case 'n':
|
||||
c = '\n';
|
||||
case 'r':
|
||||
c = '\r';
|
||||
case 't':
|
||||
c = '\t';
|
||||
case 'v':
|
||||
case 'b':
|
||||
c = '\b';
|
||||
case 'f':
|
||||
c = '\f';
|
||||
case 'n':
|
||||
c = '\n';
|
||||
case 'r':
|
||||
c = '\r';
|
||||
case 't':
|
||||
c = '\t';
|
||||
case 'v':
|
||||
#ifndef NO_BACKSLASH_V
|
||||
c = '\v';
|
||||
#else
|
||||
c = 0x0b;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if(!isprint(c))
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ void testbackslash(void)
|
|||
|
||||
int main(void)
|
||||
{
|
||||
testbackslash();
|
||||
testbackslash();
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -12,82 +12,82 @@
|
|||
/* this kind of line-continuation for strings doesnt work properly for cc65 */
|
||||
|
||||
const unsigned char characters[]={
|
||||
/*0123456789abcdef0123456789abcdef*/
|
||||
/* iso646-us control-characters */
|
||||
" " /* 00-1f */
|
||||
/* iso646-us printable characters */
|
||||
" !\"#$%&'()*+,-./" /* 20-2f !"#$%&'()*+,-./ */
|
||||
"0123456789" /* 30-39 0123456789 */
|
||||
":;<=>?@" /* 3a-40 :;<=>?@ */
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 41-5a A-Z */
|
||||
"[\\]^_`" /* 5b-60 [\]^_` */
|
||||
"abcdefghijklmnopqrstuvwxyz" /* 61-7a a-z */
|
||||
"{|}~ " /* 7b-7f {|}~ */
|
||||
/* iso8859-15 extended characters */
|
||||
/*0123456789abcdef0123456789abcdef*/
|
||||
/* iso646-us control-characters */
|
||||
" " /* 00-1f */
|
||||
/* iso646-us printable characters */
|
||||
" !\"#$%&'()*+,-./" /* 20-2f !"#$%&'()*+,-./ */
|
||||
"0123456789" /* 30-39 0123456789 */
|
||||
":;<=>?@" /* 3a-40 :;<=>?@ */
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 41-5a A-Z */
|
||||
"[\\]^_`" /* 5b-60 [\]^_` */
|
||||
"abcdefghijklmnopqrstuvwxyz" /* 61-7a a-z */
|
||||
"{|}~ " /* 7b-7f {|}~ */
|
||||
/* iso8859-15 extended characters */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
const unsigned char characters[]={
|
||||
/*0123456789abcdef0123456789abcdef*/
|
||||
/* iso646-us control-characters */
|
||||
/* 00-1f */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
/* iso646-us printable characters */
|
||||
/* 20-2f !"#$%&'()*+,-./ */
|
||||
' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
|
||||
/* 30-39 0123456789 */
|
||||
'0','1','2','3','4','5','6','7','8','9',
|
||||
/* 3a-40 :;<=>?@ */
|
||||
':',';','<','=','>','?','@',
|
||||
/* 41-5a A-Z */
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
|
||||
/* 5b-60 [\]^_` */
|
||||
'[','\\',']','^','_','`',
|
||||
/* 61-7a a-z */
|
||||
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
|
||||
/* 7b-7f {|}~ */
|
||||
'{','|','}','~',' '
|
||||
/* iso8859-15 extended characters */
|
||||
/*0123456789abcdef0123456789abcdef*/
|
||||
/* iso646-us control-characters */
|
||||
/* 00-1f */
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
/* iso646-us printable characters */
|
||||
/* 20-2f !"#$%&'()*+,-./ */
|
||||
' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
|
||||
/* 30-39 0123456789 */
|
||||
'0','1','2','3','4','5','6','7','8','9',
|
||||
/* 3a-40 :;<=>?@ */
|
||||
':',';','<','=','>','?','@',
|
||||
/* 41-5a A-Z */
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
|
||||
/* 5b-60 [\]^_` */
|
||||
'[','\\',']','^','_','`',
|
||||
/* 61-7a a-z */
|
||||
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
|
||||
/* 7b-7f {|}~ */
|
||||
'{','|','}','~',' '
|
||||
/* iso8859-15 extended characters */
|
||||
};
|
||||
|
||||
void printchars(unsigned char a,unsigned char b){
|
||||
for(b++;a!=b;a++)
|
||||
for(b++;a!=b;a++)
|
||||
/* printf("%02x ",a); */
|
||||
/* printf("%02x ",characters[a]); */
|
||||
printf("%c",characters[a]);
|
||||
printf("\n");
|
||||
printf("%c",characters[a]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
printf("characters:\n\n");
|
||||
printchars(0x61,0x7a);
|
||||
printchars(0x41,0x5a);
|
||||
printf("numbers:\n\n");
|
||||
printchars(0x30,0x39);
|
||||
printf("other:\n\n");
|
||||
printchars(0x20,0x2f);
|
||||
/*printchars(0x3a,0x40);*/
|
||||
printchars(0x3a,0x3f);
|
||||
/*printchars(0x5b,0x60);*/
|
||||
/*printchars(0x7b,0x7f);*/
|
||||
printf("\n\n");
|
||||
printf("slash: '%c'\n",'/');
|
||||
printf("backslash: '%c'\n",'\\');
|
||||
printf("curly braces open: '%c'\n",'{');
|
||||
printf("curly braces close: '%c'\n",'}');
|
||||
printf("square braces open: '%c'\n",'[');
|
||||
printf("square braces close: '%c'\n",']');
|
||||
printf("underscore: '%c'\n",'_');
|
||||
printf("tilde: '%c'\n",'~');
|
||||
printf("pipe: '%c'\n",'|');
|
||||
printf("apostroph: '%c'\n",'\'');
|
||||
printf("single quote '%c'\n",'`');
|
||||
printf("xor '%c'\n",'^');
|
||||
printf("at '%c'\n",'@');
|
||||
printf("characters:\n\n");
|
||||
printchars(0x61,0x7a);
|
||||
printchars(0x41,0x5a);
|
||||
printf("numbers:\n\n");
|
||||
printchars(0x30,0x39);
|
||||
printf("other:\n\n");
|
||||
printchars(0x20,0x2f);
|
||||
/*printchars(0x3a,0x40);*/
|
||||
printchars(0x3a,0x3f);
|
||||
/*printchars(0x5b,0x60);*/
|
||||
/*printchars(0x7b,0x7f);*/
|
||||
printf("\n\n");
|
||||
printf("slash: '%c'\n",'/');
|
||||
printf("backslash: '%c'\n",'\\');
|
||||
printf("curly braces open: '%c'\n",'{');
|
||||
printf("curly braces close: '%c'\n",'}');
|
||||
printf("square braces open: '%c'\n",'[');
|
||||
printf("square braces close: '%c'\n",']');
|
||||
printf("underscore: '%c'\n",'_');
|
||||
printf("tilde: '%c'\n",'~');
|
||||
printf("pipe: '%c'\n",'|');
|
||||
printf("apostroph: '%c'\n",'\'');
|
||||
printf("single quote '%c'\n",'`');
|
||||
printf("xor '%c'\n",'^');
|
||||
printf("at '%c'\n",'@');
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -8,31 +8,31 @@
|
|||
|
||||
void printc(signed char a,signed char b){
|
||||
signed char x=a/b,y=a%b,z=a*b;
|
||||
printf("%3d,%3d is %3d,%3d,%3d\n",a,b,x,y,z);
|
||||
printf("%3d,%3d is %3d,%3d,%3d\n",a,b,x,y,z);
|
||||
}
|
||||
void prints(short a,short b){
|
||||
short x=a/b,y=a%b,z=a*b;
|
||||
printf("%3d,%3d is %3d,%3d,%3d\n",a,b,x,y,z);
|
||||
printf("%3d,%3d is %3d,%3d,%3d\n",a,b,x,y,z);
|
||||
}
|
||||
void printl(long a,long b){
|
||||
long x=a/b,y=a%b,z=a*b;
|
||||
printf("%3ld,%3ld is %3ld,%3ld,%3ld\n",a,b,x,y,z);
|
||||
printf("%3ld,%3ld is %3ld,%3ld,%3ld\n",a,b,x,y,z);
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
printl( 3,-2);
|
||||
printl(-3,-2);
|
||||
printl(-3, 2);
|
||||
printl( 3, 2);
|
||||
printf("-\n");
|
||||
prints( 3,-2);
|
||||
prints(-3,-2);
|
||||
prints(-3, 2);
|
||||
prints( 3, 2);
|
||||
printf("-\n");
|
||||
printc( 3,-2);
|
||||
printc(-3,-2);
|
||||
printc(-3, 2);
|
||||
printc( 3, 2);
|
||||
return 0;
|
||||
printl( 3,-2);
|
||||
printl(-3,-2);
|
||||
printl(-3, 2);
|
||||
printl( 3, 2);
|
||||
printf("-\n");
|
||||
prints( 3,-2);
|
||||
prints(-3,-2);
|
||||
prints(-3, 2);
|
||||
prints( 3, 2);
|
||||
printf("-\n");
|
||||
printc( 3,-2);
|
||||
printc(-3,-2);
|
||||
printc(-3, 2);
|
||||
printc( 3, 2);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
*******************************************************************************
|
||||
* Bug reports, patches, comments, suggestions should be sent to:
|
||||
*
|
||||
* Ben Smith, Rick Grehan or Tom Yager
|
||||
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
|
||||
* Ben Smith, Rick Grehan or Tom Yager
|
||||
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
|
||||
*
|
||||
*******************************************************************************
|
||||
* Modification Log:
|
||||
|
@ -38,53 +38,53 @@ void mov(unsigned char n,unsigned char f,unsigned char t)
|
|||
{
|
||||
char o;
|
||||
|
||||
if(n == 1)
|
||||
{
|
||||
num[f]--;
|
||||
num[t]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
o = (6-(f+t));
|
||||
mov(n-1,f,o);
|
||||
mov(1,f,t);
|
||||
mov(n-1,o,t);
|
||||
}
|
||||
if(n == 1)
|
||||
{
|
||||
num[f]--;
|
||||
num[t]++;
|
||||
}
|
||||
else
|
||||
{
|
||||
o = (6-(f+t));
|
||||
mov(n-1,f,o);
|
||||
mov(1,f,t);
|
||||
mov(n-1,o,t);
|
||||
}
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("%2d: %2d %2d %2d %2d\n",
|
||||
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("%2d: %2d %2d %2d %2d\n",
|
||||
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc,char **argv)
|
||||
{
|
||||
#ifdef USECMDLINE
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s [duration] [disks]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(argc > 1) duration = atoi(argv[1]);
|
||||
if(argc > 2) disk = atoi(argv[2]);
|
||||
}
|
||||
#endif
|
||||
#ifdef USECMDLINE
|
||||
if (argc < 2) {
|
||||
printf("Usage: %s [duration] [disks]\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(argc > 1) duration = atoi(argv[1]);
|
||||
if(argc > 2) disk = atoi(argv[2]);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf("towers of hanoi\ndisks: %d\n\n",disk);
|
||||
printf("towers of hanoi\ndisks: %d\n\n",disk);
|
||||
|
||||
num[1] = disk;
|
||||
num[1] = disk;
|
||||
|
||||
#ifdef VERBOSE
|
||||
printf("%2d: %2d %2d %2d %2d\n",
|
||||
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
|
||||
#endif
|
||||
#ifdef VERBOSE
|
||||
printf("%2d: %2d %2d %2d %2d\n",
|
||||
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
|
||||
#endif
|
||||
|
||||
while(num[3]<disk)
|
||||
{
|
||||
mov(disk,1,3);
|
||||
++iter;
|
||||
}
|
||||
while(num[3]<disk)
|
||||
{
|
||||
mov(disk,1,3);
|
||||
++iter;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -13,39 +13,39 @@ int main(void)
|
|||
}
|
||||
|
||||
memchar() {
|
||||
char x, *p;
|
||||
char x, *p;
|
||||
|
||||
&x, &p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
&x, &p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
}
|
||||
|
||||
memint() {
|
||||
int x, *p;
|
||||
int x, *p;
|
||||
|
||||
&x, &p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
&x, &p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
}
|
||||
|
||||
regchar() {
|
||||
register char x, *p;
|
||||
register char x, *p;
|
||||
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
}
|
||||
|
||||
regint() {
|
||||
register int x, *p;
|
||||
register int x, *p;
|
||||
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
x = *p++;
|
||||
x = *++p;
|
||||
x = *p--;
|
||||
x = *--p;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ h();
|
|||
/*
|
||||
Word words[] = {
|
||||
1, 2, 3,"if",
|
||||
{ { 4, 5 }, { 'f', 'o', 'r' } },
|
||||
{ { 4, 5 }, { 'f', 'o', 'r' } },
|
||||
6, 7, 8, {"else"},
|
||||
{ { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', },
|
||||
{ 0 },
|
||||
|
@ -35,7 +35,7 @@ Word words[] = {
|
|||
|
||||
Word words[] = {
|
||||
{{1, 2, 3},"if"},
|
||||
{ { 4, 5 }, { 'f', 'o', 'r' } },
|
||||
{ { 4, 5 }, { 'f', 'o', 'r' } },
|
||||
{{6, 7, 8}, "else"},
|
||||
{ { 9, 10, 11}, {'w', 'h', 'i', 'l', 'e', }},
|
||||
{{ 0 }},
|
||||
|
@ -47,24 +47,24 @@ int *y[] = { x[0], x[1], x[2], 0 };
|
|||
|
||||
main()
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; y[i]; i++) {
|
||||
for (j = 0; y[i][j]; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
f();
|
||||
g(wordlist);
|
||||
return 0;
|
||||
for (i = 0; y[i]; i++) {
|
||||
for (j = 0; y[i][j]; j++)
|
||||
printf(" %d", y[i][j]);
|
||||
printf("\n");
|
||||
}
|
||||
f();
|
||||
g(wordlist);
|
||||
return 0;
|
||||
}
|
||||
|
||||
f() {
|
||||
static char *keywords[] = {"if", "for", "else", "while", 0, };
|
||||
char **p;
|
||||
static char *keywords[] = {"if", "for", "else", "while", 0, };
|
||||
char **p;
|
||||
|
||||
for (p = keywords; *p; p++)
|
||||
printf("%s\n", *p);
|
||||
for (p = keywords; *p; p++)
|
||||
printf("%s\n", *p);
|
||||
}
|
||||
|
||||
#ifdef NO_OLD_FUNC_DECL
|
||||
|
@ -74,22 +74,22 @@ g(p)
|
|||
Word *p;
|
||||
#endif
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for ( ; p->codes[0]; p++) {
|
||||
for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++)
|
||||
printf("%d ", p->codes[i]);
|
||||
printf("%s\n", p->name);
|
||||
}
|
||||
h();
|
||||
for ( ; p->codes[0]; p++) {
|
||||
for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++)
|
||||
printf("%d ", p->codes[i]);
|
||||
printf("%s\n", p->name);
|
||||
}
|
||||
h();
|
||||
}
|
||||
|
||||
h()
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(words)/sizeof(Word); i++)
|
||||
printf("%d %d %d %s\n", words[i].codes[0],
|
||||
words[i].codes[1], words[i].codes[2],
|
||||
&words[i].name[0]);
|
||||
for (i = 0; i < sizeof(words)/sizeof(Word); i++)
|
||||
printf("%d %d %d %s\n", words[i].codes[0],
|
||||
words[i].codes[1], words[i].codes[2],
|
||||
&words[i].name[0]);
|
||||
}
|
||||
|
|
|
@ -14,17 +14,17 @@ unsigned long a=3;
|
|||
|
||||
unsigned long _func(unsigned long x,unsigned long y)
|
||||
{
|
||||
printf("x:%ld y:%ld\n",x,y);
|
||||
return 0;
|
||||
printf("x:%ld y:%ld\n",x,y);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define func(x,y) _func(x,y)
|
||||
#define func(x,y) _func(x,y)
|
||||
|
||||
int main(void)
|
||||
{
|
||||
fs= func( (fd/a) , func(2,0x0082c90f) );
|
||||
printf("fs:%ld\n",fs);
|
||||
fs=_func( (fd/a) , _func(2,0x0082c90f) );
|
||||
printf("fs:%ld\n",fs);
|
||||
return 0;
|
||||
fs= func( (fd/a) , func(2,0x0082c90f) );
|
||||
printf("fs:%ld\n",fs);
|
||||
fs=_func( (fd/a) , _func(2,0x0082c90f) );
|
||||
printf("fs:%ld\n",fs);
|
||||
return 0;
|
||||
}
|
||||
|
|
3448
test/ref/paranoia.c
3448
test/ref/paranoia.c
File diff suppressed because it is too large
Load diff
|
@ -16,15 +16,15 @@ char i1[];
|
|||
void test1(void) {
|
||||
int a;
|
||||
|
||||
a=sizeof(i1[0]);
|
||||
printf("%04x - ",a);
|
||||
if(sizeof(i1[0])==sizeof(char)) {
|
||||
/* gcc gives size of element */
|
||||
printf("sizeof(i1[0]) gives size of element\n");
|
||||
}
|
||||
if(sizeof(i1[0])==sizeof(char*)) {
|
||||
printf("sizeof(i1[0]) gives size of pointer to element\n");
|
||||
}
|
||||
a=sizeof(i1[0]);
|
||||
printf("%04x - ",a);
|
||||
if(sizeof(i1[0])==sizeof(char)) {
|
||||
/* gcc gives size of element */
|
||||
printf("sizeof(i1[0]) gives size of element\n");
|
||||
}
|
||||
if(sizeof(i1[0])==sizeof(char*)) {
|
||||
printf("sizeof(i1[0]) gives size of pointer to element\n");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -40,14 +40,14 @@ char *t4={"abcde"};
|
|||
void test2(void) {
|
||||
char c1,c2,c3,c4;
|
||||
int i,e=0;
|
||||
for(i=0;i<5;i++){
|
||||
c1=t1[i];c2=t2[i];c3=t3[i];c4=t4[i];
|
||||
/* printf("%02x %02x %02x %02x\n",c1,c2,c3,c4); */
|
||||
printf("%c %c %c %c\n",c1,c2,c3,c4);
|
||||
if(!((c1==c2)&(c1==c3)&(c1==c4))) e=1;
|
||||
}
|
||||
if(e) printf("test2 failed.\n");
|
||||
else printf("test2 ok.\n");
|
||||
for(i=0;i<5;i++){
|
||||
c1=t1[i];c2=t2[i];c3=t3[i];c4=t4[i];
|
||||
/* printf("%02x %02x %02x %02x\n",c1,c2,c3,c4); */
|
||||
printf("%c %c %c %c\n",c1,c2,c3,c4);
|
||||
if(!((c1==c2)&(c1==c3)&(c1==c4))) e=1;
|
||||
}
|
||||
if(e) printf("test2 failed.\n");
|
||||
else printf("test2 ok.\n");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -74,7 +74,7 @@ A3 a3[] = {
|
|||
#endif
|
||||
|
||||
void test3a(A3 *list, int number){
|
||||
printf("%s %d\n",list->name,number);
|
||||
printf("%s %d\n",list->name,number);
|
||||
}
|
||||
|
||||
static void test31(void)
|
||||
|
@ -103,10 +103,10 @@ static void test30(void)
|
|||
*/
|
||||
|
||||
int main(void) {
|
||||
test1();
|
||||
test2();
|
||||
test30();
|
||||
test31();
|
||||
/* test32(); */
|
||||
return 0;
|
||||
test1();
|
||||
test2();
|
||||
test30();
|
||||
test31();
|
||||
/* test32(); */
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -14,62 +14,62 @@ int *xx;
|
|||
exchange(int *x,int *y) {
|
||||
int t;
|
||||
|
||||
printf("exchange(%d,%d)\n", x - xx, y - xx);
|
||||
t = *x; *x = *y; *y = t;
|
||||
printf("exchange(%d,%d)\n", x - xx, y - xx);
|
||||
t = *x; *x = *y; *y = t;
|
||||
}
|
||||
|
||||
/* partition - partition a[i..j] */
|
||||
int partition(int a[], int i, int j) {
|
||||
int v, k;
|
||||
|
||||
j++;
|
||||
k = i;
|
||||
v = a[k];
|
||||
while (i < j) {
|
||||
i++; while (a[i] < v) i++;
|
||||
j--; while (a[j] > v) j--;
|
||||
if (i < j) exchange(&a[i], &a[j]);
|
||||
}
|
||||
exchange(&a[k], &a[j]);
|
||||
return j;
|
||||
j++;
|
||||
k = i;
|
||||
v = a[k];
|
||||
while (i < j) {
|
||||
i++; while (a[i] < v) i++;
|
||||
j--; while (a[j] > v) j--;
|
||||
if (i < j) exchange(&a[i], &a[j]);
|
||||
}
|
||||
exchange(&a[k], &a[j]);
|
||||
return j;
|
||||
}
|
||||
|
||||
/* quick - quicksort a[lb..ub] */
|
||||
void quick(int a[], int lb, int ub) {
|
||||
int k;
|
||||
|
||||
if (lb >= ub)
|
||||
return;
|
||||
k = partition(a, lb, ub);
|
||||
quick(a, lb, k - 1);
|
||||
quick(a, k + 1, ub);
|
||||
if (lb >= ub)
|
||||
return;
|
||||
k = partition(a, lb, ub);
|
||||
quick(a, lb, k - 1);
|
||||
quick(a, k + 1, ub);
|
||||
}
|
||||
|
||||
/* sort - sort a[0..n-1] into increasing order */
|
||||
sort(int a[], int n) {
|
||||
quick(xx = a, 0, --n);
|
||||
quick(xx = a, 0, --n);
|
||||
}
|
||||
|
||||
/* putd - output decimal number */
|
||||
void putd(int n) {
|
||||
if (n < 0) {
|
||||
putchar('-');
|
||||
n = -n;
|
||||
}
|
||||
if (n/10)
|
||||
putd(n/10);
|
||||
putchar(n%10 + '0');
|
||||
if (n < 0) {
|
||||
putchar('-');
|
||||
n = -n;
|
||||
}
|
||||
if (n/10)
|
||||
putd(n/10);
|
||||
putchar(n%10 + '0');
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
sort(in, (sizeof in)/(sizeof in[0]));
|
||||
for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) {
|
||||
putd(in[i]);
|
||||
putchar('\n');
|
||||
}
|
||||
sort(in, (sizeof in)/(sizeof in[0]));
|
||||
for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) {
|
||||
putd(in[i]);
|
||||
putchar('\n');
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,6 +51,6 @@ int j, k, m, n;
|
|||
#endif
|
||||
|
||||
f5(){
|
||||
x=A[k*m]*A[j*m]+B[k*n]*B[j*n];
|
||||
x=A[k*m]*B[j*n]-B[k*n]*A[j*m];
|
||||
x=A[k*m]*A[j*m]+B[k*n]*B[j*n];
|
||||
x=A[k*m]*B[j*n]-B[k*n]*A[j*m];
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
#ifndef NO_FUNCS_TAKE_STRUCTS
|
||||
struct node
|
||||
{
|
||||
int a[4];
|
||||
int a[4];
|
||||
} x =
|
||||
{
|
||||
#ifdef NO_SLOPPY_STRUCT_INIT
|
||||
{
|
||||
{
|
||||
#endif
|
||||
1,2,3,4
|
||||
1,2,3,4
|
||||
#ifdef NO_SLOPPY_STRUCT_INIT
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
#endif
|
||||
|
@ -27,68 +27,68 @@ print(char *fmt, ...);
|
|||
|
||||
main()
|
||||
{
|
||||
print("test 1\n");
|
||||
print("test %s\n", "2");
|
||||
print("test %d%c", 3, '\n');
|
||||
print("%s%s %w%c", "te", "st", 4, '\n');
|
||||
print("test 1\n");
|
||||
print("test %s\n", "2");
|
||||
print("test %d%c", 3, '\n');
|
||||
print("%s%s %w%c", "te", "st", 4, '\n');
|
||||
#ifdef NO_FLOATS
|
||||
print("%s%s %f%c", "te", "st", (signed long) 5, '\n');
|
||||
#else
|
||||
print("%s%s %f%c", "te", "st", 5.0, '\n');
|
||||
print("%s%s %f%c", "te", "st", (signed long) 5, '\n');
|
||||
#else
|
||||
print("%s%s %f%c", "te", "st", 5.0, '\n');
|
||||
#endif
|
||||
#ifndef NO_FUNCS_TAKE_STRUCTS
|
||||
#ifndef NO_FUNCS_TAKE_STRUCTS
|
||||
print("%b %b %b %b %b %b\n", x, x, x, x, x, x);
|
||||
#endif
|
||||
return 0;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
print(char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
for (; *fmt; fmt++)
|
||||
{
|
||||
if (*fmt == '%')
|
||||
switch (*++fmt) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
for (; *fmt; fmt++)
|
||||
{
|
||||
if (*fmt == '%')
|
||||
switch (*++fmt) {
|
||||
case 'b': {
|
||||
#ifdef NO_FUNCS_TAKE_STRUCTS
|
||||
printf("(1 2 3 4)");
|
||||
#else
|
||||
struct node x =
|
||||
va_arg(
|
||||
ap,
|
||||
struct node
|
||||
);
|
||||
printf("(%d %d %d %d)", x.a[0], x.a[1], x.a[2], x.a[3]);
|
||||
#endif
|
||||
#ifdef NO_FUNCS_TAKE_STRUCTS
|
||||
printf("(1 2 3 4)");
|
||||
#else
|
||||
struct node x =
|
||||
va_arg(
|
||||
ap,
|
||||
struct node
|
||||
);
|
||||
printf("(%d %d %d %d)", x.a[0], x.a[1], x.a[2], x.a[3]);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case 'c':
|
||||
/* printf("%c", va_arg(ap, char)); */
|
||||
printf("%c", va_arg(ap, int));
|
||||
break;
|
||||
case 'd':
|
||||
printf("%d", va_arg(ap, int));
|
||||
break;
|
||||
case 'w':
|
||||
/* printf("%x", va_arg(ap, short)); */
|
||||
printf("%x", va_arg(ap, int));
|
||||
break;
|
||||
case 's':
|
||||
printf("%s", va_arg(ap, char *));
|
||||
break;
|
||||
case 'f':
|
||||
#ifdef NO_FLOATS
|
||||
printf("%ld.000000", va_arg(ap, signed long));
|
||||
#else
|
||||
printf("%f", va_arg(ap, double));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("%c", *fmt);
|
||||
break;
|
||||
}
|
||||
else
|
||||
printf("%c", *fmt);
|
||||
}
|
||||
va_end(ap);
|
||||
case 'c':
|
||||
/* printf("%c", va_arg(ap, char)); */
|
||||
printf("%c", va_arg(ap, int));
|
||||
break;
|
||||
case 'd':
|
||||
printf("%d", va_arg(ap, int));
|
||||
break;
|
||||
case 'w':
|
||||
/* printf("%x", va_arg(ap, short)); */
|
||||
printf("%x", va_arg(ap, int));
|
||||
break;
|
||||
case 's':
|
||||
printf("%s", va_arg(ap, char *));
|
||||
break;
|
||||
case 'f':
|
||||
#ifdef NO_FLOATS
|
||||
printf("%ld.000000", va_arg(ap, signed long));
|
||||
#else
|
||||
printf("%f", va_arg(ap, double));
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
printf("%c", *fmt);
|
||||
break;
|
||||
}
|
||||
else
|
||||
printf("%c", *fmt);
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ FILE *outfile=NULL;
|
|||
#else
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -34,18 +34,18 @@ FILE *outfile=NULL;
|
|||
|
||||
struct Xdirent
|
||||
{
|
||||
char d_name[XNAME_MAX+1];
|
||||
unsigned short d_off;
|
||||
unsigned short d_reclen;
|
||||
unsigned char d_type;
|
||||
unsigned char d_namlen;
|
||||
char d_name[XNAME_MAX+1];
|
||||
unsigned short d_off;
|
||||
unsigned short d_reclen;
|
||||
unsigned char d_type;
|
||||
unsigned char d_namlen;
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned char fd;
|
||||
unsigned short off;
|
||||
char name[XNAME_MAX+1];
|
||||
unsigned char fd;
|
||||
unsigned short off;
|
||||
char name[XNAME_MAX+1];
|
||||
} XDIR;
|
||||
|
||||
unsigned char b1[4];
|
||||
|
@ -61,51 +61,51 @@ static struct Xdirent entry;
|
|||
unsigned char fd;
|
||||
static unsigned char ch;
|
||||
|
||||
entry.d_off=dir->off;
|
||||
entry.d_off=dir->off;
|
||||
|
||||
/* basic line-link / file-length */
|
||||
memcpy(buffer,b1,4);
|
||||
|
||||
dir->off=dir->off+4;
|
||||
entry.d_reclen=254*(buffer[2]+(buffer[3]<<8));
|
||||
/* basic line-link / file-length */
|
||||
memcpy(buffer,b1,4);
|
||||
|
||||
dir->off=dir->off+4;
|
||||
entry.d_reclen=254*(buffer[2]+(buffer[3]<<8));
|
||||
|
||||
/* read file entry */
|
||||
memcpy(buffer,b2,0x10);
|
||||
|
||||
dir->off=dir->off+i;
|
||||
/* read file entry */
|
||||
memcpy(buffer,b2,0x10);
|
||||
|
||||
dir->off=dir->off+i;
|
||||
|
||||
printf("Xreaddir: '%s'\n",buffer);
|
||||
|
||||
/* skip until either quote (file) or b (blocks free => end) */
|
||||
i=0;ii=0;
|
||||
while(i==0){
|
||||
temp=buffer[ii];ii++;
|
||||
if(ii>16){
|
||||
/* something went wrong...this shouldnt happen! */
|
||||
return(NULL);
|
||||
}
|
||||
else if(temp=='\"') i++;
|
||||
else if(temp=='b') {
|
||||
/* "blocks free" */
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
printf("Xreaddir: '%s'\n",buffer);
|
||||
printf("Xreaddir: '%s'\n",buffer);
|
||||
|
||||
/* skip until either quote (file) or b (blocks free => end) */
|
||||
i=0;ii=0;
|
||||
while(i==0){
|
||||
temp=buffer[ii];ii++;
|
||||
if(ii>16){
|
||||
/* something went wrong...this shouldnt happen! */
|
||||
return(NULL);
|
||||
}
|
||||
else if(temp=='\"') i++;
|
||||
else if(temp=='b') {
|
||||
/* "blocks free" */
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
printf("Xreaddir: '%s'\n",buffer);
|
||||
|
||||
/* process file entry */
|
||||
/* process file entry */
|
||||
|
||||
i=0; temp=buffer[ii];ii++;
|
||||
while(temp!='\"'){
|
||||
entry.d_name[i]=temp;
|
||||
i++;
|
||||
temp=buffer[ii];ii++;
|
||||
}
|
||||
entry.d_name[i]=0;
|
||||
entry.d_namlen=i;
|
||||
i=0; temp=buffer[ii];ii++;
|
||||
while(temp!='\"'){
|
||||
entry.d_name[i]=temp;
|
||||
i++;
|
||||
temp=buffer[ii];ii++;
|
||||
}
|
||||
entry.d_name[i]=0;
|
||||
entry.d_namlen=i;
|
||||
|
||||
/* set type flag */
|
||||
/* set type flag */
|
||||
|
||||
return(&entry);
|
||||
return(&entry);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
@ -113,16 +113,16 @@ int main(void)
|
|||
char mydirname[XNAME_MAX+1]=".";
|
||||
XDIR mydir;
|
||||
struct Xdirent *mydirent;
|
||||
|
||||
|
||||
printf("start\n");
|
||||
|
||||
if((mydirent=Xreaddir(&mydir))==NULL)
|
||||
{
|
||||
printf("NULL\n");
|
||||
printf("NULL\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("=%s\n",mydirent->d_name);
|
||||
printf("=%s\n",mydirent->d_name);
|
||||
}
|
||||
printf("done\n");
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ void makepoint(point *p,int x, int y) {
|
|||
/* make a rectangle from two points */
|
||||
void makerect(rect *d,point p1, point p2) {
|
||||
rect r;
|
||||
r.pt1 = p1;
|
||||
r.pt2 = p2;
|
||||
r.pt1 = p1;
|
||||
r.pt2 = p2;
|
||||
|
||||
canonrect(d,r);
|
||||
}
|
||||
|
@ -97,53 +97,53 @@ odd(struct odd y) {
|
|||
|
||||
/* add two points */
|
||||
point addpoint(point p1, point p2) {
|
||||
p1.x += p2.x;
|
||||
p1.y += p2.y;
|
||||
return p1;
|
||||
p1.x += p2.x;
|
||||
p1.y += p2.y;
|
||||
return p1;
|
||||
}
|
||||
/* canonicalize rectangle coordinates */
|
||||
rect canonrect(rect r) {
|
||||
rect temp;
|
||||
rect temp;
|
||||
|
||||
temp.pt1.x = min(r.pt1.x, r.pt2.x);
|
||||
temp.pt1.y = min(r.pt1.y, r.pt2.y);
|
||||
temp.pt2.x = max(r.pt1.x, r.pt2.x);
|
||||
temp.pt2.y = max(r.pt1.y, r.pt2.y);
|
||||
return temp;
|
||||
temp.pt1.x = min(r.pt1.x, r.pt2.x);
|
||||
temp.pt1.y = min(r.pt1.y, r.pt2.y);
|
||||
temp.pt2.x = max(r.pt1.x, r.pt2.x);
|
||||
temp.pt2.y = max(r.pt1.y, r.pt2.y);
|
||||
return temp;
|
||||
}
|
||||
/* make a point from x and y components */
|
||||
point makepoint(int x, int y) {
|
||||
point p;
|
||||
point p;
|
||||
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
return p;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
return p;
|
||||
}
|
||||
|
||||
/* make a rectangle from two points */
|
||||
rect makerect(point p1, point p2) {
|
||||
rect r;
|
||||
rect r;
|
||||
|
||||
r.pt1 = p1;
|
||||
r.pt2 = p2;
|
||||
return canonrect(r);
|
||||
r.pt1 = p1;
|
||||
r.pt2 = p2;
|
||||
return canonrect(r);
|
||||
}
|
||||
|
||||
struct odd {char a[3]; } y =
|
||||
{
|
||||
#ifdef NO_SLOPPY_STRUCT_INIT
|
||||
{
|
||||
{
|
||||
#endif
|
||||
'a', 'b', 0
|
||||
'a', 'b', 0
|
||||
#ifdef NO_SLOPPY_STRUCT_INIT
|
||||
}
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
odd(struct odd y)
|
||||
{
|
||||
struct odd x
|
||||
= y;
|
||||
struct odd x
|
||||
= y;
|
||||
printf("%s\n\r", x.a);
|
||||
}
|
||||
|
||||
|
@ -157,8 +157,8 @@ int ptinrect(point *p, rect *r) {
|
|||
}
|
||||
#else
|
||||
int ptinrect(point p, rect r) {
|
||||
return p.x >= r.pt1.x && p.x < r.pt2.x
|
||||
&& p.y >= r.pt1.y && p.y < r.pt2.y;
|
||||
return p.x >= r.pt1.x && p.x < r.pt2.x
|
||||
&& p.y >= r.pt1.y && p.y < r.pt2.y;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -212,9 +212,9 @@ point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 };
|
|||
#else
|
||||
if (ptinrect(x, screen) == 0)
|
||||
#endif
|
||||
{
|
||||
{
|
||||
printf("not ");
|
||||
}
|
||||
}
|
||||
printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y,
|
||||
screen.pt2.x, screen.pt2.y);
|
||||
}
|
||||
|
@ -240,24 +240,24 @@ point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 };
|
|||
#endif
|
||||
|
||||
rect screen =
|
||||
makerect(
|
||||
addpoint(maxpt, makepoint(-10, -10)),
|
||||
addpoint(origin, makepoint(10, 10))
|
||||
);
|
||||
makerect(
|
||||
addpoint(maxpt, makepoint(-10, -10)),
|
||||
addpoint(origin, makepoint(10, 10))
|
||||
);
|
||||
|
||||
test1();
|
||||
|
||||
for (i = 0; i < sizeof pts/sizeof pts[0]; i++) {
|
||||
printf("(%d,%d) is ", pts[i].x,
|
||||
(x = makepoint(pts[i].x, pts[i].y)).y);
|
||||
if (ptinrect(x, screen) == 0)
|
||||
printf("not ");
|
||||
test1();
|
||||
|
||||
for (i = 0; i < sizeof pts/sizeof pts[0]; i++) {
|
||||
printf("(%d,%d) is ", pts[i].x,
|
||||
(x = makepoint(pts[i].x, pts[i].y)).y);
|
||||
if (ptinrect(x, screen) == 0)
|
||||
printf("not ");
|
||||
printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y,
|
||||
screen.pt2.x, screen.pt2.y);
|
||||
}
|
||||
odd(y);
|
||||
screen.pt2.x, screen.pt2.y);
|
||||
}
|
||||
odd(y);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* FUNCS_RETURN_STRUCTS */
|
||||
|
|
|
@ -18,9 +18,9 @@ limit();
|
|||
|
||||
big(
|
||||
# ifdef ASSUME_32BIT_UNSIGNED
|
||||
unsigned
|
||||
unsigned
|
||||
# else
|
||||
unsigned long
|
||||
unsigned long
|
||||
# endif
|
||||
x);
|
||||
|
||||
|
@ -28,28 +28,28 @@ x);
|
|||
|
||||
main()
|
||||
{
|
||||
testbackslash();
|
||||
f();
|
||||
g();
|
||||
h();
|
||||
testbig(); /* ! broken long int compare (?) */
|
||||
limit(); /* ! broken long int compare (?) */
|
||||
testbackslash();
|
||||
f();
|
||||
g();
|
||||
h();
|
||||
testbig(); /* ! broken long int compare (?) */
|
||||
limit(); /* ! broken long int compare (?) */
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
testbig()
|
||||
{
|
||||
#ifdef ASSUME_32BIT_INT
|
||||
int i;
|
||||
#else
|
||||
signed long i;
|
||||
#endif
|
||||
/* 2341234 2341234 2341234 */
|
||||
for (i = 0x1000000; i&0x7000000; i += 0x1000000) {
|
||||
/* printf("i = 0x%lx\n", i); */
|
||||
big(i);
|
||||
}
|
||||
#ifdef ASSUME_32BIT_INT
|
||||
int i;
|
||||
#else
|
||||
signed long i;
|
||||
#endif
|
||||
/* 2341234 2341234 2341234 */
|
||||
for (i = 0x1000000; i&0x7000000; i += 0x1000000) {
|
||||
/* printf("i = 0x%lx\n", i); */
|
||||
big(i);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NO_LOCAL_STRING_INIT
|
||||
|
@ -69,93 +69,93 @@ testbackslash()
|
|||
#else
|
||||
for (s = "bfnrtvx"; *s; s++) {
|
||||
#endif
|
||||
printf("%c = %c\n", *s, backslash(*s));
|
||||
printf("%c = %c\n", *s, backslash(*s));
|
||||
}
|
||||
}
|
||||
|
||||
backslash(c)
|
||||
{
|
||||
switch (c)
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
return 'b';
|
||||
case 'f':
|
||||
return 'f';
|
||||
case 'n':
|
||||
return 'n';
|
||||
case 'r':
|
||||
return 'r';
|
||||
case 't':
|
||||
return 't';
|
||||
case 'v':
|
||||
case 'b':
|
||||
return 'b';
|
||||
case 'f':
|
||||
return 'f';
|
||||
case 'n':
|
||||
return 'n';
|
||||
case 'r':
|
||||
return 'r';
|
||||
case 't':
|
||||
return 't';
|
||||
case 'v':
|
||||
return 'v';
|
||||
}
|
||||
}
|
||||
|
||||
return 'x';
|
||||
return 'x';
|
||||
}
|
||||
|
||||
f() {
|
||||
int i, x = 0, y;
|
||||
int i, x = 0, y;
|
||||
|
||||
printf("f:\n");
|
||||
for (i = 0; i <= 20; i++) {
|
||||
y = i;
|
||||
switch (i) {
|
||||
case 1: x = i; break;
|
||||
case 2: x = i; break;
|
||||
case 7: x = i; break;
|
||||
case 8: x = i; break;
|
||||
case 9: x = i; break;
|
||||
case 16: x = i; break;
|
||||
case 17: x = i; break;
|
||||
case 18: x = i; break;
|
||||
case 19: x = i; break;
|
||||
case 20: x = i; break;
|
||||
}
|
||||
printf("x = %d\n", x);
|
||||
}
|
||||
printf("f:\n");
|
||||
for (i = 0; i <= 20; i++) {
|
||||
y = i;
|
||||
switch (i) {
|
||||
case 1: x = i; break;
|
||||
case 2: x = i; break;
|
||||
case 7: x = i; break;
|
||||
case 8: x = i; break;
|
||||
case 9: x = i; break;
|
||||
case 16: x = i; break;
|
||||
case 17: x = i; break;
|
||||
case 18: x = i; break;
|
||||
case 19: x = i; break;
|
||||
case 20: x = i; break;
|
||||
}
|
||||
printf("x = %d\n", x);
|
||||
}
|
||||
}
|
||||
|
||||
g() {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
printf("g:\n");
|
||||
for (i = 1; i <= 10; i++)
|
||||
switch (i) {
|
||||
case 1: case 2: printf("1 %d\n", i); break;
|
||||
case 3: case 4: case 5: printf("2 %d\n", i); break;
|
||||
case 6: case 7: case 8: printf("3 %d\n", i);
|
||||
default:
|
||||
printf("d %d\n", i); break;
|
||||
case 1001: case 1002: case 1003: case 1004:
|
||||
printf("5 %d\n", i); break;
|
||||
case 3001: case 3002: case 3003: case 3004:
|
||||
printf("6 %d\n", i); break;
|
||||
}
|
||||
printf("g:\n");
|
||||
for (i = 1; i <= 10; i++)
|
||||
switch (i) {
|
||||
case 1: case 2: printf("1 %d\n", i); break;
|
||||
case 3: case 4: case 5: printf("2 %d\n", i); break;
|
||||
case 6: case 7: case 8: printf("3 %d\n", i);
|
||||
default:
|
||||
printf("d %d\n", i); break;
|
||||
case 1001: case 1002: case 1003: case 1004:
|
||||
printf("5 %d\n", i); break;
|
||||
case 3001: case 3002: case 3003: case 3004:
|
||||
printf("6 %d\n", i); break;
|
||||
}
|
||||
}
|
||||
|
||||
h()
|
||||
{
|
||||
int i, n=0;
|
||||
int i, n=0;
|
||||
|
||||
printf("h:\n");
|
||||
for (i = 1; i <= 500; i++)
|
||||
switch (i) {
|
||||
default: n++; continue;
|
||||
case 128: printf("i = %d\n", i); break;
|
||||
case 16: printf("i = %d\n", i); break;
|
||||
case 8: printf("i = %d\n", i); break;
|
||||
case 120: printf("i = %d\n", i); break;
|
||||
case 280: printf("i = %d\n", i); break;
|
||||
case 264: printf("i = %d\n", i); break;
|
||||
case 248: printf("i = %d\n", i); break;
|
||||
case 272: printf("i = %d\n", i); break;
|
||||
case 304: printf("i = %d\n", i); break;
|
||||
case 296: printf("i = %d\n", i); break;
|
||||
case 288: printf("i = %d\n", i); break;
|
||||
case 312: printf("i = %d\n", i); break;
|
||||
}
|
||||
printf("%d defaults\n", n);
|
||||
printf("h:\n");
|
||||
for (i = 1; i <= 500; i++)
|
||||
switch (i) {
|
||||
default: n++; continue;
|
||||
case 128: printf("i = %d\n", i); break;
|
||||
case 16: printf("i = %d\n", i); break;
|
||||
case 8: printf("i = %d\n", i); break;
|
||||
case 120: printf("i = %d\n", i); break;
|
||||
case 280: printf("i = %d\n", i); break;
|
||||
case 264: printf("i = %d\n", i); break;
|
||||
case 248: printf("i = %d\n", i); break;
|
||||
case 272: printf("i = %d\n", i); break;
|
||||
case 304: printf("i = %d\n", i); break;
|
||||
case 296: printf("i = %d\n", i); break;
|
||||
case 288: printf("i = %d\n", i); break;
|
||||
case 312: printf("i = %d\n", i); break;
|
||||
}
|
||||
printf("%d defaults\n", n);
|
||||
}
|
||||
|
||||
#ifdef NO_OLD_FUNC_DECL
|
||||
|
@ -165,9 +165,9 @@ h()
|
|||
#endif
|
||||
|
||||
# ifdef ASSUME_32BIT_UNSIGNED
|
||||
unsigned
|
||||
unsigned
|
||||
# else
|
||||
unsigned long
|
||||
unsigned long
|
||||
# endif
|
||||
|
||||
#ifdef NO_OLD_FUNC_DECL
|
||||
|
@ -176,42 +176,42 @@ h()
|
|||
x; {
|
||||
#endif
|
||||
|
||||
/* printf("x = 0x%x\n", x); */
|
||||
/* printf("x = 0x%x\n", x); */
|
||||
|
||||
switch(x&0x6000000){
|
||||
case -1:
|
||||
case -2:
|
||||
case 0x0000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
case 0x2000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
case 0x4000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
default:
|
||||
printf("x = 0x%lx (default)\n", x); break;
|
||||
}
|
||||
switch(x&0x6000000){
|
||||
case -1:
|
||||
case -2:
|
||||
case 0x0000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
case 0x2000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
case 0x4000000:
|
||||
printf("x = 0x%lx\n", x); break;
|
||||
default:
|
||||
printf("x = 0x%lx (default)\n", x); break;
|
||||
}
|
||||
}
|
||||
|
||||
limit() {
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for (i = INT_MIN; i <= INT_MIN+5; i++)
|
||||
/* for (i = INT_MIN; i < INT_MIN+6; i++) */
|
||||
switch (i) {
|
||||
case INT_MIN: printf("0\n"); break;
|
||||
case INT_MIN+1: printf("1\n"); break;
|
||||
case INT_MIN+2: printf("2\n"); break;
|
||||
case INT_MIN+3: printf("3\n"); break;
|
||||
case INT_MIN+4: printf("4\n"); break;
|
||||
default: printf("5\n"); break;
|
||||
}
|
||||
for (i = INT_MAX; i >= INT_MAX-5; i--)
|
||||
switch (i) {
|
||||
case INT_MAX: printf("0\n"); break;
|
||||
case INT_MAX-1: printf("1\n"); break;
|
||||
case INT_MAX-2: printf("2\n"); break;
|
||||
case INT_MAX-3: printf("3\n"); break;
|
||||
case INT_MAX-4: printf("4\n"); break;
|
||||
default: printf("5\n"); break;
|
||||
}
|
||||
for (i = INT_MIN; i <= INT_MIN+5; i++)
|
||||
/* for (i = INT_MIN; i < INT_MIN+6; i++) */
|
||||
switch (i) {
|
||||
case INT_MIN: printf("0\n"); break;
|
||||
case INT_MIN+1: printf("1\n"); break;
|
||||
case INT_MIN+2: printf("2\n"); break;
|
||||
case INT_MIN+3: printf("3\n"); break;
|
||||
case INT_MIN+4: printf("4\n"); break;
|
||||
default: printf("5\n"); break;
|
||||
}
|
||||
for (i = INT_MAX; i >= INT_MAX-5; i--)
|
||||
switch (i) {
|
||||
case INT_MAX: printf("0\n"); break;
|
||||
case INT_MAX-1: printf("1\n"); break;
|
||||
case INT_MAX-2: printf("2\n"); break;
|
||||
case INT_MAX-3: printf("3\n"); break;
|
||||
case INT_MAX-4: printf("4\n"); break;
|
||||
default: printf("5\n"); break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,31 +9,31 @@
|
|||
#include <stdio.h>
|
||||
|
||||
void testlimits(int i) {
|
||||
printf("%d:",i);
|
||||
printf("%d:",i);
|
||||
|
||||
switch(i) {
|
||||
case -1: /* works */
|
||||
/* case 0xffff: */ /* 'range error' (-1) */
|
||||
switch(i) {
|
||||
case -1: /* works */
|
||||
/* case 0xffff: */ /* 'range error' (-1) */
|
||||
|
||||
printf("-1\n");
|
||||
break;
|
||||
/* max int */
|
||||
printf("-1\n");
|
||||
break;
|
||||
/* max int */
|
||||
|
||||
/* case 0x7fff: */ /* works */
|
||||
case 32767: /* works */
|
||||
/* case 32768: */ /* 'range error' (correct for that one!) */
|
||||
/* case 0x7fff: */ /* works */
|
||||
case 32767: /* works */
|
||||
/* case 32768: */ /* 'range error' (correct for that one!) */
|
||||
|
||||
printf("max\n");
|
||||
break;
|
||||
/* min int */
|
||||
printf("max\n");
|
||||
break;
|
||||
/* min int */
|
||||
|
||||
case -32768: /* 'warning. constant is long' */
|
||||
/* case 0x8000: */ /* 'range error' */
|
||||
/* case -32769: */ /* 'range error' (correct for that one!) */
|
||||
printf("min\n");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
case -32768: /* 'warning. constant is long' */
|
||||
/* case 0x8000: */ /* 'range error' */
|
||||
/* case -32769: */ /* 'range error' (correct for that one!) */
|
||||
printf("min\n");
|
||||
break;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void testdefault1(unsigned char i) {
|
||||
|
@ -45,9 +45,9 @@ signed char k;
|
|||
#else
|
||||
char k;
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#ifdef UNSIGNED_CHARS
|
||||
signed char k;
|
||||
#else
|
||||
|
@ -56,89 +56,89 @@ char k;
|
|||
|
||||
#endif
|
||||
|
||||
for(;i<254;) {
|
||||
k = i;
|
||||
printf(">%d\n",i);i++;
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
case 17:
|
||||
break;
|
||||
/* triggers bug ? */
|
||||
/* gcc warning: case label value exceeds maximum value for type */
|
||||
/* cc65 error: range error */
|
||||
for(;i<254;) {
|
||||
k = i;
|
||||
printf(">%d\n",i);i++;
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
case 17:
|
||||
break;
|
||||
/* triggers bug ? */
|
||||
/* gcc warning: case label value exceeds maximum value for type */
|
||||
/* cc65 error: range error */
|
||||
|
||||
/*
|
||||
case 170:
|
||||
break;
|
||||
*/
|
||||
case 18:
|
||||
break;
|
||||
case 19:
|
||||
break;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
break;
|
||||
case 24:
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
break;
|
||||
default:
|
||||
printf(">>>default\n");
|
||||
/* triggers bug if this break; is missing? */
|
||||
/* break; */
|
||||
}
|
||||
}
|
||||
/*
|
||||
case 170:
|
||||
break;
|
||||
*/
|
||||
case 18:
|
||||
break;
|
||||
case 19:
|
||||
break;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
break;
|
||||
case 24:
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
break;
|
||||
default:
|
||||
printf(">>>default\n");
|
||||
/* triggers bug if this break; is missing? */
|
||||
/* break; */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void testdefault2(unsigned char i) {
|
||||
|
@ -150,9 +150,9 @@ char k;
|
|||
#else
|
||||
unsigned char k;
|
||||
#endif
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
#ifdef UNSIGNED_CHARS
|
||||
char k;
|
||||
#else
|
||||
|
@ -161,102 +161,102 @@ unsigned char k;
|
|||
|
||||
#endif
|
||||
|
||||
for(;i<254;) {
|
||||
k = i;
|
||||
printf(">%d\n",i);i++;
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
case 17:
|
||||
break;
|
||||
/* triggers bug ? */
|
||||
for(;i<254;) {
|
||||
k = i;
|
||||
printf(">%d\n",i);i++;
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
break;
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
case 10:
|
||||
break;
|
||||
case 11:
|
||||
break;
|
||||
case 12:
|
||||
break;
|
||||
case 13:
|
||||
break;
|
||||
case 14:
|
||||
break;
|
||||
case 15:
|
||||
break;
|
||||
case 17:
|
||||
break;
|
||||
/* triggers bug ? */
|
||||
|
||||
case 170:
|
||||
break;
|
||||
|
||||
case 18:
|
||||
break;
|
||||
case 19:
|
||||
break;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
break;
|
||||
case 24:
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
break;
|
||||
default:
|
||||
printf(">>>default\n");
|
||||
/* triggers bug if this break; is missing? */
|
||||
/* break; */
|
||||
}
|
||||
}
|
||||
case 170:
|
||||
break;
|
||||
|
||||
case 18:
|
||||
break;
|
||||
case 19:
|
||||
break;
|
||||
case 20:
|
||||
break;
|
||||
case 21:
|
||||
break;
|
||||
case 22:
|
||||
break;
|
||||
case 23:
|
||||
break;
|
||||
case 24:
|
||||
switch(k) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
break;
|
||||
case 6:
|
||||
case 7:
|
||||
break;
|
||||
case 8:
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
break;
|
||||
default:
|
||||
printf(">>>default\n");
|
||||
/* triggers bug if this break; is missing? */
|
||||
/* break; */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
testlimits(32767);
|
||||
testlimits(-32768);
|
||||
testlimits(-1);
|
||||
|
||||
testdefault1(1);
|
||||
testdefault1(2);
|
||||
testdefault1(3);
|
||||
testdefault1(4);
|
||||
|
||||
testdefault2(1);
|
||||
testdefault2(2);
|
||||
testdefault2(3);
|
||||
testdefault2(4);
|
||||
testlimits(32767);
|
||||
testlimits(-32768);
|
||||
testlimits(-1);
|
||||
|
||||
testdefault1(1);
|
||||
testdefault1(2);
|
||||
testdefault1(3);
|
||||
testdefault1(4);
|
||||
|
||||
testdefault2(1);
|
||||
testdefault2(2);
|
||||
testdefault2(3);
|
||||
testdefault2(4);
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ static char string[0x100];
|
|||
va_start(ap,format);
|
||||
|
||||
vsprintf(string,format,ap);
|
||||
printf("fd:%d,format:%s,string:%s\n",fd,format,string);
|
||||
printf("fd:%d,format:%s,string:%s\n",fd,format,string);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
|
102
test/ref/wf1.c
102
test/ref/wf1.c
|
@ -16,12 +16,12 @@ FILE *in;
|
|||
|
||||
struct node
|
||||
{
|
||||
int count; /* frequency count */
|
||||
struct node *left; /* left subtree */
|
||||
struct node *right; /* right subtree */
|
||||
char *word; /* word itself */
|
||||
int count; /* frequency count */
|
||||
struct node *left; /* left subtree */
|
||||
struct node *right; /* right subtree */
|
||||
char *word; /* word itself */
|
||||
} words[MAXWORDS];
|
||||
int next; /* index of next free entry in words */
|
||||
int next; /* index of next free entry in words */
|
||||
|
||||
/*struct node *lookup();*/
|
||||
|
||||
|
@ -38,14 +38,14 @@ struct node *lookup(char *word, struct node **p);
|
|||
|
||||
int isletter(char c);
|
||||
|
||||
/* err - print error message s and die */
|
||||
/* err - print error message s and die */
|
||||
#ifndef NO_OLD_FUNC_DECL
|
||||
err(s) char *s; {
|
||||
#else
|
||||
int err(char *s) {
|
||||
#endif
|
||||
printf("? %s\n", s);
|
||||
exit(1);
|
||||
printf("? %s\n", s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* getword - get next input word into buf, return 0 on EOF */
|
||||
|
@ -55,25 +55,25 @@ int getword(buf) char *buf;
|
|||
int getword(char *buf)
|
||||
#endif
|
||||
{
|
||||
char *s;
|
||||
int c;
|
||||
char *s;
|
||||
int c;
|
||||
|
||||
while (((c = getchar()) != -1) && (isletter(c) == 0))
|
||||
;
|
||||
;
|
||||
for (s = buf; (c = isletter(c)); c = getchar())
|
||||
*s++ = c;
|
||||
*s = 0;
|
||||
if (s > buf)
|
||||
return 1;
|
||||
return 0;
|
||||
*s++ = c;
|
||||
*s = 0;
|
||||
if (s > buf)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* isletter - return folded version of c if it is a letter, 0 otherwise */
|
||||
int isletter(char c)
|
||||
{
|
||||
if ((c >= 'A') && (c <= 'Z')) c += 'a' - 'A';
|
||||
if ((c >= 'a') && (c <= 'z')) return c;
|
||||
return 0;
|
||||
if ((c >= 'A') && (c <= 'Z')) c += 'a' - 'A';
|
||||
if ((c >= 'a') && (c <= 'z')) return c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* lookup - lookup word in tree; install if necessary */
|
||||
|
@ -84,27 +84,27 @@ char *word; struct node **p;
|
|||
struct node *lookup(char *word, struct node **p)
|
||||
#endif
|
||||
{
|
||||
int cond;
|
||||
/* char *malloc(); */
|
||||
int cond;
|
||||
/* char *malloc(); */
|
||||
|
||||
if (*p) {
|
||||
cond = strcmp(word, (*p)->word);
|
||||
if (cond < 0)
|
||||
return lookup(word, &(*p)->left);
|
||||
else if (cond > 0)
|
||||
return lookup(word, &(*p)->right);
|
||||
else
|
||||
return *p;
|
||||
}
|
||||
if (next >= MAXWORDS)
|
||||
err("out of node storage");
|
||||
words[next].count = 0;
|
||||
words[next].left = words[next].right = 0;
|
||||
words[next].word = malloc(strlen(word) + 1);
|
||||
if (words[next].word == 0)
|
||||
err("out of word storage");
|
||||
strcpy(words[next].word, word);
|
||||
return *p = &words[next++];
|
||||
if (*p) {
|
||||
cond = strcmp(word, (*p)->word);
|
||||
if (cond < 0)
|
||||
return lookup(word, &(*p)->left);
|
||||
else if (cond > 0)
|
||||
return lookup(word, &(*p)->right);
|
||||
else
|
||||
return *p;
|
||||
}
|
||||
if (next >= MAXWORDS)
|
||||
err("out of node storage");
|
||||
words[next].count = 0;
|
||||
words[next].left = words[next].right = 0;
|
||||
words[next].word = malloc(strlen(word) + 1);
|
||||
if (words[next].word == 0)
|
||||
err("out of word storage");
|
||||
strcpy(words[next].word, word);
|
||||
return *p = &words[next++];
|
||||
}
|
||||
|
||||
/* tprint - print tree */
|
||||
|
@ -113,28 +113,28 @@ void tprint(tree) struct node *tree; {
|
|||
#else
|
||||
void tprint(struct node *tree) {
|
||||
#endif
|
||||
if (tree) {
|
||||
tprint(tree->left);
|
||||
printf("%d:%s\n", tree->count, tree->word);
|
||||
tprint(tree->right);
|
||||
}
|
||||
if (tree) {
|
||||
tprint(tree->left);
|
||||
printf("%d:%s\n", tree->count, tree->word);
|
||||
tprint(tree->right);
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
struct node *root;
|
||||
char word[20];
|
||||
struct node *root;
|
||||
char word[20];
|
||||
|
||||
in = fopen("wf1.in","rb");
|
||||
if (in == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
root = 0;
|
||||
next = 0;
|
||||
while (getword(word))
|
||||
lookup(word, &root)->count++;
|
||||
tprint(root);
|
||||
root = 0;
|
||||
next = 0;
|
||||
while (getword(word))
|
||||
lookup(word, &root)->count++;
|
||||
tprint(root);
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
|
|
1052
test/ref/yacc.c
1052
test/ref/yacc.c
File diff suppressed because it is too large
Load diff
222
test/ref/yacc2.c
222
test/ref/yacc2.c
|
@ -10,105 +10,105 @@
|
|||
# define YYTYPE char
|
||||
struct yywork
|
||||
{
|
||||
YYTYPE verify, advance;
|
||||
YYTYPE verify, advance;
|
||||
} yycrank[] =
|
||||
{
|
||||
{0,0}, {0,0}, {1,3}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {1,4}, {1,3},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {1,3}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {1,4}, {1,3},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {1,5}, {5,7}, {5,7},
|
||||
{5,7}, {5,7}, {5,7}, {5,7},
|
||||
{5,7}, {5,7}, {5,7}, {5,7},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {1,5}, {5,7}, {5,7},
|
||||
{5,7}, {5,7}, {5,7}, {5,7},
|
||||
{5,7}, {5,7}, {5,7}, {5,7},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
/* 0x40 */
|
||||
{0,0}, {0,0}, {1,6}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {1,6}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {0,0}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {6,8}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{0,0}, {0,0}, {6,8}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
/* 0x80 */
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {0,0}, {0,0},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {0,0}, {0,0},
|
||||
|
||||
#ifdef CHARSETHACK
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {0,0}, {0,0},
|
||||
|
||||
/* 0xc0 */
|
||||
{0,0}, {0,0}, {1,6}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {0,0}, {0,0}, {0,0},
|
||||
{0,0}, {0,0}, {1,6}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {6,8}, {6,8}, {6,8},
|
||||
{6,8}, {0,0}, {0,0}, {0,0},
|
||||
#endif
|
||||
{0,0}
|
||||
{0,0}
|
||||
};
|
||||
|
||||
struct yywork *yytop = yycrank+255;
|
||||
|
||||
int yyvstop[] =
|
||||
{
|
||||
0,4,0,3,4,0,2,4,0,1,4,0,2,0,1,0,0
|
||||
0,4,0,3,4,0,2,4,0,1,4,0,2,0,1,0,0
|
||||
};
|
||||
|
||||
struct yysvf
|
||||
{
|
||||
struct yywork *yystoff;
|
||||
struct yysvf *yyother;
|
||||
int *yystops;
|
||||
struct yywork *yystoff;
|
||||
struct yysvf *yyother;
|
||||
int *yystops;
|
||||
};
|
||||
|
||||
struct yysvf yysvec[] =
|
||||
{
|
||||
{0, 0, 0},
|
||||
{yycrank+-1, 0, 0},
|
||||
{yycrank+0, yysvec+1, 0},
|
||||
{yycrank+0, 0, yyvstop+1},
|
||||
{yycrank+0, 0, yyvstop+3},
|
||||
{yycrank+2, 0, yyvstop+6},
|
||||
{yycrank+19, 0, yyvstop+9},
|
||||
{yycrank+0, yysvec+5, yyvstop+12},
|
||||
{yycrank+0, yysvec+6, yyvstop+14},
|
||||
{0, 0, 0}
|
||||
{0, 0, 0},
|
||||
{yycrank+-1, 0, 0},
|
||||
{yycrank+0, yysvec+1, 0},
|
||||
{yycrank+0, 0, yyvstop+1},
|
||||
{yycrank+0, 0, yyvstop+3},
|
||||
{yycrank+2, 0, yyvstop+6},
|
||||
{yycrank+19, 0, yyvstop+9},
|
||||
{yycrank+0, yysvec+5, yyvstop+12},
|
||||
{yycrank+0, yysvec+6, yyvstop+14},
|
||||
{0, 0, 0}
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
@ -116,7 +116,7 @@ struct yysvf yysvec[] =
|
|||
// *yylastch++ = yych = input();
|
||||
void subtest1(void)
|
||||
{
|
||||
*yylastch++ = yych = input();
|
||||
*yylastch++ = yych = input();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -125,26 +125,26 @@ static int bog=1234;
|
|||
#if 0
|
||||
void bogus(void)
|
||||
{
|
||||
bog*=0x1234;
|
||||
bog*=0x1234;
|
||||
}
|
||||
#else
|
||||
#define bogus() bog+=0x1234
|
||||
#define bogus() bog+=0x1234
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
// yyt = yyt + yych;
|
||||
void subtest2(void)
|
||||
{
|
||||
register struct yywork *yyt;
|
||||
int yych;
|
||||
register struct yywork *yyt;
|
||||
int yych;
|
||||
|
||||
yyt=yycrank;
|
||||
yych=10;
|
||||
yyt=yycrank;
|
||||
yych=10;
|
||||
|
||||
bogus();
|
||||
yyt = yyt + yych;
|
||||
bogus();
|
||||
yyt = yyt + yych;
|
||||
|
||||
printf("yyt: %d %d\n",yyt->verify,yyt->advance);
|
||||
printf("yyt: %d %d\n",yyt->verify,yyt->advance);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -152,21 +152,21 @@ void subtest2(void)
|
|||
// if(yyt <= yytop && yyt->verify+yysvec == yystate)
|
||||
void subtest3(void)
|
||||
{
|
||||
register struct yywork *yyt;
|
||||
register struct yysvf *yystate;
|
||||
register struct yywork *yyt;
|
||||
register struct yysvf *yystate;
|
||||
|
||||
yyt=yycrank;
|
||||
yystate=yysvec;
|
||||
|
||||
bogus();
|
||||
if(yyt <= yytop && yyt->verify+yysvec == yystate)
|
||||
{
|
||||
printf("if ok %d %d\n",yyt->verify,yyt->advance);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("if not ok %d %d\n",yyt->verify,yyt->advance);
|
||||
}
|
||||
yyt=yycrank;
|
||||
yystate=yysvec;
|
||||
|
||||
bogus();
|
||||
if(yyt <= yytop && yyt->verify+yysvec == yystate)
|
||||
{
|
||||
printf("if ok %d %d\n",yyt->verify,yyt->advance);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("if not ok %d %d\n",yyt->verify,yyt->advance);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -179,19 +179,19 @@ short yyr2[]=
|
|||
// yyps -= yyr2[yyn];
|
||||
void subtest4(void)
|
||||
{
|
||||
register short *yyps, yyn;
|
||||
register short *yyps, yyn;
|
||||
|
||||
yyps=0x8004;
|
||||
yyn=0;
|
||||
yyps=0x8004;
|
||||
yyn=0;
|
||||
|
||||
while(yyn<14)
|
||||
{
|
||||
bogus();
|
||||
yyps -= yyr2[yyn];
|
||||
while(yyn<14)
|
||||
{
|
||||
bogus();
|
||||
yyps -= yyr2[yyn];
|
||||
|
||||
yyn++;
|
||||
}
|
||||
printf("yyps: %04x\n",yyps);
|
||||
yyn++;
|
||||
}
|
||||
printf("yyps: %04x\n",yyps);
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
@ -199,21 +199,21 @@ void subtest4(void)
|
|||
int yylookret=10;
|
||||
yylook()
|
||||
{
|
||||
yylookret--;
|
||||
return yylookret;
|
||||
yylookret--;
|
||||
return yylookret;
|
||||
}
|
||||
|
||||
// while((nstr = yylook()) >= 0)
|
||||
void subtest5(void)
|
||||
{
|
||||
int nstr;
|
||||
int nstr;
|
||||
|
||||
bogus();
|
||||
while((nstr = yylook()) >= 0)
|
||||
{
|
||||
printf("nstr: %04x\n",nstr);
|
||||
bogus();
|
||||
}
|
||||
bogus();
|
||||
while((nstr = yylook()) >= 0)
|
||||
{
|
||||
printf("nstr: %04x\n",nstr);
|
||||
bogus();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -288,17 +288,17 @@ void c_minus1(void)
|
|||
printf("(long0 != -1)\n");
|
||||
if(long0 != -1)
|
||||
{
|
||||
failures++;
|
||||
failures++;
|
||||
}
|
||||
printf("(long0 > 0)\n");
|
||||
if(long0 > 0)
|
||||
{
|
||||
failures++;
|
||||
failures++;
|
||||
}
|
||||
printf("(long1 < 0)\n");
|
||||
if(long1 < 0)
|
||||
{
|
||||
failures++;
|
||||
failures++;
|
||||
}
|
||||
/*
|
||||
if(long1 < 2)
|
||||
|
|
|
@ -101,9 +101,9 @@ int s22(struct defs *pd0)
|
|||
#define cq_sections 1
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s22(pd0);
|
||||
|
@ -125,7 +125,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -243,9 +243,9 @@ int s241(struct defs *pd0) {
|
|||
#define cq_sections 1
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s241(pd0);
|
||||
|
@ -267,7 +267,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -176,21 +176,21 @@ int s243(struct defs *pd0) {
|
|||
by a more failproof version
|
||||
|
||||
if(
|
||||
'\0' != 0 ||
|
||||
'\01' != 1 ||
|
||||
'\02' != 2 ||
|
||||
'\03' != 3 ||
|
||||
'\04' != 4 ||
|
||||
'\05' != 5 ||
|
||||
'\06' != 6 ||
|
||||
'\07' != 7 ||
|
||||
'\10' != 8 ||
|
||||
'\17' != 15 ||
|
||||
'\20' != 16 ||
|
||||
'\77' != 63 ||
|
||||
'\100' != 64 ||
|
||||
'\177' != 127
|
||||
)
|
||||
'\0' != 0 ||
|
||||
'\01' != 1 ||
|
||||
'\02' != 2 ||
|
||||
'\03' != 3 ||
|
||||
'\04' != 4 ||
|
||||
'\05' != 5 ||
|
||||
'\06' != 6 ||
|
||||
'\07' != 7 ||
|
||||
'\10' != 8 ||
|
||||
'\17' != 15 ||
|
||||
'\20' != 16 ||
|
||||
'\77' != 63 ||
|
||||
'\100' != 64 ||
|
||||
'\177' != 127
|
||||
)
|
||||
*/
|
||||
if(
|
||||
('0' != '\60') ||
|
||||
|
@ -201,7 +201,7 @@ int s243(struct defs *pd0) {
|
|||
('z' != '\172')
|
||||
)
|
||||
|
||||
{
|
||||
{
|
||||
rc = rc+8;
|
||||
if(pd0->flgd != 0)
|
||||
{
|
||||
|
@ -221,9 +221,9 @@ int s243(struct defs *pd0) {
|
|||
#define cq_sections 1
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s243(pd0);
|
||||
|
@ -245,7 +245,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -116,9 +116,9 @@ s244(struct defs *pd0) {
|
|||
#define cq_sections 1
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s244(pd0);
|
||||
|
@ -140,7 +140,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -128,9 +128,9 @@ int s25(struct defs *pd0) {
|
|||
#define cq_sections 1
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s25(pd0);
|
||||
|
@ -152,7 +152,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -171,9 +171,9 @@ s26(struct defs *pd0) {
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s26(pd0);
|
||||
|
@ -197,7 +197,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -317,9 +317,9 @@ setev(){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s26(pd0);
|
||||
|
@ -344,7 +344,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -140,9 +140,9 @@ simply discarded. */
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
/*case 0: return s26(pd0);*/
|
||||
|
@ -167,7 +167,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -291,9 +291,9 @@ int s626(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s26(pd0);
|
||||
|
@ -318,7 +318,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -194,9 +194,9 @@ int
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
/*case 0: return s26(pd0);*/
|
||||
|
@ -221,7 +221,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
342
test/val/cq714.c
342
test/val/cq714.c
|
@ -1507,175 +1507,175 @@ initial (5,2) | (5,2) | (12,10)
|
|||
}
|
||||
|
||||
#ifdef NO_FLOATS
|
||||
fl = 5; cr = 2;
|
||||
fl /= cr;
|
||||
if(fl != 2){
|
||||
lrc = 232;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; sr = 2;
|
||||
fl /= sr;
|
||||
if(fl != 2){
|
||||
lrc = 233;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ir = 2;
|
||||
fl /= ir;
|
||||
if(fl != 2){
|
||||
lrc = 234;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; lr = 2;
|
||||
fl /= lr;
|
||||
if(fl != 2){
|
||||
lrc = 235;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ur = 2;
|
||||
fl /= ur;
|
||||
if(fl != 2){
|
||||
lrc = 236;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; fr = 2;
|
||||
fl /= fr;
|
||||
if(fl != 2){
|
||||
lrc = 237;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; dr = 2;
|
||||
fl /= dr;
|
||||
if(fl != 2){
|
||||
lrc = 238;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; cr = 2;
|
||||
dl /= cr;
|
||||
if(dl != 2){
|
||||
lrc = 239;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; sr = 2;
|
||||
dl /= sr;
|
||||
if(dl != 2){
|
||||
lrc = 240;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ir = 2;
|
||||
dl /= ir;
|
||||
if(dl != 2){
|
||||
lrc = 241;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; lr = 2;
|
||||
dl /= lr;
|
||||
if(dl != 2){
|
||||
lrc = 242;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ur = 2;
|
||||
dl /= ur;
|
||||
if(dl != 2){
|
||||
lrc = 243;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; fr = 2;
|
||||
dl /= fr;
|
||||
if(dl != 2){
|
||||
lrc = 244;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; dr = 2;
|
||||
dl /= dr;
|
||||
if(dl != 2){
|
||||
lrc = 245;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; cr = 2;
|
||||
fl /= cr;
|
||||
if(fl != 2){
|
||||
lrc = 232;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; sr = 2;
|
||||
fl /= sr;
|
||||
if(fl != 2){
|
||||
lrc = 233;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ir = 2;
|
||||
fl /= ir;
|
||||
if(fl != 2){
|
||||
lrc = 234;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; lr = 2;
|
||||
fl /= lr;
|
||||
if(fl != 2){
|
||||
lrc = 235;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ur = 2;
|
||||
fl /= ur;
|
||||
if(fl != 2){
|
||||
lrc = 236;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; fr = 2;
|
||||
fl /= fr;
|
||||
if(fl != 2){
|
||||
lrc = 237;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; dr = 2;
|
||||
fl /= dr;
|
||||
if(fl != 2){
|
||||
lrc = 238;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; cr = 2;
|
||||
dl /= cr;
|
||||
if(dl != 2){
|
||||
lrc = 239;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; sr = 2;
|
||||
dl /= sr;
|
||||
if(dl != 2){
|
||||
lrc = 240;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ir = 2;
|
||||
dl /= ir;
|
||||
if(dl != 2){
|
||||
lrc = 241;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; lr = 2;
|
||||
dl /= lr;
|
||||
if(dl != 2){
|
||||
lrc = 242;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ur = 2;
|
||||
dl /= ur;
|
||||
if(dl != 2){
|
||||
lrc = 243;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; fr = 2;
|
||||
dl /= fr;
|
||||
if(dl != 2){
|
||||
lrc = 244;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; dr = 2;
|
||||
dl /= dr;
|
||||
if(dl != 2){
|
||||
lrc = 245;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
#else
|
||||
fl = 5; cr = 2;
|
||||
fl /= cr;
|
||||
if(fl != 2.5){
|
||||
lrc = 232;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; sr = 2;
|
||||
fl /= sr;
|
||||
if(fl != 2.5){
|
||||
lrc = 233;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ir = 2;
|
||||
fl /= ir;
|
||||
if(fl != 2.5){
|
||||
lrc = 234;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; lr = 2;
|
||||
fl /= lr;
|
||||
if(fl != 2.5){
|
||||
lrc = 235;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ur = 2;
|
||||
fl /= ur;
|
||||
if(fl != 2.5){
|
||||
lrc = 236;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; fr = 2;
|
||||
fl /= fr;
|
||||
if(fl != 2.5){
|
||||
lrc = 237;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; dr = 2;
|
||||
fl /= dr;
|
||||
if(fl != 2.5){
|
||||
lrc = 238;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; cr = 2;
|
||||
dl /= cr;
|
||||
if(dl != 2.5){
|
||||
lrc = 239;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; sr = 2;
|
||||
dl /= sr;
|
||||
if(dl != 2.5){
|
||||
lrc = 240;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ir = 2;
|
||||
dl /= ir;
|
||||
if(dl != 2.5){
|
||||
lrc = 241;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; lr = 2;
|
||||
dl /= lr;
|
||||
if(dl != 2.5){
|
||||
lrc = 242;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ur = 2;
|
||||
dl /= ur;
|
||||
if(dl != 2.5){
|
||||
lrc = 243;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; fr = 2;
|
||||
dl /= fr;
|
||||
if(dl != 2.5){
|
||||
lrc = 244;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; dr = 2;
|
||||
dl /= dr;
|
||||
if(dl != 2.5){
|
||||
lrc = 245;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; cr = 2;
|
||||
fl /= cr;
|
||||
if(fl != 2.5){
|
||||
lrc = 232;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; sr = 2;
|
||||
fl /= sr;
|
||||
if(fl != 2.5){
|
||||
lrc = 233;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ir = 2;
|
||||
fl /= ir;
|
||||
if(fl != 2.5){
|
||||
lrc = 234;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; lr = 2;
|
||||
fl /= lr;
|
||||
if(fl != 2.5){
|
||||
lrc = 235;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; ur = 2;
|
||||
fl /= ur;
|
||||
if(fl != 2.5){
|
||||
lrc = 236;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; fr = 2;
|
||||
fl /= fr;
|
||||
if(fl != 2.5){
|
||||
lrc = 237;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
fl = 5; dr = 2;
|
||||
fl /= dr;
|
||||
if(fl != 2.5){
|
||||
lrc = 238;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; cr = 2;
|
||||
dl /= cr;
|
||||
if(dl != 2.5){
|
||||
lrc = 239;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; sr = 2;
|
||||
dl /= sr;
|
||||
if(dl != 2.5){
|
||||
lrc = 240;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ir = 2;
|
||||
dl /= ir;
|
||||
if(dl != 2.5){
|
||||
lrc = 241;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; lr = 2;
|
||||
dl /= lr;
|
||||
if(dl != 2.5){
|
||||
lrc = 242;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; ur = 2;
|
||||
dl /= ur;
|
||||
if(dl != 2.5){
|
||||
lrc = 243;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; fr = 2;
|
||||
dl /= fr;
|
||||
if(dl != 2.5){
|
||||
lrc = 244;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
dl = 5; dr = 2;
|
||||
dl /= dr;
|
||||
if(dl != 2.5){
|
||||
lrc = 245;
|
||||
if(prlc) printf(f,lrc);
|
||||
}
|
||||
#endif
|
||||
cl = 5; cr = 2;
|
||||
cl %= cr;
|
||||
|
@ -1750,9 +1750,9 @@ initial (5,2) | (5,2) | (12,10)
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s714(pd0);
|
||||
|
@ -1776,7 +1776,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -971,9 +971,9 @@ initial (5,2) | (5,2) | (12,10)
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s714(pd0);
|
||||
|
@ -997,7 +997,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -105,9 +105,9 @@ int x, y, z;
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
/*case 0: return s26(pd0);*/
|
||||
|
@ -132,7 +132,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -299,9 +299,9 @@ int s72(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s26(pd0);
|
||||
|
@ -326,7 +326,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -289,9 +289,9 @@ int s757(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s26(pd0);
|
||||
|
|
|
@ -336,9 +336,9 @@ int s7813(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s7813(pd0);
|
||||
|
@ -362,7 +362,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -682,9 +682,9 @@ test is unreliable. */
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s81(pd0);
|
||||
|
@ -708,7 +708,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -101,13 +101,13 @@ int s84(struct defs *pd0){
|
|||
if(pd0->flgd != 0) printf(s84er,2);
|
||||
rc = rc+2;
|
||||
}
|
||||
#else
|
||||
#else
|
||||
pfi = glork;
|
||||
if((*pfi)(4) != 4){
|
||||
if(pd0->flgd != 0) printf(s84er,2);
|
||||
rc = rc+2;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Float fa[17] declares an array of floating point
|
||||
numbers, and *afp[17] declares an array of pointers
|
||||
|
@ -223,9 +223,9 @@ return x;}
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s84(pd0);
|
||||
|
@ -249,7 +249,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -118,10 +118,10 @@ int s85(struct defs *pd0){
|
|||
#ifdef NO_FLOATS
|
||||
"signed",
|
||||
"signed",
|
||||
#else
|
||||
#else
|
||||
"float",
|
||||
"double"
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
static char aln[] = " alignment: ";
|
||||
|
@ -205,12 +205,12 @@ int s85(struct defs *pd0){
|
|||
if(pd0->flgm != 0) printf("Sign extension in fields\n");
|
||||
}
|
||||
else{
|
||||
#ifdef NO_BITFIELDS
|
||||
if(pd0->flgd != 0) printf("NO_BITFIELDS\n");
|
||||
#else
|
||||
if(pd0->flgd != 0) printf(s85er,2);
|
||||
rc = rc+2;
|
||||
#endif
|
||||
#ifdef NO_BITFIELDS
|
||||
if(pd0->flgd != 0) printf("NO_BITFIELDS\n");
|
||||
#else
|
||||
if(pd0->flgd != 0) printf(s85er,2);
|
||||
rc = rc+2;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -268,9 +268,9 @@ int one();
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s85(pd0);
|
||||
|
@ -294,7 +294,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -183,9 +183,9 @@ int *metricp;
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s86(pd0);
|
||||
|
@ -209,7 +209,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -139,9 +139,9 @@ int s88(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s88(pd0);
|
||||
|
@ -165,7 +165,7 @@ int main(int n,char **args) {
|
|||
|
||||
int j;
|
||||
static struct defs d0, *pd0;
|
||||
|
||||
|
||||
d0.flgs = 1; /* These flags dictate */
|
||||
d0.flgm = 1; /* the verbosity of */
|
||||
d0.flgd = 1; /* the program. */
|
||||
|
|
|
@ -109,9 +109,9 @@ int s9(struct defs *pd0){
|
|||
*********************************************************************************************/
|
||||
|
||||
#ifndef NO_TYPELESS_STRUCT_PTR
|
||||
int section(int j,struct* pd0){
|
||||
int section(int j,struct* pd0){
|
||||
#else
|
||||
int section(int j,void* pd0){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s9(pd0);
|
||||
|
|
|
@ -660,10 +660,10 @@ static unsigned char buf[18830];
|
|||
|
||||
int main() {
|
||||
|
||||
unsigned long cksum = adler32(0, NULL, 0);
|
||||
unsigned long cksum = adler32(0, NULL, 0);
|
||||
|
||||
decompress_lz4(compressed, buf, 18830);
|
||||
cksum = adler32(cksum, buf, 18830);
|
||||
decompress_lz4(compressed, buf, 18830);
|
||||
cksum = adler32(cksum, buf, 18830);
|
||||
|
||||
return cksum == 0xf748269d ? 0 : 1;
|
||||
return cksum == 0xf748269d ? 0 : 1;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@ unsigned char uchar1 = 0;
|
|||
|
||||
void dput(unsigned char val)
|
||||
{
|
||||
/*PORTB = val;
|
||||
PORTA = 0x01;
|
||||
PORTA = 0x00;
|
||||
*/
|
||||
/*PORTB = val;
|
||||
PORTA = 0x01;
|
||||
PORTA = 0x00;
|
||||
*/
|
||||
}
|
||||
|
||||
void done()
|
||||
|
@ -35,104 +35,104 @@ void done()
|
|||
/* both loops use the loop variable inside the inner loop */
|
||||
void for1(void)
|
||||
{
|
||||
unsigned char i, j;
|
||||
unsigned char i, j;
|
||||
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* only the outer loop's variable is used inside, inner can be optimized into a repeat-loop */
|
||||
void for2(void)
|
||||
{
|
||||
unsigned char i, j;
|
||||
unsigned char i, j;
|
||||
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* only the inner loop's variable is used inside */
|
||||
void for3(void)
|
||||
{
|
||||
unsigned char i, j;
|
||||
unsigned char i, j;
|
||||
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* neither loop variable used inside the loops */
|
||||
void for4(void)
|
||||
{
|
||||
unsigned char i, j;
|
||||
unsigned char i, j;
|
||||
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(uchar0);
|
||||
dput(uchar1);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 0; j < 4; j++) {
|
||||
uchar1++;
|
||||
dput(uchar0);
|
||||
dput(uchar1);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 12)
|
||||
failures++;
|
||||
}
|
||||
|
||||
/* like for1 but different condition in inner loop */
|
||||
void for5(void)
|
||||
{
|
||||
unsigned char i, j;
|
||||
unsigned char i, j;
|
||||
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 10; j >= 5; j--) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 18)
|
||||
failures++;
|
||||
uchar0 = 0;
|
||||
uchar1 = 0;
|
||||
for(i = 0; i < 3; i++) {
|
||||
uchar0++;
|
||||
for(j = 10; j >= 5; j--) {
|
||||
uchar1++;
|
||||
dput(i);
|
||||
dput(j);
|
||||
}
|
||||
}
|
||||
if(uchar0 != 3)
|
||||
failures++;
|
||||
if(uchar1 != 18)
|
||||
failures++;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
|
|
|
@ -10,14 +10,14 @@ static unsigned char val, array[2];
|
|||
|
||||
int main() {
|
||||
|
||||
val = 0;
|
||||
array[0] = array[1] = 10;
|
||||
val = 0;
|
||||
array[0] = array[1] = 10;
|
||||
|
||||
array[val++] = 2;
|
||||
array[val++] = 2;
|
||||
--val;
|
||||
array[val--] = 0;
|
||||
array[val--] = 0;
|
||||
array[val++] = 2;
|
||||
array[val++] = 2;
|
||||
--val;
|
||||
array[val--] = 0;
|
||||
array[val--] = 0;
|
||||
|
||||
return (array[0] == array[1] && array[0] == 0 && val == 0xff) ? 0 : 1;
|
||||
return (array[0] == array[1] && array[0] == 0 && val == 0xff) ? 0 : 1;
|
||||
}
|
||||
|
|
|
@ -50,33 +50,33 @@ void done()
|
|||
|
||||
void call0(void)
|
||||
{
|
||||
uchar0++;
|
||||
uchar0++;
|
||||
}
|
||||
|
||||
void call1(void)
|
||||
{
|
||||
uchar1++;
|
||||
uchar1++;
|
||||
}
|
||||
|
||||
unsigned char call2(void)
|
||||
{
|
||||
return uchar0 + 9;
|
||||
return uchar0 + 9;
|
||||
}
|
||||
|
||||
void docall0(void)
|
||||
{
|
||||
pfunc = call0;
|
||||
(pfunc)();
|
||||
if(uchar0 != 1)
|
||||
failures++;
|
||||
pfunc = call0;
|
||||
(pfunc)();
|
||||
if(uchar0 != 1)
|
||||
failures++;
|
||||
}
|
||||
|
||||
void docall1()
|
||||
{
|
||||
unsigned char i;
|
||||
for(i = 0; i < 3; i++) {
|
||||
(*p1func)();
|
||||
}
|
||||
unsigned char i;
|
||||
for(i = 0; i < 3; i++) {
|
||||
(*p1func)();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNCPTR_CONV
|
||||
|
@ -85,53 +85,53 @@ void docall2( void(*pf)(void) )
|
|||
void docall2( void(*pf)() )
|
||||
#endif
|
||||
{
|
||||
unsigned char i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
pf();
|
||||
}
|
||||
unsigned char i;
|
||||
for(i = 0; i < 2; i++) {
|
||||
pf();
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
docall0();
|
||||
|
||||
p1func = call1;
|
||||
docall1();
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 1)
|
||||
failures++;
|
||||
p1func = call1;
|
||||
docall1();
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 1)
|
||||
failures++;
|
||||
|
||||
p1func = call0;
|
||||
docall1();
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 4)
|
||||
failures++;
|
||||
p1func = call0;
|
||||
docall1();
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 4)
|
||||
failures++;
|
||||
|
||||
docall2(call0);
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 6)
|
||||
failures++;
|
||||
docall2(call0);
|
||||
if(uchar1 != 3)
|
||||
failures++;
|
||||
if(uchar0 != 6)
|
||||
failures++;
|
||||
|
||||
docall2(call1);
|
||||
if(uchar1 != 5)
|
||||
failures++;
|
||||
if(uchar0 != 6)
|
||||
failures++;
|
||||
docall2(call1);
|
||||
if(uchar1 != 5)
|
||||
failures++;
|
||||
if(uchar0 != 6)
|
||||
failures++;
|
||||
|
||||
pcfunc = call2;
|
||||
uchar2 = (*pcfunc)();
|
||||
if(uchar2 != 15)
|
||||
failures++;
|
||||
pcfunc = call2;
|
||||
uchar2 = (*pcfunc)();
|
||||
if(uchar2 != 15)
|
||||
failures++;
|
||||
|
||||
uchar2 += (pcfunc)();
|
||||
uchar2 += pcfunc();
|
||||
uchar2 += (pcfunc)();
|
||||
uchar2 += pcfunc();
|
||||
|
||||
success = failures;
|
||||
done();
|
||||
printf("failures: %d\n",failures);
|
||||
success = failures;
|
||||
done();
|
||||
printf("failures: %d\n",failures);
|
||||
|
||||
return failures;
|
||||
return failures;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
static unsigned char flag;
|
||||
|
||||
static void trampoline_set() {
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
asm("jsr callptr4");
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
asm("jsr callptr4");
|
||||
}
|
||||
|
||||
#pragma wrapped-call(push, trampoline_set, 4)
|
||||
|
@ -21,12 +21,12 @@ long adder(long in);
|
|||
|
||||
long adder(long in) {
|
||||
|
||||
return in + 7;
|
||||
return in + 7;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
flag = 0;
|
||||
flag = 0;
|
||||
|
||||
return adder(70436) == 70436 + 7 && flag == 4 ? 0 : 1;
|
||||
return adder(70436) == 70436 + 7 && flag == 4 ? 0 : 1;
|
||||
}
|
||||
|
|
|
@ -10,14 +10,14 @@
|
|||
static unsigned char flag;
|
||||
|
||||
static void trampoline_set() {
|
||||
// The Y register is used for variadics - save and restore
|
||||
asm("sty tmp3");
|
||||
// The Y register is used for variadics - save and restore
|
||||
asm("sty tmp3");
|
||||
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
|
||||
asm("ldy tmp3");
|
||||
asm("jsr callptr4");
|
||||
asm("ldy tmp3");
|
||||
asm("jsr callptr4");
|
||||
}
|
||||
|
||||
#pragma wrapped-call(push, trampoline_set, 4)
|
||||
|
@ -26,23 +26,23 @@ unsigned adder(unsigned char num, ...);
|
|||
|
||||
unsigned adder(unsigned char num, ...) {
|
||||
|
||||
unsigned char i;
|
||||
unsigned sum = 0;
|
||||
va_list ap;
|
||||
va_start(ap, num);
|
||||
unsigned char i;
|
||||
unsigned sum = 0;
|
||||
va_list ap;
|
||||
va_start(ap, num);
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
sum += va_arg(ap, unsigned);
|
||||
}
|
||||
for (i = 0; i < num; i++) {
|
||||
sum += va_arg(ap, unsigned);
|
||||
}
|
||||
|
||||
va_end(ap);
|
||||
va_end(ap);
|
||||
|
||||
return sum;
|
||||
return sum;
|
||||
}
|
||||
|
||||
int main() {
|
||||
|
||||
flag = 0;
|
||||
flag = 0;
|
||||
|
||||
return adder(3, 0, 5, 500) == 505 && flag == 4 ? 0 : 1;
|
||||
return adder(3, 0, 5, 500) == 505 && flag == 4 ? 0 : 1;
|
||||
}
|
||||
|
|
|
@ -8,14 +8,14 @@
|
|||
static unsigned char flag;
|
||||
|
||||
static void trampoline_set() {
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
asm("jsr callptr4");
|
||||
asm("ldy tmp4");
|
||||
asm("sty %v", flag);
|
||||
asm("jsr callptr4");
|
||||
}
|
||||
|
||||
void trampoline_inc() {
|
||||
asm("inc %v", flag);
|
||||
asm("jsr callptr4");
|
||||
asm("inc %v", flag);
|
||||
asm("jsr callptr4");
|
||||
}
|
||||
|
||||
void func3() {
|
||||
|
@ -25,7 +25,7 @@ void func3() {
|
|||
#pragma wrapped-call(push, trampoline_inc, 0)
|
||||
|
||||
void func2() {
|
||||
func3();
|
||||
func3();
|
||||
}
|
||||
|
||||
#pragma wrapped-call(push, trampoline_set, 4)
|
||||
|
@ -36,14 +36,14 @@ void func1(void);
|
|||
#pragma wrapped-call(pop)
|
||||
|
||||
void func1() {
|
||||
func2();
|
||||
func2();
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
flag = 0;
|
||||
flag = 0;
|
||||
|
||||
func1();
|
||||
func1();
|
||||
|
||||
return flag == 5 ? 0 : 1;
|
||||
return flag == 5 ? 0 : 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue