1*c7ef0cfcSnicm /* $OpenBSD: fld_info.c,v 1.7 2023/10/17 09:52:10 nicm Exp $ */
202f2426aSmillert /****************************************************************************
3*c7ef0cfcSnicm * Copyright 2020,2021 Thomas E. Dickey *
4*c7ef0cfcSnicm * Copyright 1998-2004,2010 Free Software Foundation, Inc. *
502f2426aSmillert * *
602f2426aSmillert * Permission is hereby granted, free of charge, to any person obtaining a *
702f2426aSmillert * copy of this software and associated documentation files (the *
802f2426aSmillert * "Software"), to deal in the Software without restriction, including *
902f2426aSmillert * without limitation the rights to use, copy, modify, merge, publish, *
1002f2426aSmillert * distribute, distribute with modifications, sublicense, and/or sell *
1102f2426aSmillert * copies of the Software, and to permit persons to whom the Software is *
1202f2426aSmillert * furnished to do so, subject to the following conditions: *
1302f2426aSmillert * *
1402f2426aSmillert * The above copyright notice and this permission notice shall be included *
1502f2426aSmillert * in all copies or substantial portions of the Software. *
1602f2426aSmillert * *
1702f2426aSmillert * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
1802f2426aSmillert * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
1902f2426aSmillert * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
2002f2426aSmillert * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
2102f2426aSmillert * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
2202f2426aSmillert * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
2302f2426aSmillert * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
2402f2426aSmillert * *
2502f2426aSmillert * Except as contained in this notice, the name(s) of the above copyright *
2602f2426aSmillert * holders shall not be used in advertising or otherwise to promote the *
2702f2426aSmillert * sale, use or other dealings in this Software without prior written *
2802f2426aSmillert * authorization. *
2902f2426aSmillert ****************************************************************************/
3002f2426aSmillert
3102f2426aSmillert /****************************************************************************
3281d8c4e1Snicm * Author: Juergen Pfeifer, 1995,1997 *
3302f2426aSmillert ****************************************************************************/
348d0fca71Smillert
358d0fca71Smillert #include "form.priv.h"
368d0fca71Smillert
37*c7ef0cfcSnicm MODULE_ID("$Id: fld_info.c,v 1.7 2023/10/17 09:52:10 nicm Exp $")
388d0fca71Smillert
398d0fca71Smillert /*---------------------------------------------------------------------------
408d0fca71Smillert | Facility : libnform
418d0fca71Smillert | Function : int field_info(const FIELD *field,
428d0fca71Smillert | int *rows, int *cols,
438d0fca71Smillert | int *frow, int *fcol,
448d0fca71Smillert | int *nrow, int *nbuf)
458d0fca71Smillert |
46*c7ef0cfcSnicm | Description : Retrieve information about the field's creation parameters.
478d0fca71Smillert |
488d0fca71Smillert | Return Values : E_OK - success
498d0fca71Smillert | E_BAD_ARGUMENT - invalid field pointer
508d0fca71Smillert +--------------------------------------------------------------------------*/
FORM_EXPORT(int)51*c7ef0cfcSnicm FORM_EXPORT(int)
5281d8c4e1Snicm field_info(const FIELD *field,
538d0fca71Smillert int *rows, int *cols,
548d0fca71Smillert int *frow, int *fcol,
558d0fca71Smillert int *nrow, int *nbuf)
568d0fca71Smillert {
5781d8c4e1Snicm T((T_CALLED("field_info(%p,%p,%p,%p,%p,%p,%p)"),
58*c7ef0cfcSnicm (const void *)field,
59*c7ef0cfcSnicm (void *)rows, (void *)cols,
60*c7ef0cfcSnicm (void *)frow, (void *)fcol,
61*c7ef0cfcSnicm (void *)nrow, (void *)nbuf));
6281d8c4e1Snicm
638d0fca71Smillert if (!field)
648d0fca71Smillert RETURN(E_BAD_ARGUMENT);
658d0fca71Smillert
6681d8c4e1Snicm if (rows)
6781d8c4e1Snicm *rows = field->rows;
6881d8c4e1Snicm if (cols)
6981d8c4e1Snicm *cols = field->cols;
7081d8c4e1Snicm if (frow)
7181d8c4e1Snicm *frow = field->frow;
7281d8c4e1Snicm if (fcol)
7381d8c4e1Snicm *fcol = field->fcol;
7481d8c4e1Snicm if (nrow)
7581d8c4e1Snicm *nrow = field->nrow;
7681d8c4e1Snicm if (nbuf)
7781d8c4e1Snicm *nbuf = field->nbuf;
788d0fca71Smillert RETURN(E_OK);
798d0fca71Smillert }
808d0fca71Smillert
818d0fca71Smillert /*---------------------------------------------------------------------------
828d0fca71Smillert | Facility : libnform
838d0fca71Smillert | Function : int dynamic_field_info(const FIELD *field,
848d0fca71Smillert | int *drows, int *dcols,
858d0fca71Smillert | int *maxgrow)
868d0fca71Smillert |
87*c7ef0cfcSnicm | Description : Retrieve information about a dynamic field's current
888d0fca71Smillert | dynamic parameters.
898d0fca71Smillert |
908d0fca71Smillert | Return Values : E_OK - success
918d0fca71Smillert | E_BAD_ARGUMENT - invalid argument
928d0fca71Smillert +--------------------------------------------------------------------------*/
93*c7ef0cfcSnicm FORM_EXPORT(int)
dynamic_field_info(const FIELD * field,int * drows,int * dcols,int * maxgrow)9481d8c4e1Snicm dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow)
958d0fca71Smillert {
96*c7ef0cfcSnicm T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"),
97*c7ef0cfcSnicm (const void *)field,
98*c7ef0cfcSnicm (void *)drows,
99*c7ef0cfcSnicm (void *)dcols,
100*c7ef0cfcSnicm (void *)maxgrow));
10181d8c4e1Snicm
1028d0fca71Smillert if (!field)
1038d0fca71Smillert RETURN(E_BAD_ARGUMENT);
1048d0fca71Smillert
10581d8c4e1Snicm if (drows)
10681d8c4e1Snicm *drows = field->drows;
10781d8c4e1Snicm if (dcols)
10881d8c4e1Snicm *dcols = field->dcols;
10981d8c4e1Snicm if (maxgrow)
11081d8c4e1Snicm *maxgrow = field->maxgrow;
1118d0fca71Smillert
1128d0fca71Smillert RETURN(E_OK);
1138d0fca71Smillert }
1148d0fca71Smillert
1158d0fca71Smillert /* fld_info.c ends here */
116