Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Support

Pages: 1 ... 5 6 [7] 8 9 ... 59
91
General Discussions / Re: curl https
« on: August 11, 2016, 11:38:06 PM »
I found a set of Windows 32 bit libcurl DLLs and was able to run your example with an extension error using a https based site. I really think this is a Window cURL SSL issue and not a fault with the Script BASIC extension. I'm not sure yet what the error code being returned actually is.

(0): error 0x0008113c:Extension specific error: %s

My guess at this point is the SSL version of the libcurl.dll requires other DLLs to work with HTTPS / SSL sites. These seemed to be included with the Linux version of the library.

92
General Discussions / Re: curl https
« on: August 11, 2016, 11:58:18 AM »
Quote
Can somebody help me?

I gave it a try on Windows 7 and it said my libcurl.dll wasn't found.  I have upgraded my laptop and still migrating my development environment to it. (Linux 64 & Win7 32 bit in a VirtualBox)

I will try to have another look at it today. Unfortunately I'm overwhelmed with real life issues at the moment and can't spend the time I would like with my free time open source efforts. I will do my best to help get us beyond this Windows/ cURL issue.

93
Source / Re: Compiling the scriptbasic source package
« on: August 09, 2016, 10:54:53 PM »
I said I wasn't supporting 32 bit Linux going forward. There is nothing to stop you from compiling it on any 32 bit platform you choose.

Sorry to see you leave so soon.

94
Installation / Re: Compiling ScriptBasic 2.1.0 on a modern Linux
« on: August 09, 2016, 10:49:00 PM »
No problem, glad I could help.

95
Installation / Re: Compiling ScriptBasic 2.1.0 on a modern Linux
« on: August 07, 2016, 06:16:14 PM »
Jerry,

The array.bas example that I inherited with the 2.1 release from Peter Verhas seems to work as intended under Ubuntu 14.04 64 bit. I added a couple newlines for clarity.

Code: Script BASIC
  1. a[5,3]=4
  2. c = a[5]
  3. print a[5,3],"\n",c,"\n"
  4.  


jrs@laptop:~/sb/source/examples$ scriba array.bas
4
ARRAY@#00A706C8
jrs@laptop:~/sb/source/examples$


Something more fun.

Code: Script BASIC
  1.  
  2. a[1000000,1]="one"
  3. a[1000000,2]="two"
  4. a[1000000,3]="three"
  5.  
  6. REF b = a[1000000]
  7.  
  8. PRINT "Simple as ",b[1],", ",b[2],", ",b[3],". (million)\n"
  9.  
  10. b[1] = 1
  11. b[2] = 2
  12. b[3] = 3
  13.  
  14. PRINT a[1000000,1] + a[1000000,2] + a[1000000,3],"\n"
  15.  


jrs@laptop:~/sb/sb22/test$ time scriba reftest.sb
Simple as one, two, three. (million)
6

real   0m0.004s
user   0m0.004s
sys   0m0.000s
jrs@laptop:~/sb/sb22/test$


96
Installation / Re: Compiling ScriptBasic 2.1.0 on a modern Linux
« on: August 06, 2016, 12:32:05 PM »
Please post the code to array.bas.

I'll be happy to take a peek and see what might be the problem.

Quote
Is 2.2.0 less buggy

Script BASIC has been production stable for over 10 years with no known bugs. I think you should look closer at your code.

FYI: Script BASIC will not execute faulty syntax/code and returns an error code instead.

97
Source / Re: Compiling the scriptbasic source package
« on: August 05, 2016, 04:10:31 PM »
I have a Script BASIC Ubuntu 32 bit set of binaries I can send you.

FYI: I'm not supporting 32 bit Linux anymore so you're on your own with it.


98
Source / Re: Compiling the scriptbasic source package
« on: August 04, 2016, 02:01:07 PM »
Okay.

I understand you are primarily looking for a Windows 32 bit distribution but would like a Linux (please specify) set of executables.

Please send me a PM with the best way to get this to you.


99
General Discussions / Re: curl https
« on: August 04, 2016, 11:51:55 AM »
I'll give is a try on Windows 7 and let you know what I find.


100
Source / Re: Compiling the scriptbasic source package
« on: August 03, 2016, 10:35:53 PM »
Are you looking for a Linux or Windows specific distribution?

I have executable versions of Script BASIC 2.2 for most platforms if you don't want to compile the BASIC yourself.

101
General Discussions / Re: curl https
« on: July 20, 2016, 08:38:54 PM »
This works fine for me under Linux.

Code: Script BASIC
  1. Import curl.bas
  2.  
  3. on error goto CURL_ERROR_CURL
  4.  
  5. CURL = curl::init()
  6.  
  7. curl::Option CURL,"CONNECTTIMEOUT",110
  8. curl::option CURL,"FRESH_CONNECT"
  9. curl::option CURL,"BUFFER_SIZE",1024
  10. curl::option CURL,"MAXREDIRS",7
  11. curl::option CURL,"REFERER","https://www.google.com"
  12. curl::option CURL,"USERAGENT","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0"
  13. curl::option CURL,"COOKIEFILE","cookies.txt"
  14. curl::option CURL,"URL","https://www.google.com"
  15. curl::option CURL,"FILE","file.txt"
  16.  
  17. curl::perform CURL
  18. curl::finish CURL
  19.  
  20. stop
  21.  
  22.  
  23. rem ====================
  24.  
  25. CURL_ERROR_CURL:
  26. PRINT "Some error happened while trying to download ScriptBasic home page. The error message is:\n"
  27. PRINT curl::error()
  28.  
  29. STOP
  30.  

102
General Discussions / Re: curl https
« on: July 20, 2016, 04:27:01 PM »
https: support is a libcurl related option. You may want to try a search for libcurll and https usage.

I'm trying to free up some time to have a closer look at this for you.

103
General Discussions / Re: curl https
« on: July 19, 2016, 01:27:05 PM »
Welcome to the forum!

Here is the link to the Script BASIC cURL extension module documentation.

I will try to post an example for you when I get a moment.

104
Business BASIC Migrations / Script BASIC IUP Windows 64 bit
« on: June 11, 2015, 09:10:38 PM »
This is the Online Dictionary example running under Script BASIC for Windows 64 bit. I used my IUP wrapper library to make the code easier to read.

Code: Script BASIC
  1. ' SBx Online Dictionary
  2.  
  3. servers[0]="dict.org"
  4. servers[1]="dict1.us.dict.org"
  5. servers[2]="all.dict.org"
  6.  
  7. about="""This is a Demo
  8. of the IUP GUI Binding
  9. for Scriptbasic"""
  10.  
  11. INCLUDE "SBx"
  12.  
  13. ' Create main window
  14. win = DIALOG()
  15.   SETPROPERTIES win, "TITLE=\"Script BASIC/IUP 64 bit Online Dictionary\", SIZE = 500x300"
  16.   SETEVENT win, "CLOSE_CB", ADDRESS(Win_exit())
  17.  
  18. ' Create container to house ALL GUI objects
  19. vbx = VBOX()
  20.   SETPROPERTIES vbx, "MARGIN=10x10"
  21.  
  22. ' Create server panel
  23. topBox = HBOX()
  24.   SETPROPERTIES topBox, "GAP=10"
  25.   APPEND vbx, topBox
  26. serverFrame = FRAME()
  27.   SETPROPERTIES serverFrame, "TITLE=Servers, EXPAND=YES"
  28.   APPEND topBox, serverFrame
  29. serverBox = HBOX()
  30.   SETPROPERTIES serverBox, "GAP=5"
  31.   APPEND serverFrame, serverBox
  32. serverCombo = LIST()
  33.   SETPROPERTIES serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1"
  34.   APPEND serverBox, serverCombo
  35.   SETEVENT serverCombo, "ACTION", ADDRESS(serverCombo_selected())
  36. btnFetch = BUTTON()
  37.   SETPROPERTIES btnFetch, "TITLE=Fetch, SIZE = 50x"
  38.   APPEND serverBox, btnFetch
  39.   SETEVENT btnFetch, "ACTION", ADDRESS(btnFetch_clicked())
  40.  
  41. ' Create control panel
  42. controlFrame = FRAME()
  43.   SETPROPERTIES controlFrame, "TITLE=Controls"
  44.   APPEND topBox, controlFrame
  45. controlBox = HBOX()
  46.   SETPROPERTIES controlBox, "GAP=5"
  47.   APPEND controlFrame, controlBox
  48. btnAbout = BUTTON()
  49.   SETPROPERTIES btnAbout, "TITLE=About, SIZE = 50x"
  50.   APPEND controlBox, btnAbout
  51.   SETEVENT btnAbout, "ACTION", ADDRESS(btnAbout_clicked())
  52. btnClear = BUTTON()
  53.   SETPROPERTIES btnClear, "TITLE=Clear, SIZE = 50x"
  54.   APPEND controlBox, btnClear
  55.   SETEVENT btnClear, "ACTION", ADDRESS(btnClear_clicked())
  56. btnExit = BUTTON()
  57.   SETPROPERTIES btnExit, "TITLE=Exit, SIZE = 50x"
  58.   APPEND controlBox, btnExit
  59.   SETEVENT btnExit,"ACTION",ADDRESS(Win_exit())
  60.  
  61. ' Create dictionary panel
  62. dictFrame = FRAME()
  63.   SETPROPERTIES dictFrame, "TITLE=\"Dictionaries\""
  64.   APPEND vbx, dictFrame
  65. serverList = LIST()
  66.   SETPROPERTIES serverList, "EXPAND=YES, VISIBLELINES=1"
  67.   APPEND dictFrame, serverList
  68.   SETEVENT serverList, "ACTION", ADDRESS(serverList_selected())
  69.  
  70. ' Create text part
  71. transFrame = FRAME()
  72.   SETPROPERTIES transFrame, "TITLE=\"Translation\""
  73.   APPEND vbx, transFrame
  74. txt = TEXT()
  75.   SETPROPERTIES txt, "MULTILINE=YES, EXPAND=YES"
  76.   APPEND transFrame, txt
  77.  
  78.  
  79. ' Create entry and search button
  80. bottomBox = HBOX()
  81.   SETPROPERTIES bottomBox, "GAP=10"
  82.   APPEND vbx, bottomBox
  83. lbl = LABEL()
  84.   SETPROPERTIES lbl, "TITLE=\"Enter Word to Search For:\", SIZE=x12"
  85.   APPEND bottomBox, lbl
  86. entry = TEXT()
  87.   SETPROPERTIES entry, "EXPAND=HORIZONTAL"
  88.   APPEND bottomBox, entry
  89. btnSearch = BUTTON()
  90.   SETPROPERTIES btnSearch,"TITLE=Search, SIZE=50x"
  91.   APPEND bottomBox, btnSearch
  92.   SETEVENT btnSearch, "ACTION", ADDRESS(btnSearch_clicked())
  93. chkAll = TOGGLE()
  94.   SETPROPERTIES chkAll, "TITLE=ALL, SIZE=x12"
  95.   APPEND bottomBox, chkAll
  96. chkUTF = TOGGLE()
  97.   SETPROPERTIES chkUTF, "TITLE=UTF-8, SIZE=x12"
  98.   APPEND bottomBox, chkUTF
  99.  
  100. ' Add the main GUI container to the Window
  101. APPEND win, vbx
  102.  
  103. ' Setup dialog defaults
  104. SHOW win
  105. FOCUS btnFetch
  106. FOR i = 0 TO UBOUND(servers)
  107.   SETPROPERTY serverCombo, "APPENDITEM", servers[i]
  108. NEXT
  109. SETPROPERTY serverCombo, "VALUE", "1"
  110. UPDATE serverCombo
  111. server_selection = servers[0]
  112. GETEVENT()
  113. END
  114.  
  115.  
  116. ' Callback routines
  117.  
  118. SUB Win_exit
  119.   Iup::ExitLoop = TRUE
  120. END SUB
  121.  
  122. SUB btnAbout_clicked
  123.   MESSAGE "ABOUT", about
  124. END SUB
  125.  
  126. SUB serverCombo_selected
  127.   server_selection = GETITEM()
  128. END SUB
  129.  
  130. SUB serverList_selected
  131.   whichDictionary = GETITEM()
  132. END SUB
  133.  
  134. SUB btnFetch_clicked
  135.   LOCAL dat, total, count
  136.   ON ERROR GOTO G_NetError
  137.   OPEN server_selection & ":2628" FOR SOCKET AS #1
  138.   PRINT#1,"SHOW DB\n"
  139.   LINE INPUT#1, dat
  140.   LINE INPUT#1, dat
  141.   count = 0
  142.   WHILE LEFT(dat, 1) <> "."
  143.     LINE INPUT#1, dat
  144.     IF LEFT(dat, 1) <> "." THEN total[count] = TRIM(dat)
  145.     count+=1
  146.   WEND
  147.   PRINT#1,"QUIT\n"
  148.   CLOSE(#1)
  149.   FOR cnt = 0 TO count - 2
  150.     SETPROPERTY serverList, "APPENDITEM", total[cnt]
  151.   NEXT
  152.   SETPROPERTY serverList, "VALUE", "1"
  153.   UPDATE serverCombo
  154.   whichDictionary = total[0]
  155.   EXIT SUB
  156.  
  157.   G_NetError:
  158.   PRINT "Server ",server_selection," not available. (",ERROR,")\n"
  159. END SUB
  160.  
  161. SUB btnClear_clicked
  162.   CLEAR serverList
  163.   SETPROPERTY txt, "VALUE", ""
  164.   SETPROPERTY entry, "VALUE", ""
  165. END SUB
  166.  
  167. SUB btnSearch_clicked
  168.   LOCAL dict, dat, total, info
  169.   SETPROPERTY txt, "VALUE", "Fetching...."
  170.   ON ERROR GOTO L_NetError
  171.   dict = LEFT(whichDictionary, INSTR(whichDictionary, " "))
  172.   OPEN server_selection & ":2628" FOR SOCKET AS 1
  173.   IF GETPROPERTY(chkAll, "VALUE") THEN
  174.     PRINT#1,"DEFINE * " & GETPROPERTY(entry, "VALUE") & "\n"
  175.   ELSE
  176.     PRINT#1,"DEFINE " & dict & " " & GETPROPERTY(entry, "VALUE") & "\n"
  177.   END IF
  178.   REPEAT
  179.     LINE INPUT#1, dat
  180.     IF LEFT(dat, 3) = "151" THEN
  181.       total &= "------------------------------\r\n"
  182.       total &= RIGHT(dat, LEN(dat) - LEN(GETPROPERTY(entry, "VALUE")) - LEN(dict))
  183.       total &= "------------------------------\r\n"
  184.       REPEAT
  185.         LINE INPUT#1, info
  186.         info = REPLACE(info, CHR(34), CHR(92) & CHR(34))
  187.         IF LEFT(info, 1) <> "." THEN total &= TRIM(info) & "\n"
  188.       UNTIL LEFT(info, 1) = "."
  189.       total &= "\n"
  190.     END IF
  191.   UNTIL LEFT(dat, 3) = "250" OR VAL(LEFT(dat, 3)) > 499
  192.   PRINT#1,"QUIT\n"
  193.   CLOSE(#1)
  194.   IF LEFT(dat, 3) = "552" THEN
  195.     total = "No match found."
  196.   ELSE IF LEFT(dat, 3) = "501" THEN
  197.     total = "Select a dictionary first!"
  198.   ELSE IF LEFT(dat, 3) = "550" THEN
  199.     total = "Invalid database!"
  200.   END IF
  201.   SETPROPERTY txt, "VALUE", total
  202. EXIT SUB
  203.  
  204. L_NetError:
  205.   dat[0] = "Could not lookup word! (" & ERROR & ")"
  206.   SETPROPERTY txt, "VALUE", dat
  207. END SUB
  208.  

105
Business BASIC Migrations / ProvideX Linux 64 IUP
« on: June 10, 2015, 11:00:34 PM »
Here is an example of an online dictionary program written in ProvideX (PxBasic) for Ubuntu 64 bit and using the IUP (Portable User Interface) with an interface shared object I wrote.

Update: I included a screen shot of the Windows version of ProvideX and IUP. Theming isn't working but the goal was to show the same PVX code running native GUI on Linux and Windows.

Code: Text
  1. ! Online Dictionary - Px* + IUP
  2.  
  3. BEGIN
  4.  
  5. lib = DLL(ADDR "/home/jrs/pxbasic/pxbiup.so")
  6.  
  7. DIM servers$[0]
  8. servers$[0]="dict.org"
  9.  
  10. about$ = "ProvideX IUP Binding"
  11.  
  12. ! Initialize IUP
  13. ok = DLL(lib, "IupOpen")
  14.  
  15. ! Create main window
  16.  
  17. win = DLL(lib, "IupCreate", "dialog"+$00$)
  18.   ok = DLL(lib, "IupSetAttributes", win, "TITLE="+QUO+"Online Dictionary - ProvideX/IUP"+QUO+", SIZE=500x300"+$00$)
  19.   ok = DLL(lib, "PxBSetCallback", win,"CLOSE_CB"+$00$)
  20.  
  21. ! Create container to house ALL GUI objects
  22.  
  23. vbox = DLL(lib, "IupCreate", "vbox"+$00$)
  24.   ok = DLL(lib, "IupSetAttributes", vbox, "MARGIN=10x10"+$00$)
  25.  
  26. ! Create server panel
  27.  
  28. topBox = DLL(lib, "IupCreate", "hbox"+$00$)
  29.   ok = DLL(lib, "IupSetAttributes", topBox, "GAP=10"+$00$)
  30.   ok = DLL(lib, "IupAppend", vbox, topBox)
  31. serverFrame = DLL(lib, "IupCreate", "frame"+$00$)
  32.   ok = DLL(lib, "IupSetAttributes", serverFrame, "TITLE=Servers, EXPAND=YES"+$00$)
  33.   ok = DLL(lib, "IupAppend", topBox, serverFrame)
  34. serverBox = DLL(lib, "IupCreate", "hbox"+$00$)
  35.   ok = DLL(lib, "IupSetAttributes", serverBox, "GAP=5"+$00$)
  36.   ok = DLL(lib, "IupAppend", serverFrame, serverBox)
  37. serverCombo = DLL(lib, "IupCreate", "list"+$00$)
  38.   ok = DLL(lib, "IupSetAttributes", serverCombo, "DROPDOWN=YES, SIZE=120x, EXPAND=HORIZONTAL, VALUE=1"+$00$)
  39.   ok = DLL(lib, "IupAppend", serverBox, serverCombo)
  40.   ok = DLL(lib, "PxBSetCallback", serverCombo, "ACTION"+$00$)
  41. btnFetch = DLL(lib, "IupCreate", "button"+$00$)
  42.   ok = DLL(lib, "IupSetAttributes", btnFetch, "TITLE=Fetch, SIZE = 50x"+$00$)
  43.   ok = DLL(lib, "IupAppend", serverBox, btnFetch)
  44.   ok = DLL(lib, "PxBSetCallback", btnFetch, "ACTION"+$00$)
  45.  
  46. ! Create control panel
  47.  
  48. controlFrame = DLL(lib, "IupCreate", "frame"+$00$)
  49.   ok = DLL(lib, "IupSetAttributes", controlFrame, "TITLE=Controls"+$00$)
  50.   ok = DLL(lib, "IupAppend", topBox, controlFrame)
  51. controlBox = DLL(lib, "IupCreate", "hbox"+$00$)
  52.   ok = DLL(lib, "IupSetAttributes", controlBox, "GAP=5"+$00$)
  53.   ok = DLL(lib, "IupAppend", controlFrame, controlBox)
  54. btnAbout = DLL(lib, "IupCreate", "button"+$00$)
  55.   ok = DLL(lib, "IupSetAttributes", btnAbout, "TITLE=About, SIZE = 50x"+$00$)
  56.   ok = DLL(lib, "IupAppend", controlBox, btnAbout)
  57.   ok = DLL(lib, "PxBSetCallback", btnAbout, "ACTION"+$00$)
  58. btnClear = DLL(lib, "IupCreate", "button"+$00$)
  59.   ok = DLL(lib, "IupSetAttributes", btnClear, "TITLE=Clear, SIZE = 50x"+$00$)
  60.   ok = DLL(lib, "IupAppend", controlBox, btnClear)
  61.   ok = DLL(lib, "PxBSetCallback", btnClear, "ACTION"+$00$)
  62. btnExit = DLL(lib, "IupCreate", "button"+$00$)
  63.   ok = DLL(lib, "IupSetAttributes", btnExit, "TITLE=Exit, SIZE = 50x"+$00$)
  64.   ok = DLL(lib, "IupAppend", controlBox, btnExit)
  65.   ok = DLL(lib, "PxBSetCallback", btnExit,"ACTION"+$00$)
  66.  
  67. ! Create dictionary panel
  68.  
  69. dictFrame = DLL(lib, "IupCreate", "frame"+$00$)
  70.   ok = DLL(lib, "IupSetAttributes", dictFrame, "TITLE=Dictionaries"+$00$)
  71.   ok = DLL(lib, "IupAppend", vbox, dictFrame)
  72. serverList = DLL(lib, "IupCreate", "list"+$00$)
  73.   ok = DLL(lib, "IupSetAttributes", serverList, "EXPAND=YES, VISIBLELINES=1"+$00$)
  74.   ok = DLL(lib, "IupAppend", dictFrame, serverList)
  75.   ok = DLL(lib, "PxBSetCallback", serverList, "ACTION"+$00$)
  76.  
  77. ! Create text part
  78.  
  79. transFrame = DLL(lib, "IupCreate", "frame"+$00$)
  80.   ok = DLL(lib, "IupSetAttributes", transFrame, "TITLE=Translation"+$00$)
  81.   ok = DLL(lib, "IupAppend", vbox, transFrame)
  82. text = DLL(lib, "IupCreate", "text"+$00$)
  83.   ok = DLL(lib, "IupSetAttributes", text, "MULTILINE=YES, EXPAND=YES"+$00$)
  84.   ok = DLL(lib, "IupAppend", transFrame, text)
  85.  
  86. ! Create entry and search button
  87.  
  88. bottomBox = DLL(lib, "IupCreate", "hbox"+$00$)
  89.   ok = DLL(lib, "IupSetAttributes", bottomBox, "GAP=10"+$00$)
  90.   ok = DLL(lib, "IupAppend", vbox, bottomBox)
  91. label = DLL(lib, "IupCreate", "label"+$00$)
  92.   ok = DLL(lib, "IupSetAttributes", label, "TITLE="+QUO+"Enter Word to Search For:"+QUO+", SIZE=x12"+$00$)
  93.   ok = DLL(lib, "IupAppend", bottomBox, label)
  94. entry = DLL(lib, "IupCreate", "text"+$00$)
  95.   ok = DLL(lib, "IupSetAttributes", entry, "EXPAND=HORIZONTAL"+$00$)
  96.   ok = DLL(lib, "IupAppend", bottomBox, entry)
  97. btnSearch = DLL(lib, "IupCreate", "button"+$00$)
  98.   ok = DLL(lib, "IupSetAttributes", btnSearch, "TITLE=Search, SIZE=50x"+$00$)
  99.   ok = DLL(lib, "IupAppend", bottomBox, btnSearch)
  100.   ok = DLL(lib, "PxBSetCallback", btnSearch, "ACTION"+$00$)
  101. chkAll = DLL(lib, "IupCreate","toggle"+$00$)
  102.   ok = DLL(lib, "IupSetAttributes", chkAll, "TITLE=ALL, SIZE=x12"+$00$)
  103.   ok = DLL(lib, "IupAppend", bottomBox, chkAll)
  104. chkUTF = DLL(lib, "IupCreate", "toggle"+$00$)
  105.   ok = DLL(lib, "IupSetAttributes", chkUTF, "TITLE=UTF-8, SIZE=x12"+$00$)
  106.   ok = DLL(lib, "IupAppend", bottomBox, chkUTF)
  107.  
  108. ! Add the main GUI container to the Window
  109.  
  110. ok = DLL(lib, "IupAppend", win, vbox)
  111.  
  112. ! Setup dialog defaults
  113.  
  114. ok = DLL(lib, "IupShow", win)
  115. ok = DLL(lib, "IupSetFocus", btnFetch)
  116. FOR i = 0 TO DIM(READ MAX(servers$))
  117.   ok = DLL(lib, "IupSetAttribute", serverCombo, "APPENDITEM"+$00$, servers$[i]+$00$)
  118. NEXT
  119. ok = DLL(lib, "IupSetAttribute", serverCombo, "VALUE"+$00$, "1"+$00$)
  120. ok = DLL(lib, "IupUpdate", serverCombo)
  121. server_selection$ = servers$[0]
  122.  
  123. ! Main processing loop
  124.  
  125. REPEAT
  126.   WAIT: ok = DLL(lib, "IupLoopStepWait")
  127.   this_event = DLL(lib, "GetEvent")
  128.   IF NOT(this_event) THEN GOTO WAIT
  129.   SWITCH this_event
  130.     CASE serverCombo
  131.       GOSUB serverCombo_selected
  132.       BREAK
  133.     CASE btnFetch
  134.       GOSUB btnFetch_clicked
  135.       BREAK
  136.     CASE btnAbout
  137.       GOSUB btnAbout_clicked
  138.       BREAK
  139.     CASE btnClear
  140.       GOSUB btnClear_clicked
  141.       BREAK
  142.     CASE serverList
  143.       GOSUB serverList_selected
  144.       BREAK
  145.     CASE btnSearch
  146.       GOSUB btnSearch_clicked
  147.       BREAK
  148.   END SWITCH
  149. UNTIL this_event = win OR this_event = btnExit
  150. ok = DLL(lib, "IupClose")
  151. ok = DLL(DROP lib)
  152. END
  153.  
  154. ! Callback routines
  155.  
  156. btnAbout_clicked:
  157.   ok = DLL(lib, "IupMessage", "ABOUT"+$00$, about$)
  158. RETURN
  159.  
  160. serverCombo_selected:
  161.   DIM server_selection$(1024)
  162.   ok = DLL(lib, "GetListSelectedText", server_selection$)
  163.   server_selection$ = STP(server_selection$, 2)
  164. RETURN
  165.  
  166. serverList_selected:
  167.   DIM whichDictionary$(1024)
  168.   ok = DLL(lib, "GetListSelectedText", whichDictionary$)
  169.   whichDictionary$ = STP(whichDictionary$, 2)
  170. RETURN
  171.  
  172. btnFetch_clicked:
  173.   dat$ = ""
  174.   DIM _total$[*]
  175.   count = 1
  176.   OPEN (1,BSZ=16384)"[TCP]"+server_selection$+";2628;NoDelay;stream"
  177.   WRITE (1)"SHOW DB"+$0D0A$
  178.   REPEAT
  179.     READ(1)raw_data$
  180.     dat$ = dat$ + raw_data$
  181.   UNTIL POS("250 ok" = raw_data$)
  182.   WRITE(1)"QUIT"+$0D0A$
  183.   CLOSE(1)
  184.   REPEAT
  185.     eol = POS($0D0A$=dat$)
  186.     _total$[count] = dat$(1,eol - 1)
  187.     dat$ = dat$(eol + 2)
  188.     count += 1
  189.   UNTIL dat$ = ""
  190.   FOR cnt = 3 TO count - 3
  191.     ok = DLL(lib, "IupSetAttribute", serverList, "APPENDITEM"+$00$, _total$[cnt]+$00$)
  192.    NEXT cnt
  193.   ok = DLL(lib, "IupSetAttribute", serverList, "APPENDITEM"+$00$, _total$[3]+$00$)
  194.   ok = DLL(lib, "IupSetAttribute", serverList, "VALUE"+$00$, "1"+$00$)
  195.   ok = DLL(lib, "IupUpdate", serverCombo)
  196.   whichDictionary$ = _total$[3]
  197. RETURN
  198.  
  199. G_NetError:
  200.   PRINT "Server ",server_selection$," not available. (",ERROR,")"
  201. RETURN
  202.  
  203. btnClear_clicked:
  204.   ok = DLL(lib, "IupSetAttribute", serverList,"1"+$00$)
  205.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, ""+$00$)
  206.   ok = DLL(lib, "IupSetAttribute", entry, "VALUE"+$00$, ""+$00$)
  207. RETURN
  208.  
  209. btnSearch_clicked:
  210.   dict$ = ""
  211.   dat$ = ""
  212.   total$ = ""
  213.   info$ = ""
  214.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, "Fetching...."+$00$)
  215.   dict$ = whichDictionary$(1, POS(" " = whichDictionary$) - 1)
  216.   OPEN (1,BSZ=16384)"[TCP]"+server_selection$+";2628;NoDelay;stream"
  217.   chkval$ = FNIupGetString$(DLL(lib, "IupGetAttribute", chkAll, "VALUE"+$00$))
  218.   IF chkval$ = "ON" THEN {
  219.     WRITE(1)"DEFINE * " + FNIupGetString$(DLL(lib, "IupGetAttribute", entry,"VALUE"+$00$)) + $0D0A$
  220.   } ELSE {
  221.     WRITE(1)"DEFINE " + dict$ + " " + FNIupGetString$(DLL(lib, "IupGetAttribute", entry,"VALUE"+$00$)) + $0D0A$
  222.   }
  223.   REPEAT
  224.     READ(1)raw_data$
  225.     data_str$ = data_str$ + raw_data$
  226.   UNTIL POS("250 ok [d/m/c =" = raw_data$)
  227.   WRITE(1)"QUIT"+$0D0A$
  228.   CLOSE(1)
  229.   ! Remove header
  230.   data_str$ = data_str$(POS($0D0A$=data_str$, 1, 2) + 2)
  231.   REPEAT
  232.     eol = POS($0D0A$=data_str$)
  233.     dat$ = data_str$(1,eol - 1)
  234.     data_str$ = data_str$(eol + 2)
  235.     IF dat$(1, 3) <> "151" THEN GOTO IT
  236.       entstr$ = FNIupGetString$(DLL(lib, "IupGetAttribute", entry, "VALUE"+$00$))
  237.       total$ = total$ + "------------------------------" + $0D0A$
  238.       total$ = total$ + dat$(2 + LEN(entstr$) + LEN(dict$)) + $0D0A$
  239.       total$ = total$ + "------------------------------"+ $0D0A$
  240.       REPEAT
  241.         eol = POS($0D0A$=data_str$)
  242.         info$ = data_str$(1,eol - 1)
  243.         data_str$ = data_str$(eol + 2)
  244.         info$ = SUB(info$, CHR(34), CHR(92) + CHR(34))
  245.         IF LEN(info$) AND info$(1, 1) <> "." THEN total$ += STP(info$, 2) + $0D0A$
  246.       UNTIL info$ > "" AND info$(1, 1) = "."
  247.       total$ += $0D0A$
  248.     IT:
  249.   UNTIL data_str$(1, 3) = "250" OR NUM(data_str$(1, 3)) > 499
  250.   IF dat$(1, 3) = "552" THEN total$ = "No match found."
  251.   IF dat$(1, 3) = "501" THEN total$ = "Select a dictionary first!"
  252.   IF dat$(1, 3) = "550" THEN total$ = "Invalid database!"
  253.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, total$+$00$)
  254. RETURN
  255.  
  256. L_NetError:
  257.   dat$ = "Could not lookup word! (" + STR(ERR) + ")"
  258.   ok = DLL(lib, "IupSetAttribute", text, "VALUE"+$00$, dat$+$00$)
  259. RETURN
  260.  
  261. ! DLL() return string emulator
  262.  
  263. DEF FNIupGetString$(LOCAL i_ptr)
  264.   LOCAL strlen, pxbuff$
  265.   DIM pxbuff$(4096)
  266.   strlen = DLL(lib, "ptr2pxbstr", i_ptr, pxbuff$)
  267.   RETURN pxbuff$(1,strlen)
  268. END DEF
  269.  


Pages: 1 ... 5 6 [7] 8 9 ... 59