Difference between revisions of "ArrayDeepDump"

390 bytes added ,  17:21, 23 March 2011
Bug fix: added sv_destruct at the end
imported>QQuix
(User Function: ArrayDeepDump)
 
imported>QQuix
(Bug fix: added sv_destruct at the end)
 
(2 intermediate revisions by the same user not shown)
Line 24: Line 24:


The function is recursive, therefore limited to OBSE's maximum of 30 nested function calls.
The function is recursive, therefore limited to OBSE's maximum of 30 nested function calls.
There is a Catch 22 when you first compile a recursive function: the compiler will give an error at the line where the function calls itself because no such function exists yet. So I commented that line. After the first successful compilation, you should uncomment that line.


==Examples:==
==Examples:==
Line 68: Line 70:


==Code==
==Code==
  sriptname ArrayDeepDump
  scriptname ArrayDeepDump
   
   
  array_var iaArray
  array_var iaArray
Line 192: Line 194:
                               StringToTxtFile psFile  psLine  ;#Pluggy#
                               StringToTxtFile psFile  psLine  ;#Pluggy#
         endif
         endif
         if xLevel < xDepth - 1   ; stops recursion at the last level initialized
         if xDepth > 1     ; stops recursion at the last level initialized
           set xNextLevel to xMode * 100 + xLevel + 1
           set xNextLevel to xMode * 100 + xLevel + 1
           let sText := sPrefix + sKey1
           let sText := sPrefix + sKey1
          call zzArrayDeepDump aEntry [Value] , sText , xNextLevel, xDepth - 1
;;;; Uncomment the next line after the first successful compilation
         elseif xLevel == xDepth && xMode  == 2
;;;;      call ArrayDeepDump aEntry [Value] , sText , xNextLevel, xDepth - 1
         elseif xDepth == && xMode  == 2
           let sLine := sPrefix + sKey1 + " . . ."
           let sLine := sPrefix + sKey1 + " . . ."
                               printc "PrintArray>> %z " sLine
                               printc "PrintArray>> %z " sLine
Line 206: Line 210:
   
   
   endif
   endif
  sv_destruct sPrefix, sKey1, sType, sText, sLine
  end
  end


Anonymous user