remote TABs in doc/ and test/

This commit is contained in:
Christian Groessler 2019-02-12 22:50:49 +01:00
parent b9ea77b185
commit 7445550831
97 changed files with 5956 additions and 5963 deletions

View File

@ -32,7 +32,7 @@ more information.
<sect>Binary format<p> <sect>Binary format<p>
The standard binary file format generated by the linker for the The standard binary file format generated by the linker for the
Apple&nbsp;&rsqb;&lsqb; target is an <url name="AppleSingle" Apple&nbsp;&rsqb;&lsqb; target is an <url name="AppleSingle"
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file. url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
The default load address is &dollar;803. The default load address is &dollar;803.
@ -580,18 +580,18 @@ url="ca65.html" name="assembler manual">.
ProDOS associates a file type and an auxiliary type with each file. ProDOS associates a file type and an auxiliary type with each file.
These type specifications are separate from the file's name, unlike These type specifications are separate from the file's name, unlike
Windows which uses the file name's suffix (a.k.a. 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/. <tt/.doc/, or <tt/.bat/.
The ProDOS low-level The ProDOS low-level
Machine-Language Interface (MLI) functions for creating and opening Machine-Language Interface (MLI) functions for creating and opening
files require these types to be specified. And if they don't match files require these types to be specified. And if they don't match
with the file being opened, the operation may fail. with the file being opened, the operation may fail.
In contrast, the ISO C function <tt/fopen()/ and the POSIX function 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 <tt/open()/ have no parameter to specify either a file type or an
auxiliary type. Therefore, some additional mechanism for specifying 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> <tag>Specifying the File Type and Auxiliary Type</tag>
There are two global variables provided that allow the file type 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 char _filetype; /* Default: PRODOS_T_BIN */
extern unsigned int _auxtype; /* Default: 0 */ extern unsigned int _auxtype; /* Default: 0 */
</verb> </verb>
</tscreen> </tscreen>
The header file <tt/apple2_filetype.h/ also defines many values The header file <tt/apple2_filetype.h/ also defines many values
that can be used to set these variables. It is included in 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> <tag>Example</tag>
A text file cannot be created with just the 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_BIN/. The <tt/_filetype/ variable must be set to
<tt/PRODOS_T_TXT/ to create a text file. <tt/PRODOS_T_TXT/ to create a text file.
For a text file, For a text file,
<tt/_auxtype/ specifies the record length. A zero record <tt/_auxtype/ specifies the record length. A zero record
length text file is referred to as a sequential text file. 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 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). 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 "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. file position of any individual record can be calculated.
For this example, the For this example, the
<tt/_auxtype/ does not need to be set because it defaults to <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/ <tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
which is defined as zero. which is defined as zero.
@ -670,7 +670,7 @@ url="ca65.html" name="assembler manual">.
} }
} }
</verb> </verb>
</tscreen> </tscreen>
</descrip><p> </descrip><p>
@ -686,14 +686,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -32,7 +32,7 @@ more information.
<sect>Binary format<p> <sect>Binary format<p>
The standard binary file format generated by the linker for the The standard binary file format generated by the linker for the
enhanced&nbsp;Apple&nbsp;//e target is an <url name="AppleSingle" enhanced&nbsp;Apple&nbsp;//e target is an <url name="AppleSingle"
url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file. url="http://kaiser-edv.de/documents/AppleSingle_AppleDouble.pdf"> file.
The default load address is &dollar;803. The default load address is &dollar;803.
@ -586,18 +586,18 @@ url="ca65.html" name="assembler manual">.
ProDOS associates a file type and an auxiliary type with each file. ProDOS associates a file type and an auxiliary type with each file.
These type specifications are separate from the file's name, unlike These type specifications are separate from the file's name, unlike
Windows which uses the file name's suffix (a.k.a. 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/. <tt/.doc/, or <tt/.bat/.
The ProDOS low-level The ProDOS low-level
Machine-Language Interface (MLI) functions for creating and opening Machine-Language Interface (MLI) functions for creating and opening
files require these types to be specified. And if they don't match files require these types to be specified. And if they don't match
with the file being opened, the operation may fail. with the file being opened, the operation may fail.
In contrast, the ISO C function <tt/fopen()/ and the POSIX function 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 <tt/open()/ have no parameter to specify either a file type or an
auxiliary type. Therefore, some additional mechanism for specifying 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> <tag>Specifying the File Type and Auxiliary Type</tag>
There are two global variables provided that allow the file type 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 char _filetype; /* Default: PRODOS_T_BIN */
extern unsigned int _auxtype; /* Default: 0 */ extern unsigned int _auxtype; /* Default: 0 */
</verb> </verb>
</tscreen> </tscreen>
The header file <tt/apple2_filetype.h/ also defines many values The header file <tt/apple2_filetype.h/ also defines many values
that can be used to set these variables. It is included in 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> <tag>Example</tag>
A text file cannot be created with just the 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_BIN/. The <tt/_filetype/ variable must be set to
<tt/PRODOS_T_TXT/ to create a text file. <tt/PRODOS_T_TXT/ to create a text file.
For a text file, For a text file,
<tt/_auxtype/ specifies the record length. A zero record <tt/_auxtype/ specifies the record length. A zero record
length text file is referred to as a sequential text file. 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 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). 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 "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. file position of any individual record can be calculated.
For this example, the For this example, the
<tt/_auxtype/ does not need to be set because it defaults to <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/ <tt/_auxtype/ can also be set to <tt/PRODOS_AUX_T_TXT_SEQ/
which is defined as zero. which is defined as zero.
@ -676,7 +676,7 @@ url="ca65.html" name="assembler manual">.
} }
} }
</verb> </verb>
</tscreen> </tscreen>
</descrip><p> </descrip><p>
@ -692,14 +692,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -30,14 +30,14 @@ for the cc65 compiler. ar65 is part of this suite.
The archiver is called as follows: The archiver is called as follows:
<tscreen><verb> <tscreen><verb>
Usage: ar65 <operation ...> lib file|module ... Usage: ar65 <operation ...> lib file|module ...
Operations are some of: Operations are some of:
r Add modules r Add modules
d Delete modules d Delete modules
t List library table t List library table
v Increase verbosity (put before other operation) v Increase verbosity (put before other operation)
x Extract modules x Extract modules
V Print the archiver version V Print the archiver version
</verb></tscreen> </verb></tscreen>
You may add modules to a library using the <tt/'r'/ command ('a' is deprecated). If the library 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: Here's an example:
<tscreen><verb> <tscreen><verb>
ar65 r mysubs.lib sub1.o sub2.o ar65 r mysubs.lib sub1.o sub2.o
</verb></tscreen> </verb></tscreen>
This will add two modules to the library 'mysubs.lib' creating the 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 Modules names in the library are stored without the path, so, using
<tscreen><verb> <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> </verb></tscreen>
will verbose add two modules named 'sub1.o' and 'sub2.o' to the library. 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: Example:
<tscreen><verb> <tscreen><verb>
ar65 d mysubs.lib sub1.o ar65 d mysubs.lib sub1.o
</verb></tscreen> </verb></tscreen>
This will delete the module named 'sub1.o' from the library, printing an 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: Example:
<tscreen><verb> <tscreen><verb>
ar65 tv mysubs.lib ar65 tv mysubs.lib
</verb></tscreen> </verb></tscreen>
@ -103,7 +103,7 @@ this is not a problem.
Example for extracting a module from the library: Example for extracting a module from the library:
<tscreen><verb> <tscreen><verb>
ar65 x mysubs.lib sub1.o ar65 x mysubs.lib sub1.o
</verb></tscreen> </verb></tscreen>
@ -131,17 +131,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -109,14 +109,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -184,14 +184,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -279,14 +279,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -397,14 +397,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -259,14 +259,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -481,14 +481,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

File diff suppressed because it is too large Load Diff

View File

@ -322,14 +322,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -304,14 +304,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -102,14 +102,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -236,14 +236,14 @@ package, it tries to be smart about several things.
<itemize> <itemize>
<item> If you don't give a target system on the command line, cl65 <item> If you don't give a target system on the command line, cl65
defaults to the C64. defaults to the C64.
<item> When linking, cl65 will supply the name of the library file for <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. 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 <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 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 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 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. 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: into an executable named morse:
<tscreen><verb> <tscreen><verb>
cc65 -g -Oi -t c64 morse.c cc65 -g -Oi -t c64 morse.c
ca65 -g morse.s ca65 -g morse.s
ca65 -g irq.s ca65 -g irq.s
ld65 -o morse -t c64 c64.o morse.o irq.o c64.lib ld65 -o morse -t c64 c64.o morse.o irq.o c64.lib
</verb></tscreen> </verb></tscreen>
When using cl65, this is simplified to When using cl65, this is simplified to
<tscreen><verb> <tscreen><verb>
cl65 -g -Oi morse.c irq.s cl65 -g -Oi morse.c irq.s
</verb></tscreen> </verb></tscreen>
As a general rule, you may use cl65 instead of cc65 at most times, 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 especially in makefiles to build object files directly from C files. Use
<tscreen><verb> <tscreen><verb>
.c.o: .c.o:
cl65 -g -Oi $< cl65 -g -Oi $<
</verb></tscreen> </verb></tscreen>
to do this. to do this.
@ -323,14 +323,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>

View File

@ -285,7 +285,7 @@ segment. Use the assembler to generate an object file from the assembler
output. output.
<tscreen><verb> <tscreen><verb>
co65 --code-label _c64_hi c64-hi.tgi co65 --code-label _c64_hi c64-hi.tgi
ca65 c64-hi.s ca65 c64-hi.s
</verb></tscreen> </verb></tscreen>
@ -293,7 +293,7 @@ Next, change your C code to declare a variable that is actually the address
of the driver: of the driver:
<tscreen><verb> <tscreen><verb>
extern void c64_hi[]; extern void c64_hi[];
</verb></tscreen> </verb></tscreen>
Instead of loading and unloading the driver, change the code to install and 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: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -127,17 +127,17 @@ and predecrement operators if you don't need the resulting value. That means,
use use
<tscreen><verb> <tscreen><verb>
... ...
++i; ++i;
... ...
</verb></tscreen> </verb></tscreen>
instead of instead of
<tscreen><verb> <tscreen><verb>
... ...
i++; i++;
... ...
</verb></tscreen> </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 So, to access direct memory locations, use
<tscreen><verb> <tscreen><verb>
#define VDC_STATUS 0xD601 #define VDC_STATUS 0xD601
*(char*)VDC_STATUS = 0x01; *(char*)VDC_STATUS = 0x01;
</verb></tscreen> </verb></tscreen>
That will be translated to That will be translated to
<tscreen><verb> <tscreen><verb>
lda #$01 lda #$01
sta $D601 sta $D601
</verb></tscreen> </verb></tscreen>
The constant value detection works also for struct pointers and arrays, if the The constant value detection works also for struct pointers and arrays, if the
subscript is a constant. So subscript is a constant. So
<tscreen><verb> <tscreen><verb>
#define VDC ((unsigned char*)0xD600) #define VDC ((unsigned char*)0xD600)
#define STATUS 0x01 #define STATUS 0x01
VDC[STATUS] = 0x01; VDC[STATUS] = 0x01;
</verb></tscreen> </verb></tscreen>
will also work. will also work.
@ -182,14 +182,14 @@ Initialization of local variables when declaring them gives shorter and faster
code. So, use code. So, use
<tscreen><verb> <tscreen><verb>
int i = 1; int i = 1;
</verb></tscreen> </verb></tscreen>
instead of instead of
<tscreen><verb> <tscreen><verb>
int i; int i;
i = 1; i = 1;
</verb></tscreen> </verb></tscreen>
But beware: To maximize your savings, don't mix uninitialized and initialized 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: variables each time, it parses an initialized one. So do this:
<tscreen><verb> <tscreen><verb>
int i, j; int i, j;
int a = 3; int a = 3;
int b = 0; int b = 0;
</verb></tscreen> </verb></tscreen>
instead of instead of
<tscreen><verb> <tscreen><verb>
int i; int i;
int a = 3; int a = 3;
int j; int j;
int b = 0; int b = 0;
</verb></tscreen> </verb></tscreen>
The latter will work, but will create larger and slower code. The latter will work, but will create larger and slower code.
@ -228,17 +228,17 @@ common cases.
Don't use Don't use
<tscreen><verb> <tscreen><verb>
char* a; char* a;
char b, c; char b, c;
char b = *(a + c); char b = *(a + c);
</verb></tscreen> </verb></tscreen>
Use Use
<tscreen><verb> <tscreen><verb>
char* a; char* a;
char b, c; char b, c;
char b = a[c]; char b = a[c];
</verb></tscreen> </verb></tscreen>
instead. instead.

View File

