public static void luaZ_init(lua_State L, Zio z, cc.lua_Reader reader, object data) { z.L = L; z.reader = reader; z.data = data; z.n = 0; z.p = null; }
public ObjectSet(Zio zio, objset_phys_t os) { if (zio == null) throw new ArgumentNullException("zio"); mZio = zio; mType = os.Type; mMetaDNode = new DNode(zio, os.MetaDnode); }
internal DatasetDirectory(ObjectSet mos, long objectid, string name, Zio zio) { this.mMos = mos; this.mZio = zio; this.Name = name; this.Type = DataSetType.MetaData; var rootDslObj = mos.ReadEntry(objectid); if (rootDslObj.Type != dmu_object_type_t.DSL_DIR) throw new NotSupportedException("Expected DSL_DIR dnode."); if (rootDslObj.BonusType != dmu_object_type_t.DSL_DIR) throw new NotSupportedException("Expected DSL_DIR bonus."); mDslDir = rootDslObj.GetBonus<dsl_dir_phys_t>(); var rootDslProps = Zap.Parse(mos, mDslDir.props_zapobj); Dictionary<string, long> clones; if (mDslDir.clones != 0) { clones = Zap.GetDirectoryEntries(mos, mDslDir.clones); } if (mDslDir.head_dataset_obj == 0) return; //probably meta data, like $MOS or $FREE var rootDataSetObj = mos.ReadEntry(mDslDir.head_dataset_obj); if (!IsDataSet(rootDataSetObj)) throw new Exception("Not a dataset!"); if (rootDataSetObj.BonusType != dmu_object_type_t.DSL_DATASET) throw new Exception("Missing dataset bonus!"); var headDs = rootDataSetObj.GetBonus<dsl_dataset_phys_t>(); if (headDs.bp.IsHole && mDslDir.origin_obj == 0) return; //this is $ORIGIN if (headDs.snapnames_zapobj != 0) { mSnapShots = Zap.GetDirectoryEntries(mMos, headDs.snapnames_zapobj); } if (headDs.bp.Type != dmu_object_type_t.OBJSET) throw new Exception("Expected OBJSET."); var headDsObjset = zio.Get<objset_phys_t>(headDs.bp); switch (headDsObjset.Type) { case dmu_objset_type_t.DMU_OST_ZFS: this.Type = DataSetType.ZFS; break; case dmu_objset_type_t.DMU_OST_ZVOL: this.Type = DataSetType.ZVOL; break; default: throw new Exception("Unknow dataset type: " + headDsObjset.Type.ToString()); } }
public static void luaX_setinput(lua_State L, LexState ls, Zio z, TString source, int firstchar) { ls.t.token = 0; ls.decpoint = (byte)'.'; ls.L = L; ls.current = firstchar; ls.lookahead.token = (int)RESERVED.TK_EOS; /* no look-ahead token */ ls.z = z; ls.fs = null; ls.linenumber = 1; ls.lastline = 1; ls.source = source; ls.envn = luaS_new(L, LUA_ENV); /* get env name */ luaZ_resizebuffer(ls.L, ls.buff, cc.LUA_MINBUFFER); /* initialize buffer */ }
public static int luaZ_fill(Zio z) { lua_State L = z.L; cc.lua_unlock(L); int size = 0; byte[] buff = z.reader(L, z.data, ref size); cc.lua_lock(L); if (buff == null || size == 0) { return(EOZ); } z.n = size - 1; /* discount char being returned */ z.p = buff; return(z.p[0]); }
public static int zgetc(Zio z) { return(z.n-- > 0 ? z.p[z.n] : luaZ_fill(z)); }
public NPLLex() { m_lexState = new LexState(); m_zio = new Zio(); }
public Zio z; /* input stream */ #endregion Fields #region Constructors public LexState() { current = EOZ; linenumber = 0; lastline = 0; z = null; buff = new char[0]; nestlevel = 0; bSucceed = true; t = new Token(EOZ, new SemInfo(0, "")); lookahead = new Token(EOZ, new SemInfo(0, "")); }