Re: [fpc-pascal] Const attributes

2017-07-31 Thread Felipe Monteiro de Carvalho
On Mon, Jul 31, 2017 at 2:08 PM, Marcos Douglas B. Santos
<m...@delfire.net> wrote:
> But that is the goal to achieve...
> Not because Java, but to restrict the initialization of the attributes.

I meant that if its trivial to restrict setting final fields to
constructors, but it might be a lot of work to check and make sure
that in each possible execution path inside the constructor the field
can only be set once, I would be happy to have a final implementation
which doesn't do this detail.

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

Re: [fpc-pascal] Const attributes

2017-07-31 Thread Felipe Monteiro de Carvalho
On Sun, Jul 30, 2017 at 10:47 PM, Sven Barth via fpc-pascal
<fpc-pascal@lists.freepascal.org> wrote:
> (though if one would restrict the assignments to the constructors itself
> without any methods called by the constructor then we might be able to
> implement that nevertheless, don't know what Java or other languages
> with final fields allow here)

Java final fields can only be set in constructors (and only once in
each constructor, but I guess it isn't necessary to immitate this
part).

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

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-10 Thread Felipe Monteiro de Carvalho
On Mon, Jul 10, 2017 at 3:46 PM, Graeme Geldenhuys
<mailingli...@geldenhuys.co.uk> wrote:
> Then lastly, you can even add a finally block in there too (Java calls this
> try-with-resources).

No, that's not what try-with-resources is.

This is try-with-resources:
https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html

Any object which implements the interface AutoClosable is auto-closed
in the try, regardless of an exception happening or not.

Pascal is a little different, since it has destructors, so I guess in
Pascal we could auto-free objects in a hypotetical try-with-resources
in Pascal. Something like:

try ( stringList := TStringList.Create;
 otherObj := TSomeOtherClass.Create; )
  code here
except
  exception block, optional
end;

And any object in the () section would be auto-freed, auto-checking if
it was already created or not.

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

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-10 Thread Felipe Monteiro de Carvalho
On Mon, Jul 10, 2017 at 12:52 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> There is no performance improvement, rather the contrary. The generic list
> works slower than the native list.

I meant that C++ templates (and maybe Pascal generics which are very
similar if I am not wrong) are faster than Java generics. Maybe it has
to do with that primitive types in Java cannot be added to generics at
all, but need to be wrapped in an object.

I also don't see why a template list would be slower than a fixed-type
one. It should be the same. Its just a copy of the same code.

Anyway C++ guys claim that templates are faster than Java generics,
I'm just repeating what I heard.

If they aren't faster, then Java has better generics, because they are
easier to use and debug.

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

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-10 Thread Felipe Monteiro de Carvalho
On Mon, Jul 10, 2017 at 12:14 PM, Graeme Geldenhuys
<mailingli...@geldenhuys.co.uk> wrote:
> * I seem to have grasped Generics in Java much easier than in FPC or
> Delphi. I don't fully know why that is. Maybe the syntax, more examples etc?
> Not sure.

Well, Java Generics are very limited in comparison with C++ / Object
Pascal generics (Java generics accepts only Objects never primitives),
so that's make them much simpler to use/understand of course.

Maybe Java is right and that's all we'll ever need and the performance
improvement of templates do not justify the added complexity and the
difficulty in debugging. But it is a big limitation, so your
comparison is not exactly fair here.

If Object Pascal had generics which accept only TObject I'm pretty
sure it would be just as easy to use and understand and debug as in
Java!

OTOH: The improved exception handling is indeed something we miss, in
particular try-with-resources.

Java has a very significant problem in my opinion: At least where I
live, Java is never utilized for any interresting projects. Only for
JavaEE with Spring+Hibernate and a little for Android (although
Android people don't care that much for Java, they want specific
knowledge of Android APIs and libraries, and dislike the Java generic
APIs). Its even surprising like: wow, such a nice framework and noone
ever does anything interresting with it o.O

It looks like that C++ and C# are utilized in much more varied and
interresting projects than Java.

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

Re: [fpc-pascal] Food for thought - language string improvement

2017-07-08 Thread Felipe Monteiro de Carvalho
> Language features like this is what increases productivity.

Indeed {$INCLUDESTRINGFILE file} looks like a great solution for this.

Since we are talking about language features, after learning Java I
think we could use in Pascal:

1> Default methods in interfaces (implementation multiple-inheritance,
would be extremely useful in Lazarus)

2> Try with resources like in Java

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

Re: [fpc-pascal] fpGUI on macOS

2017-06-09 Thread Felipe Monteiro de Carvalho
On Fri, Jun 9, 2017 at 9:05 AM, Mattias Gaertner
<nc-gaert...@netcologne.de> wrote:
>> So will lazarus be converting the IDE over to cocoa?
>
> Probably.

Most stuff already works in Cocoa.

I haven't used LCL-Carbon for my personal projects in years, although
I still use it for the IDE.

You can use the IDE with Carbon for now (until Cocoa is good enough),
but for personal projects I recommend Cocoa, unless you are affected
by a missing functionality or something.

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

Re: [fpc-pascal] Browser and exe

2017-05-23 Thread Felipe Monteiro de Carvalho
On Tue, May 23, 2017 at 2:39 PM, Marcos Douglas B. Santos
<m...@delfire.net> wrote:
> I can't. For security reasons I need to have an app installed on client.
> Did you see my email before, about digital signature? That is one of
> these features...

In this case I have no idea how it is done. But it can be done, I know
that Banco Itau does this, but I don't know what exactly they use.

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

Re: [fpc-pascal] Browser and exe

2017-05-23 Thread Felipe Monteiro de Carvalho
That's why Model-View-Controller is such a great design pattern. If
you use MVC you can simply create a new View component and keep the
Model and Controller without changes.

You can use fcl-web to write the web server:
http://wiki.lazarus.freepascal.org/fcl-web

You will need to rewrite the GUI in html/javascript which is served to
the web browser.

In the past there was stuff like ActiveX and a Java similar, but
nowadays they are pretty much all deprecated sometimes even
unsupported at all, people should use html+javascript for web
interfaces.

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

Re: [fpc-pascal] FPC Graphics options?

2017-05-21 Thread Felipe Monteiro de Carvalho
On Thu, May 18, 2017 at 5:05 PM, Graeme Geldenhuys
<mailingli...@geldenhuys.co.uk> wrote:
> Use Java instead. ;-) Check. Oh wait, that's what I did for that project.

Well, Java also has its issues. I am studying Java and I am completely
shocked that you need to use "volatile" to avoid serious hard-to-debug
multithreading bugs.

It looks like you pretty much need to declare all vars that might be
accessed from different threads as volatile from what I understood,
because otherwise the java compiler might never write values to the
variable at all, instead write only to a local cache. Amazing!

In FPC this isn't needed since assignments always change real memory.
Thinking about it, maybe FPC needs the oposite kind of variable
modified, a "notvolatile" so that it could optimize more agressively
in case you are 100% sure this code will be run on a single thread...

This simple program never ends if you delete the volatile keyword (I
tested here in Windows):

import java.util.*;

class FelipeTestThread
{
volatile boolean running = true;

public void test()
{
new Thread(new Runnable()
{
public void run()
   {
int counter = 0;
while (running) {
counter++;
}
System.out.println("Thread 1 finished. Counted up to "
+ counter);
}
}).start();
new Thread(new Runnable()
{
public void run()
{
// Sleep for a bit so that thread 1 has a chance to start
try
{
Thread.sleep(100);
} catch (InterruptedException ignored) { }
System.out.println("Thread 2 finishing");
running = false;
}
}).start();
  }
public static void main(String[] args)
{
new FelipeTestThread().test();
}
}

Not to mention that 1 file per class is super annoying and it is
impossible to resize arrays and there are no unsigned integers.
Generics can't accept non-Object values. There is no way to pass
parameters by reference, accessing operating system APIs is a
nightmare which involves writing large JNI wrappers in C...etc.

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

Re: [fpc-pascal] FPC Graphics options?

2017-05-12 Thread Felipe Monteiro de Carvalho
On Fri, May 12, 2017 at 10:01 AM, Graeme Geldenhuys
<mailingli...@geldenhuys.co.uk> wrote:
> The results shouldn't have come as too much of a surprise though. It was
> often said, in this mailing list, that FPC's goal is maintainability and
> multiple platform support. Good optimised binaries is a distant third.

I don't think it is the case since Java is multiplaform also. IMHO
what happened is simple: 10 years ago Java was laughting stock,
infamous for being so slow. Then Oracle and IBM invested millions to
make Java top-dog, probably inferior only to C++. In the same time
frame FPC devs were already satisfied with the speed, so people worked
on adding support for more platforms and fixing bugs. So that's it.
Java has multi-billion dollar companies behind it. We don't.

Java probably has developers who work full-time only in improving
speed. It was just a question of time until they would catch up.

I honestly thought 10 years ago that C++, Java, C# were only temporary
stuff, waiting to be dropped for the "next great thing". While
Objective C indeed proved to be temporary (Apple now loves Swift), but
the big 3 seam to have arrived to stay. From those I guess C# is the
least safe, but C++ and Java look deeply entrenched.

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

Re: [fpc-pascal] Vehicle management

2017-05-11 Thread Felipe Monteiro de Carvalho
On Thu, May 11, 2017 at 1:19 AM, Jon Foster
<jon-li...@jfpossibilities.com> wrote:
> Yeah. The wiki is cluttered with inaccurate and abandoned information for
> Android development. It needs a serious scrubbing. And access to needed
> sources is somewhat hidden. I've combed it for a few years, now, to try and
> deduce what's real and what's not. I'm not even sure where I got the bits of
> source I'm using now. I've just been clinging to it like a shipwreck
> survivor clinging to flotsam.

I don't think the wiki page I posted is inaccurate, all the stuff
there is valid AFAIK, but it is simply very incomplete. A lot more
should be written, and also note that there are 2 different ways:

1> Via NDK combining native Pascal + Java
2> Via JVM compiler

The wiki I posted is only for approach 1, even a link to a full
compilable example is posted there (thought it is for OpenGL). I never
used approach 2 and dont plan on using it.

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

Re: [fpc-pascal] Vehicle management

2017-05-08 Thread Felipe Monteiro de Carvalho
On Sun, May 7, 2017 at 8:33 PM, Mark Morgan Lloyd
<markmll.fpc-pas...@telemetry.co.uk> wrote:
> Can anybody give me a quick summary of the position of FPC on Android etc.?

Works fine like via JNI, you can do most stuff in Pascal using JNI but
part still needs to be in Java.

some info here: http://wiki.lazarus.freepascal.org/Android_Programming

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

Re: [fpc-pascal] Language constructs and types that dependent upon system unit

2017-01-19 Thread Felipe Monteiro de Carvalho
On Thu, Jan 19, 2017 at 8:15 PM, gabor <ga...@poczta.onet.pl> wrote:
> problems with initialization/finalization sections).
...
> I know that following types require extra code:
> object, class, sting, dynamic array, try..except.
> What else should I avoid?

I think it is a huge exaggeration to rule out all of that. I think
that most of this stuff from basic language or system unit should work
just fine. Indeed some might not work, but most should work.

If you use the unit cmem (or even better if you make your own memory
manager that redirects to the C side), I don't see why
object/class/string/dynamic arrays should fail, when used internally
in the Pascal side.

try...except will probably indeed not work, because C often uses a
different exception mask than FPC or something like that.

I didn't try it myself recently, but instead of going bare-bones I
would rule out stuff that fails when they fail, not beforehand suppose
they won't work.

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


Re: [fpc-pascal] Drawing bitmap by pixel

2017-01-19 Thread Felipe Monteiro de Carvalho
On Thu, Jan 19, 2017 at 3:59 PM, Ryan Joseph <r...@thealchemistguild.com> wrote:
> I used the image canvas before to draw bitmap fonts so I have this code
> working. Is there anyway to set a pixel using TFPImageCanvas?

Use the Colors property, it is fast:

property Colors [x,y:integer] : TFPColor read GetColor write SetColor;

> canvas.Brush.FPColor := colRed;  // how do I set the color as an RGB?

Use this function:

function FPColor (r,g,b,a:word) : TFPColor;

fcl-image is from Free Pascal, not from Lazarus, but in
lcl/lazcanvas.pas there is TLazCanvas which extends TFPImageCanvas
adding convenience functions for example for alpha blending among
other stuff.

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


Re: [fpc-pascal] Blind Users

2016-10-27 Thread Felipe Monteiro de Carvalho
Some work was done in the LCL-Cocoa and LCL-Win32 to support screen
readers. Since LCL-Win32 uses native controls, it should be acessible
to screen readers out of the box, but it would be great if you could
test how the LCL apps behave in practice. I tested a long time ago.

About UI designing, I think it is best if you bypass the Form designer
completely and write the UI in code instead. Here is an example of how
to write LCL GUIs in code only, without using the Form Designer:

http://wiki.freepascal.org/Form_Tutorial#Creating_a_new_form_dynamically

Also read this page about acessibility in general and specifically
about adding accessibility to custom control (non-native ones) in the
LCL: http://wiki.lazarus.freepascal.org/LCL_Accessibility

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


[fpc-pascal] NSTextStorage.paragraphs

2016-09-27 Thread Felipe Monteiro de Carvalho
Hello,

https://developer.apple.com/reference/appkit/nstextstorage/1525943-paragraphs?language=objc

It seams to be a simple NSArray, or isn't it?

But is a property. I guess that every property can be mapped to a
set and a  set of functions, although I am not
sure. So something like this:

function paragraphs: NSArray; message 'paragraphs';

I am just wondering why it isn't added in the default bindings and how
to add it myself.

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-24 Thread Felipe Monteiro de Carvalho
On Wed, Aug 24, 2016 at 2:12 PM, Ralf Quint <freedos...@gmail.com> wrote:
> Negative. I downloaded and installed it just fine on Windows 8.1/64...

Anyone knows if Windows 7 would also work?

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


Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-23 Thread Felipe Monteiro de Carvalho
"Offer valid from August 22nd 2016 to September 9th 2016"

So people interested should be aware of this time limit.

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


Re: [fpc-pascal] Compatibility of very similar generic types

2016-08-18 Thread Felipe Monteiro de Carvalho
On Thu, Aug 18, 2016 at 2:44 PM, Sven Barth <pascaldra...@googlemail.com> wrote:
> generic procedure WriteVector_To_DM(ADest: TDataManager; ASelf:
> specialize TVector);
> generic procedure ReadVector_From_DM(AFrom: TDataManager; var ASelf:
> specialize TVector);
>
> and use them like this:
>
> specialize WriteVector_To_DM(...);

Aha, great, didn't know we had something in this direction. But
correct me if I am wrong, but this wouldn't work in my case, because
my function writes the class to a stream in the end of it, so it needs
to know which type T is. If the type is TSomeClass or a descendent,
then it will write each field of the class to the stream.

But in a generic class/function there is no way to ask if T is an int,
or is an TSomeClass, or am I missing some way of writing code that is
different for various possible types?

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


[fpc-pascal] Compatibility of very similar generic types

2016-08-18 Thread Felipe Monteiro de Carvalho
Hello,

Consider this:

TSubClass1 = class(TSomeClass)...;
TSubClass2 = class(TSomeClass)...;

TSubClass1Vector = specialize TVector;
TSubClass2Vector = specialize TVector;
TSomeClassVector = specialize TVector;

And I want to write a function like:

procedure WriteVector_To_DM(ADest: TDataManager; ASelf: TSomeClassVector);
procedure ReadVector_From_DM(AFrom: TDataManager; var ASelf: TSomeClassVector);

So according to the compiler warnings this is impossible, and I need
to write 3 functions to cover the 3 specializations, even if those
functions would be identical. Which sucks, because in the real case I
have like 10 nearly identical specializations, then I need 10
identical copy+pasted functions... of course I could use
TSomeClassVector everywhere, but this negates the advantages of using
generics in the first place which was type safety and elegancy.

Of course I am not satisfied to copy+paste 10 times and maintain the
copy+pasted mirrors in every change, so I simply wrote only 1 function
for the base class and I call it like this:

var
  myobj: TSubClass1Vector;
begin
  
  ReadVector_From_DM(MyDM, TSomeClassVector(myobj));

