libsfio_C_la_SOURCES = sfclose.c sfcvt.c sfdisc.c \
sfexcept.c sfexit.c sfextern.c sffilbuf.c \
- sfflsbuf.c sfgetl.c sfgetm.c sfgetr.c sfgetu.c \
+ sfflsbuf.c sfgetm.c sfgetr.c sfgetu.c \
sfmode.c sfnew.c sfnotify.c \
sfnputc.c sfopen.c sfpkrd.c sfpoll.c sfpool.c \
sfprintf.c sfprints.c sfpurge.c \
+++ /dev/null
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-#include <sfio/sfhdr.h>
-
-/* Read a long value coded in a portable format.
-**
-** Written by Kiem-Phong Vo
-*/
-
-Sflong_t sfgetl(Sfio_t * f)
-{
- Sflong_t v;
- uchar *s, *ends, c;
- int p;
-
- SFMTXSTART(f, (Sflong_t) (-1));
-
- if (f->mode != SF_READ && _sfmode(f, SF_READ, 0) < 0)
- SFMTXRETURN(f, (Sflong_t) (-1));
- SFLOCK(f, 0);
-
- for (v = 0;;) {
- if (SFRPEEK(f, s, p) <= 0) {
- f->flags |= SF_ERROR;
- v = (Sflong_t) (-1);
- goto done;
- }
- for (ends = s + p; s < ends;) {
- c = *s++;
- if (c & SF_MORE)
- v = ((Sfulong_t) v << SF_UBITS) | SFUVALUE(c);
- else { /* special translation for this byte */
- v = ((Sfulong_t) v << SF_SBITS) | SFSVALUE(c);
- f->next = s;
- v = (c & SF_SIGN) ? -v - 1 : v;
- goto done;
- }
- }
- f->next = s;
- }
- done:
- SFOPEN(f, 0);
- SFMTXRETURN(f, v);
-}
/* get the real value of a byte in a coded long or ulong */
#define SFUVALUE(v) (((ulong)(v))&(SF_MORE-1))
-#define SFSVALUE(v) ((( long)(v))&(SF_SIGN-1))
#define SFBVALUE(v) (((ulong)(v))&(SF_BYTE-1))
/* grain size for buffer increment */
extern int sfputc(Sfio_t *, int);
- extern Sflong_t sfgetl(Sfio_t *);
extern Sfulong_t sfgetu(Sfio_t *);
extern Sfulong_t sfgetm(Sfio_t *, Sfulong_t);
extern int sfgetc(Sfio_t *);
#undef extern
/* coding long integers in a portable and compact fashion */
-#define SF_SBITS 6
#define SF_UBITS 7
#define SF_BBITS 8
-#define SF_SIGN (1 << SF_SBITS)
#define SF_MORE (1 << SF_UBITS)
#define SF_BYTE (1 << SF_BBITS)
#define SF_U1 SF_MORE
<ClCompile Include="sfextern.c" />
<ClCompile Include="sffilbuf.c" />
<ClCompile Include="sfflsbuf.c" />
- <ClCompile Include="sfgetl.c" />
<ClCompile Include="sfgetm.c" />
<ClCompile Include="sfgetr.c" />
<ClCompile Include="sfgetu.c" />
<ClCompile Include="sfflsbuf.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="sfgetl.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="sfgetm.c">
<Filter>Source Files</Filter>
</ClCompile>