[fpc-pascal] FPC programs in Android without JNI

2010-12-06 Thread Felipe Monteiro de Carvalho
Hello,

There was already a previous thread about Android apps with JNI, so I
thought I should start one for discussing non-JNI apps, which means
that I am really running executables as opposed to linking a .so to
Java via JNI.

I succeeded in running a simple FPC Pascal application in Android and
showing it's WriteLn output in a message dialog:

http://p-tools.svn.sourceforge.net/viewvc/p-tools/PascalNotes4Android/?pathrev=190

Basically you need to rename your app so that it looks like a .so and
then upon initialization the Java app needs to copy it to a folder
where it can run the application. The folder is returned by
getApplicationContext().getFilesDir which points to
/data/data/packagename/ and then I use chmod to make the executable
runnable.

I don't know how it will fare for apps running for prolonged amounts
of time at the moment, some Android developers said it is possible
that it won't work.

The Pascal app needs to be compiled separately and placed in the
lib/eabi folder. Then after that issue "ant debug" to build the APK
installer.

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


[fpc-pascal] make[4]: i386-win32-as: (command not found)

2010-12-06 Thread Osvaldo Filho
make clean all CPU_TARGET=i386 OS_TARGET=win32
make install CPU_TARGET=i386 OS_TARGET=win32
PREFIX=/home/kxu/DevPascal/fpc_inst/fpc_win32 FPC_VERSION=2.4.3

make -C hermes smart
make[3]: Entrando no diretório
`/home/deskxu/DevPascal/fpc_inst_scripts/fpc/packages/hermes'
make all LINKSMART=1 CREATESMART=1
make[4]: Entrando no diretório
`/home/deskxu/DevPascal/fpc_inst_scripts/fpc/packages/hermes'
i386-win32-as --32 -o units/i386-win32/mmx_clr.o src/i386/mmx_clr.as
*make[4]: i386-win32-as: Comando não encontrado* (command not found)
make[4]: ** [mmx_clr.o] Erro 127
make[4]: Saindo do diretório
`/home/deskxu/DevPascal/fpc_inst_scripts/fpc/packages/hermes'
make[3]: ** [fpc_smart] Erro 2
make[3]: Saindo do diretório
`/home/deskxu/DevPascal/fpc_inst_scripts/fpc/packages/hermes'
make[2]: ** [hermes_smart] Erro 2
make[2]: Saindo do diretório
`/home/deskxu/DevPascal/fpc_inst_scripts/fpc/packages'
make[1]: ** [packages_smart] Erro 2
make[1]: Saindo do diretório `/home/deskxu/DevPascal/fpc_inst_scripts/fpc'
make: ** [build-stamp.i386-win32] Erro 2
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] 2D Dynamic arrays and BlockRead

2010-12-06 Thread Marc Weustink

On 3-12-2010 17:26, Jürgen Hestermann wrote:

andrew.benn...@ns.sympatico.ca schrieb:

After using BlockRead to fill a 2D dynamic array, I get an access
violation on the very first reference. A 2D array with only one
dimension dynamic works OK.
What am I missing?

Maybe you blundered into the same trap as so many others who do not know
that dynamic arrays are *pointers* (to arrays). It is one of the sins
done by Borland to abandon the once strict logic that in Pascal the
syntax is always context independend. Now this is no longer the case
(i.e. for dynamic arrays).

in your example

STat = Array[0..W-1] Of Single ; { Static array }
DST = Array Of STat ; { One dimension dynamic, the other static }
D2T = Array Of Array Of Single ; { Two dynamic dimensions }

STat always means the address starting with STat[0] (context independend).
Also DST always means the address where DST[0].


Nope, there is a difference between DST and DST[0]. DST won't give you 
the first element. You can try this youself with an untyped parameter:


procedure Foo(const AParam);
begin
  WriteLN(Single(APAram));
end;


You will see a difference between passing DST or DST[0]

To be safe, for any N-dimension dynamic array always use [0,..,0]  to 
pass the first element. To avoid confusion, you can do this for static 
arrays too.



But D2T is a pointer which can be either the the address of the pointer
(in all low level routines like fillchar, sizeof, BlockRead/-Write etc.)
but also can be the address of the D2T[0] because you can refer to
elements without the need to dereference it as in D2T^[0].


In behaviour DST and D2T wont differ.

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


[fpc-pascal] Compile 2.5.1 Ubuntu

2010-12-06 Thread José Mejuto
Hello FPC-Pascal,

There are several months since I recompiled my 2.5.1 (SVN) in Ubuntu,
today I had installed 2.4.2 and tried to recompile SVN today, but:

/home/joshy/pascal/fpc/compiler/ppc386 -XX -CX -Ur -Xs -O2 -n -S2 
-Fu/home/joshy/pascal/fpc/rtl/units/i386-linux 
-Fu/home/joshy/pascal/fpc/packages/hermes 
-Fu/home/joshy/pascal/fpc/packages/fcl-base/units/i386-linux 
-Fu/home/joshy/pascal/fpc/packages/x11/units/i386-linux 
-Fu/home/joshy/pascal/fpc/packages/ptc 
-Fu/home/joshy/pascal/fpc/packages/pthreads/units/i386-linux 
-Fu/home/joshy/pascal/fpc/packages/sdl/units/i386-linux -Fisrc/linux -Fisrc/inc 
-Fisrc/unix -FE. -FUunits/i386-linux -Fl/usr/lib/gcc/i486-linux-gnu/4.3.3 
-Flinclude -Fl/etc/ld.so.conf.d/*.conf -di386 -dRELEASE src/ptcgraph/ptcgraph.pp
Fatal: Can't find unit ptc used by ptcgraph
Fatal: Compilation aborted
make[4]: *** [ptcgraph.ppu] Error 1
make[4]: se sale del directorio `/home/joshy/pascal/fpc/packages/graph'
make[3]: *** [fpc_smart] Error 2
make[3]: se sale del directorio `/home/joshy/pascal/fpc/packages/graph'
make[2]: *** [graph_smart] Error 2
make[2]: se sale del directorio `/home/joshy/pascal/fpc/packages'
make[1]: *** [packages_smart] Error 2
make[1]: se sale del directorio `/home/joshy/pascal/fpc'
make: *** [build-stamp.i386-linux] Error 2

Any idea ? "make clean all install"

-- 
Best regards,
 José

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