Ejemplo n.º 1
0
int main(int argc, char *argv[])
{
  char *sensor, *beam_mode, *input_dir, *output_dir;
  currArg = 1;

  // Parse command line
  if (argc == 1)
    usage(argv[0]);

  if (currArg < (argc - 5)) {
    printf("Insufficient arguments.\n"); 
    usage(argv[0]);
  }
  
  sensor = (char *) MALLOC(sizeof(char)*10);
  sprintf(sensor, "%s", uc(argv[currArg]));
  beam_mode = (char *) MALLOC(sizeof(char)*10);
  sprintf(beam_mode, "%s", uc(argv[currArg+1]));
  input_dir = (char *) MALLOC(sizeof(char)*512);
  strcpy(input_dir, argv[currArg+2]);
  output_dir = (char *) MALLOC(sizeof(char)*512);
  strcpy(output_dir, argv[currArg+3]);

  asfSplashScreen (argc, argv);
  
  // Rock and roll
  filter_srfs(sensor, beam_mode, input_dir, output_dir);

  // Clean up
  FREE(beam_mode);
  FREE(input_dir);
  FREE(output_dir);
  
  exit(0);
}
Ejemplo n.º 2
0
Archivo: uc.c Proyecto: Fiegs/exercises
int main(int argc, char *argv[]) 
{
    int i;
    int size = 5;
    char *string;

    /* Read from stdin if no command line arguments. */
    if (argc == 1) {
        if ((string = malloc(sizeof(char) * size)) == NULL) {
            perror("Error calling malloc in main");
            exit(1);
        }

        while (uc_getline(string, size, stdin) > 0) {
            printf("%s\n", uc(string));
        }

        free(string);
    }
    /* Process each argument. */
    else {
        for(i = 1; i < argc; i++) {
            printf("%s ", uc(argv[i]));
        }
        printf("\n");
    }

    return 0;
}
Ejemplo n.º 3
0
/*
 * This function converts a string containing a suit letter (that is
 * one of H,S,D,C) into its suit ID.
 *
 * The suit letter may come somewhat after the beginning of the string.
 *
 * */
