Quantcast

sysutils.beep doesn't beep under Linux?

classic Classic list List threaded Threaded
38 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

sysutils.beep doesn't beep under Linux?

Bruce Bauman-2
I'm porting some code which "beeps" the console. When I use sysutils.beep() it doesn't work under Linux.
 
What's the easiest way to accomplish this?
 
Thanks.
 
-- Bruce
CONFIDENTIALITY NOTICE: This e-mail is confidential and intended
solely for the use of the individual or entity to which it is addressed.  If
you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, forwarding, printing
or copying of this e-mail is strictly prohibited. If you received this e-mail
in error, please delete it from your computer and contact the sender.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

David Butler-3
Try writing Ctrl-G (#7) out to the terminal.

2009/11/18 Bruce Bauman <[hidden email]>:

> I'm porting some code which "beeps" the console. When I use sysutils.beep() it doesn't work under Linux.
>
> What's the easiest way to accomplish this?
>
> Thanks.
>
> -- Bruce
> CONFIDENTIALITY NOTICE: This e-mail is confidential and intended
> solely for the use of the individual or entity to which it is addressed.  If
> you are not the intended recipient, be advised that you have received
> this email in error and that any use, dissemination, forwarding, printing
> or copying of this e-mail is strictly prohibited. If you received this e-mail
> in error, please delete it from your computer and contact the sender.
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Graeme Geldenhuys
In reply to this post by Bruce Bauman-2
Bruce Bauman wrote:
> I'm porting some code which "beeps" the console. When I use
> sysutils.beep() it doesn't work under Linux.

Looking at it's implementation in FPC 2.4.0-rc1 (Linux) I can indeed see
why it doesn't beep. :-)

--------------------------
procedure Beep;
begin
end;
--------------------------


As David suggested, simply write #7 character to the console and it will
beep.  I wonder if we can't use that for the Linux sysutils.beep
implementation.


Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Michael Van Canneyt


On Thu, 19 Nov 2009, Graeme Geldenhuys wrote:

> Bruce Bauman wrote:
>> I'm porting some code which "beeps" the console. When I use
>> sysutils.beep() it doesn't work under Linux.
>
> Looking at it's implementation in FPC 2.4.0-rc1 (Linux) I can indeed see
> why it doesn't beep. :-)
>
> --------------------------
> procedure Beep;
> begin
> end;
> --------------------------
>
>
> As David suggested, simply write #7 character to the console and it will
> beep.  I wonder if we can't use that for the Linux sysutils.beep
> implementation.

No, because you don't know if a terminal is available or whether standard
output is writable.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Jonas Maebe-2

On 20 Nov 2009, at 11:51, Michael Van Canneyt wrote:

> No, because you don't know if a terminal is available or whether  
> standard
> output is writable.

And I guess that if the crt unit is used, it would just put some  
strange character on the screen.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Graeme Geldenhuys
In reply to this post by Michael Van Canneyt
Michael Van Canneyt wrote:
>
> No, because you don't know if a terminal is available or whether
> standard output is writable.

As far as I know stdout is always available for Linux. Even if I compile
applications for X11 and launch them from a desktop icon, I can do
writeln() calls without problems (unlike under Windows which will throw
an error).



Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Marco van de Voort
In our previous episode, Graeme Geldenhuys said:
> > No, because you don't know if a terminal is available or whether
> > standard output is writable.
>
> As far as I know stdout is always available for Linux. Even if I compile
> applications for X11 and launch them from a desktop icon, I can do
> writeln() calls without problems (unlike under Windows which will throw
> an error).

And did you test daemons?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Michael Van Canneyt
In reply to this post by Graeme Geldenhuys


On Fri, 20 Nov 2009, Graeme Geldenhuys wrote:

> Michael Van Canneyt wrote:
>>
>> No, because you don't know if a terminal is available or whether
>> standard output is writable.
>
> As far as I know stdout is always available for Linux. Even if I compile
> applications for X11 and launch them from a desktop icon, I can do
> writeln() calls without problems (unlike under Windows which will throw
> an error).

No, the application can (for instance almost all daemons do) close stdout.
Programs that use ncurses will also be messed-up.

For CGI programs, stdout is also reserved for the HTML output.
Imagine someone else's code doing a beep, and it ends up in your
HTML output.

Before you think that these are far-fetched:

If you'll remember, tiOPF had some very common (but nasty) windows-only
constructs like showing message boxes deeply buried in core functionality.
Works fine. Till I come along and want to run the thing on Linux. Bummer...

By that rationale: no beep() on linux.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Graeme Geldenhuys
Michael Van Canneyt wrote:
>
> No, the application can (for instance almost all daemons do) close
> stdout. Programs that use ncurses will also be messed-up.

Ah, ok.


> For CGI programs, stdout is also reserved for the HTML output.
> Imagine someone else's code doing a beep, and it ends up in your HTML

I can't say I have ever seen a HTML page that beeps, but then again you
never know. ;-)


