World: r3wp
[Core] Discuss core issues
older newer | first last |
Anton 13-May-2005 [1094] | (and maybe there's a "simple mode" and a "windows mode" the printer can go into) |
Gregg 13-May-2005 [1095x2] | That is pretty crazy Allen. Doesn't seem like it could be too hard to do. |
Graham, in the old days you would use the Escape+passthrough API, but that's been frowned on for quite a while now. Have you tried writing to %//PRN ? With more API work (OpenPrinter), you can use spooler functions like EndPagePrinter or WritePrinter too. | |
Graham 13-May-2005 [1097] | the problem is I don't have a windows driver for this printer so I am experimenting to see what type of controls it understands. There is no manual, and the windows drivers are password protected on the manufacturer's website! |
DideC 13-May-2005 [1098] | Give us the printer model. May be someone here... |
Graham 13-May-2005 [1099x3] | I doubt it .. but here it is .. Addmaster IJ3000 |
http://www.addmaster.com | |
It looks like it accepts similar escape sequences as esc/pos ... but the application I'm using won't flush the printer buffer without closing the application down. | |
Gabriele 13-May-2005 [1102] | graham: check the serial parameters |
Graham 13-May-2005 [1103] | Let me rephrase that. I am using a POS program which I downloaded. When it prints a receipt to my serial printer, it fails to cause the printer to print the full printer buffer. But when I close the POS program down, the printer then spits out the rest. I have downloaded the Builder C++ source ( but it won't compile without errors :( ). I thought I would try and use Rebol first to send commands to the printer to see what I need to do to force the printer to print the contents of it's buffer. It's not the pc buffer as I turned off the fifo buffers in the serial port settings to see what the problem was. |
sqlab 13-May-2005 [1104x2] | Does your printer finish the job, if your POS program sends a new page or a new job? Can you manually force a linefeed on your printer? |
Sorry, I meant Can you force a FF formfeed on your printer? | |
Sunanda 13-May-2005 [1106] | If you can issue a DOS command (REBOL/Command or some betas with Call enabled), try this: echo ^l > prn (That's a ctrl+L character, not a caret then L) That should force a form feed |
Graham 13-May-2005 [1107] | Looks like the POS program locks the serial port until it closes down :( |
Micha 14-May-2005 [1108x2] | port: make port! [scheme: 'tcp host: 127.0.0.1 port-id: 80 ] open port clone: func [port /local clone ] [ clone: make port [ scheme: 'tcp ] open clone clone/port-id: port/port-id clone/state: port/state clone/local-ip: port/local-ip clone/remote-ip: port/remote-ip clone/local-port: port/local-port clone/remote-port: port/remote-port return clone ] port/sub-port: clone port probe port |
how do to check or cloned harbour is open ?how do to check or cloned harbour is open ?how do to check or cloned harbour is open ?how do to check or cloned harbour is open ? | |
Anton 16-May-2005 [1110x4] | attempt [query port] probe port/status |
no no no - sorry... does not work... | |
>> value? in port/sub-port/state 'inBuffer == true >> close port >> value? in port/sub-port/state 'inBuffer == false | |
Or maybe better to check port/state/flags or port/sub-port/state/flags ...... <---- need to investigate | |
Anton 19-May-2005 [1114x4] | Ahh... Best way might be to try to open port: |
port: make port! http://www.rebol.net print either error? try [open port]["open -> open"]["closed -> open"] | |
What's the best way to rethrow an error that you have caught and disarmed ? | |
;Like this ? port: make port! http://www.rebol.net if error? err: try [open port][err: disarm err throw make error! reduce [err/type err/id]] ; do this line twice | |
Romano 19-May-2005 [1118] | try: >> errd: disarm err: try [ 2 / 0] errd/near: [new-near] err ** Math Error: Attempt to divide by zero ** Near: new-near |
Volker 19-May-2005 [1119] | 'disarm makes a copy. just throw the original error. |
Henrik 19-May-2005 [1120x2] | is there an easy way to pad zeros on time! values? as in 04:17:00 rather than having 4:17 displayed |
never mind, I figured one out. it was of course simpler than I thought :-) | |
Gabriele 20-May-2005 [1122] | henrik, try out to-itime in the new 1.2.108 |
Henrik 20-May-2005 [1123x2] | was this added on my request? :-) |
because it does exactly what I need | |
Gabriele 20-May-2005 [1125] | :-) |
Brock 20-May-2005 [1126x2] | >> to-itime/precise now/time == "06:39:2.0" |
should this not have returned "06:39:02.0" | |
sqlab 20-May-2005 [1128] | bad >> to-itime/precise now/time == "13:47:0.0" worse >> to-itime/precise now/time/precise == "13:46:4E-2" |
Gregg 27-May-2005 [1129x3] | For Post 1.3 discussion (moved here from the Debug 1.3 group) ... What would your "perfect" FOR interface look like (anyone and everyone)? For me, I want it to hide the mechanical details more than CFOR does, and is nicer to read than the current FOR (for i 1 9 1 [...]). It might look like this: for [i: from 1 to 9] [...] for [i: 1 .. 9 step 2] [...] for [i from 1..9 step 3] [...] for [i: 1 — 9 step 4] [...] for [i 0 to 1 step .1] [...] or maybe move the word outside the block: for i [1 to 9] [...] for i [1 to 9 step 2] [...] Python has an Else clause, though it works backwards from what I expect it to; the idea is to have a clause that executes if 'break is used. It also has a Continue op that jumps to the head of the body for the next iteration. |
I agree with Volker and Ladislav about the value of getting the stepping/increment code out of the body. I agree so much, I think it should be hidden entirely. :-) | |
The most common case, by far, is to step by one, so you should be able to omit that IMO. | |
Volker 28-May-2005 [1132] | cfor is not only about counting, but about anything like a "step". it may be counting, or stepping through a list by pos: next pos, or whatever. that can't be captured by better hiding. |
Allen 28-May-2005 [1133x2] | Gregg: said "The most common case, by far, is to step by one, so you should be able to omit that IMO. " , for the most common situations, you would use REPEAT or LOOP. I virtually never use FOR, except if I'm thinking in some other language |
for me, FOR is only there when one of the native looping structures doesn't suffice. But I do like then dialect options you present. My pref would be to keep the value outside (to keep closer to foreach syntax)., ie for i [1 to 9 step 2][..] | |
Gregg 28-May-2005 [1135x4] | I rarely use it myself Allen. The only reason I really think it's important at all is that new people coming to REBOL will look for FOR. Need to add a doc section on native verus mezz control functions. |
Volker, it should operate on series values as well, like FOR does today. My examples are all numbers, because that's easier to do concisely. :-) | |
The only time I use FOR today is when I need to: a) start at a number other than 1 b) step by a increment other than one. c) brevity and clarity is more important than performance. | |
If REPEAT had /start and /skip refinements... | |
Romano 28-May-2005 [1139x2] | assume: func [ {If a value is not in a series, append it.} series [series! port!] value ][ any [find series value insert tail series :value] ] |
I propose this new function for Core. check the return values in both cases. | |
ChristianE 28-May-2005 [1141] | As imho is the case with ALTER, ASSUME in my ears sounds too general to give a hint to it's functionality just by it's name. A function like the one you suggest seems very useful to me, though. How's about APPEND-ONCE (could even be APPEND/ONCE on mezzanine level). |
BrianW 29-May-2005 [1142] | I'm losing my mind here ... my Linux rebol scripts just aren't working unless I invoke rebol directly myself. |
Robert 29-May-2005 [1143] | debugging: IIRC I once asked this question already but can't remember the answer. Is it possible from inside a function to get the set-word this code is bound to? I would like to be able to print the set-word for debugging call-traces. |
older newer | first last |