solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit bc172c0659f63188a3517ec0b3772f7f56c62b4c
parent 4196a0f5f9ea60498b3ed67598e8ef84e0e5413c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 16 Dec 2016 16:18:20 +0100

Fix GCC warning + minor code review

Diffstat:
Msrc/solstice_c.h | 4++++
Msrc/solstice_entity.c | 45++++++++++++++++++++++++++-------------------
2 files changed, 30 insertions(+), 19 deletions(-)

diff --git a/src/solstice_c.h b/src/solstice_c.h @@ -22,6 +22,10 @@ struct ssol_instance; extern LOCAL_SYM res_T +solstice_setup_entities + (struct solstice* solstice); + +extern LOCAL_SYM res_T solstice_get_ssol_material (struct solstice* solstice, const struct solparser_material_id mtl_id, diff --git a/src/solstice_entity.c b/src/solstice_entity.c @@ -1,17 +1,17 @@ /* Copyright (C) CNRS 2016 -* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see <http://www.gnu.org/licenses/>. */ + * + * This program is free software: you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation, either version 3 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see <http://www.gnu.org/licenses/>. */ #include "solstice.h" #include "solstice_c.h" @@ -20,7 +20,10 @@ #include <solstice/sanim.h> #include "core/solstice_core.h" -res_T +/******************************************************************************* + * Helper function + ******************************************************************************/ +static res_T solstice_setup_entity (struct solstice* solstice, const struct solparser_entity* entity, @@ -36,6 +39,7 @@ solstice_setup_entity res_T res = RES_OK; ASSERT(solstice && solstice->parser && solstice->score && entity); + /* TODO Split the cases un sub-functions! */ switch (entity->type) { case SOLPARSER_ENTITY_EMPTY: { @@ -161,11 +165,14 @@ solstice_setup_entity end: if (out_node) *out_node = root_node; return res; - + error: goto end; } +/******************************************************************************* + * Local functions + ******************************************************************************/ res_T solstice_setup_entities (struct solstice* solstice) @@ -174,7 +181,7 @@ solstice_setup_entities res_T res = RES_OK; ASSERT(solstice && solstice->parser && solstice->score); - /* release possible previous roots (incomplete, TODO) */ + /* Release possible previous roots (incomplete, TODO) */ score_scene_clear(solstice->score); /* (re) create the list of roots from entities */ @@ -189,7 +196,7 @@ solstice_setup_entities res = solstice_setup_entity(solstice, entity, 1, NULL); if (res != RES_OK) goto error; - + solparser_entity_iterator_next(&it); } @@ -197,4 +204,5 @@ end: return res; error: goto end; -} -\ No newline at end of file +} +