mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Parse DOS and *nix text files correctly.
svn path=/trunk/; revision=4708
This commit is contained in:
parent
19c81674a3
commit
e568d2b165
3 changed files with 24 additions and 23 deletions
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: infcache.c,v 1.3 2003/04/17 10:41:02 chorns Exp $
|
/* $Id: infcache.c,v 1.4 2003/05/18 12:12:07 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS hive maker
|
* PROJECT: ReactOS hive maker
|
||||||
* FILE: tools/mkhive/infcache.c
|
* FILE: tools/mkhive/infcache.c
|
||||||
|
@ -426,7 +426,11 @@ inline static int is_eof( struct parser *parser, const CHAR *ptr )
|
||||||
/* check if the pointer points to an end of line */
|
/* check if the pointer points to an end of line */
|
||||||
inline static int is_eol( struct parser *parser, const CHAR *ptr )
|
inline static int is_eol( struct parser *parser, const CHAR *ptr )
|
||||||
{
|
{
|
||||||
return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\r' /*'\n'*/);
|
// return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\r' /*'\n'*/);
|
||||||
|
return (ptr >= parser->end ||
|
||||||
|
*ptr == CONTROL_Z ||
|
||||||
|
*ptr == '\n' ||
|
||||||
|
(*ptr == '\r' && *(ptr + 1) == '\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -544,20 +548,24 @@ static const CHAR *line_start_state( struct parser *parser, const CHAR *pos )
|
||||||
{
|
{
|
||||||
switch(*p)
|
switch(*p)
|
||||||
{
|
{
|
||||||
// case '\n':
|
|
||||||
case '\r':
|
case '\r':
|
||||||
p++;
|
continue;
|
||||||
|
|
||||||
|
case '\n':
|
||||||
parser->line_pos++;
|
parser->line_pos++;
|
||||||
close_current_line( parser );
|
close_current_line( parser );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ';':
|
case ';':
|
||||||
push_state( parser, LINE_START );
|
push_state( parser, LINE_START );
|
||||||
set_state( parser, COMMENT );
|
set_state( parser, COMMENT );
|
||||||
return p + 1;
|
return p + 1;
|
||||||
|
|
||||||
case '[':
|
case '[':
|
||||||
parser->start = p + 1;
|
parser->start = p + 1;
|
||||||
set_state( parser, SECTION_NAME );
|
set_state( parser, SECTION_NAME );
|
||||||
return p + 1;
|
return p + 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!isspace(*p))
|
if (!isspace(*p))
|
||||||
{
|
{
|
||||||
|
@ -711,20 +719,23 @@ static const CHAR *eol_backslash_state( struct parser *parser, const CHAR *pos )
|
||||||
{
|
{
|
||||||
switch(*p)
|
switch(*p)
|
||||||
{
|
{
|
||||||
// case '\n':
|
|
||||||
case '\r':
|
case '\r':
|
||||||
|
continue;
|
||||||
|
|
||||||
|
case '\n':
|
||||||
parser->line_pos++;
|
parser->line_pos++;
|
||||||
// parser->start = p + 1;
|
parser->start = p + 1;
|
||||||
parser->start = p + 2;
|
|
||||||
set_state( parser, LEADING_SPACES );
|
set_state( parser, LEADING_SPACES );
|
||||||
// return p + 1;
|
return p + 1;
|
||||||
return p + 2;
|
|
||||||
case '\\':
|
case '\\':
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
case ';':
|
case ';':
|
||||||
push_state( parser, EOL_BACKSLASH );
|
push_state( parser, EOL_BACKSLASH );
|
||||||
set_state( parser, COMMENT );
|
set_state( parser, COMMENT );
|
||||||
return p + 1;
|
return p + 1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (isspace(*p))
|
if (isspace(*p))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: reginf.c,v 1.2 2003/04/17 10:41:02 chorns Exp $
|
/* $Id: reginf.c,v 1.3 2003/05/18 12:12:07 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS hive maker
|
* PROJECT: ReactOS hive maker
|
||||||
* FILE: tools/mkhive/reginf.h
|
* FILE: tools/mkhive/reginf.h
|
||||||
|
@ -382,6 +382,8 @@ registry_callback (HINF hInf, PCHAR Section, BOOL Delete)
|
||||||
|
|
||||||
|
|
||||||
Ok = InfFindFirstLine (hInf, Section, NULL, &Context);
|
Ok = InfFindFirstLine (hInf, Section, NULL, &Context);
|
||||||
|
if (!Ok)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
for (;Ok; Ok = InfFindNextLine (&Context, &Context))
|
for (;Ok; Ok = InfFindNextLine (&Context, &Context))
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
/* $Id: registry.c,v 1.3 2003/04/17 10:41:02 chorns Exp $
|
/* $Id: registry.c,v 1.4 2003/05/18 12:12:07 ekohl Exp $
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS hive maker
|
* PROJECT: ReactOS hive maker
|
||||||
* FILE: tools/mkhive/registry.c
|
* FILE: tools/mkhive/registry.c
|
||||||
|
@ -27,7 +27,6 @@
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - Implement RegDeleteKey().
|
* - Implement RegDeleteKey().
|
||||||
* - Implement RegQueryMultipleValue().
|
|
||||||
* - Fix RegEnumValue().
|
* - Fix RegEnumValue().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -700,15 +699,4 @@ RegGetValueCount (HKEY Key)
|
||||||
return Key->ValueCount;
|
return Key->ValueCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
LONG
|
|
||||||
RegQueryMultipleValue(HKEY Key,
|
|
||||||
...)
|
|
||||||
{
|
|
||||||
return(ERROR_SUCCESS);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
Loading…
Reference in a new issue