Blender V4.3
datatoc.cc File Reference
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>

Go to the source code of this file.

Macros

#define STRPREFIX(a, b)   (strncmp((a), (b), strlen(b)) == 0)
 

Functions

static char * arg_basename (char *string)
 
static int strip_leading_c_comment (FILE *fpin, int size, int *r_newlines)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ STRPREFIX

#define STRPREFIX ( a,
b )   (strncmp((a), (b), strlen(b)) == 0)

Definition at line 16 of file datatoc.cc.

Referenced by main().

Function Documentation

◆ arg_basename()

static char * arg_basename ( char * string)
static

Definition at line 18 of file datatoc.cc.

Referenced by main().

◆ main()

int main ( int argc,
char ** argv )

Definition at line 123 of file datatoc.cc.

References arg_basename(), int, L, options, printf, size(), strip_leading_c_comment(), and STRPREFIX.

◆ strip_leading_c_comment()

static int strip_leading_c_comment ( FILE * fpin,
int size,
int * r_newlines )
static

Detect leading C-style comments and seek the file to it's end, returning the number of bytes skipped and setting r_newlines or return zero and seek to the file start.

The number of newlines is used so the number of lines matches the generated data, so any errors provide useful line numbers (this could be made optional, as there may be cases where it's not helpful).

Definition at line 43 of file datatoc.cc.

Referenced by main().