Exemple #1
0
static void firstline (LexState *LS)
{
  int c = zgetc(LS->lex_z);
  if (c == '#')
    while ((c=zgetc(LS->lex_z)) != '\n' && c != EOZ) /* skip first line */;
  zungetc(LS->lex_z);
}
Exemple #2
0
static void firstline(LexState *LS) {
	int32 c = zgetc(LS->lex_z);
	if (c == '#') {
		LS->linenumber++;
		while ((c = zgetc(LS->lex_z)) != '\n' && c != EOZ) ; // skip first line
	}
	zungetc(LS->lex_z);
}
Exemple #3
0
/* --------------------------------------------------------------- read --- */
size_t zread (ZIO *z, void *b, size_t n) {
  while (n) {
    size_t m;
    if (z->n == 0) {
      if (z->filbuf(z) == EOZ)
        return n;  /* return number of missing bytes */
      zungetc(z);  /* put result from `filbuf' in the buffer */
    }
    m = (n <= z->n) ? n : z->n;  /* min. between n and z->n */
    memcpy(b, z->p, m);
    z->n -= m;
    z->p += m;
    b = (char *)b + m;
    n -= m;
  }
  return 0;
}