Re: [fpc-pascal] Interface with NASM

2010-09-15 Thread Felipe Monteiro de Carvalho
I changed it to a very similar program, but one which can be built
with a single instruction:

program driver;

uses asmio;

{$ASMMODE Intel}

procedure tes; assembler; [alias:'tes'];
asm
 push ebp
 mov  ebp,esp
 mov  EAX,65
 push EAX
 call printc
 leave
 ret
end;

begin
 tes;
end.

It crashes inside printc apparently when getting the parameter.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Leonardo M . Ramé
Hi, I'm looking for a way to send images to a printer without using the 
Printers unit. I can't use it because it relies on X (on Linux) and I need to 
print from a CGI or command line application, that must be installed on servers 
without X installed.

Does FPC have a workaround for this?

Leonardo M. Ramé
http://leonardorame.blogspot.com



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Michael Van Canneyt



On Wed, 15 Sep 2010, Leonardo M. Ramé wrote:


Hi, I'm looking for a way to send images to a printer without using the 
Printers unit. I can't use it because it relies on X (on Linux) and I need to 
print from a CGI or command line application, that must be installed on servers 
without X installed.

Does FPC have a workaround for this?


Yes:

Draw on a postscript canvas or image canvas, 
write to file and execute 'lpr myfile.ps' or 'lpr myfile.png'


Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Graeme Geldenhuys
On 15 September 2010 14:20, Leonardo M. Ramé  wrote:
> Hi, I'm looking for a way to send images to a printer without using the 
> Printers unit. I can't use it because it relies on X (on Linux) and I need to 
> print from a CGI or command line application, that must be installed on 
> servers without X installed.
>

For more details: man lp

   Print a double-sided legal document to a printer called "foo":
  lp -d foo -o media=legal -o sides=two-sided-long-edge filename

   Print an image across 4 pages:
   lp -d bar -o scaling=200 filename

   Print a text file with 12 characters per inch, 8 lines per inch, and a
   1 inch left margin:
   lp -d bar -o cpi=12 -o lpi=8 -o page-left=72 filename

   Or just print the file to the default printer
   lp "my long file.txt"



-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Leonardo M . Ramé
Nice!, and is it possible to send the bitmap data to lpr through a pipe?.

Something like "cat myfile.bmp|lpr". This doesn't work, it just prints garbage, 
maybe "cat" is handling the file as text.

I'm asking this because I don't want to create the file, then print it, then 
delete it, much better if I just create a TMemoryStream and send it to lpr.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Wed, 9/15/10, Graeme Geldenhuys  wrote:

> From: Graeme Geldenhuys 
> Subject: Re: [fpc-pascal] Command line or CGI Printing
> To: "FPC-Pascal users discussions" 
> Date: Wednesday, September 15, 2010, 10:33 AM
> On 15 September 2010 14:20, Leonardo
> M. Ramé  wrote:
> > Hi, I'm looking for a way to send images to a printer
> without using the Printers unit. I can't use it because it
> relies on X (on Linux) and I need to print from a CGI or
> command line application, that must be installed on servers
> without X installed.
> >
> 
> For more details:     man lp
> 
>    Print a double-sided legal document to a
> printer called "foo":
>           lp -d foo -o media=legal
> -o sides=two-sided-long-edge filename
> 
>    Print an image across 4 pages:
>            lp -d bar -o
> scaling=200 filename
> 
>    Print a text file with 12 characters per
> inch, 8 lines per inch, and a
>    1 inch left margin:
>            lp -d bar -o
> cpi=12 -o lpi=8 -o page-left=72 filename
> 
>    Or just print the file to the default
> printer
>            lp "my long
> file.txt"
> 
> 
> 
> -- 
> Regards,
>   - Graeme -
> 
> 
> ___
> fpGUI - a cross-platform Free Pascal GUI toolkit
> http://opensoft.homeip.net/fpgui/
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Michael Van Canneyt


You can't use pipes.

lpr relies on the file extension to determine the file type and invoke the 
proper filter.

When using pipes, it assumes postscript AFAIK.

In each case creating the file doesn't hurt. LP will create a file anyway.

Michael.

On Wed, 15 Sep 2010, Leonardo M. Ramé wrote:


Nice!, and is it possible to send the bitmap data to lpr through a pipe?.

Something like "cat myfile.bmp|lpr". This doesn't work, it just prints garbage, maybe 
"cat" is handling the file as text.

I'm asking this because I don't want to create the file, then print it, then 
delete it, much better if I just create a TMemoryStream and send it to lpr.

Leonardo M. Ramé
http://leonardorame.blogspot.com


--- On Wed, 9/15/10, Graeme Geldenhuys  wrote:


From: Graeme Geldenhuys 
Subject: Re: [fpc-pascal] Command line or CGI Printing
To: "FPC-Pascal users discussions" 
Date: Wednesday, September 15, 2010, 10:33 AM
On 15 September 2010 14:20, Leonardo
M. Ramé  wrote:
> Hi, I'm looking for a way to send images to a printer
without using the Printers unit. I can't use it because it
relies on X (on Linux) and I need to print from a CGI or
command line application, that must be installed on servers
without X installed.
>

For more details:     man lp

   Print a double-sided legal document to a
printer called "foo":
          lp -d foo -o media=legal
-o sides=two-sided-long-edge filename

   Print an image across 4 pages:
           lp -d bar -o
scaling=200 filename

   Print a text file with 12 characters per
inch, 8 lines per inch, and a
   1 inch left margin:
           lp -d bar -o
cpi=12 -o lpi=8 -o page-left=72 filename

   Or just print the file to the default
printer
           lp "my long
file.txt"



--
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Command line or CGI Printing

2010-09-15 Thread Graeme Geldenhuys
Op 2010-09-15 15:59, Leonardo M. Ramé het geskryf:
> Nice!, and is it possible to send the bitmap data to lpr through a
> pipe?.

You can print stdout output of a program like that. eg:
   myprogram | lp


> Something like "cat myfile.bmp|lpr". This doesn't work, it just prints
> garbage, maybe "cat" is handling the file as text.

Yeah, I think cat treats it like text then.

So your best bet I think is to do:  lp myfile.bmp




Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal