static void keep_children(YogEnv* env, void* ptr, ObjectKeeper keeper, void* heap) { YogBasicObj_keep_children(env, ptr, keeper, heap); YogProperty* prop = PTR_AS(YogProperty, ptr); #define KEEP(member) YogGC_KEEP(env, prop, member, keeper, heap) KEEP(getter); KEEP(setter); #undef KEEP }
static void YogMatch_keep_children(YogEnv* env, void* ptr, ObjectKeeper keeper, void* heap) { YogBasicObj_keep_children(env, ptr, keeper, heap); YogMatch* match = PTR_AS(YogMatch, ptr); #define KEEP(member) YogGC_KEEP(env, match, member, keeper, heap) KEEP(str); KEEP(regexp); #undef KEEP }
static void usage(void) { #define KEEP(s) s "\n" static const char msg[] = { KEEP("") KEEP("Options:") KEEP(" -T TERM use this instead of $TERM") KEEP(" -V print curses-version") KEEP(" -x do not try to clear scrollback") }; #undef KEEP (void) fprintf(stderr, "Usage: %s [options]\n", _nc_progname); fputs(msg, stderr); ExitProgram(EXIT_FAILURE); }
static void Package_keep_children(YogEnv* env, void* ptr, ObjectKeeper keeper, void* heap) { YogPackage_keep_children(env, ptr, keeper, heap); Package* pkg = (Package*)ptr; #define KEEP(member) YogGC_KEEP(env, pkg, member, keeper, heap) KEEP(eZipError); #undef KEEP }
static void ModuleClass_keep_children(YogEnv* env, void* ptr, ObjectKeeper keeper, void* heap) { YogObj_keep_children(env, ptr, keeper, heap); ModuleClass* klass = PTR_AS(ModuleClass, ptr); #define KEEP(member) YogGC_KEEP(env, klass, member, keeper, heap) KEEP(super); #undef KEEP }
static void usage(void) { #define SKIP(s) /* nothing */ #define KEEP(s) s "\n" static const char msg[] = { KEEP("") KEEP("Options:") SKIP(" -a arpanet (obsolete)") KEEP(" -c set control characters") SKIP(" -d dialup (obsolete)") KEEP(" -e ch erase character") KEEP(" -I no initialization strings") KEEP(" -i ch interrupt character") KEEP(" -k ch kill character") KEEP(" -m mapping map identifier to type") SKIP(" -p plugboard (obsolete)") KEEP(" -Q do not output control key settings") KEEP(" -q display term only, do no changes") KEEP(" -r display term on stderr") SKIP(" -S (obsolete)") KEEP(" -s output TERM set command") KEEP(" -V print curses-version") KEEP(" -w set window-size") KEEP("") KEEP("If neither -c/-w are given, both are assumed.") }; #undef KEEP #undef SKIP (void) fprintf(stderr, "Usage: %s [options] [terminal]\n", _nc_progname); fputs(msg, stderr); ExitProgram(EXIT_FAILURE); /* NOTREACHED */ }
void YogVM_keep_children(YogEnv* env, void* ptr, ObjectKeeper keeper, void* heap) { YogVM* vm = PTR_AS(YogVM, ptr); YogLocalsAnchor* locals; for (locals = vm->locals; locals != NULL; locals = locals->next) { keep_locals_list(env, locals->body, keeper, locals->heap); } YogHandles* handles; for (handles = vm->handles; handles != NULL; handles = handles->next) { keep_handles(env, handles, keeper, handles->heap); } #define KEEP(member) do { \ vm->member = YogGC_keep(env, vm->member, keeper, heap); \ } while (0) KEEP(id2name); KEEP(name2id); KEEP(cArray); KEEP(cArrayField); KEEP(cBignum); KEEP(cBinary); KEEP(cBitField); KEEP(cBool); KEEP(cBuffer); KEEP(cBufferField); KEEP(cClass); KEEP(cClassMethod); KEEP(cCode); KEEP(cCoroutine); KEEP(cDatetime); KEEP(cDict); KEEP(cDir); KEEP(cEncoding); KEEP(cEnv); KEEP(cField); KEEP(cFieldArray); KEEP(cFile); KEEP(cFixnum); KEEP(cFloat); KEEP(cFunction); KEEP(cInstanceMethod); KEEP(cInt); KEEP(cLib); KEEP(cLibFunc); KEEP(cMatch); KEEP(cModule); KEEP(cNativeFunction); KEEP(cNativeFunction2); KEEP(cNativeInstanceMethod); KEEP(cNativeInstanceMethod2); KEEP(cNil); KEEP(cObject); KEEP(cPackage); KEEP(cPath); KEEP(cPointer); KEEP(cPointerField); KEEP(cProcess); KEEP(cProperty); KEEP(cRegexp); KEEP(cSet); KEEP(cStat); KEEP(cString); KEEP(cStringField); KEEP(cStructBase); KEEP(cStructClass); KEEP(cStructClassClass); KEEP(cStructField); KEEP(cSymbol); KEEP(cThread); KEEP(cUnionClass); KEEP(cUnionClassClass); KEEP(cUnsignedBitField); KEEP(eArgumentError); KEEP(eAttributeError); KEEP(eCoroutineError); KEEP(eEOFError); KEEP(eException); KEEP(eFFIError); KEEP(eIOError); KEEP(eImportError); KEEP(eIndexError); KEEP(eKeyError); KEEP(eLocalJumpError); KEEP(eNameError); KEEP(eNotImplementedError); KEEP(eOverflowError); KEEP(eSyntaxError); KEEP(eSystemError); KEEP(eTypeError); KEEP(eUnboundLocalError); KEEP(eValueError); KEEP(eZeroDivisionError); KEEP(mCallable); KEEP(mComparable); KEEP(mEnumerable); KEEP(pkgs); KEEP(search_path); KEEP(encodings); KEEP(encAscii); KEEP(encUtf8); KEEP(default_encoding); KEEP(finish_code); KEEP(main_thread); KEEP(running_threads); KEEP(path_separator); #undef KEEP YogIndirectPointer* indirect_ptr = vm->indirect_ptr; while (indirect_ptr != NULL) { indirect_ptr->val = YogGC_keep(env, indirect_ptr->val, keeper, heap); indirect_ptr = indirect_ptr->next; } }