[Coco] More optimizations for the CMOC compiler

Pierre Sarrazin sarrazip at sarrazip.com
Sun Aug 9 14:25:00 EDT 2015


Hi Kip,

Dixit Kip Koon (2015-08-09 00:34):
> Hi Pierre,
> I just tried to compile CMOC and received the following messages.
> 
> main.cc: In function ‘Byte getcharifavail()’:
> main.cc:91:57: error: ‘select’ was not declared in this scope
>   if (select(STDIN_FILENO + 1, &readset, NULL, NULL, NULL) <= 0)
> 
> What am I doing wrong?  I'm running Cygwin x64.

An #include statement is missing to declare select() on a Cygwin
system.  At the top of src/usim-0.91-cmoc/main.cc, you could try
changing this:

#if defined(__unix) || (defined(__APPLE__) && defined(TARGET_OS_MAC))
#include <unistd.h>
#endif

to just #include <unistd.h>. If that doesn't work, try adding 
#include <sys/select.h>.

If that still does not compile, replace the contents of getcharifavail()
with "return 0;", as a workaround, because you don't need USim
anyway: it's just there to run CMOC's self-tests.

> If there are any specific tests you would like me to do as you
> further develop your C Cross-Computer, just let me know.  I would
> like be a tester for CMOC.

For starters, you can help me support Cygwin. That will be useful to
those who are not in a position to run CMOC under GNU/Linux. (Please
tell me which alternative above worked for you: I'll integrate it
in the next version.)

Aside from that, just have fun writing C programs for the CoCo,
and report any bugs or usability issues to me, and I'll be glad to
check them out.

My hope is that CMOC will help more people publish practical
programs for the CoCo, like games, utilities, etc. That will be
the true measure of CMOC's usefulness.

> You may have to "hold my hand" as I learn the language so I can do
> the tests like you wish though.  Thanks for writing this compiler.
> I'm sure I will enjoy using it once I get over the learning curve.
> :)  Take care my friend.

You're welcome!

By the way, I've already published CMOC 0.1.12, after receiving bug
reports from a user:

    http://sarrazip.com/dev/cmoc.html

-- 
Pierre Sarrazin <sarrazip @ sarrazip . com>


More information about the Coco mailing list