Yes, I could write the read/write functions in the vector itself, but
then the vector would need to know about TDataManager, which it is not
supposed to know really :(

The rationale here is that I only use functions from TSubClass1 that
are in TSomeClass, and I can't see how it could go wrong,

I understand that the compiler will generate 3 copies of the same
code: 1 time for TSubClass1Vector, 1 time for TSubClass2Vector and
another for TSomeClassVector. But all those copies should be fully
compatible, considering that:

A> The generic class cannot use anything specific from TSubClass1
since it doesn't know even that we are talking about a class, it could
be an int
B> All classes are equal sized pointers

My conclusion is that doing what I am doing will work, and it can't
possibly fail.

Now I understand that some people will scream: DON'T DO THIS.

But my question is: Is there any real reason why I am wrong and will
fail in some future compiler version or something, or while not
recommended I am correct that there is no real reason why it could
possibly fail. Considering my points above?

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


Re: [fpc-pascal] Hello, I suggest that you change the TFPGMap in fgl.

2016-07-19 Thread Felipe Monteiro de Carvalho
Hello,

You could always send a patch with a TFPGHashedMap or TFPGRedBlackMap
implementation.

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


[fpc-pascal] heaptrc and high RAM usage

2016-03-30 Thread Felipe Monteiro de Carvalho
Hello,

I have an app that is using too much RAM and I am trying to figure out
which structures are using how much RAM.

Note that this is not a leak, everything is freed nicely when the app
closes, so I am resorting to putting DumpHeap() calls somewhere. The
app has multiple threads and is fairly large so it is not trivial to
guess who is responsible.

Using DumpHeap() I do get some results like this:

626944 memory blocks allocated : 17619122/20768760
626799 memory blocks freed : 17602699/20752144
145 unfreed memory blocks : 16423
True heap size : 688128
True free heap : 639696
Should be : 641352
.
Call trace for block $0B019488 size 88
  $0048262C line 419 of 
  $0048246C line 394 of 
  $00485A7D line 1165 of 
  $0072FA33 line 2927 of 
  $007F65BE line 120 of 
  $004C0278
  $0072FA33 line 2927 of 
  $007F65BE line 120 of 
Marker: global

But the information is so small. I have an excess of 100MB RAM usage
according to "task manager" in Windows 7, but heaptrc just shows a few
blocks like the one above and no mention of how many times this block
repeats itself ...it doesn't sum up 100MB, so I can't figure out how
much RAM each block is using. "size 88" isn't very helpful, if it uses
only 88 bytes it surely can't be the guilty one.

Any ideas if I should try something else instead of heaptrc? Or any
other ideas about what to do?

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


Re: [fpc-pascal] cwstrings unit and UTF8Decode()

2016-03-25 Thread Felipe Monteiro de Carvalho
On Fri, Mar 25, 2016 at 3:16 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> "lazutf8 doesn't depending" when it is in the uses clause, sounds a bit
> strange to me :-)

Important part you are forgetting: {$IFDEF UTF8_RTL}

I don't know why it is needed in the utf-8 RTL, since I haven't used
this RTL yet, but in the RTL that I am using it doesn't depend in that
unit :)

Anyway, what I meant is that the routines themselves are Pascal
implementations of the Unicode standard. We even have
uppercase/lowercase tables. So we depend as little as possible on
system stuff. More reliable, more cross-platform and some routines
actually are several times faster than system ones.

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


Re: [fpc-pascal] cwstrings unit and UTF8Decode()

2016-03-25 Thread Felipe Monteiro de Carvalho
On Fri, Mar 25, 2016 at 2:01 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> Look at the sources

Which proves me right, or do I miss something?

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


Re: [fpc-pascal] cwstrings unit and UTF8Decode()

2016-03-25 Thread Felipe Monteiro de Carvalho
On Fri, Mar 25, 2016 at 1:20 PM, Bart <bartjun...@gmail.com> wrote:
> If you're using LazUtf8 (or use LCL) then cwstring will be used in your app.
> And I guess that Utf8ToUtf16 from Lazutf8 does not depend on a WS
> manager, but I may be terribly wrong about that.

As far as I remember, lazutf8 doesn't depending on cwstring for
(most?) of its funcionality.

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


Re: [fpc-pascal] Smartphone apps in FPC

2016-03-18 Thread Felipe Monteiro de Carvalho
On Thu, Mar 17, 2016 at 11:29 AM, Maciej Izak <hnb.c...@gmail.com> wrote:
> 2016-03-17 11:08 GMT+01:00 Michael Van Canneyt <mich...@freepascal.org>:
>> - Use the NDK, and then basically you're writing a native Linux
>> application.
>>   You can try to use the Android SDK through some JNI tricks; but I am
>>   unsure how well this works.
>
> I can confirm that works very well,

Well, yes, it works fine, but you still need a Java part otherwise a
lot of APIs cannot be accessed. In particular APIs that require
creating interfaces.

> even is possible visual remote-debugging
> from Lazarus (but that requires many IDE modifications).

wow, any link describing how to achieve that?

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


[fpc-pascal] EDatabaseError on SELECT

2016-02-10 Thread Felipe Monteiro de Carvalho
Hello,

I'm posting here because this seams to be an issue with using sqldb,
my SQL seams to be ok.

I create a table and add a row to it, but when trying to read that
same row using SELECT I get EDatabase error with message "Syntax error
near SELECT".

I create the Table and add a row to it like this:

  FSQLConn := TSQLite3Connection.Create(nil);
  FSQLTran := TSQLTransaction.Create(nil);
  FQuery := TSQLQuery.Create(nil);
  FQuery.DataBase := FSQLConn;
  FQuery.Transaction := FSQLTran;
.
  lTableName := GetTableName(AListNr, dtkHeader);
  lSQL := Format('CREATE TABLE "%s"( "ID" INTEGER,'+
' "Block_NrOfItems" INTEGER, "Block_ParentList" INTEGER,'+
' "Block_IndexIn_ParentList" INTEGER, "Block_Kind" INTEGER,'+
' "Block_Name" TEXT);', [lTableName]);
  FSQLConn.ExecuteDirect(lSQL);

  lSQL := Format('INSERT INTO %s (ID, Block_NrOfItems, Block_ParentList,'+
' Block_IndexIn_ParentList, Block_Kind, Block_Name)'+
' VALUES (%u, %u, %u, %s, %u, ''%s'')',
[lTableName, UINT32_ID_SINGLE_ROW_TABLE,
 AData.NrOfItems, AData.ParentList,
 IntToStr(AData.IndexIn_ParentList),
 AData.Kind, AData.Name]);
  FSQLConn.ExecuteDirect(lSQL);
  FSQLTran.Commit;

Here is the SELECT with error:

  lTableName := GetTableName(AListNr, dtkHeader);
  lSQL := Format('SELECT * FROM "%s" WHERE ID=%u', [lTableName,
UINT32_ID_SINGLE_ROW_TABLE]);
  FQuery.SQL.Add(lSQL);
  FQuery.Open; // <- EDatabaseError

I tested with sqlite3 command line and the same statement issues no
syntax error ...

Any ideas???

lTableName = Header_0
UINT32_ID_SINGLE_ROW_TABLE=0

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


Re: [fpc-pascal] EDatabaseError on SELECT

2016-02-10 Thread Felipe Monteiro de Carvalho
On Wed, Feb 10, 2016 at 12:45 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> Did you try clearing SQL first ?

What do you mean?

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


Re: [fpc-pascal] EDatabaseError on SELECT

2016-02-10 Thread Felipe Monteiro de Carvalho
Result in sqlite3 console:

sqlite> SELECT * FROM "Header_0" WHERE ID=0;
0|0|0|0|18|

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


Re: [fpc-pascal] Format and Cardinal

2016-02-10 Thread Felipe Monteiro de Carvalho
Hello,

lol, thanks for the comprehensive reply, if no one objects I will add
a note about this in
http://www.freepascal.org/docs-html/rtl/sysutils/format.html

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


Re: [fpc-pascal] EDatabaseError on SELECT

2016-02-10 Thread Felipe Monteiro de Carvalho
On Wed, Feb 10, 2016 at 1:20 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> You used sql.add. Did you do sql.clear first ?
> Otherwise you'll be sending 2 sql statements as 1.

ok, that fixed the issue, thanks!

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


Re: [fpc-pascal] EDatabaseError on SELECT

2016-02-10 Thread Felipe Monteiro de Carvalho
Hello,

Taking advantage that we are already talking about SQL  how to
upload the contents of a blob field?

I tried using a SELECT to get the field +
TBlobField(FQuery.FieldByName('Data')).LoadFromStream but it raises an
exception that "Dataset is not in insert or edit mode"

I see that I could write the data in hexadecimal in the SQL query, but
that would be slow...

So what is the proper way to use TBlobField.LoadFromStream?

Or should I use params + an SQL statement with question mark:

lSQL := Format('UPDATE %s SET ? WHERE ID=''%d''', [lTableName, AItemNr]);

?

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


[fpc-pascal] Format and Cardinal

2016-02-10 Thread Felipe Monteiro de Carvalho
Hello,

Why does this trigger an range check exception:

var
  lNum: Cardinal;
  lStr: string;
begin
  lNum := High(Cardinal);
  lStr := Format('Num=%u', [lNum]);

Format doesn't support integer numbers above High(Integer) ?

I really need to use IntToStr?

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


Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Felipe Monteiro de Carvalho
On Thu, Feb 4, 2016 at 7:03 PM, Mazola Winstrol <mazofei...@gmail.com> wrote:
> Lets wait for the Delphi implementation so, we will not start a new flame.

You mean like "wait 5-10 years until they decide independently that
they want to do it" or are there serious plans for Delphi to support
this, say, in the next version?

> The same applies to the ARC objects.

What's that?

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


Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Felipe Monteiro de Carvalho
On Thu, Feb 4, 2016 at 7:33 PM, Michael Van Canneyt
<mich...@freepascal.org> wrote:
> b) a ? b : c
> From the people that responded in the core discussion, the majority was for
> the a ? b : c syntax, or not adding at all (not all replied).

You mean like literally using "?" and ":" ?

> If someone feels like submitting a patch that implements a ? b : c, it may
> well be taken under advisement. I heard no-one speaking out clearly against
> the actual functionality (well, maybe one) or the a ? b : c form.

aha, I see, Sven's message wasn't clear about it, it sounded like core
is completely against any implementation.

While actually simply no-one is working on the desired solution, which
are 2 very different things.

> "if then" is a statement. This is a clear and unambiguous rule.

The idea was "inline if" not "if"

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


Re: [fpc-pascal] IfThen() intrinsic removed

2016-02-04 Thread Felipe Monteiro de Carvalho
Disappointed :(

Why was it done? I thought that pretty much everyone was in favor?

It isn't very pascalish, that's true, but we could implement it like
the proposed "inline if A then B else C" syntax... which is very
pascalish and cool.

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


Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-02 Thread Felipe Monteiro de Carvalho
If other people already use "iif" then maybe it is better to use the same name?

Also I vaguely remember at least a few functions in existing code
named IfThen which would conflict with the new one.

But "iif", well I never saw anyone name a function like that...

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


Re: [fpc-pascal] New feature: IfThen() intrinsic

2016-02-01 Thread Felipe Monteiro de Carvalho
So finally we have the ternary operator in Pascal? This will simplify
converting from C to Pascal.

>  j ;= IfThen(i < 32, 48, 21);

I guess this is a typo and should be ":=" instead of ";="

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


Re: [fpc-pascal] Read JSON from file

2015-08-07 Thread Felipe Monteiro de Carvalho
On Fri, Aug 7, 2015 at 8:33 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 As it happens, I have yesterday committed an extension which allows you to
 specify that the JSON supports comments.
 Both // and /* */ are detected and discarded.

Great! =)

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


Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread Felipe Monteiro de Carvalho
On Thu, Aug 6, 2015 at 10:37 PM, Chris Moody
inqu...@greensnakedesign.com wrote:
 For my current project, I download a file from a server that contains JSON
 code. I'm not sure how to read it into something that GetJSON is able to
 handle.

 My first thought was using TStrings, however not sure how to convert a
 TString into TStream.

I do it like this, with TStringStream:

  lStrings := TStringList.Create;
  try
lStrings.LoadFromFile(AFile);

// Parse JSON data
lStream := TStringStream.Create(lStrings.Text);
lParser := TJSONParser.Create(lStream);
try
  lParser.Strict := False;
  lData := lParser.Parse;
finally
  lParser.Free;
  lStream.Free;
end;

Well, in my particular case I use TStringList because I pre-process
the data, removing comments which are not allowed in JSON.

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


[fpc-pascal] fpcanvas and alpha-blending

2015-07-29 Thread Felipe Monteiro de Carvalho
Hello,

I'd like fpcanvas to support alpha-blending while drawing for example
polygons, and I wonder what the best way would be.

Maybe a new property AlphaBlend: Boolean to both TFPCustomBrush and
TFPCustomPen?

Pen has Mode, which could have a new mode for alphablend, although I'm
not sure if this is desirable... and brush has no mode.

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


[fpc-pascal] jsonrtti and integer arrays

2015-07-08 Thread Felipe Monteiro de Carvalho
Hello,

I see that according to http://wiki.freepascal.org/Streaming_JSON one
can use TStringList for an array of strings, but this seams to work
only for writing JSON, is it possible to read array of strings?

And how to read an array of integers?

Also, can my json be an array instead of an object?

A non-rtti simple example would also be good, since it looks like that
the rtti version cannot read arrays.

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


Re: [fpc-pascal] Google Code closing down

2015-03-14 Thread Felipe Monteiro de Carvalho
On Sat, Mar 14, 2015 at 12:38 PM, Mark Morgan Lloyd
markmll.fpc-pas...@telemetry.co.uk wrote:
 [Sigh] I feel like I'm being pushed onto git rather than Subversion. I can
 really do without this.

For subversion you can use sourceforge. It's USA-based, however. If
you are not using cryptography it shouldn't matter, should it?
Sourceforge writes that you can't export crypto tech to some
countries, but I don't remember anything else other than that.

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


Re: [fpc-pascal] cocoa programming without objective-pascal mode

2014-11-02 Thread Felipe Monteiro de Carvalho
On Sun, Nov 2, 2014 at 3:43 PM, Bee bee.ogra...@gmail.com wrote:
 Is it possible to do Cocoa GUI programming on Mac/OSX using FreePascal but
 without objective-pascal mode/dialect? Just pure object pascal or delphi
 mode. How do I access the Cocoa SDK (foundation, appkit, etc) from pascal
 code?

It is possible, I was doing it before Objective Pascal was created.
Just use the functions in the objective-c runtime, read:

http://wiki.lazarus.freepascal.org/PasCocoa

https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html

But I warn you that doing this is a terrible choice. Objective Pascal
is the way to go. I've been working in Objective Pascal in the LCL
Cocoa interface and it's pretty good IMHO. But if you are masochistic
you can use the runtime instead of Objective Pascal.

 I don't want to use Lazarus since it only supports Carbon (32-bit only) which 
 will be deprecated in the next few years.

The Cocoa interface is advancing fast. I am even running out of known
bugs, so other people testing would be appreciated.

 It is also breaks one of the most important advantage of FreePascal: cross 
 platform language.

I don't see how Lazarus would break cross platform. That's a wierd statement.

 I'm an old pascal lover who feels left alone on Apple platform because 
 FreePascal/Lazarus are no longer Apple friendly like they used to be.

You got the order inverted here. It is not FPC/Lazarus that are less
Apple friendly. It is Apple that is each time less Pascal friendly,
and for that matter also each time less C/C++/Java friendly. Apple
wants you to use Swift (or whatever it's called).

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


[fpc-pascal] console gdb in mac

2014-09-07 Thread Felipe Monteiro de Carvalho
Hello,

I'm trying to debug lcl-cocoa, but the debugger in the IDE is not
helping (not stopping in breakpoints inside the LCL, can't read
variable names, etc...)

So I moved to the console gdb, and I can already break, step over, etc.

But, how to read variable names? I guess a wierd mangling will be
involved here =)

In particular, let's say I am here:

procedure TControl.SetParent(NewParent: TWinControl);
begin
  if FParent = NewParent then exit; --- here

How can I read the value of field FParent which is located in object Self ?

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


Re: [fpc-pascal] console gdb in mac

2014-09-07 Thread Felipe Monteiro de Carvalho
On Sun, Sep 7, 2014 at 5:19 PM, Felipe Monteiro de Carvalho
felipemonteiro.carva...@gmail.com wrote:
 I'm trying to debug lcl-cocoa, but the debugger in the IDE is not
 helping (not stopping in breakpoints inside the LCL, can't read
 variable names, etc...)

Well, I see now that IDE debugging generally works, but that reliably
it stops working inside this function:

function TCocoaWidgetSet.SetFocus(Handle: HWND): HWND;

Breakpoint inside it works, but stepping / viewing values / any other
action will crash gdb.

Anyway, I'd still like to know the answer to my original question, if
anyone knows =)

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


Re: [fpc-pascal] Android/JNI control example

2014-04-24 Thread Felipe Monteiro de Carvalho
There is a JNI example app here:
http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/bindings/android-ndk/examples/jnitest/

It doesn't create a button, instead it creates a TextView, and it
doesn't create it in Pascal, but in Java. Anyway, it is a starting
point to do whatever you want, including creating buttons in Pascal.

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


Re: [fpc-pascal] JNI/Android: Java events calling pascal code

2014-04-23 Thread Felipe Monteiro de Carvalho
On Wed, Apr 23, 2014 at 6:10 AM, leledumbo leledumbo_c...@yahoo.co.id wrote:
 Hmm...that's beyond my Java skill. Since Felipe who started the topic, you
 can try PM him instead.

So looking at what he originally posted:

setOnCompletionListener(MediaPlayer.OnCompletionListener listener)

And looking into the documentation:

http://developer.android.com/reference/android/media/MediaPlayer.OnCompletionListener.html

you need to provide a class which implements the
MediaPlayer.OnCompletionListener interface:

