00001 /* 00002 PROJETO USPDesigner 00003 MODULO: HIE (Estrutura Hierarquica) 00004 Copyright (C) 1989 a 2008, Marcos Tsuzuki, All rights reserved 00005 Universidade de Sao Paulo, EPUSP-PMR 00006 00007 NOME DO ARQUIVO: hieaxsmn.cpp 00008 Coded by Marcos Tsuzuki 00009 00010 Redistribution and use in source and binary forms, with or without 00011 modification, are permitted provided that the following conditions 00012 are met: 00013 00014 1. Redistributions of source code must retain the above copyright 00015 notice, this list of conditions and the following disclaimer. 00016 00017 2. Redistributions in binary form must reproduce the above copyright 00018 notice, this list of conditions and the following disclaimer in the 00019 documentation and/or other materials provided with the distribution. 00020 00021 3. The names of its contributors may not be used to endorse or promote 00022 products derived from this software without specific prior written 00023 permission. 00024 00025 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00028 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 00029 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 00037 00038 Any feedback is very welcome. 00039 email: mtsuzuki at usp.br (remove space) 00040 */ 00041 #include <stdio.h> 00042 #include <string.h> 00043 #include "memvirtu.h" 00044 #include "lowparam.h" 00045 #include "lowmacro.h" 00046 #include "lowsolid.h" 00047 #include "vectorop.h" 00048 #include "hiegroup.h" 00049 00050 Id MSD_getAxisIdFromName(char *name) 00051 { 00052 APTYPE a; 00053 00054 for (AllAxis(a)) 00055 { 00056 if (!strcmp(name, AxsName(a))) 00057 { 00058 return(AxsAxisNo(a)); 00059 } 00060 } 00061 return((Id) - 1); 00062 } 00063 00064 Id MSD_getMaxAxisId(void) 00065 { 00066 APTYPE aptr; 00067 Id an; 00068 00069 if (axsary == ANIL) 00070 { 00071 return(1); 00072 } 00073 an = AxsAxisNo(axsary); 00074 for (AllAxis(aptr)) 00075 { 00076 if (AxsAxisNo(aptr) > an) 00077 { 00078 an = AxsAxisNo(aptr); 00079 } 00080 } 00081 return(an + 1); 00082 } 00083 00084 int MSD_getNumberOfAxis(void) 00085 { 00086 APTYPE aptr; 00087 int i = 0; 00088 00089 for (AllAxis(aptr)) 00090 { 00091 i++; 00092 } 00093 return(i); 00094 } 00095 00096 char **MSD_putAxisNameInList(char **list) 00097 { 00098 APTYPE aptr; 00099 int i = 0; 00100 00101 for (AllAxis(aptr)) 00102 { 00103 list[i] = AxsName(aptr); 00104 i++; 00105 } 00106 return(list); 00107 } 00108 00109 APTYPE MSD_lowFindAxisByName(char *nam) 00110 { 00111 APTYPE aptr; 00112 00113 for (AllAxis(aptr)) 00114 { 00115 if (!strcmp(nam, AxsName(aptr))) 00116 { 00117 return(aptr); 00118 } 00119 } 00120 return(ANIL); 00121 } 00122 00123 APTYPE MSD_getAxis(Id an) 00124 { 00125 APTYPE aptr; 00126 00127 for (AllAxis(aptr)) 00128 { 00129 if (AxsAxisNo(aptr) == an) 00130 { 00131 return(aptr); 00132 } 00133 } 00134 return(ANIL); 00135 }