ReactOS 0.4.15-dev-8093-g3285f69
flag.c File Reference
#include "schilyio.h"
#include <schily/stdlib.h>
Include dependency graph for flag.c:

Go to the source code of this file.

Macros

#define FL_INIT   10
 

Functions

LOCAL int _more_flags __PR ((FILE *))
 
LOCAL int _more_flags (FILE *fp)
 
EXPORT int _io_get_my_flag (FILE *fp)
 
EXPORT void _io_set_my_flag (FILE *fp, int flag)
 
EXPORT void _io_add_my_flag (FILE *fp, int flag)
 

Variables

EXPORT int _io_glflag
 
LOCAL int _fl_inc = 10
 
EXPORT int _fl_max = FL_INIT
 
LOCAL _io_fl _io_smyfl [FL_INIT]
 
EXPORT _io_fl_io_myfl = _io_smyfl
 

Macro Definition Documentation

◆ FL_INIT

#define FL_INIT   10

Definition at line 22 of file flag.c.

Function Documentation

◆ __PR()

LOCAL int _more_flags __PR ( (FILE *)  )

◆ _io_add_my_flag()

EXPORT void _io_add_my_flag ( FILE fp,
int  flag 
)

Definition at line 124 of file flag.c.

127{
128 int oflag = _io_get_my_flag(fp);
129
130 oflag |= flag;
131
132 _io_set_my_flag(fp, oflag);
133}
EXPORT void _io_set_my_flag(FILE *fp, int flag)
Definition: flag.c:94
EXPORT int _io_get_my_flag(FILE *fp)
Definition: flag.c:70
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52

◆ _io_get_my_flag()

EXPORT int _io_get_my_flag ( FILE fp)

Definition at line 70 of file flag.c.

72{
73 register int f = fileno(fp);
74 register _io_fl *fl;
75
76 if (f >= _fl_max)
77 return (_more_flags(fp));
78
79 fl = &_io_myfl[f];
80
81 if (fl->fl_io == 0 || fl->fl_io == fp)
82 return (fl->fl_flags);
83
84 while (fl && fl->fl_io != fp)
85 fl = fl->fl_next;
86
87 if (fl == 0)
88 return (0);
89
90 return (fl->fl_flags);
91}
#define fileno
Definition: acwin.h:102
LOCAL int _more_flags(FILE *fp)
Definition: flag.c:41
EXPORT int _fl_max
Definition: flag.c:34
EXPORT _io_fl * _io_myfl
Definition: flag.c:36
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83
_In_ FLONG fl
Definition: winddi.h:1279

Referenced by _io_add_my_flag(), and _more_flags().

◆ _io_set_my_flag()

EXPORT void _io_set_my_flag ( FILE fp,
int  flag 
)

Definition at line 94 of file flag.c.

97{
98 register int f = fileno(fp);
99 register _io_fl *fl;
100 register _io_fl *fl2;
101
102 if (f >= _fl_max)
103 (void) _more_flags(fp);
104
105 fl = &_io_myfl[f];
106
107 if (fl->fl_io != (FILE *)0) {
108 fl2 = fl;
109
110 while (fl && fl->fl_io != fp)
111 fl = fl->fl_next;
112 if (fl == 0) {
113 if ((fl = (_io_fl *) malloc(sizeof (*fl))) == 0)
114 return;
115 fl->fl_next = fl2->fl_next;
116 fl2->fl_next = fl;
117 }
118 }
119 fl->fl_io = fp;
120 fl->fl_flags = flag;
121}
#define malloc
Definition: debug_ros.c:4
struct _io_flags * fl_next
Definition: schilyio.h:107

Referenced by _io_add_my_flag().

◆ _more_flags()

LOCAL int _more_flags ( FILE fp)

Definition at line 41 of file flag.c.

43{
44 register int f = fileno(fp);
45 register int n = _fl_max;
46 register _io_fl *np;
47
48 while (n <= f)
49 n += _fl_inc;
50
51 if (_io_myfl == _io_smyfl) {
52 np = (_io_fl *) malloc(n * sizeof (*np));
53 fillbytes(np, n * sizeof (*np), '\0');
54 movebytes(_io_smyfl, np, sizeof (_io_smyfl)/sizeof (*np));
55 } else {
56 np = (_io_fl *) realloc(_io_myfl, n * sizeof (*np));
57 if (np)
58 fillbytes(&np[_fl_max], (n-_fl_max)*sizeof (*np), '\0');
59 }
60 if (np) {
61 _io_myfl = np;
62 _fl_max = n;
63 return (_io_get_my_flag(fp));
64 } else {
65 return (_JS_IONORAISE);
66 }
67}
#define realloc
Definition: debug_ros.c:6
EXPORT char * fillbytes(void *tov, ssize_t cnt, char val)
Definition: fillbytes.c:36
LOCAL int _fl_inc
Definition: flag.c:33
LOCAL _io_fl _io_smyfl[FL_INIT]
Definition: flag.c:35
GLdouble n
Definition: glext.h:7729
EXPORT char * movebytes(void *fromv, void *tov, ssize_t cnt) const
Definition: movebytes.c:30
#define _JS_IONORAISE
Definition: schilyio.h:99

Referenced by _io_get_my_flag(), and _io_set_my_flag().

Variable Documentation

◆ _fl_inc

LOCAL int _fl_inc = 10

Definition at line 33 of file flag.c.

Referenced by _more_flags().

◆ _fl_max

EXPORT int _fl_max = FL_INIT

Definition at line 34 of file flag.c.

Referenced by _io_get_my_flag(), _io_set_my_flag(), and _more_flags().

◆ _io_glflag

EXPORT int _io_glflag

Definition at line 31 of file flag.c.

Referenced by _fcons(), and filewrite().

◆ _io_myfl

EXPORT _io_fl* _io_myfl = _io_smyfl

Definition at line 36 of file flag.c.

Referenced by _io_get_my_flag(), _io_set_my_flag(), and _more_flags().

◆ _io_smyfl

LOCAL _io_fl _io_smyfl[FL_INIT]

Definition at line 35 of file flag.c.

Referenced by _more_flags().