There is nothing in JNI unfortunately which would allow us to create
new classes. JNI is very limited, unlike objc runtime which gives us
access to everything, JNI gives us a limited access to the Java world.

I already asked in the past in Java/Android groups about this, how to
get rid of Java when you need to pass a class which implements and
interface.

The answer is that it is possible: You need to create the class in
.. java bytecode =D And then pass it to Java.

At this point I gave up, considering it too awkward and wrote my
software part in Java and part in Pascal.

Ideally it would not be so hard if we had a bytecode generator which
accepts as input things like classname, which interfaces it will
implement, list of functions and address to their implementation, etc,
etc. But we don't have at the moment AFAIK.

So maybe someone braver will actually do this, since it is possible =D
But I didn't for my Android app in the app store (True Democracy)

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


Re: [fpc-pascal] Re: read cells contents from .xls file

2013-10-02 Thread Felipe Monteiro de Carvalho
Why cant you download the latest FPC?

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


Re: [fpc-pascal] Re: read cells contents from .xls file

2013-10-02 Thread Felipe Monteiro de Carvalho
It's really very simple. fpspreadsheet requires lazutils, which comes
inside the source code from Lazarus and lazutils does not require
anything out of FPC.

So if you don't want to use Lazarus, which would automatically solve
the problem, then just pass 2 unit search paths to FPC when compiling
your project which uses fpspreadsheet:

1 Path to fpspreadsheet
2 Path to lazutils (located in the folder lazarus/components/lazutils)

You need to download Lazarus to have lazutils, but you don't have to
use it as an IDE.

Felipe Monteiro de Carvalho


On Wed, Oct 2, 2013 at 1:09 PM, John Lee johnel...@gmail.com wrote:
 I have it and use it - but not lazarus. But using some legacy 2.2.2
 libraries w/o source  want it to work there. Even with latest fpc it didn't
 seem very easy to get sheet data into csv, I couldn't follow the examples in
 fpspread..., seemed to need lots of lazarus stuff n units that I didn't
 understand, just to do something simple, as in my original email.
 J


 On 2 October 2013 11:20, Felipe Monteiro de Carvalho
 felipemonteiro.carva...@gmail.com wrote:

 Why cant you download the latest FPC?

 --
 Felipe Monteiro de Carvalho
 ___
 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



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


Re: [fpc-pascal] read cells contents from .xls file

2013-10-01 Thread Felipe Monteiro de Carvalho
The source code of fpspreadsheet is open ... just copy/paste/modifiy
it for your needs:

https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/components/fpspreadsheet/xlsbiff8.pas#l50

But BIFF8 is not a simple format, there is no simple answer to your
question. It is encapsulated in a OLE Document storage system to start
with, which is something pretty complex.

BIFF2 till BIFF5 (Excel 5.0) were simple formats, but that's not the
format you are looking for from your question.

Felipe

On Mon, Sep 30, 2013 at 9:45 PM, John Lee johnel...@gmail.com wrote:
 Thanks - that looks excellent, but the 'uses' list for this, for non lazarus
 users, has, I guess, lots of things in it.

 The problem is also that I'm trying to implement this hack in an old version
 of pascal, v2.2.2 for which I only have the compiler  basic rtl stuff -
 that's why I'd just like some info for a quick hack eg some bullets or some
 idea what I need to do eg to read the no or string in eg cell x23 of sheet
 jim in fred.xls.

 John






 On 30 September 2013 16:38, Felipe Monteiro de Carvalho
 felipemonteiro.carva...@gmail.com wrote:

 You mean like this library does? http://wiki.freepascal.org/FPSpreadsheet

 Felipe Monteiro de Carvalho

 On Mon, Sep 30, 2013 at 5:33 PM, John Lee johnel...@gmail.com wrote:
  File produced by excel 2003. Can anyone tell me the basic ideas,
  formats,
  pitfalls - I'd just like to write a short routine  don't want to fight
  with
  the complexities of the lazarus based stuff. Prepared to experiment...
 
  TIA John
 
 
 
  ___
  fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-pascal



 --
 Felipe Monteiro de Carvalho
 ___
 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



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


Re: [fpc-pascal] read cells contents from .xls file

2013-09-30 Thread Felipe Monteiro de Carvalho
You mean like this library does? http://wiki.freepascal.org/FPSpreadsheet

Felipe Monteiro de Carvalho

On Mon, Sep 30, 2013 at 5:33 PM, John Lee johnel...@gmail.com wrote:
 File produced by excel 2003. Can anyone tell me the basic ideas, formats,
 pitfalls - I'd just like to write a short routine  don't want to fight with
 the complexities of the lazarus based stuff. Prepared to experiment...

 TIA John



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



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


Re: [fpc-pascal] Android and cwstring

2013-08-01 Thread Felipe Monteiro de Carvalho
On Thu, Aug 1, 2013 at 9:59 AM, Torsten Bonde Christiansen
t...@epidata.info wrote:
 I did some research before i sent the mail and found the libucuuc.so using
 adb shell into an emulator.

That's a common mistake. Android is a full Linux inside, so of course
there are tons of native libraries available inside. But they are not
guaranteed to be there, they are not guaranteed to work as expected in
all devices, etc. One should never use libraries outside the list of
available NDK libraries. I'm not saying it won't work, it might work,
but the official position of Google developers is that they should not
be used.

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


Re: [fpc-pascal] Android and cwstring

2013-07-31 Thread Felipe Monteiro de Carvalho
On Wed, Jul 31, 2013 at 3:11 PM, Torsten Bonde Christiansen
t...@epidata.info wrote:
 More specifically i cannot get the library to use the cwstring unit. Below
 you see a working example of a library that works fine (the log entry is
 generated) when cwstring i commented out, but when included the android
 application just hangs on the message:

Doesn't cwstring link to the iconv library? If yes, then I guess you
can give up on using it on Android. There is no iconv available in
Android for 3rd party applications. The list of available libraries is
very small, I described it here for API level 8 which is what I
usually set as my minimum requisite:
http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#NDK_Libraries_available_in_Android_2.2_.28API_level_8.29

Anyway, I wrote a 100% Pascal widestring manager implementation which
works in Android, it is available in the Lazarus source tree, here:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/components/lazutils/paswstring.pas?view=markuprevision=41389root=lazarus

You can copy it to your project and use it.

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


Re: [fpc-pascal] Sockets?

2013-07-17 Thread Felipe Monteiro de Carvalho
Good things to read:

http://wiki.freepascal.org/Networking

http://wiki.freepascal.org/lNet

http://wiki.freepascal.org/Synapse

none of those contain an example like you ask, however. But it should
be easy to implement with either synapse or lnet. synapse might even
be easier.

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


Re: [fpc-pascal] OT: Re: http://www.freepascal.org/future.var

2013-07-05 Thread Felipe Monteiro de Carvalho
On Fri, Jul 5, 2013 at 11:27 AM, Noah Silva
shir...@galapagossoftware.com wrote:
  I (can) and (will not) ...

This interpretation is wrong. For the sentence to mean this, it would
need to be worded like this: I can, but will not ...

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


Re: [fpc-pascal] can someone please email me a zipped hello world binary program MIPS big endian for testing on my MIPS hardware?

2013-06-13 Thread Felipe Monteiro de Carvalho
On Thu, Jun 13, 2013 at 4:01 AM, Dennis Poon den...@avidsoft.com.hk wrote:
 Mark,
 Yes, please kindly send both test executables to me.

Dennis, did you try running the compiler itself as previously explained?

The compiler is a MIPS executable compiled with Free Pascal. You can
run it in the command line just to see if it runs.

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


Re: [fpc-pascal] Some RTL functions cry big tears when mixing Pchar and Ansistring/String

2013-06-11 Thread Felipe Monteiro de Carvalho
On Tue, Jun 11, 2013 at 5:29 PM, m...@rpzdesign.com m...@rpzdesign.com wrote:

  I totally understand, but I did not discover the problem until
 I was well into a larger project that I could not de-construct
 to try to generate a reproducible sample.

 I am under a time pressure, decided to start using using LAZ/FPC about 3
 months ago,
 and when I starting running the program under load, it started to die.


In my experience when such strange issues appeared and I started
distrusting the RTL, every single time I eventually could track the bug to
 an error in my own code. Don't remember the RTL ever causing such
issues in all those years. You probably have a memory corruption,
uninitialized variable or some other error in your code which causes the
problem, but depending on the problem it might be really hard to debug.

Sometimes when debugging didn't help, I simply resorted to reading the
entire code base again ... until I found the error.

Running in a different operating system also helps, sometimes it debugs
better in another OS. Sometimes it even works fine in another OS, despite
the error being present at all times =D

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

