
NSNumber :: struct {
   // #as using isa: NSObject;
}

#scope_file;

Sel :: uptr;

sel: struct {
   boolValue:        Sel; @boolValue
   intValue:         Sel; @intValue
   unsignedIntValue: Sel; @unsignedIntValue
   floatValue:       Sel; @floatValue
   doubleValue:      Sel; @doubleValue
}

#add_context InitFoundation :: () {
   #import "Basic";

   tmp: [512]u8;

   base := (*sel).(*u8);
   info := type_info(type_of(sel));
   for info.members if it.notes.count != 0 {
      name := it.notes[0];
      memcpy(tmp.data, name.data, name.count);
      tmp.data[name.count] = 0;

      ptr := base + it.offset_in_bytes;
      ptr.* = sel_register_name(tmp.data);
      assert(ptr.* != 0, "failed to register selector: %", name);
   }

   print("%\n", info.*);
}

Foundation :: #library,system,no_dll,link_always "Foundation";
