home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / DEMO / PRG / CIRCLES.ZIP / CI_MAIN.DIX / 00023_FUTIL.ls < prev    next >
Encoding:
Text File  |  1995-05-01  |  10.7 KB  |  453 lines

  1. on filelist_get paths, ext
  2.   global l_fold, l_file, mix_err, mix_fn1, mix_fnO, sndobj
  3.   put "filelist_get paths>" & paths & " ext>" & ext
  4.   if the machineType = 256 then
  5.     repeat with i = 1 to the maxinteger
  6.       if i = 1 then
  7.         set mix_fn1 to paths
  8.         sndobj(mGetfn)
  9.         if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  10.           exit repeat
  11.         end if
  12.         if mix_err = "FILE" then
  13.           append(l_file, "S " & mix_fnO)
  14.         end if
  15.       end if
  16.       sndobj(mNextfn)
  17.       if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  18.         exit repeat
  19.       end if
  20.       if mix_err = "FILE" then
  21.         append(l_file, "S " & mix_fnO)
  22.       end if
  23.     end repeat
  24.   else
  25.     repeat with i = 1 to the maxinteger
  26.       if ext = "TEXT" then
  27.         set creat to "CIEL"
  28.       else
  29.         set creat to EMPTY
  30.       end if
  31.       set err to sndobj(mGetDirEntry, i - 1, trimdb(paths), ext, creat)
  32.       set lfn to sndobj(mReadFName1)
  33.       set ldir to sndobj(mReadVolume2)
  34.       if err <> 0 then
  35.         exit repeat
  36.       end if
  37.       if ldir = 0 then
  38.         append(l_file, "S " & trim(lfn))
  39.       end if
  40.     end repeat
  41.   end if
  42.   sort(l_file)
  43. end
  44.  
  45. on dirlist_get paths
  46.   global l_fold, l_file, mix_err, mix_fn1, mix_fnO, sndobj, v_frompath, fl_search, up_load, up_cload, up_save, up_csave
  47.   put "dir_list fl_search>" & fl_search
  48.   if fl_search = "CIRCLE" then
  49.     set up_l to up_cload
  50.   else
  51.     if fl_search = "SOUND" then
  52.       set up_l to up_load
  53.     else
  54.       if fl_search = "PATH" then
  55.         set up_l to up_save
  56.       else
  57.         if fl_search = "PATHC" then
  58.           set up_l to up_csave
  59.         end if
  60.       end if
  61.     end if
  62.   end if
  63.   if the machineType = 256 then
  64.     repeat with i = 1 to the maxinteger
  65.       if i = 1 then
  66.         set mix_fn1 to paths
  67.         sndobj(mGetfn)
  68.         if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  69.           exit repeat
  70.         end if
  71.         if mix_err = "DIR" then
  72.           if not (mix_fnO = ".") and not (mix_fnO = "..") then
  73.             append(l_fold, up_l & mix_fnO & "\")
  74.           end if
  75.         end if
  76.       end if
  77.       sndobj(mNextfn)
  78.       if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  79.         exit repeat
  80.       end if
  81.       if mix_err = "DIR" then
  82.         if not (mix_fnO = ".") and not (mix_fnO = "..") then
  83.           append(l_fold, up_l & mix_fnO & "\")
  84.         end if
  85.       end if
  86.     end repeat
  87.     sort(l_fold)
  88.     set insat to count(l_fold)
  89.     repeat with i = 1 to the maxinteger
  90.       set tmppath to frompath(up_l, i + 1)
  91.       if tmppath = EMPTY then
  92.         exit repeat
  93.         next repeat
  94.       end if
  95.       addAt(l_fold, insat + 1, tmppath)
  96.     end repeat
  97.   else
  98.     repeat with i = 1 to the maxinteger
  99.       set err to sndobj(mGetDirEntry, i - 1, trimdb(paths), "AIFF", EMPTY)
  100.       set lfn to sndobj(mReadFName1)
  101.       set ldir to sndobj(mReadVolume2)
  102.       if err <> 0 then
  103.         exit repeat
  104.       end if
  105.       if ldir <> 0 then
  106.         if not (length(trim(lfn)) = 0) then
  107.           append(l_fold, paths & trim(lfn) & ":")
  108.         end if
  109.       end if
  110.     end repeat
  111.     sort(l_fold)
  112.     set insat to count(l_fold)
  113.     repeat with i = 1 to the maxinteger
  114.       set tmppath to frompath(up_l, i + 1)
  115.       if tmppath = EMPTY then
  116.         exit repeat
  117.         next repeat
  118.       end if
  119.       addAt(l_fold, insat + 1, tmppath)
  120.     end repeat
  121.   end if
  122.   set j to count(l_file)
  123.   repeat with i = 1 to count(l_fold)
  124.     set j to j + 1
  125.     setAt(l_file, j, "D " & ex_dir(trim(getAt(l_fold, i))))
  126.   end repeat
  127. end
  128.  
  129. on drivelist_get paths
  130.   global l_fold, l_file, l_drive, mix_err, mix_fn1, mix_fnO, sndobj, v_frompath, fl_search, up_lang
  131.   if the machineType = 256 then
  132.     set ac_drive to chars(paths, 1, 1)
  133.     repeat with i = 26 down to 1
  134.       set mix_fn1 to paths
  135.       sndobj(mDrives, i)
  136.       if not (value(word 2 of stripcrtlchars(mix_fnO)) = 11) then
  137.         append(l_drive, numToChar(i + 64) & ":\")
  138.       end if
  139.     end repeat
  140.   else
  141.     set ac_drive to chars(paths, 1, 1)
  142.     repeat with i = 1 to 10
  143.       set tmpstr to EMPTY
  144.       set tmpstr2 to EMPTY
  145.       if i = 1 then
  146.         set tmpstr2 to sndobj(mGetDrives, 1)
  147.       else
  148.         set tmpstr2 to sndobj(mGetDrives, 0)
  149.       end if
  150.       set tmpstr to macstripcrtlchars(tmpstr2)
  151.       if chars(tmpstr, 1, 6) = ":EMPTY" then
  152.         exit repeat
  153.       end if
  154.       append(l_drive, tmpstr & ":")
  155.     end repeat
  156.   end if
  157.   set j to count(l_file)
  158.   repeat with i = 1 to count(l_drive)
  159.     set j to j + 1
  160.     setAt(l_file, j, "F " & getAt(l_drive, i))
  161.   end repeat
  162.   if the machineType <> 256 then
  163.     if check_CD() then
  164.       if up_lang = 1 then
  165.         setAt(l_file, j + 1, "C Eject CD-ROM")
  166.       else
  167.         setAt(l_file, j + 1, "C CD-ROM Auswerfen")
  168.       end if
  169.     end if
  170.   end if
  171. end
  172.  
  173. on f_list start
  174.   global l_fold, l_file, l_disp, scrollstep, up_cload, up_load, up_save, up_csave, fl_search
  175.   set l_disp to []
  176.   put "f_list fl_search>" & fl_search
  177.   if fl_search = "CIRCLE" then
  178.     set up_l to up_cload
  179.   else
  180.     if fl_search = "SOUND" then
  181.       set up_l to up_load
  182.     else
  183.       if fl_search = "PATH" then
  184.         set up_l to up_save
  185.       else
  186.         if fl_search = "PATHC" then
  187.           set up_l to up_csave
  188.         end if
  189.       end if
  190.     end if
  191.   end if
  192.   put "f_list up_l>" & up_l
  193.   set s to up_l & RETURN & RETURN
  194.   set didx to 1
  195.   set fl_mx to count(l_file)
  196.   repeat with i = start + 1 to start + scrollstep
  197.     if i > fl_mx then
  198.       exit repeat
  199.     end if
  200.     set vname to chars(getAt(l_file, i), 3, length(getAt(l_file, i)))
  201.     set s to s & vname & RETURN
  202.     setAt(l_disp, didx, "S")
  203.     set didx to didx + 1
  204.   end repeat
  205.   return s
  206. end
  207.  
  208. on d_list start
  209.   global l_fold, l_file, l_disp, scrollstep
  210.   set l_disp to []
  211.   set s to RETURN & RETURN
  212.   set fl_mx to count(l_fold)
  213.   set didx to 1
  214.   repeat with i = start + 1 to start + scrollstep
  215.     if i > fl_mx then
  216.       exit repeat
  217.     end if
  218.     set s to s & ex_dir(trim(getAt(l_fold, i))) & RETURN
  219.     setAt(l_disp, didx, "S")
  220.     set didx to didx + 1
  221.   end repeat
  222.   return s
  223. end
  224.  
  225. on trim s
  226.   repeat with i = 1 to the maxinteger
  227.     if (chars(s, i, i) = QUOTE) or (charToNum(chars(s, i, i)) < 32) then
  228.       exit repeat
  229.     end if
  230.   end repeat
  231.   return chars(s, 1, i - 1)
  232. end
  233.  
  234. on trimdb s
  235.   if chars(s, length(s), length(s)) = ":" then
  236.     return chars(s, 1, length(s) - 1)
  237.   else
  238.     return s
  239.   end if
  240. end
  241.  
  242. on ex_dir s
  243.   set vl to 0
  244.   repeat with i = length(s) - 1 down to 1
  245.     if the machineType = 256 then
  246.       if chars(s, i, i) = "\" then
  247.         set vl to i + 1
  248.         exit repeat
  249.       end if
  250.       next repeat
  251.     end if
  252.     if chars(s, i, i) = ":" then
  253.       set vl to i + 1
  254.       exit repeat
  255.     end if
  256.   end repeat
  257.   set ret_s to chars(s, vl, length(s))
  258.   return ret_s
  259. end
  260.  
  261. on getselname idx
  262.   global up_load, up_cload, fl_search, l_file
  263.   if fl_search = "CIRCLE" then
  264.     set up_l to up_cload
  265.   else
  266.     set up_l to up_load
  267.   end if
  268.   set mode to chars(getAt(l_file, idx), 1, 1)
  269.   set vname to chars(getAt(l_file, idx), 3, length(getAt(l_file, idx)))
  270.   if mode = "S" then
  271.     if the machineType = 256 then
  272.       set sname to trimdb(trim(up_l))
  273.     else
  274.       set sname to trimdb(trim(up_l))
  275.     end if
  276.     if the machineType = 256 then
  277.       set sname to sname & EMPTY
  278.     else
  279.       set sname to sname & ":"
  280.     end if
  281.     set sname to sname & vname
  282.   else
  283.     if mode = "D" then
  284.       set sname to vname
  285.     else
  286.       if mode = "F" then
  287.         set sname to vname
  288.       else
  289.         if mode = "C" then
  290.           set sname to vname
  291.         end if
  292.       end if
  293.     end if
  294.   end if
  295.   return sname
  296. end
  297.  
  298. on todir s
  299.   global up_load, up_cload, fl_search
  300.   if fl_search = "CIRCLE" then
  301.     set up_l to up_cload
  302.   else
  303.     set up_l to up_load
  304.   end if
  305.   if up_load contains s then
  306.     set t to offset(s, up_l)
  307.     if not (t = 0) then
  308.       return chars(up_l, 1, t + length(s) - 1)
  309.     end if
  310.   else
  311.     return up_l & s
  312.   end if
  313.   return EMPTY
  314. end
  315.  
  316. on chk_dir paths, DIR
  317.   global mix_err, mix_fn1, mix_fnO, sndobj
  318.   set up_l to paths
  319.   set exist to 0
  320.   if the machineType = 256 then
  321.     repeat with i = 1 to the maxinteger
  322.       if i = 1 then
  323.         set mix_fn1 to paths
  324.         sndobj(mGetfn)
  325.         if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  326.           exit repeat
  327.         end if
  328.         if mix_err = "DIR" then
  329.           if not (mix_fnO = ".") and not (mix_fnO = "..") then
  330.             if mix_fnO = DIR then
  331.               set exist to 1
  332.               exit repeat
  333.             end if
  334.           end if
  335.         end if
  336.       end if
  337.       sndobj(mNextfn)
  338.       if (mix_fnO = EMPTY) or (mix_err = "ERROR") then
  339.         exit repeat
  340.       end if
  341.       if mix_err = "DIR" then
  342.         if not (mix_fnO = ".") and not (mix_fnO = "..") then
  343.           if mix_fnO = DIR then
  344.             set exist to 1
  345.             exit repeat
  346.           end if
  347.         end if
  348.       end if
  349.     end repeat
  350.   else
  351.     repeat with i = 1 to the maxinteger
  352.       set err to sndobj(mGetDirEntry, i - 1, trimdb(paths), "AIFF", EMPTY)
  353.       set lfn to sndobj(mReadFName1)
  354.       set ldir to sndobj(mReadVolume2)
  355.       if err <> 0 then
  356.         exit repeat
  357.       end if
  358.       if ldir <> 0 then
  359.         if not (length(trim(lfn)) = 0) then
  360.           if trim(lfn) = DIR then
  361.             set exist to 1
  362.             exit repeat
  363.           end if
  364.         end if
  365.       end if
  366.     end repeat
  367.   end if
  368.   return exist
  369. end
  370.  
  371. on getffpath s
  372.   global dir_sep
  373.   if chars(s, length(s), length(s)) = RETURN then
  374.     set s to chars(s, 1, length(s) - 1)
  375.   end if
  376.   if chars(s, length(s), length(s)) = dir_sep then
  377.     set s to chars(s, 1, length(s) - 1)
  378.   end if
  379.   repeat with i = length(s) down to 1
  380.     if chars(s, i, i) = dir_sep then
  381.       return chars(s, i + 1, length(s))
  382.     end if
  383.   end repeat
  384.   return EMPTY
  385. end
  386.  
  387. on getipath s
  388.   global dir_sep
  389.   if chars(s, length(s), length(s)) = RETURN then
  390.     set s to chars(s, 1, length(s) - 1)
  391.   end if
  392.   if chars(s, length(s), length(s)) = dir_sep then
  393.     set s to chars(s, 1, length(s) - 1)
  394.   end if
  395.   repeat with i = length(s) down to 1
  396.     if chars(s, i, i) = dir_sep then
  397.       return chars(s, 1, i)
  398.     end if
  399.   end repeat
  400.   return EMPTY
  401. end
  402.  
  403. on eject_CD
  404.   global CD
  405.   openXLib("AppleCD")
  406.   if objectp(CD) then
  407.     CD(mdispose)
  408.   end if
  409.   set CD to AppleCD(mnew)
  410.   if not objectp(CD) then
  411.     exit
  412.   end if
  413.   set chkCD to CD(mGetFirstTrack)
  414.   if chkCD <> -1 then
  415.     CD(mEject)
  416.     repeat while 1
  417.       set chkCD to CD(mGetFirstTrack)
  418.       if chkCD <> -1 then
  419.         exit repeat
  420.       end if
  421.     end repeat
  422.   end if
  423.   if objectp(CD) then
  424.     CD(mdispose)
  425.   end if
  426.   closeXLib("AppleCD")
  427.   put "back insertet"
  428. end
  429.  
  430. on check_CD
  431.   global CD
  432.   openXLib("AppleCD")
  433.   if objectp(CD) then
  434.     CD(mdispose)
  435.   end if
  436.   set CD to AppleCD(mnew)
  437.   if not objectp(CD) then
  438.     exit
  439.   end if
  440.   set chkCD to CD(mGetFirstTrack)
  441.   if chkCD <> -1 then
  442.     set retcd to 1
  443.   else
  444.     set retcd to 0
  445.   end if
  446.   if objectp(CD) then
  447.     CD(mdispose)
  448.   end if
  449.   closeXLib("AppleCD")
  450.   put "ceckCD>" & retcd
  451.   return retcd
  452. end
  453.