[GRASS-dev] v.in.dxf and modified version of G_percent

Hallo,

in read_dxf.c (v.in.dxf) there is function big_percent(). This function
prints information about progres while import. big_percent is defined
like

int big_percent(unsigned long n, unsigned long d, int s)

while G_percent

int G_percent (int n,int d,int s)

IMHO v.in.dxf should use G_percent too. What kind of approach is the
best:

    - Rewrite G_percent, so it uses long integers on input
    - New function G_percent_big for cases like this
    - Nothing, using G_percent directly will not cause any problem

??

Jachym

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

Jachym Cepicky wrote:

in read_dxf.c (v.in.dxf) there is function big_percent(). This function
prints information about progres while import. big_percent is defined
like

int big_percent(unsigned long n, unsigned long d, int s)

while G_percent

int G_percent (int n,int d,int s)

IMHO v.in.dxf should use G_percent too. What kind of approach is the
best:

    - Rewrite G_percent, so it uses long integers on input
    - New function G_percent_big for cases like this
    - Nothing, using G_percent directly will not cause any problem

I suggest taking the first approach.

--
Glynn Clements <glynn@gclements.plus.com>

Hi,

> IMHO v.in.dxf should use G_percent too. What kind of approach is the
> best:
>
> - Rewrite G_percent, so it uses long integers on input
> - New function G_percent_big for cases like this
> - Nothing, using G_percent directly will not cause any problem

I suggest taking the first approach.

Could you review this patch, please? It seems to work for me, but I have
no real imagination about the number types and how they are compatible in C.

Thanks

Jachym

--
Jachym Cepicky
e-mail: jachym.cepicky@centrum.cz
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky@node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514

(attachments)

G_percent.patch (1.2 KB)

Jachym Cepicky wrote:

> > IMHO v.in.dxf should use G_percent too. What kind of approach is the
> > best:
> >
> > - Rewrite G_percent, so it uses long integers on input
> > - New function G_percent_big for cases like this
> > - Nothing, using G_percent directly will not cause any problem
>
> I suggest taking the first approach.

Could you review this patch, please? It seems to work for me, but I have
no real imagination about the number types and how they are compatible in C.

I've committed it with a couple of minor changes:

1. The doxygen comments have been updated to the new prototypes.
2. The "s" parameter (which is a percentage) remains an "int".

--
Glynn Clements <glynn@gclements.plus.com>