[fpc-pascal] Android JNI failing in Galaxy S4

2013-05-22 Thread Felipe Monteiro de Carvalho
 failed');
  end;

My only idea at the moment is to do the static export too... maybe
that will work, lets see.

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


[fpc-pascal] Re: Android JNI failing in Galaxy S4

2013-05-22 Thread Felipe Monteiro de Carvalho
On Tue, May 21, 2013 at 5:47 PM, Felipe Monteiro de Carvalho
felipemonteiro.carva...@gmail.com wrote:
 My only idea at the moment is to do the static export too... maybe
 that will work, lets see.

No, that didn't help anything =(

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


[fpc-pascal] Re: Android JNI failing in Galaxy S4

2013-05-22 Thread Felipe Monteiro de Carvalho
Oh, forget it. Someone answered in android-ndk group: I had a typo in
another JNI routine which caused the problem.

It seams that the new Android checks all JNI routines at startup.
Older ones checked the routines only when they were utilized, so would
only crash when it was utilized.

-- 
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 JNI failing in Galaxy S4

2013-05-22 Thread Felipe Monteiro de Carvalho
Hello,

On Wed, May 22, 2013 at 1:50 PM, m...@rpzdesign.com m...@rpzdesign.com wrote:
 Are you saying that you are writing JNI routines in Pascal for android?

Yes. And luckly it works in all devices =) I was a bit scared that I
might hit a wierd problem here involving code generation or whatever,
but ... just a normal typo in my program.

 If so, can you post some of the things like the pascal header files you use
 to allow for the creation of the .so files
 so that Java can call into pascal across the JNI interface.

See here:

http://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/bindings/android-ndk/

The file jni.pas is what you are looking for. The rest are Android NDK
headers. I think that it should work for any Java platform.

In the folder examples there, there is a full Android JNI example.

