[fpc-pascal] Re: Widestrings length and character iteration

2007-05-08 Thread Christos Chryssochoidis




Daniël Mantione wrote:
>
> Op Mon, 7 May 2007, schreef Christos Chryssochoidis:
>
>> Hi,
>>
>> Are there any rtl functions to compute the length (in characters) of a
>> widestring and to iterate over its characters?
>
> If you treat it as UCS-2: length(widestring_variable)
>
>>  In my system (Mac OS X/fpc 2.1.3), a widestring is implemented as a 
UTF-8

>> encoded string, as I found out.
>
> Not possible, a widestring is UCS-2/UTF-16.

 I defined a widestring with 7 characters (code points), and the 
length() function returned the value 15. Of the 7 code points of that 
widestring only one of them was greater than $07FF (the maximum code 
point which can be encoded in 2 bytes under UTF-8). When I changed that 
character with another one with code not greater than $07FF, length() 
returned value 14... I also printed the byte values of one of the 
widestring's widechars, and the values printed indicated UTF-8 encoding.


Thanks,
Christos


>
> Daniël
>
>
> 
>
> ___
> fpc-pascal maillist  - 
[EMAIL PROTECTED]

> 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] libsndfile library

2007-05-08 Thread Tiziano_mk

Marco van de Voort wrote:

Ok, I'll try that, thanks. But the same problem could happen in other 
PCs where my program could be deployed...


Yes and no.

No: It will probably add a dependancy to libsndfile.so.1  (not .so
or .so.1.0.12). And that is installed.

Yes: the library must be present, and  under that name, and there is no
guarantee. But that at least will be ok for Ubuntu.

The only way around it is to enter the complex package building and add a
dependancy on the file, a system that varies from distro to distro, unix
variant to unix variant (iow, to package your app as a package for each
(family of) distribution(s)).
 
So I turn back to the inital question: there is a more affordable way to 
play a sound file on a Linux Machine?


No. This is a general library and packaging problematic. No library is 100%
guaranteed on Linux, even glibc can be replaced by some embedded variant.


ok, then I'll drive on the simpler way:

...
with myprocess do
 begin
   commandline:= 'aplay x1.wav';
   execute;
 end;
...

(with a section in a file .ini in order to change the command on 
distributions where aplay has another name)



Anyway:
simply creating the symlink libsndfile.so did not solve the matter:

sfplay.o: In function `PLAYFILE':sfplay.pp:57: undefined reference to 
`sf_open_read'

sound.pas(45,1) Error: Error while linking


--
for bartek:
the main reason of my problem is that my PC is not connected to Internet

SDL is great but the problem is the same, not all Linux distributions 
have it installed.


for mark:
I am not a Linux user, sorry. All that seems too complex to me, but I'll 
try to investigate :-)


thanks to all
tiziano



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


Re: [fpc-pascal] Re: Widestrings length and character iteration

2007-05-08 Thread Daniël Mantione


Op Mon, 7 May 2007, schreef Christos Chryssochoidis:

> Daniël Mantione wrote:
> > 
> > Not possible, a widestring is UCS-2/UTF-16.
> 
>  I defined a widestring with 7 characters (code points), and the length()
> function returned the value 15. Of the 7 code points of that widestring only
> one of them was greater than $07FF (the maximum code point which can be
> encoded in 2 bytes under UTF-8). When I changed that character with another
> one with code not greater than $07FF, length() returned value 14... I also
> printed the byte values of one of the widestring's widechars, and the values
> printed indicated UTF-8 encoding.

Yes, the program output is utf-8 on OS-X, because this is the native 
encoding for OS-X. However, widestrings are not utf-8. Can you show your 
code?

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Henry Vermaak

On 04/05/07, Helmut Hartl <[EMAIL PROTECTED]> wrote:


Well - that was what i would like to do - I thougt i try it
using libc, as i hade some old code who was doing it just that way.

But also the following:

program nslu_test;
{$mode objfpc}{$H+}
{$linklib c}
begin
 writeln('Hello');
end.

> ppcrossarm -XParm-linux- -CfSOFT nslu_test.lpr -Xd -Xr/usr/armlib

Fails with:

Free Pascal Compiler version 2.3.1 [2007/05/03] for arm
Copyright (c) 1993-2007 by Florian Klaempfl
Target OS: Linux for ARM
Compiling nslu_test.lpr
Assembling nslu_test
Linking nslu_test
/usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
`_haltproc':
: undefined reference to `_fini'
/usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
`_haltproc':
: undefined reference to `_init'
nslu_test.lpr(7,17) Error: Error while linking
nslu_test.lpr(7,17) Fatal: There were 1 errors compiling module,
stopping
Fatal: Compilation aborted


Am i using the compiler switches wrong?
In "/usr/armlib" are the objects files of the slugosle build process ...



i vaguely remember getting this kind of problem too.  my arm-linux-ld
for the slug doesn't like my fpc object files at all.  as a last
resort i used the --allow-shlib-undefined option for ld and that
worked for me...


Thank you,

helmut


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


RE: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Helmut Hartl
>  > linux (v 2.3.1)
>  > > nslu_test.lpr Assembling nslu_test Linking nslu_test
>  > > /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
>  > > `_haltproc':
>  > > : undefined reference to `_fini'
>  > > /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
>  > > `_haltproc':
>  > > : undefined reference to `_init'
>  >
>  > i vaguely remember getting this kind of problem too.  my
>  > arm-linux-ld for the slug doesn't like my fpc object files
>  > at all.  as a last resort i used the --allow-shlib-undefined
>  > option for ld and that worked for me...

Well - Thank you -> It now works and i got libc, sockets, ssl and much
of our code to run on the SLUG 
(I am really happy with possibilities of the crossarm compiler!!)
Now we have strange problems with range errors and so on, needs further
investigations ...

To circumvent the above mentioned error it is necessary to replace (copy
over) cprt0.o with prt0.o as
It seems that _fini and _init are not needed (strange ?) i found a
message from 2005 in the fpc list, in which this method was described.

BTW: I use the head revision of slugosle (openembedded) we took little
endian because debian chose that too.
If it helps you can download an archive of my compiled binutils under 
http://zeosdownloads.firmos.at/downloads/

Regards,
helmut

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


Re: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Henry Vermaak

On 08/05/07, Helmut Hartl <[EMAIL PROTECTED]> wrote:

Well - Thank you -> It now works and i got libc, sockets, ssl and much
of our code to run on the SLUG
(I am really happy with possibilities of the crossarm compiler!!)
Now we have strange problems with range errors and so on, needs further
investigations ...


excellent!


To circumvent the above mentioned error it is necessary to replace (copy
over) cprt0.o with prt0.o as
It seems that _fini and _init are not needed (strange ?) i found a
message from 2005 in the fpc list, in which this method was described.


i didn't really look into this and i think it might be hard to
investigate.  my programs seem to work as expected (to an extent) when
passing this option to ld.  it only happens when i link to the slug
libraries, though.


BTW: I use the head revision of slugosle (openembedded) we took little
endian because debian chose that too.
If it helps you can download an archive of my compiled binutils under
http://zeosdownloads.firmos.at/downloads/

Regards,
helmut



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


[fpc-pascal] operator overloading question

2007-05-08 Thread Alexey Pavluchenko
Hello all,

When trying to compile the following code

=== cut===
unit foo;

interface

  type tbar = record
somefield: integer;
  end;
   pbar = ^tbar;

  operator + (a: pbar; b: pbar) c: pbar;

implementation

  operator + (a: pbar; b: pbar) c: pbar;
  begin
  end;

end.
=== cut===

the compiler (2.0.4) stops with the "impossible operator overload"
message. Two questions arise: 1) why is it considered impossible and
2) how can I workaround this?

-- 
Best regards,
 Alexey


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


Re: [fpc-pascal] operator overloading question

2007-05-08 Thread Daniël Mantione


Op Tue, 8 May 2007, schreef Alexey Pavluchenko:

> the compiler (2.0.4) stops with the "impossible operator overload"
> message. Two questions arise: 1) why is it considered impossible

Overloading pointers turned out to be too problematic in the past, so it 
was to be disabled. Overloading dynamically allocated data structures is 
problematic anyway due to memory management.

> and
> 2) how can I workaround this?

You can overload Tbar instead.

Daniël___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Florian Klaempfl
Helmut Hartl schrieb:
>> why do you want to load libc dynamically?  may you can try
>> the following approach (scroll to bottom):
>> http://community.freepascal.org:1/docs-html/prog/progse53
> 
> Well - that was what i would like to do - I thougt i try it
> using libc, as i hade some old code who was doing it just that way.
> 
> But also the following:
> 
> program nslu_test;
> {$mode objfpc}{$H+}
> {$linklib c}
> begin
>  writeln('Hello');
> end. 
> 
>> ppcrossarm -XParm-linux- -CfSOFT nslu_test.lpr -Xd -Xr/usr/armlib
> 
> Fails with:
> 
> Free Pascal Compiler version 2.3.1 [2007/05/03] for arm
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: Linux for ARM
> Compiling nslu_test.lpr
> Assembling nslu_test
> Linking nslu_test
> /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc':
> : undefined reference to `_fini'
> /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc':
> : undefined reference to `_init'
> nslu_test.lpr(7,17) Error: Error while linking
> nslu_test.lpr(7,17) Fatal: There were 1 errors compiling module,
> stopping
> Fatal: Compilation aborted
> 
> 
> Am i using the compiler switches wrong? 
> In "/usr/armlib" are the objects files of the slugosle build process ...

What libc do you use?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Henry Vermaak

On 08/05/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:


What libc do you use?


i've got libc-2.3.90.so, but if i look at the downloads, the makefile
used a version 2.3.4 from 2005-06-27 (and patched it a couple of
times, no doubt).

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


RE: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread Helmut Hartl
On 08/05/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote:
>
> What libc do you use?

