Updated tool and style fixes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12817 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
b2310dc96f
commit
0e03236831
|
@ -74,12 +74,12 @@
|
||||||
* @brief Driver state machine possible states.
|
* @brief Driver state machine possible states.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
I2C_UNINIT = 0, /**< Not initialized. */
|
I2C_UNINIT = 0, /**< @brief Not initialized. */
|
||||||
I2C_STOP = 1, /**< Stopped. */
|
I2C_STOP = 1, /**< @brief Stopped. */
|
||||||
I2C_READY = 2, /**< Ready. */
|
I2C_READY = 2, /**< @brief Ready. */
|
||||||
I2C_ACTIVE_TX = 3, /**< Transmitting. */
|
I2C_ACTIVE_TX = 3, /**< @brief Transmitting. */
|
||||||
I2C_ACTIVE_RX = 4, /**< Receiving. */
|
I2C_ACTIVE_RX = 4, /**< @brief Receiving. */
|
||||||
I2C_LOCKED = 5 /**> Bus or driver locked. */
|
I2C_LOCKED = 5 /**< @brief Bus locked. */
|
||||||
} i2cstate_t;
|
} i2cstate_t;
|
||||||
|
|
||||||
#include "hal_i2c_lld.h"
|
#include "hal_i2c_lld.h"
|
||||||
|
|
|
@ -117,7 +117,7 @@ typedef struct {
|
||||||
* @brief Current configuration data.
|
* @brief Current configuration data.
|
||||||
*/
|
*/
|
||||||
const MMCConfig *config;
|
const MMCConfig *config;
|
||||||
/***
|
/**
|
||||||
* @brief Addresses use blocks instead of bytes.
|
* @brief Addresses use blocks instead of bytes.
|
||||||
*/
|
*/
|
||||||
bool block_addresses;
|
bool block_addresses;
|
||||||
|
|
|
@ -743,7 +743,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C2_TX_DMA_CHANNEL) |
|
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C2_TX_DMA_CHANNEL) |
|
||||||
STM32_DMA_CR_PL(STM32_I2C_I2C2_DMA_PRIORITY);
|
STM32_DMA_CR_PL(STM32_I2C_I2C2_DMA_PRIORITY);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
|
|
||||||
#if defined(STM32_I2C2_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
#if defined(STM32_I2C2_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
||||||
nvicEnableVector(STM32_I2C2_GLOBAL_NUMBER, STM32_I2C_I2C2_IRQ_PRIORITY);
|
nvicEnableVector(STM32_I2C2_GLOBAL_NUMBER, STM32_I2C_I2C2_IRQ_PRIORITY);
|
||||||
|
@ -779,7 +779,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C3_TX_DMA_CHANNEL) |
|
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C3_TX_DMA_CHANNEL) |
|
||||||
STM32_DMA_CR_PL(STM32_I2C_I2C3_DMA_PRIORITY);
|
STM32_DMA_CR_PL(STM32_I2C_I2C3_DMA_PRIORITY);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
|
|
||||||
#if defined(STM32_I2C3_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
#if defined(STM32_I2C3_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
||||||
nvicEnableVector(STM32_I2C3_GLOBAL_NUMBER, STM32_I2C_I2C3_IRQ_PRIORITY);
|
nvicEnableVector(STM32_I2C3_GLOBAL_NUMBER, STM32_I2C_I2C3_IRQ_PRIORITY);
|
||||||
|
@ -815,7 +815,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C4_TX_DMA_CHANNEL) |
|
i2cp->txdmamode |= STM32_DMA_CR_CHSEL(I2C4_TX_DMA_CHANNEL) |
|
||||||
STM32_DMA_CR_PL(STM32_I2C_I2C4_DMA_PRIORITY);
|
STM32_DMA_CR_PL(STM32_I2C_I2C4_DMA_PRIORITY);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
|
|
||||||
#if defined(STM32_I2C4_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
#if defined(STM32_I2C4_GLOBAL_NUMBER) || defined(__DOXYGEN__)
|
||||||
nvicEnableVector(STM32_I2C4_GLOBAL_NUMBER, STM32_I2C_I2C4_IRQ_PRIORITY);
|
nvicEnableVector(STM32_I2C4_GLOBAL_NUMBER, STM32_I2C_I2C4_IRQ_PRIORITY);
|
||||||
|
|
|
@ -866,7 +866,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C2_RX);
|
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C2_RX);
|
||||||
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C2_TX);
|
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C2_TX);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
}
|
}
|
||||||
#endif /* STM32_I2C_USE_I2C2 */
|
#endif /* STM32_I2C_USE_I2C2 */
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C3_RX);
|
dmaSetRequestSource(i2cp->rx.dma, STM32_DMAMUX1_I2C3_RX);
|
||||||
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C3_TX);
|
dmaSetRequestSource(i2cp->tx.dma, STM32_DMAMUX1_I2C3_TX);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
}
|
}
|
||||||
#endif /* STM32_I2C_USE_I2C3 */
|
#endif /* STM32_I2C_USE_I2C3 */
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ void i2c_lld_start(I2CDriver *i2cp) {
|
||||||
bdmaSetRequestSource(i2cp->rx.bdma, STM32_DMAMUX2_I2C4_RX);
|
bdmaSetRequestSource(i2cp->rx.bdma, STM32_DMAMUX2_I2C4_RX);
|
||||||
bdmaSetRequestSource(i2cp->tx.bdma, STM32_DMAMUX2_I2C4_TX);
|
bdmaSetRequestSource(i2cp->tx.bdma, STM32_DMAMUX2_I2C4_TX);
|
||||||
}
|
}
|
||||||
#endif /*STM32_I2C_USE_DMA == TRUE */
|
#endif /* STM32_I2C_USE_DMA == TRUE */
|
||||||
}
|
}
|
||||||
#endif /* STM32_I2C_USE_I2C4 */
|
#endif /* STM32_I2C_USE_I2C4 */
|
||||||
}
|
}
|
||||||
|
|
|
@ -512,7 +512,7 @@ static void otg_isoc_out_failed_handler(USBDriver *usbp) {
|
||||||
/*otgp->oe[ep].DOEPCTL |= (DOEPCTL_EPDIS | DOEPCTL_SNAK);
|
/*otgp->oe[ep].DOEPCTL |= (DOEPCTL_EPDIS | DOEPCTL_SNAK);
|
||||||
while (otgp->oe[ep].DOEPCTL & DOEPCTL_EPENA)
|
while (otgp->oe[ep].DOEPCTL & DOEPCTL_EPENA)
|
||||||
;*/
|
;*/
|
||||||
/* Prepare transfer for next frame */
|
/* Prepare transfer for next frame.*/
|
||||||
_usb_isr_invoke_out_cb(usbp, ep);
|
_usb_isr_invoke_out_cb(usbp, ep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ static bool sdc_lld_prepare_read_bytes(SDCDriver *sdcp,
|
||||||
|
|
||||||
/* Transaction starts just after DTEN bit setting.*/
|
/* Transaction starts just after DTEN bit setting.*/
|
||||||
sdcp->sdio->DCTRL = SDIO_DCTRL_DTDIR |
|
sdcp->sdio->DCTRL = SDIO_DCTRL_DTDIR |
|
||||||
SDIO_DCTRL_DTMODE | /* multibyte data transfer */
|
SDIO_DCTRL_DTMODE | /* Multibyte data transfer.*/
|
||||||
SDIO_DCTRL_DMAEN |
|
SDIO_DCTRL_DMAEN |
|
||||||
SDIO_DCTRL_DTEN;
|
SDIO_DCTRL_DTEN;
|
||||||
|
|
||||||
|
@ -228,10 +228,6 @@ static bool sdc_lld_wait_transaction_end(SDCDriver *sdcp, uint32_t n,
|
||||||
sdcp->sdio->ICR = STM32_SDIO_ICR_ALL_FLAGS;
|
sdcp->sdio->ICR = STM32_SDIO_ICR_ALL_FLAGS;
|
||||||
sdcp->sdio->DCTRL = 0;
|
sdcp->sdio->DCTRL = 0;
|
||||||
osalSysUnlock();
|
osalSysUnlock();
|
||||||
|
|
||||||
/* Wait until interrupt flags to be cleared.*/
|
|
||||||
/*while (((DMA2->LISR) >> (sdcp->dma->ishift)) & STM32_DMA_ISR_TCIF)
|
|
||||||
dmaStreamClearInterrupt(sdcp->dma);*/
|
|
||||||
#else
|
#else
|
||||||
/* Waits for transfer completion at DMA level, then the stream is
|
/* Waits for transfer completion at DMA level, then the stream is
|
||||||
disabled and cleared.*/
|
disabled and cleared.*/
|
||||||
|
|
|
@ -150,7 +150,7 @@ static bool sdc_lld_prepare_read_bytes(SDCDriver *sdcp,
|
||||||
|
|
||||||
/* Transaction starts just after DTEN bit setting.*/
|
/* Transaction starts just after DTEN bit setting.*/
|
||||||
sdcp->sdmmc->DCTRL = SDMMC_DCTRL_DTDIR |
|
sdcp->sdmmc->DCTRL = SDMMC_DCTRL_DTDIR |
|
||||||
SDMMC_DCTRL_DTMODE | /* multibyte data transfer */
|
SDMMC_DCTRL_DTMODE | /* Multibyte data transfer.*/
|
||||||
SDMMC_DCTRL_DMAEN |
|
SDMMC_DCTRL_DMAEN |
|
||||||
SDMMC_DCTRL_DTEN;
|
SDMMC_DCTRL_DTEN;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ static size_t iq_read(input_queue_t *iqp, uint8_t *bp, size_t n) {
|
||||||
memcpy((void *)bp, (void *)iqp->q_buffer, s2);
|
memcpy((void *)bp, (void *)iqp->q_buffer, s2);
|
||||||
iqp->q_rdptr = iqp->q_buffer + s2;
|
iqp->q_rdptr = iqp->q_buffer + s2;
|
||||||
}
|
}
|
||||||
else { /* n == s1 */
|
else {
|
||||||
memcpy((void *)bp, (void *)iqp->q_rdptr, n);
|
memcpy((void *)bp, (void *)iqp->q_rdptr, n);
|
||||||
iqp->q_rdptr = iqp->q_buffer;
|
iqp->q_rdptr = iqp->q_buffer;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ static size_t oq_write(output_queue_t *oqp, const uint8_t *bp, size_t n) {
|
||||||
memcpy((void *)oqp->q_buffer, (const void *)bp, s2);
|
memcpy((void *)oqp->q_buffer, (const void *)bp, s2);
|
||||||
oqp->q_wrptr = oqp->q_buffer + s2;
|
oqp->q_wrptr = oqp->q_buffer + s2;
|
||||||
}
|
}
|
||||||
else { /* n == s1 */
|
else {
|
||||||
memcpy((void *)oqp->q_wrptr, (const void *)bp, n);
|
memcpy((void *)oqp->q_wrptr, (const void *)bp, n);
|
||||||
oqp->q_wrptr = oqp->q_buffer;
|
oqp->q_wrptr = oqp->q_buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ void rtcConvertStructTmToDateTime(const struct tm *timp,
|
||||||
timespec->day = (uint32_t)timp->tm_mday;
|
timespec->day = (uint32_t)timp->tm_mday;
|
||||||
timespec->dayofweek = (uint32_t)timp->tm_wday + 1U;
|
timespec->dayofweek = (uint32_t)timp->tm_wday + 1U;
|
||||||
if (-1 == timp->tm_isdst) {
|
if (-1 == timp->tm_isdst) {
|
||||||
timespec->dstflag = 0U; /* set zero if dst is unknown */
|
timespec->dstflag = 0U; /* Set zero if dst is unknown.*/
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timespec->dstflag = (uint32_t)timp->tm_isdst;
|
timespec->dstflag = (uint32_t)timp->tm_isdst;
|
||||||
|
@ -293,7 +293,7 @@ uint32_t rtcConvertDateTimeToFAT(const RTCDateTime *timespec) {
|
||||||
day = timespec->day;
|
day = timespec->day;
|
||||||
month = timespec->month;
|
month = timespec->month;
|
||||||
|
|
||||||
/* handle DST flag */
|
/* Handle DST flag.*/
|
||||||
if (1U == timespec->dstflag) {
|
if (1U == timespec->dstflag) {
|
||||||
hour += 1U;
|
hour += 1U;
|
||||||
if (hour == 24U) {
|
if (hour == 24U) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ static size_t pipe_write(pipe_t *pp, const uint8_t *bp, size_t n) {
|
||||||
memcpy((void *)pp->buffer, (const void *)bp, s2);
|
memcpy((void *)pp->buffer, (const void *)bp, s2);
|
||||||
pp->wrptr = pp->buffer + s2;
|
pp->wrptr = pp->buffer + s2;
|
||||||
}
|
}
|
||||||
else { /* n == s1 */
|
else {
|
||||||
memcpy((void *)pp->wrptr, (const void *)bp, n);
|
memcpy((void *)pp->wrptr, (const void *)bp, n);
|
||||||
pp->wrptr = pp->buffer;
|
pp->wrptr = pp->buffer;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +180,7 @@ static size_t pipe_read(pipe_t *pp, uint8_t *bp, size_t n) {
|
||||||
memcpy((void *)bp, (void *)pp->buffer, s2);
|
memcpy((void *)bp, (void *)pp->buffer, s2);
|
||||||
pp->rdptr = pp->buffer + s2;
|
pp->rdptr = pp->buffer + s2;
|
||||||
}
|
}
|
||||||
else { /* n == s1 */
|
else {
|
||||||
memcpy((void *)bp, (void *)pp->rdptr, n);
|
memcpy((void *)bp, (void *)pp->rdptr, n);
|
||||||
pp->rdptr = pp->buffer;
|
pp->rdptr = pp->buffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,7 @@ static inline void chVTDoTickI(void) {
|
||||||
fn = vtp->func;
|
fn = vtp->func;
|
||||||
vtp->func = NULL;
|
vtp->func = NULL;
|
||||||
|
|
||||||
/* if the list becomes empty then the timer is stopped.*/
|
/* If the list becomes empty then the timer is stopped.*/
|
||||||
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
|
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
|
||||||
port_timer_stop_alarm();
|
port_timer_stop_alarm();
|
||||||
}
|
}
|
||||||
|
@ -439,7 +439,7 @@ static inline void chVTDoTickI(void) {
|
||||||
while (vtp->delta <= nowdelta);
|
while (vtp->delta <= nowdelta);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the list is empty, nothing else to do.*/
|
/* If the list is empty, nothing else to do.*/
|
||||||
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
|
if (ch.vtlist.next == (virtual_timer_t *)&ch.vtlist) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -605,6 +605,6 @@ void chSchDoReschedule(void) {
|
||||||
/* Swap operation as tail call.*/
|
/* Swap operation as tail call.*/
|
||||||
chSysSwitch(currp, otp);
|
chSysSwitch(currp, otp);
|
||||||
}
|
}
|
||||||
#endif /*!defined(CH_SCH_DO_RESCHEDULE_HOOKED) */
|
#endif /* !defined(CH_SCH_DO_RESCHEDULE_HOOKED) */
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -24,8 +24,6 @@ $filename = basename($filename);
|
||||||
my $cr = "\r";
|
my $cr = "\r";
|
||||||
my $lf = "\n";
|
my $lf = "\n";
|
||||||
my $tab = "\t";
|
my $tab = "\t";
|
||||||
my $c_comment = "";
|
|
||||||
my $state = "start";
|
|
||||||
|
|
||||||
sub style {
|
sub style {
|
||||||
my $desc = shift;
|
my $desc = shift;
|
||||||
|
@ -40,10 +38,57 @@ sub error {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $emptycnt = 0;
|
my $emptycnt = 0;
|
||||||
|
my $c_comment_complete = 0;
|
||||||
|
my $c_comment = "";
|
||||||
|
my $state = "start";
|
||||||
foreach my $line (@c_source) {
|
foreach my $line (@c_source) {
|
||||||
|
|
||||||
$lineno += 1;
|
$lineno += 1;
|
||||||
|
|
||||||
|
#****************************************************************************
|
||||||
|
# Processing comments after decoding.
|
||||||
|
if ($c_comment_complete != 0) {
|
||||||
|
# print($c_comment . "\n");
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Special case of lint comment.
|
||||||
|
if ("$c_comment" =~ /^\s*\/\*lint/) {
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
#******************************************************************************
|
||||||
|
# Check on glued doxygen back-comment start.
|
||||||
|
if ("$c_comment" =~ /^\s*\/\*\*<[^\s]/) {
|
||||||
|
style "detected glued doxygen back-comment start";
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Check on glued doxygen comment start.
|
||||||
|
if ("$c_comment" =~ /^\s*\/\*\*[^\s<]/) {
|
||||||
|
style "detected glued doxygen comment start";
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Check on glued comment start.
|
||||||
|
if ("$c_comment" =~ /^\s*\/\*[^\s\*=]/) {
|
||||||
|
style "detected glued comment start";
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Check on lower case letter at comment beginning.
|
||||||
|
if ("$c_comment" =~ /^\s*\/\*\s*[a-z]/) {
|
||||||
|
style "detected lower case comment start";
|
||||||
|
}
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Check on loose comment stop.
|
||||||
|
# if ("$line" =~ /\s\*\//) {
|
||||||
|
# style "detected loose comment stop";
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
|
||||||
|
$c_comment_complete = 0;
|
||||||
|
}
|
||||||
|
|
||||||
#****************************************************************************
|
#****************************************************************************
|
||||||
# Check on EOL.
|
# Check on EOL.
|
||||||
if (not ($line =~ /$cr$lf$/)) {
|
if (not ($line =~ /$cr$lf$/)) {
|
||||||
|
@ -91,17 +136,25 @@ foreach my $line (@c_source) {
|
||||||
# State machine handling.
|
# State machine handling.
|
||||||
if ($state eq "start") {
|
if ($state eq "start") {
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Standard separator.
|
||||||
|
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# Comment start matching.
|
# Comment start matching.
|
||||||
if ("$line" =~ /^\s*\/\*/) {
|
if ("$line" =~ /\/\*/) {
|
||||||
|
|
||||||
|
#******************************************************************************
|
||||||
|
# Single or multi line comments.
|
||||||
if ("$line" =~ /\*\//) {
|
if ("$line" =~ /\*\//) {
|
||||||
# Special case of single line comments.
|
# Special case of single line comments.
|
||||||
$line =~ /^\s*(\/\*.*\*\/)/;
|
$line =~ /(\/\*.*\*\/)/;
|
||||||
|
$c_comment = $1;
|
||||||
|
$c_comment_complete = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Start of multi-line comment.
|
# Start of multi-line comment.
|
||||||
$line =~ /(\/\*.*)/;
|
$line =~ /(\/\*.*)/;
|
||||||
$c_comment = $1 . " ";
|
$c_comment = $1;
|
||||||
$state = "incomment";
|
$state = "incomment";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -171,7 +224,7 @@ foreach my $line (@c_source) {
|
||||||
# Check on (some) operators.
|
# Check on (some) operators.
|
||||||
# Before: <<= << >>= >> <= >= == != += -= *= /= %= &= |= ^=
|
# Before: <<= << >>= >> <= >= == != += -= *= /= %= &= |= ^=
|
||||||
if ($line =~ /(\(\S<<=?|\S>>=?|[^\s<]<=|[^\s>]>=|\S[=!+\-*\/%&|^]=)/) {
|
if ($line =~ /(\(\S<<=?|\S>>=?|[^\s<]<=|[^\s>]>=|\S[=!+\-*\/%&|^]=)/) {
|
||||||
style "detected glued assignment/comparison operator (1)";
|
style "detected glued operator (1)";
|
||||||
}
|
}
|
||||||
# After: =
|
# After: =
|
||||||
elsif ($line =~ /=[^\s=]/) {
|
elsif ($line =~ /=[^\s=]/) {
|
||||||
|
@ -209,16 +262,27 @@ foreach my $line (@c_source) {
|
||||||
#******************************************************************************
|
#******************************************************************************
|
||||||
# Scanning for comment end.
|
# Scanning for comment end.
|
||||||
elsif ($state eq "incomment") {
|
elsif ($state eq "incomment") {
|
||||||
if ("$line" =~ /\*\/\s*$/) {
|
# Left trimming.
|
||||||
# End of mult-line comment.
|
$line =~ s/^\s+//;
|
||||||
|
if ("$line" =~ /^\s*\*\/\s*$/) {
|
||||||
|
# Just end of comment line.
|
||||||
|
$c_comment .= "*/";
|
||||||
|
$c_comment_complete = 1;
|
||||||
|
# print("$c_comment");
|
||||||
|
$state = "start";
|
||||||
|
}
|
||||||
|
elsif ("$line" =~ /\*\/\s*$/) {
|
||||||
|
# Text followed by end of comment.
|
||||||
$line =~ /(.*\*\/)/;
|
$line =~ /(.*\*\/)/;
|
||||||
$c_comment .= $1;
|
$c_comment .= " " . $1;
|
||||||
|
$c_comment_complete = 1;
|
||||||
# print("$c_comment");
|
# print("$c_comment");
|
||||||
$state = "start";
|
$state = "start";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# Add the whole line.
|
# Add the whole line, remove first * and following spaces if any.
|
||||||
$c_comment .= $line . " ";
|
$line =~ s/^\*?\s*//;
|
||||||
|
$c_comment .= " " . $line;
|
||||||
# print("$c_comment");
|
# print("$c_comment");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,3 +19,36 @@ a && b
|
||||||
a || b
|
a || b
|
||||||
a ^^ b
|
a ^^ b
|
||||||
|
|
||||||
|
foo(); /* Function call.*/
|
||||||
|
|
||||||
|
foo(); /* Multiple lines
|
||||||
|
right comment.*/
|
||||||
|
|
||||||
|
/** @} */
|
||||||
|
|
||||||
|
/*lint .*/
|
||||||
|
|
||||||
|
/* Good comment.*/
|
||||||
|
|
||||||
|
/** @Good comment.*/
|
||||||
|
|
||||||
|
/**< @Good comment.*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is a good comment.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Good comment.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Multiple lines
|
||||||
|
comment 1.*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Multiple lines
|
||||||
|
* comment 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
|
|
@ -58,4 +58,8 @@ a ||b
|
||||||
a^^b
|
a^^b
|
||||||
a^^ b
|
a^^ b
|
||||||
a ^^b
|
a ^^b
|
||||||
|
/** Comment.*/
|
||||||
|
/**Comment.*/
|
||||||
|
/*Comment*/
|
||||||
|
/* comment*/
|
||||||
|
/* Comment. */
|
||||||
|
|
Loading…
Reference in New Issue