home *** CD-ROM | disk | FTP | other *** search
/ Enter 1997 November / Enter1197.iso / INTERNET / ARACHNE / DGI.TXT < prev    next >
Encoding:
Text File  |  1997-01-26  |  5.4 KB  |  142 lines

  1.  
  2. DGI - Dos Gateway Interface
  3. ---------------------------
  4.  
  5. xChaos software anounces new chance for developers of DOS applications - DGI.
  6.  
  7. Today, there are crowds of programers of all ages, who know how to
  8. write simple command-line text-mode applications in different programming
  9. languages, including DOS shell (*.BAT), Basic, C, Turbo Pascal, etc.
  10. But the common usage of window-oriented operating systems made it hard for
  11. these programmers to make their programs easy-to use for common users, who are
  12. expecting graphical interface.
  13.  
  14. However, there appeared new, even easier communication standart than windows
  15. - WWW pages. It is both easier to use and easier to create than windows
  16. applications, and it is possible to use also much more beautiful design.
  17. (Note: I'm speaking about windows based interfaces generaly, not about
  18. Micorosoft (TM) Windows (TM), also known as "Windoze", or "Wir95").
  19. The application enviroment and word of explanation (help, manual) are
  20. perfectly intgrated in WWW applications, based on so-called CGI (common
  21. gateway interface). CGI is thousand times more popular than Java, partly
  22. because all browsers support CGI forms, and partly because CGI scripts are
  23. in fact simple text-mode applications in many different programming languages.
  24.  
  25. My idea is: you don't have to run CGI's on server - you can run it in DOS!
  26. If you want do distribute CD-ROM with default WWW browser, and if you want
  27. to use CGI scripts instead of Java or Javascript, you should try Arachne.
  28. It will be called DGI (Dos Gateway Interface) instead of CGI (Common
  29. Gateway Interface). Just copy your scripts from server to your PC and
  30. run them ! (of course, the opposite process - developing of CGI in DOS
  31. enviroment is also possible. DOS debugging tools are often more user friendly
  32. than those running at Un*x command line...).
  33.  
  34. All you need is browser supporting DGI calls - for example Arachne.
  35.  
  36.  
  37. What is DGI program ?
  38. ---------------------
  39.  
  40. DGI must be DOS executable (it means even *.BAT !) able to read standart CGI
  41. query string from stdin or from file specified as program argument and must
  42. be able to output HTML page to stdout or file specified as program argument.
  43. DGI should work only with files and standart input/output; not with
  44. video memory, either in text or graphics mode. That's all.
  45.  
  46.  
  47. How to add DGI to Arachne ?
  48. ---------------------------
  49.  
  50. Arachne uses configuration file MIME.CFG for configuring plugins and DGI
  51. applications. It will be necessary to write simple setup program for DGI
  52. application which will ask for directory where Arachne and MIME.CFG is
  53. installed and than modify it. It is simillar to installing Windows programs.
  54.  
  55. Line added in MIME.CFG can look for example like that:
  56.  
  57. file/myapp.cgi    >HTM|[200]c:\myapp\myapp.exe -q%s>%2
  58.  
  59. Syntax of MIME.CFG up to [200] symbol is not important; it is included
  60. in the comments in MIME.CFG. The command line itself says: "Execute
  61. c:\myapp\myapp.exe with at least 200 kb of DOS memory free, post the
  62. CGI query string as an argument called -q and redirect output to file
  63. with extension HTM which will be displayed after finishing program.
  64.  
  65. So the command assembled by Arachne can look for example like:
  66.  
  67. c:\myapp\myapp.exe -qSEARCHFOR=SOME+WORDS&MODE=1>TMP.HTM
  68.  
  69.  
  70. How to add DGI to HTML pages ?
  71. ------------------------------
  72.  
  73. It is clear, that same HTML pages will be used on WWW server and in
  74. DGI application. So for calling DGI described in previous example use
  75. following <FORM> tag syntax:
  76.  
  77. <FORM ACTION="myapp.cgi">
  78.  
  79. After putting this page online, just create script "myapp.cgi" in the
  80. same directory as the page is located and make it do the same job as
  81. prgram myapp.exe.
  82.  
  83.  
  84.  
  85. Full MIME.CFG syntax
  86. --------------------
  87.  
  88. Arachne uses standart mime types, and also special "DOS mime types"
  89. called "file/...", because is DOS the file type is specified by extension.
  90.  
  91. -viewer plug-in:
  92.  
  93. mime_type   [save_extension]|command
  94.  
  95. (examples)
  96.  
  97. video/mpeg    MPG|@mpeg.exe %1
  98. file/.mpg     |@mpeg.exe %1
  99.  
  100. -convertor plug-in or DGI:
  101.  
  102. mime_type   [original_extension]>new_extension|command
  103.  
  104. (examples)
  105.  
  106. file/*        >HTM|[150]htmldir -u%u>%2
  107. file/dir.cgi  >HTM|[150]htmldir -u%u -q%s>%2
  108. file/xapp.cgi >HTM|[100]c:\xapp\xapp.exe<%q>%2
  109.  
  110. -commands syntax:
  111.  
  112. prefix @   : set text mode and swap Arachne out
  113. prefix [nn]: keep graphics mode and swap if there is less than [nn] kb free
  114. no prefix  : keep graphics mode and always swap Arachne out
  115.  
  116. %1,$1 ... full input filename
  117. %2,$2 ... full output filename
  118. %u,$u ... url of document
  119. %h,$h ... host (telnet://cyberspace.org -> cyberspace.org)
  120. %d,$d ... file (ftp://ftp.vse.cz/pub/msdos/Arachne/ -> /pub/msdos/Arachne/)
  121. %q,$q ... name of file with query string (is created only when using this macro)
  122. %s,$s ... CGI compatible query string (max. 80 characters)
  123. %c,$c ... full name of cache index (TOHLEUZ.MAM)
  124. %h,$h ... history file (TADYJSEM.BYL)
  125.  
  126. %q, %1 and %2 can be nonexistent files, both plug-in (or DGI) and Arachne
  127. must be prepared for everything. The only rule: it's ok to exit and do
  128. nothing, as long as you do not crash the system.
  129.  
  130. See TESTDGI.HTM for more information.
  131.  
  132. CGI-QUERY syntax - open standart, already in use on Internet
  133. -----------------
  134.  
  135. <variable_name>=[<value>][&<variable_name>=[<value>]...]
  136.  
  137. For example 'NAME=John+Brown&PHONE=123456'
  138.  
  139. Spaces are replaced with '+', non-alphanumeric charactes by sequence
  140. '%NN', where NN is upercase hexadecimal ASCII code ('%0D' = 'Carriage return'
  141. alias ASCII 13).
  142.