touched up code for an old c++ compiler
This commit is contained in:
parent
c31d8dc8a2
commit
8118c7477d
@ -114,7 +114,7 @@ FULL_PATH_NAMES = YES
|
|||||||
# If left blank the directory from which doxygen is run is used as the
|
# If left blank the directory from which doxygen is run is used as the
|
||||||
# path to strip.
|
# path to strip.
|
||||||
|
|
||||||
STRIP_FROM_PATH = @abs_top_srcdir@/include
|
STRIP_FROM_PATH = @abs_top_srcdir@/include/
|
||||||
|
|
||||||
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
|
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
|
||||||
# the path mentioned in the documentation of a class, which tells
|
# the path mentioned in the documentation of a class, which tells
|
||||||
|
@ -39,7 +39,7 @@ The \@include directive inserts the contents of the object specified in the
|
|||||||
following string, typically a file name, as if they appeared in the source
|
following string, typically a file name, as if they appeared in the source
|
||||||
stream being processed. The directive can only be used at the outmost scope
|
stream being processed. The directive can only be used at the outmost scope
|
||||||
where global variable declarations, BEGIN, END, and/or pattern-action blocks
|
where global variable declarations, BEGIN, END, and/or pattern-action blocks
|
||||||
appear. To use @include, you must turn on QSE_AWK_INCLUDE.
|
appear. To use \@include, you must turn on QSE_AWK_INCLUDE.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
@include "abc.awk"
|
@include "abc.awk"
|
||||||
|
@ -185,8 +185,8 @@ Writes the first line of the pattern space to @b file
|
|||||||
|
|
||||||
- <b>s/rex/repl/opts</b>
|
- <b>s/rex/repl/opts</b>
|
||||||
Finds a matching substring with @b rex in pattern space and replaces it
|
Finds a matching substring with @b rex in pattern space and replaces it
|
||||||
with @repl. @b & in @b repl refers to the matching substring. @b opts may
|
with @b repl. @b & in @b repl refers to the matching substring. @b opts may
|
||||||
be empty; You can combine the following options into @opts:
|
be empty; You can combine the following options into @b opts:
|
||||||
- @b g replaces all occurrences of a matching substring with @b rex
|
- @b g replaces all occurrences of a matching substring with @b rex
|
||||||
- @b number replaces the <b>number</b>'th occurrence of a matching substring
|
- @b number replaces the <b>number</b>'th occurrence of a matching substring
|
||||||
with @b rex
|
with @b rex
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.hpp 272 2009-08-28 09:48:02Z hyunghwan.chung $
|
* $Id: Awk.hpp 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -74,9 +74,10 @@ public:
|
|||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
/**
|
///
|
||||||
* Defines error numbers.
|
/// The ErrorNumber defines error numbers by redefining enumerators
|
||||||
*/
|
/// of the #qse_awk_errnum_t type.
|
||||||
|
///
|
||||||
enum ErrorNumber
|
enum ErrorNumber
|
||||||
{
|
{
|
||||||
ERR_NOERR = QSE_AWK_ENOERR,
|
ERR_NOERR = QSE_AWK_ENOERR,
|
||||||
@ -198,60 +199,67 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
///
|
||||||
* The Awk::getErrorString() function returns a formatting string
|
/// The getErrorString() function returns a formatting string
|
||||||
* for an error code @a num. You can override this function
|
/// for an error code @a num. You can override this function
|
||||||
* to customize an error message. You must include the same numbers
|
/// to customize an error message. You must include the same numbers
|
||||||
* of ${X}'s as the orginal formatting string. Their order may be
|
/// of ${X}'s as the orginal formatting string. Their order may be
|
||||||
* different. The example below changes the formatting string for
|
/// different. The example below changes the formatting string for
|
||||||
* ERR_NOENT.
|
/// ERR_NOENT.
|
||||||
* @code
|
/// @code
|
||||||
* const MyAwk::char_t* MyAwk::getErrorString (ErrorNumber num) const
|
/// const MyAwk::char_t* MyAwk::getErrorString (ErrorNumber num) const
|
||||||
* {
|
/// {
|
||||||
* if (num == ERR_NOENT) return QSE_T("cannot find '${0}'");
|
/// if (num == ERR_NOENT) return QSE_T("cannot find '${0}'");
|
||||||
* return Awk::getErrorString (num);
|
/// return Awk::getErrorString (num);
|
||||||
* }
|
/// }
|
||||||
* @endcode
|
/// @endcode
|
||||||
*/
|
///
|
||||||
virtual const char_t* getErrorString (
|
virtual const char_t* getErrorString (
|
||||||
ErrorNumber num
|
ErrorNumber num
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
///
|
||||||
* The Awk::getErrorNumber() function returns the number of the last
|
/// The getErrorNumber() function returns the number of the last
|
||||||
* error occurred.
|
/// error occurred.
|
||||||
*/
|
///
|
||||||
ErrorNumber getErrorNumber () const;
|
ErrorNumber getErrorNumber () const;
|
||||||
|
|
||||||
/**
|
///
|
||||||
* The Awk::getErrorLocation() function returns the location of the
|
/// The getErrorLocation() function returns the location of the
|
||||||
* last error occurred.
|
/// last error occurred.
|
||||||
*/
|
///
|
||||||
loc_t getErrorLocation () const;
|
loc_t getErrorLocation () const;
|
||||||
|
|
||||||
/**
|
///
|
||||||
* The Awk::getErrorMessage() function returns a message describing
|
/// The Awk::getErrorMessage() function returns a message describing
|
||||||
* the last error occurred.
|
/// the last error occurred.
|
||||||
*/
|
///
|
||||||
const char_t* getErrorMessage () const;
|
const char_t* getErrorMessage () const;
|
||||||
|
|
||||||
/**
|
///
|
||||||
* Set error information.
|
/// The setError() function sets error information.
|
||||||
*/
|
///
|
||||||
void setError (
|
void setError (
|
||||||
ErrorNumber code,
|
ErrorNumber code, ///< error code
|
||||||
const cstr_t* args = QSE_NULL,
|
const cstr_t* args = QSE_NULL, ///< message formatting
|
||||||
const loc_t* loc = QSE_NULL
|
/// argument array
|
||||||
|
const loc_t* loc = QSE_NULL ///< error location
|
||||||
);
|
);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// The setErrorWithMessage() functions sets error information
|
||||||
|
/// with a customized error message.
|
||||||
|
///
|
||||||
void setErrorWithMessage (
|
void setErrorWithMessage (
|
||||||
ErrorNumber code,
|
ErrorNumber code, ///< error code
|
||||||
const char_t* msg,
|
const char_t* msg, ///< error message
|
||||||
const loc_t* loc
|
const loc_t* loc ///< error location
|
||||||
);
|
);
|
||||||
|
|
||||||
/** clears error information */
|
///
|
||||||
|
/// The clearError() function clears error information
|
||||||
|
///
|
||||||
void clearError ();
|
void clearError ();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -389,24 +397,34 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pipe
|
* The Pipe class encapsulates the pipe operations indicated by
|
||||||
|
* the | and || operators.
|
||||||
*/
|
*/
|
||||||
class Pipe: public RIOBase
|
class Pipe: public RIOBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
friend class Awk;
|
friend class Awk;
|
||||||
|
|
||||||
|
/// The Mode type defines the opening mode.
|
||||||
enum Mode
|
enum Mode
|
||||||
{
|
{
|
||||||
|
/// open for read-only access
|
||||||
READ = QSE_AWK_RIO_PIPE_READ,
|
READ = QSE_AWK_RIO_PIPE_READ,
|
||||||
|
/// open for write-only access
|
||||||
WRITE = QSE_AWK_RIO_PIPE_WRITE,
|
WRITE = QSE_AWK_RIO_PIPE_WRITE,
|
||||||
|
/// open for read and write
|
||||||
RW = QSE_AWK_RIO_PIPE_RW
|
RW = QSE_AWK_RIO_PIPE_RW
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// The CloseMode type defines the closing mode for a pipe
|
||||||
|
/// opened in the #RW mode.
|
||||||
enum CloseMode
|
enum CloseMode
|
||||||
{
|
{
|
||||||
CLOSE_FULL = QSE_AWK_RIO_CLOSE_FULL,
|
/// close both read and write ends
|
||||||
|
CLOSE_FULL = QSE_AWK_RIO_CLOSE_FULL,
|
||||||
|
/// close the read end only
|
||||||
CLOSE_READ = QSE_AWK_RIO_CLOSE_READ,
|
CLOSE_READ = QSE_AWK_RIO_CLOSE_READ,
|
||||||
|
/// close the write end only
|
||||||
CLOSE_WRITE = QSE_AWK_RIO_CLOSE_WRITE
|
CLOSE_WRITE = QSE_AWK_RIO_CLOSE_WRITE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -414,11 +432,16 @@ public:
|
|||||||
Pipe (Run* run, rio_arg_t* riod);
|
Pipe (Run* run, rio_arg_t* riod);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// The function returns the requested opening mode.
|
/// The getMode() function returns the opening mode requested.
|
||||||
|
/// You can inspect the opening mode, typically in the
|
||||||
|
/// openPipe() function, to create a pipe with proper
|
||||||
|
/// access mode. It is harmless to call this function from
|
||||||
|
/// other pipe handling functions.
|
||||||
Mode getMode () const;
|
Mode getMode () const;
|
||||||
|
|
||||||
/// The getCloseMode() function returns the requested closing
|
/// The getCloseMode() function returns the closing mode
|
||||||
/// mode. The returned value is valid if getMode() returns RW.
|
/// requested. The returned value is valid if getMode()
|
||||||
|
/// returns #RW.
|
||||||
CloseMode getCloseMode () const;
|
CloseMode getCloseMode () const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -743,7 +766,9 @@ public:
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
friend class Awk;
|
friend class Awk;
|
||||||
friend class Value;
|
friend class Value;
|
||||||
|
friend class RIOBase;
|
||||||
|
friend class Console;
|
||||||
|
|
||||||
Run (Awk* awk);
|
Run (Awk* awk);
|
||||||
Run (Awk* awk, rtx_t* run);
|
Run (Awk* awk, rtx_t* run);
|
||||||
@ -834,11 +859,11 @@ public:
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The Awk::parse() function parses the source code read from the input
|
* The Awk::parse() function parses the source code read from the input
|
||||||
* stream @a in and writes the parse tree to the output stream @out.
|
* stream @a in and writes the parse tree to the output stream @a out.
|
||||||
* To disable deparsing, you may set @a out to Awk::Source::NONE.
|
* To disable deparsing, you may set @a out to Awk::Source::NONE.
|
||||||
* However, it is not legal to specify Awk::Source::NONE for @a in.
|
* However, it is not allowed to specify Awk::Source::NONE for @a in.
|
||||||
*
|
*
|
||||||
* @return a Run object on success, #QSE_NULL on failure
|
* @return Run object on success, #QSE_NULL on failure
|
||||||
*/
|
*/
|
||||||
Awk::Run* parse (
|
Awk::Run* parse (
|
||||||
Source& in, ///< script to parse
|
Source& in, ///< script to parse
|
||||||
@ -990,7 +1015,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Sets the value of a global variable identified by @a id.
|
* Sets the value of a global variable identified by @a id.
|
||||||
* The @a id is either a value returned by Awk::addGlobal or one of
|
* The @a id is either a value returned by Awk::addGlobal or one of
|
||||||
* Awk::Global enumerators. It is not legal to call this function
|
* Awk::Global enumerators. It is not allowed to call this function
|
||||||
* prior to Awk::parse.
|
* prior to Awk::parse.
|
||||||
* @return 0 on success, -1 on failure
|
* @return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
@ -1002,7 +1027,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Gets the value of a global riable identified by @a id.
|
* Gets the value of a global riable identified by @a id.
|
||||||
* The @a id is either a value returned by Awk::addGlobal or one of
|
* The @a id is either a value returned by Awk::addGlobal or one of
|
||||||
* Awk::::Global enumerators. It is not legal to call this function
|
* Awk::::Global enumerators. It is not allowed to call this function
|
||||||
* prior to Awk::parse.
|
* prior to Awk::parse.
|
||||||
* @return 0 on success, -1 on failure
|
* @return 0 on success, -1 on failure
|
||||||
*/
|
*/
|
||||||
@ -1062,8 +1087,17 @@ protected:
|
|||||||
* Pipe operations are achieved through the following functions.
|
* Pipe operations are achieved through the following functions.
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
|
|
||||||
|
/// The openPipe() function is a pure virtual function that must be
|
||||||
|
/// overridden by a child class to open a pipe. It must return 1
|
||||||
|
/// on success, 0 on end of a pipe, and -1 on failure.
|
||||||
virtual int openPipe (Pipe& io) = 0;
|
virtual int openPipe (Pipe& io) = 0;
|
||||||
|
|
||||||
|
/// The closePipe() function is a pure virtual function that must be
|
||||||
|
/// overridden by a child class to close a pipe. It must return 0
|
||||||
|
/// on success and -1 on failure.
|
||||||
virtual int closePipe (Pipe& io) = 0;
|
virtual int closePipe (Pipe& io) = 0;
|
||||||
|
|
||||||
virtual ssize_t readPipe (Pipe& io, char_t* buf, size_t len) = 0;
|
virtual ssize_t readPipe (Pipe& io, char_t* buf, size_t len) = 0;
|
||||||
virtual ssize_t writePipe (Pipe& io, const char_t* buf, size_t len) = 0;
|
virtual ssize_t writePipe (Pipe& io, const char_t* buf, size_t len) = 0;
|
||||||
virtual int flushPipe (Pipe& io) = 0;
|
virtual int flushPipe (Pipe& io) = 0;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: StdAwk.hpp 259 2009-08-20 11:28:03Z hyunghwan.chung $
|
* $Id: StdAwk.hpp 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -24,12 +24,24 @@
|
|||||||
/** @file
|
/** @file
|
||||||
* Standard AWK Interpreter
|
* Standard AWK Interpreter
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk05.cpp
|
* @example awk05.cpp
|
||||||
* This program demonstrates how to use QSE::StdAwk::loop().
|
* This program demonstrates how to use QSE::StdAwk::loop().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk06.cpp
|
* @example awk06.cpp
|
||||||
* This program demonstrates how to use QSE::StdAwk::call().
|
* This program demonstrates how to use QSE::StdAwk::call().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk07.cpp
|
* @example awk07.cpp
|
||||||
* This program demonstrates how to handle an indexed value.
|
* This program demonstrates how to handle an indexed value.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk08.cpp
|
* @example awk08.cpp
|
||||||
* This program shows how to add intrinsic functions.
|
* This program shows how to add intrinsic functions.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.h 272 2009-08-28 09:48:02Z hyunghwan.chung $
|
* $Id: awk.h 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -26,17 +26,31 @@
|
|||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* An embeddable AWK interpreter is defined in this header file.
|
* An embeddable AWK interpreter is defined in this header file.
|
||||||
*
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk.c
|
* @example awk.c
|
||||||
* This program demonstrates how to build a complete awk interpreter.
|
* This program demonstrates how to build a complete awk interpreter.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk01.c
|
* @example awk01.c
|
||||||
* This program demonstrates how to use qse_awk_rtx_loop().
|
* This program demonstrates how to use qse_awk_rtx_loop().
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk02.c
|
* @example awk02.c
|
||||||
* The program deparses the source code and prints it before executing it.
|
* The program deparses the source code and prints it before executing it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk03.c
|
* @example awk03.c
|
||||||
* This program demonstrates how to use qse_awk_rtx_call().
|
* This program demonstrates how to use qse_awk_rtx_call().
|
||||||
* It parses the program stored in the string src and calls the functions
|
* It parses the program stored in the string src and calls the functions
|
||||||
* stated in the array fnc. If no errors occur, it should print 24.
|
* stated in the array fnc. If no errors occur, it should print 24.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example awk04.c
|
* @example awk04.c
|
||||||
* This programs shows how to qse_awk_rtx_call().
|
* This programs shows how to qse_awk_rtx_call().
|
||||||
*/
|
*/
|
||||||
@ -362,7 +376,7 @@ typedef enum qse_awk_rio_rwcmode_t qse_awk_rio_rwcmode_t;
|
|||||||
/**
|
/**
|
||||||
* The qse_awk_rio_arg_t defines the data structure passed to a runtime
|
* The qse_awk_rio_arg_t defines the data structure passed to a runtime
|
||||||
* I/O handler. An I/O handler should inspect the @a mode field and the
|
* I/O handler. An I/O handler should inspect the @a mode field and the
|
||||||
* @a name field and store an open handle to the @handle field when
|
* @a name field and store an open handle to the @a handle field when
|
||||||
* #QSE_AWK_RIO_OPEN is requested. For other request type, it can refer
|
* #QSE_AWK_RIO_OPEN is requested. For other request type, it can refer
|
||||||
* to the handle field set previously.
|
* to the handle field set previously.
|
||||||
*/
|
*/
|
||||||
@ -1567,7 +1581,7 @@ void qse_awk_rtx_geterrinf (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_awk_rtx_geterror() function retrieves error information from a
|
* The qse_awk_rtx_geterror() function retrieves error information from a
|
||||||
* runtime context @rtx. The error number is stored into memory pointed
|
* runtime context @a rtx. The error number is stored into memory pointed
|
||||||
* to by @a errnum; the error message pointer into memory pointed to by
|
* to by @a errnum; the error message pointer into memory pointed to by
|
||||||
* @a errmsg; the error line into memory pointed to by @a errlin.
|
* @a errmsg; the error line into memory pointed to by @a errlin.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: pio.h 244 2009-07-24 12:22:00Z hyunghwan.chung $
|
* $Id: pio.h 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -173,7 +173,7 @@ extern "C" {
|
|||||||
QSE_DEFINE_COMMON_FUNCTIONS (pio)
|
QSE_DEFINE_COMMON_FUNCTIONS (pio)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The qse_pio_open() function executes a command @cmd and establishes
|
* The qse_pio_open() function executes a command @a cmd and establishes
|
||||||
* pipes to it. #QSE_PIO_SHELL causes the function to execute @a cmd via
|
* pipes to it. #QSE_PIO_SHELL causes the function to execute @a cmd via
|
||||||
* the default shell of an underlying system: /bin/sh on *nix, cmd.exe on win32.
|
* the default shell of an underlying system: /bin/sh on *nix, cmd.exe on win32.
|
||||||
* On *nix systems, a full path to the command is needed if it is not specified.
|
* On *nix systems, a full path to the command is needed if it is not specified.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: StdSed.hpp 258 2009-08-19 14:04:15Z hyunghwan.chung $
|
* $Id: StdSed.hpp 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -56,7 +56,9 @@ protected:
|
|||||||
* @example sed02.cpp
|
* @example sed02.cpp
|
||||||
* The example shows how to use the QSE::StdSed class to write a simple stream
|
* The example shows how to use the QSE::StdSed class to write a simple stream
|
||||||
* editor that reads from a standard input and writes to a standard output.
|
* editor that reads from a standard input and writes to a standard output.
|
||||||
*
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example sed03.cpp
|
* @example sed03.cpp
|
||||||
* The example shows how to extend the QSE::StdSed class to read from and
|
* The example shows how to extend the QSE::StdSed class to read from and
|
||||||
* write to a string.
|
* write to a string.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: sed.h 269 2009-08-26 03:03:51Z hyunghwan.chung $
|
* $Id: sed.h 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -38,6 +38,9 @@
|
|||||||
* @todo
|
* @todo
|
||||||
* - enhance execution of the l(ell) command - consider adding a callback
|
* - enhance execution of the l(ell) command - consider adding a callback
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
* @example sed01.c
|
* @example sed01.c
|
||||||
* This example shows how to embed a basic stream editor.
|
* This example shows how to embed a basic stream editor.
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: Awk.cpp 272 2009-08-28 09:48:02Z hyunghwan.chung $
|
* $Id: Awk.cpp 275 2009-08-30 13:19:02Z hyunghwan.chung $
|
||||||
*
|
*
|
||||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ int Awk::Value::getInt (long_t* v) const
|
|||||||
run->awk->retrieveError (run);
|
run->awk->retrieveError (run);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (n >= 1) lv = rv;
|
if (n >= 1) lv = (long_t)rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
*v = lv;
|
*v = lv;
|
||||||
@ -410,7 +410,7 @@ int Awk::Value::getReal (real_t* v) const
|
|||||||
run->awk->retrieveError (run);
|
run->awk->retrieveError (run);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (n == 0) rv = lv;
|
if (n == 0) rv = (real_t)lv;
|
||||||
}
|
}
|
||||||
|
|
||||||
*v = rv;
|
*v = rv;
|
||||||
|
13
qse/regress/awk/lang-034.awk
Normal file
13
qse/regress/awk/lang-034.awk
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
BEGIN {
|
||||||
|
print "15" || "sort";
|
||||||
|
print "14" || "sort";
|
||||||
|
print "13" || "sort";
|
||||||
|
print "12" || "sort";
|
||||||
|
print "11" || "sort";
|
||||||
|
#close the input as sort emits when the input is closed
|
||||||
|
close ("sort", "r");
|
||||||
|
#close ("sort", "w");
|
||||||
|
print "-----";
|
||||||
|
while (("sort" || getline x) > 0) print "xx:", x;
|
||||||
|
}
|
||||||
|
|
@ -1666,6 +1666,27 @@ BEGIN {
|
|||||||
print x
|
print x
|
||||||
}
|
}
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
../../cmd/awk/qseawk --newline=on --rwpipe=on -o- -f lang-034.awk </dev/stdin 2>&1
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
BEGIN {
|
||||||
|
print "15" || "sort";
|
||||||
|
print "14" || "sort";
|
||||||
|
print "13" || "sort";
|
||||||
|
print "12" || "sort";
|
||||||
|
print "11" || "sort";
|
||||||
|
close ("sort","r");
|
||||||
|
print "-----";
|
||||||
|
while ((("sort" || getline x) > 0))
|
||||||
|
print "xx:",x;
|
||||||
|
}
|
||||||
|
|
||||||
|
-----
|
||||||
|
xx: 11
|
||||||
|
xx: 12
|
||||||
|
xx: 13
|
||||||
|
xx: 14
|
||||||
|
xx: 15
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
../../cmd/awk/qseawk -f quicksort.awk quicksort.dat </dev/stdin 2>&1
|
../../cmd/awk/qseawk -f quicksort.awk quicksort.dat </dev/stdin 2>&1
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
0.0000000000
|
0.0000000000
|
||||||
|
@ -136,6 +136,7 @@ PROGS="
|
|||||||
lang-031.awk///--newline=on -o-
|
lang-031.awk///--newline=on -o-
|
||||||
lang-032.awk///--newline=on -o-
|
lang-032.awk///--newline=on -o-
|
||||||
lang-033.awk///--newline=on -o-
|
lang-033.awk///--newline=on -o-
|
||||||
|
lang-034.awk///--newline=on --rwpipe=on -o-
|
||||||
|
|
||||||
quicksort.awk/quicksort.dat//
|
quicksort.awk/quicksort.dat//
|
||||||
quicksort2.awk/quicksort2.dat//
|
quicksort2.awk/quicksort2.dat//
|
||||||
@ -189,7 +190,9 @@ init)
|
|||||||
;;
|
;;
|
||||||
test)
|
test)
|
||||||
run_scripts > "${OUTFILE}.temp"
|
run_scripts > "${OUTFILE}.temp"
|
||||||
diff -q "${OUTFILE}" "${OUTFILE}.temp" || {
|
# diff -q is not supported on old platforms.
|
||||||
|
# redirect output to /dev/null instead.
|
||||||
|
diff "${OUTFILE}" "${OUTFILE}.temp" > /dev/null || {
|
||||||
echo_so "ERROR: ${OUTFILE} differs from ${OUTFILE}.temp."
|
echo_so "ERROR: ${OUTFILE} differs from ${OUTFILE}.temp."
|
||||||
echo_so " Check the scripts and output files for any errors."
|
echo_so " Check the scripts and output files for any errors."
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user