FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
Doctor buffer utilities for debugging. More...
#include "doctorBuffer_utils.h"
#include "nomos.h"
#include "list.h"
#include "util.h"
#include "nomos_regex.h"
Go to the source code of this file.
Macros | |
#define | INVISIBLE (int) '\377' |
Functions | |
int | compressDoctoredBuffer (char *textBuffer) |
garbage collect: eliminate all INVISIBLE characters in the buffer More... | |
void | removeHtmlComments (char *buf) |
Remove HTML comments from buffer without removing comment text. More... | |
void | removeLineComments (char *buf) |
Remove comments that start at the beginning of a line. More... | |
void | cleanUpPostscript (char *buf) |
Remove newlines from buffer. More... | |
void | removeBackslashesAndGTroffIndicators (char *buf) |
Remove groff/troff font-size indicators, the literal string backslash-n and all backslahes, ala. More... | |
void | convertWhitespaceToSpaceAndRemoveSpecialChars (char *buf, int isCR) |
Convert white-space to real spaces, and remove unnecessary punctuation. More... | |
void | dehyphen (char *buf) |
void | removePunctuation (char *buf) |
Clean up miscellaneous punctuation. More... | |
void | ignoreFunctionCalls (char *buf) |
Ignore function calls to print routines. More... | |
void | convertSpaceToInvisible (char *buf) |
void | doctorBuffer (char *buf, int isML, int isPS, int isCR) |
Convert a buffer of multiple stuff to text-only, separated by spaces. More... | |
Doctor buffer utilities for debugging.
Definition in file doctorBuffer_utils.c.
void cleanUpPostscript | ( | char * | buf | ) |
Remove newlines from buffer.
[in,out] | buf |
Definition at line 220 of file doctorBuffer_utils.c.
int compressDoctoredBuffer | ( | char * | textBuffer | ) |
garbage collect: eliminate all INVISIBLE characters in the buffer
[in,out] | textBuffer | Buffer to compress |
Definition at line 25 of file doctorBuffer_utils.c.
void convertSpaceToInvisible | ( | char * | buf | ) |
Convert the regex ' [X ]+' (where X is really the character #defined as INVISIBLE) to a single space (and a string of INVISIBLE characters).
[in,out] | buf |
Definition at line 530 of file doctorBuffer_utils.c.
void convertWhitespaceToSpaceAndRemoveSpecialChars | ( | char * | buf, |
int | isCR | ||
) |
Convert white-space to real spaces, and remove unnecessary punctuation.
‘tr -d ’*=+#$|%.,:;!?()\][\140\047\042' | tr '\011\012\015' ' '`
[in,out] | buf |
Definition at line 285 of file doctorBuffer_utils.c.
void dehyphen | ( | char * | buf | ) |
Look for hyphenations of words, to compress both halves into a single (sic) word. Regex == "[a-z]- [a-z]".
[in,out] | buf |
Definition at line 426 of file doctorBuffer_utils.c.
void doctorBuffer | ( | char * | buf, |
int | isML, | ||
int | isPS, | ||
int | isCR | ||
) |
Convert a buffer of multiple stuff to text-only, separated by spaces.
The steps followed in this function are:
[in,out] | buf | Buffer to filter |
[in] | isML | Buffer contains HTML/XML data |
[in] | isPS | Buffer contains post script data |
[in] | isCR |
Definition at line 575 of file doctorBuffer_utils.c.
void ignoreFunctionCalls | ( | char * | buf | ) |
Ignore function calls to print routines.
Only concentrate on what's being printed (sometimes programs do print licensing information) – but don't ignore real words that END in 'print', like footprint and fingerprint.
Here, we take a risk and just look for a 't' (in "footprint"), or for an 'r' (in "fingerprint"). If someone has ever coded a print routine that is named 'rprint' or tprint', we're spoofed.
[in,out] | buf |
Definition at line 505 of file doctorBuffer_utils.c.
void removeBackslashesAndGTroffIndicators | ( | char * | buf | ) |
Remove groff/troff font-size indicators, the literal string backslash-n and all backslahes, ala.
‘perl -pe 's,\s[+-][0-9]*,,g;s,\s[0-9]*,,g;s/\n//g;’ | f`
[in,out] | buf |
Definition at line 246 of file doctorBuffer_utils.c.
void removeHtmlComments | ( | char * | buf | ) |
Remove HTML comments from buffer without removing comment text.
[in,out] | buf |
Definition at line 43 of file doctorBuffer_utils.c.
void removeLineComments | ( | char * | buf | ) |
Remove comments that start at the beginning of a line.
Comments like *, ^dnl, ^xcomm, ^comment, and // preserving the comment text
[in,out] | buf |
when MODULE_LICENSE("GPL") is outcommented, do not get rid of this line.
Definition at line 120 of file doctorBuffer_utils.c.
void removePunctuation | ( | char * | buf | ) |
Clean up miscellaneous punctuation.
‘perl -pe 's,[-_/]+ , ,g;s/print[_a-zA-Z]* //g;s/ / /g;’`
[in,out] | buf |
Definition at line 467 of file doctorBuffer_utils.c.