fzn7 / redtamarin

Automatically exported from code.google.com/p/redtamarin
Other
0 stars 0 forks source link

implement C.errno #58

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
errno.h

Original issue reported on code.google.com by zwetan on 25 Nov 2013 at 4:36

GoogleCodeExporter commented 9 years ago
fully implemented

added some non-standard stuff

errno being a very special macro in C, we used some tricks of our own in AS3.

In the AS3 side, errno is a constant of the type ErrorNumber.

This class ErrorNumber reuse 2 function calls GetErrno() and SetErrno as getter 
/ setter to read and write to errno on the C context.

The valueOf() return the integer value of errno, but the toString() return the 
string from strerror().

It is usable and works well but the usage is a slightly bit different than in C.

Another bit of headache were the error constants that can be quite different 
between Windows and OS X / Linux, and extremely different when it comes to 
sockets.

So far we opted to hardcode the constant with the Linux values and later will 
provide "conversion functions": from WIN32 to Linux and vise versa.

Original comment by zwetan on 17 Jan 2014 at 8:32

GoogleCodeExporter commented 9 years ago

Original comment by zwetan on 17 Jan 2014 at 8:32