#!/usr/bin/mumps #+ Copyright (C) 2022 by Kevin C. O'Kane #+ #+ Kevin C. O'Kane, Ph.D. #+ Professor Emeritus #+ Computer Science Department #+ University of Northern Iowa #+ Cedar Falls, IA 50614-0507 #+ kc.okane@gmail.com #+ https://threadsafebooks.com/ #+ https://www.cs.uni.edu/~okane/ #+ #+ This program is free software; you can redistribute it and/or modify #+ it under the terms of the GNU General Public License as published by #+ the Free Software Foundation; either version 2 of the License, or #+ (at your option) any later version. #+ #+ This program is distributed in the hope that it will be useful, #+ but WITHOUT ANY WARRANTY; without even the implied warranty of #+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #+ GNU General Public License for more details. #+ #+ You should have received a copy of the GNU General Public License #+ along with this program; if not, write to the Free Software #+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #+ kill ^mesh open 1:"mtrees2003.txt,old" if '$test write "mtrees2003.txt not found",! halt for do . use 1 . read a . if '$test break . set key=$piece(a,";",1) // text description . set code=$piece(a,";",2) // everything else . if key=""!(code="") break . for i=1:1 do .. set x(i)=$piece(code,".",i) // extract code numbers .. if x(i)="" break . set i=i-1 . use 5 . set z="^mesh(" // begin building a global reference #----------------------------------------------------------------------- # build a reference like ^mesh("A01","047","025","600) # by concatenating quotes, codes, quotes, and commas onto z #----------------------------------------------------------------------- . for j=1:1:i-1 set z=z_""""_x(j)_"""," . set z="set "_z_""""_x(i)_""")="""_key_"""" #----------------------------------------------------------------------- # z now looks like: # set ^mesh("A01","047")="Abdomen" # now execute the text in z #----------------------------------------------------------------------- # . write z,! . xecute z close 1 use 5 write "done",! quit