From 02b817b73b5aa773ede4192baf528c722af8bad4 Mon Sep 17 00:00:00 2001 From: Adrien Bertrand Date: Fri, 31 May 2013 03:29:37 +0200 Subject: [PATCH] Version 3.0 - Big changes Big changes but no new features. - Now works better for any OS 3.x ("compiled" with the then-latest Luna) - Now uses Jim's AddToGC technique to directly add functions to GC - Some overall reformatting --- BetterLuaAPI.lua | 319 ++++++++++++++++++++++++++--------------------- BetterLuaAPI.tns | Bin 3635 -> 3370 bytes README.md | 31 ++--- 3 files changed, 191 insertions(+), 159 deletions(-) diff --git a/BetterLuaAPI.lua b/BetterLuaAPI.lua index 9fa0b58..7b72327 100644 --- a/BetterLuaAPI.lua +++ b/BetterLuaAPI.lua @@ -1,191 +1,222 @@ --- BetterLuaAPI for TI-Nspire --- Version 2.2 (Aug 28th 2011) --- Adriweb 2011 -- Thanks to Jim Bauwens and Levak --- adrienbertrand@msn.com +-- BetterLuaAPI for the TI-Nspire +-- Version 3.0 (May 30th 2013) +-- Adriweb 2013 +-- http://tiplanet.org - http://inspired-lua.org + -- Put all this or some of this (be careful, though, some functions use each other) in your code and thank me ;) --- Remember to put "myGC = gc" in the on.paint(gc) function. +---------------------- +------ Utilities ----- +---------------------- + +-- Thanks John Powers (TI) ! +-- Needed if OS < 3.2 +if not platform.withGC then + function platform.withGC(f) + local gc = platform.gc() + gc:begin() + local result = { f(gc) } + gc:finish() + return unpack(result) + end +end + +-- Credits to Jim Bauwens :) +-- See http://inspired-lua.org/index.php/2013/05/how-to-add-your-own-functions-to-gc/ +-- Needed. +function AddToGC(key, func) + local gcMetatable = platform.withGC(getmetatable) + gcMetatable[key] = func +end + + +---------------------- +----- New Things ----- +---------------------- + device = { api, hasColor, isCalc, theType, lang } device.api = platform.apilevel device.hasColor = platform.isColorDisplay() device.lang = locale.name() --- See the use of that device table in the on.paint function +function on.resize(w, h) + device.isCalc = platform.window:width() < 320 + device.theType = platform.isTabletModeRendering and (platform.isTabletModeRendering() and "tablet" or "software") or (platform.isDeviceModeRendering() and "handheld" or "software") -function on.create() - on.resize() -end - -function on.resize() - device.isCalc = (platform.window:width() < 320) - device.theType = platform.isDeviceModeRendering() and "handheld" or "software" + -- put the rest of your resize code here end Color = { - ["black"] = {0, 0, 0}, - ["red"] = {0xff, 0, 0}, - ["green"] = {0, 0xff, 0}, - ["blue "] = {0, 0, 0xff}, - ["white"] = {0xff, 0xff, 0xff}, - ["brown"] = {165,42,42}, - ["cyan"] = {0,255,255}, - ["darkblue"] = {0,0,139}, - ["darkred"] = {139,0,0}, - ["fuchsia"] = {255,0,255}, - ["gold"] = {255,215,0}, - ["gray"] = {127,127,127}, - ["grey"] = {127,127,127}, - ["lightblue"] = {173,216,230}, - ["lightgreen"] = {144,238,144}, - ["magenta"] = {255,0,255}, - ["maroon"] = {128,0,0}, - ["navyblue"] = {159,175,223}, - ["orange"] = {255,165,0}, - ["palegreen"] = {152,251,152}, - ["pink"] = {255,192,203}, - ["purple"] = {128,0,128}, - ["royalblue"] = {65,105,225}, - ["salmon"] = {250,128,114}, - ["seagreen"] = {46,139,87}, - ["silver"] = {192,192,192}, - ["turquoise"] = {64,224,208}, - ["violet"] = {238,130,238}, - ["yellow"] = {255,255,0} + ["black"] = { 0, 0, 0 }, + ["red"] = { 255, 0, 0 }, + ["green"] = { 0, 255, 0 }, + ["blue "] = { 0, 0, 255 }, + ["white"] = { 255, 255, 255 }, + ["brown"] = { 165, 42, 42 }, + ["cyan"] = { 0, 255, 255 }, + ["darkblue"] = { 0, 0, 139 }, + ["darkred"] = { 139, 0, 0 }, + ["fuchsia"] = { 255, 0, 255 }, + ["gold"] = { 255, 215, 0 }, + ["gray"] = { 127, 127, 127 }, + ["grey"] = { 127, 127, 127 }, + ["lightblue"] = { 173, 216, 230 }, + ["lightgreen"] = { 144, 238, 144 }, + ["magenta"] = { 255, 0, 255 }, + ["maroon"] = { 128, 0, 0 }, + ["navyblue"] = { 159, 175, 223 }, + ["orange"] = { 255, 165, 0 }, + ["palegreen"] = { 152, 251, 152 }, + ["pink"] = { 255, 192, 203 }, + ["purple"] = { 128, 0, 128 }, + ["royalblue"] = { 65, 105, 225 }, + ["salmon"] = { 250, 128, 114 }, + ["seagreen"] = { 46, 139, 87 }, + ["silver"] = { 192, 192, 192 }, + ["turquoise"] = { 64, 224, 208 }, + ["violet"] = { 238, 130, 238 }, + ["yellow"] = { 255, 255, 0 } } -Color.mt = {__index = function () return {0,0,0} end} -setmetatable(Color,Color.mt) +Color.mt = { __index = function() return { 0, 0, 0 } end } +setmetatable(Color, Color.mt) local function copyTable(t) - local t2 = {} - for k,v in pairs(t) do - t2[k] = v - end - return t2 -end - -local function deepcopy(t) -- This function recursively copies a table's contents, and ensures that metatables are preserved. That is, it will correctly clone a pure Lua object. - if type(t) ~= 'table' then return t end - local mt = getmetatable(t) - local res = {} - for k,v in pairs(t) do - if type(v) == 'table' then - v = deepcopy(v) - end - res[k] = v - end - setmetatable(res,mt) - return res -end -- from http://snippets.luacode.org/snippets/Deep_copy_of_a_Lua_Table_2 + local t2 = {} + for k, v in pairs(t) do + t2[k] = v + end + return t2 +end + +-- This function recursively copies a table's contents, and ensures that metatables are preserved. +-- That is, it will correctly clone a pure Lua object. +-- Taken from http://snippets.luacode.org/snippets/Deep_copy_of_a_Lua_Table_2 +local function deepcopy(t) + if type(t) ~= 'table' then return t end + local mt = getmetatable(t) + local res = {} + for k, v in pairs(t) do + if type(v) == 'table' then + v = deepcopy(v) + end + res[k] = v + end + setmetatable(res, mt) + return res +end local function test(arg) - return arg and 1 or 0 + return arg and 1 or 0 end -local function screenRefresh() - return platform.window:invalidate() -end +local function screenRefresh() return platform.window:invalidate() end +local function pww() return platform.window:width() end +local function pwh() return platform.window:height() end -local function pww() - return platform.window:width() +local function drawPoint(gc, x, y) + gc:fillRect(x, y, 1, 1) end -local function pwh() - return platform.window:height() +local function drawCircle(gc, x, y, diameter) + gc:drawArc(x - diameter / 2, y - diameter / 2, diameter, diameter, 0, 360) end -local function drawPoint(x, y) - myGC:fillRect(x, y, 1, 1) +local function drawCenteredString(gc, str) + gc:drawString(str, (platform.window:width() - gc:getStringWidth(str)) / 2, platform.window:height() / 2, "middle") end -local function drawCircle(x, y, diameter) - myGC:drawArc(x - diameter/2, y - diameter/2, diameter,diameter,0,360) +local function drawXCenteredString(gc, str, y) + gc:drawString(str, (platform.window:width() - gc:getStringWidth(str)) / 2, y, "top") end -local function drawCenteredString(str) - myGC:drawString(str, (pww() - myGC:getStringWidth(str)) / 2, pwh() / 2, "middle") +local function setColor(gc, theColor) + if type(theColor) == "string" then + theColor = theColor:lower() + if type(Color[theColor]) == "table" then gc:setColorRGB(unpack(Color[theColor])) end + elseif type(theColor) == "table" then + gc:setColorRGB(unpack(theColor)) + end end -local function drawXCenteredString(str,y) - myGC:drawString(str, (pww() - myGC:getStringWidth(str)) / 2, y, "top") +local function verticalBar(gc, x) + gc:fillRect(x, 0, 1, platform.window:height()) end -local function setColor(theColor) - if type(theColor) == "string" then - theColor = string.lower(theColor) - if type(Color[theColor]) == "table" then myGC:setColorRGB(unpack(Color[theColor])) end - elseif type(theColor) == "table" then - myGC:setColorRGB(unpack(theColor)) - end +local function horizontalBar(gc, y) + gc:fillRect(0, y, platform.window:width(), 1) end -local function verticalBar(x) - myGC:fillRect(x,0,1,platform.window:height()) +local function drawSquare(gc, x, y, l) + gc:drawPolyLine({ (x - l / 2), (y - l / 2), (x + l / 2), (y - l / 2), (x + l / 2), (y + l / 2), (x - l / 2), (y + l / 2), (x - l / 2), (y - l / 2) }) end -local function horizontalBar(y) - myGC:fillRect(0,y,platform.window:width(),1) +local function drawRoundRect(gc, x, y, wd, ht, rd) -- wd = width, ht = height, rd = radius of the rounded corner + local x = x - wd / 2 -- let the center of the square be the origin (x coord) + local y = y - ht / 2 -- same for y coord + if rd > ht / 2 then rd = ht / 2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max rd) + gc:drawLine(x + rd, y, x + wd - (rd), y) + gc:drawArc(x + wd - (rd * 2), y + ht - (rd * 2), rd * 2, rd * 2, 270, 90) + gc:drawLine(x + wd, y + rd, x + wd, y + ht - (rd)) + gc:drawArc(x + wd - (rd * 2), y, rd * 2, rd * 2, 0, 90) + gc:drawLine(x + wd - (rd), y + ht, x + rd, y + ht) + gc:drawArc(x, y, rd * 2, rd * 2, 90, 90) + gc:drawLine(x, y + ht - (rd), x, y + rd) + gc:drawArc(x, y + ht - (rd * 2), rd * 2, rd * 2, 180, 90) end -local function drawSquare(x,y,l) - myGC:drawPolyLine({(x-l/2),(y-l/2), (x+l/2),(y-l/2), (x+l/2),(y+l/2), (x-l/2),(y+l/2), (x-l/2),(y-l/2)}) +local function fillRoundRect(gc, x, y, wd, ht, radius) -- wd = width and ht = height -- renders badly when transparency (alpha) is not at maximum >< will re-code later + if radius > ht / 2 then radius = ht / 2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max radius) + gc:fillPolygon({ (x - wd / 2), (y - ht / 2 + radius), (x + wd / 2), (y - ht / 2 + radius), (x + wd / 2), (y + ht / 2 - radius), (x - wd / 2), (y + ht / 2 - radius), (x - wd / 2), (y - ht / 2 + radius) }) + gc:fillPolygon({ (x - wd / 2 - radius + 1), (y - ht / 2), (x + wd / 2 - radius + 1), (y - ht / 2), (x + wd / 2 - radius + 1), (y + ht / 2), (x - wd / 2 + radius), (y + ht / 2), (x - wd / 2 + radius), (y - ht / 2) }) + local x = x - wd / 2 -- let the center of the square be the origin (x coord) + local y = y - ht / 2 -- same + gc:fillArc(x + wd - (radius * 2), y + ht - (radius * 2), radius * 2, radius * 2, 1, -91) + gc:fillArc(x + wd - (radius * 2), y, radius * 2, radius * 2, -2, 91) + gc:fillArc(x, y, radius * 2, radius * 2, 85, 95) + gc:fillArc(x, y + ht - (radius * 2), radius * 2, radius * 2, 180, 95) end -local function drawRoundRect(x,y,wd,ht,rd) -- wd = width, ht = height, rd = radius of the rounded corner - x = x-wd/2 -- let the center of the square be the origin (x coord) - y = y-ht/2 -- same for y coord - if rd > ht/2 then rd = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max rd) - myGC:drawLine(x + rd, y, x + wd - (rd), y); - myGC:drawArc(x + wd - (rd*2), y + ht - (rd*2), rd*2, rd*2, 270, 90); - myGC:drawLine(x + wd, y + rd, x + wd, y + ht - (rd)); - myGC:drawArc(x + wd - (rd*2), y, rd*2, rd*2,0,90); - myGC:drawLine(x + wd - (rd), y + ht, x + rd, y + ht); - myGC:drawArc(x, y, rd*2, rd*2, 90, 90); - myGC:drawLine(x, y + ht - (rd), x, y + rd); - myGC:drawArc(x, y + ht - (rd*2), rd*2, rd*2, 180, 90); +local function clearWindow(gc, theColor) + gc:setColor(theColor) -- will handle both strings like "red" and direct colors like {255,0,0} + gc:fillRect(0, 0, platform.window:width(), platform.window:height()) end -local function fillRoundRect(x,y,wd,ht,radius) -- wd = width and ht = height -- renders badly when transparency (alpha) is not at maximum >< will re-code later - if radius > ht/2 then radius = ht/2 end -- avoid drawing cool but unexpected shapes. This will draw a circle (max radius) - myGC:fillPolygon({(x-wd/2),(y-ht/2+radius), (x+wd/2),(y-ht/2+radius), (x+wd/2),(y+ht/2-radius), (x-wd/2),(y+ht/2-radius), (x-wd/2),(y-ht/2+radius)}) - myGC:fillPolygon({(x-wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y-ht/2), (x+wd/2-radius+1),(y+ht/2), (x-wd/2+radius),(y+ht/2), (x-wd/2+radius),(y-ht/2)}) - x = x-wd/2 -- let the center of the square be the origin (x coord) - y = y-ht/2 -- same - myGC:fillArc(x + wd - (radius*2), y + ht - (radius*2), radius*2, radius*2, 1, -91); - myGC:fillArc(x + wd - (radius*2), y, radius*2, radius*2,-2,91); - myGC:fillArc(x, y, radius*2, radius*2, 85, 95); - myGC:fillArc(x, y + ht - (radius*2), radius*2, radius*2, 180, 95); -end -local function drawLinearGradient(color1,color2) - -- syntax would be : color1 and color2 as {r,g,b}. - -- don't really know how to do that. probably converting to hue/saturation/light mode and change the hue. - -- todo with unpack(color1) and unpack(color2) -end +----------------------------------------- +------ Adding the functions to gc ------- +----------------------------------------- +AddToGC("setColor", setColor) +AddToGC("drawPoint", drawPoint) +AddToGC("drawCircle", drawCircle) +AddToGC("drawSquare", drawSquare) +AddToGC("drawRoundRect", drawRoundRect) +AddToGC("fillRoundRect", fillRoundRect) +AddToGC("verticalBar", verticalBar) +AddToGC("horizontalBar", horizontalBar) +AddToGC("drawCenteredString", drawCenteredString) +AddToGC("drawXCenteredString", drawXCenteredString) +AddToGC("clearWindow", clearWindow) -local function clearWindow(theColor) - setColor(theColor) -- will handle both strings like "red" and direct colors like {255,0,0} - myGC:fillRect(0, 0, platform.window:width(), platform.window:height()) -end +---------------------- +------ Testing ------- +---------------------- function on.paint(gc) - myGC = gc -- very important line ! - setColor("red") -- is the same as gc:setColorRGB(unpack(Color["red"])) or setColor({255,0,0}) - drawPoint(50,50) - drawCircle(150,50,20) - drawSquare(200,60,30) - drawRoundRect(200,160,51,51,10) - fillRoundRect(100,160,100,75,20) - verticalBar(20) - horizontalBar(40) - setColor("black") - local isCalcCX = device.hasColor and "a CX." or "not a CX." - drawXCenteredString("You are on the " .. device.theType .. ", and it's " .. isCalcCX, 50) - drawCenteredString("hello world - Centered String") - drawXCenteredString("X-Centered String - Adriweb here \\o/",0.75*pwh()) --- screenRefresh() --- clearWindow({0, 0, 255}) - will fill the screen with the given color. Here, blue. -end - ---------------- End of BetterLuaAPI + gc:setColor("red") -- is the same as gc:setColorRGB(unpack(Color["red"])) or setColor({255,0,0}) + gc:drawPoint(50, 50) + gc:drawCircle(150, 50, 20) + gc:drawSquare(200, 60, 30) + gc:drawRoundRect(200, 160, 51, 51, 10) + gc:fillRoundRect(100, 160, 100, 75, 20) + gc:verticalBar(20) + gc:horizontalBar(40) + gc:setColor("black") + local isCalcCX = device.hasColor and "a CX" or "not a CX" + gc:drawXCenteredString("You are on the " .. device.theType .. ", and it's " .. isCalcCX .. " (" .. device.lang .. ").", 50) + gc:drawCenteredString("hello world - Centered String") + gc:drawXCenteredString("X-Centered String - Adriweb here \\o/", 0.75 * platform.window:height()) + -- screenRefresh() + -- clearWindow({0, 0, 255}) - will fill the screen with the given color. Here, blue. +end diff --git a/BetterLuaAPI.tns b/BetterLuaAPI.tns index 029cf5b9e7c872d56fb8092b4f63bf14dbc6bbdf..09f69cb45f13dd22da636797bc76ed9588d5afae 100644 GIT binary patch literal 3370 zcmZvfXD}Q9w}vRkweAPH9Qy%USOHfmNUBJApI_0@Y>y(NO^OO%Kjz1OU=Bzh+V z(Gn4EGWW-qZ|0se@0>Gp=KOhoy$_$^6Fpssu!OKMJpcfp_#=)#0sw^X{GZ7G?CP#| z-iYTeUV?rIIMu{F7DW^V)6wals9^j)%T_Mr0^s_7++9lKs~23_C3|e{)mo`;J#M<~ zhEu-CXIeZ?_w5{6zQh9#+tyheaa|cm6{1qL*TVHMBqE@x=?#!|6!yKs=ZKcFxSuL=mHY~W z1O(E?=m)8U-guxNNAH>&d)z)|Oi+cz=apee5YySWsTHqI)5--|>nog{RxTz$3``R) zUH_AtPr1UJ2)cUtng+{3yNaYI(6>z{<-6$%#wls&HhLVVCpA}Gp&z~-} z^599Tm1|CvQ?O$Z*UW=XaaiAll_|_qjDy6?v z37nj)W*c$c71Jpvl2VSl#pd4zhBw~e@+?3{KN@1wqVYGoKI0`ngmA?bF|ElPkj)ud zad~PiMJ^|nqdrhQ8^I^BltDH#$x4-8dq*ln7z@v9+S;pTC^!-9Xk;@HZ-iSvOYLo_ znTm_w>iHB=66zMt4JBwX+)N7DNpWE{8|tu2BH7>mnnG%~5Ra_2-aIN)i3ZJ2(791{ z{qz}rVxCy?>`hyc+R-)L%%MA|$N-j5la#s@_aRd6`D(`2fuUunPuku7$s2PVEdql* zZZ3F(KM_vNL^T95=#kH}Af=@B4Jn<}4?LnCTQ-nbkPFy};tA59)4_WRmQ2FO4{mY} zFT=-k_w!$rS^g%1<&LuShBe3Ve1PCM<9zOcPK15em7wVL2c1D6QG!~wO#0B^QGHeh(e`-K zg&zcJ>ggaxZ}GtTnD#Qv?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zTCm^UVS?9KAMMPaq_vdc7*4Z+n4&qc!1yB0x6PwyKK#SOLF zuprlGL>lT>IU*y2-; zR3`<$do_0&HAe9@;JD%$6ZG!Sq!Gh1=(Eigr*hKInr2?~!S)0uNeB`%5#VmidBl7Y zDZj`OGo@%?v?+8-P8@G*(rcWmn@n!aR+!U!Q{((P|i)$NhiTkMcrqR{G>f_%XKkY@4-Vs;YS9XuV2Z(u<)bhfqFv) zxJ(WaKbHRbYS1?lth=G$Fg51gfnIvPVylGfCx+7r*C{0aE;d!W-bh-IQM{-jqmIgoul7*1+)@j=%PK z)*EDP7QtqFt#$Y;SO%9d!x%VZOHrp!7FK{|h}vq#FPG!;7&#S}!M^$YeM%9L*?`Fo zLWYX#nZh6w~a=YTMrVBhF4)AE%U8TYaf z8woB^wcf4gwBr%EmAOlo;kD{AV$FMoqgf=vM0~W8`j<Dy{7AZy(u*l#=1OA2!ur z_PjqS(T;1kzA}SX(UQddswq|IJ#PHOpP0?$CRI|kZT|rz@PzIzJFikoc~|I$a6OA^^(1k8 zUU`+<5y{mFe{Yo}OLnh+U8hsjOnp8Q@y`B-UW4O2jcI~XD1=!YwAUC^Tz;MG>=LCSVb{<;JI~^iWNmI$J6fyerN2e*cxpxLl4zKmJzzAA1$|akuN2_B@PjHw4Iss>_Znv7qvH|l+*Zw584>L_eLIX z&Z+AGByjHs4hwYREG)7iuMADEoug|VJPUa`1HGpoPi@4@4kz<1%HplBloF|BzmFlW zhGQ$vSp6Q4_+E0VQ&nGkgfZ6~$AUN8W2vS%2Y?4|(8tgTe>Q1hD@tf9l`J_Fw0Jx#REuf1Id4(D!c&d8mz0|NBbx Nr@jAZ3H9I8{{UVEw%q^# diff --git a/README.md b/README.md index e915078..6c75518 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,38 @@ # BetterLuaAPI for TI-Nspire. ### Made by Adrien "Adriweb" Bertrand. +### Thanks to Jim Bauwens, John Powers, Levak ## How to use : Copy in your code the functions you want and start using them, that's all ! :-) -Please also write in your code/readme something like "[a part of] BetterLuaAPI was used"... -Since this is all written in Nspire-Lua so it requires that you have the OS 3.0 (or later) on your calculator. +Please also write in your code/readme something like "[a part of] BetterLuaAPI by Adriweb was used"... +Since this is all written in Nspire-Lua, it requires you to run the OS any OS 3.x on your calculator. The latest OS updates are available on [TI's Website](http://education.ti.com). ## New functions/things brought by BetterLuaAPI : * __device__ table : informations about the user's device (apiversion ? , hasColor ? , isCalc ? , type of calc ? , current language ? )- -* __Colors table__ (see _setColor(...)_) +* __Colors table__ (can be used for _setColor_) * __copyTable(table)__ (copies a table into another) * __deepcopy(table)__ (deep-copies a table into another) * __test(arg)__ (returns 1 if _arg_ true or 0 if _arg_ false) * __screenRefresh()__ same as _platform.window:invalidate()_ but shorter * __pww()__ same as _platform.window:width()_ but shorter * __pwh()__ same as _platform.window:height()_ but shorter -* __drawPoint(x, y)__ -* __drawCircle(x, y, diameter)__ -* __drawCenteredString(str)__ -* __drawXCenteredString(str,y)__ -* __setColor(theColor)__ -* __verticalBar(x)__ -* __horizontalBar(y)__ -* __drawSquare(x,y,l)__ -* __drawRoundRect(x,y,width,height,radius)__ -* __fillRoundRect(x,y,wd,ht,radius)__ -* __clearWindow(theColor)__ +* __gc:drawPoint(x, y)__ +* __gc:drawCircle(x, y, diameter)__ +* __gc:drawCenteredString(str)__ +* __gc:drawXCenteredString(str,y)__ +* __gc:setColor(theColor)__ (string or table of RGB) +* __gc:verticalBar(x)__ +* __gc:horizontalBar(y)__ +* __gc:drawSquare(x,y,l)__ +* __gc:drawRoundRect(x,y,width,height,radius)__ +* __gc:fillRoundRect(x,y,wd,ht,radius)__ +* __gc:clearWindow(theColor)__ ## Notes : -More information about Lua programming on the TI-Nspire : [Inspired-Lua](http://www.inspired-lua.org) +More information about Lua programming on the TI-Nspire : [Inspired-Lua](http://www.inspired-lua.org) and TI Calculators in general : [TI-Planet.org](http://tiplanet.org) __Contact : adrienbertrand @ msn . com__