コード例 #1
0
void variableSetString(le **varlist, char *key, char *value)
{
  if (key && value) {
    le *temp = leNew(value);
    variableSet(varlist, key, temp);
    leWipe(temp);
  }
}
コード例 #2
0
ファイル: eval.c プロジェクト: iPodLinux-Community/podzillaz
le * eval_cb_defun( lithp_burrito * lb, const int argc, le * branch )
{
    if (!branch || argc < 4 ) return( leNew( "NIL" ));

    if ( !branch->list_next->data )  return( leNew( "NIL" ));

    lb->defunList = variableSet(
                        lb->defunList,
                        branch->list_next->data,
                        branch->list_next->list_next
                    );

    return( leNew( branch->list_next->data ));
}
コード例 #3
0
ファイル: eval.c プロジェクト: iPodLinux-Community/podzillaz
le * eval_cb_set_helper(
    enum setfcn function,
    lithp_burrito * lb, const int argc,
    le * branch
)
{
    le * newkey = NULL;
    le * newvalue = NULL;
    le * current = NULL;

    if (!branch || argc < 3)  return( leNew( "NIL" ) );

    current = branch->list_next;
    while ( current ) {
        if (!current->list_next) {
            newvalue = leNew( "NIL" );
        } else {
            newvalue = evaluateNode(lb, current->list_next);
        }

        if ( function == S_SET ) newkey = evaluateNode(lb, current);

        lb->mainVarList = variableSet(
                              lb->mainVarList,
                              ( function == S_SET )? newkey->data : current->data,
                              newvalue
                          );

        if ( function == S_SET ) leWipe(newkey);

        if (!current->list_next) {
            current = NULL;
        } else {
            current = current->list_next->list_next;
        }
    }
    return( leDup(newvalue) );
}