@ -168,14 +168,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -109,7 +109,7 @@ Load your program, then enter the monitor and use the "<tt/ll/" command to
load your label file like this: load your label file like this:
<tscreen><verb> <tscreen><verb>
ll "hello.lbl" ll "hello.lbl"
</verb></tscreen> </verb></tscreen>
You will get lots of warnings and even a few errors. You may ignore safely all 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 and you may use them whereever you need to specify an address. Try
<tscreen><verb> <tscreen><verb>
d ._main d ._main
</verb></tscreen> </verb></tscreen>
as an example (note that VICE needs a leading dot before all labels, and that 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: load your label file like this:
<tscreen><verb> <tscreen><verb>
sl hello.sym sl hello.sym
</verb></tscreen> </verb></tscreen>
After loading the labels, they are used by Oricutron in the disassembler listing, 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 and you may use them whereever you need to specify an address. Try
<tscreen><verb> <tscreen><verb>
d ._main d ._main
</verb></tscreen> </verb></tscreen>
as an example (note that VICE needs a leading dot before all labels, and that as an example (note that VICE needs a leading dot before all labels, and that

View File

@ -138,14 +138,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -68,19 +68,19 @@ programs.
The software needed: The software needed:
<itemize> <itemize>
<item><em/cc65/ Excellent package containing a C crosscompiler, a crossassembler and a linker, you <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 <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/">. can obtain it from: <url url="http://vice-emu.sourceforge.net/">.
The VICE package contains the <em/c1541/ program that is able The VICE package contains the <em/c1541/ program that is able
to convert/unconvert GEOS files to disk images. 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 <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 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 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">. 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 <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 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 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">. this purpose. Check out: <url url="https://spiro.trikaliotis.net/opencbm">.
</itemize> </itemize>
<p> <p>
VICE and cc65 are portable - they run on variety of platforms - DOS, Win32 and UNIX. GEOSLib only 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 <sect3>BitOtherClip
<p> <p>
<tt/void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, unsigned skipTop, <tt/void BitOtherClip (void *proc1, void *proc2, char skipLeft, char skip Right, unsigned skipTop,
struct iconpic *myPic)/ struct iconpic *myPic)/
<p> <p>
Similar to the previous one with some extension. <tt/proc1/ is called before reading a byte (it 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 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> <itemize>
<item><tt/char number/ - total number of icons declared here <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 <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&lsqb;&rsqb/ - this table of size equal to <tt/icontab.number/ contains <item><tt/struct icondef tab&lsqb;&rsqb/ - this table of size equal to <tt/icontab.number/ contains
descriptions for all icons descriptions for all icons
</itemize> </itemize>
<sect1>File and Disk <sect1>File and Disk
@ -1452,9 +1452,9 @@ void example = &lcub;
Which will be compiled to following string of bytes: Which will be compiled to following string of bytes:
<tscreen><verb> <tscreen><verb>
_example: _example:
.byte 3 .byte 3
.word 3 .word 3
.byte 0 .byte 0
</verb></tscreen> </verb></tscreen>
As you see this way it is possible to define data of any type in any order. You must remember to 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. cast each member to proper type.
@ -1474,21 +1474,21 @@ just in the content.
Here is how a single descriptor looks like: Here is how a single descriptor looks like:
<tscreen><verb> <tscreen><verb>
void myMenu = &lcub; void myMenu = &lcub;
(char)top, (char)bottom, // this is the size of the menubox (char)top, (char)bottom, // this is the size of the menubox
(unsigned)left, (unsigned)right, // counting all items in the current descriptor (unsigned)left, (unsigned)right, // counting all items in the current descriptor
(char)number_of_items | type_of_menu, // number of following items ORed with (char)number_of_items | type_of_menu, // number of following items ORed with
// type of this menu, it can be either // 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 // 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. // after moving mouse pointer outside the menubox. You can have at most 31 items.
</verb></tscreen> </verb></tscreen>
This is followed by <tt/number_of_items/ of following item description. This is followed by <tt/number_of_items/ of following item description.
<tscreen><verb> <tscreen><verb>
... ...
"menuitemname", (char)item_type, (unsigned)pointer, "menuitemname", (char)item_type, (unsigned)pointer,
"nextitemname", (char)item_type, (unsigned)pointer, "nextitemname", (char)item_type, (unsigned)pointer,
... ...
"lastitemname", (char)item_type, (unsigned)pointer &rcub;; "lastitemname", (char)item_type, (unsigned)pointer &rcub;;
// Note that there isn't ending <tt/NULL/ or something like that. // Note that there isn't ending <tt/NULL/ or something like that.
</verb></tscreen> </verb></tscreen>
<tt/pointer/ is a pointer to something, what it points for depends from <tt/item_type/. This one <tt/pointer/ is a pointer to something, what it points for depends from <tt/item_type/. This one
can have following values: 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 your own. The first case results in
<tscreen><verb> <tscreen><verb>
const dlgBoxStr example = &lcub; const dlgBoxStr example = &lcub;
DB_DEFPOS (pattern_of_shadow), DB_DEFPOS (pattern_of_shadow),
... // commands ... // commands
DB_END &rcub;; DB_END &rcub;;
</verb></tscreen> </verb></tscreen>
And the own size and position would be: And the own size and position would be:
<tscreen><verb> <tscreen><verb>
const dlgBoxStr example = &lcub; const dlgBoxStr example = &lcub;
DB_SETPOS (pattern, top, bottom, left, right) DB_SETPOS (pattern, top, bottom, left, right)
... // commands ... // commands
DB_END &rcub;; DB_END &rcub;;
</verb></tscreen> </verb></tscreen>
<sect3>Commands <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 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.: <tt/OK, CANCEL, YES, NO, OPEN/, and <tt/DISK/. You can use predefined macros for using them, e.g.:
<tscreen><verb> <tscreen><verb>
... ...
DB_ICON(OK, DBI_X_0, DBI_Y_0), DB_ICON(OK, DBI_X_0, DBI_Y_0),
... ...
</verb></tscreen> </verb></tscreen>
Note that the position is counted from top left corner of window, not entire screen and that the 'x' 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. 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: is variable. Consider following:
<tscreen><verb> <tscreen><verb>
char text = "foo"; char text = "foo";
... ...
r15=(unsigned)text; // in code just before call to DoDlgBox r15=(unsigned)text; // in code just before call to DoDlgBox
... ...
DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &amp;r15), DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &amp;r15),
... ...
</verb></tscreen> </verb></tscreen>
will cause the word ''foo'' to appear in the window, but you may store the pointer to any text in 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. <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: Here is an example for clearing the screen:
<tscreen><verb> <tscreen><verb>
const graphicStr example = &lcub; const graphicStr example = &lcub;
MOVEPENTO(0,0), MOVEPENTO(0,0),
NEWPATTERN(0), NEWPATTERN(0),
RECTANGLETO(319,199) RECTANGLETO(319,199)
GSTR_END &rcub;; GSTR_END &rcub;;
</verb></tscreen> </verb></tscreen>
<sect2>InitRam table <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_func oldVector;
void NewVectorHandler(void) &lcub; void NewVectorHandler(void) &lcub;
// do something and at the end call the old vector routine // do something and at the end call the old vector routine
oldVector(); oldVector();
&rcub; &rcub;
void hook_into_system(void) &lcub; void hook_into_system(void) &lcub;
oldVector = mouseVector; oldVector = mouseVector;
mouseVector = NewVectorHandler; mouseVector = NewVectorHandler;
&rcub; &rcub;
void remove_hook(void) &lcub; void remove_hook(void) &lcub;
mouseVector = oldVector; mouseVector = oldVector;
&rcub; &rcub;
</verb></tscreen> </verb></tscreen>
<p> <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 called every time the mouse button changes status. Other important vectors you should know about
are: are:
<itemize> <itemize>
<item><tt/appMain/ - this is called from within the <tt/MainLoop/ system loop <item><tt/appMain/ - this is called from within the <tt/MainLoop/ system loop
<item><tt/keyVector/ - called whenever a keypress occurs <item><tt/keyVector/ - called whenever a keypress occurs
<item><tt/intTopVector/ - called at the start of the IRQ routine <item><tt/intTopVector/ - called at the start of the IRQ routine
<item><tt/intBotVector/ - called at the end of the IRQ routine <item><tt/intBotVector/ - called at the end of the IRQ routine
</itemize> </itemize>
</article> </article>

View File

@ -381,11 +381,11 @@ HEADER APPLICATION "MyFirstApp" "Class Name" "V1.0"
; file named MyFirstApp with the Class-string "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. ; Not all fields are required, default and current values will be used.
author "Maciej Witkowiak" ; always in quotes! author "Maciej Witkowiak" ; always in quotes!
info "Information text" ; always in quotes! info "Information text" ; always in quotes!
; date yy mm dd hh ss ; always 5 fields! ; date yy mm dd hh ss ; always 5 fields!
; dostype seq ; can be: PRG, SEQ, USR (only all UPPER- or lower-case) ; dostype seq ; can be: PRG, SEQ, USR (only all UPPER- or lower-case)
; structure seq ; can be: SEQ, VLIR (only UPPER- or lower-case) ; structure seq ; can be: SEQ, VLIR (only UPPER- or lower-case)
mode c64only ; can be: any, 40only, 80only, c64only mode c64only ; can be: any, 40only, 80only, c64only
}</verb></tscreen> }</verb></tscreen>
</article> </article>

View File

@ -24,21 +24,21 @@ It complements the features that are built into the ca65 macroassembler:
<itemize> <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 <item> In case of errors, use the meta information stored in the object files
to produce helpful error messages. In case of undefined symbols, to produce helpful error messages. In case of undefined symbols,
expression range errors, or symbol type mismatches, ld65 is able to expression range errors, or symbol type mismatches, ld65 is able to
tell you the exact location in the original assembler source, where tell you the exact location in the original assembler source, where
the symbol was referenced. the symbol was referenced.
<item> Flexible output. The output of ld65 is highly configurable by a config <item> Flexible output. The output of ld65 is highly configurable by a config
file. Some more-common platforms are supported by default configurations file. Some more-common platforms are supported by default configurations
that may be activated by naming the target system. The output that may be activated by naming the target system. The output
generation was designed with different output formats in mind, so generation was designed with different output formats in mind, so
adding other formats shouldn't be a great problem. adding other formats shouldn't be a great problem.
</itemize> </itemize>
@ -1148,14 +1148,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>

View File

@ -228,14 +228,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -337,14 +337,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -179,17 +179,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -200,15 +200,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -217,14 +217,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -242,14 +242,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -260,14 +260,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -27,19 +27,19 @@ binary needs to be compiled with <tt/--target sim6502/ or <tt/--target sim65c02/
The simulator is called as follows: The simulator is called as follows:
<tscreen><verb> <tscreen><verb>
Usage: sim65 [options] file [arguments] Usage: sim65 [options] file [arguments]
Short options: Short options:
-h Help (this text) -h Help (this text)
-c Print amount of executed CPU cycles -c Print amount of executed CPU cycles
-v Increase verbosity -v Increase verbosity
-V Print the simulator version number -V Print the simulator version number
-x <num> Exit simulator after <num> cycles -x <num> Exit simulator after <num> cycles
Long options: Long options:
--help Help (this text) --help Help (this text)
--cycles Print amount of executed CPU cycles --cycles Print amount of executed CPU cycles
--verbose Increase verbosity --verbose Increase verbosity
--version Print the simulator version number --version Print the simulator version number
</verb></tscreen> </verb></tscreen>
@ -120,14 +120,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -470,7 +470,7 @@ SMC instructions.
Example: Example:
<tscreen><verb> <tscreen><verb>
SMC_OperateOnValue ASL, LoadMask ; shift mask to left SMC_OperateOnValue ASL, LoadMask ; shift mask to left
... ...
SMC LoadMask, { LDA #$20 } SMC LoadMask, { LDA #$20 }
</verb></tscreen> </verb></tscreen>
@ -555,14 +555,14 @@ allowing reuse of some instructions.
5: SMC StoreAccuFirstSection, { sta SMC_AbsAdr, Y } 5: SMC StoreAccuFirstSection, { sta SMC_AbsAdr, Y }
6: ... 6: ...
7: RestoreCodeBranchBaseAdr: 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: ... 9: ...
10: SMC_TransferOpcode FirstIncHighByte, OPC_BEQ , x ; change code marked above with (*) 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' 11: SMC_TransferValue FirstIncHighByte, #(restoreCode - RestoreCodeBranchBaseAdr-2), x ; set relative address to 'RestoreCode'
12: ... 12: ...
13: restoreCode: 13: restoreCode:
14: SMC_TransferOpcode FirstIncHighByte, OPC_INC_abs , x ; restore original code... 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) 15: SMC_TransferValue FirstIncHighByte, #(<(StoreToFirstSection+2)), x ; (second byte of inc contained low-byte of address)
16: ... 16: ...
</verb></tscreen> </verb></tscreen>

View File

@ -403,14 +403,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>

View File

@ -148,14 +148,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -16,8 +16,8 @@ An overview over the Telestrat (Telemon 2.4 & Telemon 3.x : http://orix.oric.org
<sect>Overview<p> <sect>Overview<p>
This file contains an overview of the Telestrat runtime system as it comes 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 with the cc65 C compiler. It describes the memory layout, Telestrat-specific
header files, available drivers, and any pitfalls specific to that platform. header files, available drivers, and any pitfalls specific to that platform.
Please note that Telestrat-specific functions are just mentioned here, they are 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. information.
Oric Telestrat is the last Oric computer (Released in 1986, mainly in France). 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. joysticks (2 ports) or mouse (on joystick port), FDC.
Video chip, CPU, keyboard management, tape hardware are the same than Atmos. 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 Telestrat can start in Atmos mode with Atmos Cardridge (which is only the atmos
Basic 1.1 ROM). Basic 1.1 ROM).
Telestrat can start in Sedoric (Atmos OS) and Atmos mode with Stratoric Cardridge. Telestrat can start in Sedoric (Atmos OS) and Atmos mode with Stratoric Cardridge.
This Cardridge has 3 banks of 16KB of rom with: 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). <item>a Basic 1.0 ROM (Oric-1).
</itemize> </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. 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. alternative program.
There is also no software to write a Stratsed dsk file on PC. 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. 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: 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. 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. 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. 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) Stratsed is located in overlay memory (bank 0)
There is no tool to insert a binary in a Stratsed floppy disk. 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> <itemize>
<item>remove the 20 bytes header <item>remove the 20 bytes header
<item>download <url name="osdk" url="http://osdk.defence-force.org/index?page=download"> <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 <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 FloppyBuilder manual to learn how to insert your binary and how to start Microdisc boot sector
when Telestrat starts) when Telestrat starts)
</itemize> </itemize>
@ -183,13 +183,13 @@ TGI drivers is available on Oric Telestrat with some functions:
<sect1>Extended memory drivers<p> <sect1>Extended memory drivers<p>
No extended memory drivers are currently available for the Telestrat. No extended memory drivers are currently available for the Telestrat.
This feature could be done because telestrat can manage RAM inserted in his This feature could be done because telestrat can manage RAM inserted in his
port cardridge. port cardridge.
<sect1>Joystick drivers<p> <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. joysticks driver could be written easily.
Telemon 2.4 returns in keyboard buffer the direction of the joysticks. This means that 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> <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. Telestrat mouse is really difficult to find.
<sect1>RS232 device drivers<p> <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) RS232 port with Telemon calls (see XSOUT primitive for example)
<sect>Limitations<label id="limitations"><p> <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: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -76,13 +76,13 @@ ifneq ($(MAKECMDGOALS),clean)
endif endif
%.o: %.c %.o: %.c
$(CC) -c $(CFLAGS) -o $@ $< $(CC) -c $(CFLAGS) -o $@ $<
$(PROGRAM): $(SOURCES:.c=.o) $(PROGRAM): $(SOURCES:.c=.o)
$(CC) $(LDFLAGS) -o $@ $^ $(CC) $(LDFLAGS) -o $@ $^
clean: clean:
$(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map $(RM) $(SOURCES:.c=.o) $(SOURCES:.c=.d) $(PROGRAM) $(PROGRAM).map
</verb></tscreen> </verb></tscreen>
<bf/Important:/ When using the sample Makefile above via copy & paste it is <bf/Important:/ When using the sample Makefile above via copy & paste it is

View File

@ -264,14 +264,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <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 claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@ -5,25 +5,25 @@
*/ */
main() { main() {
return 0; return 0;
} }
nested(a,b) { nested(a,b) {
if ((a<4 && b == 'r') if ((a<4 && b == 'r')
|| (a == 1 && (b == 'h' || b == 'i')) || (a == 1 && (b == 'h' || b == 'i'))
|| (a == 2 && (b == 'o' || b == 'y')) || (a == 2 && (b == 'o' || b == 'y'))
) a=b; ) a=b;
} }
/* type name scope */ /* 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; typedef struct D D;
struct D {int x, y;} Dy={0}; struct D {int x, y;} Dy={0};
D Dz={1}; D Dz={1};
Dfunc(){ Dfunc(){
D a; a.y=1; D a; a.y=1;
s(&Dy); /* error */ s(&Dy); /* error */
} }
/* qualifiers */ /* qualifiers */
@ -33,39 +33,39 @@ const int a, *x; int b, *y;
volatile unsigned z; volatile unsigned z;
f() { f() {
x = y; x = y;
z = z + z; /* should be 2 references to z's r-value */ z = z + z; /* should be 2 references to z's r-value */
} }
f1() { f1() {
x = &a; x = &a;
x = &b; x = &b;
y = &a; /* error */ y = &a; /* error */
y = &b; y = &b;
} }
f2(int **a, int **b) { f2(int **a, int **b) {
f(&x, &y); f(&x, &y);
**a = 0; **a = 0;
return **b; return **b;
} }
g(const int *p) { g(const int *p) {
g(&a); g(&a);
g(&b); g(&b);
return *p; return *p;
} }
h(int *p) { h(int *p) {
f(&a); f(&a);
f(&b); f(&b);
return *p; return *p;
} }
h1(const int x, int y) { h1(const int x, int y) {
h1(a,b); h1(a,b);
h1(b,a); h1(b,a);
return x + y; return x + y;
} }
h2() { h2() {
char *b; const void *p; char *b; const void *p;
p = b; p = b;
b = p; /* error (incompatible pointer type) */ b = p; /* error (incompatible pointer type) */
} }
/* static naming */ /* 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 void qsort(void*, int, int, int (*)(const void*, const void*));
extern int cmp(char**a, char**b) { return strcmp(*a,*b); } extern int cmp(char**a, char**b) { return strcmp(*a,*b); }
sort() { sort() {
int n; char *a[100]; int n; char *a[100];
qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp); qsort(a, n, sizeof(char*), (int (*)(const void*, const void*))cmp);
qsort(a, n, sizeof(char*), cmp); /* error (incompatible pointer type) */ qsort(a, n, sizeof(char*), cmp); /* error (incompatible pointer type) */
} }
/* nasty calls */ /* nasty calls */
onearg(){ onearg(){
int a,b,c,d; int a,b,c,d;
f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */ f( ( (a? (b = 1): (c = 2)), (d ? 3 : 4) ) ); /* 1 argument */
} }

