Michael Fuchs | 1 Mar 12:38 2011
Picon

Re: Standard exceptions

Am 28.02.2011 14:17, schrieb Sven Barth:
> As far as I'm aware of: There are none.
>
> There is ERangeError though (in SysUtils), but that's not an equivalent
> for ArgumentOutOfRangeException (I suppose that inherits from
> ArgumentException?).

Yes,and all Argument..Exceptions have a property ParamName:String 
containing the parameter which causes the error.

I also miss a NotImplementedException (or ENotImplemented in FPC style), 
very handy for test driven development. :)

And by the way: how about a InnerException for the SysUtils.Exception 
class? This would be nice if you want to wrap an exception around another.

Are there any chances for implement this?

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

Vinzent Höfler | 1 Mar 12:54 2011
Picon
Picon

Re: Standard exceptions

On Tue, 01 Mar 2011 12:38:27 +0100, Michael Fuchs  
<freepascal@...> wrote:

> I also miss a NotImplementedException (or ENotImplemented in FPC style),  
> very handy for test driven development. :)

Yeah. And

type
    //--  <at> abstract(Obvious coding error.)
    Coder_Needs_Coffee = class (SysUtils.Exception);

was very handy for those "me stupid" situations.

;)

Vinzent.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Jonas Maebe | 1 Mar 12:58 2011
Picon

Fwd: Problem

To Rocco: the correct address to send messages for the list to is fpc-pascal@...

Begin forwarded message:

> From: ROCCO DALTO <roccoandroxy@...>
> Date: Tue 1 Mar 2011 01:13:08 GMT+01:00
> To: fpc-pascal-bounces@...
> Subject: Probem!
>
>
> Thank You for responding.
>
> Problem:Still Cannot Run Programs Compiled In Free Pascal At My  
> Website.
>
> I constructed math software in Turbo Pascal 7.0 and put some sample  
> programs on my current website at http://www.mathtut.biz.
> The programs run fine at my site.
> I recently downloaded Free Pascal and modified some programs I  
> constructed in Turbo Pascal 7.0.
> The problem is that the applications(complied in Free Pascal) run  
> fine everywhere except at my website above(Using Host Monster).
> The file cannot be found on the server when running from website.
> Can you explain why?
> Can you provide a solution?
> Also,the programs loaded in the control panel(Host Monster) which  
> where written in Turbo Pascal 7.0 are type "text/x-generic" and  
> programs written in Free Pascal are type "application/x-msdownload".
> Host Monster claimed the problem is with Free Pascal.
>
(Continue reading)

leledumbo | 1 Mar 08:34 2011
Picon

XHTML writer support in fcl-xml

Right now, fcl-xml only contains writer for THTMLDocument class from
htmlelements unit. There's also another THTMLDocument class in dom_html unit
which is used as a base class of TXHTMLDocument in xhtml unit. First, why
the separation? Second, is there any plan to have writer support for
TXHTMLDocument? I need to produce strict xhtml document dynamically.

--

-- 
View this message in context: http://free-pascal-general.1045716.n5.nabble.com/XHTML-writer-support-in-fcl-xml-tp3404505p3404505.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Michael Fuchs | 1 Mar 13:00 2011
Picon

Re: Standard exceptions

Am 28.02.2011 18:28, schrieb Jonas Maebe:
> There are no generic equivalents to ArgumentException and
> ArgumentNullException (when asking such questions in the future, you
> may also want to include a reference to a web page that describes
> what they mean, it makes it easier for people to answer you).

Sorry, bad mistake. A simple description of this exceptions or better of 
their possible FPC equivalents:

EArgument
Base exception for argument related exceptions. Contains a property 
ParamName which helds the parameter causing the error.

EArgumentNil (inherits from EArgument):
Thrown if a given parameter to a method is nil and should not.

EArgumentRange (inherits from EArgument):
Thrown if a given parameter to a method is out of range.

ENotImplemented
Thrown if a method implementation is not ready. Nice for 
test-driven-development. Maybe IDEs which generates class 
implementations could start with a "raise ENotImplemted.Create;" in 
method body.

regards
Michael
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
(Continue reading)

Michael Van Canneyt | 1 Mar 13:22 2011

Re: Fwd: Problem


On Tue, 1 Mar 2011, Jonas Maebe wrote:

