Annotation of gnutrition/budget.h, revision 1.1

1.1     ! asm         1: // SPDX-License-Identifier: GPL-3.0-or-later
        !             2: /*
        !             3:  * $Id$
        !             4:  *
        !             5:  * budget.h - USDA Food Pattern budget system for GNUtrition
        !             6:  *
        !             7:  * Copyright (C) 2026 Free Software Foundation, Inc.
        !             8:  *
        !             9:  * Author: Jason Self <jself@gnu.org>
        !            10:  *         Anton McClure <asm@gnu.org>
        !            11:  */
        !            12: 
        !            13: #ifndef BUDGET_H
        !            14: #define BUDGET_H
        !            15: 
        !            16: /* Daily budget for the USDA Healthy US-Style Eating Pattern.
        !            17:    Units: cup-equivalents for vegetables, fruits, dairy;
        !            18:           ounce-equivalents for grains, protein; grams for oils.  */
        !            19: struct daily_budget
        !            20: {
        !            21:   int calories;        /* kcal level  */
        !            22:   double vegetables;   /* cup-eq  */
        !            23:   double fruits;       /* cup-eq  */
        !            24:   double grains;       /* oz-eq   */
        !            25:   double dairy;        /* cup-eq  */
        !            26:   double protein;      /* oz-eq   */
        !            27:   double oils;         /* grams   */
        !            28: };
        !            29: 
        !            30: /* Physical activity level multiplier categories.  */
        !            31: enum activity_level
        !            32: {
        !            33:   ACTIVITY_SEDENTARY,       /* little or no exercise: 1.2   */
        !            34:   ACTIVITY_LIGHT,           /* light exercise 1-3 days/wk: 1.375  */
        !            35:   ACTIVITY_MODERATE,        /* moderate exercise 3-5 days/wk: 1.55  */
        !            36:   ACTIVITY_VERY_ACTIVE,     /* hard exercise 6-7 days/wk: 1.725  */
        !            37:   ACTIVITY_EXTRA_ACTIVE     /* very hard exercise / physical job: 1.9  */
        !            38: };
        !            39: 
        !            40: /* User gender, for equations */
        !            41: enum user_gender
        !            42: {
        !            43:   GENDER_NEUTRAL = 0,
        !            44:   GENDER_FEMALE,
        !            45:   GENDER_MALE
        !            46: };
        !            47: 
        !            48: /* Estimate daily calorie needs using the Mifflin-St Jeor equation
        !            49:    with a neutral midpoint default (-78).
        !            50: 
        !            51:    AGE_YEARS is the person's age.  HEIGHT_CM is height in centimeters.
        !            52:    WEIGHT_KG is weight in kilograms.  ACTIVITY is the physical
        !            53:    activity multiplier.  Returns estimated kcal/day, already rounded
        !            54:    to the nearest USDA pattern level (200-kcal steps, 1000-3200).  */
        !            55: int budget_estimate_calories (int age_years, double height_cm,
        !            56:                               double weight_kg,
        !            57:                               enum activity_level activity,
        !            58:                               enum user_gender gender);
        !            59: 
        !            60: /* Round a raw calorie value to the nearest USDA Food Pattern level
        !            61:    (200-kcal steps), clamped to the range 1000-3200.  */
        !            62: int budget_round_to_pattern (int kcal_raw);
        !            63: 
        !            64: /* Return the daily budget for a given calorie level KCAL, using the
        !            65:    USDA Healthy US-Style Eating Pattern table (Dietary Guidelines for
        !            66:    Americans, 2020-2025, Appendix 3).  Supported levels are 1000 to
        !            67:    3200 kcal.  Values between table entries are linearly
        !            68:    interpolated; values outside the range are clamped.  */
        !            69: struct daily_budget budget_for_calories (int kcal);
        !            70: 
        !            71: /* Return the standard 2,000 kcal daily budget.  */
        !            72: struct daily_budget budget_get_default (void);
        !            73: 
        !            74: /* Print a budget summary to stdout, showing CONSUMED against BUDGET.  */
        !            75: void budget_print (const struct daily_budget *budget,
        !            76:                    const struct daily_budget *consumed);
        !            77: 
        !            78: #endif /* BUDGET_H */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>