Re: [fpc-pascal] [OT] GPL Lisence help

2012-07-27 Thread Jorge Aldo G. de F. Junior
Do dynamic linked executables really need to not be GPL ?

I mean, application subdivision in modules has nothing to not be
accepted at courts as a valid concept.

Your module/lib is GPL but code linked to it must not be and this is
not a violation of GPL. Provided that the code to your module/lib is
sent with the binaries, the rest of code (non-gpl modules) dont need
to be provided.

software modularization is accepted at courts just like a car
subdivision in mechanical modules, at least when they are dynamically
linked.

Think about this : Can you think about the relationship of your
modules versus someone else modules as being intrinsecally the same
relation between linux and proprietary apps that happen to run in
linux ? Because (putting informational security concerns besides) the
userland apps calls kernel routines just like any app would call a
library routine, the difference is mainly due to security concerns as
the kernel code must be secured from userland. But as long as this is
dynamically linked, i dont see "judicial" differences here.

Thats my view and i am not a lawyer.

2012/7/27 Mark Morgan Lloyd :
> Dimitrios Chr. Ioannidis wrote:
>>
>> Hi all,
>>
>>   first let me express my apologies for the off topic question.
>>
>>   I'm having trouble to choose the correct gpl lisence for a new open
>> source project that i'm starting. I want the project to be open source
>> gpl'ed so it can be accepted in distro's like Debian. But, at the same
>> time, because the structure is modular, i want the possibility, to be
>> used by anyone in commercial applications.
>>
>>   Can anyone give a hint and/or a suggestion ?
>
>
> Possibly multiple licenses: the license is determined by how somebody has
> got the code from you irrespective of whether he could have got it
> elsewhere. Alternatively, the basic framework is GPL but dynamically-linked
> extensions are proprietary.
>
> I suppose that the bigger question is: how does one find an affordable
> lawyer, well-versed in the laws covering the major jurisdictions?
>
> --
> Mark Morgan Lloyd
> markMLl .AT. telemetry.co .DOT. uk
>
> [Opinions above are the author's, not those of his employers or colleagues]
>
> ___
> 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


Re: [fpc-pascal] [OT] GPL Lisence help

2012-07-27 Thread Mark Morgan Lloyd

Dimitrios Chr. Ioannidis wrote:

Hi all,

  first let me express my apologies for the off topic question.

  I'm having trouble to choose the correct gpl lisence for a new open
source project that i'm starting. I want the project to be open source
gpl'ed so it can be accepted in distro's like Debian. But, at the same
time, because the structure is modular, i want the possibility, to be
used by anyone in commercial applications.

  Can anyone give a hint and/or a suggestion ?


Possibly multiple licenses: the license is determined by how somebody 
has got the code from you irrespective of whether he could have got it 
elsewhere. Alternatively, the basic framework is GPL but 
dynamically-linked extensions are proprietary.


I suppose that the bigger question is: how does one find an affordable 
lawyer, well-versed in the laws covering the major jurisdictions?


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] [OT] GPL Lisence help

2012-07-27 Thread Daniel Gaspary
On Fri, Jul 27, 2012 at 5:39 PM, Dimitrios Chr. Ioannidis
 wrote:
> Hi all,
>
>   first let me express my apologies for the off topic question.
>
>   I'm having trouble to choose the correct gpl lisence for a new open
> source project that i'm starting. I want the project to be open source
> gpl'ed so it can be accepted in distro's like Debian. But, at the same
> time, because the structure is modular, i want the possibility, to be
> used by anyone in commercial applications.
>
>   Can anyone give a hint and/or a suggestion ?

How about Dual licensed ?

Let people choose the license: GPL or MIT
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] [OT] GPL Lisence help

2012-07-27 Thread Dimitrios Chr. Ioannidis
Hi all,

  first let me express my apologies for the off topic question.

  I'm having trouble to choose the correct gpl lisence for a new open
source project that i'm starting. I want the project to be open source
gpl'ed so it can be accepted in distro's like Debian. But, at the same
time, because the structure is modular, i want the possibility, to be
used by anyone in commercial applications.

  Can anyone give a hint and/or a suggestion ?

Regards,

--
Dimitrios Chr. Ioannidis
Nephelae - http://www.nephelae.eu
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] missing library name in external declaration in ascdef.inc

2012-07-27 Thread CA Gorski
There seems to be 'kernel32' missing in two functions in ascdef.inc of 
the rtl/win/wininc:


FindFirstFileEx and FindFirstFileTransacted
--- fpc/trunk/rtl/win/wininc/ascdef.inc Fr Jun  8 18:22:45 2012
+++ fpc/trunk/rtl/win/wininc/ascdef.my.inc  Fr Jul 27 23:31:01 2012
@@ -474,10 +474,10 @@
 function LogonUser(_para1:LPSTR; _para2:LPSTR; _para3:LPSTR; _para4:DWORD; 
_para5:DWORD;_para6:PHANDLE):WINBOOL; external 'advapi32' name 'LogonUserA';
 function CreateProcessAsUser(_para1:HANDLE; _para2:LPCTSTR; _para3:LPTSTR; 
_para4:LPSECURITY_ATTRIBUTES; _para5:LPSECURITY_ATTRIBUTES;_para6:WINBOOL; 
_para7:DWORD; _para8:LPVOID; _para9:LPCTSTR;
   _para10:LPSTARTUPINFO; _para11:LPPROCESS_INFORMATION):WINBOOL; external 
'advapi32' name 'CreateProcessAsUserA';
-function FindFirstFileEx(lpfilename : LPCStr;fInfoLevelId:FINDEX_INFO_LEVELS 
;lpFindFileData:pointer;fSearchOp : 
FINDEX_SEARCH_OPS;lpSearchFilter:pointer;dwAdditionalFlags:dword):Handle; 
stdcall; external name 'FindFirstFileExA';
+function FindFirstFileEx(lpfilename : LPCStr;fInfoLevelId:FINDEX_INFO_LEVELS 
;lpFindFileData:pointer;fSearchOp : 
FINDEX_SEARCH_OPS;lpSearchFilter:pointer;dwAdditionalFlags:dword):Handle; 
stdcall; external 'kernel32' name 'FindFirstFileExA';
 // winver>$0600
 function FindFirstFileTransacted(lpfilename : 
LPCStr;fInfoLevelId:FINDEX_INFO_LEVELS ;lpFindFileData:pointer;fSearchOp : 
FINDEX_SEARCH_OPS;lpSearchFilter:pointer;dwAdditionalFlags:dword;htransaction : 
HANDLE):Handle; stdcall;
-external name 'FindFirstFileTransactedA';
+external 'kernel32' name 'FindFirstFileTransactedA';
 {$endif read_interface}
 
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Getting UTC time etc.

2012-07-27 Thread Mark Morgan Lloyd
I know that this was discussed a couple of months ago, but I had 
difficulty working out what the consensus was.


i)	Is there an FPC function which will get the raw time from the RTC, 
which on unix systems will usually be UTC (specifically, without a DST 
correction)?


ii)	Are there functions to get "Unix seconds", "Borland seconds" and so 
on? Preferably without DST correction, or with the correction being 
extractable?


I'm trying to work out a fairly large distributed system, and while the 
backend databases will generally be able to supply UTC I'd like to be 
able to get it from the client for status messages etc. before connection.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Generating templates with FPTemplate

2012-07-27 Thread michael . vancanneyt



On Fri, 27 Jul 2012, Luciano de Souza wrote:


Michael,
Your example is very clear. I am not very good to understand source codes. 
But this style seems to be very good and logical.

It's really wonderful: FPC owns units for everything!


Well, I use FPC for everything. So, I need tools for everything, and what
better way than to make these tools open source and share them ?

This way everyone benefits, me included...

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


Re: [fpc-pascal] Generating templates with FPTemplate

2012-07-27 Thread Luciano de Souza

Michael,
Your example is very clear. I am not very good to understand source 
codes. But this style seems to be very good and logical.

It's really wonderful: FPC owns units for everything!
Thank you.

On 27/7/2012 08:43, michael.vancann...@wisa.be wrote:



On Fri, 27 Jul 2012, luciano de souza wrote:


Hello all,

I am trying to create an example with the FPTemplate unit. Firstly, I
wrote a hypothetical unit template.


[snip]



I am not successful in filling up the template. If I do
writeln(source.template), the answer is an empty string. If I do
writeln(source.GetContent), the answer is the template without the
needed replacements.

So I ask: what is wrong? How can I get a file, to replace tags and to
get a replaced string?


1. You need only one of the two classes, never both at the same time. 
2. You need to set the correct delimiters. Default are { and }


If you want to have fixed values for parameters, the easiest is
TTemplateParser. TFPCustomTemplate (or TFPTemplate) does not have 
fixed values, everything is event driven.


So, the following will do what you want:

program e30;

{$mode objfpc}{$H+}

uses
  fptemplate, classes;

var
  T : TTemplateParser;
  Fin,Fout : TFileStream;

BEGIN
  T := TTemplateParser.create;
  try
T.StartDelimiter:='<#';
T.EndDelimiter:='>';
T.values['name'] := 'freevox';
T.values['modules'] := 'sysutils, classes';
T.AllowTagParams:=False;
Fin:=TFileStream.Create('e30.txt',fmOpenRead);
try
  Fout:=TFileStream.Create('freevox.pas',fmCreate);
  try
T.ParseStream(fin,fout);
  finally
Fout.Free;
  end;
finally
  Fin.Free;
end;
  finally
T.free;
  end;
end.

Running this produces the file you want:

fsb: >e30
fsb: >cat freevox.pas
unit freevox;
{$mode objfpc}{$H+}

interface
uses
sysutils, classes

implementation

end.

That's it.

In revision 21977, I added a ParseFiles call, which makes the program 
even

easier:

program e30;

{$mode objfpc}{$H+}

uses
  fptemplate, classes;

var
  T : TTemplateParser;

BEGIN
  T := TTemplateParser.create;
  try
T.StartDelimiter:='<#';
T.EndDelimiter:='>';
T.values['name'] := 'freevox';
T.values['modules'] := 'sysutils, classes';
T.AllowTagParams:=False;
T.ParseFiles('e30.txt','freevox.pas');
  finally
T.free;
  end;
end.

Michael.
___
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


Re: [fpc-pascal] Re: Generating templates with FPTemplate

2012-07-27 Thread Luciano de Souza

On 27/7/2012 08:51, leledumbo wrote:

try this:

type
   TMyTemplate = class(TFPTemplate)
   private
 procedure ReplaceMyTags(Sender : TObject; Const TagString : String;
TagParams:TStringList; Out ReplaceText : String);
   public
 constructor Create;
   end;

procedure TMyTemplate.ReplaceMyTags(Sender : TObject; Const TagString :
String; TagParams:TStringList; Out ReplaceText : String);
begin
   // use if-else if-else if your compiler version doesn't support case
statement with string variable
   case TagString of
 'name': ReplaceText := 'sysutils, classes';
 'modules': ReplaceText := 'freevox';
   end;
end;

constructor TMyTemplate.Create;
begin
   inherited Create;
   StartDelimiter := '<#';
   EndDelimiter := '>';
   OnReplaceTag := @ReplaceMyTags;
end;

begin
   with TMyTemplate.Create do
 try
   FileName := 'e030.txt';
   WriteLn(GetContent);
 finally
   Free;
 end;
end.

if you want to use your style, you can try adapting
http://free-pascal-general.1045716.n5.nabble.com/file/n5710450/view.pp my
unit . It's more or less like what you want, only with more features as I
support parameters.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Generating-Yes, it's really 
very good. An example like that could be added to the source package. 
Templating with parameters? Oh! Yes, there are lots of interesting things I can 
do with it!

Thank you!



templates-with-FPTemplate-tp5710448p5710450.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
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: Generating templates with FPTemplate

2012-07-27 Thread leledumbo
Hey, that's nice, Michael. I never think of using TTemplateParser directly as
I thought it was meant to be used internally by TFPTemplate only. Now I see
that it actually has more features through OO approach instead of event
driven.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Generating-templates-with-FPTemplate-tp5710448p5710451.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Generating templates with FPTemplate

2012-07-27 Thread leledumbo
try this:

type
  TMyTemplate = class(TFPTemplate)
  private
procedure ReplaceMyTags(Sender : TObject; Const TagString : String;
TagParams:TStringList; Out ReplaceText : String);
  public
constructor Create;
  end;

procedure TMyTemplate.ReplaceMyTags(Sender : TObject; Const TagString :
String; TagParams:TStringList; Out ReplaceText : String);
begin
  // use if-else if-else if your compiler version doesn't support case
statement with string variable
  case TagString of
'name': ReplaceText := 'sysutils, classes';
'modules': ReplaceText := 'freevox';
  end;
end;

constructor TMyTemplate.Create;
begin
  inherited Create;
  StartDelimiter := '<#';
  EndDelimiter := '>';
  OnReplaceTag := @ReplaceMyTags;
end;

begin
  with TMyTemplate.Create do
try
  FileName := 'e030.txt';
  WriteLn(GetContent);
finally
  Free;
end;
end.

if you want to use your style, you can try adapting 
http://free-pascal-general.1045716.n5.nabble.com/file/n5710450/view.pp my
unit . It's more or less like what you want, only with more features as I
support parameters.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Generating-templates-with-FPTemplate-tp5710448p5710450.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Generating templates with FPTemplate

2012-07-27 Thread michael . vancanneyt



On Fri, 27 Jul 2012, luciano de souza wrote:


Hello all,

I am trying to create an example with the FPTemplate unit. Firstly, I
wrote a hypothetical unit template.


[snip]



I am not successful in filling up the template. If I do
writeln(source.template), the answer is an empty string. If I do
writeln(source.GetContent), the answer is the template without the
needed replacements.

So I ask: what is wrong? How can I get a file, to replace tags and to
get a replaced string?


1. You need only one of the two classes, never both at the same time. 
2. You need to set the correct delimiters. Default are { and }


If you want to have fixed values for parameters, the easiest is
TTemplateParser. TFPCustomTemplate (or TFPTemplate) does not have 
fixed values, everything is event driven.


So, the following will do what you want:

program e30;

{$mode objfpc}{$H+}

uses
  fptemplate, classes;

var
  T : TTemplateParser;
  Fin,Fout : TFileStream;

BEGIN
  T := TTemplateParser.create;
  try
T.StartDelimiter:='<#';
T.EndDelimiter:='>';
T.values['name'] := 'freevox';
T.values['modules'] := 'sysutils, classes';
T.AllowTagParams:=False;
Fin:=TFileStream.Create('e30.txt',fmOpenRead);
try
  Fout:=TFileStream.Create('freevox.pas',fmCreate);
  try
T.ParseStream(fin,fout);
  finally
Fout.Free;
  end;
finally
  Fin.Free;
end;
  finally
T.free;
  end;
end.

Running this produces the file you want:

fsb: >e30
fsb: >cat freevox.pas
unit freevox;
{$mode objfpc}{$H+}

interface
uses
sysutils, classes

implementation

end.

That's it.

In revision 21977, I added a ParseFiles call, which makes the program even
easier:

program e30;

{$mode objfpc}{$H+}

uses
  fptemplate, classes;

var
  T : TTemplateParser;

BEGIN
  T := TTemplateParser.create;
  try
T.StartDelimiter:='<#';
T.EndDelimiter:='>';
T.values['name'] := 'freevox';
T.values['modules'] := 'sysutils, classes';
T.AllowTagParams:=False;
T.ParseFiles('e30.txt','freevox.pas');
  finally
T.free;
  end;
end.

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


Re: [fpc-pascal] POSIX capabilities library

2012-07-27 Thread Mark Morgan Lloyd

Mark Morgan Lloyd wrote:
Does FPC have an interface to the POSIX capabilities library, which I 
believe is libcap or possibly libcap-ng?


I've hacked a partial interface to the API. If anybody else has to deal 
with this issue, note that Debian only provides libcap as a .so.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] FPC and IPv6, and BSD

2012-07-27 Thread Mark Morgan Lloyd

ZAN DoYe wrote:

On 2012-07-23 21:51, Mark Morgan Lloyd wrote:
I'm trying to write a simple finger daemon, capable of both IP4 and 
IP6. At present it's using an unprivileged socket so as to avoid 
problems on unix platforms.


I appear to be having problems at the bind() call for IP6 (returns 
-1), which I suspect is down to my incomplete understanding of the new 
sockaddr_in6 structure. Has anybody done this successfully?


If you called fpBind, then check fpGetErrno to see what happened. If you 
do called the bind function in libc. uses initc unit, and check the cerrno.


Thanks, the problem was entirely down to IP6 also binding IP4. I've 
coded to leave this as an option.



As a subsidiary question: noting that a client has to be aware of this:

  sockaddr_in6 = packed Record
{$ifdef SOCK_HAS_SINLEN}  // as per RFC 2553
  sin6_len: cuint8;
{$endif}
sin6_family   : sa_family_t;
..

so that it initialises the sin6_len field if present (some BSD 
variants?), does it see that conditional automatically if defined? 
Otherwise how best to do it?



You don't worry about the sin6_len field.
`Even if the length field is present, we need never set it and need 
never examine it, unless we are dealing with routing sockets. It is used 
within the kernel by the routines that deal with socket address 
structures from various protocol families.' --- UNP v1


Thanks very much for that, noted.

Remainder noted for reference.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal