% % decode baby info from comma-separated lines % % if starting with capital letter is baby name % has #lb or # lb is weight line % has #in or # in is length line % has : is birth date/time % % stack: raw-data % ":" found? { % % is birth date/time % dup isdate % % stack: raw-data is-date % { "BabyDate" *babydset } { pop } ifelse } { dup lower "m" eq$ { lower "BabyGender" *babydset } { dup lower "f" eq$ { lower "BabyGender" *babydset } { dup 1 left isupper { % % this is the baby name % "BabyName" *babydset } { dup 1 left numeric { 0 !BabyOzs 0 !BabyIns false !Bweight false !Blength digits % % stack: digs right-of % exch !val % % check for - in - lb - ft - feet - inches - oz - ounce - pound % trim " " slice exch *babyvals % % stack: right-of-units % trim % % stack: % any? { % % there is a second parameter in the line % dup 1 atleft numeric { digits exch !val trim *babyvals } { pop } ifelse } { % % there is no second parameter % } ifelse _Bweight { % % set the baby weight line % _BabyOzs 16 divmod &" ozs" exch &" lbs " ^ "BabyWeight" *babydset } { _Blength { _BabyIns &" inches" "BabyLength" *babydset } { } ifelse } ifelse } { % % not numeric % pop } ifelse } ifelse } ifelse } ifelse } ifelse % % stack: %