Recent

Recent Posts

Pages: [1] 2 3 ... 10
1
Databases / Re: Debugging SQlite
« Last post by dseligo on Today at 09:49:46 pm »
Same results with ZEOS components:
Code: Pascal  [Select][+][-]
  1.   ZConnection1.Database := 'autoincz.db3';
  2.   ZConnection1.Protocol := 'sqlite-3';
  3.   ZConnection1.LibraryLocation := 'sqlite3.37.2.dll';
  4.  
  5.   ZQuery1.Connection := ZConnection1;
  6.  
  7.   ZQuery1.SQL.Text := 'create table autoinc (id integer, data integer, primary key (id)) ';
  8.   ZQuery1.ExecSQL;
  9.  
  10.   ZQuery1.SQL.Text := 'insert into autoinc (data) values (100)';
  11.   ZQuery1.ExecSQL;
  12.   ZQuery1.SQL.Text := 'insert into autoinc (data) values (200)';
  13.   ZQuery1.ExecSQL;
  14.   ZQuery1.SQL.Text := 'insert into autoinc (data) values (300)';
  15.   ZQuery1.ExecSQL;
  16.  
  17.   ZQuery1.SQL.Text := 'update autoinc set data = 250 where id = 2';
  18.   ZQuery1.ExecSQL;
  19.  
  20.   ZQuery1.SQL.Text := 'select * from autoinc';
  21.   ZQuery1.Open;
2
Embedded - AVR / Re: Assembler procedures and function
« Last post by PascalDragon on Today at 09:46:53 pm »
This is only the case for asm-blocks. For assembly functions that clause is parsed, but ignored, because FPC adheres to the corresponding ABI.
What does ist mean "adheres to the corresponding ABI"? Will the registers be taken care of, or not?

The registers are taken care of according to the ABI of the platform. So if you play with assembler routines then you better check your platform's ABI. (With one of the few exceptions being the register calling convention of i386 cause that is part of the FPC documentation as it's a FPC/Delphi-only calling covention)

Are there other differences between using an asm-block or a asm-function e.g. in regard to variables and function parameters?

