예제 #1
0
파일: rtr.c 프로젝트: jksim/nuttx
static void _remove_value(void *tbl[], uint16_t a, int lvl)
{
    int a3 = SUB_TABLE(a, lvl);
    int empty = 1;
    int i;

    if (tbl[a3] == NULL)
        return;

    /* remove child level */
    if (lvl != 0)
        _remove_value(tbl[a3], a, lvl - 1);

    /* clear our reference */
    tbl[a3] = NULL;

    /* if this was the last entry, table will be empty - free it */
    for (i = 0; i < TABLE_ENTRIES; i++) {
        if (tbl[i] != NULL) {
            empty = 0;
            break;
        }
    }

    if (empty && (lvl < LEVELS - 1))
        _rtr_free_table(tbl);
}
예제 #2
0
파일: rtr.c 프로젝트: jksim/nuttx
static void _add_value(void *tbl[], uint16_t a, int lvl, void *data)
{
    int a3 = SUB_TABLE(a, lvl);

    if (lvl == 0) {
            tbl[a3] = data;
    } else {
        if (tbl[a3] == NULL) {
            tbl[a3] = _rtr_alloc_table(tbl);
        }
        _add_value(tbl[a3], a, lvl - 1, data);
    }
}
예제 #3
0
    * 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 FREG. If not, see <http://www.gnu.org/licenses/>. */

#include "TrManager.h"

#include <QLocale>
#include <QCoreApplication>
#include <QObject>
#include <QTranslator>
#include <QDebug>

const QString TrManager::rawKinds[] = { KIND_TABLE(X_STRING) };
const QString TrManager::rawSubs [] = {  SUB_TABLE(X_STRING) };

TrManager::TrManager()
    : Singleton(this)
    , translator(LoadTranslator())
    , kindNames()
    , subNames()
    , shredTypeNames()
{
    for (int i = 0; i < SUB_COUNT; ++i) {
        subNames[i] =
            QCoreApplication::translate("Block", rawSubs[i].toLatin1());
    }
    for (int i = 0; i < KIND_COUNT; ++i) {
        kindNames[i] =
            QCoreApplication::translate("Block", rawKinds[i].toLatin1());