int freecell_solver_u2p_suit(const char * suit)
{
    char c;

    c = uc(*suit);
    while (
            (c != 'H') &&
            (c != 'S') &&
            (c != 'D') &&
            (c != 'C') &&
            (c != ' ') &&
            (c != '\0'))
    {
        suit++;
        c = uc(*suit);
    }

    if (c == 'H')
        return 0;
    else if (c == 'C')
        return 1;
    else if (c == 'D')
        return 2;
    else if (c == 'S')
        return 3;
    else
        return 0;
}
Ejemplo n.º 4
0
/* s1 is source, s2 dest */
void builds(const char *s1, char *s2)
{
        int i;
        char c;

        for (i=0; (i<8) && (*s1) && (*s1 != '*') && (*s1 != SLASH) &&
            (*s1 != '.') && (*s1 != ' '); i++)
                *s2++ = uc(*s1++);

        if (i == 8)
                while (*s1 && (*s1 != '.') && (*s1 != SLASH))
                        s1++;

        c = ((*s1 == '*') ? '?' : ' ');

        if (*s1 == '*')
                s1++;

        if (*s1 == '.')
                s1++;

        for (; i < 8; i++)
                *s2++ = c;

        for (i=0;(i<3) && (*s1) && (*s1 != '*') && (*s1 != SLASH) &&
            (*s1 != '.') && (*s1 != ' '); i++)
                *s2++ = uc(*s1++);

        c = ((*s1 == '*') ? '?' : ' ');

        for (; i < 3; i++)
                *s2++ = c;
}
Ejemplo n.º 5
0
void cheboksarovv::lab7()
{ double* a1=new double[N];
  double* a2=new double[N];
  double e=0.00000001;
   do{
       a2=v(um(A,x),b);
       a1=v(a1,umc(a2,uc(um(A,a2),a2)/uc(um(A,a2),um(A,a2))));
            }while(logik(x,a1,e));
}
Ejemplo n.º 6
0
static int xcmps(char *s, char *d)
{
        register int i;

        for (i = 0; i < 11; i++)
                if (uc(*s++) != uc(*d++))
                        return(0);
        return(1);
}
Ejemplo n.º 7
0
int ispolygon(char *inFile)
{
    int isPolygon=0;
    char *line=NULL, *s;
    FILE *fp;

    fp = fopen(inFile, "r");
    if (!fp) {
        char n[1024];
        sprintf(n, "%s.csv", inFile);
        fp = fopen(n, "r");
    }
    if (!fp) {
        char *basename = get_basename(inFile);
        char n[1024];
        sprintf(n, "%s.csv", basename);
        fp = fopen(n, "r");
        FREE(basename);
    }
    if (fp) {
        line = (char*)MALLOC(sizeof(char)*LINE_MAX);
        int line_count=0;
        while (fgets(line, LINE_MAX, fp)) {
            line[strlen(line)-1] = '\0';
            s=line;
            while(isspace((int)(*s))) ++s;
            if (*s == '#') {
                char *tok = strtok(s,",");
                if (tok) {
                    s = strstr(uc(tok), "FILE");
                    if (s && strncmp(uc(s), "FILE", 4) == 0) {
                        tok = strtok(NULL, ",");
                        if (tok) {
                            s = strstr(uc(tok), "POLYGON");
                            if (s && strncmp(uc(s), "POLYGON", 7) == 0) {
                                isPolygon = 1;
                                break;
                            }
                        }
                    }
                }
            }
            // avoid scanning the entire contents of a huge file
            if (++line_count>100)
              break;
        }
    }
    FREE(line);
    FCLOSE(fp);

    return isPolygon;
}
Ejemplo n.º 8
0
char *hex(void *p, int len)
{
	if ((HEXSZ-1)/2 < len)
		len = (HEXSZ-1)/2;
	char *out = _xbuf;
	while (len--) {
		*out++ = hx[(*uc(p))>>4];
		*out++ = hx[(*uc(p))&15];
		(u_char*)p++;
	};
	*out = 0;
	return _xbuf;
};
Ejemplo n.º 9
0
void
asmcheck_do_sou(struct tdesc *tdp, struct node *np)
{
	struct mlist *mlp;
	struct child *chp;
	char *format;

	if (np->format != NULL) {
		char *upper = uc(np->format);

		printf("!	struct/union %s size 0x%x\n", upper, tdp->size);

#if 0 /* { FIXME: */
		{
			int l;
			if ((np->format2 != NULL) &&
			    (l = stabs_log2(tdp->size)) != -1) {
				printf("#define\t%s 0x%x\n", np->format2, l);
			}
		}
#endif /* } */

		free(upper);
	}

	/*
	 * Run thru all the fields of a struct and print them out
	 */
	for (mlp = tdp->data.members.forw; mlp != NULL; mlp = mlp->next) {
		/*
		 * If there's a child list, only print those members.
		 */
		if (np->child != NULL) {
			if (mlp->name == NULL)
				continue;
			chp = find_child(np, mlp->name);
			if (chp == NULL)
				continue;
			format = uc(chp->format);
		} else {
			format = NULL;
		}
		if (mlp->fdesc == NULL)
			continue;
		switch_on_type(mlp, mlp->fdesc, format, 0);
		if (format != NULL)
			free(format);
	}
}
Ejemplo n.º 10
0
HRESULT CUpdateCheckEx::Check(BOOL bRunInThread, HWND hParent, CImageList* pImages,
	BOOL bUIOnlyOnUpdate)
{
	HRESULT hRes = S_OK;

	if(bRunInThread == TRUE)
	{
		g_ucInitStruct.hParent = hParent;
		g_ucInitStruct.pImages = pImages;
		g_ucInitStruct.bUIOnlyOnUpdate = bUIOnlyOnUpdate;

		DWORD dwDummyID = 0; // Pointer may not be NULL on Windows 9x/Me
		HANDLE h = CreateThread(NULL, 0, CfuEx_Thread, NULL, 0, &dwDummyID);

		if((h != NULL) && (h != INVALID_HANDLE_VALUE)) CloseHandle(h);
		else hRes = E_FAIL;
	}
	else
	{
		// CStatusDialogEx dlg(hParent, false, true);
		// dlg.Show();
		// std_string str = TRL("Check for Updates");
		// str += _T("...");
		// dlg.SetStatus(true, str.c_str());

		CUpdateCheckEx uc(hParent, pImages, bUIOnlyOnUpdate);
		uc._RunCheck(NULL);

		// dlg.Release();
	}

	ASSERT(SUCCEEDED(hRes));
	return hRes;
}
Ejemplo n.º 11
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void jdlvFrame::SelectColor (QAction *act) // called from menu action
{                                          //
  if (act->text().startsWith("random")) {
    elRecolorator rc(act->text().indexOf("Bi") > 0 ? "%%%%%%%" : "*******");
    primeWorld->changeTheWorld(rc);
         vista->updateTheWorld  (); notifyOfChange();
  }
  else { char cl = act->text().at(0).unicode();
    switch (cl) {
    case 'b': curColor = elcDefault; cl = 'o'; break; // -- "blanco"
    case 'r': curColor = elcRojo;              break;
    case 'v': curColor = elcVerde;             break;
    case 'a': curColor = elcAzul;              break;
    case 'x': curColor = elcCianico;           break;
    case 'c': curColor = elcCastano;           break;
    case 'z': curColor = elcMagenta;           break;
    case 'U':
      { elRecolorator uc("ooooooo"); // everything -> default color ("blanco")
        primeWorld->changeTheWorld(uc);
             vista->updateTheWorld  (); notifyOfChange(); return; }
    }
    setColor->setIcon (act->icon());
    QRect S = vista->getSelection();
    if (eM == elModeEdit && !S.isEmpty()) {   QString rule(elcMax, QChar(cl));
      elRecolorator rc(rule.cStr(), S.left(), S.right(), S.top(), S.bottom());
      primeWorld->changeTheWorld(rc);
           vista->updateTheWorld  (); notifyOfChange();
} } }
Ejemplo n.º 12
0
tempotest_UserClass::tempotest_UserClass(IdMsg *msg)
{
  mainid = msg->id;
  delete msg;
  CProxy_tempotest_UserClass uc(thishandle);
  uc.doSendRecv();
}
Ejemplo n.º 13
0
 std::string to_upper(const std::string &s) {
     std::string uc(s);
     size_t l = uc.size();
     for (size_t i=0; i<l; i++)
         uc[i] = static_cast<char>(std::toupper(uc[i]));
     return uc;
 }
