libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] Sample functions


From: gagan
Subject: Re: [libredwg] Sample functions
Date: Fri, 28 Jun 2013 11:07:57 +0530

On Thu, Jun 27, 2013 at 2:44 AM, Till Heuschmann <address@hidden> wrote:
>
> First of all your functions are OK (from a source point of view, I have not 
> run them in a debugger) they produce the output one expects them to do and 
> hide libredwgs internal structure. Fine.

Thanks for approving them. BTW I do check them if they are working
properly before showing it to you.

> To improve them or to keep in mind for the next functions you write here are 
> some hints:
>
>
> count_entity(...)
> The function has the parameter "name" with witch the the name of an object is 
> given. In nearly the whole body of the function there are string compares to 
> match the DWG_TYPE with the "name". Instead of the name parameter the 
> function could have a DWG_TYPE parameter which would eliminate all the strcmp 
> calls.
>
> The object name as a string makes room for "misspelling" errors (searching 
> for "Circle" instead of "CIRCLE")
>
> If you want to stay with the parameter "name" you should try to move the 
> strcmp calls outside of the while loop.

Thanks again for helping out. I have updated according to object_type
and it drastically reduced my lines of code [ 0 ].
BTW ( for flexibility reasons ) can we have both the functions ? 1
according to object type and 1 according to name input ?

> extract_lines(...)
> Functions that allocate memory and left the user to free this memory are 
> always problematic. But, why not.

So is this function alright ?

> The API must not hide the get_first/get_next functions. What the extract_XXX 
> functions do the user should be able to do also without these functions.

Didn't get you on this. A user is able to use get_first/get_next
functions outside my function. These get_first/get_next functions were
already there in dwg.c and dwg.h files. I have just used them in my
functions.

[ 0 ] http://202.164.53.122/~gagan/gsoc/function2.txt

-- 
Thanks
Gaganjyot
http://codeify.wordpress.com
"Jai Sai Naath"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]