[Cobolforgcc-devel] Re: Numeric Moves, Unedit, & Unedit Moves
Status: Pre-Alpha
Brought to you by:
timjosling
|
From: Tim J. <te...@me...> - 2000-08-20 07:07:50
|
"Theodore J. Seward, Jr." wrote:
>
> Tim,
>
> Here are the Numeric Move, unedit, and unedit move routines. I
> think I've got it working okay, but as before I'm sure errors
> will be there and fixed over time. Before things are done,
> these routines would most likely be rewritten as needed.
>
> I'll try to finish the display in the next few days.
>
> Good Luck - Ted Seward
>
> Numeric Edited Moves
> ------- ------ -----
>
>
> --------
> Overview
> --------
>
> Routines like these have to start with an apology. They are
> sometimes slow, take
> lots of arguments. The main reason is processing of all data
> types versus all data
> types. The argument list look more complex than they really
> are. Please look at
> the examples in test_cobr_editMove.c for examples.
>
>
> These routines provide 3 basic types of functionality;
>
> * Moving non edited fields to edited fields
> * Moving edited fields to edited fields
> * Unediting a fields
>
>
> There are two minor services:
>
> * Changing the currency symbol
> * Swapping the meaning of the Decimal and comma.
>
>
> Typical, the compiler will call one function to do some basic
> analysis of the picture
> clauses. The results of this call will provide the arguments
> needed to generate the
> call to be inserted into the output.
>
>
> For example, to move a non edited field to an edited field:
>
> 1. The compiler will call the routine cobr_emEditMove_Analyze
> to encode the
> source and destination pictures, plus provide a few
> counters pertaining to
> the decimal points relationship between the picture
> clauses.
>
> 2. The compiler will emit code to call cobr_emEditMove, with
> arguments pointing
> to the source and destination fields along with the output
> returned by the
> analysis program.
>
>
> The supplied functions are (See prototypes later in this file):
>
>
>
> cobr_emEditMove_Analyze - Compiler analysis routine for
> EditMove
> cobr_emEditMove - Move numeric fields
> cobr_emUnedit_Analyze - Complier analysis routine for
> unedit of edited field
> cobr_emUnedit - Unedit an edited field
> cobr_emUneditMove_Analyze - Compiler analysis routine for
> unedit move
> cobr_emUneditMove - move an edited field
> cobr_emSetCurrencySymbol - Set the Currency Symbol (defaults
> to Currency='$')
> cobr_emSetDecimalIsComma - Set Decimal is Comma flag (defaults
> to Decimal='.')
>
>
> ------------------------------------------------------------------
>
> Typical code for compiler -- Note printf below implies emited
> code
> ------------------------------------------------------------------
>
>
>
> Moving non edited field to edited field
> ---------------------------------------
>
> char destPic[32]; /* Destination Picture */
> char sourcePic[32]; /* Source Picture */
> char outArea[32]; /* Output Area */
>
> int digTotal; /* Total digits in destination */
> int digLeft; /* Digits to left of decimal in
> destination */
> int digRight; /* Digits to right of decimal in soruce
> */
> char editPic[32]; /* Encoded desintation picture */
>
> cobr_emEditMove_Analyze (editPic, &digTotal, &digLeft,
> &digRight, destPic, sourcePic);
>
> printf("cobr_emEditMove (outArea, sizeof(outArea),
> cobr_typeDisplay, cobr_flagNull,\n");
> printf(" \"%s\", %d, %d, %d,\n", editPic,
> digTotal, digLeft, digRight);
> printf(" inValue, inLen,
> cobr_typeDisplay,\n");
> printf("
> cobr_flagSignLead|cobr_flagOverpunch);\n");
>
>
> Moving Edited field to edited field
> -----------------------------------
>
> char destPic[32]; /* Destination Picture */
> char sourcePic[32]; /* Source Picture */
> char outArea[32]; /* Output Area */
>
> int digTotal; /* Total digits in destination */
> int digLeft; /* Digits to left of decimal in
> destination */
> int digRight; /* Digits to right of decimal in soruce
> */
> int digUnedit; /* Digits unedited */
> char editPic[32]; /* Encoded desintation picture */
> char uneditPic[32]; /* Source unediting Picture */
>
> cobr_emUneditMove_Analyze (editPic, &digTotal, &digLeft,
> &digRight,
> uneditPic, &digUnedit, destPic,
> sourcePic);
>
> printf("cobr_emUneditMove (outArea, sizeof(outArea),
> cobr_typeDisplay, cobr_flagNull,\n");
> printf(" \"%s\, %d, %d, %d,\n", editPic,
> digitTotal, digitLeft, digitRight);
> printf(" \"%s\", %d, inValue,
> cobr_typeDisplay, cobr_flagNull);\n",uneditPic,digUnedit);
>
>
> Unedit fields
> -------------
>
> char sourcePic[32]; /* Source Picture */
> char outArea[32]; /* Output Area */
>
> int digUnedit; /* Digits unedited */
> char editPic[32]; /* Encoded desintation picture */
> char uneditPic[32]; /* Source unediting Picture */
>
> cobr_emUnedit_Analyze (editPic, uneditPic, &digUnedit,
> sourcePic);
>
> printf("cobr_emUnedit (outArea, sizeof (outArea), \"%s\",
> %d,\n",uneditPic,digUnedit);
> printf(" inValue, cobr_typeDisplay,
> cobr_flagNull);\n");
>
>
> ---------------------------------------------
> Defeind bit flags for data types and modifier
> ---------------------------------------------
>
> // Usage Types
>
> #define cobr_typeNull 0x00000000 /* Null type */
> #define cobr_typeText 0x80000000 /* Text Type */
> #define cobr_typeDisplay 0x40000000 /* Display */
> #define cobr_typePacked 0x20000000 /* Packed Decimal */
> #define cobr_typeBinary 0x10000000 /* Signed binary */
> #define cobr_typeUnsigned 0x08000000 /* Unsigned binary */
> #define cobr_typeFloat 0x04000000 /* Floating point */
>
>
> // Usage Flags
>
> #define cobr_flagNull 0x00000000 /* Null type */
> #define cobr_flagSignLead 0x80000000 /* Display with SIGN
> IS LEADING */
> #define cobr_flagSignTrail 0x40000000 /* Display with SIGN
> IS TRAILING */
> #define cobr_flagOverpunch 0x20000000 /* Display with SIGN
> IS TRAILING SEPARATE CHARACTER */
>
> ------------------------------------------------
> Actual data type definitions defined in config.h
> ------------------------------------------------
>
> Singed Integer Binary Data Types
>
> #define INT8 signed char /* 8 bit signed binary */
> #define INT16 short /* 16 bit signed binary */
>
> #define INT32 int /* 32 bit signed binary */
>
> #define INT64 long long /* 64 bit signed binary */
>
> #define INT128 long long /* 128 bit signed binary
> */
>
> Unsinged Integer Binary Data Types
>
> #define UINT8 unsigned char /* 8 bit unsigned binary
> */
> #define UINT16 unsigned short /* 16 bit unsigned binary
> */
> #define UINT32 unsigned int /* 32 bit unsigned binary
> */
> #define UINT64 unsigned long long /* 64 bit unsigned binary
> */
> #define UINT128 unsigned long long /* 128 bit unsigned binary
> */
>
> Floating point Binary Data Types
>
> #define FLOAT32 float /* 32 bit floating point
> */
> #define FLOAT64 double /* 64 bit floating point
> */
> #define FLOAT128 long double /* 128 bit floating point
> */
>
> ----------
> Prototypes
> ----------
>
> char *
> cobr_emEditMove_Analyze /* Destination */
> (char *Picture, /* Output Picture */
> int *destDigitTotal, /* Digits in destination */
> int *destDigitLeft /* Destination digits left
> of decimal */
> int *sourceDigitRight,/* Source digits right of
> decimal */
> char *destPic, /* Destination Picture */
> char *sourcePic); /* Source Picture */
>
> int cobr_emEditMove
> (void *dest, /* Destination */
> size_t destLen, /* Destination Length */
> int destType, /* Destination Type */
> int destFlags, /* Destination flags */
> char *picture, /* Destination Encoded
> Picture (from cobr_emEditMove_Analyze) */
> int destDigitTotal, /* total digits in number
> (from cobr_emEditMove_Analyze) */
> int destDigitLeft, /* digits to left of decimal
> in destination (from cobr_emEditMove_Analyze) */
> int sourceDigitRight, /* digits to right of
> decimal in source (from cobr_emEditMove_Analyze) */
> void *source, /* Source */
> size_t sourceLen, /* Source Length */
> int sourceType, /* Source Type */
> int sourceFlags); /* Source Flags */
>
> char * /* destPicture */
> cobr_emUnedit_Analyze
> (char *editPicture, /* edit Picture (for
> cobr_em_editMove) */
> char *uneditPicture, /* Unedit picture (for
> cobr_emUnedit) */
> int *uneditDigits, /* Digits in unedited
> picture (for cobr_emUnedit) */
> char *sourcePic); /* Source Picture */
>
> char * /* Destination */
> cobr_emUnedit
> (void *dest, /* Destination */
> size_t destLen, /* Destination Length */
> char *uneditPic, /* Unedit Encoded Picture
> (from cobr_emUnedit_Analyze) */
> int uneditDigits, /* Unedit Digits (from
> cobr_emUnedit_Analyze) */
> void *source, /* Source */
> int sourceType, /* Source Type */
> int sourceFlags); /* Source Flags */
>
> int cobr_emUneditMove_Analyze
> (char *Picture, /* Encoded Output Picture */
>
> int *destDigitTotal, /* Digits in destination */
> int *destDigitLeft, /* Destination digits left
> of decimal */
> int *sourceDigitRight,/* Source digits right of
> decimal */
> char *uneditPicture, /* Unedit Picture */
> int *uneditDigits, /* Digits in unedited
> picture */
> char *destPic, /* Original Destination
> Picture */
> char *sourcePic); /* Original Source Picture
> */
>
> int cobr_emUneditMove
> (void *dest, /* Destination */
> size_t destLen, /* Destination Length */
> int destType, /* Destination Type */
> int destFlags, /* Destination Flags */
> char *Picture, /* Destination Encoded
> Picture */
> int destDigitTotal, /* total digits in number
> */
> int destDigitLeft, /* digits to left of decimal
> in destination */
> int sourceDigitRight, /* digits to right of
> decimal in source */
> char *uneditPicture, /* Picture for unedited data
> */
> int uneditDigits, /* Digits in unedited
> picture */
> void *source, /* Source */
> int sourceType, /* Source Type */
> int sourceFlags); /* Source Flags */
>
> int cobr_emSetCurrencySymbol
> (char symbol); /* New currency symbol */
>
> int cobr_emSetDecimalIsComma
> (int flag); /* True if Decimal characer
> is comma */
>
>
>
> Name: cobr_editMove.tar.gz
> cobr_editMove.tar.gz Type: Unix Tape Archive
> (application/x-tar)
> Encoding: base64
|