Warning: session_start(): open(/var/lib/php/sessions/sess_4k15sg011kj558861jhcvo03k9, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
ifndef SymbolAsString
sclass symbol_Tester { // compares by text (case-sensitive)
Symbol symbol;
*() {}
*(Symbol *symbol) {}
public int hashCode() { ret symbol.text.hashCode(); }
public bool equals(O o) {
if (!o instanceof symbol_Tester) false;
ret eq(symbol.text, o/symbol_Tester.symbol.text);
}
}
sclass symbol_MasterTester { // compares by text (case-insensitive)
MasterSymbol symbol;
*() {}
*(Symbol *Mastersymbol) {}
public int hashCode() { ret symbol.lowerCase.hashCode(); }
public bool equals(O o) {
if (!o instanceof symbol_MasterTester) false;
ret eq(symbol.lowerCase, o/symbol_MasterTester.symbol.lowerCase);
}
}
static WeakHashMap symbol_map = unsyncedWeakHashMap();
static WeakHashMap masterSymbol_map = unsyncedWeakHashMap();
endifndef
static Symbol symbol(S s) {
ifdef SymbolAsString
ret s;
endifdef
ifndef SymbolAsString
if (s == null) null;
synchronized(symbol_map) {
// This is a trick that works because of how WeakHashMap compares keys.
symbol_MasterTester masterTester = symbol_MasterTester(new MasterSymbol(s, true));
O e = call(masterSymbol_map, 'getEntry, masterTester);
MasterSymbol existingMaster = e == null ? null : ((WeakReference) e).get();
if (existingMaster == null)
masterSymbol_map.put(existingMaster = masterTester.master, true);
ifdef symbol_debug
print("existing master for " + s + ": " + existingMaster);
endifdef
// second lookup
Symbol symbol = eq(s, existingMaster.text) ? existingMaster : new Symbol(s, existingMaster);
symbol_Tester tester = symbol_Tester(symbol);
e = call(symbol_map, 'getEntry, tester);
symbol_Tester sym = e == null ? null : ((WeakReference) e).get();
if (sym == null)
symbol_map.put(sym = tester, true);
ret sym.symbol;
}
endifndef
}
static Symbol symbol(CharSequence s) {
if (s == null) null;
ifdef SymbolAsString
ret str(s);
endifdef
ifndef SymbolAsString
if (s instanceof Symbol) ret (Symbol) s;
if (s instanceof S) ret symbol((S) s);
ret symbol(str(s));
endifndef
}