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

Rebol & printers

 [1/5] from: olivier:auverlot:ac-lille at: 19-Feb-2002 12:00


Someone knows a TCP protocol for Rebol to print a document on a server NT/2000 ? Regards Olivier ;-)

 [2/5] from: greggirwin:mindspring at: 19-Feb-2002 15:38


Olivier, << Someone knows a TCP protocol for Rebol to print a document on a server NT/2000 ? >> I'm using Gabriele's pdf-maker to print things on a current project and you can specify the printer it should use when you launch Acrobat, if that will work for you. Other than that, I haven't made any attempt to tackle the printing APIs from REBOL. I thought about it, but then someone from RT alluded to the fact that they were looking at printing issues as well and I'm wiling to wait a bit for that. --Gregg

 [3/5] from: riusa::email::it at: 20-Feb-2002 9:07


Good! You wish some suggestions? I say my suggestion... Since Rebol is internet-oriented library should be created to let me insert in my code only the needed functions, not the whole library. If you create a rebol script, I can import it with "do ..." but I import all the libraries... not only the functions I need. I know Python, and it has a very interesting option to include external functions: in "IMPORT" statement I can specify the functions to import: Examples: 1) import string # to import the string manipulation library 2) from string import xyz # to import only the function xyz bye! ================================================
> Olivier, > > << Someone knows a TCP protocol for Rebol to print a document on a
server
> NT/2000 ? >> > > I'm using Gabriele's pdf-maker to print things on a current project
and you
> can specify the printer it should use when you launch Acrobat, if
that will
> work for you. Other than that, I haven't made any attempt to tackle
the
> printing APIs from REBOL. I thought about it, but then someone from RT > alluded to the fact that they were looking at printing issues as well
and
> I'm wiling to wait a bit for that. > > --Gregg >
-- Prendi GRATIS l'email universale che... risparmia: http://www.email.it/f Sponsor: Aderisci a un gruppo d'acquisto: pagherai di meno quello che desideri Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=245&d=20-2

 [4/5] from: mario:cassani:icl at: 20-Feb-2002 9:06


Hallo Olivier,
> Someone knows a TCP protocol for Rebol to print a document > on a server NT/2000 ?
Start from this: http://www.google.com/search?hl=en&q=lpd+windows+printer+daemon Mario

 [5/5] from: joel:neely:fedex at: 20-Feb-2002 6:41


Actually the equivalent can be accomplished in REBOL as well, but you have to implement the conventions yourself (at least until somebody has the time...) [riusa--email--it] wrote:
> Since Rebol is internet-oriented library should be created to > let me insert in my code only the needed functions, not the > whole library. If you create a rebol script, I can import it > with "do ..." but I import all the libraries... not only the > functions I need. >
Here's the line of thought I was pursuing in connection with UHURU (which I had to lay on the shelf due to time pressures from a "black hole" project at work; I still hope to be able to resume the effort and put it into decent shape at some point...) SIMPLE "INCLUDE" CAPABILITY You can have a file something like this dinky sample: 8<----------counter.r---------- REBOL [] make object! [ current_counter: 0 reset: func [] [current_counter: 0] with: func [n] [current_counter: current_counter + n] ] 8<----------------------------- and then tell the interpreter (at the console)
>> my-counter: do %counter.r
at which point you've "instantiated" the object in your own variable:
>> my-counter: do %counter.r >> my-counter/reset
== 0
>> my-counter/with 1
== 1
>> my-counter/with 1
== 2
>> my-counter/with 17
== 19 Of course, good design dictates that only mutually-relevant methods and attributes be collected together in a single object. Using this as the basis, the idea was to have a layer that could keep up with a collection of directories containing such source files (and could keep them and their documentation up to date etc..., but that is a different conversation). That layer could expose an interface something like my-counter: UHURU/import %counter.r to accomplish this single-object version. The interesting thing is you can also do things like this in a script: foo: func [... /local tally ...] [ tally: UHURU/import %counter.r ;;... ;;... do stuff that uses TALLY within FOO ;;... tally: none ;; destroy the ref to the object ] In this case (assuming that no other references are created to TALLY's value) the memory for that object can now be GCed, thus leaving in memory only the things that are in use elsewhere. The next step, of course, is to extend the interface to manage that create/destroy cycle for you. (The notation below is only for illustration during this thread! One of the most significant design issues IMHO is packaging and naming the interface capabilities appropriately, and I haven't done that work...) With that next level of extension, one could write something like this: foo: func [...] [ UHURU/scope tally %counter.r [ ;;... ;;... do stuff with TALLY ;;... ] ;; at the end of the controlled block, TALLY is ;; cleared, making its former content garbage ] FANCY "IMPORT list FROM file" CAPABILITY Now let's imagine another (equally trivial/hypothetical) file: 8<----------accumulators.r---------- REBOL [] [ "by-sum" make object! [ the_sum: 0 reset: func [] [the_sum: 0] with: func [n] [the_sum: the_sum + n] ] "by-and" make object! [ the_conjunction: true reset: func [] [the_conjunction: true] with: func [p] [the_conjunction: the_conjunction and p] ] "by-product" make object! [ the_product: 1 reset: func [] [the_product: 1] with: func [n] [the_product: the_product * n] ] ] 8<---------------------------------- Without belaboring the details, the idea is to be able to say something like: UHURU/import [adder multiplier] %accumulators.r ["by-sum" "by-product"] and get only the components you wanted. -jn- -- ; sub REBOL {}; sub head ($) {@_[0]} REBOL [] # despam: func [e] [replace replace/all e ":" "." "#" "@"] ; sub despam {my ($e) = @_; $e =~ tr/:#/.@/; return "\n$e"} print head reverse despam "moc:xedef#yleen:leoj" ;