Commit 4debd8a0 authored by Olimaticer's avatar Olimaticer

2018-03-31

parent dd3e6101
REM Start of BASIC! Include Program BarCodeScanner.bas
FN.DEF GetBarCode(SCAN_MODE$,globals)
BUNDLE.CONTAIN globals,"barcodeFirstRun",barcodeFirstRun
IF barcodeFirstRun = 0
BUNDLE.PUT globals,"barcodeFirstRun",1
APP.INSTALLED check, "com.google.zxing.client.android"
IF check = 0
APP.LOAD "market://details?id="+ "com.google.zxing.client.android"
DIALOG.MESSAGE "Installing succeeded?", "Please confirm", buttonResult, "Yes", "No"
IF buttonResult = 2
BUNDLE.PUT globals,"barcodeFirstRun",0
ENDIF
ENDIF
!SCAN_MODEs$ = "QR_CODE_MODE,CODE_39,CODE_128,EAN_8,EAN_13,ITF,UPC_A,UPC_E,DATAMATRIX,PDF417,QR_CODE"
!"UPC_A", "UPC_E", "EAN_8", "EAN_13","RSS_14","UPC_A","UPC_E","EAN_8","EAN_13","CODE_39","CODE_93","CODE_128","ITF","RSS_14","RSS_EXPANDED","QR_CODE",
LIST.CREATE S, commandListPointer
LIST.ADD commandListPointer~
"new Intent("+CHR$(34)+"com.google.zxing.client.android.SCAN"+CHR$(34)+");" ~
! "putExtra ("+CHR$(34)+"SCAN_MODE"+CHR$(34)+","+CHR$(34)+ "QR_CODE_MODE"+CHR$(34)+");" ~
"putExtra("+CHR$(34)+"PROMPT_MESSAGE"+CHR$(34)+","+CHR$(34)+ "Scan the Item!"+CHR$(34)+");" ~
"addCategory(Intent.CATEGORY_DEFAULT);" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);" ~
"EOCL"
LIST.CREATE S, resultListPointer
LIST.ADD resultListPointer~
"result$=getStringExtra("+CHR$(34)+"SCAN_RESULT"+CHR$(34)+");" ~
"format$=getStringExtra("+CHR$(34)+"SCAN_RESULT_FORMAT"+CHR$(34)+");" ~
"errCorrection$=getStringExtra("+CHR$(34)+"SCAN_RESULT_ERROR_CORRECTION_LEVEL"+CHR$(34)+");" ~
"i#intentOrientation=getIntExtra("+CHR$(34)+"SCAN_RESULT_ORIENTATION"+CHR$(34)+",-5);" ~ %You get 180 for bar codes reading from right to left.
"EORL"
! byte[] rawBytes = intent.getByteArrayExtra("SCAN_RESULT_BYTES");
! BUNDLE.CREATE appVarPointer
! May be later
! BUNDLE.PL or BUNDLE.PUT.LIST appVarPointer,"***CommandList***",commandListPointer
BUNDLE.PL appVarPointer,"***CommandList***",commandListPointer
BUNDLE.PL appVarPointer,"***ResultList***",resultListPointer
BUNDLE.PUT appVarPointer,"result$","nothing"
BUNDLE.PUT appVarPointer,"format$",""
BUNDLE.PUT appVarPointer,"errCorrection$",""
BUNDLE.PUT appVarPointer,"i#intentOrientation",-1
! May be later
! BUNDLE.PB or BUNDLE.PUT.BUNDLE appVarPointer,"myBundle",myBundlePointer
BUNDLE.PUT globals,"barcodeAppVarPointer",appVarPointer
ELSE
BUNDLE.GET globals,"barcodeAppVarPointer",appVarPointer
BUNDLE.PUT appVarPointer,"result$","nothing"
ENDIF
APP.SAR appVarPointer
! May be later
! APP.SAR appVarPointer, commandListPointer, resultListPointer
FN.RTN appVarPointer
FN.END
FN.DEF GetBarCodeSimple$(globals)
ResultPointer = GetBarCode("",globals)
BUNDLE.GET ResultPointer, "result$", result$
BUNDLE.GET ResultPointer, "i#intentOrientation", intentOrientation
PRINT "i#intentOrientation", intentOrientation
FN.RTN result$
FN.END
DEBUG.OFF
BUNDLE.CREATE globals
!!
PRINT "Scan Result: " ; GetBarCodeSimple$(globals) %Works twice! Issue #79
!!
myBarcode$ = GetBarCodeSimple$(globals)
PRINT "Scan Result: " ; myBarcode$
DIALOG.MESSAGE "", "Go on", buttonResult, "Go"
myBarcode$ = GetBarCodeSimple$(globals)
PRINT "Scan Result: " ; myBarcode$
END
REM *** Bundle Package Test Program *** / A_BundleWithArrays01.bas
FN.DEF PutBundleContens(globals)
b$ = "B"
ARRAY.LOAD c$[], "D","E","F","G","H","I"
BUNDLE.PUT globals,"myString_A", "A"
BUNDLE.PUT globals,"myString_B", c$[]
BUNDLE.PUT globals,"myString_B", b$
BUNDLE.PUT globals,"myStringArray_C", c$[]
l = 97
ARRAY.LOAD m[], 4,-5,6,-7,8,-9
BUNDLE.PUT globals,"myDouble_K", -47.11
BUNDLE.PUT globals,"myDouble_L", l
BUNDLE.PUT globals,"myDoubleArray_M", m[]
DIM Z[2,3]
Z[1,1] = 1
Z[1,2] = 2
Z[1,3] = 3
Z[2,1] = 4
Z[2,2] = 5
Z[2,3] = 6
BUNDLE.PUT globals,"myDoubleArray_Z", Z[]
FN.RTN 1
FN.END
DEBUG.ON
BUNDLE.CREATE globals
PutBundleContens(globals)
BUNDLE.GET globals,"myString_A", myString_A$
BUNDLE.GET globals,"myString_B", myString_B$
DIM myStringArray_C$[11]
BUNDLE.GET globals,"myStringArray_C", myStringArray_C$[]
PRINT "myString_A", myString_A$
PRINT "myString_B", myString_B$
PRINT "myStringArray_C", myStringArray_C$[4]
BUNDLE.TYPE globals,"myString_B", varType$
PRINT "Type myString_B", varType$
BUNDLE.TYPE globals,"myStringArray_C", varType$
PRINT "Type myStringArray_C", varType$
PRINT
BUNDLE.GET globals,"myDouble_K", myDouble_K
BUNDLE.GET globals,"myDouble_L", myDouble_L
! DIM myDouble_M[11]
ARRAY.LOAD myDouble_M[],1,2,3,4,5,6,7
! DIM myDouble_Z[2,3]
BUNDLE.GET globals,"myDoubleArray_M", myDouble_M[]
BUNDLE.GET globals,"myDoubleArray_Z", myDouble_Z[]
PRINT "myDouble_K", myDouble_K
PRINT "myDouble_L", myDouble_L
PRINT "myDoubleArray_M", myDouble_M[3]
PRINT "myDoubleArray_Z", myDouble_Z[2,1]
BUNDLE.TYPE globals,"myDoubleArray_M", varType$
PRINT "Type myDoubleArray_M", varType$
BUNDLE.TYPE globals,"myDouble_K", varType$
PRINT "Type myDouble_K", varType$
BUNDLE.TYPE globals,"myDoubleArray_Z", varType$
PRINT "Type myDoubleArray_Z", varType$
DIM Z[2,2]
Z[1,1] = 1
Z[1,2] = 2
Z[2,1] = 3
Z[2,2] = 4
PRINT "Array.copy, copy and dispose to one dimension"
ARRAY.COPY Z[], W[]
! PRINT W[2,2] throws an error ?
PRINT W[4] % Print 4
! The manual should be teach, that this command is developed for arrays with one dimension.
! Arrays with more dimensions will be dispose to one dimension.
PRINT "Array copy with BUNDLE.PUT and BUNDLE.GET"
BUNDLE.PUT globals,"Z[]", Z[]
BUNDLE.GET globals,"Z[]", W[]
PRINT W[2,2]
BUNDLE.KEYS globals, list_ptr
LIST.SIZE list_ptr, lSize
PRINT "Print Bundle.Keys, Keys: ",lSize
FOR I = 1 TO lSize
LIST.GET list_ptr, I, contens$
PRINT contens$
NEXT I
! BUNDLE.CREATE myFirstBundle % In this case obsolet, because BUNDLE Auto-Create
BUNDLE.PB myFirstBundle, "globals", globals
BUNDLE.KEYS myFirstBundle, lp
LIST.SIZE lp, listSize
PRINT "keys myFirstBundle listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET lp, i, text$
PRINT text$
NEXT I
BUNDLE.GB myFirstBundle, "globals", globals
BUNDLE.PB myFirstBundle, "globals", globals
BUNDLE.CREATE mySecondBundle
BUNDLE.GB myFirstBundle, "globals", mySecondBundle
BUNDLE.KEYS mySecondBundle, lp
LIST.SIZE lp, listSize
PRINT "keys mySecondBundle listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET lp, i, text$
PRINT text$
NEXT I
BUNDLE.GET mySecondBundle,"myString_B", myString_B_In_Second_Bundle$
PRINT "myString_B_In_Second_Bundle$", myString_B_In_Second_Bundle$
BUNDLE.PL myFirstBundle, "globals_list_ptr", list_ptr
BUNDLE.KEYS myFirstBundle, lp
LIST.SIZE lp, listSize
PRINT "keys myFirstBundle listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET lp, i, text$
PRINT text$
NEXT I
LIST.CREATE S, list_ptr2
BUNDLE.GL myFirstBundle, "globals_list_ptr", list_ptr2
LIST.SIZE list_ptr2, listSize
PRINT "keys list_ptr2 listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET list_ptr2, i, text$
PRINT text$
NEXT I
STACK.CREATE S, stack_ptr
STACK.PUSH stack_ptr, "A"
STACK.PUSH stack_ptr, "B"
STACK.PUSH stack_ptr, "C"
BUNDLE.PS myFirstBundle, "stack_ptr", stack_ptr
STACK.CREATE S, stack_ptr2
BUNDLE.GS myFirstBundle, "stack_ptr", stack_ptr2
STACK.ISEMPTY stack_ptr2, stackIsE
IF stackIsE < 1
DO
STACK.POP stack_ptr2, stackText$
STACK.ISEMPTY stack_ptr2, stackIsE
PRINT "stackText$: ", stackText$
UNTIL stackIsE > 0
ENDIF
STACK.CREATE N, stack_ptr3
STACK.PUSH stack_ptr3, 1
STACK.PUSH stack_ptr3, 2
STACK.PUSH stack_ptr3, 3
BUNDLE.PS myFirstBundle, "stack_ptr2", stack_ptr3
STACK.CREATE N, stack_ptr4
BUNDLE.GS myFirstBundle, "stack_ptr2", stack_ptr4
STACK.ISEMPTY stack_ptr4, stackIsE
IF stackIsE < 1
DO
STACK.POP stack_ptr4, stackNum
STACK.ISEMPTY stack_ptr4, stackIsE
PRINT "stackText$: ", stackNum
UNTIL stackIsE > 0
ENDIF
BUNDLE.TYPE myFirstBundle, "globals", bType$
PRINT "Bundle Tag Type: globals ", bType$
BUNDLE.TYPE myFirstBundle, "globals_list_ptr", bType$
PRINT "Bundle Tag Type: globals_list_ptr ", bType$
BUNDLE.TYPE myFirstBundle, "stack_ptr", bType$
PRINT "Bundle Tag Type: stack_ptr ", bType$
BUNDLE.TYPE myFirstBundle, "stack_ptr2", bType$
PRINT "Bundle Tag Type: stack_ptr2 ", bType$
BUNDLE.COPY myFirstBundle, b2
BUNDLE.TYPE b2, "stack_ptr2", b2Type$
PRINT "Bundle Tag Type: stack_ptr2 ", b2Type$
END
REM Start of BASIC! Include Program CallFileBrowser.bas
FN.DEF GetOpenFilePath$(aFile$,multiple$)
LIST.CREATE S, commandListPointer
LIST.ADD commandListPointer~
"new Intent(Intent.ACTION_GET_CONTENT);" ~
"setPackage("+ CHR$(34) +"com.blackmoonit.android.FileBrowser"+ CHR$(34) +");" ~
!"setData("+ CHR$(34) + aFile$ + chr$(34) +");" ~ %//default file / jump directly to this file/folder
!"setDataAndType(" + CHR$(34) + aFile$ + chr$(34) + "," + CHR$(34) + "*/*" + CHR$(34) + ");" ~
!"putExtra(Intent.EXTRA_TITLE,"+ CHR$(34) + customTitle$ + CHR$(34) +");" ~
!"putExtra("+ CHR$(34) + "com.blackmoonit.extra.ALLOW_MULTIPLE" + CHR$(34) + ",true);" ~
"putExtra("+ CHR$(34) + "com.blackmoonit.extra.ALLOW_MULTIPLE" + CHR$(34) + ","+multiple$+");" ~
!
! Direct from developer.android.com. But this is available for Android API 18+ only.
! "putExtra("+ CHR$(34) + "Intent.EXTRA_ALLOW_MULTIPLE" + CHR$(34) + ",true);" ~
! "putExtra("+ CHR$(34) + "Intent.EXTRA_LOCAL_ONLY" + CHR$(34) + ",true);" ~
! if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
!
!"setType("+ CHR$(34) + "image/*"+ CHR$(34) + ");" ~
! "setType("+ CHR$(34) + "image/gif"+ CHR$(34) + ");" ~
! "setType("+ CHR$(34) + "text/html"+ CHR$(34) + ");" ~
!"setType("+ CHR$(34) + "folder/*"+ CHR$(34) + ");" ~
"setType("+ CHR$(34) + "*/*"+ CHR$(34) + ");" ~
!"setType("+ CHR$(34) + "multipart/mixed"+ CHR$(34) + ");" ~
"addCategory(Intent.CATEGORY_DEFAULT);" ~
"addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);" ~
"EOCL"
LIST.CREATE S, resultListPointer
IF multiple$ = "true"
LIST.ADD resultListPointer~
"listS#theFileUriList=getParcelableArrayListExtra(Intent.EXTRA_STREAM);" ~
"stackS#theFileUriList=getParcelableArrayListExtra(Intent.EXTRA_STREAM);" ~
"theFileUriList$[]=getParcelableArrayListExtra(Intent.EXTRA_STREAM);" ~
"EORL"
ELSE
LIST.ADD resultListPointer~
"theFilePath$=getData().getPath();" ~
"EORL"
ENDIF
LIST.CREATE S, theFileUriListPointer
STACK.CREATE S, theFileUriStackPointer
DIM theFileUriList$[1]
BUNDLE.CREATE appVarPointer
BUNDLE.PL appVarPointer,"***CommandList***",commandListPointer
BUNDLE.PL appVarPointer,"***ResultList***",resultListPointer
BUNDLE.PUT appVarPointer,"theFilePath$","No file selected!"
BUNDLE.PL appVarPointer,"listS#theFileUriList",theFileUriListPointer
BUNDLE.PS appVarPointer,"stackS#theFileUriList",theFileUriStackPointer
BUNDLE.PUT appVarPointer,"theFileUriList$[]",theFileUriList$[]
!BUNDLE.PUT.BUNDLE appVarPointer,"BUNDLE",appBundlePointer
!BUNDLE.PUT.LIST appVarPointer,"LIST",appListPointer
!BUNDLE.PUT.Stack appVarPointer,"STACK",appStackPointer
!BUNDLE.GET.BUNDLE appVarPointer,"BUNDLE",appBundlePointer2
!BUNDLE.GET.LIST appVarPointer,"LIST",appListPointer2
!BUNDLE.GET.Stack appVarPointer,"STACK",appStackPointer2
APP.SAR appVarPointer
BUNDLE.GET appVarPointer,"theFilePath$",theFilePath$
IF multiple$ = "true"
!BUNDLE.GL appVarPointer,"listS#theFileUriList",theFileUriListPointer %Unbedingt Fehler abfangen!!
BUNDLE.GS appVarPointer,"stackS#theFileUriList",theFileUriStackPointer %Unbedingt Fehler abfangen!!
BUNDLE.GET appVarPointer,"theFileUriList$[]",theFileUriList2$[]
!!
List.size theFileUriListPointer, listSize
PRINT "listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET theFileUriListPointer, i, text$
PRINT "From List: ",text$
NEXT I
!!
STACK.ISEMPTY theFileUriStackPointer, stackIsE
PRINT "stackIsE: ", stackIsE
IF stackIsE < 1
DO
STACK.POP theFileUriStackPointer, stackText$
STACK.ISEMPTY theFileUriStackPointer, stackIsE
PRINT "stackText$: ", stackText$
UNTIL stackIsE > 0
ENDIF
ARRAY.LENGTH arrayLength, theFileUriList2$[]
FOR i = 1 TO arrayLength
text$ = theFileUriList2$[i]
PRINT "fromArray: ", text$
NEXT I
BUNDLE.KEYS appVarPointer, lp
LIST.SIZE lp, listSize
PRINT "listSize: ", listSize
FOR i = 1 TO listSize
LIST.GET lp, i, text$
PRINT text$
NEXT I
ENDIF
FN.RTN theFilePath$
FN.END
DEBUG.OFF
FILE.ROOT dataPath$
fileName$ = "file://" + dataPath$ % + "/"% + "De_Re_BASIC!.pdf"
PRINT fileName$
!!
PRINT "File path: " ; GetOpenFilePath$(fileName$, "false") %Works two times! Issue #79
!!
myFilePath$ = GetOpenFilePath$(fileName$, "false")
PRINT "File path: " ; myFilePath$
DIALOG.MESSAGE "", "Go on", buttonResult, "Go"
!
myFilePath$ = GetOpenFilePath$(fileName$, "true")
PRINT "File path: " ; myFilePath$
END
REM Start of BASIC! Include Program CallAnActivity.bas
FN.DEF ViewPdf(fileName$)
LIST.CREATE S, commandListPointer
LIST.ADD commandListPointer~
"new Intent("+CHR$(34)+"Intent.ACTION_VIEW"+CHR$(34)+");" ~
"setPackage("+CHR$(34)+"com.adobe.reader"+CHR$(34)+");" ~
"setDataAndType("+CHR$(34)+fileName$+CHR$(34)+","+CHR$(34)+ "application/pdf"+CHR$(34)+");" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);" ~
"addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);" ~
"EOCL"
!BUNDLE.CREATE appVarPointer % Obsolet because BUNDLE Auto-Create
BUNDLE.PL appVarPointer,"***CommandList***",commandListPointer
APP.SAR appVarPointer
FN.RTN appVarPointer
FN.END
file.root dataPath$
fileName$ = dataPath$ + "/" + "App.SAR FlowChart 2016-05-30.pdf"
PRINT "pdfFileName: " , fileName$
myVarPointer = ViewPdf (fileName$)
END
REM Program SentTo
DEBUG.OFF
FILE.ROOT dataPath$
myTO$ = "bob.exampleman@example.com"
myS$ = "Subject"
myB$ = "Mail body"
gmail$ = "com.google.android.gm"
onedrive$ = "com.microsoft.skydrive"
twitter$ = "com.twitter.android"
whatsapp$ = "com.whatsapp"
zip$ = "com.blackmoonit.android.FileBrowser"
myCC$ = "kurt.k@web.de"
myBCc$ = "harry.cerry@web.de"
LIST.CREATE S, myFileListPointer
LIST.ADD myFileListPointer ~
"file://" + dataPath$ + "/" + "cartman.png" ~
"file://" + dataPath$ + "/" + "fly.gif" ~
"file://" + dataPath$ + "/" + "whee.mp3"
LIST.TOARRAY myFileListPointer, FileList$[]
EMAIL.SEND myTO$, myS$, myB$
ARRAY.LOAD myToA$[],myTO$,myBCc$
EMAIL.SEND myToA$[], myS$, myB$
DIALOG.MESSAGE "", "Go on", buttonResult, "Yes", "Chancel"
IF buttonResult = 1
EMAIL.SEND "mike.t@web.de", "", myB$
ENDIF
APP.INSTALLED flag, gmail$
IF flag = 0
APP.LOAD "market://details?id="+ gmail$
DIALOG.MESSAGE "Installing succeeded?", "Please confirm", buttonResult, "Yes", "No"
IF buttonResult = 1
EMAIL.SEND myToA$[], myS$, myB$, gmail$, "", "", FileList$[]
ENDIF
ELSE
EMAIL.SEND myToA$[], myS$, myB$, gmail$, "", "", FileList$[]
ENDIF
END
REM Start of BASIC! Include Program CallAnActivity.bas
FN.DEF GetOpenMap(geoLocation$)
LIST.CREATE S, commandListPointer
LIST.ADD commandListPointer~
"new Intent(Intent.ACTION_VIEW);" ~
"setData(" + CHR$(34) + geoLocation$ + CHR$(34) + ");" ~
"resolveActivity(getPackageManager());" ~
"EOCL"
BUNDLE.CREATE appVarPointer
BUNDLE.PL appVarPointer,"***CommandList***",commandListPointer
APP.SAR appVarPointer
FN.RTN appVarPointer
FN.END
DEBUG.OFF
myGeoLocation$ = "geo:0,0?q=34.99,-106.61(Treasure)"
GetOpenMap(myGeoLocation$)
END
!!
Data URI Scheme
geo:latitude,longitude
Show the map at the given longitude and latitude.
Example: "geo:47.6,-122.3"
geo:latitude,longitude?z=zoom
Show the map at the given longitude and latitude at a certain zoom level.
A zoom level of 1 shows the whole Earth, centered at the given lat,lng.
The highest (closest) zoom level is 23.
Example: "geo:47.6,-122.3?z=11"
geo:0,0?q=lat,lng(label)
Show the map at the given longitude and latitude with a string label.
Example: "geo:0,0?q=34.99,-106.61(Treasure)"
geo:0,0?q=my+street+address
Show the location for "my street address" (may be a specific address or location query).
Example: "geo:0,0?q=1600+Amphitheatre+Parkway%2C+CA"
Note: All strings passed in the geo URI must be encoded.
For example, the string 1st & Pike, Seattle should become 1st%20%26%20Pike%2C%20Seattle.
Spaces in the string can be encoded with %20 or replaced with the plus sign (+).
!!
REM Start of BASIC! Program IsAppInstalled.bas
APP.installed flag, "com.google.android.gm"
Print "com.google.android.gm Installed?: "; flag
package$ = "com.rfo.basic"
APP.installed c , package$,vN$, vC
Print c , package$,vN$,vC
REM SearchInDictionary.bas
FN.DEF InsertInMyDic(path$, dic$, insertText$)
!* Creates/opens a additional dictionary.
BYTE.OPEN a, bft, "file://" + path$ + "/" + dic$
BYTE.WRITE.BUFFER bft, " " + ENCODE$("URL", "ISO-8859-1", insertText$) + "\n"
BYTE.CLOSE bft
FN.RTN 1
FN.END
FN.DEF GrepSearch$(path$, dic$, modifiers$, searchText$ )
searchText$ = ENCODE$("URL", "ISO-8859-1", searchText$)
!* You can use grep with Android >= 4.1-4.3 (JellyBean)
d$ = "grep " + modifiers$ + "'" + searchText$ + "' " + path$ + "/" + dic$ +"\n"
BYTE.OPEN w, bft, "file://" + path$ + "/" + "script.sh"
BYTE.WRITE.BUFFER bft, d$
BYTE.CLOSE bft
d$ = "sh " + path$ + "/" + "script.sh"
SHELL text$, d$
!IF text$ = "" THEN text$ = "Empty Result!"
FN.RTN text$
FN.END
FN.DEF SearchItem(path$, dic$, shortDic$, myDic$, searchText$)
t1 =TIME()
modifiers$ = "-w -e "% -w for complete words, -e search pattern follows
text$ = ""
FILE.EXISTS ok, "file://" + path$ + "/" + myDic$
!* Insert LET, because TEXT is a reserved key word.
!* The additional dictionary is the first choice.
IF ok > 0 THEN LET text$ = text$ + GrepSearch$(path$, myDic$, modifiers$, searchText$)
!* Returns often more items, because URL encoded characters
IF text$ = "" THEN LET text$ = text$ + GrepSearch$(path$, shortDic$, modifiers$, searchText$)
IF text$ = "" THEN LET text$ = text$ + GrepSearch$(path$, dic$, modifiers$, searchText$)
t2 =TIME()
PRINT "Grep search time: ", (t2-t1)/1000
SPLIT.ALL resultArray$[], text$, CHR$(10)
LIST.CREATE S, matchResults
LIST.ADD.ARRAY matchResults, resultArray$[]
LIST.SIZE matchResults, ls
FOR i = 1 TO ls
LIST.GET matchResults, i, text$
text$ = TRIM$(DECODE$("URL", "ISO-8859-1", text$))
LIST.REPLACE matchResults, i, text$
NEXT
t2 =TIME()
LIST.SEARCH matchResults, searchText$, w
DEBUG.ON
DEBUG.DUMP.LIST matchResults
PRINT w
IF w > 0
LIST.GET matchResults, w, text$
PRINT text$
ENDIF
PRINT "Complete search time: ", (t2-t1)/1000
FN.RTN w
FN.END
BUNDLE.PUT clbp, "_TextFont", "_Default" % This line is a must!
BUNDLE.PUT clbp, "_TextColor", "255,0,0,0"
BUNDLE.PUT clbp, "_TextBackgroundColor", "0,0,0,0"
BUNDLE.PUT clbp, "_BackgroundColor", "255,255,140,0"
BUNDLE.PUT clbp, "_DividerColor", "255,0,0,0"
BUNDLE.PUT clbp, "_DividerHeight", 3
Console.layout clbp
dic$ = "germanSpaceURL.dic" % Characters outside ASCII code are encryptetd as URL code,
!^ because they will be ignored in Android's shell implementation.
!^ In this case according to the ISO-8859-1 standard.
!^ Mostly also "UTF-8" is possible. But the character set has to be overall the same in the commands.
!^ The first character has to be a white space, because BSD grep is not fully/correct implemented.
shortDic$ = "shortGermanSpaceURL.dic" % For very short words like "in"
myDic$ = "myDicSpaceURL.dic" % For your own stuff
FILE.ROOT path$ % Basic!'s data path
!searchText$ = "auf"
!w = SearchItem(path$, dic$, searchText$)
DO
INPUT "Search text" , searchText$
IF LEN(searchText$) > 1 % For words longer than 1 letter. Handle a, $, € ... in a special routine.
w = SearchItem(path$, dic$, shortDic$, myDic$, searchText$)
FILE.EXISTS ok, "file://" + path$ + "/" + myDic$
IF w = 0
dispText$ = "Should " + searchText$ + " be inserted?"
DIALOG.MESSAGE "", dispText$, sel, "Go on", "Close", "Insert"
ELSE
dispText$ = "Item " + INT$(w) + " in the list is the right one."
DIALOG.MESSAGE "", dispText$, sel, "Go on", "Close"
ENDIF
IF sel = 3 THEN InsertInMyDic(path$, myDic$, searchText$)
ENDIF
UNTIL sel = 2
END
REM ToSpaceUrlDic.bas
REM Convert Windows Text File to Linux With Space and URL Encoding
sourceDic$ = "german.dic"
!^ german.dic is a plain Windows text file
!^ from sourceforge.net/projects/germandict
!^ over 1.9 million entries (including inflected forms)
dic$ = "germanSpaceURL.dic" %Characters outside ASCII code are encryptetd as URL code,
!^ because they will be ignored in Android's shell implementation.
!^ In this case according to the ISO-8859-1 standard.
!^ Mostly also "UTF-8" is possible. But the character set has to be overall the same in the commands.
!^ The first character has to be a white space, because BSD grep is not fully/correct implemented.
shortDic$ = "shortGermanSpaceURL.dic" % For very short words like "in" and your own stuff
FILE.ROOT path$ % Basic!'s data path
t1 =TIME()
GRABFILE text$, "file://" + path$ + "/" + sourceDic$
? "Step 1"
SPLIT.ALL resultArray$[], text$, CHR$(13) + CHR$(10)
!^ File from Windows. Got a memory fault using a file without CR.
? "Step 2"
text$ = ""
ARRAY.LENGTH al, resultArray$[]
? "Step 3"
!WAKELOCK 5
BYTE.OPEN w, bftD, "file://" + path$ + "/" + dic$
BYTE.OPEN w, bftS, "file://" + path$ + "/" + shortDic$
deciAl = INT(al / 10)
lc = 1
FOR i = 1 TO al
IF i = deciAl * lc THEN ? "Loop Counter "; int$(lc); "/10: "; deciAl * lc: ++lc
text$ = " " + ENCODE$("URL", "ISO-8859-1", resultArray$[i]) + "\n"
IF LEN(resultArray$[i]) < 4 %You can optimize, if you change maybe to higher values
!* Store short words into "shortGermanDicSpaceURL.dic"
BYTE.WRITE.BUFFER bftS, text$
ELSE
!* Store longer words into "germanSpaceURL.dic"
BYTE.WRITE.BUFFER bftD, text$
ENDIF
NEXT
BYTE.CLOSE bftD
BYTE.CLOSE bftM
!WAKELOCK 5
t2 =TIME()
PRINT "Encoding time: ", (t2-t1)/1000; " sec "; (t2-t1)/1000/60; " min"
This diff is collapsed.
This diff is collapsed.
Rollenband
Dornma%D
Stulp
Magnetprofilzylinder
Industriegewekschaft
flexen
AA
AAA
Aal
Aar
Aas
ab
Abc
Abi
Abk
ABM
Abo
ABS
Abt
Abu
ach
ad
Ada
ADC
ade
ADS
AEG
AfA
AfD
AG
AGB
AGP
AGs
ah
%E4h
aha
%E4hm
Ahn
Ahr
AHS
Air
AKH
AKP
Akt
AKW
Alb
Alf
ALG
Ali
Alk
all
Alm
Alp
als