Farbflash projects: Imaging lingo table | 3-D scene list | Find all | Handler menu | Lingo message window

Ignore:
Timestamp:
03/23/09 10:16:14 (3 years ago)
Author:
alex
Message:

moved helper handlers used by svn and alex utitlies to alex_utilities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lingosource/castlib1/alexUtilities.ls

    r230 r232  
    35693569end 
    35703570 
     3571 
     3572-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3573 
     3574on mRemoveWhiteSpaces me, theText 
     3575   
     3576  if mCheckForXtra(me, "Pregex") = 1 then 
     3577     
     3578    theText = [theText] 
     3579    PRegEx_Replace(theText, "\s" , "g", "") 
     3580    return theText[1] 
     3581     
     3582  else 
     3583    whitespaces = [" ", RETURN] 
     3584    repeat with ws = count(whitespaces) down to 1 
     3585      theText = mReplaceChunk(me, theText, whitespaces[ws], "") 
     3586    end repeat 
     3587  end if 
     3588   
     3589  return theText 
     3590   
     3591end 
     3592-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3593 
     3594-- using offset() -> no pregex 
     3595on mReplaceChunk me, srcText, fromChunk, toChunk 
     3596   
     3597  stelle = offset(fromChunk, srcText) 
     3598   
     3599  if stelle then 
     3600     
     3601    len = fromChunk.length 
     3602    newtext = "" 
     3603    replText = toChunk 
     3604     
     3605    repeat while stelle 
     3606       
     3607      if stelle > 1 then put char 1 to (stelle - 1) of srcText & replText after newtext 
     3608      else put replText after newtext 
     3609       
     3610      delete char 1 to (stelle + len - 1) of srcText 
     3611       
     3612      stelle = offset(fromChunk, srcText) 
     3613       
     3614      if stelle = 0 then put srcText after newtext 
     3615       
     3616    end repeat 
     3617     
     3618  else -- no match 
     3619     
     3620    return srcText 
     3621  end if 
     3622   
     3623  return newtext 
     3624end 
     3625 
     3626-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3627 
     3628on mFindUnixAppInPath me, whichBinaryName 
     3629   
     3630  binaryPath = [] 
     3631   
     3632  binaryPath = mDoShellCmd(me, "for thisBinPath in /usr/bin /bin /usr/sbin /sbin /usr/local/sbin /usr/local/bin /opt/sbin /opt/bin /opt/local/sbin /opt/local/bin /sw/bin /sw/sbin ; do find $thisBinPath -name " & whichBinaryName & " ; done", RETURN, 0, 1) 
     3633   
     3634  if count(binaryPath) > 0 then return binaryPath[1] 
     3635   
     3636  return "" 
     3637   
     3638end 
     3639 
     3640-- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 
     3641 
     3642on getCastlibList me, selectionList, defaultCLNum 
     3643   
     3644  castlibList = 0 
     3645   
     3646  if symbolP(selectionList) then 
     3647    -- #all 
     3648    clnum = the number of castlibs 
     3649    castlibList = [] 
     3650    repeat with n = 1 to clnum 
     3651      castlibList.add(n) 
     3652    end repeat 
     3653     
     3654  else 
     3655     
     3656    selectionList = string(selectionList) 
     3657    if length(selectionList) > 0 then 
     3658       
     3659      offs = offset("'", selectionList) 
     3660      repeat while offs > 0 
     3661        put QUOTE into char offs of selectionList 
     3662        offs = offset("'", selectionList) 
     3663      end repeat 
     3664       
     3665      if char 1 of selectionList <> "[" then put "[" before selectionList 
     3666      if the last char of selectionList <> "]" then put "]" after selectionList 
     3667       
     3668      selectionList = value(selectionList) 
     3669      if listP(selectionList) then 
     3670        clnum = the number of castlibs + 1 
     3671        castlibList = [] 
     3672        selectionListCnt = count(selectionList) 
     3673        repeat with n = 1 to selectionListCnt 
     3674           
     3675          cl = castlib(selectionList[n]) 
     3676          if ilk(cl) = #castlib then 
     3677            int = cl.number 
     3678            if castlibList.getPos(int) < 1 then 
     3679              castlibList.add(int) 
     3680            end if 
     3681          else 
     3682            int = integer(selectionList[n]) 
     3683            if integerP(int) then 
     3684              if clnum > int then 
     3685                if castlibList.getPos(int) < 1 then castlibList.add(int) 
     3686              end if 
     3687            end if 
     3688          end if 
     3689        end repeat 
     3690      end if 
     3691    end if 
     3692  end if 
     3693   
     3694  if not(listP(castlibList)) then castlibList = [] 
     3695   
     3696  if count(castlibList) < 1 then 
     3697    if ilk(defaultCLNum) = #integer then 
     3698      castlibList.add(defaultCLNum) 
     3699    else if listP(defaultCLNum) then 
     3700      castlibList = defaultCLNum 
     3701    end if 
     3702  end if 
     3703   
     3704  return castlibList 
     3705end 
     3706 
Note: See TracChangeset for help on using the changeset viewer.