Exemple #1
0
char GoToChar(char *f,char t,int *ind)
{ int i=*ind-1;
  do { i++;
       if (f[i]=='\0') return 1;
     } while (UpCase(f[i])!=UpCase(t));
  *ind=i;
  return f[i];
}
bool datoIgualBST(tPalabra* dato,tPalabra* d){
        String c = dato->cadena;
        String e = d->cadena;
        int n = c.Length();
        for(int i = 1; i <= n;i++)
                c[i] = UpCase(c[i]);
        n = e.Length();
        for(int i = 1; i <= n;i++)
                e[i] = UpCase(e[i]);
        return e == c;
}
Exemple #3
0
//---------------------------------------------------------------------------
intptr_t TFileCustomCommand::PatternLen(const UnicodeString & Command, intptr_t Index)
{
  intptr_t Len;
  switch (UpCase(Command[Index + 1]))
  {
    case L'@':
    case L'U':
    case L'P':
    case L'/':
    case L'&':
      Len = 2;
      break;

    default:
      Len = 1;
      break;
  }
  return Len;
}
Exemple #4
0
//---------------------------------------------------------------------------
void TFormPrincipal::leerPalabra(AnsiString linea,int &i,string pal,int &numPag)
{
        int longLinea = linea.Length();
        while ((i <= longLinea) && (linea[i] != 32)){
              if (((65 <= linea[i]) && (linea[i] <= 90)) || // ASCII: A..Z = 65..90
                 ((97 <= linea[i]) && (linea[i] <= 122)) || // ASCII: a..z = 97..122
                 ((48 <= linea[i]) && (linea[i] <= 57)))    // ASCII: 0..1 = 48..57
                 pal += linea[i];
              i++;
              }

        if (pal != ""){
           if (pal =="newpage")
              numPag++;
            else {
              char letra = UpCase(pal[0]);
              bool estaEnFiltro = filtro->esta(pal);
              if (!estaEnFiltro){
                 tNodoIndice* ni = new tNodoIndice(letra,pal,numPag);
                 this->indicePalabras->insertar(ni);
                 }
              }
           }
}
char * Dictionary::FindDataIC(char * keyword)
{
    long  rvi;     //IndiceRicercaVeloce;
    int   len = strlen(keyword);

    if (len > 0)
    {
        char s = UpCase(keyword[0]);

        for (rvi=indexStart_[s]; rvi < indexEnd_[s] ; rvi++)
        {
            char * kw = keyword_ + index_[rvi].Key;

#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(GNUWIN32)
            if (strnicmp( kw , keyword, len) == 0)
#else
            if (strncasecmp( kw , keyword, len) == 0)
#endif
                return traslation_ + index_[rvi].Trad;
        }
    }

    return NULL;
}
Exemple #6
0
int FindChar(FILE *f,char y)
{ char t;
  do { if (fscanf(f,"%c",&t)<=0) return 1;
     } while (t==' ' || UpCase(y)!=UpCase(t));
  return 0;
}
Exemple #7
0
ARC_STATUS
HalSetEnvironmentVariable (
    IN PCHAR Variable,
    IN PCHAR Value
)

/*++

Routine Description:

    This function creates an environment variable with the specified value.

Arguments:

    Variable - Supplies a pointer to an environment variable name.

    Value - Supplies a pointer to the environment variable value.

Return Value:

    ESUCCESS is returned if the environment variable is created. Otherwise,
    ENOMEM is returned.

--*/