> To Rocco: the correct address to send messages for the list to is 
> fpc-pascal@...
>
>
> Begin forwarded message:
>
>> From: ROCCO DALTO <roccoandroxy@...>
>> Date: Tue 1 Mar 2011 01:13:08 GMT+01:00
>> To: fpc-pascal-bounces@...
>> Subject: Probem!
>> 
>> 
>> Thank You for responding.
>> 
>> Problem:Still Cannot Run Programs Compiled In Free Pascal At My Website.
>> 
>> I constructed math software in Turbo Pascal 7.0 and put some sample 
>> programs on my current website at http://www.mathtut.biz.
>> The programs run fine at my site.
>> I recently downloaded Free Pascal and modified some programs I constructed 
>> in Turbo Pascal 7.0.
>> The problem is that the applications(complied in Free Pascal) run fine 
>> everywhere except at my website above(Using Host Monster).
>> The file cannot be found on the server when running from website.
>> Can you explain why?
>> Can you provide a solution?
>> Also,the programs loaded in the control panel(Host Monster) which where 
(Continue reading)

Marco van de Voort | 1 Mar 14:07 2011
Picon

Re: Standard exceptions

In our previous episode, Jonas Maebe said:
> None of these exist in Pascal. You can get exceptions for range check errors (ERangeError) in case you
enable range checking and include the sysutils unit in your uses clause, but in that case range checking
will be performed for all assignments, not just for passed arguments (and the range is checked by the
compiler at the caller side based on the declared parameter types, not at the callee side). There are only a
few routines in the RTL that explicitly raise it after explicitly checking their arguments.
> 
> There are no generic equivalents to ArgumentException and
> ArgumentNullException (when asking such questions in the future, you may
> also want to include a reference to a web page that describes what they
> mean, it makes it easier for people to answer you).

C# has nullable types, and my guess would be that the ArgumentNullexception
happens you assign/pass a nullable value with NULL to a non-nullable
equivalent.

So it could be that it corresponds to some EVariantisnull error, but that is
a bit of a stretch.

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

Jorge Aldo G. de F. Junior | 1 Mar 19:50 2011
Picon

Consumer producer unit (donation to fcl)

i have implemented a small consumer x producer unit (ie: threads that
produce or consume tobjects)

it is thread safe (based around a tthreadsafequeue with signalling -
the thread can sleep/wait arbitrary timeout time while its queue is
empty waiting for the producer)

is it interesting for the fcl ?

i want to donate it, and i think it can be incremented with other functions.

currently theres the following :

TProducer (thread that produces tobjects, placing then on the queue of
a consumer)
TConsumer (thread that consumes tobjects thru a queue)
TConsumerProducer (kind of a proxy, that consumes tobjects in a side,
process them and sends then to another consumer, it inherits from
TConsumer)
TRandomMultiplexerProducerConsumerThread (similar to the previous, but
has more than one consumer attached, it selects the next one to send
its tobjects by random)
TRoundRobinMultiplexerProducerConsumerThread (similar to the previous,
but instead of random chance, uses a round robing fashion)
TCustomAddressableMultiplexer (similar to the previous, but allows a
kind of addressability of the tobjects, selecting with consumer to
send to, by using a message address and a hashtable -
tfphashobjectlist)

Now i am developing bus and other models (various threads sharing a
(Continue reading)

Roland Turcan | 2 Mar 09:02 2011
Picon

Conversion between ordinals and pointers is not portable

Hello all,

I have this code:

TYPE  PRDBRecord  =^TRDBRecord;
      TRDBRecord  =PACKED RECORD
                     Content :ARRAY [0..65500] OF BYTE;
                   END;

VAR MOffset:INTEGER;
    p      :PByteArray;
    FData  :PRDBRecord;

  ...
  p := PByteArray (PtrUInt ( <at> FData.Content[0]) + MOffset);
  ...

But the compiler informs about %subj%.

How to get rid of this warning and to make code portable?

Thanks in advance.

--

-- 
Best regards, TRoland
http://www.rotursoft.sk
http://exekutor.rotursoft.sk

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
(Continue reading)

Jonas Maebe | 2 Mar 10:33 2011
Picon

Re: Conversion between ordinals and pointers is not portable


On 02 Mar 2011, at 09:02, Roland Turcan wrote:

>  ...
>  p := PByteArray (PtrUInt ( <at> FData.Content[0]) + MOffset);
>  ...
>
>
> But the compiler informs about %subj%.
>
> How to get rid of this warning and to make code portable?

Typecast to PByte instead of to PtrUInt.

Jonas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@...
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Gmane