[EMAIL PROTECTED]:~$ /lib/libc.so.6 
GNU C Library development release version 2.3.90, by Roland McGrath et
al.
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 4.1.1.
Compiled on a Linux 2.6.18 system on 2007-05-03.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
Support for some architectures added on, not maintained in glibc
core.
linuxthreads-0.10 by Xavier Leroy
BIND-8.2.3-T5B
libthread_db work sponsored by Alpha Processor Inc
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
For bug reporting instructions, please see:
.


During the make process (openembedded) the library seems to get patched.

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


Re: [fpc-pascal] libsndfile library

2007-05-08 Thread Marc Santhoff
Am Dienstag, den 08.05.2007, 09:51 +0200 schrieb Tiziano_mk:

> for mark:
> I am not a Linux user, sorry. All that seems too complex to me, but I'll 
> try to investigate :-)

What I wrote is pretty easy, I wish Windows has something like this in
the base system - ever had a missing .DLL and windows won't tell you
it's name?

The last mail showed you how to ask "is libsndfile there?" and maybe
"what version does it have?" depending on th naming conventions of your
distribution.

Today I can tell you how to answer the question "does the installed lib
really not have function 'sf_open_read'?":

$nm -D /usr/local/libsndfile.so | grep sf_open_read
$

Hm, no output, funny.

$ nm -D /usr/local/libsndfile.so | grep sf_open
c570 T psf_open_rsrc
3e44 T sf_open
3fb0 T sf_open_fd

Ah, see: this version of the lib only has a bunch of other opening
functions, not based on a filename but on a file descriptor or similar.

Only guessing here, but:
To support older lib version you can use that function instead of the
apparently newer one taking a name or tell people to use at least the
version you have installed. Your package manager (rpm, apt, ...) should
be able to tell you the version number.

After having had a look into the header
file /usr/local/include/sndfile.h it is pretty clear ...

HTH anyways,
Marc


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


RE: [fpc-pascal] some problem in SVN FPC for arm linux (v 2.3.1)

2007-05-08 Thread josepascual (almudi)
hi,

search *.o files in your crosstools and add diretory to ppcarm with -Fl

f.e. 

find /usr/local/arm/armlinux/gcc-3.4.1-glibc-2.3.2 -name "*.o"



> -Mensaje original-
> De: [EMAIL PROTECTED] [mailto:fpc-pascal-
> [EMAIL PROTECTED] En nombre de Helmut Hartl
> Enviado el: viernes, 04 de mayo de 2007 19:56
> Para: FPC-Pascal users discussions
> Asunto: RE: [fpc-pascal] some problem in SVN FPC for arm linux (v
> 2.3.1)
> 
> > why do you want to load libc dynamically?  may you can try
> > the following approach (scroll to bottom):
> > http://community.freepascal.org:1/docs-html/prog/progse53
> 
> Well - that was what i would like to do - I thougt i try it
> using libc, as i hade some old code who was doing it just that way.
> 
> But also the following:
> 
> program nslu_test;
> {$mode objfpc}{$H+}
> {$linklib c}
> begin
>  writeln('Hello');
> end.
> 
> > ppcrossarm -XParm-linux- -CfSOFT nslu_test.lpr -Xd -Xr/usr/armlib
> 
> Fails with:
> 
> Free Pascal Compiler version 2.3.1 [2007/05/03] for arm
> Copyright (c) 1993-2007 by Florian Klaempfl
> Target OS: Linux for ARM
> Compiling nslu_test.lpr
> Assembling nslu_test
> Linking nslu_test
> /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc':
> : undefined reference to `_fini'
> /usr/local/lib/fpc/2.3.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc':
> : undefined reference to `_init'
> nslu_test.lpr(7,17) Error: Error while linking
> nslu_test.lpr(7,17) Fatal: There were 1 errors compiling module,
> stopping
> Fatal: Compilation aborted
> 
> 
> Am i using the compiler switches wrong?
> In "/usr/armlib" are the objects files of the slugosle build process
> ...
> 
> Thank you,
> 
> helmut
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
> 
> __ Informacisn de NOD32, revisisn 2239 (20070504) __
> 
> Este mensaje ha sido analizado con NOD32 antivirus system
> http://www.nod32.com


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


RE: RV: [fpc-pascal] Program exited with code 01

2007-05-08 Thread josepascual (almudi)
Hi,


> On 07/05/07, josepascual (almudi) <[EMAIL PROTECTED]> wrote:
> > >$ ./hello_eabi_arm
> > -bash: ./ hello_eabi_arm: No such file or directory
> ...
> ...
> ...
> > (gdb) run
> > Starting program: /tmp/hello_eabi_arm
> > /bin/bash: /tmp/hello_eabi_arm: No such file or directory
> 
> so the file doesn't exist.  did it not compile?  if you want to link
> to these libraries, you need to make sure that they are somewhere in a
> lib directory under your toolchain.  usually your cross-ld will be
> configured to look for the library in the right place, but otherwise
> you might have to give the option to fpc to look in the right dir for
> those libs.


ppccrossarm generate executable file, error is when I run executable file
from basch.

it's only happens if my program need from libdl and libc

Jose Pascual



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