> If you'll remember, tiOPF had some very common (but nasty)
> windows-only constructs like showing message boxes deeply buried in
> core functionality. Works fine. Till I come along and want to run the
> thing on Linux. Bummer...

Please let me know if this is still the case, so those + translations
can be resolved. It took me considerable time to fix tiOPF Core to run
on a headless Linux box. So if any strange "gui" message boxes appear in
tiOPF Core, I would be very surprised. Hard-coded English text is a
different issue.


> By that rationale: no beep() on linux.

Funny you say that. When I started working on fpGUI's DocView (help
viewer) and viewed various OS/2 INF files, I couldn't get the damn
program to stop beeping at me! It took me a good two weeks before I
found the problem - it was #7 characters used in the IBM INF documents!

So I can honestly say my Linux system CAN beep. ;-)

Possible alternatives:
Maybe under Linux the system.beep() can make a sound if stdout is
available, otherwise write the word "beep" to the console (like the old
silent movies did on screen), or flash the Scroll Lock keyboard light. :-)

Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Michael Van Canneyt


On Fri, 20 Nov 2009, Graeme Geldenhuys wrote:

> Michael Van Canneyt wrote:
>>
>> No, the application can (for instance almost all daemons do) close
>> stdout. Programs that use ncurses will also be messed-up.
>
> Ah, ok.
>
>
>> For CGI programs, stdout is also reserved for the HTML output.
>> Imagine someone else's code doing a beep, and it ends up in your HTML
>
> I can't say I have ever seen a HTML page that beeps, but then again you
> never know. ;-)
>
>
>> If you'll remember, tiOPF had some very common (but nasty)
>> windows-only constructs like showing message boxes deeply buried in
>> core functionality. Works fine. Till I come along and want to run the
>> thing on Linux. Bummer...
>
> Please let me know if this is still the case, so those + translations
> can be resolved. It took me considerable time to fix tiOPF Core to run
> on a headless Linux box. So if any strange "gui" message boxes appear in
> tiOPF Core, I would be very surprised. Hard-coded English text is a
> different issue.

As far as I know, they were removed at the first "complaint" from my side,
but I just wanted to make a point, namely: you don't know what system your
code will end up on.

>
>
>> By that rationale: no beep() on linux.
>
> Funny you say that. When I started working on fpGUI's DocView (help
> viewer) and viewed various OS/2 INF files, I couldn't get the damn
> program to stop beeping at me! It took me a good two weeks before I
> found the problem - it was #7 characters used in the IBM INF documents!
>
> So I can honestly say my Linux system CAN beep. ;-)

It can, of course...

>
> Possible alternatives:
> Maybe under Linux the system.beep() can make a sound if stdout is
> available, otherwise write the word "beep" to the console (like the old
> silent movies did on screen), or flash the Scroll Lock keyboard light. :-)

No, see the ncurses/cgi use cases.

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Marco van de Voort
In reply to this post by Graeme Geldenhuys
In our previous episode, Graeme Geldenhuys said:
> Possible alternatives:
> Maybe under Linux the system.beep() can make a sound if stdout is
> available, otherwise write the word "beep" to the console (like the old
> silent movies did on screen), or flash the Scroll Lock keyboard light. :-)

Sure. How to detect this? What stdout exactly points to, if I can toggle
scroll lock etc?

If you are really good at this kind of stuff, please have a look at the
video, keyboard and mouse unit. They can also use sb who is good at this
kind of stuff. (which is hell under *nix)
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

FPC equivalent to "system" under Linux

Bruce Bauman-2
In reply to this post by Bruce Bauman-2
I'm porting some code which called "system". Is there an equivalent under FPC, or do I need to use FpFork/FpExecV?
 
-- Bruce
CONFIDENTIALITY NOTICE: This e-mail is confidential and intended
solely for the use of the individual or entity to which it is addressed.  If
you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, forwarding, printing
or copying of this e-mail is strictly prohibited. If you received this e-mail
in error, please delete it from your computer and contact the sender.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: FPC equivalent to "system" under Linux

Marco van de Voort
In our previous episode, Bruce Bauman said:

> I'm porting some code which called "system". Is there an equivalent under
> FPC, or do I need to use FpFork/FpExecV?

unix.fpsystem both with short annd ansistring arguments.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Jorge Aldo G. de F. Junior
In reply to this post by Marco van de Voort
arent there a /dev/something device for pcspeaker ?
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

convert st_mtime from BaseUnix.FpStat to year, month, day, hour, minute, sec

Bruce Bauman-2
In reply to this post by Bruce Bauman-2
I need to convert the st_time field of the record returned by BaseUnix.FpStat to the year, month, day, hour, minute and second and need to compensate for the local timezone.
 
I've read over the RTL documentation and am thoroughly confused. Some of the documentation of the interfaces say that they are unimplemented and will raise an exception. Others just appear to be missing.
 
How can I accompilish this? Any example code?
 
-- Bruce

 
CONFIDENTIALITY NOTICE: This e-mail is confidential and intended
solely for the use of the individual or entity to which it is addressed.  If
you are not the intended recipient, be advised that you have received
this email in error and that any use, dissemination, forwarding, printing
or copying of this e-mail is strictly prohibited. If you received this e-mail
in error, please delete it from your computer and contact the sender.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: convert st_mtime from BaseUnix.FpStat to year, month, day, hour, minute, sec

Jonas Maebe-2

On 20 Nov 2009, at 23:49, Bruce Bauman wrote:

> I need to convert the st_time field of the record returned by BaseUnix.FpStat to the year, month, day, hour, minute and second and need to compensate for the local timezone.

The dateutils unit contains the following functions that you can use:

Function DateTimeToUnix(const AValue: TDateTime): Int64;
Function UnixToDateTime(const AValue: Int64): TDateTime;

Once you have a TDateTime, you can use DecodeDateTime() to extract the various components.

> I've read over the RTL documentation and am thoroughly confused. Some of the documentation of the interfaces say that they are unimplemented and will raise an exception.

Which ones?

> Others just appear to be missing.


Which ones?


Jonas_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Martin Schreiber
In reply to this post by Jorge Aldo G. de F. Junior
On Friday 20 November 2009 21:24:17 Jorge Aldo G. de F. Junior wrote:
> arent there a /dev/something device for pcspeaker ?

With X11 one can use xbell().

Martin

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

fpclist
On Saturday 21 November 2009 08:56:53 Martin Schreiber wrote:
> On Friday 20 November 2009 21:24:17 Jorge Aldo G. de F. Junior wrote:
> > arent there a /dev/something device for pcspeaker ?
/dev/pcspkr

>
> With X11 one can use xbell().
>
> Martin
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal



_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Graeme Geldenhuys-2
The joys of Linux. I have neither /dev/pcspkr or xbell available on my
Ubuntu 9.08.2 system.  :-(

Graeme.



On 21/11/2009, [hidden email] <[hidden email]> wrote:

> On Saturday 21 November 2009 08:56:53 Martin Schreiber wrote:
>> On Friday 20 November 2009 21:24:17 Jorge Aldo G. de F. Junior wrote:
>> > arent there a /dev/something device for pcspeaker ?
> /dev/pcspkr
>
>>
>> With X11 one can use xbell().
>>
>> Martin
>>
>> _______________________________________________
>> fpc-pascal maillist  -  [hidden email]
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>


--
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: sysutils.beep doesn't beep under Linux?

Graeme Geldenhuys-2
Sorry about the typo - a slip of the hand.  Make that Ubuntu 8.04.2


On 21/11/2009, Graeme Geldenhuys <[hidden email]> wrote:
> The joys of Linux. I have neither /dev/pcspkr or xbell available on my
> Ubuntu 9.08.2 system.  :-(
>
> Graeme.


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
12
Loading...