If you use an asm-block you'll always have an established stack frame while with an assembly function that depends on the nostackframe-directive. And depending on that the parameter locations are different which might mean that you need to write different assembly code depending on the platform (cause the compiler will simply insert the location in your assembly code, but it won't change the opcode to match that). This becomes important if you need to use different instructions for working with a register (e.g. on aarch64 the first 8 parameters are passed in registers) than for working with a value on the stack (which is were parameters will be moved to if there's a stack frame established).
3
Embedded - AVR / Re: Constant dynamic array
« Last post by PascalDragon on Today at 09:40:31 pm »
I don't have a working compiler handy currently, but I imagine that the problem could be lack of support for dynamic arrays, pointers being initialized to flash storage, or the program not crashing because you don't have a working heapmgr when the arrays are allocated (if they are allocated). Either way, a bug for sure

Much more trivial: one part of the compiler assumes that the High value stored in the array is 8-bit the other part assumes 16-bit and that obviously doesn't go hand in hand that well. ;) (in this case only the high part of the 16-bit High value is loaded which is 0 and thus High returns 0 and Length returns 1)

Regarding the state of dynamic arrays on AVR in general:
The functions that are used for dynamically allocating a dynamic array are disabled by default on AVR (e.g. SetLength), however these can be enabled by compiling the RTL with a suitable configuration as well as providing the tiny heap.
The Length and High however are intrinsics that are not handled by the RTL, but by the compiler itself and thus are available always just like the ability to declare a dynamic array is always available.
Declaring constants might be one of the few uses dynamic arrays have on AVR, though you'll always have 8-Byte overhead for each constant declared such compared to a static array of the same size (2 Byte reference count, 2 Byte size and 2 Byte Pointer to the array data).
4
Databases / Re: Debugging SQlite
« Last post by Zvoni on Today at 09:25:15 pm »
Frank, I‘m following a hunch: what‘s the value of „result“ in your lines 40 and 45?
Resp. the value of „q“ in line 103?
5
Databases / Re: Debugging SQlite
« Last post by dseligo on Today at 09:12:10 pm »
I think I'll scrap the whole setup and only use the TSQLQuery datasets.

What do you use to access SQlite (if not TSQLQuery)?

This code:
Code: Pascal  [Select][+][-]
  1.   SQLiteDefaultLibrary := 'sqlite3.37.2.dll';
  2.  
  3.   SQLite3Connection1.DatabaseName := 'autoinc.db3';
  4.   SQLite3Connection1.Connected := True;
  5.  
  6.   SQLQuery1.SQL.Text := 'create table autoinc (id integer, data integer, primary key (id)) ';
  7.   SQLQuery1.ExecSQL;
  8.  
  9.   SQLQuery1.SQL.Text := 'insert into autoinc (data) values (100)';
  10.   SQLQuery1.ExecSQL;
  11.   SQLQuery1.SQL.Text := 'insert into autoinc (data) values (200)';
  12.   SQLQuery1.ExecSQL;
  13.   SQLQuery1.SQL.Text := 'insert into autoinc (data) values (300)';
  14.   SQLQuery1.ExecSQL;
  15.  
  16.   SQLQuery1.SQL.Text := 'update autoinc set data = 250 where id = 2';
  17.   SQLQuery1.ExecSQL;
  18.  
  19.   SQLQuery1.SQL.Text := 'select * from autoinc';
  20.   SQLQuery1.Open;

Produces:
Code: Text  [Select][+][-]
  1.   id | data
  2. -----+------
  3.    1 |  100
  4.    2 |  250
  5.    3 |  300

This is with latest SQlite3 library (3.37.2), Lazarus 2.2.0 (rev lazarus_2_2_0) FPC 3.2.2 x86_64-win64-win32/win64, Windows 11.
6
Embedded - AVR / Re: Constant dynamic array
« Last post by Laksen on Today at 09:05:10 pm »
I don't have a working compiler handy currently, but I imagine that the problem could be lack of support for dynamic arrays, pointers being initialized to flash storage, or the program not crashing because you don't have a working heapmgr when the arrays are allocated (if they are allocated). Either way, a bug for sure
7
General / Re: StrToInt in pure pascal.
« Last post by engkin on Today at 08:46:51 pm »
Any code gets compiled AFTER {$R+} till it meets:
{$R-} or
end of this unit or
{$pop} with the proper push & R
8
General / console in Lazarus.
« Last post by Seenkao on Today at 08:25:47 pm »
Linux
Lazarus 2.0.12 r64642

в консоли не работает "Enter"на цифровой клавиатуре.
google translate:
"Enter" on the numeric keypad does not work in the console.

offtop:
а в Windows консоли вообще нет. )))
eng: and in Windows there is no console at all.. )))
9
Third party / Re: CAD program written in Lazarus / FPC
« Last post by zamtmn on Today at 08:19:45 pm »
Hi All!
Building ZCAD from sources always raises a lot of questions, so I wrote a detailed instruction with explanations https://github.com/zamtmn/zcad/blob/master/README_ENG.md Text is written for non-programmers, so there are obvious points there. My English is very bad, I will be glad if someone points out mistakes
10
General / Re: how to use the units -no information about this
« Last post by alaa123456789 on Today at 08:04:59 pm »

I did some more tests and this library, librsvg-2-2, fails with some files. At this point you better use something else, or if you insist try to get a newer version. The one I have is over 10 years old. But again, I don't see the point. Either way when you test the code, try to use a simple svg file.
hi engkin , yes it failed here are all the errors

Quote
Compile Project, Target: project1.exe: Exit code 1, Errors: 5
project1.lpr(24,1) Error: Undefined symbol: rsvg_init
project1.lpr(24,1) Error: Undefined symbol: rsvg_handle_new_from_file
project1.lpr(24,1) Error: Undefined symbol: rsvg_handle_get_pixbuf
project1.lpr(24,1) Error: Undefined symbol: rsvg_handle_close
project1.lpr(24,1) Error: Undefined symbol: rsvg_term
thanks for your time

Pages: [1] 2 3 ... 10

TinyPortal © 2005-2018