View File

@ -20,11 +20,11 @@ main()
#ifdef REFCC #ifdef REFCC
#include <stdint.h> #include <stdint.h>
struct foo { struct foo {
int16_t a; int16_t a;
char b; char b;
int16_t x : 12, y : 4; int16_t x : 12, y : 4;
int16_t zz : 1, : 0, : 4, z : 3; int16_t zz : 1, : 0, : 4, z : 3;
char c; char c;
} x = { 1, 2, 3, 4, 5, 6 }; } x = { 1, 2, 3, 4, 5, 6 };
struct baz { uint16_t a:2, b:4, c:16;} y = { 7, 8, 9}; struct baz { uint16_t a:2, b:4, c:16;} y = { 7, 8, 9};
@ -33,11 +33,11 @@ int16_t i = 8;
#else #else
struct foo { struct foo {
int a; int a;
char b; char b;
int x : 12, y : 4; int x : 12, y : 4;
int zz : 1, : 0, : 4, z : 3; int zz : 1, : 0, : 4, z : 3;
char c; char c;
} x = { 1, 2, 3, 4, 5, 6 }; } x = { 1, 2, 3, 4, 5, 6 };
struct baz { unsigned int a:2, b:4, c:16;} y = { 7, 8, 9}; struct baz { unsigned int a:2, b:4, c:16;} y = { 7, 8, 9};
@ -46,10 +46,10 @@ int i = 8;
#else #else
struct foo { struct foo {
int a; int a;
char b; char b;
int x : 12, y : 4, : 0, : 4, z : 3; int x : 12, y : 4, : 0, : 4, z : 3;
char c; char c;
} x = { 1, 2, 3, 4, 5, 6 }; } x = { 1, 2, 3, 4, 5, 6 };
struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9}; struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9};
@ -63,32 +63,32 @@ f2(struct baz *p);
main() 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("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); printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
x.y = i; x.y = i;
x.z = 070; 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); 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.a = 2;
y.c = i; y.c = i;
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c); printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
#ifdef CAST_STRUCT_PTR #ifdef CAST_STRUCT_PTR
f2((struct baz *)&x); f2((struct baz *)&x);
#else #else
f2(&x); f2(&x);
#endif #endif
return 0; return 0;
} }
f1(struct baz *p) { f1(struct baz *p) {
p->a = p->b = 0; p->a = p->b = 0;
if (p->b) if (p->b)
printf("p->b != 0!\n"); printf("p->b != 0!\n");
p->a = 0x3; p->b = 0xf; p->a = 0x3; p->b = 0xf;
printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b); printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b);
} }
f2(struct baz *p) { f2(struct baz *p) {
p->a = (i==0); p->a = (i==0);
p->b = (f1(p),0); p->b = (f1(p),0);
} }
#endif #endif

View File

@ -7,9 +7,9 @@
#include <stdio.h> #include <stdio.h>
#include <limits.h> #include <limits.h>
#define SSHRT_MAX SHRT_MAX #define SSHRT_MAX SHRT_MAX
#define SINT_MAX INT_MAX #define SINT_MAX INT_MAX
#define SLONG_MAX LONG_MAX #define SLONG_MAX LONG_MAX
#define UCHAR_MIN 0 #define UCHAR_MIN 0
#define USHRT_MIN 0 #define USHRT_MIN 0

File diff suppressed because it is too large Load Diff

View File

@ -12,38 +12,38 @@ void print(void);
int main(void) int main(void)
{ {
int i; int i;
for (i = 0; i < 15; i++) for (i = 0; i < 15; i++)
up[i] = down[i] = 1; up[i] = down[i] = 1;
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
rows[i] = 1; rows[i] = 1;
queens(0); queens(0);
return 0; return 0;
} }
void queens(int c) void queens(int c)
{ {
int r; int r;
for (r = 0; r < 8; r++) for (r = 0; r < 8; r++)
if (rows[r] && up[r-c+7] && down[r+c]) { if (rows[r] && up[r-c+7] && down[r+c]) {
rows[r] = up[r-c+7] = down[r+c] = 0; rows[r] = up[r-c+7] = down[r+c] = 0;
x[c] = r; x[c] = r;
if (c == 7) if (c == 7)
print(); print();
else else
queens(c + 1); queens(c + 1);
rows[r] = up[r-c+7] = down[r+c] = 1; rows[r] = up[r-c+7] = down[r+c] = 1;
} }
} }
void print(void) void print(void)
{ {
int k; int k;
for (k = 0; k < 8; k++) { for (k = 0; k < 8; k++) {
printf("%c", x[k]+'1'); printf("%c", x[k]+'1');
if(k<7) printf(" "); if(k<7) printf(" ");
} }
printf("\n"); printf("\n");
} }

View File

@ -14,49 +14,49 @@ int g(int x[][4],int *y[]);
int x[3][4], *y[3]; int x[3][4], *y[3];
main() { main() {
int z[3][4]; int z[3][4];
int i, j, *p; int i, j, *p;
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
x[i][j] = 1000*i + j; x[i][j] = 1000*i + j;
y[i] = x[i]; y[i] = x[i];
} }
f(); f();
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
y[i] = p = &z[i][0]; y[i] = p = &z[i][0];
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
p[j] = x[i][j]; p[j] = x[i][j];
} }
g(z, y); g(z, y);
return 0; return 0;
} }
f() { f() {
int i, j; int i, j;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
printf(" %d", x[i][j]); printf(" %d", x[i][j]);
printf("\n"); printf("\n");
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
printf(" %d", y[i][j]); printf(" %d", y[i][j]);
printf("\n"); printf("\n");
} }
g(x, y) g(x, y)
int x[][4], *y[]; int x[][4], *y[];
{ {
int i, j; int i, j;
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
printf(" %d", x[i][j]); printf(" %d", x[i][j]);
printf("\n"); printf("\n");
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
printf(" %d", y[i][j]); printf(" %d", y[i][j]);
printf("\n"); printf("\n");
} }

View File

@ -9,17 +9,17 @@
typedef signed int TypA[3]; typedef signed int TypA[3];
typedef struct TypB { typedef struct TypB {
TypA Data[2]; TypA Data[2];
} sTypB; } sTypB;
sTypB Bs[10]; sTypB Bs[10];
TypA * APtr; TypA * APtr;
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
Bs[7].Data[1][2]=11; Bs[7].Data[1][2]=11;
APtr=&(Bs[7].Data[1]); APtr=&(Bs[7].Data[1]);
printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] ); printf("Hallo Welt! %i = %i \n",Bs[7].Data[1][2], (*APtr)[2] );
return 0; return 0;
} }
/* /*

View File

@ -17,26 +17,26 @@ typedef RecordType *RecordPtr;
void Proc3(RecordPtr *PtrParOut) void Proc3(RecordPtr *PtrParOut)
{ {
/* whatever */ /* whatever */
} }
void Proc1(RecordPtr PtrParIn) void Proc1(RecordPtr PtrParIn)
{ {
#define NextRecord (*(PtrParIn->PtrComp)) #define NextRecord (*(PtrParIn->PtrComp))
Proc3((RecordPtr *)NextRecord.PtrComp); Proc3((RecordPtr *)NextRecord.PtrComp);
Proc3(&NextRecord.PtrComp); Proc3(&NextRecord.PtrComp);
Proc3(&PtrParIn->PtrComp->PtrComp); Proc3(&PtrParIn->PtrComp->PtrComp);
#ifdef CAST_STRUCT_PTR #ifdef CAST_STRUCT_PTR
Proc3((RecordPtr *) PtrParIn->PtrComp->PtrComp); Proc3((RecordPtr *) PtrParIn->PtrComp->PtrComp);
Proc3((RecordPtr *) (*(PtrParIn->PtrComp)).PtrComp); Proc3((RecordPtr *) (*(PtrParIn->PtrComp)).PtrComp);
Proc3((RecordPtr *) NextRecord.PtrComp); Proc3((RecordPtr *) NextRecord.PtrComp);
#else #else
Proc3(PtrParIn->PtrComp->PtrComp); Proc3(PtrParIn->PtrComp->PtrComp);
Proc3((*(PtrParIn->PtrComp)).PtrComp); Proc3((*(PtrParIn->PtrComp)).PtrComp);
Proc3(NextRecord.PtrComp); Proc3(NextRecord.PtrComp);
#endif #endif
#undef NextRecord #undef NextRecord
} }

View File

@ -17,7 +17,7 @@ with compiler option -O but does _not_ show up with -Oi.
unsigned htons(unsigned val) unsigned htons(unsigned val)
{ {
return (((unsigned) (val)) << 8) | (((unsigned) (val)) >> 8); return (((unsigned) (val)) << 8) | (((unsigned) (val)) >> 8);
} }
int main(void) int main(void)

View File

@ -25,7 +25,7 @@ int foo=0,bar=2;
int main(void) int main(void)
{ {
while(foo<bar) while(foo<bar)
label: ++foo; label: ++foo;
printf("foo: %d bar: %d\n",foo,bar); printf("foo: %d bar: %d\n",foo,bar);

View File

@ -33,9 +33,9 @@ int argc;
char *argv[]; char *argv[];
#endif #endif
{ {
int i, c, nc; int i, c, nc;
#ifndef NO_FLOATS #ifndef NO_FLOATS
float cutoff, atof(); float cutoff, atof();
#else #else
signed cutoff; signed cutoff;
#endif #endif
@ -45,22 +45,22 @@ char *argv[];
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (argc <= 1) if (argc <= 1)
#ifndef NO_FLOATS #ifndef NO_FLOATS
cutoff = 0.0; cutoff = 0.0;
#else #else
cutoff = 0; cutoff = 0;
#endif #endif
else else
#ifndef NO_FLOATS #ifndef NO_FLOATS
cutoff = atof(argv[1])/100; cutoff = atof(argv[1])/100;
#else #else
cutoff = atoi(argv[1])/100; cutoff = atoi(argv[1])/100;
#endif #endif
for (i = 0; i < 0x100; ) for (i = 0; i < 0x100; )
{ {
#ifndef NO_FLOATS #ifndef NO_FLOATS
f[i++] = 0.0; f[i++] = 0.0;
#else #else
f[i++] = 0; f[i++] = 0;
#endif #endif
@ -87,13 +87,13 @@ char *argv[];
printf("a-z char:freq\n\n"); printf("a-z char:freq\n\n");
/* first round ... lowercase characters */ /* 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 #ifndef NO_FLOATS
printf(":%.1f\n", 100*f[i]/nc); printf(":%.1f\n", 100*f[i]/nc);
#else #else
@ -101,19 +101,19 @@ char *argv[];
#endif #endif
f[i]=0; f[i]=0;
} }
} }
} }
printf("A-Z char:freq\n\n"); printf("A-Z char:freq\n\n");
/* second round ... uppercase characters */ /* 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 #ifndef NO_FLOATS
printf(":%.1f\n", 100*f[i]/nc); printf(":%.1f\n", 100*f[i]/nc);
#else #else
@ -121,19 +121,19 @@ char *argv[];
#endif #endif
f[i]=0; f[i]=0;
} }
} }
} }
printf("0-9 char:freq\n\n"); printf("0-9 char:freq\n\n");
/* third round ... numbers */ /* 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 #ifndef NO_FLOATS
printf(":%.1f\n", 100*f[i]/nc); printf(":%.1f\n", 100*f[i]/nc);
#else #else
@ -141,19 +141,19 @@ char *argv[];
#endif #endif
f[i]=0; f[i]=0;
} }
} }
} }
printf("isprint char:freq\n\n"); printf("isprint char:freq\n\n");
/* second last round ... remaining printable characters */ /* 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 #ifndef NO_FLOATS
printf(":%.1f\n", 100*f[i]/nc); printf(":%.1f\n", 100*f[i]/nc);
#else #else
@ -161,30 +161,30 @@ char *argv[];
#endif #endif
f[i]=0; f[i]=0;
} }
} }
} }
printf("rest char:freq\n\n"); printf("rest char:freq\n\n");
/* last round ... remaining non printable characters */ /* 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') if(i=='\n')
{ {
printf("newline"); printf("newline");
} }
else else
{ {
printf("%03o", i); printf("%03o", i);
} }
#ifndef NO_FLOATS #ifndef NO_FLOATS
printf(":%.1f\n", 100*f[i]/nc); printf(":%.1f\n", 100*f[i]/nc);
#else #else
printf(":%d\n", 100*f[i]/nc); printf(":%d\n", 100*f[i]/nc);
#endif #endif
} }
} }
fclose(in); fclose(in);
return 0; return 0;

View File

@ -14,23 +14,23 @@ void backslash(unsigned char c)
switch (c) switch (c)
{ {
case 'b': case 'b':
c = '\b'; c = '\b';
case 'f': case 'f':
c = '\f'; c = '\f';
case 'n': case 'n':
c = '\n'; c = '\n';
case 'r': case 'r':
c = '\r'; c = '\r';
case 't': case 't':
c = '\t'; c = '\t';
case 'v': case 'v':
#ifndef NO_BACKSLASH_V #ifndef NO_BACKSLASH_V
c = '\v'; c = '\v';
#else #else
c = 0x0b; c = 0x0b;
#endif #endif
} }
if(!isprint(c)) if(!isprint(c))
{ {
@ -54,7 +54,7 @@ void testbackslash(void)
int main(void) int main(void)
{ {
testbackslash(); testbackslash();
return 0; return 0;
} }

View File

@ -12,82 +12,82 @@
/* this kind of line-continuation for strings doesnt work properly for cc65 */ /* this kind of line-continuation for strings doesnt work properly for cc65 */
const unsigned char characters[]={ const unsigned char characters[]={
/*0123456789abcdef0123456789abcdef*/ /*0123456789abcdef0123456789abcdef*/
/* iso646-us control-characters */ /* iso646-us control-characters */
" " /* 00-1f */ " " /* 00-1f */
/* iso646-us printable characters */ /* iso646-us printable characters */
" !\"#$%&'()*+,-./" /* 20-2f !"#$%&'()*+,-./ */ " !\"#$%&'()*+,-./" /* 20-2f !"#$%&'()*+,-./ */
"0123456789" /* 30-39 0123456789 */ "0123456789" /* 30-39 0123456789 */
":;<=>?@" /* 3a-40 :;<=>?@ */ ":;<=>?@" /* 3a-40 :;<=>?@ */
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 41-5a A-Z */ "ABCDEFGHIJKLMNOPQRSTUVWXYZ" /* 41-5a A-Z */
"[\\]^_`" /* 5b-60 [\]^_` */ "[\\]^_`" /* 5b-60 [\]^_` */
"abcdefghijklmnopqrstuvwxyz" /* 61-7a a-z */ "abcdefghijklmnopqrstuvwxyz" /* 61-7a a-z */
"{|}~ " /* 7b-7f {|}~ */ "{|}~ " /* 7b-7f {|}~ */
/* iso8859-15 extended characters */ /* iso8859-15 extended characters */
}; };
#endif #endif
const unsigned char characters[]={ const unsigned char characters[]={
/*0123456789abcdef0123456789abcdef*/ /*0123456789abcdef0123456789abcdef*/
/* iso646-us control-characters */ /* iso646-us control-characters */
/* 00-1f */ /* 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,
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 */ /* iso646-us printable characters */
/* 20-2f !"#$%&'()*+,-./ */ /* 20-2f !"#$%&'()*+,-./ */
' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/', ' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
/* 30-39 0123456789 */ /* 30-39 0123456789 */
'0','1','2','3','4','5','6','7','8','9', '0','1','2','3','4','5','6','7','8','9',
/* 3a-40 :;<=>?@ */ /* 3a-40 :;<=>?@ */
':',';','<','=','>','?','@', ':',';','<','=','>','?','@',
/* 41-5a A-Z */ /* 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', '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 [\]^_` */ /* 5b-60 [\]^_` */
'[','\\',']','^','_','`', '[','\\',']','^','_','`',
/* 61-7a a-z */ /* 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', '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 {|}~ */ /* 7b-7f {|}~ */
'{','|','}','~',' ' '{','|','}','~',' '
/* iso8859-15 extended characters */ /* iso8859-15 extended characters */
}; };
void printchars(unsigned char a,unsigned char b){ void printchars(unsigned char a,unsigned char b){
for(b++;a!=b;a++) for(b++;a!=b;a++)
/* printf("%02x ",a); */ /* printf("%02x ",a); */
/* printf("%02x ",characters[a]); */ /* printf("%02x ",characters[a]); */
printf("%c",characters[a]); printf("%c",characters[a]);
printf("\n"); printf("\n");
} }
int main(void) { int main(void) {
printf("characters:\n\n"); printf("characters:\n\n");
printchars(0x61,0x7a); printchars(0x61,0x7a);
printchars(0x41,0x5a); printchars(0x41,0x5a);
printf("numbers:\n\n"); printf("numbers:\n\n");
printchars(0x30,0x39); printchars(0x30,0x39);
printf("other:\n\n"); printf("other:\n\n");
printchars(0x20,0x2f); printchars(0x20,0x2f);
/*printchars(0x3a,0x40);*/ /*printchars(0x3a,0x40);*/
printchars(0x3a,0x3f); printchars(0x3a,0x3f);
/*printchars(0x5b,0x60);*/ /*printchars(0x5b,0x60);*/
/*printchars(0x7b,0x7f);*/ /*printchars(0x7b,0x7f);*/
printf("\n\n"); printf("\n\n");
printf("slash: '%c'\n",'/'); printf("slash: '%c'\n",'/');
printf("backslash: '%c'\n",'\\'); printf("backslash: '%c'\n",'\\');
printf("curly braces open: '%c'\n",'{'); printf("curly braces open: '%c'\n",'{');
printf("curly braces close: '%c'\n",'}'); printf("curly braces close: '%c'\n",'}');
printf("square braces open: '%c'\n",'['); printf("square braces open: '%c'\n",'[');
printf("square braces close: '%c'\n",']'); printf("square braces close: '%c'\n",']');
printf("underscore: '%c'\n",'_'); printf("underscore: '%c'\n",'_');
printf("tilde: '%c'\n",'~'); printf("tilde: '%c'\n",'~');
printf("pipe: '%c'\n",'|'); printf("pipe: '%c'\n",'|');
printf("apostroph: '%c'\n",'\''); printf("apostroph: '%c'\n",'\'');
printf("single quote '%c'\n",'`'); printf("single quote '%c'\n",'`');
printf("xor '%c'\n",'^'); printf("xor '%c'\n",'^');
printf("at '%c'\n",'@'); printf("at '%c'\n",'@');
return 0; return 0;
} }

View File

@ -8,31 +8,31 @@
void printc(signed char a,signed char b){ void printc(signed char a,signed char b){
signed char x=a/b,y=a%b,z=a*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){ void prints(short a,short b){
short x=a/b,y=a%b,z=a*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){ void printl(long a,long b){
long x=a/b,y=a%b,z=a*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) { int main(void) {
printl( 3,-2); printl( 3,-2);
printl(-3,-2); printl(-3,-2);
printl(-3, 2); printl(-3, 2);
printl( 3, 2); printl( 3, 2);
printf("-\n"); printf("-\n");
prints( 3,-2); prints( 3,-2);
prints(-3,-2); prints(-3,-2);
prints(-3, 2); prints(-3, 2);
prints( 3, 2); prints( 3, 2);
printf("-\n"); printf("-\n");
printc( 3,-2); printc( 3,-2);
printc(-3,-2); printc(-3,-2);
printc(-3, 2); printc(-3, 2);
printc( 3, 2); printc( 3, 2);
return 0; return 0;
} }

View File

@ -11,8 +11,8 @@
******************************************************************************* *******************************************************************************
* Bug reports, patches, comments, suggestions should be sent to: * Bug reports, patches, comments, suggestions should be sent to:
* *
* Ben Smith, Rick Grehan or Tom Yager * Ben Smith, Rick Grehan or Tom Yager
* ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com * ben@bytepb.byte.com rick_g@bytepb.byte.com tyager@bytepb.byte.com
* *
******************************************************************************* *******************************************************************************
* Modification Log: * Modification Log:
@ -38,53 +38,53 @@ void mov(unsigned char n,unsigned char f,unsigned char t)
{ {
char o; char o;
if(n == 1) if(n == 1)
{ {
num[f]--; num[f]--;
num[t]++; num[t]++;
} }
else else
{ {
o = (6-(f+t)); o = (6-(f+t));
mov(n-1,f,o); mov(n-1,f,o);
mov(1,f,t); mov(1,f,t);
mov(n-1,o,t); mov(n-1,o,t);
} }
#ifdef VERBOSE #ifdef VERBOSE
printf("%2d: %2d %2d %2d %2d\n", printf("%2d: %2d %2d %2d %2d\n",
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]); (int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
#endif #endif
} }
int main(int argc,char **argv) int main(int argc,char **argv)
{ {
#ifdef USECMDLINE #ifdef USECMDLINE
if (argc < 2) { if (argc < 2) {
printf("Usage: %s [duration] [disks]\n", argv[0]); printf("Usage: %s [duration] [disks]\n", argv[0]);
exit(1); exit(1);
} }
else else
{ {
if(argc > 1) duration = atoi(argv[1]); if(argc > 1) duration = atoi(argv[1]);
if(argc > 2) disk = atoi(argv[2]); if(argc > 2) disk = atoi(argv[2]);
} }
#endif #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 #ifdef VERBOSE
printf("%2d: %2d %2d %2d %2d\n", printf("%2d: %2d %2d %2d %2d\n",
(int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]); (int)iter,(int)num[0],(int)num[1],(int)num[2],(int)num[3]);
#endif #endif
while(num[3]<disk) while(num[3]<disk)
{ {
mov(disk,1,3); mov(disk,1,3);
++iter; ++iter;
} }
return 0; return 0;
} }

View File

@ -13,39 +13,39 @@ int main(void)
} }
memchar() { 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() { 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() { 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() { 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;
} }

View File

@ -26,7 +26,7 @@ h();
/* /*
Word words[] = { Word words[] = {
1, 2, 3,"if", 1, 2, 3,"if",
{ { 4, 5 }, { 'f', 'o', 'r' } }, { { 4, 5 }, { 'f', 'o', 'r' } },
6, 7, 8, {"else"}, 6, 7, 8, {"else"},
{ { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', }, { { 9, 10, 11,}, 'w', 'h', 'i', 'l', 'e', },
{ 0 }, { 0 },
@ -35,7 +35,7 @@ Word words[] = {
Word words[] = { Word words[] = {
{{1, 2, 3},"if"}, {{1, 2, 3},"if"},
{ { 4, 5 }, { 'f', 'o', 'r' } }, { { 4, 5 }, { 'f', 'o', 'r' } },
{{6, 7, 8}, "else"}, {{6, 7, 8}, "else"},
{ { 9, 10, 11}, {'w', 'h', 'i', 'l', 'e', }}, { { 9, 10, 11}, {'w', 'h', 'i', 'l', 'e', }},
{{ 0 }}, {{ 0 }},
@ -47,24 +47,24 @@ int *y[] = { x[0], x[1], x[2], 0 };
main() main()
{ {
int i, j; int i, j;
for (i = 0; y[i]; i++) { for (i = 0; y[i]; i++) {
for (j = 0; y[i][j]; j++) for (j = 0; y[i][j]; j++)
printf(" %d", y[i][j]); printf(" %d", y[i][j]);
printf("\n"); printf("\n");
} }
f(); f();
g(wordlist); g(wordlist);
return 0; return 0;
} }
f() { f() {
static char *keywords[] = {"if", "for", "else", "while", 0, }; static char *keywords[] = {"if", "for", "else", "while", 0, };
char **p; char **p;
for (p = keywords; *p; p++) for (p = keywords; *p; p++)
printf("%s\n", *p); printf("%s\n", *p);
} }
#ifdef NO_OLD_FUNC_DECL #ifdef NO_OLD_FUNC_DECL
@ -74,22 +74,22 @@ g(p)
Word *p; Word *p;
#endif #endif
{ {
int i; int i;
for ( ; p->codes[0]; p++) { for ( ; p->codes[0]; p++) {
for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++) for (i = 0; i < sizeof p->codes/sizeof(p->codes[0]); i++)
printf("%d ", p->codes[i]); printf("%d ", p->codes[i]);
printf("%s\n", p->name); printf("%s\n", p->name);
} }
h(); h();
} }
h() h()
{ {
int i; int i;
for (i = 0; i < sizeof(words)/sizeof(Word); i++) for (i = 0; i < sizeof(words)/sizeof(Word); i++)
printf("%d %d %d %s\n", words[i].codes[0], printf("%d %d %d %s\n", words[i].codes[0],
words[i].codes[1], words[i].codes[2], words[i].codes[1], words[i].codes[2],
&words[i].name[0]); &words[i].name[0]);
} }

View File

@ -14,17 +14,17 @@ unsigned long a=3;
unsigned long _func(unsigned long x,unsigned long y) unsigned long _func(unsigned long x,unsigned long y)
{ {
printf("x:%ld y:%ld\n",x,y); printf("x:%ld y:%ld\n",x,y);
return 0; return 0;
} }
#define func(x,y) _func(x,y) #define func(x,y) _func(x,y)
int main(void) int main(void)
{ {
fs= func( (fd/a) , func(2,0x0082c90f) ); fs= func( (fd/a) , func(2,0x0082c90f) );
printf("fs:%ld\n",fs); printf("fs:%ld\n",fs);
fs=_func( (fd/a) , _func(2,0x0082c90f) ); fs=_func( (fd/a) , _func(2,0x0082c90f) );
printf("fs:%ld\n",fs); printf("fs:%ld\n",fs);
return 0; return 0;
} }

File diff suppressed because it is too large Load Diff

View File

@ -16,15 +16,15 @@ char i1[];
void test1(void) { void test1(void) {
int a; int a;
a=sizeof(i1[0]); a=sizeof(i1[0]);
printf("%04x - ",a); printf("%04x - ",a);
if(sizeof(i1[0])==sizeof(char)) { if(sizeof(i1[0])==sizeof(char)) {
/* gcc gives size of element */ /* gcc gives size of element */
printf("sizeof(i1[0]) gives size of element\n"); printf("sizeof(i1[0]) gives size of element\n");
} }
if(sizeof(i1[0])==sizeof(char*)) { if(sizeof(i1[0])==sizeof(char*)) {
printf("sizeof(i1[0]) gives size of pointer to element\n"); printf("sizeof(i1[0]) gives size of pointer to element\n");
} }
} }
/* /*
@ -40,14 +40,14 @@ char *t4={"abcde"};
void test2(void) { void test2(void) {
char c1,c2,c3,c4; char c1,c2,c3,c4;
int i,e=0; int i,e=0;
for(i=0;i<5;i++){ for(i=0;i<5;i++){
c1=t1[i];c2=t2[i];c3=t3[i];c4=t4[i]; c1=t1[i];c2=t2[i];c3=t3[i];c4=t4[i];
/* printf("%02x %02x %02x %02x\n",c1,c2,c3,c4); */ /* printf("%02x %02x %02x %02x\n",c1,c2,c3,c4); */
printf("%c %c %c %c\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(!((c1==c2)&(c1==c3)&(c1==c4))) e=1;
} }
if(e) printf("test2 failed.\n"); if(e) printf("test2 failed.\n");
else printf("test2 ok.\n"); else printf("test2 ok.\n");
} }
/* /*
@ -74,7 +74,7 @@ A3 a3[] = {
#endif #endif
void test3a(A3 *list, int number){ void test3a(A3 *list, int number){
printf("%s %d\n",list->name,number); printf("%s %d\n",list->name,number);
} }
static void test31(void) static void test31(void)
@ -103,10 +103,10 @@ static void test30(void)
*/ */
int main(void) { int main(void) {
test1(); test1();
test2(); test2();
test30(); test30();
test31(); test31();
/* test32(); */ /* test32(); */
return 0; return 0;
} }

View File

@ -14,62 +14,62 @@ int *xx;
exchange(int *x,int *y) { exchange(int *x,int *y) {
int t; int t;
printf("exchange(%d,%d)\n", x - xx, y - xx); printf("exchange(%d,%d)\n", x - xx, y - xx);
t = *x; *x = *y; *y = t; t = *x; *x = *y; *y = t;
} }
/* partition - partition a[i..j] */ /* partition - partition a[i..j] */
int partition(int a[], int i, int j) { int partition(int a[], int i, int j) {
int v, k; int v, k;
j++; j++;
k = i; k = i;
v = a[k]; v = a[k];
while (i < j) { while (i < j) {
i++; while (a[i] < v) i++; i++; while (a[i] < v) i++;
j--; while (a[j] > v) j--; j--; while (a[j] > v) j--;
if (i < j) exchange(&a[i], &a[j]); if (i < j) exchange(&a[i], &a[j]);
} }
exchange(&a[k], &a[j]); exchange(&a[k], &a[j]);
return j; return j;
} }
/* quick - quicksort a[lb..ub] */ /* quick - quicksort a[lb..ub] */
void quick(int a[], int lb, int ub) { void quick(int a[], int lb, int ub) {
int k; int k;
if (lb >= ub) if (lb >= ub)
return; return;
k = partition(a, lb, ub); k = partition(a, lb, ub);
quick(a, lb, k - 1); quick(a, lb, k - 1);
quick(a, k + 1, ub); quick(a, k + 1, ub);
} }
/* sort - sort a[0..n-1] into increasing order */ /* sort - sort a[0..n-1] into increasing order */
sort(int a[], int n) { sort(int a[], int n) {
quick(xx = a, 0, --n); quick(xx = a, 0, --n);
} }
/* putd - output decimal number */ /* putd - output decimal number */
void putd(int n) { void putd(int n) {
if (n < 0) { if (n < 0) {
putchar('-'); putchar('-');
n = -n; n = -n;
} }
if (n/10) if (n/10)
putd(n/10); putd(n/10);
putchar(n%10 + '0'); putchar(n%10 + '0');
} }
int main(void) { int main(void) {
int i; int i;
sort(in, (sizeof in)/(sizeof in[0])); sort(in, (sizeof in)/(sizeof in[0]));
for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) { for (i = 0; i < (sizeof in)/(sizeof in[0]); i++) {
putd(in[i]); putd(in[i]);
putchar('\n'); putchar('\n');
} }
return 0; return 0;
} }

View File

@ -51,6 +51,6 @@ int j, k, m, n;
#endif #endif
f5(){ f5(){
x=A[k*m]*A[j*m]+B[k*n]*B[j*n]; 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]*B[j*n]-B[k*n]*A[j*m];
} }

View File

@ -10,15 +10,15 @@
#ifndef NO_FUNCS_TAKE_STRUCTS #ifndef NO_FUNCS_TAKE_STRUCTS
struct node struct node
{ {
int a[4]; int a[4];
} x = } x =
{ {
#ifdef NO_SLOPPY_STRUCT_INIT #ifdef NO_SLOPPY_STRUCT_INIT
{ {
#endif #endif
1,2,3,4 1,2,3,4
#ifdef NO_SLOPPY_STRUCT_INIT #ifdef NO_SLOPPY_STRUCT_INIT
} }
#endif #endif
}; };
#endif #endif
@ -27,68 +27,68 @@ print(char *fmt, ...);
main() main()
{ {
print("test 1\n"); print("test 1\n");
print("test %s\n", "2"); print("test %s\n", "2");
print("test %d%c", 3, '\n'); print("test %d%c", 3, '\n');
print("%s%s %w%c", "te", "st", 4, '\n'); print("%s%s %w%c", "te", "st", 4, '\n');
#ifdef NO_FLOATS #ifdef NO_FLOATS
print("%s%s %f%c", "te", "st", (signed long) 5, '\n'); print("%s%s %f%c", "te", "st", (signed long) 5, '\n');
#else #else
print("%s%s %f%c", "te", "st", 5.0, '\n'); print("%s%s %f%c", "te", "st", 5.0, '\n');
#endif #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); print("%b %b %b %b %b %b\n", x, x, x, x, x, x);
#endif #endif
return 0; return 0;
} }
print(char *fmt, ...) { print(char *fmt, ...) {
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
for (; *fmt; fmt++) for (; *fmt; fmt++)
{ {
if (*fmt == '%') if (*fmt == '%')
switch (*++fmt) { switch (*++fmt) {
case 'b': { case 'b': {
#ifdef NO_FUNCS_TAKE_STRUCTS #ifdef NO_FUNCS_TAKE_STRUCTS
printf("(1 2 3 4)"); printf("(1 2 3 4)");
#else #else
struct node x = struct node x =
va_arg( va_arg(
ap, ap,
struct node struct node
); );
printf("(%d %d %d %d)", x.a[0], x.a[1], x.a[2], x.a[3]); printf("(%d %d %d %d)", x.a[0], x.a[1], x.a[2], x.a[3]);
#endif #endif
break; break;
} }
case 'c': case 'c':
/* printf("%c", va_arg(ap, char)); */ /* printf("%c", va_arg(ap, char)); */
printf("%c", va_arg(ap, int)); printf("%c", va_arg(ap, int));
break; break;
case 'd': case 'd':
printf("%d", va_arg(ap, int)); printf("%d", va_arg(ap, int));
break; break;
case 'w': case 'w':
/* printf("%x", va_arg(ap, short)); */ /* printf("%x", va_arg(ap, short)); */
printf("%x", va_arg(ap, int)); printf("%x", va_arg(ap, int));
break; break;
case 's': case 's':
printf("%s", va_arg(ap, char *)); printf("%s", va_arg(ap, char *));
break; break;
case 'f': case 'f':
#ifdef NO_FLOATS #ifdef NO_FLOATS
printf("%ld.000000", va_arg(ap, signed long)); printf("%ld.000000", va_arg(ap, signed long));
#else #else
printf("%f", va_arg(ap, double)); printf("%f", va_arg(ap, double));
#endif #endif
break; break;
default: default:
printf("%c", *fmt); printf("%c", *fmt);
break; break;
} }
else else
printf("%c", *fmt); printf("%c", *fmt);
} }
va_end(ap); va_end(ap);
} }

View File

@ -24,7 +24,7 @@ FILE *outfile=NULL;
#else #else
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <fcntl.h> #include <fcntl.h>
@ -34,18 +34,18 @@ FILE *outfile=NULL;
struct Xdirent struct Xdirent
{ {
char d_name[XNAME_MAX+1]; char d_name[XNAME_MAX+1];
unsigned short d_off; unsigned short d_off;
unsigned short d_reclen; unsigned short d_reclen;
unsigned char d_type; unsigned char d_type;
unsigned char d_namlen; unsigned char d_namlen;
}; };
typedef struct typedef struct
{ {
unsigned char fd; unsigned char fd;
unsigned short off; unsigned short off;
char name[XNAME_MAX+1]; char name[XNAME_MAX+1];
} XDIR; } XDIR;
unsigned char b1[4]; unsigned char b1[4];
@ -61,51 +61,51 @@ static struct Xdirent entry;
unsigned char fd; unsigned char fd;
static unsigned char ch; static unsigned char ch;
entry.d_off=dir->off; entry.d_off=dir->off;
/* basic line-link / file-length */ /* basic line-link / file-length */
memcpy(buffer,b1,4); memcpy(buffer,b1,4);
dir->off=dir->off+4; dir->off=dir->off+4;
entry.d_reclen=254*(buffer[2]+(buffer[3]<<8)); entry.d_reclen=254*(buffer[2]+(buffer[3]<<8));
/* read file entry */ /* read file entry */
memcpy(buffer,b2,0x10); memcpy(buffer,b2,0x10);
dir->off=dir->off+i; dir->off=dir->off+i;
printf("Xreaddir: '%s'\n",buffer); printf("Xreaddir: '%s'\n",buffer);
/* skip until either quote (file) or b (blocks free => end) */ /* skip until either quote (file) or b (blocks free => end) */
i=0;ii=0; i=0;ii=0;
while(i==0){ while(i==0){
temp=buffer[ii];ii++; temp=buffer[ii];ii++;
if(ii>16){ if(ii>16){
/* something went wrong...this shouldnt happen! */ /* something went wrong...this shouldnt happen! */
return(NULL); return(NULL);
} }
else if(temp=='\"') i++; else if(temp=='\"') i++;
else if(temp=='b') { else if(temp=='b') {
/* "blocks free" */ /* "blocks free" */
return(NULL); return(NULL);
} }
} }
printf("Xreaddir: '%s'\n",buffer); printf("Xreaddir: '%s'\n",buffer);
/* process file entry */ /* process file entry */
i=0; temp=buffer[ii];ii++; i=0; temp=buffer[ii];ii++;
while(temp!='\"'){ while(temp!='\"'){
entry.d_name[i]=temp; entry.d_name[i]=temp;
i++; i++;
temp=buffer[ii];ii++; temp=buffer[ii];ii++;
} }
entry.d_name[i]=0; entry.d_name[i]=0;
entry.d_namlen=i; entry.d_namlen=i;
/* set type flag */ /* set type flag */
return(&entry); return(&entry);
} }
int main(void) int main(void)
@ -113,16 +113,16 @@ int main(void)
char mydirname[XNAME_MAX+1]="."; char mydirname[XNAME_MAX+1]=".";
XDIR mydir; XDIR mydir;
struct Xdirent *mydirent; struct Xdirent *mydirent;
printf("start\n"); printf("start\n");
if((mydirent=Xreaddir(&mydir))==NULL) if((mydirent=Xreaddir(&mydir))==NULL)
{ {
printf("NULL\n"); printf("NULL\n");
} }
else else
{ {
printf("=%s\n",mydirent->d_name); printf("=%s\n",mydirent->d_name);
} }
printf("done\n"); printf("done\n");

View File

@ -74,8 +74,8 @@ void makepoint(point *p,int x, int y) {
/* make a rectangle from two points */ /* make a rectangle from two points */
void makerect(rect *d,point p1, point p2) { void makerect(rect *d,point p1, point p2) {
rect r; rect r;
r.pt1 = p1; r.pt1 = p1;
r.pt2 = p2; r.pt2 = p2;
canonrect(d,r); canonrect(d,r);
} }
@ -97,53 +97,53 @@ odd(struct odd y) {
/* add two points */ /* add two points */
point addpoint(point p1, point p2) { point addpoint(point p1, point p2) {
p1.x += p2.x; p1.x += p2.x;
p1.y += p2.y; p1.y += p2.y;
return p1; return p1;
} }
/* canonicalize rectangle coordinates */ /* canonicalize rectangle coordinates */
rect canonrect(rect r) { rect canonrect(rect r) {
rect temp; rect temp;
temp.pt1.x = min(r.pt1.x, r.pt2.x); temp.pt1.x = min(r.pt1.x, r.pt2.x);
temp.pt1.y = min(r.pt1.y, r.pt2.y); temp.pt1.y = min(r.pt1.y, r.pt2.y);
temp.pt2.x = max(r.pt1.x, r.pt2.x); temp.pt2.x = max(r.pt1.x, r.pt2.x);
temp.pt2.y = max(r.pt1.y, r.pt2.y); temp.pt2.y = max(r.pt1.y, r.pt2.y);
return temp; return temp;
} }
/* make a point from x and y components */ /* make a point from x and y components */
point makepoint(int x, int y) { point makepoint(int x, int y) {
point p; point p;
p.x = x; p.x = x;
p.y = y; p.y = y;
return p; return p;
} }
/* make a rectangle from two points */ /* make a rectangle from two points */
rect makerect(point p1, point p2) { rect makerect(point p1, point p2) {
rect r; rect r;
r.pt1 = p1; r.pt1 = p1;
r.pt2 = p2; r.pt2 = p2;
return canonrect(r); return canonrect(r);
} }
struct odd {char a[3]; } y = struct odd {char a[3]; } y =
{ {
#ifdef NO_SLOPPY_STRUCT_INIT #ifdef NO_SLOPPY_STRUCT_INIT
{ {
#endif #endif
'a', 'b', 0 'a', 'b', 0
#ifdef NO_SLOPPY_STRUCT_INIT #ifdef NO_SLOPPY_STRUCT_INIT
} }
#endif #endif
}; };
odd(struct odd y) odd(struct odd y)
{ {
struct odd x struct odd x
= y; = y;
printf("%s\n\r", x.a); printf("%s\n\r", x.a);
} }
@ -157,8 +157,8 @@ int ptinrect(point *p, rect *r) {
} }
#else #else
int ptinrect(point p, rect r) { int ptinrect(point p, rect r) {
return p.x >= r.pt1.x && p.x < r.pt2.x return p.x >= r.pt1.x && p.x < r.pt2.x
&& p.y >= r.pt1.y && p.y < r.pt2.y; && p.y >= r.pt1.y && p.y < r.pt2.y;
} }
#endif #endif
@ -212,9 +212,9 @@ point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 };
#else #else
if (ptinrect(x, screen) == 0) if (ptinrect(x, screen) == 0)
#endif #endif
{ {
printf("not "); printf("not ");
} }
printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y, printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y,
screen.pt2.x, screen.pt2.y); screen.pt2.x, screen.pt2.y);
} }
@ -240,24 +240,24 @@ point pts[] = { -1, -1, 1, 1, 20, 300, 500, 400 };
#endif #endif
rect screen = rect screen =
makerect( makerect(
addpoint(maxpt, makepoint(-10, -10)), addpoint(maxpt, makepoint(-10, -10)),
addpoint(origin, makepoint(10, 10)) addpoint(origin, makepoint(10, 10))
); );
test1(); test1();
for (i = 0; i < sizeof pts/sizeof pts[0]; i++) { for (i = 0; i < sizeof pts/sizeof pts[0]; i++) {
printf("(%d,%d) is ", pts[i].x, printf("(%d,%d) is ", pts[i].x,
(x = makepoint(pts[i].x, pts[i].y)).y); (x = makepoint(pts[i].x, pts[i].y)).y);
if (ptinrect(x, screen) == 0) if (ptinrect(x, screen) == 0)
printf("not "); printf("not ");
printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y, printf("within (%d,%d; %d,%d)\n\r", screen.pt1.x, screen.pt1.y,
screen.pt2.x, screen.pt2.y); screen.pt2.x, screen.pt2.y);
} }
odd(y); odd(y);
return 0; return 0;
} }
#endif /* FUNCS_RETURN_STRUCTS */ #endif /* FUNCS_RETURN_STRUCTS */

View File

@ -18,9 +18,9 @@ limit();
big( big(
# ifdef ASSUME_32BIT_UNSIGNED # ifdef ASSUME_32BIT_UNSIGNED
unsigned unsigned
# else # else
unsigned long unsigned long
# endif # endif
x); x);
@ -28,28 +28,28 @@ x);
main() main()
{ {
testbackslash(); testbackslash();
f(); f();
g(); g();
h(); h();
testbig(); /* ! broken long int compare (?) */ testbig(); /* ! broken long int compare (?) */
limit(); /* ! broken long int compare (?) */ limit(); /* ! broken long int compare (?) */
return 0; return 0;
} }
testbig() testbig()
{ {
#ifdef ASSUME_32BIT_INT #ifdef ASSUME_32BIT_INT
int i; int i;
#else #else
signed long i; signed long i;
#endif #endif
/* 2341234 2341234 2341234 */ /* 2341234 2341234 2341234 */
for (i = 0x1000000; i&0x7000000; i += 0x1000000) { for (i = 0x1000000; i&0x7000000; i += 0x1000000) {
/* printf("i = 0x%lx\n", i); */ /* printf("i = 0x%lx\n", i); */
big(i); big(i);
} }
} }
#ifdef NO_LOCAL_STRING_INIT #ifdef NO_LOCAL_STRING_INIT
@ -69,93 +69,93 @@ testbackslash()
#else #else
for (s = "bfnrtvx"; *s; s++) { for (s = "bfnrtvx"; *s; s++) {
#endif #endif
printf("%c = %c\n", *s, backslash(*s)); printf("%c = %c\n", *s, backslash(*s));
} }
} }
backslash(c) backslash(c)
{ {
switch (c) switch (c)
{ {
case 'b': case 'b':
return 'b'; return 'b';
case 'f': case 'f':
return 'f'; return 'f';
case 'n': case 'n':
return 'n'; return 'n';
case 'r': case 'r':
return 'r'; return 'r';
case 't': case 't':
return 't'; return 't';
case 'v': case 'v':
return 'v'; return 'v';
} }
return 'x'; return 'x';
} }
f() { f() {
int i, x = 0, y; int i, x = 0, y;
printf("f:\n"); printf("f:\n");
for (i = 0; i <= 20; i++) { for (i = 0; i <= 20; i++) {
y = i; y = i;
switch (i) { switch (i) {
case 1: x = i; break; case 1: x = i; break;
case 2: x = i; break; case 2: x = i; break;
case 7: x = i; break; case 7: x = i; break;
case 8: x = i; break; case 8: x = i; break;
case 9: x = i; break; case 9: x = i; break;
case 16: x = i; break; case 16: x = i; break;
case 17: x = i; break; case 17: x = i; break;
case 18: x = i; break; case 18: x = i; break;
case 19: x = i; break; case 19: x = i; break;
case 20: x = i; break; case 20: x = i; break;
} }
printf("x = %d\n", x); printf("x = %d\n", x);
} }
} }
g() { g() {
int i; int i;
printf("g:\n"); printf("g:\n");
for (i = 1; i <= 10; i++) for (i = 1; i <= 10; i++)
switch (i) { switch (i) {
case 1: case 2: printf("1 %d\n", i); break; case 1: case 2: printf("1 %d\n", i); break;
case 3: case 4: case 5: printf("2 %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); case 6: case 7: case 8: printf("3 %d\n", i);
default: default:
printf("d %d\n", i); break; printf("d %d\n", i); break;
case 1001: case 1002: case 1003: case 1004: case 1001: case 1002: case 1003: case 1004:
printf("5 %d\n", i); break; printf("5 %d\n", i); break;
case 3001: case 3002: case 3003: case 3004: case 3001: case 3002: case 3003: case 3004:
printf("6 %d\n", i); break; printf("6 %d\n", i); break;
} }
} }
h() h()
{ {
int i, n=0; int i, n=0;
printf("h:\n"); printf("h:\n");
for (i = 1; i <= 500; i++) for (i = 1; i <= 500; i++)
switch (i) { switch (i) {
default: n++; continue; default: n++; continue;
case 128: printf("i = %d\n", i); break; case 128: printf("i = %d\n", i); break;
case 16: printf("i = %d\n", i); break; case 16: printf("i = %d\n", i); break;
case 8: printf("i = %d\n", i); break; case 8: printf("i = %d\n", i); break;
case 120: printf("i = %d\n", i); break; case 120: printf("i = %d\n", i); break;
case 280: printf("i = %d\n", i); break; case 280: printf("i = %d\n", i); break;
case 264: printf("i = %d\n", i); break; case 264: printf("i = %d\n", i); break;
case 248: printf("i = %d\n", i); break; case 248: printf("i = %d\n", i); break;
case 272: printf("i = %d\n", i); break; case 272: printf("i = %d\n", i); break;
case 304: printf("i = %d\n", i); break; case 304: printf("i = %d\n", i); break;
case 296: printf("i = %d\n", i); break; case 296: printf("i = %d\n", i); break;
case 288: printf("i = %d\n", i); break; case 288: printf("i = %d\n", i); break;
case 312: printf("i = %d\n", i); break; case 312: printf("i = %d\n", i); break;
} }
printf("%d defaults\n", n); printf("%d defaults\n", n);
} }
#ifdef NO_OLD_FUNC_DECL #ifdef NO_OLD_FUNC_DECL
@ -165,9 +165,9 @@ h()
#endif #endif
# ifdef ASSUME_32BIT_UNSIGNED # ifdef ASSUME_32BIT_UNSIGNED
unsigned unsigned
# else # else
unsigned long unsigned long
# endif # endif
#ifdef NO_OLD_FUNC_DECL #ifdef NO_OLD_FUNC_DECL
@ -176,42 +176,42 @@ h()
x; { x; {
#endif #endif
/* printf("x = 0x%x\n", x); */ /* printf("x = 0x%x\n", x); */
switch(x&0x6000000){ switch(x&0x6000000){
case -1: case -1:
case -2: case -2:
case 0x0000000: case 0x0000000:
printf("x = 0x%lx\n", x); break; printf("x = 0x%lx\n", x); break;
case 0x2000000: case 0x2000000:
printf("x = 0x%lx\n", x); break; printf("x = 0x%lx\n", x); break;
case 0x4000000: case 0x4000000:
printf("x = 0x%lx\n", x); break; printf("x = 0x%lx\n", x); break;
default: default:
printf("x = 0x%lx (default)\n", x); break; printf("x = 0x%lx (default)\n", x); break;
} }
} }
limit() { limit() {
int i; int i;
for (i = INT_MIN; i <= INT_MIN+5; i++) for (i = INT_MIN; i <= INT_MIN+5; i++)
/* for (i = INT_MIN; i < INT_MIN+6; i++) */ /* for (i = INT_MIN; i < INT_MIN+6; i++) */
switch (i) { switch (i) {
case INT_MIN: printf("0\n"); break; case INT_MIN: printf("0\n"); break;
case INT_MIN+1: printf("1\n"); break; case INT_MIN+1: printf("1\n"); break;
case INT_MIN+2: printf("2\n"); break; case INT_MIN+2: printf("2\n"); break;
case INT_MIN+3: printf("3\n"); break; case INT_MIN+3: printf("3\n"); break;
case INT_MIN+4: printf("4\n"); break; case INT_MIN+4: printf("4\n"); break;
default: printf("5\n"); break; default: printf("5\n"); break;
} }
for (i = INT_MAX; i >= INT_MAX-5; i--) for (i = INT_MAX; i >= INT_MAX-5; i--)
switch (i) { switch (i) {
case INT_MAX: printf("0\n"); break; case INT_MAX: printf("0\n"); break;
case INT_MAX-1: printf("1\n"); break; case INT_MAX-1: printf("1\n"); break;
case INT_MAX-2: printf("2\n"); break; case INT_MAX-2: printf("2\n"); break;
case INT_MAX-3: printf("3\n"); break; case INT_MAX-3: printf("3\n"); break;
case INT_MAX-4: printf("4\n"); break; case INT_MAX-4: printf("4\n"); break;
default: printf("5\n"); break; default: printf("5\n"); break;
} }
} }

View File

@ -9,31 +9,31 @@
#include <stdio.h> #include <stdio.h>
void testlimits(int i) { void testlimits(int i) {
printf("%d:",i); printf("%d:",i);
switch(i) { switch(i) {
case -1: /* works */ case -1: /* works */
/* case 0xffff: */ /* 'range error' (-1) */ /* case 0xffff: */ /* 'range error' (-1) */
printf("-1\n"); printf("-1\n");
break; break;
/* max int */ /* max int */
/* case 0x7fff: */ /* works */ /* case 0x7fff: */ /* works */
case 32767: /* works */ case 32767: /* works */
/* case 32768: */ /* 'range error' (correct for that one!) */ /* case 32768: */ /* 'range error' (correct for that one!) */
printf("max\n"); printf("max\n");
break; break;
/* min int */ /* min int */
case -32768: /* 'warning. constant is long' */ case -32768: /* 'warning. constant is long' */
/* case 0x8000: */ /* 'range error' */ /* case 0x8000: */ /* 'range error' */
/* case -32769: */ /* 'range error' (correct for that one!) */ /* case -32769: */ /* 'range error' (correct for that one!) */
printf("min\n"); printf("min\n");
break; break;
} }
printf("\n"); printf("\n");
} }
void testdefault1(unsigned char i) { void testdefault1(unsigned char i) {
@ -45,9 +45,9 @@ signed char k;
#else #else
char k; char k;
#endif #endif
#else #else
#ifdef UNSIGNED_CHARS #ifdef UNSIGNED_CHARS
signed char k; signed char k;
#else #else
@ -56,89 +56,89 @@ char k;
#endif #endif
for(;i<254;) { for(;i<254;) {
k = i; k = i;
printf(">%d\n",i);i++; printf(">%d\n",i);i++;
switch(k) { switch(k) {
case 1: case 1:
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
case 4: case 4:
break; break;
case 5: case 5:
break; break;
case 6: case 6:
break; break;
case 7: case 7:
break; break;
case 8: case 8:
break; break;
case 9: case 9:
break; break;
case 10: case 10:
break; break;
case 11: case 11:
break; break;
case 12: case 12:
break; break;
case 13: case 13:
break; break;
case 14: case 14:
break; break;
case 15: case 15:
break; break;
case 17: case 17:
break; break;
/* triggers bug ? */ /* triggers bug ? */
/* gcc warning: case label value exceeds maximum value for type */ /* gcc warning: case label value exceeds maximum value for type */
/* cc65 error: range error */ /* cc65 error: range error */
/* /*
case 170: case 170:
break; break;
*/ */
case 18: case 18:
break; break;
case 19: case 19:
break; break;
case 20: case 20:
break; break;
case 21: case 21:
break; break;
case 22: case 22:
break; break;
case 23: case 23:
break; break;
case 24: case 24:
switch(k) { switch(k) {
case 1: case 1:
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
case 4: case 4:
case 5: case 5:
break; break;
case 6: case 6:
case 7: case 7:
break; break;
case 8: case 8:
case 9: case 9:
break; break;
} }
break; break;
case 100: case 100:
break; break;
default: default:
printf(">>>default\n"); printf(">>>default\n");
/* triggers bug if this break; is missing? */ /* triggers bug if this break; is missing? */
/* break; */ /* break; */
} }
} }
} }
void testdefault2(unsigned char i) { void testdefault2(unsigned char i) {
@ -150,9 +150,9 @@ char k;
#else #else
unsigned char k; unsigned char k;
#endif #endif
#else #else
#ifdef UNSIGNED_CHARS #ifdef UNSIGNED_CHARS
char k; char k;
#else #else
@ -161,102 +161,102 @@ unsigned char k;
#endif #endif
for(;i<254;) { for(;i<254;) {
k = i; k = i;
printf(">%d\n",i);i++; printf(">%d\n",i);i++;
switch(k) { switch(k) {
case 1: case 1:
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
case 4: case 4:
break; break;
case 5: case 5:
break; break;
case 6: case 6:
break; break;
case 7: case 7:
break; break;
case 8: case 8:
break; break;
case 9: case 9:
break; break;
case 10: case 10:
break; break;
case 11: case 11:
break; break;
case 12: case 12:
break; break;
case 13: case 13:
break; break;
case 14: case 14:
break; break;
case 15: case 15:
break; break;
case 17: case 17:
break; break;
/* triggers bug ? */ /* triggers bug ? */
case 170: case 170:
break; break;
case 18: case 18:
break; break;
case 19: case 19:
break; break;
case 20: case 20:
break; break;
case 21: case 21:
break; break;
case 22: case 22:
break; break;
case 23: case 23:
break; break;
case 24: case 24:
switch(k) { switch(k) {
case 1: case 1:
break; break;
case 2: case 2:
break; break;
case 3: case 3:
break; break;
case 4: case 4:
case 5: case 5:
break; break;
case 6: case 6:
case 7: case 7:
break; break;
case 8: case 8:
case 9: case 9:
break; break;
} }
break; break;
case 100: case 100:
break; break;
default: default:
printf(">>>default\n"); printf(">>>default\n");
/* triggers bug if this break; is missing? */ /* triggers bug if this break; is missing? */
/* break; */ /* break; */
} }
} }
} }
int main(void) { int main(void) {
testlimits(32767); testlimits(32767);
testlimits(-32768); testlimits(-32768);
testlimits(-1); testlimits(-1);
testdefault1(1); testdefault1(1);
testdefault1(2); testdefault1(2);
testdefault1(3); testdefault1(3);
testdefault1(4); testdefault1(4);
testdefault2(1); testdefault2(1);
testdefault2(2); testdefault2(2);
testdefault2(3); testdefault2(3);
testdefault2(4); testdefault2(4);
return 0; return 0;
} }

View File

@ -86,7 +86,7 @@ static char string[0x100];
va_start(ap,format); va_start(ap,format);
vsprintf(string,format,ap); 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); va_end(ap);
} }

View File

