[fpc-pascal] CMS in Pascal ?

2016-03-12 Thread Michael Van Canneyt


Hi,

I'm looking for a minimalist flat-file CMS. There are many floating around,
I found a list on e.g.

http://www.hongkiat.com/blog/flat-cms/

Is there one written in Object Pascal ?

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


Re: [fpc-pascal] CMem issue?

2016-03-12 Thread Michael Van Canneyt



On Fri, 11 Mar 2016, dinmil wrote:


program project1;

{$mode delphi}

uses
 cmem,
 Classes, SysUtils;
var
 VBuffer: TBytes;
 VStream: TStream;
begin
 VStream := TBytesStream.Create;
 try
   VBuffer := TEncoding.UTF8.GetBytes('abc');
   VStream.WriteBuffer(VBuffer[0], Length(VBuffer));
 finally
   VStream.Free;
 end;
 writeln('Press any key to finish...');
 readln;
end.

I tried this with CT540 - it is OK
CT570 with newer compiler gets access violation when in debug.
If you try application from command prompt then it is OK.


This points to an error in CodeTyphon, not Free Pascal.
What are the options used to compile the program ? Does it include -gh ?
If so, then that is almost certainly the problem.

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


[fpc-pascal] Fpc 3.0 Bug: type specialization and operator overload

2016-03-12 Thread Mazola Winstrol
Hello,

Fpc version: 3.0 (the one provided by Lazarus).

Please confirm if this is a bug regarding operator overloading and type
specialization. It is a quite difficult to explain, but i will try.


Consider this unit

=== CODE ===

unit MyRecordDefinitionA;

{$mode delphi}

interface

type
  TMyRecord = record
  public
FValue: T;
class operator Add(A,B: TMyRecord): TMyRecord;
  end;

implementation

class operator TMyRecord.Add(A,B: TMyRecord): TMyRecord;
begin
  Result.FValue := A.FValue + B.FValue;
end;

end.

=== END ===

The unit above defines a generic type named TMyRecord with the arithmetic
operator overloaded Add. This type is supposed to be specialized with a
type parameter that supports the add operation (e.g Integer types).


=== CODE ===

unit MyRecordDefinitionB;

{$mode delphi}

interface

type
  TMyRecord = record
  public
FValue: T;
class operator LogicalAnd(A: TMyRecord; B: Boolean): TMyRecord;
  end;

implementation

class operator TMyRecord.LogicalAnd(A: TMyRecord; B: Boolean):
TMyRecord;
begin
  Result.FValue := A.FValue and B;
end;

end.

=== END ===


The unit above defines a generic type named TMyRecord too, but with the
logical operator overloading And. This type is supposed to be specialized
with a type parameter that supports the logical and operation (e.g Boolean
types).


=== CODE ===

unit MyRecordSpecialization;

{$mode delphi}

interface

uses
  MyRecordDefinitionA, MyRecordDefinitionB;

type
  TMyIntegerRecord = MyRecordDefinitionA.TMyRecord;
  TMyBooleanRecord = MyRecordDefinitionB.TMyRecord;

implementation

end.


=== END ===


The unit above defines two specialized types based on the generic type
TMyRecord defined in the units MyRecordDefinitionA and MyRecordDefinitionB.

When i try to compile MyRecordSpecialization, i get this error: "Operator
is not overloaded: LongInt and Boolean".

It seems the compiler treats the type MyRecordDefinitionA.TMyRecord and
MyRecordDefinitionB.TMyRecord as being the same type. So, the compiler try
to apply the logical operator and of MyRecordDefinitionB.TMyRecord in the
integer specialization of the type MyRecordDefinitionA.TMyRecord.

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

Re: [fpc-pascal] Fpc 3.0 Bug: type specialization and operator overload

2016-03-12 Thread Sven Barth
Am 12.03.2016 22:45 schrieb "Mazola Winstrol" :
>
> Hello,
>
> Fpc version: 3.0 (the one provided by Lazarus).
>
> Please confirm if this is a bug regarding operator overloading and type
specialization. It is a quite difficult to explain, but i will try.
>
[snip]
>
> It seems the compiler treats the type MyRecordDefinitionA.TMyRecord and
MyRecordDefinitionB.TMyRecord as being the same type. So, the compiler try
to apply the logical operator and of MyRecordDefinitionB.TMyRecord in the
integer specialization of the type MyRecordDefinitionA.TMyRecord.

It does not treat them the same, it simply picks the wrong one (as in
"doesn't correctly respect the unit qualifier"). You should see a different
(yet no less wrong) behavior if you turn around the units in the
uses-clause.

Please report.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] CMem issue?

2016-03-12 Thread dinmil
Opitions are like that (defaults) - does not include -gh (no heap trace)

 -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq
-FiC:\codetyphon\typhonTemp\lib\i386-win32 
-FUC:\codetyphon\typhonTemp\lib\i386-win32\ -FEC:\codetyphon\typhonTemp\

Note - this is first time that Typhon behave this was. Even, beta version of
CT570 was OK considering this error, so I assume something does not behave
as it was before. They suggest (CT people) on its forum that 
we should not use cmem in debug mode because they have to fix it deeply (or
something like that. If I understood correctly) ?!?!?

Regards, Dinko



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/CMem-issue-tp5724477p5724521.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] CMS in Pascal ?

2016-03-12 Thread Christian-W. Budde



Hello Michael,

while not being an entire CMS you can use DWScript (see
https://www.delphitools.info/dwscript/) to write your code in a nice
Object Pascal dialect. With this there are plenty of options such as a
server side solution with DWSCript Web Server (scroll further down for
more info and use the code from the GIT repository at
https://bitbucket.org/egrange/dwscript/overview )

With this the site http://www.beginend.net was built.

It allows you to not only write the HTML generator code in Object
Pascal, but also write the HTML script code in Object Pascal (transpiled
to JS on delivery).


Another idea would be to build a client side web "application" with
Smart Mobile Studio. While this is a commercial product, the entry
"basic" edition should be suitable.

The advantage of the client-side approach is that you can build platform
independent app-store apps with tools like Cordova in no time.

Kind regards,

Christian



Am 12.03.2016 um 10:25 schrieb Michael Van Canneyt:
> 
> Hi,
> 
> I'm looking for a minimalist flat-file CMS. There are many floating around,
> I found a list on e.g.
> 
> http://www.hongkiat.com/blog/flat-cms/
> 
> Is there one written in Object Pascal ?
> 
> Michael.
> ___
> fpc-pascal maillist  - 
> fpc-pascal-pd4fty7x32k2wbthl531ywd2fqjk+...@public.gmane.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
> 



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