In lazarus/lcl/interfaces/customdrawn/* there is also a lot of JNI
code for Android which can be utilized as examples to learn how to 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] Re: Android JNI failing in Galaxy S4

2013-05-22 Thread Felipe Monteiro de Carvalho
On Wed, May 22, 2013 at 3:54 PM, m...@rpzdesign.com m...@rpzdesign.com wrote:
 Watch out when the Intel mobile processors come along, I doubt they will be
 ARM 7 compatible.
 But they may be x86!

That's not problem. If we have x86 too, then instead of doing 2 clicks
to build the project, I'll have to do 4 clicks. 1 to build for arm, 1
to change the build mode, 1 to build for x86 and 1 to build both apks

Doesn't change much to me =)

On Wed, May 22, 2013 at 3:56 PM, m...@rpzdesign.com m...@rpzdesign.com wrote:
 Any comments on how you would mix C and pascal into the same binary
 for JNI/Android?

Maybe in the same way that is done in desktops?
via {$L objectfile.o} + headers with the directive external

Something like:

uses ctypes;
function something_from_c(params: cint): cint; cdecl; external;

I think it is $L ... I haven't utilized this feature in a long time.

Your c code needs to be compiled for arm-android of course.

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


Re: [fpc-pascal] Re: Xcode

2012-09-17 Thread Felipe Monteiro de Carvalho
On Sun, Sep 16, 2012 at 11:35 AM, Mabu realm...@gmail.com wrote:
 So the conclusion is that a new developer, like me, who has only installed
 Xcode 4.4.1, will NOT be able to install fpc 2.6.0, fpcsrc 2.6.0 and
 definitely NOT be able to use Lazarus on a Mac box?

How did you arrive at this conclusion? I think that you missread the
post by Jonas and this lead you to a completely wrong conclusion.

I'm quite sure that someone with any Xcode installed can install fpc,
fpcsrc and use Lazarus.

Lazarus does not use Xcode templates. It uses only the command line
binutils. So it is unaffected by issues which involve the templates.
But like Jonas said you may need aditional steps to install command
line tools in newer Xcode versions.

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


[fpc-pascal] Constant of 2D array

2012-09-11 Thread Felipe Monteiro de Carvalho
Hello,

Can I write constants of a 2D array? I am trying to convert some C++
code which uses this ... so far I tryed:

const number_return_map: array[0..7][0..7] of U8 =
(
  ( 15, 14, 13, 12, 11, 10,  9,  8 ),
  ( 14,  0,  1,  3,  6, 10, 10,  9 ),
  ( 13,  1,  2,  4,  7, 11, 11, 10 ),
  ( 12,  3,  4,  5,  8, 12, 12, 11 ),
  ( 11,  6,  7,  8,  9, 13, 13, 12 ),
  ( 10, 10, 11, 12, 13, 14, 14, 13 ),
  (  9, 10, 11, 12, 13, 14, 15, 14 ),
  (  8,  9, 10, 11, 12, 13, 14, 15 )
);

but it stops between the two [0..7] requesting a of, which indicates
that it does not want a 2D array but expects a 1D array only.

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


Re: [fpc-pascal] Constant of 2D array

2012-09-11 Thread Felipe Monteiro de Carvalho
On Tue, Sep 11, 2012 at 2:58 PM, Vincent Snijders
vincent.snijd...@gmail.com wrote:
 const number_return_map: array[0..7,0..7] of byte =

Ah, nice, thanks =) Now it works... and the syntax is almost the same
as in C++ which facilitates the conversion

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


Re: [fpc-pascal] (no subject)

2012-02-24 Thread Felipe Monteiro de Carvalho
I think that you just described class methods:

http://www.freepascal.org/docs-html/ref/refsu27.html

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


[fpc-pascal] dbus in Pascal

2012-02-22 Thread Felipe Monteiro de Carvalho
Hello,

I haven't touched in dbus in ages, so I was wondering how people are
using it. Did anyone write a wrapper around libdbus for Lazarus or is
everyone using directly libdbus or something like dbus-glib? Do we
have bindings for dbus-glib already translated?

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


Re: [fpc-pascal] dbus in Pascal

2012-02-22 Thread Felipe Monteiro de Carvalho
On Thu, Feb 23, 2012 at 8:42 AM, Michael Van Canneyt
mich...@freepascal.org wrote:
 I have written dbus classes/components. I never committed them, but they
 work, and if you want I can send them to you.
 If you think they're good enough, we can include them in FPC.

Yes, I am very interrested in seeing this

How do you get messages with this library? You need to call something
periodically? I always thought that dbus needs integration with the
application loop.

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


Re: [fpc-pascal] How create a full text search with TChmWriter?

2012-02-21 Thread Felipe Monteiro de Carvalho
On Tue, Feb 21, 2012 at 4:08 PM, Mattias Gaertner
nc-gaert...@netcologne.de wrote:
 Bingo. It does not:

 Generating Table of contents...
 Generating Index...
 Finishing compressing...
 Exception at 0050057F: EAccessViolation:
 Access violation.

 docs/html/lcl/lcl.chm is 0 bytes.

Which FPC version are you using? Those errors occured for me in FPC
2.4.* but disappeared in FPC 2.6.0

FPC 2.7.1 introduced new errors =)

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


Re: [fpc-pascal] How create a full text search with TChmWriter?

2012-02-21 Thread Felipe Monteiro de Carvalho
On Tue, Feb 21, 2012 at 4:37 PM, Mattias Gaertner
nc-gaert...@netcologne.de wrote:
 What do you mean with Those errors?

AVs in fpdoc

 I'm pretty sure 2.6.0 can create AVs too.

oh ... I haven't yet had any AV in fpdoc from 2.6.0 while I had them
all the time in 2.4.x
I guess your mileage can vary then.

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


[fpc-pascal] level curve and surface generation code

2012-02-20 Thread Felipe Monteiro de Carvalho
Hello,

I was wondering if anyone has seen Pascal code around for these two tasks

1 generate level curves from an array of 3D points

2 Generate a 3D surface from an array of 3D points. Here so far my
best idea is using the marching cubes algorithm. I'd prefer only
triangles, since those fit better to OpenGL.

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: level curve and surface generation code

2012-02-20 Thread Felipe Monteiro de Carvalho
On Mon, Feb 20, 2012 at 3:59 PM, leledumbo leledumbo_c...@yahoo.co.id wrote:
 Something like
 http://www.sulaco.co.za/opengl_project_terrain_generation_using_heightmaps.htm
 terrain ?

Pretty good! Unfortunatelly in my case the input is much more complex.
Here it seams to be a grid with heights given as input. I have an
array of 3D points. Maybe I should first generate a grid of heights
and then try the code here.

And I got something wrong in the other question. The english
terminology is countour line, in portuguese it is Curva de nivel,
and my direct translation didn't work out very well =)

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


Re: [fpc-pascal] Re: Working Free Pascal android JNI example

2012-02-13 Thread Felipe Monteiro de Carvalho
Hello,

For asking Android questions I recommend the Lazarus forum:

http://www.lazarus.freepascal.org/index.php/board,43.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] What ARM targets are supported by FPC?

2012-02-08 Thread Felipe Monteiro de Carvalho
On Tue, Feb 7, 2012 at 3:19 PM, Jorge Aldo G. de F. Junior
jagf...@gmail.com wrote:
 Graeme, can you help port fpGui to DirectFB ? this would help embedded
 development a lot...

I don't know if you use fpgui only or the lcl too, but you might want
to know that now the LCL can be ported to platform like directfb via
LCL-CustomDrawn:

See http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface

It was specially designed to run in a system such a the framebuffer,
which is very similar to what Android for example offers: Only a raw
surface.

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


Re: [fpc-pascal] Problem using make install in Windows

2012-02-07 Thread Felipe Monteiro de Carvalho
Thanks, you were right =)

But strange that it considered my \ a space. I know that \  is a
escaping for a space, but there was no space in the end.

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


[fpc-pascal] Problem using make install in Windows

2012-02-06 Thread Felipe Monteiro de Carvalho
In Windows I am executing:

PATH=F:\Programas\lazarus31_fpc26\fpc\2.6.1\bin\i386-win32
make all
make install INSTALL_PREFIX=F:\Programas\fpcsvn\dest\
pause

And it will build the RTL and put it in the expected place, then it
starts putting hash in the place and then ... I get the following
error:

make[3]: Entering directory `F:/Programas/fpcsvn/packages'
make -C hash distinstall
make[4]: Entering directory `F:/Programas/fpcsvn/packages/hash'
F:/Programas/fpcsvn/compiler/ppc386.exe fpmake.pp -n -FuF:/Programas/fpcsvn/pack
ages/fpmkunit/units_bs/i386-win32 -FuF:/Programas/fpcsvn/rtl/units/i386-win32
./fpmake.exe install --localunitdir=../.. --globalunitdir=.. --os=win32 --cpu=i3
86 -o -Ur -o -Xs -o -O2 -o -n -o -FuF:/Programas/fpcsvn/rtl/units/i386-win32 -o
-FE. -o -FUunits/i386-win32 -o -di386 -o -dRELEASE --compiler=F:/Programas/fpcsv
n/compiler/ppc386.exe --prefix=F:\Programas\fpcsvn\dest\  --unitinstalldir=F:\Pr
ogramas\fpcsvn\dest\/units/i386-win32/hash -ie
The installer encountered the following error:
Failed to create directory F:\Programas\fpcsvn\dest \examples\fpc-hash-2.7.1\ex
amples\
make[4]: *** [distinstall] Error 1
make[4]: Leaving directory `F:/Programas/fpcsvn/packages/hash'
make[3]: *** [hash_distinstall] Error 2
make[3]: Leaving directory `F:/Programas/fpcsvn/packages'
make[2]: *** [packages_distinstall] Error 2
make[2]: Leaving directory `F:/Programas/fpcsvn'
make[1]: *** [installother] Error 2
make[1]: Leaving directory `F:/Programas/fpcsvn'
make: *** [install] Error 2

I see the space between \dest and \examples but I dont see how it is
something that I did wrong, or else it should fail in the RTL too.

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


Re: [fpc-pascal] TStringStream.DataString returns garbage?

2012-02-03 Thread Felipe Monteiro de Carvalho
On Fri, Feb 3, 2012 at 9:39 AM,  michael.vancann...@wisa.be wrote:
 http://www.freepascal.org/docs-html/rtl/classes/tstream.writeansistring.html
 We could make an optional parameter AsText : Boolean = False which would
 then write the former.

I think this would be a nice addition. One thing I would suggest is
using a more clear wording. AsText might be hard to understand what
the author ment. Either with the length or without it is still text in
a certain way. A more clear wording could be: AWriteTextContentsOnly:
Boolean = False or AWriteStringLength: Boolean = True

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


Re: [fpc-pascal] libQT4Pas - Why it is needed?

2012-01-29 Thread Felipe Monteiro de Carvalho
On Sun, Jan 29, 2012 at 11:38 PM, Lars nore...@z505.com wrote:
 Do other languages like python use the plain c interface, or C++?

 how about something like ruby, lua, objective C, php ..

No idea, but Python, ruby, lua and php do not generate real programs
but instead are just scripts which run in a interpreter, which is
immensely different from a real program.

A more close comparison to Pascal might be asking what Fortran, Cobol,
Ada or other similar compiled languages do, and I think that all of
those would need a C interface.

I know very well Java due to Android work, which cannot bind to
anything directly. It requires a special format using plain procedures
in a special way, so it is like a C interface, or a plan Pascal
procedural interface. It is called JNI and it will never accept C++

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


[fpc-pascal] fpdoc links and short description

2012-01-27 Thread Felipe Monteiro de Carvalho
Hello,

I havent seen an answer for this in the other thread and it is getting
too big. So, in fpdoc if we make a link like this:

element name=TShellTreeView.OnMouseDown
link=#LCL.Controls.TControl.OnMouseDown/

It does not properly link the short description when listing elements
of a class, for example.

Is this a bug or should it work like this?

Is it possible to link the short description too? How?

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


Re: [fpc-pascal] fpdoc links and short description

2012-01-27 Thread Felipe Monteiro de Carvalho
On Fri, Jan 27, 2012 at 11:06 AM,  michael.vancann...@wisa.be wrote:
 Most likely a bug, please report it.

umm, now I have rebuilt the docs and it obtained the short description
in the top-level view. I think I was using an old version of fpdoc ...

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


Re: [fpc-pascal] fpdoc links and short description

2012-01-27 Thread Felipe Monteiro de Carvalho
Aha! I found the gotcha!

If I write the link like this:

  element name=TRadioGroup.OnSelectionChanged
link=TCustomRadioGroup.OnSelectionChanged
short/
descr/
seealso/
  /element

Then it links properly (clicking makes it go to
TCustomRadioGroup.OnSelectionChanged) but it will not copy the short
description to the class overview. But it does that if I link like
this:

  element name=TRadioGroup.OnSelectionChanged
link=#lcl.ExtCtrls.TCustomRadioGroup.OnSelectionChanged
short/
descr/
seealso/
  /element

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


[fpc-pascal] Converting header with va_list

2012-01-18 Thread Felipe Monteiro de Carvalho
Hello,

I need to convert this:

[felipe@localhost android]$ gedit
~/Programas/android-ndk-r5/platforms/android-8/arch-arm/usr/include/jni.h

void(*CallStaticVoidMethodV)(JNIEnv*, jclass, jmethodID, va_list);

To Pascal. I tryed using array of const, but it keeps crashing in this call =(

  
CallStaticVoidMethodV:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:array
of const);{$ifdef mswindows}stdcall;{$else}cdecl;{$endif}

Any ideas if using array of const is a good idea or if something else
is better? My target is Android (via arm-linux in FPC)

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


Re: [fpc-pascal] Converting header with va_list

2012-01-18 Thread Felipe Monteiro de Carvalho
Hello,

Thanks, it is good to have some input as to what would be necessary,
but in the mean time I solved my problem in another way. JNI has
another way of sending the parameters, the A functions:

CallStaticVoidMethodA:procedure(Env:PJNIEnv;AClass:JClass;MethodID:JMethodID;Args:PJValue);

And this worked for me sending a pointer to the first element of a
pascal static Array in the parameter Args.

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


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
If you are trying to print, why do you want to use PostScriptCanvas
directly? Are you targeting only UNIXes? How will you connect the
generated postscript to the printer? You have your own code for that?

I would recommend that you use the LCL in your project and print via
the Printer object, as normally done. LCL applications do not need to
be visual, just make an application without any forms.

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


Re: [fpc-pascal] Advanced Records - Why not available by default?

2012-01-17 Thread Felipe Monteiro de Carvalho
On Sun, Jan 15, 2012 at 12:59 AM, Lars nore...@z505.com wrote:
 Personally, I'm getting sick of all the new features added to delphi that
 don't add anything meaningful, and just add complexity to the compiler.

Why is compiler complexity relevant (if true at all that the new
features add significant complexity)? Are you sending patches to the
compiler and finds that the new features disturb this?

About adding something meaningful, this varies from one person to
another one. For me new features might not be useful now, but if there
is a chance they might be useful in the future, then they are good
features to have. Use cases are often not obvious. I would normally
not think that static class methods are useful, but they were very
useful for me in the early days of PasCocoa. And if a features will
never be useful to me, then they will be for someone else (if they
were useful for noone, then noone would have written the code to
support them in the first place)

And if you dont like them, you dont need to use them. The LCL rarely
uses newer compiler features. I would say the same for most code in
the FCL.

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


Re: [fpc-pascal] Re: Help!!

2012-01-17 Thread Felipe Monteiro de Carvalho
If the use case is closing the main form without quitting the
application, then I would prefer a property
TApplication.QuitApplicationWhenMainFormCloses or something like that.

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


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
On Tue, Jan 17, 2012 at 1:40 PM, David Copeland
david.copel...@jsidata.ca wrote:
 I had not thought that approach (a non-visual lcl program) to be
 possible, but I will try it. Would I use the Nogui widgetset?

No, it doesn't implement printing.

 Would such a program run on a host where X was not installed?

No

 I am targeting only Linux. I save the output to a file (SaveToFile). The user 
 prints the
 file if needed.

Well, if you are not printing in your software then you are not doing
printing, only drawing. So the answer to my original questions should
have been Drawing. So with your requirements using the LCL is
probably not necessary. If you are targeting only linux then you can
probably use a command line execution to print the file.

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


Re: [fpc-pascal] Postscriptcanvas

2012-01-17 Thread Felipe Monteiro de Carvalho
I think I was wrong about the nogui LCL widgetset. It should probably
be able to run the unit Postscriptcanvas and require no X11.

Another option would be adding postscript output to fpvectorial. It
has postscript input at the moment but not output:
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] Postscriptcanvas

2012-01-15 Thread Felipe Monteiro de Carvalho
On Fri, Jan 13, 2012 at 3:31 PM, David Copeland
david.copel...@jsidata.ca wrote:
 Is it possible to use the PostScriptCanvas unit in a non-gui program?

For drawing or for printing?

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


Re: [fpc-pascal] Re: Finished full JVM Android application

2012-01-03 Thread Felipe Monteiro de Carvalho
On Fri, Dec 30, 2011 at 4:56 PM, leledumbo leledumbo_c...@yahoo.co.id wrote:
 I want it, I need it, give 'em to me, yeah!
 Anyway, are you using FPC-JVM or Lazarus-Android interface to accomplish
 this?

This thread is not related to the Lazarus Android support which is
called LCL-CustomDrawn-Android. LCL-CustomDrawn-Android is native and
communicates via JNI with the Android Java APIs. And I don't see any
reason to change it into using the JVM port even in a remote future,
because it already works great.

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


Re: [fpc-pascal] Meego Harmattan (Nokia N9) and fpc

2011-12-24 Thread Felipe Monteiro de Carvalho
On Sat, Dec 24, 2011 at 10:30 AM, zeljko zel...@holobit.net wrote:
 How to pass EABI to version 5 (fpc-2.4.5) ?

I use this solution to force the assembler into eabi 5. See Step 2 here:

http://wiki.lazarus.freepascal.org/Custom_Drawn_Interface/Android#Using_the_pre-compiled_compiler

Sometime ago I read here that this should be doable with an FPC option
to pass an assembler option, but I never used that.

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


Re: [fpc-pascal] where are the sources for rtl.chm, fcl.chm ref.chm etc.?

2011-12-24 Thread Felipe Monteiro de Carvalho
On Sat, Dec 24, 2011 at 6:43 PM, Marco van de Voort mar...@stack.nl wrote:
 The fpcdocs repository, run the fixdocs.sh scripts. Afaik for the lazarus
 there is no blind script.

There are lots of blind scripts for lazarus help building, although
its been a long time since I worked on them, so I don't know if they
still work blindly:

cd lazarus/docs/html

MacBook-de-Felipe-Monteiro-de-Carvalho:html felipe$ ls -l
total 2584
-rw-r--r--   1 felipe  staff  687  5 Jan  2010 Makefile
-rw-r--r--   1 felipe  staff  497  2 Out 16:47 README.txt
-rw-r--r--   1 felipe  staff  306  5 Jan  2010 build_chm.bat
-rwxr-xr-x   1 felipe  staff  189  5 Jan  2010 build_chm.sh
-rwxr-xr-x   1 felipe  staff 1030  5 Jan  2010 build_gtkintf_html.sh
-rw-r--r--   1 felipe  staff  274  5 Jan  2010 build_html.bat
-rwxr-xr-x   1 felipe  staff  190  5 Jan  2010 build_html.sh
-rw-r--r--   1 felipe  staff 1623  8 Nov 21:17 build_lcl_docs.lpi
-rwxr-xr-x   1 felipe  staff 3048 12 Ago 09:22 build_lcl_html.sh
-rw-r--r--   1 felipe  staff 2253  8 Nov 21:17 fpdoc.css
...

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


Re: [fpc-pascal] Timer in X11

2011-12-22 Thread Felipe Monteiro de Carvalho
On Thu, Dec 22, 2011 at 9:15 AM,  michael.vancann...@wisa.be wrote:
 As I understand it, Delphi and Lazarus implement the former, and don't need
 a timeout for it.

Ops, you are correct, it is a one shot event:

http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/Forms_TApplication_OnIdle.html

I think I implemented it as a repetitive event. ops =D I guess I'll
need to fix this.

But you should not try to compare directly the LCL gtk2 or qt4
widgetsets with fpgui since gtk2 and qt4 do most of the real work.
Lazarus now has a X11 interface which can be used for direct
comparisons and it uses the timeout. In general I don't fully trust
select() to wakeup correctly yet. I guess that more testing would show
if it does, but I read in the web that X11 could use more then one
file descriptor for communication, so if I use a infinite select() the
application could hang in some corner cases.

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


Re: [fpc-pascal] Timer in X11

2011-12-22 Thread Felipe Monteiro de Carvalho
On Thu, Dec 22, 2011 at 9:51 AM,  michael.vancann...@wisa.be wrote:
 Strange statement.

 If select() didn't do its job correctly, neither Qt or Gtk could do their
 job, or any network related program, for that matter.

It is not about select working or not, it is about how many file
descriptors X uses to communicate:

http://fixunix.com/xwindows/91558-xconnectionnumber-select.html#post301681

I don't have time in the foreseeable future to find in which wierd
corner case XAddConnectionWatch is necessary and test that a
implementation which I come up with works, but Qt could pay someone to
stay all week testing wierd corner cases and find the most perfect
algoritm. For me, timeouting every second is already more then good
enough, it could even be each half second. Already at 50ms I could not
see my application with top in the top 20 CPU users (most of which
were using zero), so I seriously doubt the battery usage concerns
unless someone really measures it.

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


[fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
Hello,

Does anyone know what would be the solution for implementing timer
support in a X11 toolkit? I already have TTimer support implemented
for LCL-CustomDrawn-Windows, Cocoa and Android (but Android is the
best tested of them), but it looks like X11 has no support for timers,
so I wonder what the best approach would be to solve this.

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


Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 4:53 PM, Henry Vermaak henry.verm...@gmail.com wrote:
 Spinning like this is bad news for efficiency and battery life of embedded
 devices.

Well, using X11 in an embedded device by itself is a very bad choice
=D And that's why it is very rare and linux-based phones don't use it.
But what do you mean exactly? Using the timeout 50?

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


Re: [fpc-pascal] Timer in X11

2011-12-21 Thread Felipe Monteiro de Carvalho
On Wed, Dec 21, 2011 at 5:46 PM, Henry Vermaak henry.verm...@gmail.com wrote:
 You're still guessing a timer interval of 10ms to add to the timer if the
 select() doesn't time out.  So your error can be as much as 990ms per
 iteration of the loop.  So much for precision then.

select() doesn't seam to return how much time has passed, so how do
you expect me to know the value when the only thing FPC offers for
time counting is Now() and each UNIX goes a wildly different way about
this?

I tried to implement GetTickCount as a first step to at least basic
time counting support in FPC outside Now, but it was quite hard and I
don't care about timer precision that much. If you need a precise
TTimer in X11, maybe you could try to implement GetTickCount and
GetMillisecondCount. I'd merge the implementation to lazutils, which
already has a GetTickCount waiting for a proper UNIX implementation
and then I could use it to implement a precise TTimer support in
LCL-CustomDrawn-X11.

If not, then it will stay like it is now until someone sends a patch
to improve it.

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


Re: [fpc-pascal] Why is Random(255) some 529x slower compared to Delphi 7?

2011-12-09 Thread Felipe Monteiro de Carvalho
On Fri, Dec 9, 2011 at 9:39 AM, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
 I didn't write this encryption code, I merely debugged why the unit
 tests for this unit took so long to complete, compared to under
 Delphi.

It is specifically written in the Delphi documentation that Random
should not be utilized for encryption...

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


  1   2   3   4   5   6   7   8   >