{

    UCHAR Character;
    PUCHAR Environment;
    KIRQL OldIrql;
    ENTRYLO SavedPte[2];
    ARC_STATUS Status;
    ULONG TopIndex;
    ULONG VariableIndex;
    ULONG VariableLength;
    ULONG ValueEnd;
    ULONG ValueIndex;
    ULONG ValueLength;

#if DBG
    DbgPrint("NVRAM 1S\n");
#endif

    //
    // Map the NVRAM into the address space of the current process.
    //

    OldIrql = HalpMapNvram(&SavedPte[0]);
    Environment = &((PNV_CONFIGURATION)NVRAM_MEMORY_BASE)->Environment[0];

    //
    // If the checksum does not match, then set status to an I/O error.
    //

    if (HalpEnvironmentCheckChecksum() != ESUCCESS) {
        Status = EIO;
        goto Unmap;
    }

    //
    // Determine the top of the environment area by scanning backwards until
    // the a non-null character is found or the beginning of the environment
    // area is reached.
    //

    for (TopIndex = (LENGTH_OF_ENVIRONMENT - 1); TopIndex > 0; TopIndex -= 1) {
        if (READ_REGISTER_UCHAR(&Environment[TopIndex]) != '\0') {
            break;
        }
    }

    //
    // If the environment area contains any data, then adjust the top index
    // to the first free byte.
    //

    if (TopIndex != 0) {
        TopIndex += 2;
    }

    //
    // Compute the length of the variable name and the variable value.
    //

    VariableLength = strlen(Variable) + 1;
    ValueLength = strlen(Value) + 1;

    //
    // Check to determine if the specified variable is currently defined.
    //

    if (HalpFindEnvironmentVariable(Variable,
                                    &VariableIndex,
                                    &ValueIndex) == ESUCCESS) {

        //
        // The specified variable is currently defined. Determine the end
        // of the variable value by scanning forward to the zero termination
        // byte.
        //

        ValueEnd = ValueIndex;
        while (READ_REGISTER_UCHAR(&Environment[ValueEnd]) != '\0') {
            ValueEnd += 1;
        }

        ValueEnd += 1;

        //
        // If there is enough free space for the new variable value, then
        // remove the current variable name and value from the environment
        // area, insert the new variable value at the end of the environment
        // if it is not null, and set the status to success. Otherwise, set
        // the status to no space available.
        //

        if ((ValueEnd - ValueIndex + LENGTH_OF_ENVIRONMENT - TopIndex) >= ValueLength) {
            while (ValueEnd != TopIndex) {
                Character = READ_REGISTER_UCHAR(&Environment[ValueEnd]);
                WRITE_REGISTER_UCHAR(&Environment[VariableIndex], Character);
                ValueEnd += 1;
                VariableIndex += 1;
            }

            ValueIndex = VariableIndex;
            while (ValueIndex != TopIndex) {
                WRITE_REGISTER_UCHAR(&Environment[ValueIndex], '\0');
                ValueIndex += 1;
            }

            //
            // If the new variable value is not null, then copy the variable
            // name and the variable value into the enviroment area.
            //

            if (*Value != '\0') {

                //
                // copy the variable name to the environment area.
                //

                do {
                    WRITE_REGISTER_UCHAR(&Environment[VariableIndex], UpCase(*Variable));
                    VariableIndex += 1;
                    Variable += 1;
                } while (*Variable != '\0');

                //
                // Insert separator character and copy variable value to the
                // environment area.
                //

                WRITE_REGISTER_UCHAR(&Environment[VariableIndex], '=');
                VariableIndex += 1;
                do {
                    WRITE_REGISTER_UCHAR(&Environment[VariableIndex], *Value);
                    VariableIndex += 1;
                    Value += 1;
                } while (*Value != '\0');
            }

            Status = ESUCCESS;

        } else {
            Status = ENOSPC;
        }

    } else {

        //
        // The specified variable does not currently have a value. If the
        // specified variable is null or has no value, then set the status
        // to success. Otherwise, if the free area is not large enough to
        // hold the new variable name and its value, then set the status to
        // no space available. Otherwise, insert the variable name and value
        // at the end of the environment area and set the status to success.
        //

        if ((*Variable == '\0') || (*Value == '\0')) {
            Status = ESUCCESS;

        } else if ((LENGTH_OF_ENVIRONMENT - TopIndex) <
                   (VariableLength + ValueLength)) {
            Status = ENOSPC;

        } else {

            //
            // copy the variable name to the environment area.
            //

            do {
                WRITE_REGISTER_UCHAR(&Environment[TopIndex], UpCase(*Variable));
                TopIndex += 1;
                Variable += 1;
            } while (*Variable != '\0');

            //
            // Insert separator character and copy variable value to the
            // environment area.
            //

            WRITE_REGISTER_UCHAR(&Environment[TopIndex], '=');
            TopIndex += 1;
            do {
                WRITE_REGISTER_UCHAR(&Environment[TopIndex], *Value);
                TopIndex += 1;
                Value += 1;
            } while (*Value != '\0');

            Status = ESUCCESS;
        }
    }

    //
    // Compute the new checksum and write to the environment area.
    //

    HalpEnvironmentSetChecksum();

    //
    // Unmap the NVRAM from the address space of the current process.
    //

Unmap:
    HalpUnmapNvram(&SavedPte[0], OldIrql);
#if DBG
    DbgPrint("NVRAM 1E\n");
#endif


    return Status;
}
Exemple #8
0
ARC_STATUS
HalpFindEnvironmentVariable (
    IN PCHAR Variable,
    OUT PULONG VariableIndex,
    OUT PULONG ValueIndex
)

/*++

Routine Description:

    This routine performs a case insensitive search of the NVRAM environment
    area for the specified variable name.

    N.B. The NVRAM must be mapped before this routine is called.


Arguments:

    Variable - Supplies a pointer to a zero terminated string containing an
        environment variable name.

Return Value:

    ESUCCESS is returned if the specified variable name is located. Otherwise,
    ENOENT is returned.

--*/

{

    PUCHAR Environment;
    ULONG Index;
    PUCHAR Name;

    //
    // If the variable name is null, then return no entry found.
    //

    if (*Variable == 0) {
        return ENOENT;
    }

    //
    // Search the environment section of the NVRAM for a variable name match.
    //

    Environment = &((PNV_CONFIGURATION)NVRAM_MEMORY_BASE)->Environment[0];
    Index = 0;
    do {

        //
        // Set name to the beginning of the variable name and record the
        // current index value.
        //

        Name = Variable;
        *VariableIndex = Index;

        //
        // Search until the end of the current environment variable, the
        // end of the specified variable name, or the end of the NVRAM is
        // reached.
        //

        while ((Index < LENGTH_OF_ENVIRONMENT) &&
                (READ_REGISTER_UCHAR(&Environment[Index]) != 0) && (*Name != 0)) {
            if (READ_REGISTER_UCHAR(&Environment[Index]) != UpCase(*Name)) {
                break;
            }

            Name += 1;
            Index += 1;
        }

        //
        // Check for a match which is signified by the end of the variable
        // name and the equal separator in the current environment variable.
        //

        if ((*Name == 0) && (READ_REGISTER_UCHAR(&Environment[Index]) == '=')) {
            *ValueIndex = Index + 1;
            return ESUCCESS;
        }

        //
        // Advance to the start of the next variable.
        //

        while ((Index < LENGTH_OF_ENVIRONMENT) &&
                (READ_REGISTER_UCHAR(&Environment[Index]) != 0)) {
            Index += 1;
        }

        Index += 1;
    } while (Index < LENGTH_OF_ENVIRONMENT);

    return ENOENT;
}