import end # Mark this module is a top level one. (must be only one)
+in "C" `{
+ #include <stdlib.h>
+ #include <errno.h>
+`}
+
###############################################################################
# System Classes #
###############################################################################
fun run do main
# Number of the last error
- fun errno: Int is extern "sys_errno"
+ fun errno: Int `{ return errno; `}
end
# Quit the program with a specific return code
# Pointer classes are used to manipulate extern C structures.
extern class Pointer
# Is the address behind this Object at NULL?
- fun address_is_null: Bool is extern "address_is_null"
+ fun address_is_null: Bool `{ return self == NULL; `}
# Free the memory pointed by this pointer
- fun free is extern "free"
+ fun free `{ free(self); `}
end
+++ /dev/null
-#ifndef __KERNEL_NIT_H
-#define __KERNEL_NIT_H
-/* This file is part of NIT ( http://www.nitlanguage.org ).
- *
- * This file is free software, which comes along with NIT. This software is
- * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
- * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. You can modify it is you want, provided this header
- * is kept unaltered, and a notification of the changes is added.
- * You are allowed to redistribute it and sell it, alone or is a part of
- * another product.
- */
-
-#include <stdlib.h>
-#include <errno.h>
-
-#define address_is_null(x) ((x)==NULL)
-#define sys_errno(x) (errno)
-
-#endif