Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

mimetypes, loopback, object serialistion tool: minidisk

 [1/2] from: agem:crosswinds at: 3-Mar-2001 5:06


REBOL [ title: "mimetypes, loopback, object serialistion tool: minidisk" purpose: { installs a scheme ram:// which actually works as a ramdisk. this disk can be saved completely to a single file and restored later. is meant to be minimal, do deleteing and such by access to 'ram/files . output is enbase-64 compressed. only read/write, no open/append/close (simpler)(advanced version available). } usage: { [do %minidisk.r] read/write ram://filename stuff [ram/save %your-file.r] [do %yourfile.r];disk back :) append your own startup in 'save behind 'ram/install . } name: "minidisk" file: %minidisk.r author: "volker" ] ram: context [ header: none save: func [file'] [ system/words/save/header file' compose [ ram: do decompress debase (enbase compress mold make self [header: none]) ram/install ] third load mold make header [file: file' date: now] ] install: does [header: system/script/header net-utils/net-install 'RAM self 9900] init: func [port spec] [ net-utils/url-parser/parse-url port spec port/locals: to file! skip spec length? to url! "RAM://" ] open: func [port] [ port/state/flags: port/state/flags or system/standard/port-flags/direct ] read: func [port data /local len] [ either port/locals [ insert data debase select files port/locals port/locals: none length? data ] [0] ] write: func [port data /local found] [ either found: find files port/locals [ change next found enbase copy data ] [ repend files [port/locals enbase data] ] length? data ] close: func [port] [] files: copy [] ] do example: [ ram/install ? ram write ram://write.txt "hello" print read ram://write.txt ? ram ram/save %minidisk1.r print read %minidisk1.r do %minidisk1.r ; ? ram ]

 [2/2] from: deadzaphod::hotmail::com at: 3-Mar-2001 10:29


That's great! Thank you. Now I not only have this as a tool, I have a new example of how to write a new protocol for rebol (which I've been having trouble figuring out) Cal Dixon -><-