From f0fc51ab506034db25dd325a3b3b0e123af62e98 Mon Sep 17 00:00:00 2001
From: Alain Romedenne
Date: Tue, 28 Jul 2020 17:17:19 +0200
Subject: tdf131416 Basic syntax diagrams
- Close, Get, Put and Open statements
Change-Id: I09a89ededbf65c41a65e3d347111c9dac10cfdde
Reviewed-on: https://gerrit.libreoffice.org/c/help/+/99601
Tested-by: Jenkins
Reviewed-by: Olivier Hallot
---
source/media/helpimg/sbasic/Close_statement.svg | 41 +++++++++++++
source/media/helpimg/sbasic/Get_statement.svg | 44 ++++++++++++++
source/media/helpimg/sbasic/Open_statement.svg | 57 ++++++++++++++++++
source/media/helpimg/sbasic/Put_statement.svg | 44 ++++++++++++++
source/media/helpimg/sbasic/access_fragment.svg | 39 +++++++++++++
source/media/helpimg/sbasic/locking_fragment.svg | 41 +++++++++++++
source/text/sbasic/shared/03020101.xhp | 43 ++++----------
source/text/sbasic/shared/03020103.xhp | 71 +++++++++++++----------
source/text/sbasic/shared/03020201.xhp | 73 +++++++++++++-----------
source/text/sbasic/shared/03020204.xhp | 58 ++++++-------------
10 files changed, 378 insertions(+), 133 deletions(-)
create mode 100644 source/media/helpimg/sbasic/Close_statement.svg
create mode 100644 source/media/helpimg/sbasic/Get_statement.svg
create mode 100644 source/media/helpimg/sbasic/Open_statement.svg
create mode 100644 source/media/helpimg/sbasic/Put_statement.svg
create mode 100644 source/media/helpimg/sbasic/access_fragment.svg
create mode 100644 source/media/helpimg/sbasic/locking_fragment.svg
(limited to 'source')
diff --git a/source/media/helpimg/sbasic/Close_statement.svg b/source/media/helpimg/sbasic/Close_statement.svg
new file mode 100644
index 0000000000..4a4a2135bd
--- /dev/null
+++ b/source/media/helpimg/sbasic/Close_statement.svg
@@ -0,0 +1,41 @@
+
\ No newline at end of file
diff --git a/source/media/helpimg/sbasic/Get_statement.svg b/source/media/helpimg/sbasic/Get_statement.svg
new file mode 100644
index 0000000000..b2dc6d3418
--- /dev/null
+++ b/source/media/helpimg/sbasic/Get_statement.svg
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/source/media/helpimg/sbasic/Open_statement.svg b/source/media/helpimg/sbasic/Open_statement.svg
new file mode 100644
index 0000000000..7c1e1e3572
--- /dev/null
+++ b/source/media/helpimg/sbasic/Open_statement.svg
@@ -0,0 +1,57 @@
+
\ No newline at end of file
diff --git a/source/media/helpimg/sbasic/Put_statement.svg b/source/media/helpimg/sbasic/Put_statement.svg
new file mode 100644
index 0000000000..5f50458dcf
--- /dev/null
+++ b/source/media/helpimg/sbasic/Put_statement.svg
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/source/media/helpimg/sbasic/access_fragment.svg b/source/media/helpimg/sbasic/access_fragment.svg
new file mode 100644
index 0000000000..74302ec6c8
--- /dev/null
+++ b/source/media/helpimg/sbasic/access_fragment.svg
@@ -0,0 +1,39 @@
+
\ No newline at end of file
diff --git a/source/media/helpimg/sbasic/locking_fragment.svg b/source/media/helpimg/sbasic/locking_fragment.svg
new file mode 100644
index 0000000000..331f54690e
--- /dev/null
+++ b/source/media/helpimg/sbasic/locking_fragment.svg
@@ -0,0 +1,41 @@
+
\ No newline at end of file
diff --git a/source/text/sbasic/shared/03020101.xhp b/source/text/sbasic/shared/03020101.xhp
index 608027d66f..79247f40ca 100644
--- a/source/text/sbasic/shared/03020101.xhp
+++ b/source/text/sbasic/shared/03020101.xhp
@@ -34,44 +34,23 @@
-Close Statement
+
Close Statement
Closes a specified file that was opened with the Open statement.
-Syntax:
+
+
+ Close Statement diagram
+
-Close FileNumber As Integer[, FileNumber2 As Integer[,...]]
+Close [[#]fileNum [, [#]fileNum2 [,...]]]
-Parameters:
-FileNumber: Any integer expression that specifies the number of the data channel that was opened with the Open statement.
+
+fileNum: Any integer expression that specifies the number of the data channel that was opened with the Open statement.
-Example:
-
-Sub ExampleWorkWithAFile
-Dim iNumber As Integer
-Dim sLine As String
-Dim aFile As String
-Dim sMsg As String
- aFile = "c:\data.txt"
- sMsg = ""
- iNumber = Freefile
- Open aFile For Output As #iNumber
- Print #iNumber, "First line of text"
- Print #iNumber, "Another line of text"
- Close #iNumber
- iNumber = Freefile
- Open aFile For Input As iNumber
- While Not eof(iNumber)
- Line Input #iNumber, sLine
- If sLine <>"" Then
- sMsg = sMsg & sLine & chr(13)
- End If
- Wend
- Close #iNumber
- MsgBox sMsg
-End Sub
-
-
-
Get statement
-
-Get Statement
+
Get Statement
Reads a record from a relative file, or a sequence of bytes from a binary file, into a variable.See also: PUT Statement
-Syntax:
+
+
+ Get Statement diagram
+
-Get [#] FileNumber As Integer, [Position], Variable
+Get [#]fileNum, [recordNum|filePos], variable
-Parameters:
-FileNumber: Any integer expression that determines the file number.
-Position: For files opened in Random mode, Position is the number of the record that you want to read.
-For files opened in Binary mode, Position is the byte position in the file where the reading starts.
-If Position is omitted, the current position or the current data record of the file is used.
-Variable: Name of the variable to be read. With the exception of object variables, you can use any variable type.
+
+fileNum: Any integer expression that determines the file number.
+recordNum: For files opened in Random mode, recordNum is the number of the record that you want to read.
+For files opened in Binary mode, filePos is the byte position in the file where the reading starts.
+If recordNum and filePos are omitted, the current position or the current data record of the file is used.
+ variable: Name of the variable to be read. With the exception of object variables, you can use any variable type.
-Example:
+
+
-Sub ExampleRandomAccess
-Dim iNumber As Integer
-Dim sText As Variant ' Must be a variant
-Dim aFile As String
- aFile = "c:\data.txt"
- iNumber = Freefile
- Open aFile For Random As #iNumber Len=32
+Sub ExampleRandomAccess
+ Dim iNumber As Integer
+ Dim sText As Variant ' Must be a variant
+ Dim aFile As String
+ aFile = "c:\data.txt"
+ iNumber = Freefile
+ Open aFile For Random As #iNumber Len=32 Seek #iNumber,1 ' Position at beginning Put #iNumber,, "This is the first line of text" ' Fill line with text Put #iNumber,, "This is the second line of text" Put #iNumber,, "This is the third line of text"
- Seek #iNumber,2
- Get #iNumber,,sText
- Print sText
- Close #iNumber
- iNumber = Freefile
- Open aFile For Random As #iNumber Len=32
- Get #iNumber,2,sText
+ Seek #iNumber,2
+ Get #iNumber,,sText
+ Print sText
+ Close #iNumber
+ iNumber = Freefile
+ Open aFile For Random As #iNumber Len=32
+ Get #iNumber,2,sText Put #iNumber,,"This is a new text"
- Get #iNumber,1,sText
- Get #iNumber,2,sText
+ Get #iNumber,1,sText
+ Get #iNumber,2,sText Put #iNumber,20,"This is the text in record 20"
- Print Lof(#iNumber)
- Close #iNumber
-End Sub
+ Print Lof(#iNumber)
+ Close #iNumber
+End Sub
-
-
-
Put statement
-
-Put Statement
+
Put Statement
Writes a record to a relative file or a sequence of bytes to a binary file.See also: Get statement
-Syntax:
+
+
+ Put Statement diagram
+
-Put [#] FileNumber As Integer, [position], Variable
+Put [#]fileNum, [recordNum|filePos], variable
-Parameters:
-FileNumber: Any integer expression that defines the file that you want to write to.
-Position: For relative files (random access files), the number of the record that you want to write.
+
+fileNum: Any integer expression that defines the file that you want to write to.
+recordNum, filePos: For relative files (random access files), the number of the record that you want to write.For binary files (binary access), the position of the byte in the file where you want to start writing.
-Variable: Name of the variable that you want to write to the file.
+variable: Name of the variable that you want to write to the file.Note for relative files: If the contents of this variable does not match the length of the record that is specified in the Len clause of the Open statement, the space between the end of the newly written record and the next record is padded with existing data from the file that you are writing to.Note for binary files: The contents of the variables are written to the specified position, and the file pointer is inserted directly after the last byte. No space is left between the records.
-Example:
-
-Sub ExampleRandomAccess
-Dim iNumber As Integer
-Dim sText As Variant ' Must be a variant type
-Dim aFile As String
- aFile = "c:\data.txt"
- iNumber = Freefile
- Open aFile For Random As #iNumber Len=32
- Seek #iNumber,1 ' Position To start writing
- Put #iNumber,, "This is the first line of text" ' Fill line with text
- Put #iNumber,, "This is the second line of text"
- Put #iNumber,, "This is the third line of text"
- Seek #iNumber,2
- Get #iNumber,,sText
- Print sText
- Close #iNumber
- iNumber = Freefile
- Open aFile For Random As #iNumber Len=32
- Get #iNumber,2,sText
- Put #iNumber,,"This is new text"
- Get #iNumber,1,sText
- Get #iNumber,2,sText
- Put #iNumber,20,"This is the text in record 20"
- Print Lof(#iNumber)
- Close #iNumber
-End Sub
-
-