On Sun, 15 Nov 2009, Szak�ts Viktor wrote:
> >> // Error BASE/3012  Argument error: COPTION
> >> // Called from WIN_OLEAUTO:COPTION(0)
> >> // Called from SAMPLE(42)
> > The real error code is 0x8002000E DISP_E_BADPARAMCOUNT
> > It would be nice to have real OLE error code instead of 3012, but the 
> > problem is that error codes are USHORT and OLE errors are ULONG (with 
> > significant part in upper word). The similar situation is in ADS error 
> > codes. They has UNSIGNED32 type, but are small values, so no problem to 
> > cast to USHORT. Can we have ULONG (or LONG) for error subcode and OS code? 
> > It seems a simple change. hb_errRT_*() already accepts ULONG, we have to 
> > change hb_err[Get|Put]SubCode() only.
> Yes, it would be a good thing to change gencode, 
> subcode and oscode to 32-bit.
> I'd suggest using some abstract type in this case f.e. 
> HB_ERROR or HB_ERRCODE, or some others from the new 
> types, like HB_U32.
> Plain ULONG/LONG isn't very good as we'd need to change them 
> later anyway.
> But, I'm not sure if mapping system error codes directly 
> to Harbour gencode is a good idea. It seems to be better 
> to put these codes to oscode, or subcode.

Viktor,

The bad thing with abstracted types is the fact the it makes creating
interface between Harbour and other tools harder.
As long as Harbour uses well known types then it's quite easy.
When I have a function in some library which needs as parameter variable as
type 'abc' and returns result as type 'xyz' and I can see exactly the same
types in harbour public functions then creating the wrapper is trivial.
In the moment when we introduce our own new types then we create new
possible problems for many users who have to create some simple extensions
in C. And this is sth what causes that I want to delay this moment as long
as possible. Just simply I'm nearly sure that it will break much more things
then resolve current problems which seems to be really minor in comparison
to potential problems which will be created by users ;-)

In this case I agree that final type for error codes should be existing
HB_ERRCODE and this type should be converted to 'unsigned int' but before
you will change it please check all places in the Harbour SVN which will
be effected by such modification. We have to well know them. I'm mostly
interested in all structures and function parameters which may use USHORT
so they have to be converted to HB_ERRCODE. And of course we will have to
eliminate casting added to pacify MSVC warnings in code like:
      uiOsErrorLast = ( USHORT ) GetLastError();
Such modification fully breaks any binary compatibility in some subsystems
like GT or RDD so if we want to make it then it should be done ASAP before
final 2.0.
So as 1-st step I suggest to systematically replace all USHORT used
in error code context with HB_ERRCODE without changing the HB_ERRCODE
definition.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to