|
From: <ze...@us...> - 2002-09-03 06:24:23
|
Update of /cvsroot/subtrick/TiTan/src/lib/ansi
In directory usw-pr-cvs1:/tmp/cvs-serv7076
Modified Files:
isxdigit.c m_isxdigit.c isalnum.c m_isalnum.c Makefile
Added Files:
iscntrl.c m_iscntrl.c isprint.c m_isprint.c isgraph.c
m_isgraph.c ispunct.c m_ispunct.c toascii.c m_toascii.c
Log Message:
update to somelibs and adding the rest of libs
--- NEW FILE: iscntrl.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: iscntrl.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function takes 'c' and checks if its control
charector then retiurn 1 else it return 0
*/
int iscntrl (int c)
{
if ( c <' ' || c >='\del')
return 1;
else
return 0;
}
--- NEW FILE: m_iscntrl.c ---
#include <stdio.h>
int main()
{
int c='\del';
if (iscntrl(c))
printf ("%c is chtrl char\n ",c);
else
printf ("%c is not chtrl char \n",c);
return 0;
}
--- NEW FILE: isprint.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isprint.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function taht takes 'c' and checks if it's not a control charecter
then its a printable charecter and return 1
*/
int isprint (int c)
{
if (! (c<' ' || c>= '\del'))
return 1;
else
return 0;
}
--- NEW FILE: m_isprint.c ---
#include <stdio.h>
int main ()
{
int c= '\n';
if (isprint (c))
printf ("%c is printable\n",c);
else
printf ("%c is not printable\n",c);
return 0;
}
--- NEW FILE: isgraph.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: isgraph.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* function taht takes 'c' and checks if it's a printable charecter
then its a graph charecter and return 1
// note the the graph charecters like print charecter they're both not control charecters
*/
int isgraph (int c)
{
if ( c<=' ' || c>= '\del' )
return 0;
else
return 1;
}
--- NEW FILE: m_isgraph.c ---
#include <stdio.h>
int main ()
{
int c= ' ';
if (isgraph (c))
printf ("%c is graphical\n",c);
else
printf ("%c is not graphical\n",c);
return 0;
}
--- NEW FILE: ispunct.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: ispunct.c
* Date: 02:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* a function takes 'c' if its not printable charecter or an alphanumeric char it return 0
otherwise it return 1 and its a punctiuation */
int ispunct (int c)
{
if (c<= ' ' || c >='a' && c <='z' || c >='A' && c<= 'Z' || c >= '0' && c <= '9'|| c>= '\del')
return 0;
else
return 1;
}
--- NEW FILE: m_ispunct.c ---
#include <stdio.h>
int main ()
{
char c=',';
if (ispunct(c))
printf ("%c is punc\n",c);
else
printf ("%c is not punc\n",c);
return 0;
}
--- NEW FILE: toascii.c ---
/* TiTaN OS
*
* Please read license Agreement
* (c)2002 SubTrick Group
* Part Of the clib
*
* file: toascii.c
* Date: 2:09:02
* Type: ANSI
* LIB: ctype.h
* Written by: Emad Zakaria
*/
/* a function that takes 'c' and return its equivalent ascii number by anding 127 or 0X7F*/
int toascii (int c)
{
int a= c & 0x7F ;
return a;
}
--- NEW FILE: m_toascii.c ---
#include <stdio.h>
int main()
{
int n,r;
n = 197; //511 return 127
r= toascii(n);
printf ("%d = %d\n",n,r);
return 0;
}
Index: isxdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isxdigit.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** isxdigit.c 2 Sep 2002 22:37:48 -0000 1.2
--- isxdigit.c 3 Sep 2002 06:24:19 -0000 1.3
***************
*** 21,25 ****
int isxdigit (int c)
{
! if (isdigit(c) || c>='A'&& c<='F' || c>='a' && c<='f')
return 1;
else
--- 21,25 ----
int isxdigit (int c)
{
! if ( c >= '0' && c <= '9' || c>='A'&& c<='F' || c>='a' && c<='f')
return 1;
else
***************
*** 28,37 ****
}
-
- int isdigit (int c)
- {
- if (c >= '0' && c <= '9')
- return 1;
- else
- return 0;
- }
\ No newline at end of file
--- 28,29 ----
Index: m_isxdigit.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_isxdigit.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_isxdigit.c 2 Sep 2002 07:35:39 -0000 1.1
--- m_isxdigit.c 3 Sep 2002 06:24:19 -0000 1.2
***************
*** 1,14 ****
! /* TiTaN OS
! *
! * Please read license Agreement
! * (c)2002 SubTrick Group
! * Part Of the clib
! *
! * file: isupper.c
! * Date: 31:08:02
! * Type: ANSI
! * LIB: ctype.h
! * Written by: Emad Zakaria
! */
#include <stdio.h>
--- 1,3 ----
!
#include <stdio.h>
Index: isalnum.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/isalnum.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** isalnum.c 2 Sep 2002 22:37:48 -0000 1.2
--- isalnum.c 3 Sep 2002 06:24:19 -0000 1.3
***************
*** 12,16 ****
*/
! /*
fucntion the takes 'c' and see if its either
alphabet or a digit and return 1 otherwise
--- 12,16 ----
*/
! /*
fucntion the takes 'c' and see if its either
alphabet or a digit and return 1 otherwise
***************
*** 19,25 ****
*/
! int alnum (int c)
{
! if (isalpha (c) || isdigit(c))
return 1;
else
--- 19,25 ----
*/
! int isalnum (int c)
{
! if ( (c>='a'&& c<='z'|| c>='A'&& c<='Z') || c>='0' && c<='9')
return 1;
else
***************
*** 29,47 ****
-
- int isalpha (int c)
- {
- if ( (c >= 'a' && c <='z') || (c >= 'A' && c <= 'Z') )
- return 1;
- else
- return 0;
- }
-
-
- int isdigit (int c)
- {
- if (c >= '0' && c <= '9')
- return 1;
- else
- return 0;
- }
\ No newline at end of file
--- 29,30 ----
Index: m_isalnum.c
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/m_isalnum.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** m_isalnum.c 2 Sep 2002 07:35:39 -0000 1.1
--- m_isalnum.c 3 Sep 2002 06:24:19 -0000 1.2
***************
*** 1,14 ****
! /* TiTaN OS
! *
! * Please read license Agreement
! * (c)2002 SubTrick Group
! * Part Of the clib
! *
! * file: isupper.c
! * Date: 31:08:02
! * Type: ANSI
! * LIB: ctype.h
! * Written by: Emad Zakaria
! */
#include <stdio.h>
--- 1,3 ----
!
#include <stdio.h>
***************
*** 17,25 ****
{
! char c=' ';
if (isalnum(c))
! printf ("%c is alpha num",c);
else
! printf ("%c is not alpha num",c);
return 0;
}
--- 6,14 ----
{
! char c='v';
if (isalnum(c))
! printf ("%c is alpha num\n",c);
else
! printf ("%c is not alpha num\n",c);
return 0;
}
Index: Makefile
===================================================================
RCS file: /cvsroot/subtrick/TiTan/src/lib/ansi/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 2 Sep 2002 22:41:54 -0000 1.4
--- Makefile 3 Sep 2002 06:24:19 -0000 1.5
***************
*** 60,63 ****
--- 60,78 ----
$(CC) -c isalnum.c
$(CC) m_isalnum.c isalnum.o -o isalnum.out
+ iscntrl:
+ $(CC) -c iscntrl.c
+ $(CC) m_iscntrl.c iscntrl.o -o iscntrl.out
+ isprint:
+ $(CC) -c isprint.c
+ $(CC) m_isprint.c isprint.o -o isprint.out
+ isgraph:
+ $(CC) -c isgraph.c
+ $(CC) m_isgraph.c isgraph.o -o isgraph.out
+ ispunct:
+ $(CC) -c ispunct.c
+ $(CC) m_ispunct.c ispunct.o -o ispunct.out
+ toascii:
+ $(CC) -c toascii.c
+ $(CC) m_toascii.c toascii.o -o toascii.out
clean:
rm *.o
|