Difference between revisions of "User:Ksuzee/Reports"

From BRL-CAD
Line 53: Line 53:
  
 
/libtclcad/tclcadobj.c -  
 
/libtclcad/tclcadobj.c -  
*functions "HIDDEN int to_mouse_move_arb_edge", "HIDDEN int to_mouse_move_arb_face" and "HIDDEN int to_mouse_move_pipept". The difference's in:
+
***functions "HIDDEN int to_mouse_move_arb_edge", "HIDDEN int to_mouse_move_arb_face" and "HIDDEN int to_mouse_move_pipept". The difference's in:
 
av[0] = "move_arb_face"; - to_mouse_move_arb_face
 
av[0] = "move_arb_face"; - to_mouse_move_arb_face
 
av[0] = "move_arb_edge"; - to_mouse_move_arb_edge
 
av[0] = "move_arb_edge"; - to_mouse_move_arb_edge
Line 64: Line 64:
  
 
So these functions could call another static function which'd have all the body and get char * parameter for av[0] and functional type for ret.
 
So these functions could call another static function which'd have all the body and get char * parameter for av[0] and functional type for ret.
*functions "HIDDEN int to_poly_ell_mode" and "HIDDEN int to_poly_circ_mode". Differnce's in consts - gdvp->gdv_view->gv_mode = TCLCAD_POLY_ELLIPSE_MODE; and gdvp->gdv_view->gv_mode = TCLCAD_POLY_CIRCLE_MODE; so necessary const could be got by common function (type - ged_view, if I'm not mistaken). Also difference is in bu_vls_printf, but type char* can be transmit too.
+
***functions "HIDDEN int to_poly_ell_mode" and "HIDDEN int to_poly_circ_mode". Differnce's in consts - gdvp->gdv_view->gv_mode = TCLCAD_POLY_ELLIPSE_MODE; and gdvp->gdv_view->gv_mode = TCLCAD_POLY_CIRCLE_MODE; so necessary const could be got by common function (type - ged_view, if I'm not mistaken). Also difference is in bu_vls_printf, but type char* can be transmit too.
  
 
/librt/primitives/nmg/nmg_rt_segs.c - functions "HIDDEN int state5" and "HIDDEN int state6". It'd be easy to reduct, because difference's only in ret_val (in two situations at the end of functions) which is INT. So I'd be necessary only to transmit ret_val1 and ret_val2.
 
/librt/primitives/nmg/nmg_rt_segs.c - functions "HIDDEN int state5" and "HIDDEN int state6". It'd be easy to reduct, because difference's only in ret_val (in two situations at the end of functions) which is INT. So I'd be necessary only to transmit ret_val1 and ret_val2.

Revision as of 15:59, 2 June 2012

GSoC 2012

0 week

  • 2/05/2012 - installing Ubuntu-12.04, XChat
  • 4-5/05/2012 - downloading sources, successful building with CMake
  • 8-9/05/2012 - making folder which contains the information about duplications in every folder of /trunk/src
  • 12/05/2012 - csh script for finding duplications
  • 15/05/2012 - patch r50549 for adrt/isst_tcltk.c
  • 16-18/05/2012 - patches:
    • /fb/orle-fb.c
    • /util/picbackgnd.c
    • /libbu/htonf.c

1 week

    • start fixing duplications, which are situated in different folders
    • patch /libbu/convert.c for check
    • patch /util/lowp.c for check
    • patch /rt/viewarea.c for check
    • getting familiar with Astyle

Also I continue to check folders which contain duplications in one file.

There're folders: util, vfont, tclscripts, sig, shapes, rtthem, remrt, proc-fb, nirt, libwdb, libtermio, libsysw, librtserver. All these directories are checked. They either have no duplications in one file which should be reducted or reductions are put to patch tracker for check. I'm working on directories: tab, rt. mged, libtclcad, librt

