      SUBROUTINE PC.SUB(OBJ)
*PRE-COMPILER
*
*DEV TRIAL RT
*BASIC
*N
*     PRECISION 6
*
************************************************************************
************************************************************************
***                                                                  ***
*** PICK PARSING PRE-COMPILER SYSTEM                                 ***
***                                                                  ***
*** COPYRIGHT 1988 MODULAR SOFTWARE                                  ***
***                P.O. BOX 204                                      ***
***                ATLANTA, GA  30291                                ***
***                (404) 964 - 7171                                  ***
***                                                                  ***
*** THIS PROGRAM IS PROPRIETARY TO MODULAR SOFTWARE AND MAY NOT BE   ***
*** USED, COPIED, EXAMINED, OR DISCLOSED WITHOUT A VALID LICENSE     ***
*** FROM MODULAR SOFTWARE.                                           ***
***                                                                  ***
************************************************************************
************************************************************************
*
*
* Subroutine to compile a single line into object format
*
* This routine operates in the following manner
*
* 1.  Check to see if any of the KEYWORDS are present.  If not return
*     with OBJ unchanged
*
* 2.  Split the line into statements along semicolons and process each
*     statement seperately.
*
* 3.  Check each statement to see if it is a comment and if so skip the
*     rest of the processing.  The comment is passed along as a single
*     asterisk.
*
* 4.  If the statement is not a comment, starting at the back end of the
*     statement lookup for:
*
*     a. KEYWORDS
*     b. Syntax matches
*
*     This search proceedure proceeded forward one element at a time
*     until a match is found.  If the match does not extend to the
*     end of the statement, a POST.OBJ is used to hold the post-object
*     elements for later recombining with the rebuilt statement.
*
* 5.  The statement, upon recompiling will consist of the following
*     elements:
*
*     a. A pre-string stored in PRE.OBJ which is used to store function
*        call statements that are assigned into variables FN$$$#.
*     b. The re-compiled statement.
*
      $INCLUDE PC.COMMON
*
*======================================================================
*
* Check for FUNCTION CALLS
*
      IF INDEX(OBJ,SVM,1) THEN
         FLG = YES
      END ELSE
         FLG = NO
         FOR I = 1 TO KW.AC UNTIL FLG
            IF INDEX(OBJ,KW.A<I>,1) THEN FLG = YES
         NEXT I
      END
*
      IF FLG THEN
         S = OBJ
         IF INDEX(OBJ,SVM,1) THEN
            P.OBJS = OBJ
         END ELSE
            CALL PC.PARSE.ALT(S,P.OBJS)
            CALL PC.THEN(P.OBJS)
         END
         SC1 = DCOUNT(P.OBJS,AM)
*
         FN.OBJ = ''
*
         FOR SC = 1 TO SC1
            FN.NO = 0
            P.OBJ = P.OBJS<SC,1>
            T = N.F<2,1>
            T.C = DCOUNT(T,SVM)
            FLG = NO
            FOR I = 1 TO T.C UNTIL FLG
               IF INDEX(P.OBJ,T<1,1,I>,1) THEN FLG = YES
            NEXT I
*
            LOOP WHILE FLG DO
               FLG = NO
               I1 = DCOUNT(P.OBJ,SVM)
               FOR I = I1 TO 1 STEP -1 UNTIL FLG
                  IF I > 1 THEN
                     T = INDEX(P.OBJ,SVM,I-1)
                     OBJ = P.OBJ[T+1,32000]
                  END ELSE
                     OBJ = P.OBJ
                  END
                  CALL PC.MATCH(OBJ,N.F,1,FLG,ID,ELS,POS)
                  IF FLG THEN
                     FN.NO = FN.NO + 1
                     OBJ1 = 'FN$' : FN.NO
                     GOSUB 200
                     CALL PC.EXPAND(ID,ELS,OBJ)
                     FN.OBJ<SC,1,-1> = OBJ
                  END
               NEXT I
            REPEAT
*
*
*======================================================================
*
* Check for STATEMENTS
*
            CALL PC.MATCH(P.OBJ,N.S,0,FLG,ID,ELS,POS)
            IF FLG THEN
               CALL PC.EXPAND(ID,ELS,OBJ)
*H.OBJ = OCONV(OBJ,'MX')
               P.OBJ = OBJ
            END
*
            P.OBJS<SC,1> = P.OBJ
*
         NEXT SC
*
         OBJ = ''
         F = NO
         FOR SC = 1 TO SC1
            IF P.OBJS<SC,2> <> '' THEN
               IF F THEN OBJ = OBJ : CHAR(240)
               OBJ = OBJ : P.OBJS<SC,2> : ' '
               F = NO
            END
            IF FN.OBJ<SC> <> '' THEN
               T = FN.OBJ<SC>
               J1 = DCOUNT(T,SVM)
               FOR J = 1 TO J1
                  IF F THEN OBJ = OBJ : CHAR(240)
                  OBJ = OBJ : T<1,1,J>
                  F = YES
               NEXT J
            END
            IF F THEN OBJ = OBJ : CHAR(240)
            T = P.OBJS<SC>
            J1 = DCOUNT(T,SVM)
            FOR J = 1 TO J1
               OBJ = OBJ : T<1,1,J>
            NEXT J
            F = YES
         NEXT SC
*
      END
*
      RETURN
*
200 REM INSERT OBJ1 INTO OBJ IN POSITIONS I THROUGH POS
*
      T = INDEX(P.OBJ,SVM,I+POS-2)
*
      IF I = 1 THEN
         IF T THEN
            P.OBJ = OBJ1 : SVM : P.OBJ[T+1,32000]
         END ELSE
            P.OBJ = OBJ1
         END
      END ELSE
         IF T THEN
            P.OBJ = P.OBJ[1,INDEX(P.OBJ,SVM,I-1)] : OBJ1 : P.OBJ[T,32000]
         END ELSE
            P.OBJ = P.OBJ[1,INDEX(P.OBJ,SVM,I-1)] : OBJ1
         END
      END
*
      RETURN
*
      CW = '(C) Copyright 1985-1989 Modular Software.  All rights reserved.'
   END