Ejemplo n.º 14
0
  void Bspline3DSetBase::tileOrbitals(const TinyVector<int,3>& boxdup)
  {
    TensorType uc(
        Lattice.R(0,0)/static_cast<RealType>(boxdup[0]),
        Lattice.R(0,1)/static_cast<RealType>(boxdup[0]),
        Lattice.R(0,2)/static_cast<RealType>(boxdup[0]),
        Lattice.R(1,0)/static_cast<RealType>(boxdup[1]),
        Lattice.R(1,1)/static_cast<RealType>(boxdup[1]),
        Lattice.R(1,2)/static_cast<RealType>(boxdup[1]),
        Lattice.R(2,0)/static_cast<RealType>(boxdup[2]),
        Lattice.R(2,1)/static_cast<RealType>(boxdup[2]),
        Lattice.R(2,2)/static_cast<RealType>(boxdup[2]));
    UnitLattice.set(uc);

    int norb=OrbitalSetSize/(boxdup[0]*boxdup[1]*boxdup[2]);
    int i=norb;
    for(int ic=0; ic<boxdup[0]; ic++)
      for(int jc=0; jc<boxdup[1]; jc++)
        for(int kc=0; kc<boxdup[2]; kc++)
        {
          if(ic == 0 && jc == 0 && kc == 0) continue;
          PosType c(ic,jc,kc);
          PosType displ=UnitLattice.toCart(c);
          for(int o=0; o<norb; o++, i++)
          {
            P[i]=P[o];
            Centers[i]=Centers[o]+displ;
            Origins[i]=Origins[o]+displ;
          }
        }

    //for(i=0; i<OrbitalSetSize; i++)
    //  app_log() << Centers[i] << endl;
  }
Ejemplo n.º 15
0
QString MythUIVirtualKeyboard::decodeChar(QString c)
{
    QString res;

    while (c.length() > 0)
    {
        if (c.startsWith("0x"))
        {
            QString sCode = c.left(6);
            bool bOK;
            short nCode = sCode.toShort(&bOK, 16);

            c = c.mid(6);

            if (bOK)
            {
                QChar uc(nCode);
                res += QString(uc);
            }
            else
                LOG(VB_GENERAL, LOG_ERR, QString("bad char code (%1)")
                                .arg(sCode));
        }
        else
        {
            res += c.left(1);
            c = c.mid(1);
        }
    }

    return res;
}
Ejemplo n.º 16
0
void UsageComputer::Read(Expression* x) {
  if (is_write_) {
    UsageComputer uc(weight_, false);
    uc.Visit(x);
  } else {
    Visit(x);
  }
}
Ejemplo n.º 17
0
void About::runUpdateCheck()
{
	updateView->clear();
	UpgradeCheckerGUI uc(updateView);
	disconnect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
	uc.fetch();
	connect( checkForUpdateButton, SIGNAL( clicked() ), this, SLOT( runUpdateCheck() ) );
}
Ejemplo n.º 18
0
void UsageComputer::Write(Expression* x) {
  if (!is_write_) {
    UsageComputer uc(weight_, true);
    uc.Visit(x);
  } else {
    Visit(x);
  }
}
Ejemplo n.º 19
0
	void compile(const char* path, CompileOptions& opts)
	{
		Buffer unit_data(default_allocator());

		UnitCompiler uc(opts);
		uc.compile_unit(path);

		opts.write(uc.blob());
	}
