Differences From
Artifact [d82ba893dd]:
564 564 'blob'; -- opaque binary blob, so 3d-pty mods can use the
565 565 -- file mechanism to store arbirary data.
566 566 };
567 567 drm = T.u8; -- inhibit copying
568 568 name = T.str;
569 569 body = T.text;
570 570 }, function(file) -- enc
571 + assert(E.chip.file[file.kind], string.format('invalid file kind "%s"', file.kind))
571 572 local b = E.chip.file[file.kind].enc(file.body)
572 573 return {
573 574 kind = file.kind;
574 575 drm = file.drm;
575 576 name = file.name;
576 577 body = b;
577 578 }
................................................................................
872 873 end;
873 874 __index = {
874 875 read = function(self)
875 876 local dat = E.chip.read(self.chip)
876 877 return dat.files[self.inode]
877 878 end;
878 879 write = function(self,data)
879 - -- print('writing', self.chip, self.inode)
880 880 return E.chip.fileWrite(self.chip, self.inode, data)
881 881 end;
882 882 erase = function(self)
883 883 local dat = E.chip.read(self.chip)
884 884 table.remove(dat.files, self.inode)
885 885 E.chip.write(self.chip, dat)
886 886 self.inode = nil
................................................................................
909 909 then
910 910 for fl, inode in E.chip.files(e) do
911 911 if fl.kind == 'sw' then
912 912 local s = starlit.item.sw.db[fl.body.pgmId]
913 913 table.insert(sw, {
914 914 sw = s, chip = e, chipSlot = i;
915 915 file = fl, inode = inode;
916 + id = fl.body.pgmId;
916 917 })
917 918 end
918 919 end
919 920 end
920 921 end
921 922 end
922 923
923 924 for _, s in pairs(sw) do
924 925 if s.sw.cost.ram <= comp.ram and pred(s) then
925 926 table.insert(r, {
927 + id = s.id;
926 928 sw = s.sw;
927 929 chip = s.chip, chipSlot = s.chipSlot;
928 930 file = s.file;
929 931 fd = E.chip.fileHandle(s.chip, s.inode);
930 932 speed = s.sw.cost.cycles / comp.cycles;
931 933 powerCost = s.sw.cost.cycles / comp.powerEfficiency;
932 934 comp = comp;