Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r--source/blender/makesdna/intern/dna_genfile.c142
-rw-r--r--source/blender/makesdna/intern/makesdna.c166
2 files changed, 154 insertions, 154 deletions
diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c
index 2e21223d042..32e41863ad1 100644
--- a/source/blender/makesdna/intern/dna_genfile.c
+++ b/source/blender/makesdna/intern/dna_genfile.c
@@ -201,10 +201,10 @@ static int elementsize(const SDNA *sdna, short type, short name)
{
int mul, namelen, len;
const char *cp;
-
+
cp = sdna->names[name];
len = 0;
-
+
namelen = strlen(cp);
/* is it a pointer or function pointer? */
if (ispointer(cp)) {
@@ -213,7 +213,7 @@ static int elementsize(const SDNA *sdna, short type, short name)
if (cp[namelen - 1] == ']') {
mul = DNA_elem_array_size(cp);
}
-
+
len = sdna->pointerlen * mul;
}
else if (sdna->typelens[type]) {
@@ -222,11 +222,11 @@ static int elementsize(const SDNA *sdna, short type, short name)
if (cp[namelen - 1] == ']') {
mul = DNA_elem_array_size(cp);
}
-
+
len = mul * sdna->typelens[type];
-
+
}
-
+
return len;
}
@@ -236,13 +236,13 @@ static void printstruct(SDNA *sdna, short strnr)
/* is for debug */
int b, nr;
short *sp;
-
+
sp = sdna->structs[strnr];
-
+
printf("struct %s\n", sdna->types[sp[0]]);
nr = sp[1];
sp += 2;
-
+
for (b = 0; b < nr; b++, sp += 2) {
printf(" %s %s\n", sdna->types[sp[0]], sdna->names[sp[1]]);
}
@@ -322,7 +322,7 @@ static bool init_structDNA(
int *data, *verg, gravity_fix = -1;
short *sp;
char str[8];
-
+
verg = (int *)str;
data = (int *)sdna->data;
@@ -343,17 +343,17 @@ static bool init_structDNA(
const char *cp;
data++;
-
+
/* load names array */
strcpy(str, "NAME");
if (*data == *verg) {
data++;
-
+
sdna->nr_names = *data;
if (do_endian_swap) {
BLI_endian_switch_int32(&sdna->nr_names);
}
-
+
data++;
sdna->names = MEM_callocN(sizeof(void *) * sdna->nr_names, "sdnanames");
}
@@ -361,7 +361,7 @@ static bool init_structDNA(
*r_error_message = "NAME error in SDNA file";
return false;
}
-
+
cp = (char *)data;
for (int nr = 0; nr < sdna->nr_names; nr++) {
sdna->names[nr] = cp;
@@ -381,7 +381,7 @@ static bool init_structDNA(
}
cp = pad_up_4(cp);
-
+
/* load type names array */
data = (int *)cp;
strcpy(str, "TYPE");
@@ -392,7 +392,7 @@ static bool init_structDNA(
if (do_endian_swap) {
BLI_endian_switch_int32(&sdna->nr_types);
}
-
+
data++;
sdna->types = MEM_callocN(sizeof(void *) * sdna->nr_types, "sdnatypes");
}
@@ -400,25 +400,25 @@ static bool init_structDNA(
*r_error_message = "TYPE error in SDNA file";
return false;
}
-
+
cp = (char *)data;
for (int nr = 0; nr < sdna->nr_types; nr++) {
sdna->types[nr] = cp;
-
+
/* this is a patch, to change struct names without a conflict with SDNA */
/* be careful to use it, in this case for a system-struct (opengl/X) */
-
+
if (*cp == 'b') {
/* struct Screen was already used by X, 'bScreen' replaces the old IrisGL 'Screen' struct */
if (strcmp("bScreen", cp) == 0) sdna->types[nr] = cp + 1;
}
-
+
while (*cp) cp++;
cp++;
}
cp = pad_up_4(cp);
-
+
/* load typelen array */
data = (int *)cp;
strcpy(str, "TLEN");
@@ -426,11 +426,11 @@ static bool init_structDNA(
data++;
sp = (short *)data;
sdna->typelens = sp;
-
+
if (do_endian_swap) {
BLI_endian_switch_int16_array(sp, sdna->nr_types);
}
-
+
sp += sdna->nr_types;
}
else {
@@ -444,12 +444,12 @@ static bool init_structDNA(
strcpy(str, "STRC");
if (*data == *verg) {
data++;
-
+
sdna->nr_structs = *data;
if (do_endian_swap) {
BLI_endian_switch_int32(&sdna->nr_structs);
}
-
+
data++;
sdna->structs = MEM_callocN(sizeof(void *) * sdna->nr_structs, "sdnastrcs");
}
@@ -457,17 +457,17 @@ static bool init_structDNA(
*r_error_message = "STRC error in SDNA file";
return false;
}
-
+
sp = (short *)data;
for (int nr = 0; nr < sdna->nr_structs; nr++) {
sdna->structs[nr] = sp;
-
+
if (do_endian_swap) {
short a;
-
+
BLI_endian_switch_int16(&sp[0]);
BLI_endian_switch_int16(&sp[1]);
-
+
a = sp[1];
sp += 2;
while (a--) {
@@ -552,7 +552,7 @@ SDNA *DNA_sdna_from_data(
sdna->data = data;
}
sdna->data_alloc = data_alloc;
-
+
if (init_structDNA(sdna, do_endian_swap, &error_message)) {
return sdna;
@@ -606,11 +606,11 @@ static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structn
int a, b, typenr, elems;
const short *sp;
const char *cp;
-
+
/* check all structs, test if it's inside another struct */
sp = sdna->structs[structnr];
typenr = sp[0];
-
+
for (a = 0; a < sdna->nr_structs; a++) {
if ((a != structnr) && (compflags[a] == SDNA_CMP_EQUAL)) {
sp = sdna->structs[a];
@@ -627,7 +627,7 @@ static void recurs_test_compflags(const SDNA *sdna, char *compflags, int structn
}
}
}
-
+
}
@@ -641,7 +641,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
const short *sp_old, *sp_new;
const char *str1, *str2;
char *compflags;
-
+
if (oldsdna->nr_structs == 0) {
printf("error: file without SDNA\n");
return NULL;
@@ -649,14 +649,14 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
compflags = MEM_callocN(oldsdna->nr_structs, "compflags");
- /* we check all structs in 'oldsdna' and compare them with
+ /* we check all structs in 'oldsdna' and compare them with
* the structs in 'newsdna'
*/
unsigned int newsdna_index_last = 0;
-
+
for (a = 0; a < oldsdna->nr_structs; a++) {
sp_old = oldsdna->structs[a];
-
+
/* search for type in cur */
int sp_new_index = DNA_struct_find_nr_ex(newsdna, oldsdna->types[sp_old[0]], &newsdna_index_last);
@@ -667,7 +667,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
sp_new = newsdna->structs[sp_new_index];
/* initial assumption */
compflags[a] = SDNA_CMP_NOT_EQUAL;
-
+
/* compare length and amount of elems */
if (sp_new[1] == sp_old[1]) {
if (newsdna->typelens[sp_new[0]] == oldsdna->typelens[sp_old[0]]) {
@@ -701,7 +701,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
}
}
-
+
}
}
@@ -718,7 +718,7 @@ const char *DNA_struct_get_compareflags(const SDNA *oldsdna, const SDNA *newsdna
recurs_test_compflags(oldsdna, compflags, a);
}
}
-
+
#if 0
for (a = 0; a < oldsdna->nr_structs; a++) {
if (compflags[a] == SDNA_CMP_NOT_EQUAL) {
@@ -801,7 +801,7 @@ static void cast_elem(
case SDNA_TYPE_UINT64:
val = *( (uint64_t *)olddata); break;
}
-
+
switch (ctypenr) {
case SDNA_TYPE_CHAR:
*curdata = val; break;
@@ -846,11 +846,11 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
{
int64_t lval;
int arrlen;
-
+
arrlen = DNA_elem_array_size(name);
-
+
while (arrlen > 0) {
-
+
if (curlen == oldlen) {
memcpy(curdata, olddata, curlen);
}
@@ -869,7 +869,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
/* for debug */
printf("errpr: illegal pointersize!\n");
}
-
+
olddata += oldlen;
curdata += curlen;
arrlen--;
@@ -883,7 +883,7 @@ static void cast_pointer(int curlen, int oldlen, const char *name, char *curdata
static int elem_strcmp(const char *name, const char *oname)
{
int a = 0;
-
+
while (1) {
if (name[a] != oname[a]) return 1;
if (name[a] == '[' || oname[a] == '[') break;
@@ -916,9 +916,9 @@ static const char *find_elem(
{
int a, elemcount, len;
const char *otype, *oname;
-
+
/* without arraypart, so names can differ: return old namenr and type */
-
+
/* in old is the old struct */
elemcount = old[1];
old += 2;
@@ -934,10 +934,10 @@ static const char *find_elem(
if (sppo) *sppo = old;
return olddata;
}
-
+
return NULL;
}
-
+
olddata += len;
}
return NULL;
@@ -975,7 +975,7 @@ static void reconstruct_elem(
*/
int a, elemcount, len, countpos, oldsize, cursize, mul;
const char *otype, *oname, *cp;
-
+
/* is 'name' an array? */
cp = name;
countpos = 0;
@@ -983,7 +983,7 @@ static void reconstruct_elem(
cp++; countpos++;
}
if (*cp != '[') countpos = 0;
-
+
/* in old is the old struct */
elemcount = old[1];
old += 2;
@@ -991,9 +991,9 @@ static void reconstruct_elem(
otype = oldsdna->types[old[0]];
oname = oldsdna->names[old[1]];
len = elementsize(oldsdna, old[0], old[1]);
-
+
if (strcmp(name, oname) == 0) { /* name equal */
-
+
if (ispointer(name)) { /* pointer of functionpointer afhandelen */
cast_pointer(newsdna->pointerlen, oldsdna->pointerlen, name, curdata, olddata);
}
@@ -1009,7 +1009,7 @@ static void reconstruct_elem(
else if (countpos != 0) { /* name is an array */
if (oname[countpos] == '[' && strncmp(name, oname, countpos) == 0) { /* basis equal */
-
+
cursize = DNA_elem_array_size(name);
oldsize = DNA_elem_array_size(oname);
@@ -1022,7 +1022,7 @@ static void reconstruct_elem(
mul = len / oldsize; /* size of single old array element */
mul *= (cursize < oldsize) ? cursize : oldsize; /* smaller of sizes of old and new arrays */
memcpy(curdata, olddata, mul);
-
+
if (oldsize > cursize && strcmp(type, "char") == 0) {
/* string had to be truncated, ensure it's still null-terminated */
curdata[mul - 1] = '\0';
@@ -1086,7 +1086,7 @@ static void reconstruct_struct(
spo = oldsdna->structs[oldSDNAnr];
elen = oldsdna->typelens[spo[0]];
memcpy(cur, data, elen);
-
+
return;
}
@@ -1102,7 +1102,7 @@ static void reconstruct_struct(
for (a = 0; a < elemcount; a++, spc += 2) { /* convert each field */
type = newsdna->types[spc[0]];
name = newsdna->names[spc[1]];
-
+
elen = elementsize(newsdna, spc[0], spc[1]);
/* test: is type a struct? */
@@ -1110,26 +1110,26 @@ static void reconstruct_struct(
/* struct field type */
/* where does the old struct data start (and is there an old one?) */
cpo = (char *)find_elem(oldsdna, type, name, spo, data, &sppo);
-
+
if (cpo) {
oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last);
curSDNAnr = DNA_struct_find_nr_ex(newsdna, type, &cursdna_index_last);
-
+
/* array! */
mul = DNA_elem_array_size(name);
nameo = oldsdna->names[sppo[1]];
mulo = DNA_elem_array_size(nameo);
-
+
eleno = elementsize(oldsdna, sppo[0], sppo[1]);
-
+
elen /= mul;
eleno /= mulo;
-
+
while (mul--) {
reconstruct_struct(newsdna, oldsdna, compflags, oldSDNAnr, cpo, curSDNAnr, cpc);
cpo += eleno;
cpc += elen;
-
+
/* new struct array larger than old */
mulo--;
if (mulo <= 0) break;
@@ -1167,18 +1167,18 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
if (oldSDNAnr == -1) return;
firststructtypenr = *(oldsdna->structs[0]);
-
+
spo = spc = oldsdna->structs[oldSDNAnr];
elemcount = spo[1];
spc += 2;
cur = data;
-
+
for (a = 0; a < elemcount; a++, spc += 2) {
type = oldsdna->types[spc[0]];
name = oldsdna->names[spc[1]];
-
+
/* elementsize = including arraysize */
elen = elementsize(oldsdna, spc[0], spc[1]);
@@ -1189,7 +1189,7 @@ void DNA_struct_switch_endian(const SDNA *oldsdna, int oldSDNAnr, char *data)
char *cpo = (char *)find_elem(oldsdna, type, name, spo, data, NULL);
if (cpo) {
oldSDNAnr = DNA_struct_find_nr_ex(oldsdna, type, &oldsdna_index_last);
-
+
mul = DNA_elem_array_size(name);
elena = elen / mul;
@@ -1255,7 +1255,7 @@ void *DNA_struct_reconstruct(
char *cur, *cpc;
const char *cpo;
const char *type;
-
+
/* oldSDNAnr == structnr, we're looking for the corresponding 'cur' number */
spo = oldsdna->structs[oldSDNAnr];
type = oldsdna->types[spo[0]];
@@ -1304,11 +1304,11 @@ bool DNA_struct_find(const SDNA *sdna, const char *stype)
bool DNA_struct_elem_find(const SDNA *sdna, const char *stype, const char *vartype, const char *name)
{
const int SDNAnr = DNA_struct_find_nr(sdna, stype);
-
+
if (SDNAnr != -1) {
const short * const spo = sdna->structs[SDNAnr];
const char * const cp = find_elem(sdna, vartype, name, spo, NULL, NULL);
-
+
if (cp) {
return true;
}
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index f249eb92886..3b8d0e01ace 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -226,7 +226,7 @@ static int add_type(const char *str, int len)
{
int nr;
char *cp;
-
+
/* first do validity check */
if (str[0] == 0) {
return -1;
@@ -236,7 +236,7 @@ static int add_type(const char *str, int len)
* 'struct SomeStruct* somevar;' <-- correct but we cant handle right now. */
return -1;
}
-
+
/* search through type array */
for (nr = 0; nr < nr_types; nr++) {
if (strcmp(str, types[nr]) == 0) {
@@ -248,7 +248,7 @@ static int add_type(const char *str, int len)
return nr;
}
}
-
+
/* append new type */
if (nr_types == 0) {
cp = typedata;
@@ -261,13 +261,13 @@ static int add_type(const char *str, int len)
typelens_native[nr_types] = len;
typelens_32[nr_types] = len;
typelens_64[nr_types] = len;
-
+
if (nr_types >= maxnr) {
printf("too many types\n");
return nr_types - 1;
}
nr_types++;
-
+
return nr_types - 1;
}
@@ -288,7 +288,7 @@ static int add_name(const char *str)
const char *name;
additional_slen_offset = 0;
-
+
if (str[0] == 0 /* || (str[1] == 0) */) return -1;
if (str[0] == '(' && str[1] == '*') {
@@ -306,7 +306,7 @@ static int add_name(const char *str)
buf[i] = str[i];
i++;
}
-
+
/* Another number we need is the extra slen offset. This extra
* offset is the overshoot after a space. If there is no
* space, no overshoot should be calculated. */
@@ -322,7 +322,7 @@ static int add_name(const char *str)
if (debugSDNA > 3) printf("seen %c ( %d)\n"
"special after offset%d\n",
str[j], str[j], j);
-
+
if (!isfuncptr) {
/* multidimensional array pointer case */
if (str[j] == 0) {
@@ -332,7 +332,7 @@ static int add_name(const char *str)
printf("Error during tokening multidim array pointer\n");
}
else if (str[j] == 0) {
- if (debugSDNA > 3) printf("offsetting for space\n");
+ if (debugSDNA > 3) printf("offsetting for space\n");
/* get additional offset */
k = 0;
while (str[j] != ')') {
@@ -349,7 +349,7 @@ static int add_name(const char *str)
else {
printf("Error during tokening function pointer argument list\n");
}
-
+
/*
* Put )(void) at the end? Maybe )(). Should check this with
* old sdna. Actually, sometimes )(), sometimes )(void...)
@@ -363,7 +363,7 @@ static int add_name(const char *str)
*
* */
buf[i] = 0;
- if (debugSDNA > 3) printf("Name before chomping: %s\n", buf);
+ if (debugSDNA > 3) printf("Name before chomping: %s\n", buf);
if ((strncmp(buf, "(*headdraw", 10) == 0) ||
(strncmp(buf, "(*windraw", 9) == 0) )
{
@@ -390,14 +390,14 @@ static int add_name(const char *str)
/* normal field: old code */
name = str;
}
-
+
/* search name array */
for (nr = 0; nr < nr_names; nr++) {
if (strcmp(name, names[nr]) == 0) {
return nr;
}
}
-
+
/* append new type */
if (nr_names == 0) {
cp = namedata;
@@ -407,13 +407,13 @@ static int add_name(const char *str)
}
strcpy(cp, name);
names[nr_names] = cp;
-
+
if (nr_names >= maxnr) {
printf("too many names\n");
return nr_names - 1;
}
nr_names++;
-
+
return nr_names - 1;
}
@@ -430,16 +430,16 @@ static short *add_struct(int namecode)
len = sp[1];
structs[nr_structs] = sp + 2 * len + 2;
}
-
+
sp = structs[nr_structs];
sp[0] = namecode;
-
+
if (nr_structs >= maxnr) {
printf("too many structs\n");
return sp;
}
nr_structs++;
-
+
return sp;
}
@@ -447,14 +447,14 @@ static int preprocess_include(char *maindata, int len)
{
int a, newlen, comment = 0;
char *cp, *temp, *md;
-
+
/* note: len + 1, last character is a dummy to prevent
* comparisons using uninitialized memory */
temp = MEM_mallocN(len + 1, "preprocess_include");
temp[len] = ' ';
memcpy(temp, maindata, len);
-
+
/* remove all c++ comments */
/* replace all enters/tabs/etc with spaces */
cp = temp;
@@ -470,7 +470,7 @@ static int preprocess_include(char *maindata, int len)
if (comment || *cp < 32 || *cp > 128) *cp = 32;
cp++;
}
-
+
/* data from temp copy to maindata, remove comments and double spaces */
cp = temp;
@@ -479,7 +479,7 @@ static int preprocess_include(char *maindata, int len)
comment = 0;
a = len;
while (a--) {
-
+
if (cp[0] == '/' && cp[1] == '*') {
comment = 1;
cp[0] = cp[1] = 32;
@@ -511,7 +511,7 @@ static int preprocess_include(char *maindata, int len)
}
cp++;
}
-
+
MEM_freeN(temp);
return newlen;
}
@@ -552,7 +552,7 @@ static void *read_file_data(const char *filename, int *r_len)
fclose(fp);
return NULL;
}
-
+
fclose(fp);
return data;
}
@@ -566,7 +566,7 @@ static int convert_include(const char *filename)
short *structpoin, *sp;
char *maindata, *mainend, *md, *md1;
bool skip_struct;
-
+
md = maindata = read_file_data(filename, &filelen);
if (filelen == -1) {
fprintf(stderr, "Can't read file %s\n", filename);
@@ -580,12 +580,12 @@ static int convert_include(const char *filename)
count = 0;
skip_struct = false;
while (count < filelen) {
-
+
/* code for skipping a struct: two hashes on 2 lines. (preprocess added a space) */
if (md[0] == '#' && md[1] == ' ' && md[2] == '#') {
skip_struct = true;
}
-
+
if (md[0] == '{') {
md[0] = 0;
if (skip_struct) {
@@ -596,7 +596,7 @@ static int convert_include(const char *filename)
md1 = md - 2;
while (*md1 != 32) md1--; /* to beginning of word */
md1++;
-
+
/* we've got a struct name when... */
if (strncmp(md1 - 7, "struct", 6) == 0) {
@@ -615,22 +615,22 @@ static int convert_include(const char *filename)
md1 = md + 1;
while (*md1 != '}') {
if (md1 > mainend) break;
-
+
if (*md1 == ',' || *md1 == ' ') *md1 = 0;
md1++;
}
-
+
/* read types and names until first character that is not '}' */
md1 = md + 1;
while (*md1 != '}') {
if (md1 > mainend) break;
-
+
/* skip when it says 'struct' or 'unsigned' or 'const' */
if (*md1) {
if (strncmp(md1, "struct", 6) == 0) md1 += 7;
if (strncmp(md1, "unsigned", 8) == 0) md1 += 9;
if (strncmp(md1, "const", 5) == 0) md1 += 6;
-
+
/* we've got a type! */
type = add_type(md1, 0);
if (type == -1) {
@@ -642,11 +642,11 @@ static int convert_include(const char *filename)
md1 += strlen(md1);
-
+
/* read until ';' */
while (*md1 != ';') {
if (md1 > mainend) break;
-
+
if (*md1) {
/* We've got a name. slen needs
* correction for function
@@ -665,11 +665,11 @@ static int convert_include(const char *filename)
structpoin[1]++;
sp += 2;
-
+
md1 += slen;
break;
}
-
+
name = add_name(md1);
slen += additional_slen_offset;
@@ -680,7 +680,7 @@ static int convert_include(const char *filename)
structpoin[1]++;
sp += 2;
-
+
md1 += slen;
}
md1++;
@@ -697,7 +697,7 @@ static int convert_include(const char *filename)
count++;
md++;
}
-
+
MEM_freeN(maindata);
return 0;
@@ -707,7 +707,7 @@ static int arraysize(const char *str)
{
int a, mul = 1;
const char *cp = NULL;
-
+
for (a = 0; str[a]; a++) {
if (str[a] == '[') {
cp = &(str[a + 1]);
@@ -718,7 +718,7 @@ static int arraysize(const char *str)
mul *= atoi(cp);
}
}
-
+
return mul;
}
@@ -752,7 +752,7 @@ static int calculate_structlens(int firststruct)
while (unknown) {
lastunknown = unknown;
unknown = 0;
-
+
/* check all structs... */
for (int a = 0; a < nr_structs; a++) {
const short *structpoin = structs[a];
@@ -760,13 +760,13 @@ static int calculate_structlens(int firststruct)
/* when length is not known... */
if (typelens_native[structtype] == 0) {
-
+
const short *sp = structpoin + 2;
int len_native = 0;
int len_32 = 0;
int len_64 = 0;
bool has_pointer = false;
-
+
/* check all elements in struct */
for (int b = 0; b < structpoin[1]; b++, sp += 2) {
int type = sp[0];
@@ -838,7 +838,7 @@ static int calculate_structlens(int firststruct)
dna_error = 1;
}
}
-
+
/* Check 2-4-8 aligned. */
if (!check_field_alignment(firststruct, structtype, type, len_32, cp, "32 bit")) {
dna_error = 1;
@@ -850,7 +850,7 @@ static int calculate_structlens(int firststruct)
len_native += mul * typelens_native[type];
len_32 += mul * typelens_32[type];
len_64 += mul * typelens_64[type];
-
+
}
else {
len_native = 0;
@@ -859,7 +859,7 @@ static int calculate_structlens(int firststruct)
break;
}
}
-
+
if (len_native == 0) {
unknown++;
}
@@ -876,30 +876,30 @@ static int calculate_structlens(int firststruct)
dna_error = 1;
}
}
-
+
if (len_native % 4) {
fprintf(stderr, "Sizeerror 4 in struct: %s (add %d bytes)\n",
types[structtype], len_native % 4);
dna_error = 1;
}
-
+
}
}
}
-
+
if (unknown == lastunknown) break;
}
-
+
if (unknown) {
fprintf(stderr, "ERROR: still %d structs unknown\n", unknown);
if (debugSDNA) {
fprintf(stderr, "*** Known structs :\n");
-
+
for (int a = 0; a < nr_structs; a++) {
const short *structpoin = structs[a];
const int structtype = structpoin[0];
-
+
/* length unknown */
if (typelens_native[structtype] != 0) {
fprintf(stderr, " %s\n", types[structtype]);
@@ -907,9 +907,9 @@ static int calculate_structlens(int firststruct)
}
}
-
+
fprintf(stderr, "*** Unknown structs :\n");
-
+
for (int a = 0; a < nr_structs; a++) {
const short *structpoin = structs[a];
const int structtype = structpoin[0];
@@ -935,7 +935,7 @@ static void dna_write(FILE *file, const void *pntr, const int size)
const char *data;
data = (const char *)pntr;
-
+
for (i = 0; i < size; i++) {
fprintf(file, "%d, ", data[i]);
linelength++;
@@ -956,7 +956,7 @@ void printStructLengths(void)
while (unknown) {
/*lastunknown = unknown;*/ /*UNUSED*/
unknown = 0;
-
+
/* check all structs... */
for (a = 0; a < nr_structs; a++) {
structpoin = structs[a];
@@ -978,17 +978,17 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* it a bit. Hope this is enough :) -nzc- */
char str[SDNA_MAX_FILENAME_LENGTH], *cp;
int firststruct;
-
+
if (debugSDNA > 0) {
fflush(stdout);
printf("Running makesdna at debug level %d\n", debugSDNA);
}
-
+
/* the longest known struct is 50k, so we assume 100k is sufficent! */
namedata = MEM_callocN(maxdata, "namedata");
typedata = MEM_callocN(maxdata, "typedata");
structdata = MEM_callocN(maxdata, "structdata");
-
+
/* a maximum of 5000 variables, must be sufficient? */
names = MEM_callocN(sizeof(char *) * maxnr, "names");
types = MEM_callocN(sizeof(char *) * maxnr, "types");
@@ -1023,12 +1023,12 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* the defines above shouldn't be output in the padding file... */
firststruct = nr_types;
-
+
/* add all include files defined in the global array */
/* Since the internal file+path name buffer has limited length, I do a */
/* little test first... */
/* Mind the breaking condition here! */
- if (debugSDNA) printf("\tStart of header scan:\n");
+ if (debugSDNA) printf("\tStart of header scan:\n");
for (i = 0; *(includefiles[i]) != '\0'; i++) {
sprintf(str, "%s%s", baseDirectory, includefiles[i]);
if (debugSDNA) printf("\t|-- Converting %s\n", str);
@@ -1036,7 +1036,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
return (1);
}
}
- if (debugSDNA) printf("\tFinished scanning %d headers.\n", i);
+ if (debugSDNA) printf("\tFinished scanning %d headers.\n", i);
if (calculate_structlens(firststruct)) {
/* error */
@@ -1054,13 +1054,13 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
printf(" %s\n", names[a]);
}
printf("\n");
-
+
sp = typelens_native;
for (a = 0; a < nr_types; a++, sp++) {
printf(" %s %d\n", types[a], *sp);
}
printf("\n");
-
+
for (a = 0; a < nr_structs; a++) {
sp = structs[a];
printf(" struct %s elems: %d size: %d\n", types[sp[0]], sp[1], typelens_native[sp[0]]);
@@ -1076,63 +1076,63 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
/* file writing */
if (debugSDNA > 0) printf("Writing file ... ");
-
+
if (nr_names == 0 || nr_structs == 0) {
/* pass */
}
else {
dna_write(file, "SDNA", 4);
-
+
/* write names */
dna_write(file, "NAME", 4);
len = nr_names;
dna_write(file, &len, 4);
-
+
/* calculate size of datablock with strings */
cp = names[nr_names - 1];
cp += strlen(names[nr_names - 1]) + 1; /* +1: null-terminator */
len = (intptr_t) (cp - (char *) names[0]);
len = (len + 3) & ~3;
dna_write(file, names[0], len);
-
+
/* write TYPES */
dna_write(file, "TYPE", 4);
len = nr_types;
dna_write(file, &len, 4);
-
+
/* calculate datablock size */
cp = types[nr_types - 1];
cp += strlen(types[nr_types - 1]) + 1; /* +1: null-terminator */
len = (intptr_t) (cp - (char *) types[0]);
len = (len + 3) & ~3;
-
+
dna_write(file, types[0], len);
-
+
/* WRITE TYPELENGTHS */
dna_write(file, "TLEN", 4);
-
+
len = 2 * nr_types;
if (nr_types & 1) len += 2;
dna_write(file, typelens_native, len);
-
+
/* WRITE STRUCTS */
dna_write(file, "STRC", 4);
len = nr_structs;
dna_write(file, &len, 4);
-
+
/* calc datablock size */
sp = structs[nr_structs - 1];
sp += 2 + 2 * (sp[1]);
len = (intptr_t) ((char *) sp - (char *) structs[0]);
len = (len + 3) & ~3;
-
+
dna_write(file, structs[0], len);
-
+
/* a simple dna padding test */
if (0) {
FILE *fp;
int a;
-
+
fp = fopen("padding.c", "w");
if (fp == NULL) {
/* pass */
@@ -1160,7 +1160,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
}
/* end end padding test */
}
-
+
/* write a simple enum with all structs offsets,
* should only be accessed via SDNA_TYPE_FROM_STRUCT macro */
{
@@ -1174,7 +1174,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
fprintf(file_offsets, "\tSDNA_TYPE_MAX = %d,\n", nr_structs);
fprintf(file_offsets, "};\n");
}
-
+
MEM_freeN(namedata);
MEM_freeN(typedata);
MEM_freeN(structdata);
@@ -1186,7 +1186,7 @@ static int make_structDNA(const char *baseDirectory, FILE *file, FILE *file_offs
MEM_freeN(structs);
if (debugSDNA > 0) printf("done.\n");
-
+
return(0);
}
@@ -1254,7 +1254,7 @@ int main(int argc, char **argv)
}
}
-
+
return(return_status);
}
@@ -1297,14 +1297,14 @@ int main(int argc, char **argv)
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
-#include "DNA_lattice_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_object_types.h"
#include "DNA_object_force_types.h"
#include "DNA_object_fluidsim_types.h"
#include "DNA_world_types.h"
#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
-#include "DNA_view2d_types.h"
+#include "DNA_view2d_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
#include "DNA_screen_types.h"