public static void set_quit() { int i; for (i = 0; i < MyArray.array_len(sets); i++) { set_free((Set)MyArray.array_get(sets, i)); } MyArray.array_free(sets); sets = null; }
public static int set_init() { IntPtr fin; string name = null; MyArray items; int i; if (Set.sets != null) { Set.set_quit(); } Set.sets = MyArray.array_new(); Set.curr = 0; /* * First, load the sets listed in the set file, preserving order. */ if ((fin = FileSystem.fs_open(Set.SET_FILE)) != IntPtr.Zero) { while (FileSystem.read_line(ref name, fin) != 0) { Set s = (Set)MyArray.array_add(Set.sets, new Set()); if (Set.set_load(s, name) == 0) { MyArray.array_del(Set.sets); } name = null; } FileSystem.fs_close(fin); } return(MyArray.array_len(Set.sets)); }
public static int set_exists(int i) { return((0 <= i && i < MyArray.array_len(sets)) ? 1 : 0); }