...writing TNT2 opengl drivers in perl.Whoa! That's a strange undertaking. I hope it's only an academic exercise. In any case, accessing raw memory is largely what Perl is designed to shield you from. So as far as core Perl is concerned, you can't do that (and shouldn't be able to). A quick search didn't turn up an existing module to do this, but you could write a small XS extension (a Perl module written in C) which had routines to read to and write from specific memory locations, and then just call those in your program. Keep in mind this would most likely be insanely slow. But perhaps you could accelerate Commander Keen :-). As far as the printing goes, you might not be far off. Provided your /dev/lp0 is configured to correctly handle raw text dumped to it, you should be able to use what you have if you make the handle writable (open(PRINTER,'>>/dev/lp0')) before printing to it. You may need to figure out how to send a page-feed, though, or just press the button yourself on the printer. | [reply] [d/l] [select] |
Generally, \x0c (that's ctrl-L or ^L) is a page-feed to most printers.
I've written ofs in perl for the lpd before, it's not a difficult task :) However, I'd strongly recommend using the lpd (or at least, one of the new non-spooling print programs, such as pdq) rather than trying to write raw text to the hardware device.
Spud Zeppelin * spud@spudzeppelin.com
| [reply] [d/l] |
In Perl (and usually "C") string handling you can use "\f" for the
formfeeds.
As long as you are playing with teletype commands, you should remember
that one.
- \t ab
- \n ewline
- \r eturn
- \f ormfeed
- \b ackspace
- \a larm
- \e scape (also handy but a perl only idiom AFAIK)
--
$you = new YOU;
honk() if $you->love(perl)
| [reply] |
i was hoping something like the printer thing would work, and i think i couldn't spend my time more productively than accelerating commander keen. That game rocks!! seriously, it was the game that got me interested in computer games. I owe it my life (or perhaps it owes me my life back... i'll have to think about that) I wonder if there is commander keen for linux.......
@:::::::((==========Rydor====>
| [reply] |
You might have more luck with Loki's SDL, especially as there are Perl bindings available from the CPAN.
(Now under Unix, writing to devices is a lot easier as they appear to be files in the filesystem, but writing actual drivers for speed-intensive hardware like a 3d card in Perl strikes me as a sign of too much free time. :)
Update: merlyn has just pointed out the shiny new Inline module, which may get you closer to writing drivers in Perl. | [reply] |
| [reply] |