Changed multi-line C comments into another style.

The left side doesn't look unbalanced.
This commit is contained in:
Greg King
2014-06-30 05:10:35 -04:00
parent 132d57f1ad
commit 0390c34e88
502 changed files with 8869 additions and 8884 deletions

View File

@@ -96,10 +96,10 @@ void DumpAttrColl (const Collection* C)
int FindAttr (const Collection* C, const char* Name, unsigned* Index)
/* Search for an attribute with the given name in the collection. If it is
* found, the function returns true and Index contains the index of the
* entry. If Name isn't found, the function returns false and Index
* will contain the insert position.
*/
** found, the function returns true and Index contains the index of the
** entry. If Name isn't found, the function returns false and Index
** will contain the insert position.
*/
{
/* Do a binary search */
int Lo = 0;
@@ -136,8 +136,8 @@ int FindAttr (const Collection* C, const char* Name, unsigned* Index)
const Attr* GetAttr (const Collection* C, const char* Name)
/* Search for an attribute with the given name and return it. The function
* returns NULL if the attribute wasn't found.
*/
** returns NULL if the attribute wasn't found.
*/
{
/* Search for the attribute and return it */
unsigned Index;
@@ -153,9 +153,9 @@ const Attr* GetAttr (const Collection* C, const char* Name)
const Attr* NeedAttr (const Collection* C, const char* Name, const char* Op)
/* Search for an attribute with the given name and return it. If the attribute
* is not found, the function terminates with an error using Op as additional
* context in the error message.
*/
** is not found, the function terminates with an error using Op as additional
** context in the error message.
*/
{
/* Search for the attribute and return it */
unsigned Index;
@@ -169,8 +169,8 @@ const Attr* NeedAttr (const Collection* C, const char* Name, const char* Op)
const char* GetAttrVal (const Collection* C, const char* Name)
/* Search for an attribute with the given name and return its value. The
* function returns NULL if the attribute wasn't found.
*/
** function returns NULL if the attribute wasn't found.
*/
{
const Attr* A = GetAttr (C, Name);
return (A == 0)? 0 : A->Value;
@@ -180,9 +180,9 @@ const char* GetAttrVal (const Collection* C, const char* Name)
const char* NeedAttrVal (const Collection* C, const char* Name, const char* Op)
/* Search for an attribute with the given name and return its value. If the
* attribute wasn't not found, the function terminates with an error using
* Op as additional context in the error message.
*/
** attribute wasn't not found, the function terminates with an error using
** Op as additional context in the error message.
*/
{
const Attr* A = NeedAttr (C, Name, Op);
return (A == 0)? 0 : A->Value;
@@ -197,8 +197,8 @@ void AddAttr (Collection* C, const char* Name, const char* Value)
Attr* A = NewAttr (Name, Value);
/* Search for the attribute. If it is there, we have a duplicate, otherwise
* we have the insert position.
*/
** we have the insert position.
*/
unsigned Index;
if (FindAttr (C, Name, &Index)) {
Error ("Duplicate command line attribute `%s'", Name);
@@ -212,9 +212,9 @@ void AddAttr (Collection* C, const char* Name, const char* Value)
void SplitAddAttr (Collection* C, const char* Combined, const char* Name)
/* Split a combined name/value pair and add it as an attribute to C. Some
* attributes may not need a name. If the name is missing, use Name. If
* Name is NULL, terminate with an error.
*/
** attributes may not need a name. If the name is missing, use Name. If
** Name is NULL, terminate with an error.
*/
{
/* Name and value are separated by an equal sign */
const char* Pos = strchr (Combined, '=');
@@ -242,10 +242,10 @@ void SplitAddAttr (Collection* C, const char* Combined, const char* Name)
Collection* ParseAttrList (const char* List, const char** NameList, unsigned NameCount)
/* Parse a list containing name/value pairs into a sorted collection. Some
* attributes may not need a name, so NameList contains these names. If there
* were no errors, the function returns a alphabetically sorted collection
* containing Attr entries.
*/
** attributes may not need a name, so NameList contains these names. If there
** were no errors, the function returns a alphabetically sorted collection
** containing Attr entries.
*/
{
const char* Name;

View File

@@ -75,48 +75,48 @@ void DumpAttrColl (const Collection* C);
int FindAttr (const Collection* C, const char* Name, unsigned* Index);
/* Search for an attribute with the given name in the collection. If it is
* found, the function returns true and Index contains the index of the
* entry. If Name isn't found, the function returns false and Index
* will contain the insert position.
*/
** found, the function returns true and Index contains the index of the
** entry. If Name isn't found, the function returns false and Index
** will contain the insert position.
*/
const Attr* GetAttr (const Collection* C, const char* Name);
/* Search for an attribute with the given name and return it. The function
* returns NULL if the attribute wasn't found.
*/
** returns NULL if the attribute wasn't found.
*/
const Attr* NeedAttr (const Collection* C, const char* Name, const char* Op);
/* Search for an attribute with the given name and return it. If the attribute
* is not found, the function terminates with an error using Op as additional
* context in the error message.
*/
** is not found, the function terminates with an error using Op as additional
** context in the error message.
*/
const char* GetAttrVal (const Collection* C, const char* Name);
/* Search for an attribute with the given name and return its value. The
* function returns NULL if the attribute wasn't found.
*/
** function returns NULL if the attribute wasn't found.
*/
const char* NeedAttrVal (const Collection* C, const char* Name, const char* Op);
/* Search for an attribute with the given name and return its value. If the
* attribute wasn't not found, the function terminates with an error using
* Op as additional context in the error message.
*/
** attribute wasn't not found, the function terminates with an error using
** Op as additional context in the error message.
*/
void AddAttr (Collection* C, const char* Name, const char* Value);
/* Add an attribute to an alphabetically sorted attribute collection */
void SplitAddAttr (Collection* C, const char* Combined, const char* Name);
/* Split a combined name/value pair and add it as an attribute to C. Some
* attributes may not need a name. If the name is missing, use Name. If
* Name is NULL, terminate with an error.
*/
** attributes may not need a name. If the name is missing, use Name. If
** Name is NULL, terminate with an error.
*/
Collection* ParseAttrList (const char* List, const char** NameList, unsigned NameCount);
/* Parse a list containing name/value pairs into a sorted collection. Some
* attributes may not need a name, so NameList contains these names. If there
* were no errors, the function returns a alphabetically sorted collection
* containing Attr entries.
*/
** attributes may not need a name, so NameList contains these names. If there
** were no errors, the function returns a alphabetically sorted collection
** containing Attr entries.
*/
void FreeAttrList (Collection* C);
/* Free a list of attributes */

View File

@@ -69,10 +69,10 @@ void WriteBinFile (const StrBuf* Data, const Collection* A,
}
/* Write to the file. We will use fwrite here instead of the fileio
* module, since it's just one call, so the latter doesn't have any
* advantages, and we can output a more readable error message in case of
* problems.
*/
** module, since it's just one call, so the latter doesn't have any
** advantages, and we can output a more readable error message in case of
** problems.
*/
Size = SB_GetLen (Data);
if (fwrite (SB_GetConstBuf (Data), 1, Size, F) != Size) {
Error ("Error writing to output file `%s': %s", Name, strerror (errno));

View File

@@ -104,9 +104,9 @@ int ValidBitmapSize (unsigned Width, unsigned Height)
Bitmap* SliceBitmap (const Bitmap* O, unsigned OrigX, unsigned OrigY,
unsigned Width, unsigned Height)
/* Create a slice of the given bitmap. The slice starts at position X/Y of
* the original and has the given width and height. Location 0/0 is at the
* upper left corner.
*/
** the original and has the given width and height. Location 0/0 is at the
** upper left corner.
*/
{
Bitmap* B;
unsigned Y;
@@ -140,15 +140,15 @@ Bitmap* SliceBitmap (const Bitmap* O, unsigned OrigX, unsigned OrigY,
Color GetPixelColor (const Bitmap* B, unsigned X, unsigned Y)
/* Get the color for a given pixel. For indexed bitmaps, the palette entry
* is returned.
*/
** is returned.
*/
{
/* Get the pixel at the given coordinates */
Pixel P = GetPixel (B, X, Y);
/* If the bitmap has a palette, return the color from the palette. For
* simplicity, we will only check the palette, not the type.
*/
** simplicity, we will only check the palette, not the type.
*/
if (B->Pal) {
if (P.Index >= B->Pal->Count) {
/* Palette index is invalid */
@@ -166,8 +166,8 @@ Color GetPixelColor (const Bitmap* B, unsigned X, unsigned Y)
Pixel GetPixel (const Bitmap* B, unsigned X, unsigned Y)
/* Return a pixel from the bitmap. The returned value may either be a color
* or a palette index, depending on the type of the bitmap.
*/
** or a palette index, depending on the type of the bitmap.
*/
{
/* Check the coordinates */
PRECONDITION (X < B->Width && Y < B->Height);

View File

@@ -65,10 +65,10 @@ typedef struct Bitmap Bitmap;
struct Bitmap {
/* Name of the bitmap. This is used for error messages and should be
* something that allows the user to identify which bitmap the message
* refers to. For bitmaps loaded from a file, using the file name is
* a good idea.
*/
** something that allows the user to identify which bitmap the message
** refers to. For bitmaps loaded from a file, using the file name is
** a good idea.
*/
StrBuf Name;
/* Size of the bitmap */
@@ -103,19 +103,19 @@ Bitmap* SliceBitmap (const Bitmap* Original,
unsigned X, unsigned Y,
unsigned Width, unsigned Height);
/* Create a slice of the given bitmap. The slice starts at position X/Y of
* the original and has the given width and height. Location 0/0 is at the
* upper left corner.
*/
** the original and has the given width and height. Location 0/0 is at the
** upper left corner.
*/
Color GetPixelColor (const Bitmap* B, unsigned X, unsigned Y);
/* Get the color for a given pixel. For indexed bitmaps, the palette entry
* is returned.
*/
** is returned.
*/
Pixel GetPixel (const Bitmap* B, unsigned X, unsigned Y);
/* Return a pixel from the bitmap. The returned value may either be a color
* or a palette index, depending on the type of the bitmap.
*/
** or a palette index, depending on the type of the bitmap.
*/
#if defined(HAVE_INLINE)
INLINE int BitmapIsIndexed (const Bitmap* B)
@@ -170,8 +170,8 @@ INLINE const StrBuf* GetBitmapName (const Bitmap* B)
#if defined(HAVE_INLINE)
INLINE unsigned GetBitmapColors (const Bitmap* B)
/* Get the number of colors in an image. The function will return the number
* of palette entries for indexed bitmaps and 2^24 for non indexed bitmaps.
*/
** of palette entries for indexed bitmaps and 2^24 for non indexed bitmaps.
*/
{
return B->Pal? B->Pal->Count : (1U << 24);
}

View File

@@ -157,9 +157,9 @@ void WriteCFile (const StrBuf* Data, const Collection* A, const Bitmap* B)
/* Write a readable header */
fprintf (F,
"/*\n"
" * This file was generated by %s %s from\n"
" * %.*s (%ux%u, %u colors%s)\n"
" */\n"
"** This file was generated by %s %s from\n"
"** %.*s (%ux%u, %u colors%s)\n"
"*/\n"
"\n",
ProgName,
GetVersionAsString (),
@@ -169,8 +169,8 @@ void WriteCFile (const StrBuf* Data, const Collection* A, const Bitmap* B)
BitmapIsIndexed (B)? ", indexed" : "");
/* If an identifier was given, output #defines for width, height, the
* number of colors and declare a variable for the data.
*/
** number of colors and declare a variable for the data.
*/
if (Ident) {
fprintf (F,
"#define %s_COLORS %u\n"

View File

@@ -89,10 +89,10 @@ static int Compare (const void* Key, const void* MapEntry)
StrBuf* ConvertTo (const Bitmap* B, const Collection* A)
/* Convert the bitmap B into some sort of other binary format. The output is
* stored in a string buffer (which is actually a dynamic char array) and
* returned. The actual output format is taken from the "format" attribute
* in the attribute collection A.
*/
** stored in a string buffer (which is actually a dynamic char array) and
** returned. The actual output format is taken from the "format" attribute
** in the attribute collection A.
*/
{
const ConverterMapEntry* E;

View File

@@ -57,10 +57,10 @@
StrBuf* ConvertTo (const Bitmap* B, const Collection* A);
/* Convert the bitmap B into some sort of other binary format. The output is
* stored in a string buffer (which is actually a dynamic char array) and
* returned. The actual output format is taken from the "format" attribute
* in the attribute collection A.
*/
** stored in a string buffer (which is actually a dynamic char array) and
** returned. The actual output format is taken from the "format" attribute
** in the attribute collection A.
*/
void ListConversionTargets (FILE* F);
/* Output a list of conversion targets */

View File

@@ -76,15 +76,15 @@ struct RLE {
static void StoreByte (struct RLE* RLE)
/* Store a unique byte or a run of repeated bytes. If count is zero, the
* function will flush the internal buffers, so that all data is in RLE->D.
*/
** function will flush the internal buffers, so that all data is in RLE->D.
*/
{
if (RLE->Count == 1 || RLE->Count == 2) {
/* A run of two identical bytes is treated as two unique bytes, since
* this will usually merge with the following run.
*/
** this will usually merge with the following run.
*/
SB_AppendChar (&RLE->UniqueData, RLE->LastVal);
if (RLE->Count == 2) {
SB_AppendChar (&RLE->UniqueData, RLE->LastVal);
@@ -96,8 +96,8 @@ static void StoreByte (struct RLE* RLE)
} else {
/* Run of repeated bytes. First flush the temp buffer for unique
* bytes.
*/
** bytes.
*/
const char* Buf = SB_GetConstBuf (&RLE->UniqueData);
unsigned Count = SB_GetLen (&RLE->UniqueData);
while (Count) {
@@ -142,9 +142,9 @@ static void StoreByte (struct RLE* RLE)
StrBuf* GenGeosBitmap (const Bitmap* B, const Collection* A attribute ((unused)))
/* Generate binary output in GEOS compacted bitmap format for the bitmap B.
* The output is stored in a string buffer (which is actually a dynamic char
* array) and returned.
*/
** The output is stored in a string buffer (which is actually a dynamic char
** array) and returned.
*/
{
unsigned LineWidth;
unsigned char* Buf;
@@ -192,8 +192,8 @@ StrBuf* GenGeosBitmap (const Bitmap* B, const Collection* A attribute ((unused))
SB_Realloc (D, 64);
/* Compact the image. We're currently using only REPEAT and UNIQUE opcodes.
* BIGCOUNT is rather difficult to apply.
*/
** BIGCOUNT is rather difficult to apply.
*/
RLE.Buf = Buf;
RLE.Remaining = LineWidth * GetBitmapHeight (B) - 1;
RLE.LastVal = *RLE.Buf++;

View File

@@ -55,9 +55,9 @@
StrBuf* GenGeosBitmap (const Bitmap* B, const Collection* A);
/* Generate binary output in GEOS compacted bitmap format for the bitmap B.
* The output is stored in a string buffer (which is actually a dynamic char
* array) and returned.
*/
** The output is stored in a string buffer (which is actually a dynamic char
** array) and returned.
*/

View File

@@ -64,9 +64,9 @@
StrBuf* GenGeosIcon (const Bitmap* B, const Collection* A attribute ((unused)))
/* Generate binary output in GEOS icon format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/
{
StrBuf* D;
unsigned X, Y;

View File

@@ -55,9 +55,9 @@
StrBuf* GenGeosIcon (const Bitmap* B, const Collection* A);
/* Generate binary output in GEOS icon format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/

View File

@@ -87,9 +87,9 @@ static const FileId FormatTable[] = {
Bitmap* ReadInputFile (const Collection* A)
/* Read a bitmap from a file and return it. Format, file name etc. must be
* given as attributes in A. If no format is given, the function tries to
* autodetect it by using the extension of the file name.
*/
** given as attributes in A. If no format is given, the function tries to
** autodetect it by using the extension of the file name.
*/
{
const FileId* F;

View File

@@ -54,9 +54,9 @@
Bitmap* ReadInputFile (const Collection* A);
/* Read a bitmap from a file and return it. Format, file name etc. must be
* given as attributes in A. If no format is given, the function tries to
* autodetect it by using the extension of the file name.
*/
** given as attributes in A. If no format is given, the function tries to
** autodetect it by using the extension of the file name.
*/

View File

@@ -62,9 +62,9 @@
StrBuf* GenKoala (const Bitmap* B, const Collection* A attribute ((unused)))
/* Generate binary output in koala format for the bitmap B. The output is
* stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/
{
StrBuf* D;
unsigned char Screen[160][200];

View File

@@ -55,9 +55,9 @@
StrBuf* GenKoala (const Bitmap* B, const Collection* A);
/* Generate binary output in koala format for the bitmap B. The output is
* stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/

View File

@@ -235,22 +235,22 @@ static void WriteOutBuffer(StrBuf *D)
static void encodeSprite(StrBuf *D, enum Mode M, char ColorBits, char ColorMask, char LineBuffer[512],
int len, int LastOpaquePixel) {
/*
* The data starts with a byte count. It tells the number of bytes on this
* line + 1.
* Special case is a count of 1. It will change to next quadrant.
* Other special case is 0. It will end the sprite.
*
* Ordinary data packet. These are bits in a stream.
* 1=literal 0=packed
* 4 bit count (+1)
* for literal you put "count" values
* for packed you repeat the value "count" times
* Never use packed mode for one pixel
* If the last bit on a line is 1 you need to add a byte of zeroes
* A sequence 00000 ends a scan line
*
* All data is high nybble first
*/
** The data starts with a byte count. It tells the number of bytes on this
** line + 1.
** Special case is a count of 1. It will change to next quadrant.
** Other special case is 0. It will end the sprite.
**
** Ordinary data packet. These are bits in a stream.
** 1=literal 0=packed
** 4 bit count (+1)
** for literal you put "count" values
** for packed you repeat the value "count" times
** Never use packed mode for one pixel
** If the last bit on a line is 1 you need to add a byte of zeroes
** A sequence 00000 ends a scan line
**
** All data is high nybble first
*/
unsigned char V = 0;
signed i;
signed count;
@@ -369,17 +369,17 @@ static void encodeSprite(StrBuf *D, enum Mode M, char ColorBits, char ColorMask,
StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A)
/* Generate binary output in Lynx sprite format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*
* The Lynx will draw 4 quadrants:
* - Down right
* - Up right
* - Up left
* - Down left
*
* The sprite will end with a byte 0.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
**
** The Lynx will draw 4 quadrants:
** - Down right
** - Up right
** - Up left
** - Down left
**
** The sprite will end with a byte 0.
*/
{
enum Mode M;
StrBuf* D;

View File

@@ -55,9 +55,9 @@
StrBuf* GenLynxSprite (const Bitmap* B, const Collection* A);
/* Generate binary output in packed Lynx sprite format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/

View File

@@ -107,8 +107,8 @@ static void Usage (void)
static void SetWorkBitmap (Bitmap* N)
/* Delete an old working bitmap and set a new one. The new one may be NULL
* to clear it.
*/
** to clear it.
*/
{
/* If we have a distinct work bitmap, delete it */
if (C != 0 && C != B) {
@@ -123,8 +123,8 @@ static void SetWorkBitmap (Bitmap* N)
static void SetOutputData (StrBuf* N)
/* Delete the old output data and replace it by the given one. The new one
* may be NULL to clear it.
*/
** may be NULL to clear it.
*/
{
/* Delete the old output data */
if (D != 0) {

View File

@@ -106,11 +106,11 @@ static const FileId FormatTable[] = {
void WriteOutputFile (const StrBuf* Data, const Collection* A, const Bitmap* B)
/* Write the contents of Data to a file. Format, file name etc. must be given
* as attributes in A. If no format is given, the function tries to autodetect
* it by using the extension of the file name. The bitmap passed to the
* function is the bitmap used as source of the conversion. It may be used to
* determine the bitmap properties for documentation purposes.
*/
** as attributes in A. If no format is given, the function tries to autodetect
** it by using the extension of the file name. The bitmap passed to the
** function is the bitmap used as source of the conversion. It may be used to
** determine the bitmap properties for documentation purposes.
*/
{
const FileId* F;

View File

@@ -54,11 +54,11 @@
void WriteOutputFile (const StrBuf* Data, const Collection* A, const Bitmap* B);
/* Write the contents of Data to a file. Format, file name etc. must be given
* as attributes in A. If no format is given, the function tries to autodetect
* it by using the extension of the file name. The bitmap passed to the
* function is the bitmap used as source of the conversion. It may be used to
* determine the bitmap properties for documentation purposes.
*/
** as attributes in A. If no format is given, the function tries to autodetect
** it by using the extension of the file name. The bitmap passed to the
** function is the bitmap used as source of the conversion. It may be used to
** determine the bitmap properties for documentation purposes.
*/

View File

@@ -153,10 +153,10 @@ static PCXHeader* ReadPCXHeader (FILE* F, const char* Name)
P->Compressed, Name);
}
/* We support:
* - one plane with either 1 or 8 bits per pixel
* - three planes with 8 bits per pixel
* - four planes with 8 bits per pixel (does this exist?)
*/
** - one plane with either 1 or 8 bits per pixel
** - three planes with 8 bits per pixel
** - four planes with 8 bits per pixel (does this exist?)
*/
if (!((P->BPP == 1 && P->Planes == 1) ||
(P->BPP == 8 && (P->Planes == 1 || P->Planes == 3 || P->Planes == 4)))) {
/* We could support others, but currently we don't */
@@ -326,8 +326,8 @@ Bitmap* ReadPCXFile (const Collection* A)
}
/* One plane means we have a palette which is either part of the header
* or follows.
*/
** or follows.
*/
if (P->PalInfo == 0) {
/* Create the monochrome palette */

View File

@@ -52,8 +52,8 @@
StrBuf* GenRaw (const Bitmap* B, const Collection* A attribute ((unused)))
/* Generate binary output in raw format. The output is stored in a string
* buffer (which is actually a dynamic char array) and returned.
*/
** buffer (which is actually a dynamic char array) and returned.
*/
{
StrBuf* D;
unsigned X, Y;

View File

@@ -55,8 +55,8 @@
StrBuf* GenRaw (const Bitmap* B, const Collection* A);
/* Generate binary output in raw format. The output is stored in a string
* buffer (which is actually a dynamic char array) and returned.
*/
** buffer (which is actually a dynamic char array) and returned.
*/

View File

@@ -92,9 +92,9 @@ static enum Mode GetMode (const Collection* A)
StrBuf* GenVic2Sprite (const Bitmap* B, const Collection* A)
/* Generate binary output in VICII sprite format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/
{
enum Mode M;
StrBuf* D;

View File

@@ -55,9 +55,9 @@
StrBuf* GenVic2Sprite (const Bitmap* B, const Collection* A);
/* Generate binary output in VICII sprite format for the bitmap B. The output
* is stored in a string buffer (which is actually a dynamic char array) and
* returned.
*/
** is stored in a string buffer (which is actually a dynamic char array) and
** returned.
*/