@ -16,12 +16,12 @@ FILE *in;
struct node struct node
{ {
int count; /* frequency count */ int count; /* frequency count */
struct node *left; /* left subtree */ struct node *left; /* left subtree */
struct node *right; /* right subtree */ struct node *right; /* right subtree */
char *word; /* word itself */ char *word; /* word itself */
} words[MAXWORDS]; } words[MAXWORDS];
int next; /* index of next free entry in words */ int next; /* index of next free entry in words */
/*struct node *lookup();*/ /*struct node *lookup();*/
@ -38,14 +38,14 @@ struct node *lookup(char *word, struct node **p);
int isletter(char c); int isletter(char c);
/* err - print error message s and die */ /* err - print error message s and die */
#ifndef NO_OLD_FUNC_DECL #ifndef NO_OLD_FUNC_DECL
err(s) char *s; { err(s) char *s; {
#else #else
int err(char *s) { int err(char *s) {
#endif #endif
printf("? %s\n", s); printf("? %s\n", s);
exit(1); exit(1);
} }
/* getword - get next input word into buf, return 0 on EOF */ /* getword - get next input word into buf, return 0 on EOF */
@ -55,25 +55,25 @@ int getword(buf) char *buf;
int getword(char *buf) int getword(char *buf)
#endif #endif
{ {
char *s; char *s;
int c; int c;
while (((c = getchar()) != -1) && (isletter(c) == 0)) while (((c = getchar()) != -1) && (isletter(c) == 0))
; ;
for (s = buf; (c = isletter(c)); c = getchar()) for (s = buf; (c = isletter(c)); c = getchar())
*s++ = c; *s++ = c;
*s = 0; *s = 0;
if (s > buf) if (s > buf)
return 1; return 1;
return 0; return 0;
} }
/* isletter - return folded version of c if it is a letter, 0 otherwise */ /* isletter - return folded version of c if it is a letter, 0 otherwise */
int isletter(char c) int isletter(char c)
{ {
if ((c >= 'A') && (c <= 'Z')) c += 'a' - 'A'; if ((c >= 'A') && (c <= 'Z')) c += 'a' - 'A';
if ((c >= 'a') && (c <= 'z')) return c; if ((c >= 'a') && (c <= 'z')) return c;
return 0; return 0;
} }
/* lookup - lookup word in tree; install if necessary */ /* 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) struct node *lookup(char *word, struct node **p)
#endif #endif
{ {
int cond; int cond;
/* char *malloc(); */ /* char *malloc(); */
if (*p) { if (*p) {
cond = strcmp(word, (*p)->word); cond = strcmp(word, (*p)->word);
if (cond < 0) if (cond < 0)
return lookup(word, &(*p)->left); return lookup(word, &(*p)->left);
else if (cond > 0) else if (cond > 0)
return lookup(word, &(*p)->right); return lookup(word, &(*p)->right);
else else
return *p; return *p;
} }
if (next >= MAXWORDS) if (next >= MAXWORDS)
err("out of node storage"); err("out of node storage");
words[next].count = 0; words[next].count = 0;
words[next].left = words[next].right = 0; words[next].left = words[next].right = 0;
words[next].word = malloc(strlen(word) + 1); words[next].word = malloc(strlen(word) + 1);
if (words[next].word == 0) if (words[next].word == 0)
err("out of word storage"); err("out of word storage");
strcpy(words[next].word, word); strcpy(words[next].word, word);
return *p = &words[next++]; return *p = &words[next++];
} }
/* tprint - print tree */ /* tprint - print tree */
@ -113,28 +113,28 @@ void tprint(tree) struct node *tree; {
#else #else
void tprint(struct node *tree) { void tprint(struct node *tree) {
#endif #endif
if (tree) { if (tree) {
tprint(tree->left); tprint(tree->left);
printf("%d:%s\n", tree->count, tree->word); printf("%d:%s\n", tree->count, tree->word);
tprint(tree->right); tprint(tree->right);
} }
} }
int main(void) int main(void)
{ {
struct node *root; struct node *root;
char word[20]; char word[20];
in = fopen("wf1.in","rb"); in = fopen("wf1.in","rb");
if (in == NULL) { if (in == NULL) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }
root = 0; root = 0;
next = 0; next = 0;
while (getword(word)) while (getword(word))
lookup(word, &root)->count++; lookup(word, &root)->count++;
tprint(root); tprint(root);
fclose(in); fclose(in);
return 0; return 0;

File diff suppressed because it is too large Load Diff

View File

@ -10,105 +10,105 @@
# define YYTYPE char # define YYTYPE char
struct yywork struct yywork
{ {
YYTYPE verify, advance; YYTYPE verify, advance;
} yycrank[] = } yycrank[] =
{ {
{0,0}, {0,0}, {1,3}, {0,0}, {0,0}, {0,0}, {1,3}, {0,0},
{0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0}, {0,0},
{0,0}, {0,0}, {1,4}, {1,3}, {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}, {0,0}, {0,0}, {0,0},
{0,0}, {1,5}, {5,7}, {5,7}, {0,0}, {1,5}, {5,7}, {5,7},
{5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {5,7}, {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}, {0,0}, {0,0}, {0,0},
/* 0x40 */ /* 0x40 */
{0,0}, {0,0}, {1,6}, {6,8}, {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}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8},
{6,8}, {0,0}, {0,0}, {0,0}, {6,8}, {0,0}, {0,0}, {0,0},
{0,0}, {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}, {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}, {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}, {0,0}, {0,0},
{0,0}, {0,0}, {6,8}, {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}, {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 */ /* 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}, {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}, {0,0}, {0,0},
#ifdef CHARSETHACK #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 */ /* 0xc0 */
{0,0}, {0,0}, {1,6}, {6,8}, {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}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8}, {6,8},
{6,8}, {0,0}, {0,0}, {0,0}, {6,8}, {0,0}, {0,0}, {0,0},
#endif #endif
{0,0} {0,0}
}; };
struct yywork *yytop = yycrank+255; struct yywork *yytop = yycrank+255;
int yyvstop[] = 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 yysvf
{ {
struct yywork *yystoff; struct yywork *yystoff;
struct yysvf *yyother; struct yysvf *yyother;
int *yystops; int *yystops;
}; };
struct yysvf yysvec[] = struct yysvf yysvec[] =
{ {
{0, 0, 0}, {0, 0, 0},
{yycrank+-1, 0, 0}, {yycrank+-1, 0, 0},
{yycrank+0, yysvec+1, 0}, {yycrank+0, yysvec+1, 0},
{yycrank+0, 0, yyvstop+1}, {yycrank+0, 0, yyvstop+1},
{yycrank+0, 0, yyvstop+3}, {yycrank+0, 0, yyvstop+3},
{yycrank+2, 0, yyvstop+6}, {yycrank+2, 0, yyvstop+6},
{yycrank+19, 0, yyvstop+9}, {yycrank+19, 0, yyvstop+9},
{yycrank+0, yysvec+5, yyvstop+12}, {yycrank+0, yysvec+5, yyvstop+12},
{yycrank+0, yysvec+6, yyvstop+14}, {yycrank+0, yysvec+6, yyvstop+14},
{0, 0, 0} {0, 0, 0}
}; };
#if 0 #if 0
@ -116,7 +116,7 @@ struct yysvf yysvec[] =
// *yylastch++ = yych = input(); // *yylastch++ = yych = input();
void subtest1(void) void subtest1(void)
{ {
*yylastch++ = yych = input(); *yylastch++ = yych = input();
} }
#endif #endif
@ -125,26 +125,26 @@ static int bog=1234;
#if 0 #if 0
void bogus(void) void bogus(void)
{ {
bog*=0x1234; bog*=0x1234;
} }
#else #else
#define bogus() bog+=0x1234 #define bogus() bog+=0x1234
#endif #endif
#if 1 #if 1
// yyt = yyt + yych; // yyt = yyt + yych;
void subtest2(void) void subtest2(void)
{ {
register struct yywork *yyt; register struct yywork *yyt;
int yych; int yych;
yyt=yycrank; yyt=yycrank;
yych=10; yych=10;
bogus(); bogus();
yyt = yyt + yych; yyt = yyt + yych;
printf("yyt: %d %d\n",yyt->verify,yyt->advance); printf("yyt: %d %d\n",yyt->verify,yyt->advance);
} }
#endif #endif
@ -152,21 +152,21 @@ void subtest2(void)
// if(yyt <= yytop && yyt->verify+yysvec == yystate) // if(yyt <= yytop && yyt->verify+yysvec == yystate)
void subtest3(void) void subtest3(void)
{ {
register struct yywork *yyt; register struct yywork *yyt;
register struct yysvf *yystate; register struct yysvf *yystate;
yyt=yycrank; yyt=yycrank;
yystate=yysvec; yystate=yysvec;
bogus(); bogus();
if(yyt <= yytop && yyt->verify+yysvec == yystate) if(yyt <= yytop && yyt->verify+yysvec == yystate)
{ {
printf("if ok %d %d\n",yyt->verify,yyt->advance); printf("if ok %d %d\n",yyt->verify,yyt->advance);
} }
else else
{ {
printf("if not ok %d %d\n",yyt->verify,yyt->advance); printf("if not ok %d %d\n",yyt->verify,yyt->advance);
} }
} }
#endif #endif
@ -179,19 +179,19 @@ short yyr2[]=
// yyps -= yyr2[yyn]; // yyps -= yyr2[yyn];
void subtest4(void) void subtest4(void)
{ {
register short *yyps, yyn; register short *yyps, yyn;
yyps=0x8004; yyps=0x8004;
yyn=0; yyn=0;
while(yyn<14) while(yyn<14)
{ {
bogus(); bogus();
yyps -= yyr2[yyn]; yyps -= yyr2[yyn];
yyn++; yyn++;
} }
printf("yyps: %04x\n",yyps); printf("yyps: %04x\n",yyps);
} }
#if 1 #if 1
@ -199,21 +199,21 @@ void subtest4(void)
int yylookret=10; int yylookret=10;
yylook() yylook()
{ {
yylookret--; yylookret--;
return yylookret; return yylookret;
} }
// while((nstr = yylook()) >= 0) // while((nstr = yylook()) >= 0)
void subtest5(void) void subtest5(void)
{ {
int nstr; int nstr;
bogus(); bogus();
while((nstr = yylook()) >= 0) while((nstr = yylook()) >= 0)
{ {
printf("nstr: %04x\n",nstr); printf("nstr: %04x\n",nstr);
bogus(); bogus();
} }
} }
#endif #endif

View File

@ -288,17 +288,17 @@ void c_minus1(void)
printf("(long0 != -1)\n"); printf("(long0 != -1)\n");
if(long0 != -1) if(long0 != -1)
{ {
failures++; failures++;
} }
printf("(long0 > 0)\n"); printf("(long0 > 0)\n");
if(long0 > 0) if(long0 > 0)
{ {
failures++; failures++;
} }
printf("(long1 < 0)\n"); printf("(long1 < 0)\n");
if(long1 < 0) if(long1 < 0)
{ {
failures++; failures++;
} }
/* /*
if(long1 < 2) if(long1 < 2)

View File

@ -101,9 +101,9 @@ int s22(struct defs *pd0)
#define cq_sections 1 #define cq_sections 1
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s22(pd0); case 0: return s22(pd0);
@ -125,7 +125,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -243,9 +243,9 @@ int s241(struct defs *pd0) {
#define cq_sections 1 #define cq_sections 1
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s241(pd0); case 0: return s241(pd0);
@ -267,7 +267,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -176,21 +176,21 @@ int s243(struct defs *pd0) {
by a more failproof version by a more failproof version
if( if(
'\0' != 0 || '\0' != 0 ||
'\01' != 1 || '\01' != 1 ||
'\02' != 2 || '\02' != 2 ||
'\03' != 3 || '\03' != 3 ||
'\04' != 4 || '\04' != 4 ||
'\05' != 5 || '\05' != 5 ||
'\06' != 6 || '\06' != 6 ||
'\07' != 7 || '\07' != 7 ||
'\10' != 8 || '\10' != 8 ||
'\17' != 15 || '\17' != 15 ||
'\20' != 16 || '\20' != 16 ||
'\77' != 63 || '\77' != 63 ||
'\100' != 64 || '\100' != 64 ||
'\177' != 127 '\177' != 127
) )
*/ */
if( if(
('0' != '\60') || ('0' != '\60') ||
@ -201,7 +201,7 @@ int s243(struct defs *pd0) {
('z' != '\172') ('z' != '\172')
) )
{ {
rc = rc+8; rc = rc+8;
if(pd0->flgd != 0) if(pd0->flgd != 0)
{ {
@ -221,9 +221,9 @@ int s243(struct defs *pd0) {
#define cq_sections 1 #define cq_sections 1
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s243(pd0); case 0: return s243(pd0);
@ -245,7 +245,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -116,9 +116,9 @@ s244(struct defs *pd0) {
#define cq_sections 1 #define cq_sections 1
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s244(pd0); case 0: return s244(pd0);
@ -140,7 +140,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -128,9 +128,9 @@ int s25(struct defs *pd0) {
#define cq_sections 1 #define cq_sections 1
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s25(pd0); case 0: return s25(pd0);
@ -152,7 +152,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -171,9 +171,9 @@ s26(struct defs *pd0) {
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s26(pd0); case 0: return s26(pd0);
@ -197,7 +197,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -317,9 +317,9 @@ setev(){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s26(pd0); case 0: return s26(pd0);
@ -344,7 +344,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -140,9 +140,9 @@ simply discarded. */
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
/*case 0: return s26(pd0);*/ /*case 0: return s26(pd0);*/
@ -167,7 +167,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -291,9 +291,9 @@ int s626(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s26(pd0); case 0: return s26(pd0);
@ -318,7 +318,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -194,9 +194,9 @@ int
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
/*case 0: return s26(pd0);*/ /*case 0: return s26(pd0);*/
@ -221,7 +221,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -1507,175 +1507,175 @@ initial (5,2) | (5,2) | (12,10)
} }
#ifdef NO_FLOATS #ifdef NO_FLOATS
fl = 5; cr = 2; fl = 5; cr = 2;
fl /= cr; fl /= cr;
if(fl != 2){ if(fl != 2){
lrc = 232; lrc = 232;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; sr = 2; fl = 5; sr = 2;
fl /= sr; fl /= sr;
if(fl != 2){ if(fl != 2){
lrc = 233; lrc = 233;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; ir = 2; fl = 5; ir = 2;
fl /= ir; fl /= ir;
if(fl != 2){ if(fl != 2){
lrc = 234; lrc = 234;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; lr = 2; fl = 5; lr = 2;
fl /= lr; fl /= lr;
if(fl != 2){ if(fl != 2){
lrc = 235; lrc = 235;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; ur = 2; fl = 5; ur = 2;
fl /= ur; fl /= ur;
if(fl != 2){ if(fl != 2){
lrc = 236; lrc = 236;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; fr = 2; fl = 5; fr = 2;
fl /= fr; fl /= fr;
if(fl != 2){ if(fl != 2){
lrc = 237; lrc = 237;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; dr = 2; fl = 5; dr = 2;
fl /= dr; fl /= dr;
if(fl != 2){ if(fl != 2){
lrc = 238; lrc = 238;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; cr = 2; dl = 5; cr = 2;
dl /= cr; dl /= cr;
if(dl != 2){ if(dl != 2){
lrc = 239; lrc = 239;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; sr = 2; dl = 5; sr = 2;
dl /= sr; dl /= sr;
if(dl != 2){ if(dl != 2){
lrc = 240; lrc = 240;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; ir = 2; dl = 5; ir = 2;
dl /= ir; dl /= ir;
if(dl != 2){ if(dl != 2){
lrc = 241; lrc = 241;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; lr = 2; dl = 5; lr = 2;
dl /= lr; dl /= lr;
if(dl != 2){ if(dl != 2){
lrc = 242; lrc = 242;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; ur = 2; dl = 5; ur = 2;
dl /= ur; dl /= ur;
if(dl != 2){ if(dl != 2){
lrc = 243; lrc = 243;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; fr = 2; dl = 5; fr = 2;
dl /= fr; dl /= fr;
if(dl != 2){ if(dl != 2){
lrc = 244; lrc = 244;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; dr = 2; dl = 5; dr = 2;
dl /= dr; dl /= dr;
if(dl != 2){ if(dl != 2){
lrc = 245; lrc = 245;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
#else #else
fl = 5; cr = 2; fl = 5; cr = 2;
fl /= cr; fl /= cr;
if(fl != 2.5){ if(fl != 2.5){
lrc = 232; lrc = 232;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; sr = 2; fl = 5; sr = 2;
fl /= sr; fl /= sr;
if(fl != 2.5){ if(fl != 2.5){
lrc = 233; lrc = 233;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; ir = 2; fl = 5; ir = 2;
fl /= ir; fl /= ir;
if(fl != 2.5){ if(fl != 2.5){
lrc = 234; lrc = 234;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; lr = 2; fl = 5; lr = 2;
fl /= lr; fl /= lr;
if(fl != 2.5){ if(fl != 2.5){
lrc = 235; lrc = 235;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; ur = 2; fl = 5; ur = 2;
fl /= ur; fl /= ur;
if(fl != 2.5){ if(fl != 2.5){
lrc = 236; lrc = 236;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; fr = 2; fl = 5; fr = 2;
fl /= fr; fl /= fr;
if(fl != 2.5){ if(fl != 2.5){
lrc = 237; lrc = 237;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
fl = 5; dr = 2; fl = 5; dr = 2;
fl /= dr; fl /= dr;
if(fl != 2.5){ if(fl != 2.5){
lrc = 238; lrc = 238;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; cr = 2; dl = 5; cr = 2;
dl /= cr; dl /= cr;
if(dl != 2.5){ if(dl != 2.5){
lrc = 239; lrc = 239;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; sr = 2; dl = 5; sr = 2;
dl /= sr; dl /= sr;
if(dl != 2.5){ if(dl != 2.5){
lrc = 240; lrc = 240;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; ir = 2; dl = 5; ir = 2;
dl /= ir; dl /= ir;
if(dl != 2.5){ if(dl != 2.5){
lrc = 241; lrc = 241;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; lr = 2; dl = 5; lr = 2;
dl /= lr; dl /= lr;
if(dl != 2.5){ if(dl != 2.5){
lrc = 242; lrc = 242;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; ur = 2; dl = 5; ur = 2;
dl /= ur; dl /= ur;
if(dl != 2.5){ if(dl != 2.5){
lrc = 243; lrc = 243;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; fr = 2; dl = 5; fr = 2;
dl /= fr; dl /= fr;
if(dl != 2.5){ if(dl != 2.5){
lrc = 244; lrc = 244;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
dl = 5; dr = 2; dl = 5; dr = 2;
dl /= dr; dl /= dr;
if(dl != 2.5){ if(dl != 2.5){
lrc = 245; lrc = 245;
if(prlc) printf(f,lrc); if(prlc) printf(f,lrc);
} }
#endif #endif
cl = 5; cr = 2; cl = 5; cr = 2;
cl %= cr; cl %= cr;
@ -1750,9 +1750,9 @@ initial (5,2) | (5,2) | (12,10)
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s714(pd0); case 0: return s714(pd0);
@ -1776,7 +1776,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -971,9 +971,9 @@ initial (5,2) | (5,2) | (12,10)
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s714(pd0); case 0: return s714(pd0);
@ -997,7 +997,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -105,9 +105,9 @@ int x, y, z;
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
/*case 0: return s26(pd0);*/ /*case 0: return s26(pd0);*/
@ -132,7 +132,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -299,9 +299,9 @@ int s72(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s26(pd0); case 0: return s26(pd0);
@ -326,7 +326,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -289,9 +289,9 @@ int s757(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s26(pd0); case 0: return s26(pd0);

View File

@ -336,9 +336,9 @@ int s7813(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s7813(pd0); case 0: return s7813(pd0);
@ -362,7 +362,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -682,9 +682,9 @@ test is unreliable. */
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s81(pd0); case 0: return s81(pd0);
@ -708,7 +708,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -101,13 +101,13 @@ int s84(struct defs *pd0){
if(pd0->flgd != 0) printf(s84er,2); if(pd0->flgd != 0) printf(s84er,2);
rc = rc+2; rc = rc+2;
} }
#else #else
pfi = glork; pfi = glork;
if((*pfi)(4) != 4){ if((*pfi)(4) != 4){
if(pd0->flgd != 0) printf(s84er,2); if(pd0->flgd != 0) printf(s84er,2);
rc = rc+2; rc = rc+2;
} }
#endif #endif
/* Float fa[17] declares an array of floating point /* Float fa[17] declares an array of floating point
numbers, and *afp[17] declares an array of pointers numbers, and *afp[17] declares an array of pointers
@ -223,9 +223,9 @@ return x;}
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s84(pd0); case 0: return s84(pd0);
@ -249,7 +249,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -118,10 +118,10 @@ int s85(struct defs *pd0){
#ifdef NO_FLOATS #ifdef NO_FLOATS
"signed", "signed",
"signed", "signed",
#else #else
"float", "float",
"double" "double"
#endif #endif
}; };
static char aln[] = " alignment: "; static char aln[] = " alignment: ";
@ -205,12 +205,12 @@ int s85(struct defs *pd0){
if(pd0->flgm != 0) printf("Sign extension in fields\n"); if(pd0->flgm != 0) printf("Sign extension in fields\n");
} }
else{ else{
#ifdef NO_BITFIELDS #ifdef NO_BITFIELDS
if(pd0->flgd != 0) printf("NO_BITFIELDS\n"); if(pd0->flgd != 0) printf("NO_BITFIELDS\n");
#else #else
if(pd0->flgd != 0) printf(s85er,2); if(pd0->flgd != 0) printf(s85er,2);
rc = rc+2; rc = rc+2;
#endif #endif
} }
} }
@ -268,9 +268,9 @@ int one();
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s85(pd0); case 0: return s85(pd0);
@ -294,7 +294,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -183,9 +183,9 @@ int *metricp;
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s86(pd0); case 0: return s86(pd0);
@ -209,7 +209,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -139,9 +139,9 @@ int s88(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s88(pd0); case 0: return s88(pd0);
@ -165,7 +165,7 @@ int main(int n,char **args) {
int j; int j;
static struct defs d0, *pd0; static struct defs d0, *pd0;
d0.flgs = 1; /* These flags dictate */ d0.flgs = 1; /* These flags dictate */
d0.flgm = 1; /* the verbosity of */ d0.flgm = 1; /* the verbosity of */
d0.flgd = 1; /* the program. */ d0.flgd = 1; /* the program. */

View File

@ -109,9 +109,9 @@ int s9(struct defs *pd0){
*********************************************************************************************/ *********************************************************************************************/
#ifndef NO_TYPELESS_STRUCT_PTR #ifndef NO_TYPELESS_STRUCT_PTR
int section(int j,struct* pd0){ int section(int j,struct* pd0){
#else #else
int section(int j,void* pd0){ int section(int j,void* pd0){
#endif #endif
switch(j){ switch(j){
case 0: return s9(pd0); case 0: return s9(pd0);

View File

@ -660,10 +660,10 @@ static unsigned char buf[18830];
int main() { int main() {
unsigned long cksum = adler32(0, NULL, 0); unsigned long cksum = adler32(0, NULL, 0);
decompress_lz4(compressed, buf, 18830); decompress_lz4(compressed, buf, 18830);
cksum = adler32(cksum, buf, 18830); cksum = adler32(cksum, buf, 18830);
return cksum == 0xf748269d ? 0 : 1; return cksum == 0xf748269d ? 0 : 1;
} }

View File

@ -21,10 +21,10 @@ unsigned char uchar1 = 0;
void dput(unsigned char val) void dput(unsigned char val)
{ {
/*PORTB = val; /*PORTB = val;
PORTA = 0x01; PORTA = 0x01;
PORTA = 0x00; PORTA = 0x00;
*/ */
} }
void done() void done()
@ -35,104 +35,104 @@ void done()
/* both loops use the loop variable inside the inner loop */ /* both loops use the loop variable inside the inner loop */
void for1(void) void for1(void)
{ {
unsigned char i, j; unsigned char i, j;
uchar0 = 0; uchar0 = 0;
uchar1 = 0; uchar1 = 0;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
uchar0++; uchar0++;
for(j = 0; j < 4; j++) { for(j = 0; j < 4; j++) {
uchar1++; uchar1++;
dput(i); dput(i);
dput(j); dput(j);
} }
} }
if(uchar0 != 3) if(uchar0 != 3)
failures++; failures++;
if(uchar1 != 12) if(uchar1 != 12)
failures++; failures++;
} }
/* only the outer loop's variable is used inside, inner can be optimized into a repeat-loop */ /* only the outer loop's variable is used inside, inner can be optimized into a repeat-loop */
void for2(void) void for2(void)
{ {
unsigned char i, j; unsigned char i, j;
uchar0 = 0; uchar0 = 0;
uchar1 = 0; uchar1 = 0;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
uchar0++; uchar0++;
for(j = 0; j < 4; j++) { for(j = 0; j < 4; j++) {
uchar1++; uchar1++;
dput(i); dput(i);
} }
} }
if(uchar0 != 3) if(uchar0 != 3)
failures++; failures++;
if(uchar1 != 12) if(uchar1 != 12)
failures++; failures++;
} }
/* only the inner loop's variable is used inside */ /* only the inner loop's variable is used inside */
void for3(void) void for3(void)
{ {
unsigned char i, j; unsigned char i, j;
uchar0 = 0; uchar0 = 0;
uchar1 = 0; uchar1 = 0;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
uchar0++; uchar0++;
for(j = 0; j < 4; j++) { for(j = 0; j < 4; j++) {
uchar1++; uchar1++;
dput(j); dput(j);
} }
} }
if(uchar0 != 3) if(uchar0 != 3)
failures++; failures++;
if(uchar1 != 12) if(uchar1 != 12)
failures++; failures++;
} }
/* neither loop variable used inside the loops */ /* neither loop variable used inside the loops */
void for4(void) void for4(void)
{ {
unsigned char i, j; unsigned char i, j;
uchar0 = 0; uchar0 = 0;
uchar1 = 0; uchar1 = 0;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
uchar0++; uchar0++;
for(j = 0; j < 4; j++) { for(j = 0; j < 4; j++) {
uchar1++; uchar1++;
dput(uchar0); dput(uchar0);
dput(uchar1); dput(uchar1);
} }
} }
if(uchar0 != 3) if(uchar0 != 3)
failures++; failures++;
if(uchar1 != 12) if(uchar1 != 12)
failures++; failures++;
} }
/* like for1 but different condition in inner loop */ /* like for1 but different condition in inner loop */
void for5(void) void for5(void)
{ {
unsigned char i, j; unsigned char i, j;
uchar0 = 0; uchar0 = 0;
uchar1 = 0; uchar1 = 0;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
uchar0++; uchar0++;
for(j = 10; j >= 5; j--) { for(j = 10; j >= 5; j--) {
uchar1++; uchar1++;
dput(i); dput(i);
dput(j); dput(j);
} }
} }
if(uchar0 != 3) if(uchar0 != 3)
failures++; failures++;
if(uchar1 != 18) if(uchar1 != 18)
failures++; failures++;
} }
int main(void) int main(void)

View File

@ -10,14 +10,14 @@ static unsigned char val, array[2];
int main() { int main() {
val = 0; val = 0;
array[0] = array[1] = 10; array[0] = array[1] = 10;
array[val++] = 2; array[val++] = 2;
array[val++] = 2; array[val++] = 2;
--val; --val;
array[val--] = 0; array[val--] = 0;
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;
} }

View File

@ -50,33 +50,33 @@ void done()
void call0(void) void call0(void)
{ {
uchar0++; uchar0++;
} }
void call1(void) void call1(void)
{ {
uchar1++; uchar1++;
} }
unsigned char call2(void) unsigned char call2(void)
{ {
return uchar0 + 9; return uchar0 + 9;
} }
void docall0(void) void docall0(void)
{ {
pfunc = call0; pfunc = call0;
(pfunc)(); (pfunc)();
if(uchar0 != 1) if(uchar0 != 1)
failures++; failures++;
} }
void docall1() void docall1()
{ {
unsigned char i; unsigned char i;
for(i = 0; i < 3; i++) { for(i = 0; i < 3; i++) {
(*p1func)(); (*p1func)();
} }
} }
#ifdef NO_IMPLICIT_FUNCPTR_CONV #ifdef NO_IMPLICIT_FUNCPTR_CONV
@ -85,53 +85,53 @@ void docall2( void(*pf)(void) )
void docall2( void(*pf)() ) void docall2( void(*pf)() )
#endif #endif
{ {
unsigned char i; unsigned char i;
for(i = 0; i < 2; i++) { for(i = 0; i < 2; i++) {
pf(); pf();
} }
} }
int main(void) int main(void)
{ {
docall0(); docall0();
p1func = call1; p1func = call1;
docall1(); docall1();
if(uchar1 != 3) if(uchar1 != 3)
failures++; failures++;
if(uchar0 != 1) if(uchar0 != 1)
failures++; failures++;
p1func = call0; p1func = call0;
docall1(); docall1();
if(uchar1 != 3) if(uchar1 != 3)
failures++; failures++;
if(uchar0 != 4) if(uchar0 != 4)
failures++; failures++;
docall2(call0); docall2(call0);
if(uchar1 != 3) if(uchar1 != 3)
failures++; failures++;
if(uchar0 != 6) if(uchar0 != 6)
failures++; failures++;
docall2(call1); docall2(call1);
if(uchar1 != 5) if(uchar1 != 5)
failures++; failures++;
if(uchar0 != 6) if(uchar0 != 6)
failures++; failures++;
pcfunc = call2; pcfunc = call2;
uchar2 = (*pcfunc)(); uchar2 = (*pcfunc)();
if(uchar2 != 15) if(uchar2 != 15)
failures++; failures++;
uchar2 += (pcfunc)(); uchar2 += (pcfunc)();
uchar2 += pcfunc(); uchar2 += pcfunc();
success = failures; success = failures;
done(); done();
printf("failures: %d\n",failures); printf("failures: %d\n",failures);
return failures; return failures;
} }

View File

@ -10,9 +10,9 @@
static unsigned char flag; static unsigned char flag;
static void trampoline_set() { static void trampoline_set() {
asm("ldy tmp4"); asm("ldy tmp4");
asm("sty %v", flag); asm("sty %v", flag);
asm("jsr callptr4"); asm("jsr callptr4");
} }
#pragma wrapped-call(push, trampoline_set, 4) #pragma wrapped-call(push, trampoline_set, 4)
@ -21,12 +21,12 @@ long adder(long in);
long adder(long in) { long adder(long in) {
return in + 7; return in + 7;
} }
int main() { int main() {
flag = 0; flag = 0;
return adder(70436) == 70436 + 7 && flag == 4 ? 0 : 1; return adder(70436) == 70436 + 7 && flag == 4 ? 0 : 1;
} }

View File

@ -10,14 +10,14 @@
static unsigned char flag; static unsigned char flag;
static void trampoline_set() { static void trampoline_set() {
// The Y register is used for variadics - save and restore // The Y register is used for variadics - save and restore
asm("sty tmp3"); asm("sty tmp3");
asm("ldy tmp4"); asm("ldy tmp4");
asm("sty %v", flag); asm("sty %v", flag);
asm("ldy tmp3"); asm("ldy tmp3");
asm("jsr callptr4"); asm("jsr callptr4");
} }
#pragma wrapped-call(push, trampoline_set, 4) #pragma wrapped-call(push, trampoline_set, 4)
@ -26,23 +26,23 @@ unsigned adder(unsigned char num, ...);
unsigned adder(unsigned char num, ...) { unsigned adder(unsigned char num, ...) {
unsigned char i; unsigned char i;
unsigned sum = 0; unsigned sum = 0;
va_list ap; va_list ap;
va_start(ap, num); va_start(ap, num);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
sum += va_arg(ap, unsigned); sum += va_arg(ap, unsigned);
} }
va_end(ap); va_end(ap);
return sum; return sum;
} }
int main() { 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;
} }

View File

@ -8,14 +8,14 @@
static unsigned char flag; static unsigned char flag;
static void trampoline_set() { static void trampoline_set() {
asm("ldy tmp4"); asm("ldy tmp4");
asm("sty %v", flag); asm("sty %v", flag);
asm("jsr callptr4"); asm("jsr callptr4");
} }
void trampoline_inc() { void trampoline_inc() {
asm("inc %v", flag); asm("inc %v", flag);
asm("jsr callptr4"); asm("jsr callptr4");
} }
void func3() { void func3() {
@ -25,7 +25,7 @@ void func3() {
#pragma wrapped-call(push, trampoline_inc, 0) #pragma wrapped-call(push, trampoline_inc, 0)
void func2() { void func2() {
func3(); func3();
} }
#pragma wrapped-call(push, trampoline_set, 4) #pragma wrapped-call(push, trampoline_set, 4)
@ -36,14 +36,14 @@ void func1(void);
#pragma wrapped-call(pop) #pragma wrapped-call(pop)
void func1() { void func1() {
func2(); func2();
} }
int main(void) int main(void)
{ {
flag = 0; flag = 0;
func1(); func1();
return flag == 5 ? 0 : 1; return flag == 5 ? 0 : 1;
} }