Re: [fpc-pascal] problems using utf8toansi

2007-12-10 Thread Jonas Maebe


On 10 Dec 2007, at 08:43, Marc Santhoff wrote:

You can compile with -al and search for CWSTRING in the assembler  
file
generated for your main program. Since that unit has an  
initialization
section, it will be in the init/final table if it's included  
somewhere.


Hm, that's funny, the string is not found.

I did:

$ fpc -Fu../zipfile -al -B -FE./bin TestDocInfo
$ grep -i CWSTRING bin/*.s

and the output was empty.

Meanwhile I had some look and found that DOM is using a type  
"DOMString"

everywhere which itself is defined as

DOMString = WideString;

so that is an indicator for using widestrings? The uses-line looks  
like

this:

uses
  {$IFDEF MEM_CHECK}MemCheck,{$ENDIF}
  SysUtils, Classes, AVL_Tree;

Confusing ...


The system and sysutils units contain bare metal widestring support:  
i.e., widestring support which only works (as far as alphabetical  
ordering, upper/lowercase support and converting from/to ansistrings  
is concerned) with ascii values <= #127. It is perfectly possible to  
use widestrings in that way, but then they are simply using twice the  
memory for no gain whatsoever.


You have to add cwstring on any *nix platform to get actual ansi/ 
widestring support for your current locale. If you don't, anything  
can happen.



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


Re: [fpc-pascal] problems using utf8toansi

2007-12-10 Thread Marc Santhoff
Am Montag, den 10.12.2007, 11:10 +0100 schrieb Jonas Maebe:
> On 10 Dec 2007, at 08:43, Marc Santhoff wrote:

> > Confusing ...
> 
> The system and sysutils units contain bare metal widestring support:  
> i.e., widestring support which only works (as far as alphabetical  
> ordering, upper/lowercase support and converting from/to ansistrings  
> is concerned) with ascii values <= #127. It is perfectly possible to  
> use widestrings in that way, but then they are simply using twice the  
> memory for no gain whatsoever.
> 
> You have to add cwstring on any *nix platform to get actual ansi/ 
> widestring support for your current locale. If you don't, anything  
> can happen.

Now thing are getting clear. I'll look at sysutils and try out the
behaviour in both cases to be safe.

Thank you,
Marc


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


Re: [fpc-pascal] cross compiling enigma

2007-12-10 Thread Sam Liddicott
Jonas Maebe wrote:
>
> On 08 Dec 2007, at 19:26, Sam Liddicott wrote:
>
>>> So... because the makefile knew it was compiling for the same
>>> architecture it decided that I wasn't building an fpc cross compiler
>>> but cross building an fpc compiler? That's a bit unexpectedly clever...
>> So... this time:
>> $ make clean all CPU_TARGET=powerpc OS_TARGET=linux FPC=/usr/bin/ppc386
>> BINUTILSPREFIX=/usr/bin/powerpc-linux-gnu-
>>
>> And, just like before, it has created a load of powerpc binaries:
>>
>> $ file /≈/usr/bin/postw32
>> /tmp/fpc_patchdir/fpc_build/usr/bin/postw32: ELF 32-bit MSB executable,
>> PowerPC or cisco 4500, version 1 (SYSV), statically linked, stripped
>
> "make clean all" does not put anything in usr/bin, so you at least alo
> have done a "make install" afterwards.

Yes, I'm modifying lazarus's create_fpc_deb.sh so it can also create
cross-compiler debs as well (this being simpler than fixing the scripts
in cross_unix)

>
>> So I'm still puzzled that the recipe for creating a cross compiler is
>> actually cross-compiling a compiler and cross-compiling the tools.
>>
>> Of course,  compiler/ppcrossppc was created, but it seems as a precursor
>> to creating all the powerpc binaries.
>
> It's a cross compiler, which is indeed necessary to create PowerPC
> binaries.
>

yes... I was expecting ppcrossppc to be created, the rest was surprising me

>> So I still think I'm doing it wrong; was my make command line correct to
>> produce an fpc instance that will cross-compile for powerpc-linux?
>
> Cross compilers are only intended as add-ons to a native compiler
> suite. If you do a plain install, the Makefiles assume you want to
> create a native install for the target platform (although currently
> this will only work consistently if both the source and target
> platform have the same endianess).
>
> If you want to perform an add-on cross install (which will only
> install the cross compiler and units, but not the PowerPC-native
> compiler and utilities -- as the natively installed versions of those
> utilities will be used), do something like this:
>
> make FPC=`pwd`/compiler/ppcrossppc
> INSTALL_PREFIX=/tmp/fpc_patchdir/fpc_build/usr install CROSSINSTALL=1
>

this was the required tip, thanks

> (the CROSSINSTALL=1 may not even be necessary when you point FPC to
> the cross compiler, as the Makefile should detect that it's a cross
> compiler and set that variable itself)

It seems to be needed, and I think I have it working now, apart from
adding stuff to /etc/fpc.cfg when the cross compiler package is installed.

I see that the old cross_unix crosswin32 stuff tries to add like this:

# add -FD and -XP entry for cross compiling
echo '# set binutils paths for crosscompiling # fpc_crosswin32' >>
/etc/fpc.cfg
echo '#IFDEF FPC_CROSSCOMPILING   # fpc_crosswin32' >>
/etc/fpc.cfg
echo '  -XPfpc-i386-win32-' >> /etc/fpc.cfg
echo '#ENDIF  # fpc_crosswin32' >>
/etc/fpc.cfg
# end.


But that seems to presume there will be only one cross compiler
installed; do you have any hints on what to add to fpc.cfg?

Thank

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