def charp2strn(cp, maxlen): b = builder_class(maxlen) i = 0 while i < maxlen and cp[i] != lastchar: b.append(cp[i]) i += 1 return assert_str0(b.build())
def charp2str(cp): b = builder_class() i = 0 while cp[i] != lastchar: b.append(cp[i]) i += 1 return assert_str0(b.build())
def load_feature(space, path, orig_path): if not os.path.exists(assert_str0(path)): raise space.error(space.w_LoadError, orig_path) f = open_file_as_stream(path) try: contents = f.readall() finally: f.close() space.execute(contents, filepath=path)
def find_feature(space, path): if not path.endswith(".rb"): path += ".rb" if not (path.startswith("/") or path.startswith("./") or path.startswith("../")): w_load_path = space.globals.get("$LOAD_PATH") for w_base in space.listview(w_load_path): base = space.str_w(w_base) full = os.path.join(base, path) if os.path.exists(assert_str0(full)): path = os.path.join(base, path) break return path