Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. PROC getSelection(position:PTR TO INT, linecount:PTR TO INT)
  2. DEF start = 0:PTR TO INT
  3. DEF end = 0:PTR TO INT
  4. DEF totallines = 0:PTR TO INT
  5. DEF indexlength = NIL:PTR TO CHAR
  6. DEF indexoffset = NIL:PTR TO CHAR
  7. DEF allindexstring = NIL:PTR TO CHAR
  8. DEF allgamestring = NIL:PTR TO CHAR
  9. DEF gamestring = NIL:PTR TO CHAR
  10. DEF paddedgamestring = NIL:PTR TO CHAR
  11.  
  12. IF (position < 0)
  13. start := 0
  14. ELSE
  15. start := position
  16. ENDIF
  17.  
  18. totallines := self.indexfile.length() / self.indexlinewidth
  19.  
  20. IF ((position + linecount) >= totallines)
  21. end := totallines - position - 1
  22. ELSE
  23. end := linecount - 1
  24. ENDIF
  25.  
  26. indexoffset := String(INDEX_OFFSET_LENGTH)
  27. indexlength := String(INDEX_LENGTH_LENGTH)
  28. allgamestring := String(GAMESTRING_LENGTH * end)
  29.  
  30. self.indexfile.moveFromBeginning(start * self.indexlinewidth)
  31. allindexstring := self.indexfile.read(end * self.indexlinewidth)
  32.  
  33. FOR i := 0 TO end
  34. IF (gamestring) THEN DisposeLink(gamestring)
  35.  
  36. MidStr(indexoffset, allindexstring, INDEX_OFFSET_POSITION + (i * self.indexlinewidth), INDEX_OFFSET_LENGTH)
  37. MidStr(indexlength, allindexstring, INDEX_LENGTH_POSITION + (i * self.indexlinewidth), INDEX_LENGTH_LENGTH)
  38.  
  39. self.masterfile.moveFromBeginning(Val(indexoffset))
  40. gamestring := self.masterfile.read(Val(indexlength))
  41. paddedgamestring := strToPaddedGameStr(gamestring)
  42. StrAdd(allgamestring, paddedgamestring)
  43. ENDFOR
  44. ENDPROC gamestring
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement