Re: [fpc-pascal] Testing set membership for unicode chars

2013-01-21 Thread Wimpie Nortje
Thanks, I had already written a CharInSet(UnicodeChar; UnicodeString) function, but I hoped there were a language construct equivalent to the ansi char method. On 21 January 2013 10:32, Marco van de Voort mar...@stack.nl wrote: In our previous episode, Paul Ishenin said: I am using fpc

Re: [fpc-pascal] Testing set membership for unicode chars

2013-01-21 Thread Wimpie Nortje
Thanks, I'll have a look at it. On 2013/01/21 04:07 PM, Honza wrote: 2013/1/20 Paul Ishenin paul.ishe...@gmail.com: 20.01.13, 23:21, Wimpie Nortje пишет: Hi list I want to test membership of a unicode char in a set / array of unicode chars. Something like var ucCh: unicodechar; if ucCh

[fpc-pascal] Testing set membership for unicode chars

2013-01-20 Thread Wimpie Nortje
Hi list I want to test membership of a unicode char in a set / array of unicode chars. Something like var ucCh: unicodechar; if ucCh in [ UnicodeChar('0')..UnicodeChar('9')] then dosomething; I am using fpc 2.6.0 and the '..' operator converts the data to a pascal set, which is limited to

Re: [fpc-pascal] Linux sound (especially MIDI) programming: ALSA?

2012-05-06 Thread Wimpie Nortje
I have used ALSA to record sound. It was some time ago, I think on Kubuntu 10.04 or so. I can send you some code I used but I have no idea whether it will work under newer Linux's On 2012/05/06 10:09 AM, Mark Morgan Lloyd wrote: Has anybody used FPC to control ALSA on Linux? I need to filter a

Re: [fpc-pascal] Stunnel replaced by FPC?

2011-10-13 Thread Wimpie Nortje
Have a look at BEEP (beepcore.org) and Vortex (www.aspl.es/vortex). I think it covers all of your requirements. Currently the closest to a Pascal version is BeepFp, which uses Vortex. BeepFp is however not finished yet, so it may or may not work for you. On 2011/10/13 01:15 PM, Reinier

[fpc-pascal] Self pointer existence

2011-04-18 Thread Wimpie Nortje
Hi When does the self pointer's value become valid? I need a reference to the object being created inside the object's own create method. The last statement in Create uses self, but that causes program crashes. Is this too early to use self? Is there another way?

Re: [fpc-pascal] Self pointer existence

2011-04-18 Thread Wimpie Nortje
Thanks There is probably a bug in your code, but without seeing the code there is no way to tell. It was something to do with converting strings to pchar before passing to a C library. Looks like it is fixed now ___ fpc-pascal maillist -

[fpc-pascal] Variable argument list for cdecl functions

2011-04-14 Thread Wimpie Nortje
Hi How do one access the array of const members for a function declared as cdecl? Eg. function A(args: array of const): integer;cdecl; I get a warning that cdecl'ared functions have no high parameter, which now makes sense to me since I tried to use High(args)

[fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
Hi, Is it safe to create a dynamic array with setlength() in one thread and free the array using finalize() in another thread? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
Thanks for the resonse Jonas Is it safe to create a dynamic array with setlength() in one thread and free the array using finalize() in another thread? Normally, you should not call finalize() on dynamic arrays. When the last reference to a dynamic array goes out of scope, it is finalised

Re: [fpc-pascal] Sharing dynamic arrays between threads

2011-02-25 Thread Wimpie Nortje
Calling dispose() on a record with a dynamic array field will free the array (and recursively finalize all its elements) as long as the pointer on which you call it is correctly typed in the source code. The fact that you still get memory leaks after everything you are doing suggests that

[fpc-pascal] Context of TThread.OnTerminate

2011-02-24 Thread Wimpie Nortje
Hi everybody, The manual (possibly Delphi one) says that TThread.OnTerminate executes in the GUI thread. This is easy if the GUI thread owns the TThread. Suppose the GUI owns a TTHread which owns a subthread. In which context does the subthread's OnTerminate execute? Thanks

Re: [fpc-pascal] Context of TThread.OnTerminate

2011-02-24 Thread Wimpie Nortje
Thanks Mattias and Michael On 2011/02/24 05:51 PM, michael.vancann...@wisa.be wrote: On Thu, 24 Feb 2011, Wimpie Nortje wrote: Hi everybody, The manual (possibly Delphi one) says that TThread.OnTerminate executes in the GUI thread. This is easy if the GUI thread owns the TThread

Re: [fpc-pascal] [ANN] BeepFp v1.1 released

2010-04-20 Thread Wimpie Nortje
I don't understand what you mean Johann Glaser wrote: Isn't that as easy as just using Write(^G); ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] [ANN] BeepFp v1.1 released

2010-04-19 Thread Wimpie Nortje
Release note: - BeepFp 1.1 was released on April 18, 2010. BeepFp is a Free Pascal component to provide BEEP services in the object pascal language. It is written as a binding on top of Vortex library. Changes from v1.0 --- - BeepFp events are now triggered

[fpc-pascal] Determining procedure's name

2010-03-03 Thread Wimpie Nortje
Hello everybody, Is there a macro or function that gives the current procedure's name? E.g. procedure TClass.SomeProc; begin writeln(Format('This procedure's name is %s', [THE_MACRO])); end; should print This procedure's name is TClass.SomeProc or This procedure's name is SomeProc

Re: [fpc-pascal] Determining procedure's name

2010-03-03 Thread Wimpie Nortje
Thanks, I will look at the suggestions Mattias Gaertner wrote: On Wed, 03 Mar 2010 21:33:45 +0200 Wimpie Nortje wimpienor...@gmail.com wrote: Hello everybody, Is there a macro or function that gives the current procedure's name? E.g. procedure TClass.SomeProc; begin writeln(Format

Re: [fpc-pascal] Thread IDs

2010-02-19 Thread Wimpie Nortje
I found some inconsistencies a couple of months ago, but never got to creating a bug report: http://www.mail-archive.com/fpc-pascal@lists.freepascal.org/msg17337.html lists.freepascal.org seems down, so I found this link. VIncent ___ fpc-pascal

[fpc-pascal] Thread IDs

2010-02-18 Thread Wimpie Nortje
Hello list, What is the difference between GetThreadID() and GetCurrentThreadID()? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Thread IDs

2010-02-18 Thread Wimpie Nortje
Jonas Maebe wrote: On 18 Feb 2010, at 16:35, Wimpie Nortje wrote: What is the difference between GetThreadID() and GetCurrentThreadID()? There is a threadvar called threadid in the system unit. When a new thread is started, GetCurrentThreadID is called to obtain the thread id of the new

[fpc-pascal] C thread callbacks

2010-02-17 Thread Wimpie Nortje
Hi I have a C library that uses threads. These threads use callbacks into my pascal for events. What must happen for the pascal events handlers to be able to safely access the main thread's resources? This is the same situation where I would use TThread.Synchronize if the threads were

Re: [fpc-pascal] YAML support

2010-02-03 Thread Wimpie Nortje
JSON is not related to YAML at all except in that it is a simple data format. That's true, but from the yaml v1.2 spec: YAML can therefore be viewed as a natural superset of JSON, offering improved human readability and a more complete information model. This is also the case in practice;

Re: [fpc-pascal] Swopping two items in TCollection

2010-01-16 Thread Wimpie Nortje
Done. http://bugs.freepascal.org/view.php?id=15517 Michael Van Canneyt wrote: Please do, this way we won't forget it. Michael. On Thu, 14 Jan 2010, Wimpie Nortje wrote: Thanks. An exhange() would be usefull. Should I file a bug report? Michael Van Canneyt wrote: On Thu, 14 Jan 2010

Re: [fpc-pascal] Swopping two items in TCollection

2010-01-14 Thread Wimpie Nortje
Thanks. An exhange() would be usefull. Should I file a bug report? Michael Van Canneyt wrote: On Thu, 14 Jan 2010, Wimpie Nortje wrote: Hi list I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem

[fpc-pascal] Swopping two items in TCollection

2010-01-13 Thread Wimpie Nortje
Hi list I have a class derived from Tcollection, holding items derived from TCollectionItem. How do I swop two items in the collection? FItem is of type TList which has an exchange function, but that is private and not accessable to me. ___

[fpc-pascal] Where do I contribute units to?

2009-11-26 Thread Wimpie Nortje
Hi all I have translated a C header file for interfacing with a National Instruments data acquisition device. This is a standalone, independant unit which will rarely if ever change. It also has no dependancy on lazarus. Where is the best place to put these kinds of files? The lazarus CCR? I

[fpc-pascal] Using C functions

2009-11-21 Thread Wimpie Nortje
Hi all, Is there any way to use a C library that use the __fastcall calling convention? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Using C functions

2009-11-21 Thread Wimpie Nortje
Jonas Maebe wrote: On 21 Nov 2009, at 20:16, Wimpie Nortje wrote: Is there any way to use a C library that use the __fastcall calling convention? Not at this time. Also note that that the fastcall convention is not standardised and varies between different C compilers. Thanks

[fpc-pascal] h2pas truncates strings

2009-11-10 Thread Wimpie Nortje
Hallo I am trying to convert a .h to pascal with h2pas. The header file contains many declarations with lines of 400 characters or longer. h2pas creates the *.tmp.h file with all the code intact but the .pas file's lines are cut off at 256 characters. Is there an easy way around this

Re: [fpc-pascal] h2pas truncates strings

2009-11-10 Thread Wimpie Nortje
Thanks, I will try that. Henry Vermaak wrote: 2009/11/10 Wimpie Nortje wimpienor...@gmail.com: Hallo I am trying to convert a .h to pascal with h2pas. The header file contains many declarations with lines of 400 characters or longer. h2pas creates the *.tmp.h file with all the code intact

