Re: [fpc-pascal] support for using an activex
On Mon, May 23, 2011 at 1:21 PM, Henrik Genssen henrik.gens...@mediafactory.de wrote: Active-X / OLE objects do not work as far as I remember I don't think that it is a matter of not working (as in something that stops it from working), but rather that noone has researched and developed an way to make that work. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: URIParser
It should assume that sip is a protocol, like it does now. I think that: URI := ParseURI('sip:b...@example.com'); Should output this: Protocol: sip Username: bob Password: Host: example.com Port: 0 Path: Document: Params: Bookmark: HasAuthority: FALSE -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: PDFlib TET - convert using h2pas
The file is not big, why don't you just convert it manually? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: PDFlib TET - convert using h2pas
If you have any question about translating manually I can help. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: PDFlib TET - convert using h2pas
On Wed, May 18, 2011 at 4:43 PM, Marcos Douglas m...@delfire.net wrote: Answer me: if you were to use this lib, which way do you choose? ActiveX (Delphi or FPC), translate header or use another language with support (Java, .NET, Pyhon, Perl, etc... see here http://www.pdflib.com/products/tet/how-to-use-tet/ ). I would translate the headers manually and use that. I am sending back what I translated in 2 minutes of work. You can use as a model. -- Felipe Monteiro de Carvalho tetlib.pas Description: Binary data ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Fatal error Executable image size is too big for wince target
Does anyone know if we have our own internal linker to wince? It seams that yes, but I that's very strange for me. I thought that we have it only for x86-win32. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Fatal error Executable image size is too big for wince target
On Tue, May 17, 2011 at 4:39 PM, Paul Ishenin webpi...@mail.ru wrote: We have it for all windows targets. Interresting. In that case another possible solution is using an external linker instead, as pointed in the forum. One might need to link manually and maybe even build a newer linker from binutils sources. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Next major FPC release?
On Tue, May 10, 2011 at 3:17 PM, Ben ben.smith.li...@gmail.com wrote: Maybe FPC could adopt a similar release schedule as many open source projects do these days - like what was started by Ubuntu. Have a set timeframe or months that releases will happen on. Even commercial companies have difficulty following this model, because a lot of over hours need to be paid if you want to follow a rigid time frame. I guess that it works for Ubuntu simply because their work is mostly packaging and not actually writing software. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Fatal error Executable image size is too big for wince target
Link to the forum discussion on the same topic: http://www.lazarus.freepascal.org/index.php/topic,12971.0.html -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPImage and GetDataLineStart
It also annoys me, but changing would probably be a huge work. All of the image reader/writers would need to be checked... -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] New to freepascal and how to translate my delphi program.
Hello, I have already written such a program and I used the Pascal unit provided by FTTI, because I was using FTTI's USB component: http://wiki.lazarus.freepascal.org/Hardware_Access#FTDI For serial I would probably use Synaser: http://wiki.lazarus.freepascal.org/Hardware_Access#Serial_Communication You might also be interrested in knowing that fpvectorial, a library to read/modify/write vectorial images, exists: http://wiki.lazarus.freepascal.org/fpvectorial I used it in my program to read PDF files (generated by CorelDraw) and convert them to g-code. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] DIFF Pascal component
Hello, I was wondering if anyone knows a good Pascal component for generating a diff in the standard format. Googling I found TDiff here: http://angusj.com/delphi/ Maybe there is something else as well? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] New to freepascal and how to translate my delphi program.
On Mon, Apr 18, 2011 at 2:45 PM, Marcos Douglas m...@delfire.net wrote: Like read the text of PDF files? No, vectorial drawings. PDF can hold raster images, vectorial drawings and/or rich text. In CorelDraw in the dialog to export to PDF there is an option Convert text to vectors, that's what we used. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
On Tue, Apr 12, 2011 at 6:43 PM, Darius Blaszyk dhkblas...@zeelandnet.nl wrote: Hi Felipe, Nice work. I have been playing with FreeType as well to have it render on OpenGL. For that I ported some code from the web and modified it slightly. The result is a bitmapped font for OpenGL. You can find the code here: http://scandraid.svn.sourceforge.net/viewvc/scandraid/src/branches/font/ Regards, Darius For me it proved less useful. I wanted to read the name of Face objects, but it seams that this feature is only in TrueType 2 =( -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: stripping HTML
2011/4/17 Roland Schäfer roland.schae...@fu-berlin.de: Yes, that looks perfect. I wouldn't even have a problem with the license or with paying for it, and I even still have D7. However, my program has to run on our Debian 64-bit servers. You could contact the authors and say that you would like to buy a license if it works in FPC linux-x86-64 -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Installing FPC 2.5.1 in Mac OS X
Hello, Ok, I managed to fix my problem: user-46-113-147-187:carbon felipe$ cd /usr/local/lib/fpc/2.5.1/ user-46-113-147-187:2.5.1 felipe$ which fpcres /usr/local/bin/fpcres user-46-113-147-187:2.5.1 felipe$ sudo ln -s /usr/local/bin/fpcres fpcres -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Installing FPC 2.5.1 in Mac OS X
Hello, I am trying to install FPC 2.5.1 in Mac OS X. So I tryed this steps: 1 I have FPC 2.4.2 working fine 2 cd fpctrunk make clean make all sudo make install 3 In Lazarus set the new compiler to /usr/local/bin/fpc/2.5.1/ppc386 4 Build LCL-Cocoa (works fine) 5 Build a trivial LCL project, I get somethink like this as an error: Cannot find Resource Compiler fpcres But it is in my path =o So I tryed to compile with -va And I got nothing helpful ... I removed all {$R } statements from my project and it didn't help. Any ideas? I'll try again something at home, but now I'm at work, so because of that I cannot copy exact error messages. Just though that maybe someone will have an idea for me to try at home... thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Installing FPC 2.5.1 in Mac OS X
On Fri, Apr 15, 2011 at 4:11 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: And does it work when you manually execute it? As in just typing: fpcres ? Yes, then it shows a help message -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Installing FPC 2.5.1 in Mac OS X
Ok, very wierd now =D If I go to the command line and type: user-46-113-151-158:cocoa felipe$ /usr/local/lib/fpc/2.5.1/ppc386 -MObjFPC -Scghi -O1 -gl -k-framework -kCocoa -WG -vewnhi -l -Filib/i386-darwin -Fu../../lazarus/lcl/units/i386-darwin/cocoa -Fu../../lazarus/lcl/units/i386-darwin -Fu../../lazarus/packager/units/i386-darwin -Fu. -FUlib/i386-darwin/ -va -dLCL -dLCLcocoa cocoatest.lpr It works fine (I just copied the options which Lazarus says it uses) But form the IDE I get: Options changed, recompiling clean with -B Hint: Start of reading config file /etc/fpc.cfg Hint: End of reading config file /etc/fpc.cfg Free Pascal Compiler version 2.5.1 [2011/04/15] for i386 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Darwin for i386 Compiling cocoatest.lpr Compiling mainform.pas Assembling (pipe) /Users/felipe/Programas/tests/cocoa/lib/i386-darwin/mainform.s Assembling (pipe) /Users/felipe/Programas/tests/cocoa/lib/i386-darwin/cocoatest.s cocoatest.lpr(15,32) Error: resource compiler fpcres not found, switching to external mode cocoatest.lpr(15,32) Fatal: There were 1 errors compiling module, stopping -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: android share library with classes unit
Forwarding to the mailling list: On Thu, Apr 14, 2011 at 4:09 AM, heru susanto her...@gmail.com wrote: I've done the second step here : #!/bin/sh /usr/local/bin/arm-linux-as_org -march=armv6 -meabi=5 -mfloat-abi=softfp -mfpu=vfp3 $@ my problem have been solved. my next problem is dynamic linking. thank you herux On Wed, Apr 13, 2011 at 3:29 PM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Have you done Step 2 described here: http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre-compiled_compiler ? I know that those instructions are different from what you are doing, but Step 2 should apply anyway. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: android share library with classes unit
Have you done Step 2 described here: http://wiki.lazarus.freepascal.org/Android_Interface#Using_the_pre-compiled_compiler ? I know that those instructions are different from what you are doing, but Step 2 should apply anyway. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
Hello, I fixed the compilation of the old freetype and put it in the Lazarus-ccr for now. Maybe it can be added to FPC later on if it proves a good substitute: http://wiki.lazarus.freepascal.org/Freetype#Download http://www.koders.com/delphi/fidEAE4D251909342259720229735A9CBF6C74B15AB.aspx?s=delphi+freetype#L40 I prefered to take the sources from here: http://cvsweb.xfree86.org/cvsweb/xc/extras/FreeType/pascal/lib/Attic/ It's not maintained anymore - but imho has nothing todo with fornix ? From what I saw fornix has nothing to do with it. Probably they just used this library in one of their projects, like X11 uses. (Have a look at : http://www.freetype.org/freetype1/index.html, and the name of the authors ...) What's special with the name of the authors? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] TMenu - barbreak Delphi Compatbility.
In the same way: Set the caption of the item which is a separator to - without quotes -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compiling android example
It might be useful to know that I rebased my trunk to a new project, systeminfo4android which is a simple program that I wrote to help me at work. It calculates the reported screen diameter in inches, as well as all data from DisplayMetrics. I documented this here: http://wiki.lazarus.freepascal.org/Android4Pascal Updating (if desired, since not much changed) is easy, just copy the *pas and *java files to your project. The java ones of course need to have some stuff renamed as usual. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: TFPImageCanvas TextOut raise an exception
In the wiki there is a tutorial, but the wiki seams down at the moment. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Creating windows cross arm-linux ppcarm compiler.
The first step would be obtaining the correct binutils. In Linux I just install via urpmi. There are some instructions to build from source in the wiki. Maybe there are precompiled ones, but I dont know where. After that you need a working install of FPC 2.4.2, download FPC 2.5.2 trunk from svn and make a batch script with some commands to build. You probably could just use the source from FPC 2.4.2 for that, but I usually use svn for no particular reason. I dont know the exact commands, some months ago I started a thread about this in this mailling listbut for Linux-arm-linux and in the end I got a working command. The Windows one should be similar. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Font reading library
Hello, I just tought I'd ask: Do we have a Pascal library for reading font files? TTF and other formats. Obtain the information about the font and the glyphs. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Font reading library
Hello, Which unit exactly? I know that it has bindings to the freetype library (freetype.pp), but AFAIK that's it. I don't remember that it has Pascal code to read font files, or at least I couldn't find it if it has. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Strange arm-linux cross-compilation errors
In this thread: http://www.lazarus.freepascal.org/index.php/topic,12585.0.html I though that maybe posting here would help, since the user has some problems with some strange errors which say nothing to me =) -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] run pascal programs as scripts
On Thu, Mar 24, 2011 at 7:27 PM, Mark Morgan Lloyd markmll.fpc-pas...@telemetry.co.uk wrote: Would it be feasible to modify FPC so that it discarded everything preceding program, unit etc? Feasable, yes, but it is probably easier to make a pre-processor which removes this line, simply. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] run pascal programs as scripts
Commenting is better. Then the reported error line numbers are still valid. Yes, but then bash won't recognize it, I suppose -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Consumer producer unit (donation to fcl)
Another option is adding it to the Lazarus-ccr. You can create a wiki page for this in the Lazarus wiki and add it somewhere in the lazarus-ccr subversion. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpc and armv5-android
On Sun, Feb 27, 2011 at 1:32 PM, Dejan Boras de_jean_7...@yahoo.com wrote: Is there anyone on this list who uses fpc with android under windows and the android emulator(armv5) without problems(e.g. basic functionality at least like sysutils, ansistrings, ...)? I'm just trying to figure out if I'm doing something wrong. I haven't had any problems at the moment, but I don't use shared libraries, but rather real Linux executables. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IXP435
If it is ARVv5 with softfloat, then maybe the instructions for Android will work for you, because it targets the same configuration. You can either build the compiler yourself or try to use the pre-compiled snapshot that I created: http://wiki.lazarus.freepascal.org/Android_Interface#Configuring_the_Free_Pascal_Compiler_for_Android -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Android calling JNI functions crash
No idea, I always use Linux, but if no-one has a better idea, I would suggest that you try first using the linux cross-compiler, just to check if the crash is really related to the binutils. There are some instructions here: http://wiki.lazarus.freepascal.org/Android_Interface#Configuring_the_Free_Pascal_Compiler_for_Android -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: html scrapping library
On Tue, Feb 15, 2011 at 3:09 PM, Gene Buckle ge...@deltasoft.com wrote: The person may mean scraping (to scrape). Didn't help much at least to me. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Android calling JNI functions crash
I use eabi=5 (aka ARMv5), just in case this is the problem. But I don't use JNI. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Is LNET dead?
Of course lnet is not dead: http://wiki.lazarus.freepascal.org/index.php?title=lNetaction=history -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Converting .doc and/or .html to .pdf
Another solution is that you could start a generic library for handling formatted text documents. It will certainly be harder, and take more time, but the end result will be much better and it won't require having OpenOffice installed (a rather huge thing to have as a dependency). We already have a spreadsheet library: http://wiki.lazarus.freepascal.org/FPSpreadsheet Something similar could be done for handling the class of formatted documents, like pdf, doc, html, etc. FPVectorial has support for PDF reading, but only from a vectorial drawing point of view, nevertheless it's code and documentation which explain the PDF format could be reused. I actually have documentation in portuguese about the PDF format. http://wiki.lazarus.freepascal.org/fpvectorial -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FPC programs in Android without JNI
Hello, On Tue, Dec 28, 2010 at 4:17 AM, Jeppe Johansen jepj...@es.aau.dk wrote: They are C APIs indeed. I just took a stab at it, and after a long day of pointer errors in converted C code and really, really badly descriptions of error messages, I managed to port the example from here http://developer.android.com/reference/android/app/NativeActivity.html to FPC Code here: http://j-software.dk/android.zip Simply run lazbuild test.lpi in the jni dir, and then run ant debug/ant install in the root dir What about putting your units in the lazarus-ccr? I also want to use parts of it (at the moment I am interested in log.pas), so we should keep files in a central repository easily accessible for everyone and the Lazarus-ccr is the best place for emergent projects. Then we can colaborate on the development of common parts. If you want I can put the units there and send you a link. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FPC programs in Android without JNI
On Thu, Jan 13, 2011 at 4:38 PM, Jeppe Johansen jepj...@es.aau.dk wrote: I think you can put the units there if you want. I can't figure that site out It's a source forge project. I added the files here: http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/bindings/android-ndk/ If you would like to maintain them, please send me your source forge login and I'll give you commit rights to the repository. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FPC programs in Android without JNI
On Tue, Dec 28, 2010 at 7:03 AM, Florian Klämpfl flor...@freepascal.org wrote: What FPC did you use? Just a plain arm compiler with an eabi rtl? Software floating point should be activated too, because most phones have no FPU. I thought 2.3 support now native apps using the android user interface? It is getting closer, but still, not really. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] The new Delphi compatible unicode string
On Tue, Jan 4, 2011 at 10:20 AM, Juha Manninen I would also laugh if I was the Java developer. Then just wait until the guy needs to use an ifdef and ops. There are no ifdefs in Java. Your turn to laugh has come as he tries to hack around this very serious short coming. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Moving callbackfunctions to class
On Fri, Dec 31, 2010 at 11:01 AM, Darius Blaszyk dhkblas...@zeelandnet.nl wrote: Thanks for the tip Paul. Unfortunately it did not help. See for the results below. Using a correct type cast it should work. Which line brings the errors? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A cross-architecture Integer type for 32-bit and 64-bit
PtrUInt or something similar. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FPC programs in Android without JNI
ahahah, I was writing an answer in my phone, but then gave up. Probably hit the send button by accident. Anyway, yes, I had also seen that one and it is a step in the right direction =) I haven't yet fully understood how this new APIs work, hopefully they are C APIs, if they are C++ APIs then it is just better to make Java calls like I can already do now. Another problem is that it doesn't solve the main issue which is that Android does not officially support running native programs, they need to be libraries. Of course I ignored this and managed to run native programs, but that's another story. In short I don't think that I will change my development strategy for now, specially since I already bought a Android 2.1 phone and I can write Pascal apps for it at the moment and I don't plan on dropping support for it at the moment. Of course that I might migrate to use this newer possibilities when I have exhausted that my current strategy can provide =) -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: FPC programs in Android without JNI
I a On Dec 17, 2010 8:47 PM, Andrew Haines andrewd...@aol.com wrote: On 12/16/10 12:23, Felipe Monteiro de Carvalho wrote: Hello, It might be interesting to know ... The Android 2.3 ndk now has support for a NativeActivity and there is a sample of OpenGL ES native program. quote General notes: * Adds support for native activities, which allows you to implement the Android application lifecycle in native code. * Adds native support for the following: o Input subsystem (such as the keyboard and touch screen) o Access to sensor data (accelerometer, compass, gyroscope, etc). o Event loop APIs to wait for things such as input and sensor events. o Window and surface subsystem o Audio APIs based on the OpenSL ES standard that support playback and recording as well as control over platform audio effects o Access to assets packaged in an .apk file. /quote ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: FPC programs in Android without JNI
Hello, It might be interesting to know that I managed to build a bridge which exports the Java API and the Android API to Free Pascal. Check this hello world code and screenshot: http://wiki.lazarus.freepascal.org/Android_Interface/Android_Programming#Using_the_Android_API_from_Pascal The full code is here: http://p-tools.svn.sourceforge.net/viewvc/p-tools/PascalNotes4Android/ bye, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Problem with OpenGL drawing on Linux
Your program shows this in my Mac OS X: http://img64.imageshack.us/img64/640/screencapture3p.png Strange the the window does not have a close button. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Working Free Pascal android JNI example
In Android 2.3 you can write apps without any Java code, but you still need to build it as a library: http://developer.android.com/reference/android/app/NativeActivity.html It seams to support OpenGL and user input without Java. Still not ideal, however. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Working Free Pascal android JNI example
On Tue, Dec 7, 2010 at 12:12 PM, Matt Emson memson.li...@googlemail.com wrote: Well, no. As Android targets any processor - not just ARM. Indeed, there are Intel based versions. I've never seen one and I've already worked with maybe 50 different Android smartphones / tablets. x86-Android is negletible. I bet that it has less then 0.1% of the Android devices market share. Native is bad your opinion. I disagree. Would it not be a better solution to create a Dalvik back-end? 1 This would be a huge, very hard task. Who will do it? I don't have the resources (time / money) to do it. If you have, I'm all for it that you do it! Good luck! 2 There are no guarantees that Dalvik's bytecode will remain compatible in the future. Google is being sued over Dalvik and might even decide to drop it completely as far as we know. If that happens, you just lost all your work. 3 Existing FPC applications would need to be modified to work in this FPC port. Think about pointers for example. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] FPC programs in Android without JNI
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
Re: [fpc-pascal] Working Free Pascal android JNI example
Hello, How do you compile BeRoXM? Using ant? Also, installing BeRoXM.apk failed in HTC Wildfire Android 2.1 Also, I couldn't find the source code for the Pascal part. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Working Free Pascal android JNI example
On Tue, Nov 30, 2010 at 11:32 AM, Felipe Monteiro de Carvalho felipemonteiro.carva...@gmail.com wrote: Also, installing BeRoXM.apk failed in HTC Wildfire Android 2.1 I didn't check the log since I don't plan on using JNI anyway, but probably it was built for release but lacks the certificate. This issue confused me a bit. ant debug Should be used for building most of the time so that it adds the debug certificate. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Working Free Pascal android JNI example
On Wed, Nov 10, 2010 at 5:08 PM, Reimar Grabowski reimg...@web.de wrote: Thanks for the tutorial, but as you surely have read (see comments) there are problems using this approach. And I won't hardly call it officially supported as it is a little hackish. I don't care about being officially supported or being hackish, I am only interrested if it works. I just tryed and the tutorial doesn't work anymore, it works for Android up to 1.5 only But I found an alternative very easy solution which works: http://p-tools.svn.sourceforge.net/viewvc/p-tools/PascalNotes4Android/src/com/pascalnotes/PascalNotes4Android.java?revision=187view=markup I succeded at running ls /sdcard and showing the results in a message dialog =) Next step is running a deployed Pascal application =D -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] More Win CE
On Wed, Nov 17, 2010 at 9:54 AM, Sven Barth pascaldra...@googlemail.com wrote: And now comes Windows Phone 7 and destroys this dream mobile OS of mine. Thank you Microsoft. You could try MeeGo: http://en.wikipedia.org/wiki/MeeGo At the moment with this phone: http://en.wikipedia.org/wiki/Nokia_N900 I hope that in 2011 Nokia will launch cheaper phones with MeeGo and that the platform will get cheaper, more stable and with a larger market share. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] More Win CE
On Wed, Nov 17, 2010 at 12:11 PM, Matt Emson memson.li...@googlemail.com wrote: There is little chance that will happen as it assumes Nokia will focus on Meego... Nokia can't focus on a blade of grass on a sunny day - they will carry on as is IMO and be shamed in to releasing cheap and shoddy hardware in a few years when it will be too little too late to save their business. Which smartphone platform do you recommend then? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] More Win CE
On Tue, Nov 16, 2010 at 11:07 PM, Max Vlasov max.vla...@gmail.com wrote: Sven, although I understand what you're talking about, I think this is a case when MS partially learned from their own mistakes as well as from google success. No, it has nothing to do with it. They really are just evil, unethical and not worth a single drop of trust. As long as I remember, even first Windows CE binaries could be created for several processors architecures, while the main competitor, Palm, only to a single (Motorola). The latter was a real benefit for general user. Of all other factors which make Palm obsolete you picked up a small technical detail which the users couldn't care less about. Managed code (if I understand this concept correctly) would allow exsting multiply process architectures transparent to the developer. Imagine x86 architecture would finally overcome power-saving issues and be the winner over ARM (unlikely, but just imagine), who would not suffer? Andorid and Windows Phone, and who would have hard times? iOS and Symbian This problem is non-existant. In the worse case you have one download per architecture. And yes, sure, yeah, right that managed code solves anything. I know a couple of Android apps which have different downloads for version 1.5, 1.6, etc, because of platform differences. How is it better then one download per architecture + a good designed API with better compatibility? Even then you can have something like the Universal Binaries from Mac. Plus, Mac OS X had no trouble migrating to x86. If anything it was only better then developing for PowerPC. You can see it as an excelent example of a successful platform migration. And if they want to virtualize something they could virtualize one processor, like Rosetta virtualized PowerPC in x86 Although, on the other side, if your writing native, you will invest in something more solid. Motorola processor is gone, but the c code for example of my reader for PalmOS is open source and anyone can change it at least leaving some code from the past. But your c code won't run in Windows Phone. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Win CE
On Wed, Nov 10, 2010 at 9:13 AM, Uffe Kousgaard u...@routeware.dk wrote: When developing for WinCE, is it possible to compile for DLL's or COM objects? Your frase isn't very clear, so you want to use a COM object or you want to implement one? Using COM objects should work nearly the same as in Win32, but people do have difficulty using it because we lack adequate information (no-one wrote a tutorial specific for using COM in WinCE in the wiki yet). I personally never use COM in my projects, so I have not much experience with it. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Win CE
On Wed, Nov 10, 2010 at 10:00 AM, Uffe Kousgaard u...@routeware.dk wrote: Implement. It should be used from VBscript in another application. As already said, I don't use COM, but I found this in the forum: http://www.lazarus.freepascal.org/index.php/topic,10938.msg55198/topicseen.html#new If you manage to make it, a tutorial in the wiki about how to do it would be very welcome =) bye, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] ZLIB
The text rendering example also shows how to write a png image: http://wiki.lazarus.freepascal.org/fcl-image#Drawing_text -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Endian issues when porting FPC programs from x86 to other platforms
On Tue, Nov 2, 2010 at 7:04 PM, Bo Berglund bo.bergl...@gmail.com wrote: Thanks, that helps a lot! Are there also overloaded BEtoN functions for floating point values? I think that single and double have always the same binary layout. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Precision of timestamp values.
http://wiki.lazarus.freepascal.org/EpikTimer -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Real length of WideString
On Thu, Oct 21, 2010 at 2:28 AM, Zaher Dirkey parm...@gmail.com wrote: var ws: widestring; begin ws:= 'زاهر'; Label3.Caption := inttostr(length(ws)); //= 8 Here the compiler assumes that your source code is encoded in the default system encoding and then it converts your string to utf-16. Probably your system encoding is not UTF-8. so your string is corrupted by a wrong conversion. Then length 8 seams to indicate that the string was corrupted. You could tell the compiler that your source code is in UTF-8, which should allow the code above to work, but then it will break all utf-8 ansistrings. There is no real solution for this issue while FPC lacks full Unicode support. In the mean time I recommend using your second version of the code. It is different with ws:= UTF8Decode('زاهر'); Label3.Caption := inttostr(length(ws)); //= 4 This is more like the standard Lazarus way of doing things. The string is encoded in the file as utf-8 and assigned to a ansistring. Then UTF8Decode converts this to UTF-16. A correct conversion takes place, because you didn't let the compiler decide for you what to convert, but you decided yourself. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Real length of WideString
On Thu, Oct 21, 2010 at 1:41 AM, Zaher Dirkey parm...@gmail.com wrote: How to get the real length of WideString variable. Length in which unit? WideChars (2 bytes each) or Bytes? Length() returns the amount of WideChars AFAIK -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] non visual timer win32
MyTimer := TTimer.Create(Application); MyTimer.OnTimer := myHandler; -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: declaration of functions
On Fri, Oct 15, 2010 at 11:41 AM, Uffe Kousgaard u...@routeware.dk wrote: Since I'm compiling for WinCE at the moment, would anybody know if there is something wrong with the emulator from MS? http://www.microsoft.com/downloads/en/details.aspx?FamilyID=A120E012-CA31-4BE9-A3BF-B9BF4F64CE72 It keeps stopping installation halfway through with message was interrupted. No further errors. Use the instructions here: http://wiki.lazarus.freepascal.org/Windows_CE_Interface#Windows_Mobile_5.0_Emulator They always worked perfectly for me. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] FPC for High Performance Computing (HPC) Components with Application API
Just one suggestion: If the current TThread uses too many security facilities for your purpose, then I think that it may not be possible to make a single thread manager which fits all purposes. So you could create your own high-performance thread manager, and for most users which don't need this feature, but prefere safer threads, can keep using the current thread manager, cthreads in UNIXes. So you can still use the standard TThread object, just add your own high_performace_thread_manager unit to your uses clause instead of cthreads. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] lNet getting the local IP
Ok, thanks everyone, it seams that I managed to extract a function from Silvio's code which doesn't use Synapse. I only tested in Windows so far: unit chesstcputils; {$mode objfpc}{$H+} interface uses {$IFDEF MSWINDOWS} Winsock, {$ENDIF} Classes, SysUtils; function ChessGetLocalIP(): string; implementation const CFormatIPMask = '%d.%d.%d.%d'; function ChessGetLocalIP(): string; var I, VAttempt: Integer; VStrTemp, VSitesToTry: TStringList; {$IFDEF UNIX} VProcess: TProcess; {$ENDIF} {$IFDEF MSWINDOWS} var VWSAData: TWSAData; VHostEnt: PHostEnt; VName: string; {$ENDIF} begin Result := ''; {$IFDEF UNIX} VStrTemp := TStringList.Create; VProcess := TProcess.Create(nil); try VProcess.CommandLine := 'sh -c ifconfig eth0 | awk ''/inet end/ {print $3}'''; VProcess.Options := [poWaitOnExit, poUsePipes]; VProcess.Execute; VStrTemp.LoadFromStream(VProcess.Output); Result := Trim(VStrTemp.Text); finally VStrTemp.Free; VProcess.Free; end; {$ENDIF} {$IFDEF MSWINDOWS} {$HINTS OFF} WSAStartup(2, VWSAData); {$HINTS ON} SetLength(VName, 255); GetHostName(PChar(VName), 255); SetLength(VName, StrLen(PChar(VName))); VHostEnt := GetHostByName(PChar(VName)); with VHostEnt^ do Result := Format(CFormatIPMask, [Byte(h_addr^[0]), Byte(h_addr^[1]), Byte(h_addr^[2]), Byte(h_addr^[3])]); WSACleanup; {$ENDIF} end; end. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] lNet getting the local IP
hello, I am searching for a way to get the local IP. I already found examples with winsock, synapse and indy. Does anyone know how to do that with lNet? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] lNet getting the local IP
Hello, Actually it uses both synapse (under unix) and winsock (under Windows). What should one put in the parameter AHTTPSend: THTTPSend ? Where is this type declared? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Delphi incompatible conditionals?
One solution would be putting the contents of the fpc specific ifdefs inside a include file. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Any recommendations for a good in-memory storage type
Personally, I would go for TMemoryStream -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interface with NASM
Strange, I took a look and no idea why it doesn't work with the linked .o file =) Maybe disassembling what nasm produces could show something, but I don't know which GNU tool could be used for that... The following program works for me: program driver; uses asmio; {$ASMMODE att} procedure tes2; pascal; begin printc(Char(65)); end; procedure tes; assembler; [alias:'tes']; asm movl $65,%eax push %eax call printc end; begin tes2; tes; end. And here is the assembler generated: fpc -s driver.pas edit driver.s .text .align 4 .globl _P$DRIVER_TES2 _P$DRIVER_TES2: pushl %ebp movl%esp,%ebp subl$24,%esp movl%ebx,-12(%ebp) movl%esi,-8(%ebp) movl%edi,-4(%ebp) movl$65,%eax movl%eax,(%esp) callL_ASMIO_PRINTC$CHAR$stub movl-12(%ebp),%ebx movl-8(%ebp),%esi movl-4(%ebp),%edi leave ret .text .align 4 .globl _P$DRIVER_TES _P$DRIVER_TES: .reference tes .globl tes tes: .reference _P$DRIVER_TES subl$12,%esp movl$65,%eax pushl %eax call_ASMIO_PRINTC$CHAR addl$12,%esp ret -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Re: Interface with NASM
On Thu, Sep 16, 2010 at 11:10 AM, leledumbo leledumbo_c...@yahoo.co.id wrote: Just by changing to ATT syntax? Weird... No, I removed the function header: push ebp mov ebp,esp And function footer: leave ret Because FPC automatically adds them, putting another header was the cause of the crash in my code. But this doesn't seam to be the case with the nasm object file. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interface with NASM
On Thu, Sep 16, 2010 at 11:44 AM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: Check that this puts a 32 bit value on the stack rather than an 8 bit or 16 bit one. You may need push dword 65 or something like that. I can add that my gdb said that the stack was missaligned, so this has a high probability of being the case. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interface with NASM
On Thu, Sep 16, 2010 at 3:19 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote: It works fine under linux (if you replace the -f coff with -f elf). For me it doesn't work in Mac OS X using -f macho -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Interface with NASM
I changed it to a very similar program, but one which can be built with a single instruction: program driver; uses asmio; {$ASMMODE Intel} procedure tes; assembler; [alias:'tes']; asm push ebp mov ebp,esp mov EAX,65 push EAX call printc leave ret end; begin tes; end. It crashes inside printc apparently when getting the parameter. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Question mark?
Does it work without {$ Codepage UTF8} ? -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Generic B+Trees, Lists and Vectors
I would recommend listing it here: http://wiki.lazarus.freepascal.org/Components_and_Code_examples#Packages_for_FPC.2FLazarus_.28not_hosted_here.29 thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Basics of profiling
Thanks a lot all for the tips =) On Mon, Sep 6, 2010 at 1:01 PM, Graeme Geldenhuys graemeg.li...@gmail.com wrote: fpprofiler was quick and easy to use, and it have me results that was But for quick and easy profiling, I found fpprofiler to suite my needs just well. Just remember to have your code in some SCM system, because fpprofiler does modify the code and recompiles it Good to know that there is a pascal profiling solution, but somewhat nasty that it changes the code, but thinking about it I couldn't think of a better alternative. Maybe only by copying the source tree to a temp dir. Obviously, you can go old-school too, and simply use EpikTimer, to time certain functions you know to be slow or prone to hot spots in code. In my case I only wanted to profile 5 painting routines, so I just went for EpikTimer with a PROFILING ifdef and it worked well =) -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compile ANSI unit as UTF8
On Mon, Sep 6, 2010 at 1:28 AM, Zaher Dirkey parm...@gmail.com wrote: I have unit with Ansi strings but i want to compile it as UTF-8 how to ask the compiler to convert it to utf8 before compile it? By saying that the unit has ansi strings do you mean that is has some types like: X: ansistring; Or that the text of the unit itself is in an iso encoding? For the second case probably using a editor which can convert between encodings like Notepad++ would solve the issue. You can use it to convert your unit to UTF-8. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Basics of profiling
Hello, Does anyone have a link or some info about basic info for doing profiling in fpc apps? Basically I would like to know how many miliseconds does my app spend in a couple of drawing routines to calculate the effect of speed optimizations. I know I could just check with a timer in my code, but I suppose that there is a better way. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Compile ANSI unit as UTF8
In the Virtual Magnifying Glass I used the following solution: 1 All my strings come from a translations manager 2 When they are updated (because the user selected a different language for example) then I also added the following code: {$ifndef fpc} -- here convert all utf-8 strings to ansi for Delphi usage {$endif} And now it works fine. Check: http://magnifier.svn.sourceforge.net/viewvc/magnifier/trunk/translationsvmg.pas?revision=193view=markup procedure TTranslations.UpdateTranslations; -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to set a type as a variable?
No, if all your types are classes descending from the same root you can do it is like this: type TBaseType = class; procedure somemethod(); end; TExtendedType = class(TBaseType); TBaseTypeClass = class of TBaseType; procedure (value: TBaseType; type_: TBaseTypeClass) begin value := type_.Create(); value.somemethod(); end; And you can call your procedure as: proc(somevar, TExtendedType); For other types you need to use generics. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extended, Currency and TDateTime memory layout
For single and double there is a nice converter which shows the binary layout: http://babbage.cs.qc.edu/IEEE-754/Decimal.html Unfortunately there seams to be much less resources about extended... On Fri, Aug 6, 2010 at 4:52 PM, Michael Van Canneyt mich...@freepascal.org wrote: Strange, because tkCurrency exists ? A currency is a Int64, which is the currency amount multiplied by 1. Well, apparently Delphi 6 RTTI thinks that it is a float. Check this code: 471 else if ElmTypeInfo.Kind in [tkFloat] then begin 472 case TypeData.FloatType of 473 ftSingle: Stream.Write(DynArray^, ArrayLength * SizeOf(Single)); 474 ftDouble: Stream.Write(DynArray^, ArrayLength * SizeOf(Double)); 475 ftComp: Stream.Write(DynArray^, ArrayLength * SizeOf(Comp)); 476 ftCurr: Stream.Write(DynArray^, ArrayLength * SizeOf(Currency)); 477 ftExtended: Stream.Write(DynArray^, ArrayLength * SizeOF(Extended)); 478 end; But this code is in another part of the program. For that particular part it simply converts any float type to extended, which was a pretty nasty thing to do. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extended, Currency and TDateTime memory layout
On Sat, Aug 7, 2010 at 10:44 PM, Zaher Dirkey parm...@gmail.com wrote: A Currency is a Int64 not float, if you assign currency to float variable (double/extended) and return back to currency variable, you will not get the same value. Yes, but I didn't write the server I just need to interface with it's strange messages =) In general it works ok, but the Currency converted to Extended is giving me some headaches ... -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extended, Currency and TDateTime memory layout
Hello, I managed to read the extended by putting it in a program like this: procedure TForm1.Button1Click(Sender: TObject); var Hex: array[0..9] of Byte; Num: Extended; begin Hex[0] := $00; Hex[1] := $00; Hex[2] := $00; Hex[3] := $00; Hex[4] := $00; Hex[5] := $00; Hex[6] := $00; Hex[7] := $80; Hex[8] := $FD; Hex[9] := $3F; Num := Extended(Hex); Caption := FloatToStr(Num); end; And that just confirms it, yep, the server converts the currency to extended ... -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Extended, Currency and TDateTime memory layout
On Sat, Aug 7, 2010 at 10:44 PM, Zaher Dirkey parm...@gmail.com wrote: A Currency is a Int64 not float, if you assign currency to float variable (double/extended) and return back to currency variable, you will not get the same value. Interresting enough, the exact same value is returned. From my research on this subject a floating point is something like: Sign bit || exponent bits || decimal places Num = sign * (2^(exponent - offset) + decimal places) And the server only sends numbers like: 0,25; 0,5; 1; 2; 4; etc All those numbers can be fully represented using the exponent, so the double conversion maintains them exactly the same. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Extended, Currency and TDateTime memory layout
Hello, I am interfacing with a server written in Delphi via network and it sends over data. The server sends some data types, and among the hardest ones to read are Currency and TDateTime. The server is undocumented and does some strange transformations of the data using RTTI to pass properties. I always though that Currency was a special kind of integer type, but it seams that RTTI will return tkFloat for it under Delphi. Where is the internal memory layout of Currency documented? Where is it declared in the compiler? I couldn't find it... Similarly, it seams that most often TDateTime=double. Any docs on the memory layout of TDateTime? Before sending the data over, the application seams to convert both types to Extended ... any docs on the memory layout of that? I am trying to convert the data that the server sends into a readable number, but it doesn't seam to work, so maybe the memory layout of this would help ... A snap of what kind of stuff the server does: var FloatProp: Extended; PropCnt, I: Integer; PropList: PPropList; begin ... PropCnt := GetPropList(Result,PropList); for I := 0 to PropCnt - 1 do begin case PropList[I].PropType^^.Kind of tkFloat: begin Stream.Read(FloatProp, SizeOf(FloatProp)); SetFloatProp(Result, PropList[i], FloatProp); end; Plus, the Extended type is limited to x86 or does it also exist under x86_64? As in having the same memory layout... If it doesn't exist, does anyone know a function to read/write an extended even without hardware support? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
I added a small introduction here: http://wiki.lazarus.freepascal.org/fcl-web Having said that, I think that fpWeb worked quite well for my very simple web page and all kinds of web applications could be developed with it. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] fpweb tutorial
Hello, Does anyone know where I can find documentation or a tutorial about fpweb? Also, is the version included in FPC 2.4.0 very old and I should really use the FPC SVN code or can I use the units that come with FPC 2.4.0? I want to make a simple page which converts hexadecimal to a string. I found some, but they were really crappy. Plain CGI should be the prefered format, as apache modules are too much for this simple task. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
Hello, Thanks, with this blog I seam to be going somewhere and it worked ok with fpc 2.4.0 and the weblaz.lpk package. One thing still: Is there support for templates? I am doing something like this to load my page: procedure TFPWebModule1.DataModuleRequest(Sender: TObject; ARequest: TRequest; AResponse: TResponse; var Handled: Boolean); begin AResponse.ContentType := 'text/html;charset=utf-8'; AResponse.Contents.LoadFromFile(ExtractFilePath(ParamStr(0)) + 'mainpage.html'); Handled := True; end; Something like powutils templates would be extremely handy ... all that html mixed with pascal doesn't look very nice. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
Ah ... I see that you can just use Format for that ... And what about reading a GET input =D Any ideas how to do that? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Search Engine friendly CGI web apps and pages
In the standard Apache setup it will thread anything you put in the cgi-bin directory regardless of the extension as a cgi program. The path to this is set in httpd.conf here: # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that # documents in the target directory are treated as applications and # run by the server when requested rather than as documents sent to the # client. The same rules about trailing / apply to ScriptAlias # directives as to Alias. # ScriptAlias /cgi-bin/ C:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin/ -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] fpweb tutorial
On Tue, Jul 13, 2010 at 5:10 PM, Michael Van Canneyt mich...@freepascal.org wrote: Well, Request.Variables['Myvar'] is enough, no ? Doesn't seam to exist in fpc 2.4.0, any idea how to do that with that version? I found a couple of stuff which didn't work, including: Request.GetFieldByName(); Self.GetParam(); -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] A patched unit overriding the default - like Delphi supports
The solution that I use is to rename the unit slightly, like I am improving OpenSSL.pas, so I renamed it to MyOpenSSL.pas to avoid conflicts. Once the changes are merged and released I will rename my uses clauses back to OpenSSL. Can be very annoying if the problem involves lot's of units, but for simple cases works fine. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] LNet
I sent a direct main to Almindor and he answered my questions. Basically there is no direct way to detect the barrier between packages, you have to make your packet structure allow for that, but luckly mine was already prepared for this. And from my tests Get is indeed returning the amount read. I still don't know if half a packet could be received in the OnReceive event or if it only returns an integer amount of packets. That makes difference in the algorithm to separate the packets. -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] LNet
Hello, I am trying to use lNet and I have some questions. 1 Can I use TLTcp or do I need to use the visual version, TLTcpComponent? 2 Can I use only the base package or do I need to use the visual one? Basically I am not a big fan of design time packages, I prefer to add the units and create the components myself. 3 Does LNet require some kind of support for the widgetset? I am curious if TLTcp will work in Mac OS X or if it requires some support for the Carbon widgetset. And if it already works, then what is the mentioned support for widgetsets? thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] LNet
Ok, thanks, now I seam to be able to get it working using TLTCPComponent, but I am unsure about how to read data. Ok, I read that it will call OnReceive when there is data ready, but I couldn't find anything about how much data is waiting to be read? I would like to get each single Packet which is sent to my program and store them in a Queue, which will later be dealt with, but using only the Get method I don't see how I can Find out how much data is available. Without this I don't know how big a buffer I should send for this function, but I guess I could just give a very big buffer, but then there are no comments in the function indicating if it returns the amount of bytes written. Also, how would I know where are the packets separated? I mean, two packets could arrive very quickly and I would be reading both together instead of first the first one and then the next one. thanks, -- Felipe Monteiro de Carvalho ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal