[lazarus] Encryption library
There is an urgen need for an Encryption library ready to use on Lazarus. Searching on the WEB, I found some open source libraries that could probably be converted to Lazarus, but, there are asm pieces of code. An example is TurboPower's LockBox library. I suppose that using asm will make the solution incompatible at least to Apple Mac systems. Is it correct? Is there any such library compatible to Windows, Linux, OS X or any other OS? Any help would be most appreciated. Regards, Panagiotis _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] Debugger causing problem in Windows
On 1/28/06, George Lober [EMAIL PROTECTED] wrote: gdb 6.0 seems to work OK. Thanks. BTW, I got gdb 6.2.1 from the fpc 2.0.0 distribution. Just for the record. I had the same problem on Windows XP, and solved it the exact same way. So the problem has nothing to do with Windows version, but rather with GDB version. -- Felipe Monteiro de Carvalho _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
[lazarus] PasZlib still
I am still unable to get paszlib to work. I have since gone to some pretty big lengths toward my goal, but I am afraid I am stuck. I think the ideal way would be to be able to read the file into a TMemstream, decompress it into another Tmemstream and then write that out, but I must admit I have no idea how to go about achieving that. So considering that, for the moment I decided that I may have made a mistake in my code conversions, so I fell back on minigz's own code virtually unaltered, but wrapped inside a component. All I get is that when I call the extract method - the program throws: TApplication.HandleException Access violation Stack trace: $40489AE0 GZ_EXTRACT_finalize_implicit, line 54 of gtkglobals.pp What does an error in finalize MEAN ? I did an strace on the program, and it certainly reads and writes a LOT of data once you trigger the method, so SOMETHING is happening before the crash. I attach my full source code this time, if somebody would like to see the trace I will mail that offlist as it is likely to be huge. I urgently need to get this working to do transparent decompression for OpenBook on windows (calling gunzip only works where gunzip works well). Ciao A.J. -- A.J. Venter Chief Software Architext OpenLab International www.getopenlab.com www.silentcoder.co.za +27 82 726 5103 { Copyright (C) 2006 A.J. Venter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. } unit gz_extract; {Note - you must add turbopoweripro to your project requirements for this to work} {$mode objfpc}{$H+} interface uses Classes, SysUtils,Process,zutil,gzIo, Forms, Controls, Graphics, Dialogs; Type TGZ_Extractor = class(TComponent) private FInputFile : String; FOutPutFile : String; public destructor destroy; override; Procedure Extract; published property InputFile : String write FInputFile; property OutPutFile : String write FOutPutFile; constructor create(AOwner: TComponent); override; end; procedure register; Implementation {TGZ_Extractor} const BUFLEN = 16384 ; GZ_SUFFIX= '.gz' ; {$DEFINE MAXSEF_64K} var buf : packed array [0..BUFLEN-1] of byte; { Global uses BSS instead of stack } prog : string; procedure error (msg:string); begin showMessage(msg); end; procedure Register; begin RegisterComponents('OLPack',[TGZ_Extractor]); end; procedure gz_uncompress (infile:gzFile; var outfile:file); var len : int; written : uInt; ioerr : integer; err : int; begin while true do begin len := gzread (infile, @buf, BUFLEN); if (len 0) then error (gzerror (infile, err)); if (len = 0) then break; {$I-} blockwrite (outfile, buf, len, written); {$I+} if (written len) then error ('write error'); end; {WHILE} {$I-} close (outfile); {$I+} ioerr := IOResult; if (ioerr 0) then begin writeln ('close error: ',ioerr); halt(1); end; if (gzclose (infile) 0{Z_OK}) then error ('gzclose error'); end; procedure file_uncompress (filename,outname:String); var inname : string; infile : gzFile; outfile : file; ioerr : integer; len : integer; begin len := Length(filename); inname := filename; infile := gzopen (inname, 'r'); if (infile = NIL) then begin writeln (prog,': can''t gzopen ',inname); halt(1); end; Assign (outfile, outname); {$I-} Rewrite (outfile,1); {$I+} ioerr := IOResult; if (ioerr 0) then begin writeln ('open error: ',ioerr); halt(1); end; gz_uncompress (infile, outfile); end; Procedure TGZ_Extractor.Extract; Begin File_UnCompress(FInputFile,FOutPutFile); end; destructor TGZ_Extractor.destroy; Begin end; constructor TGZ_Extractor.create(AOwner: TComponent); begin inherited create(AOwner); end; end.
Re: [lazarus] Qt4 Interface
On Thursday 26 January 2006 20:14, Florian Klaempfl wrote: Christian Iversen wrote: On Thursday 26 January 2006 12:55, Felipe Monteiro de Carvalho wrote: Hello, Attached is a patch that changes the current Qt interface into a Qt4 interface. The following widgets work: TApplication, TCustomForm, TCustomButton, TCustomMemo It uses Jen Dean qt4 wrapper, which is basically a 800kb .so file that needs to be on the library path for lcl-qt4 programs to work. I'll bet the farm that the 800kb file is not needed! All you need to do is change the header file slightly. I ported the modplug (module player) header code to linux. Now, modplug is C++, so of course this was a bit of a challenge. However, I managed to use the following style: Procedure SoundFile_FreeSample(p: Pointer); CDecl; External {$IFDEF DYNLINK}libmodplugname{$ENDIF} Name '_ZN10CSoundFile10FreeSampleEPv'; Function SoundFile_ReadS3M (Obj : Pointer; lpStream : Pointer; dwMemLength: dword): Bool; CDecl; External {$IFDEF DYNLINK}libmodplugname{$ENDIF} Name '_ZN10CSoundFile7ReadS3MEPKhm'; and so on. How do you handle e.g. virtual calls :) ? I've been quite busy with my final exams, but I managed to find a little time to make sample of this. It's attached here. To run it, do this: $ gcc -c test.cpp (creates test.o) $ fpc -Mdelphi virtest.pas ./virtest It should print out something like the following: Free Pascal Compiler version 2.1.1 [2005/12/15] for i386 Copyright (c) 1993-2005 by Florian Klaempfl Target OS: Linux for i386 Compiling virtest.pas Linking virtest 94 Lines compiled, 0.3 sec I got the number 42 as an argument Reading back a variable: 42 Got 3 I got the number 17 as an argument Reading back a variable: 17 Please notice that all code except for Reading back a variable is entirely in C++! Also, the memory maps in the header file is currently made in such a way as to save typing for me. If it were auto-generated, it would be HUGELY simpler to access a low-level property of a high-level object (i.e no object.vmt.parent.parent.parent.parent... ) This is _only_ a proof-of-concept, but it goes to show that it's quite doable to link in C++ code. Please once again keep in mind that the access method will look much nicer in a possible real version. -- Regards, Christian Iversen #include stdio.h class foo { private: public: int foo; virtual void frob(int x) { foo = x; } virtual void nicate() { printf(I got the number %d as an argument\n, foo); } }; class bar : public foo { virtual void frobnicate(int x) { printf(Got %d\n, x); } }; foo* new_foo() { return new foo(); } bar* new_bar() { return new bar(); } program test; {$LINK 'test.o'} {$LINKLIB 'c'} uses LibC, sysutils; type tfrobber = procedure(obj: pointer; x: integer); stdcall; tnicater = procedure(obj: pointer); stdcall; // VMTs for Foo and Bar tfoovmt = record frob: procedure(obj: pointer; x: integer); stdcall; nicate: procedure(obj: pointer); stdcall; end; pfoovmt = ^tfoovmt; tbarvmt = record parent: tfoovmt; frobnicate: procedure(obj: pointer; x: integer); stdcall; end; pbarvmt = ^tbarvmt; // Memory maps for Foo and Bar tfoovars = record x: integer; end; tbarvars = record parent: tfoovars; end; // Class maps for Foo and Bar tfooclass = record vmt: pfoovmt; vars: tfoovars; end; pfooclass = ^tfooclass; tbarclass = record vmt: pbarvmt; vars: tbarvars; end; pbarclass = ^tbarclass; // Custom constructors function new_foo(): pfooclass; external name '_Z7new_foov'; function new_bar(): pbarclass external name '_Z7new_barv'; function new_integer(x: integer): pointer; begin result := malloc(x); end; procedure dummy(); begin end; // Quiesce the linker - g++ needs this to be defined exports dummy name '__gxx_personality_v0', dummy name '_ZTVN10__cxxabiv117__class_type_infoE', dummy name '_ZTVN10__cxxabiv120__si_class_type_infoE', new_integer name '_Znwj'; var x: pfooclass; y: pbarclass; begin x := new_foo(); y := new_bar(); x.vmt.frob(x, 42); x.vmt.nicate(x); writeln('Reading back a variable: ', x.vars.x); y.vmt.frobnicate(y, 3); y.vmt.parent.frob(y, 17); y.vmt.parent.nicate(y); writeln('Reading back a variable: ', y.vars.parent.x); end.
Re: [lazarus] Qt4 Interface
On Sunday 29 January 2006 23:53, Christian Iversen wrote: This is _only_ a proof-of-concept, but it goes to show that it's quite doable to link in C++ code. Please once again keep in mind that the access method will look much nicer in a possible real version. Just to correct myself - I clearly wasn't thinking. Here's an improved version that removes ALL the g++ cruft from the code. It's SO much cleaner now. (I forgot to link to libstdc++ ;-) -- Regards, Christian Iversen program test; {$LINK 'test.o'} {$LINKLIB 'c'} {$LINKLIB 'stdc++'} uses LibC, sysutils; type tfrobber = procedure(obj: pointer; x: integer); stdcall; tnicater = procedure(obj: pointer); stdcall; // VMTs for Foo and Bar tfoovmt = record frob: procedure(obj: pointer; x: integer); stdcall; nicate: procedure(obj: pointer); stdcall; end; pfoovmt = ^tfoovmt; tbarvmt = record parent: tfoovmt; frobnicate: procedure(obj: pointer; x: integer); stdcall; end; pbarvmt = ^tbarvmt; // Memory maps for Foo and Bar tfoovars = record x: integer; end; tbarvars = record parent: tfoovars; end; // Class maps for Foo and Bar tfooclass = record vmt: pfoovmt; vars: tfoovars; end; pfooclass = ^tfooclass; tbarclass = record vmt: pbarvmt; vars: tbarvars; end; pbarclass = ^tbarclass; // Custom constructors function new_foo(): pfooclass; external name '_Z7new_foov'; function new_bar(): pbarclass external name '_Z7new_barv'; var x: pfooclass; y: pbarclass; begin x := new_foo(); y := new_bar(); x.vmt.frob(x, 42); x.vmt.nicate(x); writeln('Reading back a variable: ', x.vars.x); y.vmt.frobnicate(y, 3); y.vmt.parent.frob(y, 17); y.vmt.parent.nicate(y); writeln('Reading back a variable: ', y.vars.parent.x); end.
Re: [lazarus] PasZlib still
A.J. Venter escreveu: I am still unable to get paszlib to work. I have since gone to some pretty big lengths toward my goal, but I am afraid I am stuck. I think the ideal way would be to be able to read the file into a TMemstream, decompress it into another Tmemstream and then write that out, but I must admit I have no idea how to go about achieving that. Try http://wiki.lazarus.freepascal.org/index.php/Zlibar Luiz _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] PasZlib still
I am still unable to get paszlib to work. I have since gone to some pretty big lengths toward my goal, but I am afraid I am stuck. I think the ideal way would be to be able to read the file into a TMemstream, decompress it into another Tmemstream and then write that out, but I must admit I have no idea how to go about achieving that. There are some classes in fcl (uses zstream) that you can use: TCompressionStream, TDecompressionStream, TGZFileStream. No need to reinvent the wheel :) _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives