From 3a536492ca2ef84d4ddfbffb3d3a6fc49fdbfbaa Mon Sep 17 00:00:00 2001 From: izydorst Date: Fri, 4 Apr 2003 21:16:15 +0000 Subject: [PATCH] replaced 'int' by 'unsigned' where appropriate git-svn-id: svn://svn.cc65.org/cc65/trunk@2040 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- doc/geos.sgml | 75 +++++++++++++++++++++-------------------- include/geos/gdisk.h | 8 ++--- include/geos/gfile.h | 9 ++--- include/geos/ggraph.h | 20 +++++------ include/geos/gmemory.h | 19 ++++++----- include/geos/gprocess.h | 2 +- include/geos/gstruct.h | 24 ++++++------- include/geos/gsys.h | 2 +- 8 files changed, 82 insertions(+), 77 deletions(-) diff --git a/doc/geos.sgml b/doc/geos.sgml index bc9d11b97..857de5268 100644 --- a/doc/geos.sgml +++ b/doc/geos.sgml @@ -50,17 +50,20 @@ changed between -It is safe to use these standard includes and its contents: +It is safe to use these standard includes and their contents: It was not tested enough, but functions from these includes might work under GEOS: +Functions from the headers above are either standard C library functions or cc65-specific, in +either case they are not GEOS specific and so they are not described here. +

I am an assembler programmer and GEOSLib was designed in such way that cc65 could emit the best available code (well, the best as for machine :). Many of the Requirements

@@ -159,9 +162,9 @@ series of -You might wonder why I have chosen sometimes weird order of arguments in functions. It is because -I wanted to avoid unnecessary pushing and popping arguments from stack. cc65 can pass single Do not try to compile in strict ANSI mode. Library uses cc65 extensions which are not available in ANSI. @@ -248,27 +251,27 @@ horizontal lines. HorizontalLine

- This function draws horizontal line using given pattern - here it is a true bit pattern, not pattern set by InvertLine

- There is only horizontal version. RecoverLine

- This function recovers only one line. It is utilized by VerticalLine

- This function draws vertical line using given pattern. Note that PutString

- Same as PutDecimal

- This function converts BitmapClip

- This function acts similar to BitOtherClip

- Similar to the previous one with some extension. CalcBlksFree

- This function returns the number of free blocks on current disk. It is counted using data in BlkAlloc and NxtBlkAlloc

- - Both functions are allocating enough disk sectors to fit the number of struct tr_se myTrSe; ... -(int)myTrSe=(int)SetNextFree(&otherTrSe); +(unsigned)myTrSe=(unsigned)SetNextFree(&otherTrSe);

In this example These two functions are best suited for scanning whole directory for particular files. Note that returned filehandles describes all file slots in the directory - even those with deleted files. -The return value can be obtained by casting both sides to ReadFile

- This function reads at most ReadRecord and WriteRecord

- - This function will load or save at most CRC

- This function calculates the CRC checksum for given memory range. I don't know if it is compatible with standard CRC routines. FillRam and ClearRam

- - Both functions are filling given memory range. MoveData

- This functions copies one memory region to another. There are checks for overlap and the non-destructive method is chosen. Be warned that this function destroys contents of @@ -1105,13 +1108,13 @@ This is done with Stash, Fetch, Swap, and VerifyRAM

- - - - These functions are interface to REU - Ram Expansion Unit. I think that they are self-explanatory. You can check for REU presence by taking value of Sleep

- This function is multitasking sleep - the program is halted, but it doesn't block other functions. The only argument here is the number of jiffies to wait until app will wake up. @@ -1256,7 +1259,7 @@ you don't need to check if the pointer is valid. GetSerialNumber

- This function returns the serial number of system. It might be used for copy-protection. However, please remember that the Free Software is a true power and you are using it @@ -1403,9 +1406,9 @@ pair. You should declare a table of that type to prepare data for Few thing in detail...

@@ -1522,7 +1525,7 @@ is variable. Consider following: char text = "foo"; ... - r15=(int)text; // in code just before call to DoDlgBox + r15=(unsigned)text; // in code just before call to DoDlgBox ... DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &r15), ... diff --git a/include/geos/gdisk.h b/include/geos/gdisk.h index e6dba969d..99d119eb7 100644 --- a/include/geos/gdisk.h +++ b/include/geos/gdisk.h @@ -21,19 +21,19 @@ char __fastcall__ ReadBlock(struct tr_se *myTrSe, char *buffer); char __fastcall__ WriteBlock(struct tr_se *myTrSe, const char *buffer); char __fastcall__ VerWriteBlock(struct tr_se *myTrSe, const char *buffer); -int __fastcall__ CalcBlksFree(void); +unsigned __fastcall__ CalcBlksFree(void); char __fastcall__ ChkDkGEOS(void); char __fastcall__ SetGEOSDisk(void); char __fastcall__ NewDisk(void); char __fastcall__ OpenDisk(void); char __fastcall__ FindBAMBit(struct tr_se *myTrSe); -char __fastcall__ BlkAlloc(struct tr_se output[], int length); +char __fastcall__ BlkAlloc(struct tr_se output[], unsigned length); char __fastcall__ NxtBlkAlloc(struct tr_se *startTrSe, - struct tr_se output[], int length); + struct tr_se output[], unsigned length); char __fastcall__ FreeBlock(struct tr_se *myTrSe); struct tr_se __fastcall__ SetNextFree(struct tr_se *myTrSe); -// above needs (int) casts on both sides of '=' +// above needs (unsigned) casts on both sides of '=' char __fastcall__ GetDirHead(void); char __fastcall__ PutDirHead(void); diff --git a/include/geos/gfile.h b/include/geos/gfile.h index 34ef6869a..e6f9c14d2 100644 --- a/include/geos/gfile.h +++ b/include/geos/gfile.h @@ -17,9 +17,10 @@ struct filehandle *__fastcall__ GetNxtDirEntry(void); char __fastcall__ FindFTypes(char *buffer, char ftype, char fmaxnum, const char *classtxt); -char __fastcall__ GetFile(char flag, const char *fname, const char *loadaddr, const char *datadname, char *datafname); +char __fastcall__ GetFile(char flag, const char *fname, const char *loadaddr, + const char *datadname, char *datafname); char __fastcall__ FindFile(const char *fname); -char __fastcall__ ReadFile(struct tr_se *myTrSe, char *buffer, int flength); +char __fastcall__ ReadFile(struct tr_se *myTrSe, char *buffer, unsigned flength); char __fastcall__ SaveFile(struct fileheader *myHeader); char __fastcall__ FreeFile(struct tr_se myTable[]); char __fastcall__ DeleteFile(const char *fname); @@ -38,8 +39,8 @@ char __fastcall__ PointRecord(char); char __fastcall__ DeleteRecord(void); char __fastcall__ InsertRecord(void); char __fastcall__ AppendRecord(void); -char __fastcall__ ReadRecord(char *buffer, int flength); -char __fastcall__ WriteRecord(const char *buffer, int flength); +char __fastcall__ ReadRecord(char *buffer, unsigned flength); +char __fastcall__ WriteRecord(const char *buffer, unsigned flength); char __fastcall__ UpdateRecordFile(void); /* GEOS filetypes */ diff --git a/include/geos/ggraph.h b/include/geos/ggraph.h index 8f8452233..6171cf61d 100644 --- a/include/geos/ggraph.h +++ b/include/geos/ggraph.h @@ -14,14 +14,14 @@ #endif void __fastcall__ cpputs(char *s); -void __fastcall__ cpputsxy(int x, int y, char *s); +void __fastcall__ cpputsxy(unsigned x, unsigned y, char *s); void __fastcall__ SetPattern(char newpattern); -void __fastcall__ HorizontalLine(char pattern, char y, int xstart, int xend); -void __fastcall__ InvertLine(char y, int xstart, int xend); -void __fastcall__ RecoverLine(char y, int xstart, int xend); -void __fastcall__ VerticalLine(char pattern, char ystart, char yend, int x); +void __fastcall__ HorizontalLine(char pattern, char y, unsigned xstart, unsigned xend); +void __fastcall__ InvertLine(char y, unsigned xstart, unsigned xend); +void __fastcall__ RecoverLine(char y, unsigned xstart, unsigned xend); +void __fastcall__ VerticalLine(char pattern, char ystart, char yend, unsigned x); void __fastcall__ InitDrawWindow(struct window *myRectangle); void __fastcall__ Rectangle(void); @@ -35,19 +35,19 @@ void __fastcall__ DrawLine(struct window *topBotCoords); void __fastcall__ DrawPoint(struct pixel *myPixel); char __fastcall__ TestPoint(struct pixel *myPixel); -void __fastcall__ PutChar(char character, char y, int x); -void __fastcall__ PutString(char *myString, char y, int x); -void __fastcall__ PutDecimal(char style, int value, char y, int x); +void __fastcall__ PutChar(char character, char y, unsigned x); +void __fastcall__ PutString(char *myString, char y, unsigned x); +void __fastcall__ PutDecimal(char style, int value, char y, unsigned x); char __fastcall__ GetCharWidth(char character); void __fastcall__ LoadCharSet(struct fontdesc *myFont); void __fastcall__ UseSystemFont(void); void __fastcall__ BitmapUp(struct iconpic *myIcon); -void __fastcall__ BitmapClip(char skipl, char skipr, int skiptop, +void __fastcall__ BitmapClip(char skipl, char skipr, unsigned skiptop, struct iconpic *myIcon); void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl, - char skipr, int skiptop, + char skipr, unsigned skiptop, struct iconpic *myIcon); void __fastcall__ GraphicsString(char *myGfxString); diff --git a/include/geos/gmemory.h b/include/geos/gmemory.h index 2f42d172d..cf421d748 100644 --- a/include/geos/gmemory.h +++ b/include/geos/gmemory.h @@ -2,7 +2,8 @@ GEOS memory and string functions ported to small C on 27.10.1999 - by Maciej 'YTM/Alliance' Witkowiak + by Maciej 'YTM/Elysium' Witkowiak + 04.04.2003 - updates */ #ifndef _GMEMORY_H @@ -17,17 +18,17 @@ char __fastcall__ CmpString(const char *dest, const char *source); void __fastcall__ CopyFString(char len, char *dest, const char *source); char __fastcall__ CmpFString(char len, char *dest, const char *source); -int __fastcall__ CRC(const char *buffer, int len); -void __fastcall__ ClearRam(char *dest, int len); -void __fastcall__ FillRam(char *dest, char what, int len); +unsigned __fastcall__ CRC(const char *buffer, unsigned len); +void __fastcall__ ClearRam(char *dest, unsigned len); +void __fastcall__ FillRam(char *dest, char what, unsigned len); -void __fastcall__ MoveData(char *dest, const char *source, int len); +void __fastcall__ MoveData(char *dest, const char *source, unsigned len); void __fastcall__ InitRam(char *myInitTab); -void __fastcall__ StashRAM(char REUBank, int len, char *reuaddy, const char *cpuaddy); -void __fastcall__ FetchRAM(char REUBank, int len, const char *reuaddy, char *cpuaddy); -void __fastcall__ SwapRAM(char REUBank, int len, char *reuaddy, char *cpuaddy); -char __fastcall__ VerifyRAM(char REUBank, int len, const char *reuaddy, const char *cpuaddy); +void __fastcall__ StashRAM(char REUBank, unsigned len, char *reuaddy, const char *cpuaddy); +void __fastcall__ FetchRAM(char REUBank, unsigned len, const char *reuaddy, char *cpuaddy); +void __fastcall__ SwapRAM(char REUBank, unsigned len, char *reuaddy, char *cpuaddy); +char __fastcall__ VerifyRAM(char REUBank, unsigned len, const char *reuaddy, const char *cpuaddy); #endif diff --git a/include/geos/gprocess.h b/include/geos/gprocess.h index e867867d0..16a13950f 100644 --- a/include/geos/gprocess.h +++ b/include/geos/gprocess.h @@ -20,6 +20,6 @@ void __fastcall__ UnBlockProcess(char number); void __fastcall__ FreezeProcess(char number); void __fastcall__ UnFreezeProcess(char number); -void __fastcall__ Sleep(int jiffies); +void __fastcall__ Sleep(unsigned jiffies); #endif diff --git a/include/geos/gstruct.h b/include/geos/gstruct.h index e410ec3a5..5535b9abe 100644 --- a/include/geos/gstruct.h +++ b/include/geos/gstruct.h @@ -46,9 +46,9 @@ struct fileheader { /* header block (like fileHeader) */ char dostype; char type; char structure; - int load_address; - int end_address; - int exec_address; + unsigned load_address; + unsigned end_address; + unsigned exec_address; char class_name[19]; char column_flag; char author[63]; @@ -63,11 +63,11 @@ struct filehandle { /* filehandle in directory sectors */ char structure; char type; struct f_date date; - int size; + unsigned size; }; struct pixel { /* describes point */ - int x; + unsigned x; char y; }; @@ -82,20 +82,20 @@ struct fontdesc { /* describes font */ struct window { /* describes screen region */ char top; char bot; - int left; - int right; + unsigned left; + unsigned right; }; struct VLIR_info { /* VLIR information */ char curRecord; /* currently only used in VLIR */ char usedRecords; /* as system info (curRecord is mainly of your interest */ char fileWritten; - int fileSize; + unsigned fileSize; }; struct process { /* process info, declare table of that type */ - int pointer; /* (like: struct process proctab[2]=... */ - int jiffies; /* last entry HAVE TO BE {0,0} */ + unsigned pointer; /* (like: struct process proctab[2]=... */ + unsigned jiffies; /* last entry HAVE TO BE {0,0} */ }; @@ -113,7 +113,7 @@ struct icondef { /* icon definition for DoIcons */ char y; char width; /* of icon (in cards) */ char heigth; /* of icon in lines (pixels) */ - int proc_ptr; /* pointer to function handling that icon */ + unsigned proc_ptr; /* pointer to function handling that icon */ }; struct icontab { @@ -136,7 +136,7 @@ struct menu { }; struct inittab { /* use struct inittab mytab[n] for initram */ - int ptr; /* ptr to 1st byte */ + unsigned ptr; /* ptr to 1st byte */ char number; /* number of following bytes */ char values[]; /* actual string of bytes */ }; diff --git a/include/geos/gsys.h b/include/geos/gsys.h index a367d255d..09017a1c3 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -18,7 +18,7 @@ void __fastcall__ Panic(void); void __fastcall__ CallRoutine(void *myRoutine); -int __fastcall__ GetSerialNumber(void); +unsigned __fastcall__ GetSerialNumber(void); char __fastcall__ GetRandom(void); void __fastcall__ SetDevice(char newdev); -- 2.39.2