Piggy icon indicating copy to clipboard operation
Piggy copied to clipboard

Help Comments (feature request)

Open fdncred opened this issue 7 years ago • 1 comments

Sorry to keep peppering you with issues but here's another one.

With Leptonica, and other code bases, there are comments that are used to generate help files and provide autocomplete help/intellisense. Do you plan on including those items?

Here is an example from from Leptonica's pix.h. You can see the struct member help here.

/*! Basic Pix */
struct Pix
{
    l_uint32             w;         /*!< width in pixels                   */
    l_uint32             h;         /*!< height in pixels                  */
    l_uint32             d;         /*!< depth in bits (bpp)               */
    l_uint32             spp;       /*!< number of samples per pixel       */
    l_uint32             wpl;       /*!< 32-bit words/line                 */
    l_uint32             refcount;  /*!< reference count (1 if no clones)  */
    l_int32              xres;      /*!< image res (ppi) in x direction    */
                                    /*!< (use 0 if unknown)                */
    l_int32              yres;      /*!< image res (ppi) in y direction    */
                                    /*!< (use 0 if unknown)                */
    l_int32              informat;  /*!< input file format, IFF_*          */
    l_int32              special;   /*!< special instructions for I/O, etc */
    char                *text;      /*!< text string associated with pix   */
    struct PixColormap  *colormap;  /*!< colormap (may be null)            */
    l_uint32            *data;      /*!< the image data                    */
};
typedef struct Pix PIX;

And from pix1.c you can see the help defined for the functions, such as this one.

/*--------------------------------------------------------------------*
 *                              Pix Creation                          *
 *--------------------------------------------------------------------*/
/*!
 * \brief   pixCreate()
 *
 * \param[in]    width, height, depth
 * \return  pixd with data allocated and initialized to 0,
 *                    or NULL on error
 */
PIX *
pixCreate(l_int32  width,
          l_int32  height,
          l_int32  depth)
{
PIX  *pixd;

    PROCNAME("pixCreate");

    if ((pixd = pixCreateNoInit(width, height, depth)) == NULL)
        return (PIX *)ERROR_PTR("pixd not made", procName, NULL);
    memset(pixd->data, 0, 4LL * pixd->wpl * pixd->h);
    return pixd;
}

I'm sure this complicates things but it definitely makes a more useful wrapper.

This also assumes that one can supply all the .h and .c/.cpp files to Piggy for generation. I'm not sure if that's possible yet.

Thanks again for your great work!

fdncred avatar Jan 18 '19 13:01 fdncred

No prob. So, yes, it would be good to include comments in the declarations. In fact, I was thinking, much easier, would be to include the line/col as a comment when creating a declaration in lep.pig.cs. I'll make a "to do" note. -K

On 1/18/2019 8:46 AM, Darren Schroeder wrote:

Sorry to keep peppering you with issues but here's another one.

With Leptonica, and other code bases, there are comments that are used to generate help files and provide autocomplete help/intellisense. Do you plan on including those items?

Here is an example from from Leptonica's pix.h. You can see the struct member help here.

/! Basic Pix / struct Pix { l_uint32 w;/!< width in pixels / l_uint32 h;/!< height in pixels / l_uint32 d;/!< depth in bits (bpp) / l_uint32 spp;/!< number of samples per pixel / l_uint32 wpl;/!< 32-bit words/line / l_uint32 refcount;/!< reference count (1 if no clones) / l_int32 xres;/!< image res (ppi) in x direction / /!< (use 0 if unknown) / l_int32 yres;/!< image res (ppi) in y direction / /!< (use 0 if unknown) / l_int32 informat;/!< input file format, IFF_ / l_int32 special;/!< special instructions for I/O, etc */ char text;/!< text string associated with pix */ struct PixColormap colormap;/!< colormap (may be null) */ l_uint32 data;/!< the image data */ }; typedef struct Pix PIX;

And from pix1.c you can see the help defined for the functions, such as this one.

/--------------------------------------------------------------------

  • Pix Creation * --------------------------------------------------------------------/ /*!

  • \brief pixCreate()

  • \param[in] width, height, depth

  • \return pixd with data allocated and initialized to 0,

  • or NULL on error */ PIX * pixCreate(l_int32 width, l_int32 height, l_int32 depth) { PIX *pixd;

    PROCNAME("pixCreate");

    if ((pixd =pixCreateNoInit(width, height, depth)) ==NULL) return (PIX *)ERROR_PTR("pixd not made", procName,NULL); memset(pixd->data,0,4LL * pixd->wpl * pixd->h); return pixd; }

I'm sure this complicates things but it definitely makes a more useful wrapper.

This also assumes that one can supply all the .h and .c/.cpp files to Piggy for generation. I'm not sure if that's possible yet.

Thanks again for your great work!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kaby76/Piggy/issues/11, or mute the thread https://github.com/notifications/unsubscribe-auth/AK3KCxyKR4ZXLL4sOuW8GJF3HwRcKVlrks5vEdBDgaJpZM4aH7y7.

kaby76 avatar Jan 18 '19 13:01 kaby76