tests: add some runtime error in nitin.input
[nit.git] / lib / core / kernel.nit
index fe45072..88dcc8a 100644 (file)
@@ -1056,11 +1056,21 @@ end
 
 # Pointer classes are used to manipulate extern C structures.
 extern class Pointer
+       # C `NULL` pointer
+       new nul `{ return NULL; `}
+
        # Is the address behind this Object at NULL?
        fun address_is_null: Bool `{ return self == NULL; `}
 
        # Free the memory pointed by this pointer
        fun free `{ free(self); `}
+
+       # Use the address value
+       redef fun hash `{ return (long)(intptr_t)self; `}
+
+       # Is equal to any instance pointing to the same address
+       redef fun ==(o) do return o isa Pointer and native_equals(o)
+       private fun native_equals(o: Pointer): Bool `{ return self == o; `}
 end
 
 # Task with a `main` method to be implemented by subclasses
@@ -1073,3 +1083,12 @@ interface Task
        # Main method of this task
        fun main do end
 end
+
+# Is this program currently running in a Windows OS?
+fun is_windows: Bool `{
+#ifdef _WIN32
+       return 1;
+#else
+       return 0;
+#endif
+`}