Ejemplo n.º 20
0
	void compile(CompileOptions& opts)
	{
		Buffer unit_data(default_allocator());

		UnitCompiler uc(opts);
		uc.compile_unit(opts.source_path());

		opts.write(uc.blob());
	}
Ejemplo n.º 21
0
static BOOL match(char *s1, char *s2)
{
    register int i;

    /*
     **  skip VFAT long file name entries
     */

    if (s2[11] == FA_LFN)
        return( FALSE );

    /*
     **  check for deleted entry.  wild cards don't match deleted entries,
     **  only specific requests for deleted entries do.
     */

    if (*s2 == (char)0xe5)
    {
        if (*s1 == '?')
            return( FALSE );
        else if (*s1 == (char)0xe5)
            return( TRUE );
    }

    /*
     **  compare names
     */

    for (i=0; i < 11 ; i++, s1++, s2++)
        if (*s1 != '?')
            if (uc(*s1) != uc(*s2))
                return( FALSE );

    /*
     **  check attribute match   M01.01.SCC.FS.08
     ** volume labels and subdirs must be specifically asked for
     */

    if(  (*s1 != FA_VOL)  &&  (*s1 != FA_SUBDIR)  )
        if (!(*s2))
            return( TRUE );

    return( *s1 & *s2 ? TRUE : FALSE ) ;
}
Ejemplo n.º 22
0
DWORD WINAPI CfuEx_Thread(LPVOID lpParameter)
{
	UNREFERENCED_PARAMETER(lpParameter);

	CUpdateCheckEx uc(g_ucInitStruct.hParent, g_ucInitStruct.pImages,
		g_ucInitStruct.bUIOnlyOnUpdate);
	uc._RunCheck(NULL);

	return 0;
}
Ejemplo n.º 23
0
void
asmcheck_do_intrinsic(struct tdesc *tdp, struct node *np)
{
	if (np->format != NULL) {
		char *upper = uc(np->format);

		printf("\t/* %s 0x%x */\n", upper, tdp->size);

		free(upper);
	}
}
Ejemplo n.º 24
0
int
is_absolute_path(const ichar *name)
{ if (isDirSep(name[0])
#ifdef __WINDOWS__
      || (iswalpha(uc(name)) && name[1] == ':')
#endif
    )
    return TRUE;

  return FALSE;
}
Ejemplo n.º 25
0
int
is_absolute_path(const char *name)
{ if (isDirSep(name[0])
#ifdef WIN_NT
      || (isalpha(uc(name)) && name[1] == ':')
#endif
    )
    return TRUE;

  return FALSE;
}
Ejemplo n.º 26
0
void CompiledLoop::removeTagChecks() {
  // Eliminate all tag checks for loop variable and upper bound
  // As a side effect, this will add all arrays indexed by the loop variable to the LoopHeaderNode
  UntagClosure uc(this, _loopVar);
  _loopVar->forAllUsesDo(&uc);
  if (_lowerBound) {
    uc.theLoopPReg = _lowerBound;
    _lowerBound->forAllUsesDo(&uc);
  }
  uc.theLoopPReg = _upperBound;
  _upperBound->forAllUsesDo(&uc);
}
Ejemplo n.º 27
0
/* Append an extension if it's not already there. Case insensitive. */
void append_ext_if_needed(char *file_name, const char *newExt,
                          const char *alsoAllowedExt)
{
  char *ext, extuc[1024];
  char new1uc[1024], new2uc[1024];

  ext = findExt(file_name);
  if (ext) {
    strcpy(extuc, uc(ext));
    if (newExt) {
      strcpy(new1uc,uc(newExt));
      if (strcmp(extuc, new1uc)==0) {
        return;
      }
    }
    if (alsoAllowedExt) {
      strcpy(new2uc,uc(alsoAllowedExt));
      if (strcmp(extuc, new2uc)==0) {
        return;
      }
    }
  }

  // If we haven't returned yet, we need to apply the extension

  // don't append any "." if one is already there
  const char *p = newExt;
  if (file_name[strlen(file_name)-1] == '.')
      ++p;

  // if the basename doesn't end with a "." and the given extension
  // doesn't have a leader ".", we will add one ourselves
  if (file_name[strlen(file_name)-1] != '.' && p[0] != '.')
      strcat(file_name, ".");

  // now can append given extension
  strcat(file_name, p);
}
Ejemplo n.º 28
0
static void
switch_on_type(struct mlist *mlp, struct tdesc *tdp, char *format, int level)
{
	boolean_t allocated = B_FALSE;

	if (format == NULL) {
		allocated = B_TRUE;
		format = uc(mlp->name);
	}

	switch (tdp->type) {
	case INTRINSIC:
		print_intrinsic(mlp, tdp, format, level);
		break;
	case POINTER:
		print_pointer(mlp, tdp, format, level);
		break;
	case ARRAY:
		print_array(mlp, tdp, format, level);
		break;
	case FUNCTION:
		print_function(mlp, tdp, format, level);
		break;
	case UNION:
		print_union(mlp, tdp, format, level);
		break;
	case ENUM:
		print_enum(mlp, tdp, format, level);
		break;
	case FORWARD:
		print_forward(mlp, tdp, format, level);
		break;
	case TYPEOF:
		print_typeof(mlp, tdp, format, level);
		break;
	case STRUCT:
		print_struct(mlp, tdp, format, level);
		break;
	case VOLATILE:
		print_volatile(mlp, tdp, format, level);
		break;
	default:
		fprintf(stderr, "Switch to Unknown type\n");
		error = B_TRUE;
		break;
	}
	if (allocated)
		free(format);
}
Ejemplo n.º 29
0
static DND *dcrack(const char **np)
{
    register const char *n;
    DND *p;
    register int d;
    LONG l;                                             /* M01.01.1212.01 */

#if DBGFSDIR
    kprintf("\n dcrack(%p -> '%s')", np, *np);
#endif

    /*
     **  get drive spec (or default) and make sure drive is logged in
     */

    n = *np;                    /*  get ptr to name             */
    if (n[1] == ':')            /*  if we start with drive spec */
    {
        d = uc(n[0]) - 'A';     /*    compute drive number      */
        n += 2;                 /*    bump past drive number    */
    }
    else                                /*  otherwise                   */
        d = run->p_curdrv;      /*    assume default            */

    /* M01.01.1212.01 */
    if ((l = ckdrv(d)) < 0)     /*  check for valid drive & log */
        return((DND*) l );              /*    in.  abort if error       */

    /*
     **  if the pathspec begins with SLASH, then the first element is
     **  the root.  Otherwise, it is the current default directory.     Get
     **  the proper DND for this element
     */

    if (*n == SLASH)
    {   /* [D:]\path */
        p = drvtbl[d]->m_dtl;   /*  get root dir for log drive  */
        n++;                    /*  skip over slash             */
    }
    else
        p = dirtbl[(int)(run->p_curdir[d])];    /*  else use curr dir   */

    /* whew ! */ /*  <= thankyou, Jason, for that wonderful comment */

    *np = n;
    return( (DND*)p );
}
Ejemplo n.º 30
0
/*
 * This function converts a card number from its user representation
 * (e.g: "A", "K", "9") to its card number that can be used by
 * the program.
 * */
int freecell_solver_u2p_card_number(const char * string)
{
    char rest;

    while (1)
    {
        rest = uc(*string);

        if ((rest == '\0') || (rest == ' ') || (rest == '\t'))
        {
            return 0;
        }
        if (rest == 'A')
        {
            return 1;
        }
        else if (rest =='J')
        {
            return 11;
        }
        else if (rest == 'Q')
        {
            return 12;
        }
        else if (rest == 'K')
        {
            return 13;
        }
        else if (rest == '1')
        {
            return (*(string+1) == '0')?10:1;
        }
        else if ((rest == '0') || (rest == 'T'))
        {
            return 10;
        }
        else if ((rest >= '2') && (rest <= '9'))
        {
            return (rest-'0');
        }
        else
        {
            string++;
        }
    }
}