home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Programming / PureBasic / PureBasic_2.32_Demo / Extras / CygnusEd / PB_GetSyntax.ced < prev    next >
Encoding:
Text File  |  2001-01-16  |  4.2 KB  |  165 lines

  1. /* $VER: PB_GetSyntax.ced ENG 1.2 (24-Oct-2000) by A.Greve */
  2.  
  3. sourcepath = 'PureBasic:Projects'
  4. cedname    = 'CED:Ed'
  5. temp_s     = 'T:pb_srch.txt'
  6. temp_l     = 'T:pb_link.txt'
  7. fkey1      = 1
  8. fkey2      = 2
  9.  
  10. /**********************************************************/
  11. /**  Don't change the code below these lines, unless     **/
  12. /**  You know what You're doin'...                       **/
  13. /**********************************************************/
  14.  
  15. cedscript1 = 'PureBasic:Extras/CygnusEd/PB_GetSyntax.ced'
  16. cedscript2 = 'PureBasic:Extras/CygnusEd/PB_SaveCompile.ced'
  17. indexfile  = 'PureBasic:Help/IndexAll.guide'
  18. lf = '0a'x; qu = '22'x
  19. link = '@{'qu
  20. msg1b = 'Could''t open <'
  21. msg1c = 'Could''t create <'
  22. msg1d = 'Could''t find and install <'
  23.  
  24. IF sourcepath == 'SOURCEPATH' THEN sourcepath = 'PureBasic:'
  25. IF cedname    == 'CEDNAME'    THEN cedname    = 'ed'
  26. IF temp_s     == 'TEMP_S'     THEN temp_s     = 'T:pb_srch.txt'
  27. IF temp_l     == 'TEMP_L'     THEN temp_l     = 'T:pb_link.txt'
  28. IF (fkey1 < 1) | (fkey1 > 10) | (fkey1 == 'FKEY1') THEN fkey1 = 1
  29. IF (fkey2 < 1) | (fkey2 > 10) | (fkey2 == 'FKEY2') THEN fkey2 = 2
  30.  
  31. OPTIONS RESULTS
  32. PARSE ARG srcfile
  33.  
  34. IF ADDRESS() = 'REXX' THEN DO
  35.     IF SHOW(p,'CYGNUSED') THEN DO
  36.         ADDRESS 'CYGNUSED'
  37.         CEDTOFRONT
  38.         IF srcfile ~= '' THEN DO
  39.             OPEN NEW
  40.             IF ~RESULT THEN OKAY1 "Couldn't open a new View!"
  41.             ELSE OPEN qu''srcfile''qu
  42.         END
  43.         InstScript()
  44.     END
  45.     ELSE DO
  46.         IF ~SHOW('L','rexxsupport.library') THEN DO
  47.             IF ~ADDLIB('rexxsupport.library',10,-30,0) THEN DO
  48.                 SAY msg1b'rexxsupport.library> !'
  49.                 EXIT(0)
  50.             END
  51.         END
  52.         IF ~SHOW('L','rexxtricks.library') THEN DO
  53.             IF ~ADDLIB('rexxtricks.library',10,-30,0) THEN DO
  54.                 SAY msg1b'rexxtricks.library> !'
  55.                 EXIT(0)
  56.             END
  57.         END
  58.         IF ~SHOW('L','rexxreqtools.library') THEN DO
  59.             IF ~ADDLIB('rexxreqtools.library',10,-30,0) THEN DO
  60.                 SAY msg1b'rexxreqtools.library> !'
  61.                 EXIT(0)
  62.             END
  63.         END
  64.         IF ~SHOW('L','amigaguide.library') THEN DO
  65.             IF ~ADDLIB('amigaguide.library',10,-30,0) THEN DO
  66.                 SAY msg1b'amigaguide.library> !'
  67.                 EXIT(0)
  68.             END
  69.         END
  70.  
  71.         IF srcfile = '' THEN DO
  72.             filename = RTFILEREQUEST(sourcepath,,'Please select a PureBasic script...',,,
  73.                           'rtfi_matchpat=#?.pb rtfi_flags=freqf_patgad')
  74.             IF filename ~= '' THEN ADDRESS COMMAND cedname' 'qu''filename''qu
  75.             ELSE ADDRESS COMMAND cedname
  76.         END
  77.         ELSE ADDRESS COMMAND cedname' 'qu''srcfile''qu
  78.  
  79.         ADDRESS 'CYGNUSED'
  80.         CEDTOFRONT
  81.         InstScript()
  82.  
  83.         IF READFILE(indexfile, 'index') THEN DO
  84.             j = 0
  85.             DO i = 1 TO index.0
  86.                 IF WORD(index.i, 1) = link THEN DO
  87.                     j = j + 1
  88.                     indsrch.j = WORD(index.i, 2)
  89.                     tmp = WORD(index.i, 5)
  90.                     indlink.j = LEFT(tmp, LENGTH(tmp) - 1)
  91.                     indlink.j = CENTER(indlink.j, LENGTH(indlink.j) - 2)
  92.                 END
  93.             END
  94.             DROP index.
  95.             indsrch.0 = j; indlink.0 = j
  96.             IF ~WRITEFILE(temp_s, 'indsrch') THEN DO
  97.                 SAY msg1c''temp_s'> !'
  98.                 EXIT(0)
  99.             END
  100.             IF ~WRITEFILE(temp_l, 'indlink') THEN DO
  101.                 SAY msg1c''temp_l'> !'
  102.                 EXIT(0)
  103.             END
  104.         END
  105.         ELSE SAY msg1b''indexfile'> !'
  106.  
  107.         EXIT(0)
  108.     END
  109. END
  110.  
  111. ADDRESS COMMAND 'Version >NIL: amigaguide.library 40'
  112. aguidever = RC
  113.  
  114. IF ~READFILE(temp_s, 'indsrch') THEN DO
  115.     SAY msg1b''temp_s'> !'
  116.     EXIT(0)
  117. END
  118. IF ~READFILE(temp_l, 'indlink') THEN DO
  119.     SAY msg1b''temp_l'> !'
  120.     EXIT(0)
  121. END
  122.  
  123. CEDTOFRONT
  124. GETWORD
  125. theword = RESULT
  126. IF RIGHT(theword, 1) == lf THEN
  127.     theword = LEFT(theword, LENGTH(theword) - 1)
  128. GETCHAR
  129. thechar = RESULT
  130. charpos = INDEX('#&()*:;@\', thechar)
  131. IF (theword ~= 0) | (charpos > 0) THEN DO
  132.     SELECT
  133.         WHEN charpos > 0 THEN theword = thechar
  134.         WHEN FIND('B L S UB UL UW W', UPPER(theword)) > 0 THEN DO
  135.             LEFT
  136.             GETWORD
  137.             IF RESULT = '.' THEN theword = '.'theword
  138.             RIGHT
  139.         END
  140.     OTHERWISE
  141.         NOP
  142.     END
  143.     num = RXTR_LSEARCH(theword, 'indsrch', 1)
  144.        IF num > 0 THEN DO
  145.         STATUS PUBSCREENNAME
  146.         ps_name = RESULT
  147.         IF ps_name == '' THEN ps_name = 'Workbench'
  148.  
  149.         IF aguidever = 5 THEN
  150.             CALL SHOWNODE(ps_name, RXTR_PATHPART(indlink.num), RXTR_FILEPART(indlink.num),)
  151.         ELSE
  152.             CALL SHOWNODE(ps_name, RXTR_PATHPART(indlink.num), RXTR_FILEPART(indlink.num),,)
  153.     END
  154.     ELSE OKAY1 'Couldn''t get information about'lf'<'theword'> !'
  155. END
  156. EXIT(0)
  157.  
  158. InstScript:
  159.     IF EXISTS(cedscript1) THEN "INSTALL DOS/AREXX COMMAND" fkey1 cedscript1
  160.     ELSE SAY msg1d''cedscript1'> !'
  161.  
  162.     IF EXISTS(cedscript2) THEN "INSTALL DOS/AREXX COMMAND" fkey2 cedscript2
  163.     ELSE SAY msg1d''cedscript2'> !'
  164. RETURN 0
  165.