Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abc
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
abc
Commits
a24b15d0
Commit
a24b15d0
authored
Mar 29, 2022
by
Alan Mishchenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Suggested changes for the case when the file begings with a new line.
parent
ee228339
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
53 deletions
+74
-53
src/map/amap/amapRead.c
+38
-28
src/map/mio/mioRead.c
+36
-25
No files found.
src/map/amap/amapRead.c
View file @
a24b15d0
...
...
@@ -126,41 +126,52 @@ void Amap_RemoveComments( char * pBuffer, int * pnDots, int * pnLines )
// (in the BLIF file, comments are lines starting with "#")
nDots
=
nLines
=
0
;
for
(
pCur
=
pBuffer
;
*
pCur
;
pCur
++
)
{
{
// if this is the beginning of comment
// clean it with spaces until the new line statement
if
(
*
pCur
==
'#'
)
while
(
*
pCur
!=
'\n'
)
*
pCur
++
=
' '
;
if
(
*
pCur
==
'#'
)
{
while
(
*
pCur
!=
'\n'
)
{
*
pCur
++
=
' '
;
}
}
// count the number of new lines and dots
if
(
*
pCur
==
'\n'
)
{
if
(
*
(
pCur
-
1
)
==
'\r'
)
{
// DOS(R) file support
if
(
*
(
pCur
-
2
)
!=
'\\'
)
nLines
++
;
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
2
)
=
' '
;
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
else
{
// UNIX(TM) file support
if
(
*
(
pCur
-
1
)
!=
'\\'
)
nLines
++
;
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
if
(
pCur
>
pBuffer
)
{
if
(
*
(
pCur
-
1
)
==
'\r'
)
{
// DOS(R) file support
if
(
pCur
>
(
pBuffer
+
1
))
{
if
(
*
(
pCur
-
2
)
!=
'\\'
)
{
nLines
++
;
}
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
2
)
=
' '
;
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
}
else
{
// UNIX(TM) file support
if
(
*
(
pCur
-
1
)
!=
'\\'
)
{
nLines
++
;
}
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
}
}
else
if
(
*
pCur
==
'.'
)
{
nDots
++
;
}
}
else
if
(
*
pCur
==
'.'
)
nDots
++
;
}
}
if
(
pnDots
)
*
pnDots
=
nDots
;
*
pnDots
=
nDots
;
if
(
pnLines
)
*
pnLines
=
nLines
;
*
pnLines
=
nLines
;
}
/**Function*************************************************************
...
...
@@ -491,4 +502,3 @@ Amap_Lib_t * Amap_LibReadFile( char * pFileName, int fVerbose )
ABC_NAMESPACE_IMPL_END
src/map/mio/mioRead.c
View file @
a24b15d0
...
...
@@ -734,37 +734,48 @@ void Io_ReadFileRemoveComments( char * pBuffer, int * pnDots, int * pnLines )
// (in the BLIF file, comments are lines starting with "#")
nDots
=
nLines
=
0
;
for
(
pCur
=
pBuffer
;
*
pCur
;
pCur
++
)
{
{
// if this is the beginning of comment
// clean it with spaces until the new line statement
if
(
*
pCur
==
'#'
)
while
(
*
pCur
!=
'\n'
)
*
pCur
++
=
' '
;
if
(
*
pCur
==
'#'
)
{
while
(
*
pCur
!=
'\n'
)
{
*
pCur
++
=
' '
;
}
}
// count the number of new lines and dots
if
(
*
pCur
==
'\n'
)
{
if
(
*
(
pCur
-
1
)
==
'\r'
)
{
// DOS(R) file support
if
(
*
(
pCur
-
2
)
!=
'\\'
)
nLines
++
;
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
2
)
=
' '
;
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
else
{
// UNIX(TM) file support
if
(
*
(
pCur
-
1
)
!=
'\\'
)
nLines
++
;
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
if
(
pCur
>
pBuffer
)
{
if
(
*
(
pCur
-
1
)
==
'\r'
)
{
// DOS(R) file support
if
(
pCur
>
(
pBuffer
+
1
))
{
if
(
*
(
pCur
-
2
)
!=
'\\'
)
{
nLines
++
;
}
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
2
)
=
' '
;
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
}
else
{
// UNIX(TM) file support
if
(
*
(
pCur
-
1
)
!=
'\\'
)
{
nLines
++
;
}
else
{
// rewind to backslash and overwrite with a space
*
(
pCur
-
1
)
=
' '
;
*
pCur
=
' '
;
}
}
}
}
else
if
(
*
pCur
==
'.'
)
{
nDots
++
;
}
}
else
if
(
*
pCur
==
'.'
)
nDots
++
;
}
}
if
(
pnDots
)
*
pnDots
=
nDots
;
if
(
pnLines
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment