Exemplo n.º 1
0
Arquivo: Main.cpp Projeto: gigte/nlfix
int processArgs(int argc, char *argv[])
{
	searchpath = argv[1];

	SearchFiles = argc < 3 ? false : argv[2][0] != '-';

	if (SearchFiles)
	{
		extensions = argv[2];
	}
	else
	{

	}

	const char *param;

	{
		param = findParam("-mode", argc, argv);

		if (param == NULL)
		{
			const char *program_name = strrchr(argv[0], DIRSEP) + 1;

			if (memcmp(program_name, "tounix", 6) == 0)
				Mode = MODE_UNIX;
			else if (memcmp(program_name, "todos", 5) == 0)
				Mode = MODE_DOS;
			else if (memcmp(program_name, "tomac", 5) == 0)
				Mode = MODE_MAC;
			else
				return error("mode not specified");
		}
		else if (strcmp(param, "unix") == 0)
			Mode = MODE_UNIX;
		else if (strcmp(param, "dos") == 0)
			Mode = MODE_DOS;
		else if (strcmp(param, "mac") == 0)
			Mode = MODE_MAC;
		else
			return error("unknown mode");
	}

	SkipErrors = findFlag("-skiperrors", argc, argv);
	ShowLogs = !findFlag("-nolog", argc, argv);

	return 0;
}
Exemplo n.º 2
0
/**
 * Take a string representing the wParmFlags field in a PARAMDESC struct and
 * turn it into a string representing its numerical value.
 *
 * wParmFlags are true flags, as long as each token is a valid flag, any number
 * of tokens can be or'd together any number of times and the result is valid.
 *
 * @param   The string to convert.
 *
 * @return  The integer value (as a string) of the wParamFlags, or null if the
 *          string to convert was not valid.
 */
static RexxObjectPtr stringToFlags(RexxMethodContext *context, RexxObjectPtr rxStr )
{
    RexxObjectPtr  rxResult = NULL;  // Return null if invalid.
    CHAR       *pszRxStr;
    CHAR       *ptr;
    int         tmp, count, i;
    int         val = 0;

    pszRxStr = pszStringDupe(context->ObjectToStringValue(rxStr));
    if ( !pszRxStr )
    {
        context->RaiseException0(Rexx_Error_System_resources);
    }

    // Allow case insensitive.
    pszRxStr = strupr(pszRxStr);

    count = countSymbols(pszRxStr, FLAG_SEPARATOR_CHAR);

    // Look at each token, and if valid use it.
    for ( i = 0; i < count; i++ )
    {
        ptr = strrchr(pszRxStr, FLAG_SEPARATOR_CHAR);
        tmp = findFlag(stripNonCSyms(ptr));

        if ( tmp == PARAMFLAG_ILLEGAL )
        {
            val = tmp;
            break;
        }
        val |= tmp;
        *ptr = 0x0;
    }

    // If still valid, pick up the last token.
    if ( val != PARAMFLAG_ILLEGAL )
    {
        tmp = findFlag(stripNonCSyms(pszRxStr));
        if ( tmp != PARAMFLAG_ILLEGAL )
        {
            rxResult = context->WholeNumberToObject(val | tmp);
        }
    }

    ORexxOleFree(pszRxStr);

    return rxResult;
}
Exemplo n.º 3
0
bool AnyOption::getFlag (char option) {
        if (!valueStoreOK ())
                return false;
        for (int i = 0; i < optchar_counter; i++) {
                if (optionchars[i] == option)
                        return findFlag (values[optcharindex[i]]);
        }
        return false;
}
Exemplo n.º 4
0
bool AnyOption::getFlag (const char *option) {
        if (!valueStoreOK ())
                return false;
        for (int i = 0; i < option_counter; i++) {
                if (strcmp (options[i], option) == 0)
                        return findFlag (values[optionindex[i]]);
        }
        return false;
}
Exemplo n.º 5
0
int DDLT::Bitfield::l__index( lua_State* L )
{
  const char* key  = luaL_checkstring( L, 2 );
  uint32_t    hash = DDLParser::StringCrc32( key );

  switch ( hash )
  {
  case 0x44e9085cU:// getType
    lua_pushcfunction( L, getType );
    return 1;
  case 0x96142173U: // getName
    lua_pushcfunction( L, getName );
    return 1;
  case 0x55eac3d6U: // getAuthor
    lua_pushcfunction( L, getAuthor );
    return 1;
  case 0x13f87889U: // getDescription
    lua_pushcfunction( L, getDescription );
    return 1;
  case 0xfc020d89U: // getLabel
    lua_pushcfunction( L, getLabel );
    return 1;
  case 0x8d3caf7aU: // getDisplayLabel
    lua_pushcfunction( L, getDisplayLabel );
    return 1;
  case 0x2709d01bU: // getNameHash
    lua_pushcfunction( L, getNameHash );
    return 1;
  case 0xb9621bc2U: // getNumFlags
    lua_pushcfunction( L, getNumFlags );
    return 1;
  case 0x6cd616dcU: // getDefaultFlag
    lua_pushcfunction( L, getDefaultFlag );
    return 1;
  case 0x19c3b4efU: // getFlag
    lua_pushcfunction( L, getFlag );
    return 1;
  case 0x6031845aU: // findFlag
    lua_pushcfunction( L, findFlag );
    return 1;
  case 0x3dc5bb1dU: // getOwner
    lua_pushcfunction( L, getOwner );
    return 1;
  case 0xd397a27fU: // flags
    lua_pushcfunction( L, flags );
    return 1;
  case 0xff1efba8U: // tags
    lua_pushcfunction( L, tags );
    return 1;
  default:
    if ( lua_isnumber( L, 2 ) )
    {
      return getFlag( L );
    }
    else
    {
      return findFlag( L );
    }
    break;
  }

  return 0;
}