00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 OGMATlcat(p, q){
00039 if p==nil
00040 then
00041 q
00042 else let p -> [h nxt] in
00043 h::OGMATlcat nxt q;
00044 }
00045
00046
00047 OGMATfindResourcePath(file, lpaths){
00048 if file == nil then nil else
00049 if (_checkpack file) != nil then
00050 file
00051 else
00052 let getPathFile file "" -> [_ file] in
00053 let sizelist lpaths -> size in
00054 let nil -> goodpath in
00055 let 0 -> i in
00056 (
00057 while i < size && goodpath == nil do
00058 (
00059 let nth_list lpaths i -> path in
00060 (
00061 let if (!strcmp "/" (substr path ((strlen path) - 1) 1)) then path else (strcat path "/") -> path in
00062 if (_checkpack strcat path file) == nil then nil else
00063 set goodpath = strcat path file;
00064 );
00065 set i = i + 1;
00066 );
00067 goodpath;
00068 );
00069 }
00070
00071
00072 strcatLine(l){
00073 let sizelist l -> size in
00074 let "" -> line in
00075 let 0 -> i in
00076 (
00077 while i < size do
00078 (
00079 let nth_list l i -> word in
00080 if i == 0 then
00081 set line = word
00082 else
00083 set line = strcatn line::" "::word::nil;
00084
00085 set i = i + 1;
00086 );
00087 line;
00088 );
00089 }
00090
00091
00092 strBuildWithTabs(l){
00093 let sizelist l -> size in
00094 let "" -> string in
00095 let 0 -> i in
00096 (
00097 while i < size do
00098 (
00099 let nth_list l i -> line in
00100 if i == 0 then
00101 set string = strcatLine line
00102 else
00103 set string = strcatn string::(ctoa 13)::(ctoa 10)::(strcatLine line)::nil;
00104 set i = i + 1;
00105 );
00106 string;
00107 );
00108 }
00109
00110
00111 OGMATsetResourcesPath(file, lpaths){
00112 let _checkpack file -> pfile in
00113 if pfile == nil then
00114 (
00115 _fooS strcat "OGRE MATERIAL PARSER ERROR : file not found > " file;
00116 nil;
00117 )
00118 else
00119 (
00120 let nil -> baddata in
00121 let strextr _getpack pfile -> lcont in
00122 (
00123 let sizelist lcont -> size in
00124 let 0 -> i in
00125
00126 while i < size do
00127 (
00128 let nth_list lcont i -> line in
00129 (
00130
00131
00132 if (!isLastWordfromString "texture" (hd line))
00133 && (!isLastWordfromString "cubic_texture" (hd line))
00134 && (!isLastWordfromString "source" (hd line))
00135 then nil else
00136 (
00137 if (isLastWordfromString "cubic_texture" (hd line)) || (isLastWordfromString "anim_texture" (hd line)) then
00138 (
00139 let sizelist (tl line) -> size2 in
00140 let 1 -> i2 in
00141 while i2 < size2 do
00142 (
00143 let endlist line i2 -> cubelist in
00144 let hd cubelist -> cubefile in
00145 if (atoi cubefile) > 0 then nil else
00146 if ((_checkpack cubefile) != nil) || ((getFileExt cubefile) == nil) then nil else
00147 (
00148 let OGMATfindResourcePath cubefile lpaths -> goodcubepath in
00149 if goodcubepath == nil then
00150 (
00151 set baddata = [i cubefile]::baddata;
00152 0;
00153 )
00154 else
00155 (
00156 mutate cubelist <- [goodcubepath _];
00157 0;
00158 );
00159 );
00160 set i2 = i2 + 1;
00161 );
00162 )
00163 else if ((_checkpack (hd tl line)) != nil) || ((getFileExt (hd tl line)) == nil) then nil else
00164 (
00165 let tl line -> chtup in
00166 let OGMATfindResourcePath (hd chtup) lpaths -> goodpath in
00167 if goodpath == nil then
00168 (
00169 set baddata = [i (hd chtup)]::baddata;
00170 0;
00171 )
00172 else
00173 (
00174 mutate chtup <- [goodpath _];
00175 0;
00176 );
00177 0;
00178 );
00179 );
00180 );
00181 set i = i + 1;
00182 );
00183 _storepack (strBuildWithTabs lcont) file;
00184 baddata;
00185 );
00186 );
00187 }
00188
00189
00190 OGMATgetResources(file){
00191 let _checkpack file -> pfile in
00192 if pfile == nil then
00193 (
00194 _fooS strcat "OGRE MATERIAL PARSER ERROR : file not found > " file;
00195 nil;
00196 )
00197 else
00198 (
00199 let strextr _getpack pfile -> lcont in
00200 let sizelist lcont -> size in
00201 let 1 -> ret in
00202 let nil -> ndata in
00203 let nil -> baddata in
00204 let 0 -> i in
00205 (
00206 while i < size do
00207 (
00208 let nth_list lcont i -> line in
00209 (
00210
00211
00212 if (!isLastWordfromString "texture" (hd line))
00213 && (!isLastWordfromString "cubic_texture" (hd line))
00214 && (!isLastWordfromString "source" (hd line))
00215 then nil else
00216 (
00217 if (isLastWordfromString "cubic_texture" (hd line)) || (isLastWordfromString "anim_texture" (hd line)) then
00218 (
00219 let sizelist (tl line) -> size2 in
00220 let 1 -> i2 in
00221 while i2 < size2 do
00222 (
00223 let nth_list line i2 -> cubefile in
00224 (
00225 if ((_checkpack cubefile) != nil) || ((atoi cubefile) > 0) then
00226 (
00227 set ndata = [1 cubefile]::ndata;
00228 0;
00229 )
00230 else if (getFileExt cubefile) == nil then nil else
00231 (
00232 set baddata = [i cubefile]::baddata;
00233 set ret = 0;
00234 0;
00235 );
00236 );
00237 set i2 = i2 + 1;
00238 );
00239 )
00240 else if (_checkpack (hd tl line)) != nil then
00241 (
00242 set ndata = [(if (!strcmpi "source" hd line) then 0 else 1) (hd tl line)]::ndata;
00243 0;
00244 )
00245 else if (getFileExt (hd tl line)) == nil then nil else
00246 (
00247 set baddata = [i (hd tl line)]::baddata;
00248 set ret = 0;
00249 0;
00250 );
00251 );
00252 );
00253 set i = i + 1;
00254 );
00255 [ret ndata baddata];
00256 );
00257 );
00258 }
00259
00260