home *** CD-ROM | disk | FTP | other *** search
- /**************************************************************************
- Version : 1.0
- Function : ProcessLine
- Parameters: Line - a pointer to the character line to be analyzed
- Returns : Nothing
-
- This function filters lines output from Gimpel's PC-Lint 4.0 into a format
- usable in the Turbo C++ environment message window. Most of the work is
- done by correct parameters to LINT so that the lines require very little
- processing by this function.
-
-
- Substitute this function for the one in GREP2MSG found in the TC++ package.
- Then rename the file to LINT2MSG and at the top of the file add:
- #include <stdio.h>
-
-
- The Options-Transfer-Edit-program Title should be:
- ~Lint
-
- The Options-Transfer-Edit-program Path should be:
- pathspec\LINT
-
- The Options-Transfer-Edit-program Command line should be:
- pathspec\CO-TC -h1 -w(0,0) "-format=@%f %l %c %t %n: %m" $MEM(256) $NOSWAP
- $CAP MSG(LINT2MSG) $NAME($EXENAME) $SAVE PROMPT
-
- The command line above should be on one continious line the the transfer
- editor window. Substitute the correct path to your LINT directory for
- pathspec above.
-
-
- written by Edward Rayl
-
- If you have any comments for improvements please leave a CIS message to:
- 73210,3446
-
- **************************************************************************/
- void ProcessLine(char *Line)
- {
- MsgType Type;
- unsigned i;
- unsigned LineNum;
- unsigned ColNum;
- char Message[133];
- static char LastFile[65] = "";
- char NewFile[65];
- int NumRead;
-
- if ((Line[0] == 0) || /* ignore blank line */
- (Line[0] != '@')) /* all legal lines start with * */
- return;
-
- memmove(Line,&Line[1],strlen(Line)); /* kill the @ */
-
-
- /* check for new file name */
- if (sscanf(Line, "%64s", NewFile) !=1)
- return;
-
- if (strcmp(NewFile, "0") == 0) /* handle lines with no file name */
- {
- if (sscanf(Line, " 0 %132[^@]", Message) != 1)
- strcpy(Message, "Error in PC-Lint output stream\n");
- NewFile[0] = '\0';
- if (LastFile[0] != '\0')
- {
- Type = MsgNewFile; /* indicate new file */
- Put((char *)&Type,1);
- Put(NewFile,(int) strlen(NewFile) + 1); /* write filename */
- Type = MsgNewLine; /* put some space in window */
- i = 0;
- Put((char *)&Type,1);
- Put((char *)&i,2);
- Put((char *)&i,2);
- Put(" ",2);
- }
- LastFile[0] = '\0';
- LineNum = 0;
- ColNum = 0;
- }
- else
- {
- if (strcmp(LastFile,NewFile) != 0)
- {
- strcpy(LastFile,NewFile);
- Type = MsgNewFile; /* indicate new file */
- Put((char *)&Type,1);
- Put(NewFile,(int) strlen(NewFile) + 1); /* write filename */
- }
- memmove(Line,&Line[strlen(NewFile)] + 1,strlen(Line));
- NoLines = FALSE; /* message lines output */
- Type = MsgNewLine; /* new line in message window */
-
- if (sscanf(Line, "%u %u %132[^@]", &LineNum, &ColNum, Message) != 3)
- {
- strcpy(Message, "Error in PC-Lint output stream\n");
- LastFile[0] = '\0';
- LineNum = 0;
- ColNum = 0;
- }
- }
- Type = MsgNewLine; /* new line in message window */
- Put((char *)&Type,1);
- Put((char *)&LineNum,2); /* write line number */
- Put((char *)&ColNum,2); /* write column number */
- Put(Message,(int) strlen(Message) + 1); /* write message */
- }
-