Re: [fpc-pascal] h2pas truncates strings

2009-11-10 Thread Wimpie Nortje
and lex files for? Henry Vermaak wrote: 2009/11/10 Wimpie Nortje wimpienor...@gmail.com: Hallo I am trying to convert a .h to pascal with h2pas. The header file contains many declarations with lines of 400 characters or longer. h2pas creates the *.tmp.h file with all the code intact

Re: [fpc-pascal] h2pas truncates strings

2009-11-10 Thread Wimpie Nortje
indent can only add or delete whitespace. Comments that start with // and extend beyond the -lcn limit are left alone. Henry Vermaak wrote: 2009/11/10 Wimpie Nortje wimpienor...@gmail.com: Ok, I've tried indent and it doesn't do the job because the comments are also 400 chars long

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Wimpie Nortje
Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin Application.StopDaemons(True); Application.Terminate; end; If it doesn't, something is wrong

Re: [fpc-pascal] Stopping daemon in linux

2009-11-09 Thread Wimpie Nortje
Joost van der Sluis wrote: On Mon, 2009-11-09 at 13:02 +0200, Wimpie Nortje wrote: Michael Van Canneyt wrote: It should stop the daemons properly. This is the code that gets executed: Procedure DoShutDown(Sig : Longint; Info : PSigInfo; Context : PSigContext); cdecl; begin

[fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Hi I am writing an application using lazdaemon. How does one stop the daemon gracefully, ie not killing it. The wiki says the daemon runs until it receives the TERM signal. THe only way I know to send the TERM signal is using 'kill'. This kills the app rather letting it exit gracefully.

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marco van de Voort wrote: In our previous episode, Wimpie Nortje said: I am writing an application using lazdaemon. How does one stop the daemon gracefully, ie not killing it. The wiki says the daemon runs until it receives the TERM signal. THe only way I know to send the TERM signal

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marco van de Voort wrote: No plans yet. The problem is also a bit that whatever you do is an island. I think this is more something for freedesktop to standarize first. I know there is a standard/recomended way to write a daemon. If you use KDevelop it will create such a template. I

Re: [fpc-pascal] Stopping daemon in linux

2009-11-08 Thread Wimpie Nortje
Marc Santhoff wrote: You can send any defined signal using kill. Try: # kill -TERM yourdeamon for sending the TERM signal. At least FreeBSDs kill works that way. If yours doesn't try: That is what I did. This doesn't run my daemon's exit routines. I don't know if Linux just kills the

Re: [fpc-pascal] Byte array manipulation

2009-08-17 Thread Wimpie Nortje
Andrew Brunner wrote: Hi there, I have a ByteArray unit that's pretty extensive. function toString(Var Item:TByteArray):string var iLen:Integer; begin iLen:=System.Length(Item); SetLength(Result,iLen); if iLen0 then System.Move(Item[0],Result[1],iLen); end; Thanks, this will be a

[fpc-pascal] Byte array manipulation

2009-08-16 Thread Wimpie Nortje
Hi all, I have a lot of byte arrays which contains mostly text but also #0. I am looking for functions to manipulate these arrays. The stuff in strutils are mainly what I need but they operate on strings which is not usable to me due to the #0. Are there any such functions in FPC? And

Re: [fpc-pascal] Byte array manipulation

2009-08-16 Thread Wimpie Nortje
theo wrote: AnsiString does not have problems with #0. Test: var aStr:AnsiString; begin aStr:='test-test-test'; aStr:=StringReplace(aStr,'-',#0,[rfReplaceAll]); //if you ouput now, you'll only see 'test'... aStr:=StringReplace(aStr,#0,'-',[rfReplaceAll]); //...but the text is still in the

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-05 Thread Wimpie Nortje
Jonas Maebe wrote: I think the easiest way for you to do this would be to do something similar to what the FPC rtl does: write your own function that does all of this initialisation, and pass that one to pthread_create as the function to run in the new thread. Then from this function perform

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-03 Thread Wimpie Nortje
wrote: On 02 Aug 2009, at 20:02, Wimpie Nortje wrote: Thanks for the response. The library uses a centralised function to start all its threads using pthread_create. If I can make this central function inform FPC about all the threads created, would this work? There is no interface

Re: [fpc-pascal] Stack problem in externally called callback function

2009-08-02 Thread Wimpie Nortje
Thanks, I'll have a look Jonas Maebe wrote: On 02 Aug 2009, at 20:02, Wimpie Nortje wrote: Thanks for the response. The library uses a centralised function to start all its threads using pthread_create. If I can make this central function inform FPC about all the threads created, would

[fpc-pascal] Stack problem in externally called callback function

2009-07-31 Thread Wimpie Nortje
Hi everybody, I am trying to use a shared lib written in C in my FPC program. The lib creates a number of threads and requires callbacks into the main app. It can call the callback from any of the threads. When I compile without stack checking everything (seems) to work fine but when stack