From f4b8249675346948f0dfc5f6a3495a86465fb744 Mon Sep 17 00:00:00 2001 From: Andras Timar Date: Sun, 16 Sep 2012 19:17:05 +0200 Subject: indented Basic source code + enabled syntax highlight for wiki Change-Id: I4f139d3f3cdfc1492c2d7c0cbdf0a0014879c4a9 --- .../source/text/sbasic/shared/03020303.xhp | 56 ++++++++++++---------- .../source/text/sbasic/shared/03050200.xhp | 28 ++++++----- .../source/text/sbasic/shared/03090401.xhp | 19 ++++---- .../source/text/sbasic/shared/03101110.xhp | 26 +++++----- .../source/text/sbasic/shared/03120402.xhp | 12 +++-- .../source/text/sbasic/shared/03130100.xhp | 12 +++-- .../source/text/sbasic/shared/03130600.xhp | 16 ++++--- .../source/text/sbasic/shared/03132100.xhp | 10 ++-- 8 files changed, 99 insertions(+), 80 deletions(-) (limited to 'helpcontent2/source') diff --git a/helpcontent2/source/text/sbasic/shared/03020303.xhp b/helpcontent2/source/text/sbasic/shared/03020303.xhp index 9eab0766f5..5d3b09daa9 100644 --- a/helpcontent2/source/text/sbasic/shared/03020303.xhp +++ b/helpcontent2/source/text/sbasic/shared/03020303.xhp @@ -47,7 +47,9 @@ Returns the size of an open file in bytes. Syntax: -Lof (FileNumber) + +Lof (FileNumber) + Return value: Long Parameters: @@ -58,30 +60,32 @@ Example: -Sub ExampleRandomAccess -Dim iNumber As Integer -Dim sText As Variant REM 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 REM Position at start -Put #iNumber,, "This is the first line of text" REM Fill 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 a new line of 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 + +Sub ExampleRandomAccess +Dim iNumber As Integer +Dim sText As Variant REM 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 REM Position at start + Put #iNumber,, "This is the first line of text" REM Fill 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 a new line of 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 + diff --git a/helpcontent2/source/text/sbasic/shared/03050200.xhp b/helpcontent2/source/text/sbasic/shared/03050200.xhp index dbde24b186..7a4b90f789 100644 --- a/helpcontent2/source/text/sbasic/shared/03050200.xhp +++ b/helpcontent2/source/text/sbasic/shared/03050200.xhp @@ -53,18 +53,20 @@ Parameters: The Err function is used in error-handling routines to determine the error and the corrective action. Example: -sub ExampleError -on error goto ErrorHandler REM Set up error handler -Dim iVar as Integer -Dim sVar As String -REM Error occurs due to non-existent file -iVar = Freefile -Open "\file9879.txt" for Input as #iVar -Line Input #iVar, sVar -Close #iVar -exit sub -ErrorHandler: -MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred" -end sub + +Sub ExampleError +On Error Goto ErrorHandler REM Set up error handler +Dim iVar as Integer +Dim sVar As String +REM Error occurs due to non-existent file + iVar = Freefile + Open "\file9879.txt" for Input as #iVar + Line Input #iVar, sVar + Close #iVar +Exit Sub +ErrorHandler: + MsgBox "Error " & Err & ": " & Error$ + chr(13) + "At line : " + Erl + chr(13) + Now , 16 ,"an error occurred" +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03090401.xhp b/helpcontent2/source/text/sbasic/shared/03090401.xhp index d1e08a6af2..b05874f3aa 100644 --- a/helpcontent2/source/text/sbasic/shared/03090401.xhp +++ b/helpcontent2/source/text/sbasic/shared/03090401.xhp @@ -55,13 +55,16 @@ Parameter: Parameters to pass to the procedure. The type and number of parameters is dependent on the routine that is executing. A keyword is optional when you call a procedure. If a function is executed as an expression, the parameters must be enclosed by brackets in the statement. If a DLL is called, it must first be specified in the Declare-Statement. Example: -Sub ExampleCall -Dim sVar As String -sVar = "Office" -Call f_callFun sVar -end Sub -Sub f_callFun (sText as String) -Msgbox sText -end sub + +Sub ExampleCall +Dim sVar As String + sVar = "LibreOffice" + Call f_callFun sVar +End Sub + +Sub f_callFun (sText as String) + Msgbox sText +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03101110.xhp b/helpcontent2/source/text/sbasic/shared/03101110.xhp index ac0682cfff..6c120bd862 100644 --- a/helpcontent2/source/text/sbasic/shared/03101110.xhp +++ b/helpcontent2/source/text/sbasic/shared/03101110.xhp @@ -58,17 +58,19 @@ DefCur: Currency Example: -REM Prefix definitions for variable types: -DefBool b -DefDate t -DefDbL d -DefInt i -DefLng l -DefObj o -DefVar v -DefCur c -Sub ExampleDefCur -cCur=Currency REM cCur is an implicit currency variable -end sub + +REM Prefix definitions for variable types: +DefBool b +DefDate t +DefDbL d +DefInt i +DefLng l +DefObj o +DefVar v +DefCur c +Sub ExampleDefCur + cCur=Currency REM cCur is an implicit currency variable +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03120402.xhp b/helpcontent2/source/text/sbasic/shared/03120402.xhp index d3957d4fef..988ea73da9 100644 --- a/helpcontent2/source/text/sbasic/shared/03120402.xhp +++ b/helpcontent2/source/text/sbasic/shared/03120402.xhp @@ -56,10 +56,12 @@ Example: -Sub ExampleLen -Dim sText as String -sText = "Las Vegas" -MsgBox Len(sText) REM Returns 9 -End Sub + +Sub ExampleLen +Dim sText as String + sText = "Las Vegas" + MsgBox Len(sText) REM Returns 9 +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03130100.xhp b/helpcontent2/source/text/sbasic/shared/03130100.xhp index e89c6c5e65..ed8f29dd21 100644 --- a/helpcontent2/source/text/sbasic/shared/03130100.xhp +++ b/helpcontent2/source/text/sbasic/shared/03130100.xhp @@ -51,10 +51,12 @@ Example: -Sub ExampleBeep -beep -beep -beep -end sub + +Sub ExampleBeep + Beep + Beep + Beep +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03130600.xhp b/helpcontent2/source/text/sbasic/shared/03130600.xhp index e871a9e800..66dd9b73f0 100644 --- a/helpcontent2/source/text/sbasic/shared/03130600.xhp +++ b/helpcontent2/source/text/sbasic/shared/03130600.xhp @@ -54,12 +54,14 @@ Example: -Sub ExampleWait -Dim lTick As Long -lTick = GetSystemTicks() -wait 2000 -lTick = (GetSystemTicks() - lTick) -MsgBox "" & lTick & " Ticks" ,0,"The pause lasted" -End Sub + +Sub ExampleWait +Dim lTick As Long + lTick = GetSystemTicks() + Wait 2000 + lTick = (GetSystemTicks() - lTick) + MsgBox "" & lTick & " Ticks" ,0,"The pause lasted" +End Sub + diff --git a/helpcontent2/source/text/sbasic/shared/03132100.xhp b/helpcontent2/source/text/sbasic/shared/03132100.xhp index 7f5d32edad..e5c892d2f2 100644 --- a/helpcontent2/source/text/sbasic/shared/03132100.xhp +++ b/helpcontent2/source/text/sbasic/shared/03132100.xhp @@ -54,8 +54,10 @@ 4: UNIX Example: - Sub ExampleEnvironment - MsgBox GetGUIType - End Sub + + Sub ExampleEnvironment + MsgBox GetGUIType + End Sub + - \ No newline at end of file + -- cgit v1.2.3