Hi,
> Viktor Szakáts wrote:
>> It seems that OS/2 cairo version has no 'CAIRO_HAS_IMAGE_SURFACE' support,
>> and this makes test app break. The correct fix here is to provide Harbour
>> level function regardless of cairo version, but return permanent error in
>> this case. This is the method used in all other Harbour lib bindings.
>> I hope Mindaugas can fix it.
>
> Let's say cairo function should return surface (GC pointer type). What is
> expected behavior of such function, if does not exist in current cairo
> version? hb_ret()? EG_UNSUPPORTED? etc....
IMO it's best if it returns failure just as if the underlying
low-level function had failed, which means returning the same
type as in normal cases, but HB_FALSE, NULL or other distinctive
value. This is hb_retptr( NULL ) for low-level object creation
functions.
If hb_retptr( NULL ) is returned, all other functions expecting
this value should also handle it, by throwing an RTE in param
checking phase.
Current hbcairo code uses RTE _right on creation_, which is
IMO not ideal solution, as it's more difficult to handle it
on .prg level.
So as a general advice, IMO RTE should only be thrown if
wrong parameter was passed to a function, so code snippet
like this one can be made sure to not RTE because of
problems downstream in calls.
IF ! Empty( p := MYOBJECT_CREATE( "hello" ) )
MYOBJECT_DO_SOMETHING_USEFUL( p, 100 )
ELSE
/* Either the low-level call failed,
or low-level call was not available.
Handle it gracefully. */
ENDIF
In current implementation whole above construct needs to be
put inside BEGIN SEQUENCE to prepare for MYOBJECT_CREATE()
failures.
Brgds,
Viktor
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour