// $Id: xxl_proper.cc,v 1.3 1996/12/11 21:39:49 aml Exp $

// This function changes the value of the string in place !!

#include "xxl_funcs.hh"
#include "sheet.hh"

Stack_elem *Proper::eval(Stack_elem *p,Sheet *sheet, short col, short row) {
    int i;
    char *st;

    se = p;

    st = sheet->stack_string(p);

    if (st == NULL)
      se->contents.string_val[0] = 0;
    else {
      for(i=0; st[i] != 0; i++) {
        if (i == 0 || !isalpha(st[i-1]))
          se->contents.string_val[i] = toupper(st[i]);
        else
          se->contents.string_val[i] = tolower(st[i]);
      }
      se->contents.string_val[i] = 0;
    }
    se->type = FORM_STRING;
    return(se);
}

Proper::Proper() {
  //    se = new Stack_elem;
}

Proper::~Proper() {
  //delete se;
}

// $Log: xxl_proper.cc,v $
// Revision 1.3  1996/12/11  21:39:49  aml
// Sumif implemented.
// Diverse time functions implemented.
// Fixed needtoscroll2 to avoid out of control scroll.
//
// Revision 1.2  1996/08/28 17:17:25  aml
// Load and save now accept string_value for formula cells.
// This fixes previous thought problem of formula values not
// being stored.
// Functions upper,lower and proper created.
// Function if can now return labels.
// Fixed problem with function count.
// Reasonably stable version, very used to manipulate notas.wk1.
//
// Revision 1.1  1996/08/28 17:03:27  aml
// Initial revision
//
