forked from amazingfate/help
regression from...
commit 6614bedceadcc07ec082c5e926107f27903bda5c
Date: Mon Jan 25 20:07:10 2016 +0100
fix validation errors by round-trip through helpauthoring extension
with git show 6614bedceadcc07ec082c5e926107f27903bda5c | ~/recoverindent.py
import fileinput
import re
import sys
added = []
removed = []
filename = ""
def processlastfile(filename, added, removed):
if len(added) != len(removed):
print "BROKEN"
sys.exit(-2)
if len(removed):
f = open(filename, "rw")
linestring = open(filename, "r").read()
start = 0
for x in range(0, len(added)):
if added[x] == removed[x]:
continue
if added[x].strip() != removed[x].strip():
print "BROKEN"
sys.exit(-2)
if filename == "source/text/sbasic/shared/03080301.xhp" and x == 6:
print "skipping special hunk", removed[x], "in source/text/sbasic/shared/03080301.xhp"
else:
start = linestring.find(added[x], start)
if start == -1:
print "BROKEN"
sys.exit(-2)
linestring = linestring[0:start] + removed[x] + linestring[start + len(added[x]):]
start = start + len(removed[x])
open(filename, "w").write(linestring)
for line in fileinput.input():
if line.startswith("--- a/"):
if filename is not "":
processlastfile(filename, added, removed)
added = []
removed = []
filename = line[6:-1]
elif "role=\"bascode\"" in line:
m = re.search('>(.+?)<', line)
code = m.group(1)
if line.startswith("-"):
removed.append(code)
else:
added.append(code)
processlastfile(filename, added, removed)
which puts the code back the way it was, except for one string
which had changed and was fixed manually afterwards
Change-Id: Ic67abf36bb5d27be58a51ebbf5022830f56dcb37
84 lines
6.1 KiB
XML
84 lines
6.1 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<helpdocument version="1.0">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
* This file incorporates work covered by the following license notice:
|
|
*
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
* with this work for additional information regarding copyright
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
* except in compliance with the License. You may obtain a copy of
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
-->
|
|
|
|
<meta>
|
|
<topic id="textsbasicshared03020201xml" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">Get Statement [Runtime]</title>
|
|
<filename>/text/sbasic/shared/03020201.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
|
|
<body>
|
|
|
|
|
|
<section id="get">
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id3154927">
|
|
<bookmark_value>Get statement</bookmark_value>
|
|
</bookmark>
|
|
|
|
|
|
<paragraph id="hd_id3154927" role="heading" level="1" xml-lang="en-US"><link href="text/sbasic/shared/03020201.xhp">Get Statement [Runtime]</link></paragraph>
|
|
<paragraph id="par_id3145069" role="paragraph" xml-lang="en-US">Reads a record from a relative file, or a sequence of bytes from a binary file, into a variable.</paragraph>
|
|
</section>
|
|
<paragraph id="par_id3154346" role="paragraph" xml-lang="en-US">See also: <link href="text/sbasic/shared/03020204.xhp" name="PUT"><item type="literal">PUT</item></link> Statement</paragraph>
|
|
|
|
<paragraph id="hd_id3150358" role="heading" level="2" xml-lang="en-US">Syntax:</paragraph>
|
|
<bascode>
|
|
<paragraph id="par_id3150792" role="bascode" xml-lang="en-US">Get [#] FileNumber As Integer, [Position], Variable</paragraph>
|
|
</bascode>
|
|
|
|
<paragraph id="hd_id3154138" role="heading" level="2" xml-lang="en-US">Parameters:</paragraph>
|
|
<paragraph id="par_id3150448" role="paragraph" xml-lang="en-US"> <emph>FileNumber:</emph> Any integer expression that determines the file number.</paragraph>
|
|
<paragraph id="par_id3154684" role="paragraph" xml-lang="en-US"> <emph>Position:</emph> For files opened in Random mode, <emph>Position</emph> is the number of the record that you want to read.</paragraph>
|
|
<paragraph id="par_id3153768" role="paragraph" xml-lang="en-US">For files opened in Binary mode, <emph>Position</emph> is the byte position in the file where the reading starts.</paragraph>
|
|
<paragraph id="par_id3147319" role="paragraph" xml-lang="en-US">If <emph>Position</emph> is omitted, the current position or the current data record of the file is used.</paragraph>
|
|
<paragraph id="par_id3149484" role="paragraph" xml-lang="en-US">Variable: Name of the variable to be read. With the exception of object variables, you can use any variable type.</paragraph>
|
|
|
|
<paragraph id="hd_id3153144" role="heading" level="2" xml-lang="en-US">Example:</paragraph>
|
|
<bascode>
|
|
<paragraph id="par_idm1340774864" role="bascode" localize="false" xml-lang="en-US">Sub ExampleRandomAccess</paragraph>
|
|
<paragraph id="par_idm1340773632" role="bascode" localize="false" xml-lang="en-US">Dim iNumber As Integer</paragraph>
|
|
<paragraph id="par_id3155307" role="bascode" xml-lang="en-US">Dim sText As Variant ' Must be a variant</paragraph>
|
|
<paragraph id="par_idm1340770608" role="bascode" localize="false" xml-lang="en-US">Dim aFile As String</paragraph>
|
|
<paragraph id="par_idm1340769376" role="bascode" localize="false" xml-lang="en-US"> aFile = "c:\data.txt"</paragraph>
|
|
<paragraph id="par_idm1340768128" role="bascode" localize="false" xml-lang="en-US"> iNumber = Freefile</paragraph>
|
|
<paragraph id="par_idm1340766896" role="bascode" localize="false" xml-lang="en-US"> Open aFile For Random As #iNumber Len=32</paragraph>
|
|
<paragraph id="par_id3149411" role="bascode" xml-lang="en-US"> Seek #iNumber,1 ' Position at beginning</paragraph>
|
|
<paragraph id="par_id3153158" role="bascode" xml-lang="en-US"> Put #iNumber,, "This is the first line of text" ' Fill line with text</paragraph>
|
|
<paragraph id="par_id3148457" role="bascode" xml-lang="en-US"> Put #iNumber,, "This is the second line of text"</paragraph>
|
|
<paragraph id="par_id3150715" role="bascode" xml-lang="en-US"> Put #iNumber,, "This is the third line of text"</paragraph>
|
|
<paragraph id="par_idm1340758576" role="bascode" localize="false" xml-lang="en-US"> Seek #iNumber,2</paragraph>
|
|
<paragraph id="par_idm1340757344" role="bascode" localize="false" xml-lang="en-US"> Get #iNumber,,sText</paragraph>
|
|
<paragraph id="par_idm1340756112" role="bascode" localize="false" xml-lang="en-US"> Print sText</paragraph>
|
|
<paragraph id="par_idm1340754880" role="bascode" localize="false" xml-lang="en-US"> Close #iNumber</paragraph>
|
|
<paragraph id="par_idm1340753648" role="bascode" localize="false" xml-lang="en-US"> iNumber = Freefile</paragraph>
|
|
<paragraph id="par_idm1340752416" role="bascode" localize="false" xml-lang="en-US"> Open aFile For Random As #iNumber Len=32</paragraph>
|
|
<paragraph id="par_idm1340751152" role="bascode" localize="false" xml-lang="en-US"> Get #iNumber,2,sText</paragraph>
|
|
<paragraph id="par_id3155938" role="bascode" xml-lang="en-US"> Put #iNumber,,"This is a new text"</paragraph>
|
|
<paragraph id="par_idm1340748176" role="bascode" localize="false" xml-lang="en-US"> Get #iNumber,1,sText</paragraph>
|
|
<paragraph id="par_idm1340746928" role="bascode" localize="false" xml-lang="en-US"> Get #iNumber,2,sText</paragraph>
|
|
<paragraph id="par_id3146916" role="bascode" xml-lang="en-US"> Put #iNumber,20,"This is the text in record 20"</paragraph>
|
|
<paragraph id="par_idm1340743936" role="bascode" localize="false" xml-lang="en-US"> Print Lof(#iNumber)</paragraph>
|
|
<paragraph id="par_idm1340742704" role="bascode" localize="false" xml-lang="en-US"> Close #iNumber</paragraph>
|
|
<paragraph id="par_idm1340741472" role="bascode" localize="false" xml-lang="en-US">End Sub</paragraph>
|
|
</bascode>
|
|
</body>
|
|
|
|
</helpdocument> |