2 week

  • 28/05
    • correction to patches: /fb/orle-fb.c and /util/picbackgnd.c (testing)
    • working at duplications in /mged/points/process.c
  • 29/05
    • there's a huge duplication in rt/worker.c. I'm working on it
    • checking some more directories (will write the result later)
  • 30/05
    • checking some more directories (will write the result later)
    • leave worker.c for discuss (ready, but not tested yet)
  • 31/05
    • correction the util/lowp.c patch
    • checking some more directories
  • 1/06
    • all the directories are checked for duplications in one file
  • 2/06
    • preparing the summary about duplications

b/tabinterp.c - functions step_interpolate and linear_interpolate -- the bodies're different but part which contains "for", "while" and "if" can be put in common static inline function.

/rt/worker.c - there're two huge parts in function "void do_pixel" in "begin unroll"-"end unroll" and "begin non-ubrolled"-"end non-unrolled". However, you told it problem file, so I'll wait your comment here.

/mged/cmd.c - functions "int cmd_ged_edit_wrapper" and "int cmd_ged_simulate_wrapper". The only ddifference is value of av[1]. Both these functions are used in setup.c, so it's better to use static inline function too. I suggest to make one more variable for parameter of argv[]

/libtclcad/tclcadobj.c -

      • functions "HIDDEN int to_mouse_move_arb_edge", "HIDDEN int to_mouse_move_arb_face" and "HIDDEN int to_mouse_move_pipept". The difference's in:

av[0] = "move_arb_face"; - to_mouse_move_arb_face av[0] = "move_arb_edge"; - to_mouse_move_arb_edge av[0] = "move_pipept"; - to_mouse_move_pipept

and ret = ged_move_arb_edge(gedp, 5, (const char **)av); ret = ged_move_arb_face(gedp, 5, (const char **)av); ret = ged_move_pipept(gedp, 5, (const char **)av);

So these functions could call another static function which'd have all the body and get char * parameter for av[0] and functional type for ret.

      • functions "HIDDEN int to_poly_ell_mode" and "HIDDEN int to_poly_circ_mode". Differnce's in consts - gdvp->gdv_view->gv_mode = TCLCAD_POLY_ELLIPSE_MODE; and gdvp->gdv_view->gv_mode = TCLCAD_POLY_CIRCLE_MODE; so necessary const could be got by common function (type - ged_view, if I'm not mistaken). Also difference is in bu_vls_printf, but type char* can be transmit too.

/librt/primitives/nmg/nmg_rt_segs.c - functions "HIDDEN int state5" and "HIDDEN int state6". It'd be easy to reduct, because difference's only in ret_val (in two situations at the end of functions) which is INT. So I'd be necessary only to transmit ret_val1 and ret_val2.

/libpc/pcParameter.cpp - methods Point::Point(VCSet & vcs, std::string n, void *ptr) and Vector::Vector(VCSet & vcs, std::string n, void *ptr): the blocks in if (ptr) {...} are the same, so this block can be put in other function.

/liboptical/sh_camo.c - functions HIDDEN int marble_setup and HIDDEN int camo_setup. The difference is in bu_log (just static comment) and in memcpy.

/libbn/plot.c - functions void pd_3space and void pd_3line. I made static inline function pd_3 which gets the same parameters as those two functions + char l. Both functions call pd_3 with l == 'W' for pd3_space and l == 'V' for pd_3line. Making was successful.

/fbserv/server.c - void fb_server_fb_scursor and void fb_server_fb_cursor. Difference is: (void)pkg_plong(&rbuf[0], fb_cursor(fb_server_fbp, mode, x, y)); and (void)pkg_plong(&rbuf[0], fb_scursor(fb_server_fbp, mode, x, y)); So common function can get just: struct pkg_conn *pcp, char *buf + functional type

/fb/pl-fb.c - int GetDCoords(coords *coop) and int Get3DCoords(coords *coop). Difference is only here: if (debug) {fprintf..}. So text for fprintf can be transmited like a char * in common function.