Re: [fpc-pascal] "Variant array locked" error for now apparent reason
Graeme Geldenhuys schrieb: > As the subject line says, I keep getting this error and I can't see why! > I'm trying to get the last 4 unit test errors fixed running the tiOPF > project under FPC 2.1.1. (latest SVN revision) > > The tiOPF function tiVariantArrayToString() converts a Variant Array > to a String. I placed some writeln() statements in the code to see how > far it gets before the error occurs. As you can see from the backtrace > output, that it finishes (exits) the function, and then the error > occurs. Also nowhere in the code do I lock the variant array, as I am > not modifying it, just iterating through it's elements. > > Hope someone can shed some light on this issue - I'm stuck! :-( I didn't look at it but please submit a bug report, so it won't be forgotten. > > > > -- Error Start -- > > > TTestTIUtils.tiVariantArrayToString: Variant array > locked > EVariantArrayLockedError > Variant array locked > > /mnt/data/programming/3rdParty/tiOPF2/Source/Core/tiUtils.pas > > 890 > _INTTOSTR > > > > -- Error End > > > > The Code > function tiVariantArrayToString(AValue: Variant): string; > //- > procedure appendVariantToStringList(pStringList: TStringList; > pVariant: Variant; var pIndent: integer); > var >i: integer; >iLow: integer; >iHigh: integer; > begin >if VarIsArray(pVariant) then > //if tiIsVariantOfType(pVariant, varArray) then >begin > iLow := varArrayLowBound(pVariant, 1); > iHigh := varArrayHighBound(pVariant, 1); > for i := iLow to iHigh do > begin >inc(pIndent); > >if i = iLow then > pStringList.add(tiSpace(pIndent*3) + '['); > >appendVariantToStringList(pStringList, pVariant[i], pIndent); > >if i = iHigh then > pStringList.add(tiSpace(pIndent*3) + ']'); > >dec(pIndent); > end; >end >else >begin > pStringList.add(tiSpace(pIndent*3 + 1) + varToStr(pVariant)); >end; > end; > > var > lStringList : TStringList; > pIndent : integer; > dimcount: integer; > begin > lStringList := TStringList.Create; > try >pIndent := -1; > writeln('*** Start ***'); >appendVariantToStringList(lStringList, AValue, pIndent); > writeln('*** Finish ***'); >result := lStringList.Text; > finally >lStringList.free; > end; > writeln('*** Exit ***'); > end; > > --- Code End -- > > ... and the backtrace > > > --- Backtrace Start -- > > (gdb) run > Starting program: /UnitTests/GUI/fpcUnitTIOPFGui > [Thread debugging using libthread_db enabled] > [New Thread -1213237024 (LWP 12705)] > InitKeyboardTables - Duplicate Keysymstring="=" for keycode=126 ignored. > Existing: vkey=57, flags=0x00 New: vkey=227, flags=0x00 > [New Thread -1215480912 (LWP 12711)] > *** Start *** > *** Finish *** > *** Exit *** > > [Switching to Thread -1213237024 (LWP 12705)] > > Breakpoint 1, 0x08060196 in fpc_raiseexception () > (gdb) bt > #0 0x08060196 in fpc_raiseexception () > #1 0x0824c21c in VARIANTS_VARARRAYLOCKEDERROR () at tiUtils.pas:2784 > #2 0x0824c4c7 in VARIANTS_RAISEVAREXCEPTION$HRESULT () at tiUtils.pas:2784 > #3 0x0824c558 in VARIANTS_VARRESULTCHECK$HRESULT () at tiUtils.pas:2784 > #4 0x08247e69 in VARIANTS_SYSVARCLEARPROC$TVARDATA () at tiUtils.pas:2023 > #5 0x080605dd in SYSTEM_VARIANT_CLEAR$TVARDATA () > #6 0x08062326 in fpc_decref () > #7 0x0823e1c1 in TIVARIANTARRAYTOSTRING (AVALUE={VARIANT} 0xbfe6562c) >at tiUtils.pas:1309 > #8 0x082b6bb5 in TTESTTIUTILS__TIVARIANTARRAYTOSTRING (this=0xb78eb240) >at tiUtils_TST.pas:1709 > #9 0x082007e7 in FPCUNIT_TTESTCASE_$__RUNTEST () > #10 0x0820071e in FPCUNIT_TTESTCASE_$__RUNBARE () > #11 0x082017aa in FPCUNIT_PROTECTTEST$TTEST$TTESTRESULT () > #12 0x082018a1 in FPCUNIT_TTESTRESULT_$__RUNPROTECTED$TTEST$TPROTECT () > #13 0x082017e0 in FPCUNIT_TTESTRESULT_$__RUN$TTESTCASE () > #14 0x082006cb in FPCUNIT_TTESTCASE_$__RUN$TTESTRESULT () > #15 0x082011c1 in FPCUNIT_TTESTSUITE_$__RUNTEST$TTEST$TTESTRESULT () > #16 0x083cf820 in _$FPCUNIT$_Ld39 () > #17 0x08201176 in FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT () > #18 0x0070 in ?? () > #19 0xb7f4f760 in ?? () > #20 0xb70a1980 in ?? () > #21 0x00140022 in ?? () > #22 0xb7a93680 in ?? () > <...snip...> > --- Backtrace End --- > > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] "Variant array locked" error for now apparent reason
Thanks, will submit a bug report today. Graeme. On 1/8/07, Florian Klaempfl <[EMAIL PROTECTED]> wrote: Graeme Geldenhuys schrieb: > As the subject line says, I keep getting this error and I can't see why! > I'm trying to get the last 4 unit test errors fixed running the tiOPF > project under FPC 2.1.1. (latest SVN revision) > > The tiOPF function tiVariantArrayToString() converts a Variant Array > to a String. I placed some writeln() statements in the code to see how > far it gets before the error occurs. As you can see from the backtrace > output, that it finishes (exits) the function, and then the error > occurs. Also nowhere in the code do I lock the variant array, as I am > not modifying it, just iterating through it's elements. > > Hope someone can shed some light on this issue - I'm stuck! :-( I didn't look at it but please submit a bug report, so it won't be forgotten. > > > > -- Error Start -- > > > TTestTIUtils.tiVariantArrayToString: Variant array > locked > EVariantArrayLockedError > Variant array locked > > /mnt/data/programming/3rdParty/tiOPF2/Source/Core/tiUtils.pas > > 890 > _INTTOSTR > > > > -- Error End > > > > The Code > function tiVariantArrayToString(AValue: Variant): string; > //- > procedure appendVariantToStringList(pStringList: TStringList; > pVariant: Variant; var pIndent: integer); > var >i: integer; >iLow: integer; >iHigh: integer; > begin >if VarIsArray(pVariant) then > //if tiIsVariantOfType(pVariant, varArray) then >begin > iLow := varArrayLowBound(pVariant, 1); > iHigh := varArrayHighBound(pVariant, 1); > for i := iLow to iHigh do > begin >inc(pIndent); > >if i = iLow then > pStringList.add(tiSpace(pIndent*3) + '['); > >appendVariantToStringList(pStringList, pVariant[i], pIndent); > >if i = iHigh then > pStringList.add(tiSpace(pIndent*3) + ']'); > >dec(pIndent); > end; >end >else >begin > pStringList.add(tiSpace(pIndent*3 + 1) + varToStr(pVariant)); >end; > end; > > var > lStringList : TStringList; > pIndent : integer; > dimcount: integer; > begin > lStringList := TStringList.Create; > try >pIndent := -1; > writeln('*** Start ***'); >appendVariantToStringList(lStringList, AValue, pIndent); > writeln('*** Finish ***'); >result := lStringList.Text; > finally >lStringList.free; > end; > writeln('*** Exit ***'); > end; > > --- Code End -- > > ... and the backtrace > > > --- Backtrace Start -- > > (gdb) run > Starting program: /UnitTests/GUI/fpcUnitTIOPFGui > [Thread debugging using libthread_db enabled] > [New Thread -1213237024 (LWP 12705)] > InitKeyboardTables - Duplicate Keysymstring="=" for keycode=126 ignored. > Existing: vkey=57, flags=0x00 New: vkey=227, flags=0x00 > [New Thread -1215480912 (LWP 12711)] > *** Start *** > *** Finish *** > *** Exit *** > > [Switching to Thread -1213237024 (LWP 12705)] > > Breakpoint 1, 0x08060196 in fpc_raiseexception () > (gdb) bt > #0 0x08060196 in fpc_raiseexception () > #1 0x0824c21c in VARIANTS_VARARRAYLOCKEDERROR () at tiUtils.pas:2784 > #2 0x0824c4c7 in VARIANTS_RAISEVAREXCEPTION$HRESULT () at tiUtils.pas:2784 > #3 0x0824c558 in VARIANTS_VARRESULTCHECK$HRESULT () at tiUtils.pas:2784 > #4 0x08247e69 in VARIANTS_SYSVARCLEARPROC$TVARDATA () at tiUtils.pas:2023 > #5 0x080605dd in SYSTEM_VARIANT_CLEAR$TVARDATA () > #6 0x08062326 in fpc_decref () > #7 0x0823e1c1 in TIVARIANTARRAYTOSTRING (AVALUE={VARIANT} 0xbfe6562c) >at tiUtils.pas:1309 > #8 0x082b6bb5 in TTESTTIUTILS__TIVARIANTARRAYTOSTRING (this=0xb78eb240) >at tiUtils_TST.pas:1709 > #9 0x082007e7 in FPCUNIT_TTESTCASE_$__RUNTEST () > #10 0x0820071e in FPCUNIT_TTESTCASE_$__RUNBARE () > #11 0x082017aa in FPCUNIT_PROTECTTEST$TTEST$TTESTRESULT () > #12 0x082018a1 in FPCUNIT_TTESTRESULT_$__RUNPROTECTED$TTEST$TPROTECT () > #13 0x082017e0 in FPCUNIT_TTESTRESULT_$__RUN$TTESTCASE () > #14 0x082006cb in FPCUNIT_TTESTCASE_$__RUN$TTESTRESULT () > #15 0x082011c1 in FPCUNIT_TTESTSUITE_$__RUNTEST$TTEST$TTESTRESULT () > #16 0x083cf820 in _$FPCUNIT$_Ld39 () > #17 0x08201176 in FPCUNIT_TTESTSUITE_$__RUN$TTESTRESULT () > #18 0x0070 in ?? () > #19 0xb7f4f760 in ?? () > #20 0xb70a1980 in ?? () > #21 0x00140022 in ?? () > #22 0xb7a93680 in ?? () > <...snip...> > --- Backtrace End --- > > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Graeme Geldenhuys There's no place like S34° 03.168' E018° 49.342' ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Web development
How can FPC help me to develop web applications ? What kind of web technologies are already available in FPC ? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Web development
Rodrigo Palhano schreef: How can FPC help me to develop web applications ? What kind of web technologies are already available in FPC ? http://wiki.lazarus.freepascal.org/Web_Service_Toolkit might be an interesting read. Vincent ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Web development
> How can FPC help me to develop web applications ? > What kind of web technologies are already available in FPC ? Take a look at PSP: http://www.psp.furtopia.org/cgi-bin/psp/index.psp Leonardo M. Ramé http://leonardorame.blogspot.com __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Popen
I am trying to use the "Popen" function in Read mode. I first tried the example (---Write---) from the manual (see beneath). The POpen gives an error 25 (Not a typewriter) but it looks like it works. I try to do almost the same (---Read---)to read the output, but I cannot get this to read anything. As far as I can tell, the script is not executed. Dos anybody have a hint. Carsten Program output is beneath ">" --Write-- Program Example37 ; {Program to demonstrate the Popen function.} uses BaseUnix,Unix; var f:text; i:longint; begin writeln('Creating a shell script to which echoes its arguments '); writeln('and input back to stdout'); assign (f,'test21a.sh'); rewrite(f); writeln(f,'#!/bin/sh'); writeln(f,'echo this is the child speaking . . . . '); writeln(f,'echo got arguments\*"$*"\*'); writeln(f,'cat') ; writeln(f,'exit 2'); writeln(f); close(f); fpchmod('test21a.sh',&755); popen(f,'./test21a.sh arg1 arg2','W') ; if fpgeterrno <>0 then writeln('error from POpen: errno: ',fpgeterrno); for i :=1 to 10 do writeln(f,'This is written to the pipe , and should appear on stdout.' ) ; Flush(f); Writeln('The script exited with status :',PClose(f)); writeln; writeln('Press < return > to remove shell script. '); readln; assign(f,'test21a.sh'); erase(f); end. >>> Creating a shell script to which echoes its arguments and input back to stdout error from POpen: errno: 25 this is the child speaking . . . . got arguments*arg1 arg2* This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. This is written to the pipe , and should appear on stdout. The script exited with status :2 Press < return > to remove shell script. -- - Read- Program Example37 ; {Program to demonstrate the Popen function.} uses BaseUnix , Unix, errors; {System} var f:text; i:longint; s:string[255]; begin writeln('Creating a shell script to which echoes its arguments '); writeln('and input back to stdout'); assign (f,'test21a.sh'); rewrite(f); writeln(f,'#!/bin/sh'); writeln(f,'echo this is the child speaking . . . . ' ) ; writeln(f,'echo got arguments\*"$*"\*'); writeln(f,'echo got arguments\*"$*"\* >m'); writeln(f,'exit 3'); writeln(f); close(f); fpchmod('test21a.sh',&755); popen(f,'./test21a.sh arg1 arg2','R') ; if fpgeterrno <>0 then writeln('error from POpen: errno: ',StrError(fpgeterrno)); for i :=1 to 10 do begin Readln(f,s); writeln(s); end; Writeln('The script exited with status :' ,PClose(f)); writeln; writeln('Press < return > to remove shell script. '); readln ; assign (f,'test21a.sh'); erase(f); end. Creating a shell script to which echoes its arguments and input back to stdout error from POpen: errno: Not a typewriter The script exited with status :127 Press < return > to remove shell script. --- ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Popen
> I am trying to use the "Popen" function in Read mode. > I first tried the example (---Write---) from the manual (see beneath). > The POpen gives an error 25 (Not a typewriter) but it looks like it works. > I try to do almost the same (---Read---)to read the output, but I cannot get > this to read > anything. As far as I can tell, the script is not executed. > Dos anybody have a hint. I don't have time to test your program atm, but I can see directly that the program is wrong. You are only allowed to check errno if popen returns -1 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Popen
> > I am trying to use the "Popen" function in Read mode. > > I first tried the example (---Write---) from the manual (see beneath). > > The POpen gives an error 25 (Not a typewriter) but it looks like it works. > > I try to do almost the same (---Read---)to read the output, but I cannot > > get this to read > > anything. As far as I can tell, the script is not executed. > > Dos anybody have a hint. > > I don't have time to test your program atm, but I can see directly that the > program is wrong. You are only allowed to check errno if popen returns -1 The FPC manual (REFERENCE FOR UNIT ´UNIX´) 32.3.20 dos not indicate this, (The code is a direct copy from the manual). I have corrected it, but it did not change anything. Carsten Med venlig hilsen Carsten Bager BEAS A/S Brørupvænget 10 DK-7650 Bøvlingbjerg Tlf. : +45 9788 5222 Fax : +45 9788 5434 www.beas.dk ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal