Esempio n. 1
0
int de_Delete() {
	char * more;
	char * rdn;
	char * sure;
	char name[LINESIZE];

	int fillMostRmArg();
	int noEntries;
	int objectType;
	int status;

	noEntries = 0;

	more = malloc(LINESIZE);
	plp = (struct namelist *) malloc(sizeof(struct namelist));
	sure = malloc(LINESIZE);

	fillMostRmArg();

	(void) sprintf(default_person, ""); /* Clear default value */
	(void) sprintf(more, yes_string);  /* Enter loop */

	highNumber = 0;

	while (!(strcmp(more, yes_string))) {
		enterString(DELETE, person, plp);

		if (!(strcmp(person, quit_String))) {
			(void) sprintf(more, no_string);
			if (noEntries > 0) {
				freePRRs(&plp);
			}
			continue;
		}
		if (strlen(person) <= 0) {
			(void) printf("%s %s %s", enter_entry_name, quit_String, to_quit);
			continue;
		}
		(void) printf("\n");


		if (noEntries > 0) {
			freePRRs(&plp);
		}

		if (listPRRs(posdit, person, &plp) != OK) {
			searchFail(person);
			de_exit(-1);
		}

		noEntries = listlen(plp);

		if (noEntries == 0) {
			(void) printf(no_ent_found);
			freePRRs(&plp);
		} else if (noEntries == 1) {
			rdn = copy_string(lastComponent(plp->name, PERSON));
			status = get_objectClassPRR(plp, &objectType);
			if (status != OK) {
				(void) printf(no_p_rl_rm);
				continue;
			} else if (objectType == PERSON) {
				if (listPRRs(posdit, rdn, &plp) != OK) {
					searchFail(rdn);
				}
			} else if (objectType == ROLE) {
				if (listPRRRl(posdit, rdn, &plp) != OK) {
					searchFail(rdn);
				}
			} else if (objectType == ROOM) {
				if (listPRRRm(posdit, rdn, &plp) != OK) {
					searchFail(rdn);
				}
			}
			pagerOn(NUMBER_NOT_ALLOWED);
			printListPRRs(person, plp, COUNTRY, TRUE);
			highNumber = 0;
			de_prompt_yesno(sure_delete, sure, no_string);
			if (!(strcmp(sure, yes_string))) {
				/* Delete the entry */
				(void) dm_Delete_entry();
				freePRRs(&plp);
			} else {
				freePRRs(&plp);
			}
		} else {
			/* more than 1, select from list */
			pagerOn(NUMBER_ALLOWED);
			printListPRRs(name, plp, COUNTRY, FALSE);
		}
	}

	free(more);
	free(rdn);
	free(sure);
	return OK;
}
Esempio n. 2
0
void update_ssd_ui(SSDataUI *ui, Quark *q)
{
    if (ui && q) {
        int i, nc, nr, new_nc, new_nr, ncols, nrows, nfixed_cols;
        int delta_nc, delta_nr;
        int *maxlengths;
        char **rowlabels, **collabels;
        
        if (ui->q != q) {
            TableDeselectAllCells(ui->mw);
        }
        
        ui->q = q;
        
        ncols = ssd_get_ncols(q);
        nrows = ssd_get_nrows(q);
        
        new_nc = ncols + EXTRA_SS_COLS;
        new_nr = nrows + EXTRA_SS_ROWS;
        
        if (ssd_is_indexed(q)) {
            nfixed_cols = 1;
        } else {
            nfixed_cols = 0;
        }

        nr = TableGetNrows(ui->mw);
        nc = TableGetNcols(ui->mw);

        delta_nr = new_nr - nr;
        delta_nc = new_nc - nc;

        if (delta_nr > 0) {
            TableAddRows(ui->mw, delta_nr);
        } else if (delta_nr < 0) {
            TableDeleteRows(ui->mw, -delta_nr);
        }

        rowlabels = xmalloc(new_nr*sizeof(char *));
        for (i = 0; i < new_nr; i++) {
            char buf[32];
            sprintf(buf, "%d", i + 1);
            rowlabels[i] = copy_string(NULL, buf);
        }
        TableSetRowLabels(ui->mw, rowlabels);
        for (i = 0; i < new_nr; i++) {
            xfree(rowlabels[i]);
        }
        xfree(rowlabels);

        maxlengths = xmalloc(new_nc*SIZEOF_INT);
        collabels = xmalloc(new_nc*sizeof(char *));

        for (i = 0; i < new_nc; i++) {
            ss_column *col = ssd_get_col(q, i);
            if (col && col->format == FFORMAT_STRING) {
                maxlengths[i] = STRING_CELL_WIDTH;
            } else {
                maxlengths[i] = 2*CELL_WIDTH;
            }
            if (col && !string_is_empty(col->label)) {
                collabels[i] = copy_string(NULL, col->label);
            } else {
                unsigned int coli;
                char buf[32];
                
                coli = i;
                sprintf(buf, "%c", coli%26 + 'A');
                while ((coli /= 26)) {
                    memmove(&buf[1], buf, strlen(buf) + 1);
                    buf[0] = coli%26 + 'A' - 1;
                }
                
                collabels[i] = copy_string(NULL, buf);
            }
        }

        if (delta_nc > 0) {
            TableAddCols(ui->mw, delta_nc);
        } else if (delta_nc < 0) {
            TableDeleteCols(ui->mw, -delta_nc);
        }

        TableSetColMaxlengths(ui->mw, maxlengths);
        TableSetColLabels(ui->mw, collabels);
        TableSetFixedCols(ui->mw, nfixed_cols);
        TableUpdateVisibleRowsCols(ui->mw);

        xfree(maxlengths);
        for (i = 0; i < new_nc; i++) {
            xfree(collabels[i]);
        }
        xfree(collabels);
        
        UpdateColChoice(ui->col_sel, q);
    }
}
Esempio n. 3
0
static enum proto_parse_status tns_parse_end(struct sql_proto_info *info, struct cursor *cursor)
{
    SLOG(LOG_DEBUG, "Parsing tns end packet");
    enum proto_parse_status status;

    uint_least64_t var[6];
    for (unsigned i = 0; i < 6; i++) {
        if (PROTO_OK != (status = cursor_read_variable_int(cursor, var + i))) return status;
    }

    uint_least64_t nb_rows;
    uint_least64_t error_code;

    // let's use the double 0x00 to guess the position of row number and error code
    if (var[0] > 0 && var[4] == 0 && var[5] == 0) {
        // var[0] is unknown?
        // var[1] == sequence
        // var[2] == rows
        // var[3] == error code
        SLOG(LOG_DEBUG, "Unknown bits after ttc code");
        nb_rows = var[2];
        error_code = var[3];
        DROP_VAR(cursor);
    } else if (var[3] == 0 && var[4] == 0) {
        // var[0] == sequence
        // var[1] == rows
        // var[2] == error code
        nb_rows = var[1];
        error_code = var[2];
    } else {
        // var[0] == rows
        // var[1] == error code
        nb_rows = var[0];
        error_code = var[1];
    }

    if (info->msg_type == SQL_QUERY) {
        sql_set_row_count(info, nb_rows);
        SLOG(LOG_DEBUG, "Nb rows %d", info->u.query.nb_rows);
    }
    SLOG(LOG_DEBUG, "Error code is %zu", error_code);

    DROP_VARS(cursor, 1);
    DROP_FIX(cursor, 2);
    DROP_VARS(cursor, 2);
    DROP_FIX(cursor, 2);
    DROP_VARS(cursor, 2);
    DROP_FIX(cursor, 1);
    DROP_VARS(cursor, 3);

    if (error_code != 0) {
        SLOG(LOG_DEBUG, "Parsing error message");
        char *error_msg = tempstr();
        unsigned error_len;

        // Drop an unknown number of bytes here
        while(cursor->cap_len > 2 && (cursor_peek_u8(cursor, 0) == 0 || !is_print(cursor_peek_u8(cursor, 1)))){
            DROP_FIX(cursor, 1);
        }
        SLOG(LOG_DEBUG, "First printable char is %c", cursor_peek_u8(cursor, 1));
        status = cursor_read_variable_string(cursor, error_msg, TEMPSTR_SIZE, &error_len);
        if (status != PROTO_OK) return status;
        if (error_len < 12) return PROTO_PARSE_ERR;
        // Split "ORA-XXXX: msg"
        // Part before : is the error code
        // Part after is the localized message
        char *colon_pos = memchr(error_msg, ':', error_len);
        sql_set_request_status(info, SQL_REQUEST_ERROR);
        if (colon_pos) {
            // We extract the error code
            unsigned error_code_size = colon_pos - error_msg;
            int size_err = MIN(error_code_size, sizeof(info->error_code));
            memcpy(info->error_code, error_msg, size_err);
            info->error_code[size_err] = '\0';
            info->set_values |= SQL_ERROR_CODE;
            if (0 == strcmp("ORA-01403", info->error_code))
                info->request_status = SQL_REQUEST_COMPLETE;

            // We skip ':' in errror message
            char const *start_message = colon_pos + 1;
            // We skip spaces before errror message
            while (start_message < error_len + error_msg && *start_message == ' ')
                start_message++;

            copy_string(info->error_message, start_message, sizeof(info->error_message));
            info->set_values |= SQL_ERROR_MESSAGE;
        } else {
            copy_string(info->error_message, error_msg, sizeof(info->error_message));
            info->set_values |= SQL_ERROR_MESSAGE;
        }
    }

    return PROTO_OK;
}
Esempio n. 4
0
/**
	result_next : 'result -> object?
	<doc>
	Return the next row if available. A row is represented
	as an object, which fields have been converted to the
	corresponding Neko value (int, float or string). For
	Date and DateTime you can specify your own conversion
	function using [result_set_conv_date]. By default they're
	returned as plain strings. Additionally, the TINYINT(1) will
	be converted to either true or false if equal to 0.
	</doc>
**/
static value result_next( value o ) {
	result *r;
	unsigned long *lengths = NULL;
	MYSQL_ROW row;
	val_check_kind(o,k_result);
	r = RESULT(o);
	row = mysql_fetch_row(r->r);
	if( row == NULL )
		return val_null;
	{
		int i;
		value cur = alloc_object(NULL);
		r->current = row;
		for(i=0;i<r->nfields;i++)
			if( row[i] != NULL ) {
				value v;
				switch( r->fields_convs[i] ) {
				case CONV_INT:
					v = alloc_best_int(atoi(row[i]));
					break;
				case CONV_STRING:
					v = alloc_string(row[i]);
					if( r->conv_string != NULL )
						v = val_call1(r->conv_string,v);
					break;
				case CONV_BOOL:
					v = alloc_bool( *row[i] != '0' );
					break;
				case CONV_FLOAT:
					v = alloc_float(atof(row[i]));
					break;
				case CONV_BINARY:
					if( lengths == NULL ) {
						lengths = mysql_fetch_lengths(r->r);
						if( lengths == NULL )
							val_throw(alloc_string("mysql_fetch_lengths"));
					}
					v = copy_string(row[i],lengths[i]);
					if( r->conv_bytes != NULL )
						v = val_call1(r->conv_bytes,v);
					break;
				case CONV_DATE:
					if( r->conv_date == NULL )
						v = alloc_string(row[i]);
					else {
						struct tm t;
						sscanf(row[i],"%4d-%2d-%2d",&t.tm_year,&t.tm_mon,&t.tm_mday);
						t.tm_hour = 0;
						t.tm_min = 0;
						t.tm_sec = 0;
						t.tm_isdst = -1;
						t.tm_year -= 1900;
						t.tm_mon--;
						v = val_call1(r->conv_date,alloc_int32((int)mktime(&t)));
					}
					break;
				case CONV_DATETIME:
					if( r->conv_date == NULL )
						v = alloc_string(row[i]);
					else {
						struct tm t;
						sscanf(row[i],"%4d-%2d-%2d %2d:%2d:%2d",&t.tm_year,&t.tm_mon,&t.tm_mday,&t.tm_hour,&t.tm_min,&t.tm_sec);
						t.tm_isdst = -1;
						t.tm_year -= 1900;
						t.tm_mon--;
						v = val_call1(r->conv_date,alloc_int32((int)mktime(&t)));
					}
					break;
				default:
					v = val_null;
					break;
				}
				alloc_field(cur,r->fields_ids[i],v);
			}
		return cur;
	}
}
Esempio n. 5
0
int
do_execve(const char *filename, const char **argv, const char **envp) {
    static_assert(EXEC_MAX_ARG_LEN >= FS_MAX_FPATH_LEN);
    
    struct mm_struct *mm = current->mm;

    char local_name[PROC_NAME_LEN + 1];
    memset(local_name, 0, sizeof(local_name));

    char *kargv[EXEC_MAX_ARG_NUM], *kenvp[EXEC_MAX_ENV_NUM];
    const char *path;

    int ret = -E_INVAL;
    lock_mm(mm);
#if 0
    if (name == NULL) {
        snprintf(local_name, sizeof(local_name), "<null> %d", current->pid);
    }
    else {
        if (!copy_string(mm, local_name, name, sizeof(local_name))) {
            unlock_mm(mm);
            return ret;
        }
    }
#endif
    snprintf(local_name, sizeof(local_name), "<null> %d", current->pid);

    int argc = 0, envc = 0;
    if ((ret = copy_kargv(mm, kargv, argv, EXEC_MAX_ARG_NUM, &argc)) != 0) {
      unlock_mm(mm);
      return ret;
    }
    if ((ret = copy_kargv(mm, kenvp, envp, EXEC_MAX_ENV_NUM, &envc)) != 0) {
      unlock_mm(mm);
      put_kargv(argc, kargv);
      return ret;
    }

#if 0
    int i;
    kprintf("## fn %s\n", filename);
    kprintf("## argc %d\n", argc);
    for(i=0;i<argc;i++)
      kprintf("## %08x %s\n", kargv[i], kargv[i]);
    kprintf("## envc %d\n", envc);
    for(i=0;i<envc;i++)
      kprintf("## %08x %s\n", kenvp[i], kenvp[i]);
#endif
    //path = argv[0];
    //copy_from_user (mm, &path, argv, sizeof (char*), 0);
    path = filename;
    unlock_mm(mm);

    /* linux never do this */
    //fs_closeall(current->fs_struct);

    /* sysfile_open will check the first argument path, thus we have to use a user-space pointer, and argv[0] may be incorrect */

    int fd;
    if ((ret = fd = sysfile_open(path, O_RDONLY)) < 0) {
      goto execve_exit;
    }

    if (mm != NULL) {
      mm->lapic = -1;
      mp_set_mm_pagetable(NULL);
      if (mm_count_dec(mm) == 0) {
        exit_mmap(mm);
        put_pgdir(mm);
        bool intr_flag;
        local_intr_save(intr_flag);
        {
          list_del(&(mm->proc_mm_link));
        }
            local_intr_restore(intr_flag);
            mm_destroy(mm);
        }
        current->mm = NULL;
    }
    put_sem_queue(current);

    ret = -E_NO_MEM;
    /* init signal */
    put_sighand(current);
    if ((current->signal_info.sighand = sighand_create()) == NULL) {
      goto execve_exit;
    }
    sighand_count_inc(current->signal_info.sighand);

    put_signal(current);
    if ((current->signal_info.signal = signal_create()) == NULL) {
      goto execve_exit;
    }
    signal_count_inc(current->signal_info.signal);

    if ((current->sem_queue = sem_queue_create()) == NULL) {
      goto execve_exit;
    }
    sem_queue_count_inc(current->sem_queue);

    if ((ret = load_icode(fd, argc, kargv, envc, kenvp)) != 0) {
      goto execve_exit;
    }

    set_proc_name(current, local_name);

	if (do_execve_arch_hook (argc, kargv) < 0)
		goto execve_exit;
	
    put_kargv(argc, kargv);
    return 0;

execve_exit:
    put_kargv(argc, kargv);
    put_kargv(envc, kenvp);
/* exec should return -1 if failed */
    //return ret;
    do_exit(ret);
    panic("already exit: %e.\n", ret);
}
Esempio n. 6
0
CAMLprim value unix_error_message(value err)
{
  int errnum;
  errnum = Is_block(err) ? Int_val(Field(err, 0)) : error_table[Int_val(err)];
  return copy_string(strerror(errnum));
}
Esempio n. 7
0
/* DataLayout.t -> string */
CAMLprim value llvm_datalayout_as_string(value TD) {
  char *StringRep = LLVMCopyStringRepOfTargetData(DataLayout_val(TD));
  value Copy = copy_string(StringRep);
  LLVMDisposeMessage(StringRep);
  return Copy;
}
Esempio n. 8
0
CAMLprim value unix_gethostname(value unit)
{
  struct utsname un;
  uname(&un);
  return copy_string(un.nodename);
}
Esempio n. 9
0
/**
	parse_multipart_data : onpart:function:2 -> ondata:function:3 -> void
	<doc>
	Incrementally parse the multipart data. call [onpart(name,filename)] for each part
	found and [ondata(buf,pos,len)] when some data is available
	</doc>
**/
static value parse_multipart_data( value onpart, value ondata ) {
	value buf;
	int len = 0;
	mcontext *c = CONTEXT();
	const char *ctype = ap_table_get(c->r->headers_in,"Content-Type");
	value boundstr;
	val_check_function(onpart,2);
	val_check_function(ondata,3);
	buf = alloc_empty_string(BUFSIZE);
	if( !ctype || strstr(ctype,"multipart/form-data") == NULL )
		return val_null;
	// extract boundary value
	{
		const char *boundary, *bend;
		if( (boundary = strstr(ctype,"boundary=")) == NULL )
			neko_error();
		boundary += 9;
		PARSE_HEADER(boundary,bend);
		len = (int)(bend - boundary);
		boundstr = alloc_empty_string(len+2);
		if( val_strlen(boundstr) > BUFSIZE / 2 )
			neko_error();
		val_string(boundstr)[0] = '-';
		val_string(boundstr)[1] = '-';
		memcpy(val_string(boundstr)+2,boundary,len);
	}
	len = 0;
    if( !ap_should_client_block(c->r) )
		neko_error();
	while( true ) {
		char *name, *end_name, *filename, *end_file_name, *data;
		int pos;
		// refill buffer
		// we assume here that the the whole multipart header can fit in the buffer
		fill_buffer(c,buf,&len);
		// is boundary at the beginning of buffer ?
		if( len < val_strlen(boundstr) || memcmp(val_string(buf),val_string(boundstr),val_strlen(boundstr)) != 0 )
			return discard_body(c);
		name = memfind(val_string(buf),len,"Content-Disposition:");
		if( name == NULL )
			break;
		name = memfind(name,len - (int)(name - val_string(buf)),"name=");
		if( name == NULL )
			return discard_body(c);
		name += 5;
		PARSE_HEADER(name,end_name);
		data = memfind(end_name,len - (int)(end_name - val_string(buf)),"\r\n\r\n");
		if( data == NULL )
			return discard_body(c);
		filename = memfind(name,(int)(data - name),"filename=");
		if( filename != NULL ) {
			filename += 9;
			PARSE_HEADER(filename,end_file_name);
		}
		data += 4;
		pos = (int)(data - val_string(buf));
		// send part name
		val_call2(onpart,copy_string(name,(int)(end_name - name)),filename?copy_string(filename,(int)(end_file_name - filename)):val_null);
		// read data
		while( true ) {
			const char *boundary;
			// recall buffer
			memmove(val_string(buf),val_string(buf)+pos,len - pos);
			len -= pos;
			pos = 0;
			fill_buffer(c,buf,&len);
			// lookup bounds
			boundary = memfind(val_string(buf),len,val_string(boundstr));
			if( boundary == NULL ) {
				if( len == 0 )
					return discard_body(c);
				// send as much buffer as possible to client
				if( len < BUFSIZE )
					pos = len;
				else
					pos = len - val_strlen(boundstr) + 1;
				val_call3(ondata,buf,alloc_int(0),alloc_int(pos));
			} else {
				// send remaining data
				pos = (int)(boundary - val_string(buf));
				val_call3(ondata,buf,alloc_int(0),alloc_int(pos-2));
				// recall
				memmove(val_string(buf),val_string(buf)+pos,len - pos);
				len -= pos;
				break;
			}
		}
	}
	return val_null;
}
Esempio n. 10
0
static void string()
{
	emit_constant(OBJ_VAL(copy_string(parser.previous.start + 1, parser.previous.length - 2)));
}
Esempio n. 11
0
bool
nsTextFragment::Append(const char16_t* aBuffer, uint32_t aLength, bool aUpdateBidi)
{
  // This is a common case because some callsites create a textnode
  // with a value by creating the node and then calling AppendData.
  if (mState.mLength == 0) {
    return SetTo(aBuffer, aLength, aUpdateBidi);
  }

  // Should we optimize for aData.Length() == 0?

  if (mState.mIs2b) {
    // Already a 2-byte string so the result will be too
    char16_t* buff = (char16_t*)realloc(m2b, (mState.mLength + aLength) * sizeof(char16_t));
    if (!buff) {
      return false;
    }

    memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(char16_t));
    mState.mLength += aLength;
    m2b = buff;

    if (aUpdateBidi) {
      UpdateBidiFlag(aBuffer, aLength);
    }

    return true;
  }

  // Current string is a 1-byte string, check if the new data fits in one byte too.
  int32_t first16bit = FirstNon8Bit(aBuffer, aBuffer + aLength);

  if (first16bit != -1) { // aBuffer contains no non-8bit character
    // The old data was 1-byte, but the new is not so we have to expand it
    // all to 2-byte
    char16_t* buff =
      (char16_t*)malloc((mState.mLength + aLength) * sizeof(char16_t));
    if (!buff) {
      return false;
    }

    // Copy data into buff
    LossyConvertEncoding8to16 converter(buff);
    copy_string(m1b, m1b+mState.mLength, converter);

    memcpy(buff + mState.mLength, aBuffer, aLength * sizeof(char16_t));
    mState.mLength += aLength;
    mState.mIs2b = true;

    if (mState.mInHeap) {
      free(m2b);
    }
    m2b = buff;

    mState.mInHeap = true;

    if (aUpdateBidi) {
      UpdateBidiFlag(aBuffer + first16bit, aLength - first16bit);
    }

    return true;
  }

  // The new and the old data is all 1-byte
  char* buff;
  if (mState.mInHeap) {
    buff = (char*)realloc(const_cast<char*>(m1b),
                          (mState.mLength + aLength) * sizeof(char));
    if (!buff) {
      return false;
    }
  }
  else {
    buff = (char*)malloc((mState.mLength + aLength) * sizeof(char));
    if (!buff) {
      return false;
    }

    memcpy(buff, m1b, mState.mLength);
    mState.mInHeap = true;
  }

  // Copy aBuffer into buff.
  LossyConvertEncoding16to8 converter(buff + mState.mLength);
  copy_string(aBuffer, aBuffer + aLength, converter);

  m1b = buff;
  mState.mLength += aLength;

  return true;
}
Esempio n. 12
0
/*
 * parse_args()
 *
 * In:      argc - number of command-line arguments.
 *          argv - string array containing command-line arguments.
 *
 * Returns: an index into argv where we stopped parsing arguments.
 *
 * Abstract: Parses command-line arguments.  In some cases, it will
 *           set the appropriate global variables and return.  Otherwise,
 *           it performs the appropriate action and exits.
 *
 * Assumptions: Currently, we check to make sure that there are no arguments
 *              other than the defined options, so the return value is
 *              pretty useless and should be ignored.
 */
int parse_args(int argc, char **argv)
{
    int c;
    int gotdomain = 0;

    progname = strrchr(argv[0], '/');
    if (!progname) progname = argv[0];

    while(1) {
#if defined(__GNU_LIBRARY__)
	c = getopt_long(argc, argv, short_options, long_options, 0);
#else
	c = getopt(argc, argv, short_options);
#endif
	if (c == -1) break;
	switch(c) {
	  case 'a': {
	      if (!inet_aton(optarg, &recv_addr.sin_addr)) {
		  log_msg(LOG_ERR, "%s: Bad ip address \"%s\"\n",
			  progname, optarg);
		  exit(-1);
	      }
	      break;
	  }
	  case 'c': {
#ifdef ENABLE_CACHE
	      copy_string(cache_param, optarg, sizeof(cache_param));
#endif
	      break;
	  }
	  case 'd': {
	      opt_debug++;
	      break;
	  }
	  case 'h': {
	      give_help();
	      exit(0);
	      break;
	  }
	  case 'k': {
	      if (!kill_current()) {
		  printf("No %s daemon found.  Exiting.\n", progname);
	      }
	      exit(0);
	      break;
	  }
	  case 'l': {
	      gotterminal = 0;
	      break;
	  }
	  case 'm': {
#ifdef ENABLE_CACHE
	      copy_string(master_param, optarg, sizeof(master_param));
#endif
	      break;
	  }
	  case 's': {
	      char *sep = strchr(optarg, (int)':');
	      if (serv_cnt >= MAX_SERV) {
		  log_msg(LOG_ERR, "%s: Max. %d DNS servers allowed\n",
			  progname, MAX_SERV);
		  exit(-1);
	      }
	      if (gotdomain == -1) {
		  log_msg(LOG_ERR, "%s: When giving server arguments with "
			  "domain names,\nonly the last one is permitted to "
			  "not have a domain name.\n", progname);
		  exit(-1);
	      }
	      if (sep) {
		  dns_srv[serv_cnt].domain = make_cname(sep + 1);
		  if (gotdomain == -1) {
		      log_msg(LOG_ERR, "%s: Server arguments with domain "
			      "names must appear before\n"
			      "those without domain names.\n", progname);
		      exit(-1);
		  }
		  gotdomain = 1;
		  *sep = 0;
	      }
	      else if (gotdomain != 0) {
		  gotdomain = -1;
	      }
	      if (!inet_aton(optarg, &dns_srv[serv_cnt].addr.sin_addr)) {
		  log_msg(LOG_ERR, "%s: Bad ip address \"%s\"\n",
			  progname, optarg);
		  exit(-1);
	      }
	      if (sep) *sep = ':';
	      serv_cnt++;
	      break;
	  }
	  case 'u': {
	      char *ep;
	      struct passwd *pwent;
	      daemonuid = (uid_t)strtoul(optarg, &ep, 10);

	      pwent = *ep ? getpwnam(optarg) : getpwuid(daemonuid);
	      if (!pwent) {
		  log_msg(LOG_ERR, "%s: Bad uid \"%s\"\n", progname, optarg);
		  exit(-1);
	      }

	      daemonuid = pwent->pw_uid;
	      daemongid = pwent->pw_gid;
	      break;
	  }
	  case 'v': {
	      printf("dnrd version %s\n\n", version);
	      exit(0);
	      break;
	  }
	  case ':': {
	      log_msg(LOG_ERR, "%s: Missing parameter for \"%s\"\n",
		      progname, argv[optind]);
	      exit(-1);
	      break;
	  }
	  case '?':
	  default: {
	      /* getopt_long will print "unrecognized option" for us */
	      give_help();
	      exit(-1);
	      break;
	  }
	}
    }

    if (optind != argc) {
	log_msg(LOG_ERR, "%s: Unknown parameter \"%s\"\n",
		progname, argv[optind]);
	exit(-1);
    }
    return optind;
}
Esempio n. 13
0
PREFIX value ml_string_of_ptr(value v_ptr)
{
        const char* ptr = (const char*) v_ptr;
        if(ptr == NULL) caml_failwith("string_of_ptr");
        return copy_string(ptr);
}
Esempio n. 14
0
Token* Scanner::read_name(fint c) {
  Token::TokenType t;
  fint l = line;
  fint col = column - 1;
  const char* ss = sourceAddr() - 1;
  fint len;
  if (c == ':') {
    t = Token::ARG;
    len = 0;
  } else {
    t = c == '_' ? Token::PRIMNAME : Token::NAME;
    len = 1;
    buffer[0] = char(c);
  }
  while (c = get_char(), is_id_char(c)) {
    buffer[len++] = char(c);
  }
  if (c == ':' && (t == Token::NAME || t == Token::PRIMNAME)) {
    buffer[len++] = char(c);
    if (is_upper((fint)*buffer)) t = Token::CAPKEYWORD;
    else
      t = c == '_' ? Token::PRIMKEYWORD : Token::KEYWORD;
  } 
  else {
    push_char(c);
  }
  buffer[len] = '\0';
  if (t == Token::ARG && len == 0) {
    t = as_TokenType(':');
  } else if (t == Token::NAME || t == Token::PRIMNAME) {
    c = get_char();
    if (c == '.') {
      c = get_char();
      push_char(c);
      if (is_id_alpha(c) || is_punct(c)) {
        t = Token::DELEGATE;
      } else {
        push_char('.');
      }
    } else {
      push_char(c);
    }
  }
  if (strcmp(buffer, "self") == 0) {
    if (t == Token::NAME) {
      t = Token::SELF_TOKEN;
    } else {
      return TokenizingError(
                             "using \"self\" as a parent name for a directed resend");
    }
  } else if (strcmp(buffer, "resend") == 0) {
    if (t == Token::DELEGATE) {
      t = Token::RESEND_TOKEN;
    } else {
      return TokenizingError("not using \"resend\" in a resend");
    }
  }
  String* s;
  if (t == Token::NAME    || t == Token::PRIMNAME    || t == Token::ARG || t == Token::DELEGATE ||
      t == Token::KEYWORD || t == Token::PRIMKEYWORD || t == Token::CAPKEYWORD) {
    s = new String(copy_string(buffer));
  } else {
    s = NULL;
  }
  return new Token(t, s, l, col, ss);
}
Esempio n. 15
0
void set_editor(GraceApp *gapp, const char *cmd)
{
    gapp->rt->gapp_editor = copy_string(gapp->rt->gapp_editor, cmd);
}
Esempio n. 16
0
int load_module(char *fname, char *dl_function, char *dl_key, int dl_type)
{
#if defined(HAVE_DL)

    int dlflag;
    void *handle;
    char *error;
    symtab_entry newkey;
    int retval;
    
    if ((dl_type < 0) || (dl_key == NULL) || (dl_function == NULL)) {
        errmsg("Improper call to load_module()");
	return RETURN_FAILURE;
    }
    
#if defined(HAVE_DLOPEN)
#  if defined(HAVE_RTLD_NOW)
    if (dl_load_fast == TRUE) {
        dlflag = RTLD_LAZY;
    } else {
        dlflag = RTLD_NOW;
    }
#  else
    dlflag = 1;
#  endif
    
    handle = (void *) dlopen (fname, dlflag);
    if (!handle) {
        errmsg ((char *) dlerror());
        return RETURN_FAILURE;
    }
    
    newkey.data = dlsym(handle, dl_function);
    if ((error = (char *) dlerror()) != NULL) {
        errmsg(error);
        dlclose(handle);
        return RETURN_FAILURE;
    }

#endif /* end dlopen interface */

#if defined(HAVE_SHL_LOAD)

    if (dl_load_fast == TRUE) {
        dlflag = BIND_DEFERRED;
    } else {
        dlflag = BIND_IMMEDIATE;
    }
    
    handle = (void *) shl_load (fname, dlflag, 0L);
    if (!handle) {
#if defined(HAVE_STRERROR)
        errmsg(strerror(errno));
#else
# if defined(HAVE_SYS_ERRLIST_DECL)
        errmsg(sys_errlist[errno]);
# else
        errmsg("DL module initialization failed");
# endif
#endif
        return RETURN_FAILURE;
    }
    
    if (shl_findsym(handle, dl_function, TYPE_UNDEFINED, &newkey.data) != NULL) {
#if defined(HAVE_STRERROR)
        errmsg(strerror(errno));
#else
# if defined(HAVE_SYS_ERRLIST_DECL)
        errmsg(sys_errlist[errno]);
# else
        errmsg("Error while resolving symbol");
# endif
#endif
        shl_unload(handle);
        return RETURN_FAILURE;
    }

#endif /* end shl_load interface */

    newkey.type = dl_type;
    newkey.s = copy_string(NULL, dl_key);
    
    retval = addto_symtab(newkey);
    xfree(newkey.s);
    return retval;

#else /* no support for DL */
    errmsg("No support for DL modules on your OS");
    return RETURN_FAILURE;
#endif
}
Esempio n. 17
0
void set_help_viewer(GraceApp *gapp, const char *dir)
{
    gapp->rt->help_viewer = copy_string(gapp->rt->help_viewer, dir);
}
Esempio n. 18
0
    /* Process the argument character and its associated value.
     * This function processes arguments from the command line and
     * from an argument file associated with the -A argument.
     *
     * An argument -ofile.pgn would be passed in as:
     *                'o' and "file.pgn".
     * A zero-length string for associated_value is not necessarily
     * an error, e.g. -e has an optional following filename.
     * NB: If the associated_value is to be used beyond this function,
     * it must be copied.
     */
void
process_argument(char arg_letter,const char *associated_value)
{   /* Provide an alias for associated_value because it will
     * often represent a file name.
     */
    const char *filename = skip_leading_spaces(associated_value);

    switch(arg_letter){
        case WRITE_TO_OUTPUT_FILE_ARGUMENT:
        case APPEND_TO_OUTPUT_FILE_ARGUMENT:
          if(GlobalState.ECO_level > 0){
              fprintf(GlobalState.logfile,"-%c conflicts with -E\n",
                      arg_letter);
          }
          else if(GlobalState.games_per_file > 0){
              fprintf(GlobalState.logfile,"-%c conflicts with -#\n",
                      arg_letter);
          }
          else if(GlobalState.output_filename != NULL){
              fprintf(GlobalState.logfile,
                      "-%c: File %s has already been selected for output.\n",
                      arg_letter,GlobalState.output_filename);
              exit(1);
          }
          else if(*filename == '\0'){
              fprintf(GlobalState.logfile,"Usage: -%cfilename.\n",arg_letter);
              exit(1);
          }
          else{
              if(GlobalState.outputfile != NULL){
                  (void) fclose(GlobalState.outputfile);
              }
              if(arg_letter == WRITE_TO_OUTPUT_FILE_ARGUMENT){
                  GlobalState.outputfile = must_open_file(filename,"w");
              }
              else{
                  GlobalState.outputfile = must_open_file(filename,"a");
              }
              GlobalState.output_filename = filename;
          }
          break;
        case WRITE_TO_LOG_FILE_ARGUMENT:
        case APPEND_TO_LOG_FILE_ARGUMENT:
          /* Take precautions against multiple log files. */
          if((GlobalState.logfile != stderr) && (GlobalState.logfile != NULL)){
                (void) fclose(GlobalState.logfile);
          }
          if(arg_letter == WRITE_TO_LOG_FILE_ARGUMENT){
                GlobalState.logfile = fopen(filename,"w");
          }
          else{
                GlobalState.logfile = fopen(filename,"a");
          }
          if(GlobalState.logfile == NULL){
                fprintf(stderr,"Unable to open %s for writing.\n",filename);
                GlobalState.logfile = stderr;
          }
          break;
        case DUPLICATES_FILE_ARGUMENT:
          if(*filename == '\0'){
              fprintf(GlobalState.logfile,"Usage: -%cfilename.\n",arg_letter);
              exit(1);
          }
          else if(GlobalState.suppress_duplicates){
              fprintf(GlobalState.logfile,
                      "-%c clashes with the -%c flag.\n",arg_letter,
                      DONT_KEEP_DUPLICATES_ARGUMENT);
              exit(1);
          }
          else{
              GlobalState.duplicate_file = must_open_file(filename,"w");
          }
          break;
        case USE_ECO_FILE_ARGUMENT:
          GlobalState.add_ECO = TRUE;
          if(*filename != '\0'){
              GlobalState.eco_file = copy_string(filename);
          }
          else if((filename = getenv("ECO_FILE")) != NULL){
              GlobalState.eco_file = filename;
          }
          else{
              /* Use the default which is already set up. */
          }
          initEcoTable();
          break;
        case ECO_OUTPUT_LEVEL_ARGUMENT:
          {   unsigned level;

              if(GlobalState.output_filename != NULL){
                  fprintf(GlobalState.logfile,
                          "-%c: File %s has already been selected for output.\n",
                          arg_letter,
                          GlobalState.output_filename);
                  exit(1);
              }
              else if(GlobalState.games_per_file > 0){
                  fprintf(GlobalState.logfile,
                            "-%c conflicts with -#.\n",
                            arg_letter);
                  exit(1);
              }
              else if(sscanf(associated_value,"%u",&level) != 1){
                    fprintf(GlobalState.logfile,
                            "-%c requires a number attached, e.g., -%c1.\n",
                            arg_letter,arg_letter);
                     exit(1);
              }
              else if((level < MIN_ECO_LEVEL) || (level > MAX_ECO_LEVEL)){
                    fprintf(GlobalState.logfile,
                            "-%c level should be between %u and %u.\n",
                            MIN_ECO_LEVEL,MAX_ECO_LEVEL,arg_letter);
                    exit(1);
              }
              else{
                    GlobalState.ECO_level = level;
              }
          }
          break;
        case CHECK_FILE_ARGUMENT:
          if(*filename != '\0'){
              /* See if it is a single PGN file, or a list
               * of files.
               */
              size_t len = strlen(filename);
              /* Check for a .PGN suffix. */
              const char *suffix = output_file_suffix(SAN);

              if((len > strlen(suffix)) &&
                    (stringcompare(&filename[len-strlen(suffix)],
                                            suffix) == 0)){
                  add_filename_to_source_list(filename,CHECKFILE);
              }
              else{
                  FILE *fp = must_open_file(filename,"r");
                  add_filename_list_from_file(fp,CHECKFILE);
                  (void) fclose(fp);
              }
          }
          break;
        case FILE_OF_FILES_ARGUMENT:
          if(*filename != '\0'){
              FILE *fp = must_open_file(filename,"r");
              add_filename_list_from_file(fp,NORMALFILE);
              (void) fclose(fp);
          }
          else{
              fprintf(GlobalState.logfile,"Filename expected with -%c\n",
                      arg_letter);
          }
          break;
        case BOUNDS_ARGUMENT:
          {
              /* Bounds on the number of moves are to be found.
               * "l#" means less-than-or-equal-to.
               * "g#" means greater-than-or-equal-to.
               * Otherwise "#" (or "e#") means that number.
               */
              /* Equal by default. */
              char which = 'e';
              unsigned value;
              Boolean Ok = TRUE;
              const char *bound = associated_value;

              switch(*bound){
                case 'l':
                case 'u':
                case 'e':
                  which = *bound;
                  bound++;
                  break;
                default:
                  if(!isdigit((int) *bound)){
                      fprintf(GlobalState.logfile,
                              "-%c must be followed by e, l, or u.\n",
                              arg_letter);
                      Ok = FALSE;
                  }
                  break;
              }
              if(Ok && (sscanf(bound,"%u",&value) == 1)){
                GlobalState.check_move_bounds = TRUE;
                switch(which){
                  case 'e':
                        GlobalState.lower_move_bound = value; 
                        GlobalState.upper_move_bound = value; 
                        break;
                  case 'l':
                    if(value <= GlobalState.upper_move_bound){
                        GlobalState.lower_move_bound = value; 
                    }
                    else{
                        fprintf(GlobalState.logfile,
                           "Lower bound is greater than the upper bound; -%c ignored.\n",
                           arg_letter);
                        Ok = FALSE;
                    }
                    break;
                  case 'u':
                    if(value >= GlobalState.lower_move_bound){
                        GlobalState.upper_move_bound = value; 
                    }
                    else{
                        fprintf(GlobalState.logfile,
                           "Upper bound is smaller than the lower bound; -%c ignored.\n",
                           arg_letter);
                        Ok = FALSE;
                    }
                    break;
                }
             }
             else{
               fprintf(GlobalState.logfile,
                       "-%c should be in the form -%c[elu]number.\n",
                       arg_letter,arg_letter);
               Ok = FALSE;
             }
             if(!Ok){
                exit(1);
             }
         }
         break;
        case GAMES_PER_FILE_ARGUMENT:
          if(GlobalState.ECO_level > 0){
              fprintf(GlobalState.logfile,
                      "-%c conflicts with -E.\n",arg_letter);
              exit(1);
          }
          else if(GlobalState.output_filename != NULL){
              fprintf(GlobalState.logfile,
                        "-%c: File %s has already been selected for output.\n",
                        arg_letter,
                        GlobalState.output_filename);
              exit(1);
          }
          else if(sscanf(associated_value,"%u",
                       &GlobalState.games_per_file) != 1){
            fprintf(GlobalState.logfile,
                    "-%c should be followed by an unsigned integer.\n",
                    arg_letter);
            exit(1);
          }
          else{
            /* Value set. */
          }
          break;
        case FILE_OF_ARGUMENTS_ARGUMENT:
          if(*filename != '\0'){
              /* @@@ Potentially recursive call. Is this safe? */
              read_args_file(filename);
          }
          else{
              fprintf(GlobalState.logfile,"Usage: -%cfilename.\n",
                      arg_letter);
          }
          break;
        case NON_MATCHING_GAMES_ARGUMENT:
          if(*filename != '\0'){
              if(GlobalState.non_matching_file != NULL){
                  (void) fclose(GlobalState.non_matching_file);
              }
              GlobalState.non_matching_file = must_open_file(filename,"w");
          }
          else{
              fprintf(GlobalState.logfile,"Usage: -%cfilename.\n",arg_letter);
              exit(1);
          }
          break;
        case TAG_EXTRACTION_ARGUMENT:
            /* A single tag extraction criterion. */
            extract_tag_argument(associated_value);
            break;
        case LINE_WIDTH_ARGUMENT:
            { /* Specify an output line width. */
              unsigned length;

              if(sscanf(associated_value,"%u",&length) > 0){
                  set_output_line_length(length);
              }
              else{
                  fprintf(GlobalState.logfile,
                          "-%c should be followed by an unsigned integer.\n",
                          arg_letter);
                  exit(1);
              }
            }
            break;
        case HELP_ARGUMENT:
            usage_and_exit();
            break;
        case OUTPUT_FORMAT_ARGUMENT:
            /* Whether to use the source form of moves or
             * rewrite them into another format.
             */
	    {
		OutputFormat format = which_output_format(associated_value);
		if(format == UCI) {
		    /* Rewrite the game in a format suitable for input to
		     * a UCI-compatible engine.
		     * This is actually LALG but involves adjusting a lot of
		     * the other statuses, too.
		     */
		    GlobalState.keep_NAGs = FALSE;
		    GlobalState.keep_comments = FALSE;
		    GlobalState.keep_move_numbers = FALSE;
		    GlobalState.keep_checks = FALSE;
		    GlobalState.keep_variations = FALSE;
		    set_output_line_length(5000);
		    format = LALG;
		}
		GlobalState.output_format = format;
	    }
            break;
        case SEVEN_TAG_ROSTER_ARGUMENT:
            if(GlobalState.tag_output_format == ALL_TAGS ||
               GlobalState.tag_output_format == SEVEN_TAG_ROSTER) {
                GlobalState.tag_output_format = SEVEN_TAG_ROSTER;
            }
            else {
                fprintf(GlobalState.logfile,
                        "-%c clashes with another argument.\n",
                        SEVEN_TAG_ROSTER_ARGUMENT);
                exit(1);
            }
            break;
        case DONT_KEEP_COMMENTS_ARGUMENT:
            GlobalState.keep_comments = FALSE;
            break;
        case DONT_KEEP_DUPLICATES_ARGUMENT:
            /* Make sure that this doesn't clash with -d. */
            if(GlobalState.duplicate_file == NULL){
                GlobalState.suppress_duplicates = TRUE;
            }
            else{
                fprintf(GlobalState.logfile,
                            "-%c clashes with -%c flag.\n",
                            DONT_KEEP_DUPLICATES_ARGUMENT,
                            DUPLICATES_FILE_ARGUMENT);
                exit(1);
            }
            break;
        case DONT_MATCH_PERMUTATIONS_ARGUMENT:
            GlobalState.match_permutations = FALSE;
            break;
        case DONT_KEEP_NAGS_ARGUMENT:
            GlobalState.keep_NAGs = FALSE;
            break;
        case OUTPUT_FEN_STRING_ARGUMENT:
            /* Output a FEN string of the final position.
             * This is displayed in a comment.
             */
	    if(GlobalState.add_FEN_comments) {
		/* Already implied. */
	        GlobalState.output_FEN_string = FALSE;
	    }
	    else {
		GlobalState.output_FEN_string = TRUE;
	    }
            break;
        case CHECK_ONLY_ARGUMENT:
            /* Report errors, but don't convert. */
            GlobalState.check_only = TRUE;
            break;
        case KEEP_SILENT_ARGUMENT:
            /* Turn off progress reporting. */
            GlobalState.verbose = FALSE;
            break;
        case USE_SOUNDEX_ARGUMENT:
            /* Use soundex matches for player tags. */
            GlobalState.use_soundex = TRUE;
            break;
        case MATCH_CHECKMATE_ARGUMENT:
            /* Match only games that end in checkmate. */
            GlobalState.match_only_checkmate = TRUE;
            break;
        case SUPPRESS_ORIGINALS_ARGUMENT:
            GlobalState.suppress_originals = TRUE;
            break;
        case DONT_KEEP_VARIATIONS_ARGUMENT:
            GlobalState.keep_variations = FALSE;
            break;
        case USE_VIRTUAL_HASH_TABLE_ARGUMENT:
            GlobalState.use_virtual_hash_table = TRUE;
            break;

        case TAGS_ARGUMENT:
            if(*filename != '\0'){
                read_tag_file(filename);
            }
            break;
        case TAG_ROSTER_ARGUMENT:
            if(*filename != '\0'){
                read_tag_roster_file(filename);
            }
            break;
        case MOVES_ARGUMENT:
            if(*filename != '\0'){
                /* Where the list of variations of interest are kept. */
                FILE *variation_file = must_open_file(filename,"r");
                /* We wish to search for particular variations. */
                add_textual_variations_from_file(variation_file);
                fclose(variation_file);
            }
            break;
        case POSITIONS_ARGUMENT:
            if(*filename != '\0'){
                FILE *variation_file = must_open_file(filename,"r");
                /* We wish to search for positional variations. */
                add_positional_variations_from_file(variation_file);
                fclose(variation_file);
            }
            break;
        case ENDINGS_ARGUMENT:
            if(*filename != '\0'){
                if(!build_endings(filename)){
                    exit(1);
                }
            }
            break;
        default:
            fprintf(GlobalState.logfile,
                    "Unrecognized argument -%c\n", arg_letter);
    }
}
Esempio n. 19
0
void
initializeBondTable(void)
{
  struct stat statBuf;
  char *home;
  char *rest;
  int len;
  int reloadSystemOverlay = 0;
  int reloadUserOverlay = 0;

  if (UseAMBER) {
    if (AmberNonbondedParametersFileName != NULL) {
      read_amber_itp_file(AmberNonbondedParametersFileName);
    }
    if (AmberBondedParametersFileName != NULL) {
      read_amber_itp_file(AmberBondedParametersFileName);
    }
  }
  if (bondStretchHashtable == NULL) {
    reloadSystemOverlay = 1;
    reloadUserOverlay = 1;
  }
  if (SystemParametersFileName != NULL) {
    if (systemBondTableOverlayFileName == NULL ||
        strcmp(systemBondTableOverlayFileName, SystemParametersFileName)) {
      if (systemBondTableOverlayFileName != NULL) {
        free(systemBondTableOverlayFileName);
      }
      systemBondTableOverlayFileName = copy_string(SystemParametersFileName);
      systemBondTableOverlayModificationTime = 0;
    }
    if (!stat(SystemParametersFileName, &statBuf)) {
      if (systemBondTableOverlayModificationTime < statBuf.st_mtime) {
        reloadSystemOverlay = 1;
        systemBondTableOverlayModificationTime = statBuf.st_mtime;
      }
    }      
  }
  
  if (userBondTableOverlayFileName == NULL) {
    home = getenv("HOME");
    if (home == NULL) {
      home = getenv("USERPROFILE"); // windows
    }
    if (home == NULL) {
      home = "";
    }
    rest = "/Nanorex/sim-params.txt";
    len = strlen(home) + strlen(rest) + 1;
    userBondTableOverlayFileName = (char *)allocate(len);
    strcpy(userBondTableOverlayFileName, home);
    strcat(userBondTableOverlayFileName, rest);
    UserParametersFileName = userBondTableOverlayFileName;
  }
  if (!stat(userBondTableOverlayFileName, &statBuf)) {
    if (userBondTableOverlayModificationTime < statBuf.st_mtime) {
      reloadUserOverlay = 1;
      userBondTableOverlayModificationTime = statBuf.st_mtime;
    }
  }
  if (reloadSystemOverlay || reloadUserOverlay) {
    initializeStaticBondTable();

    numStruts = 0;    
    LoadedSystemParameters =
      readBondTableOverlay(systemBondTableOverlayFileName);
    LoadedUserParameters =
      readBondTableOverlay(userBondTableOverlayFileName);
  }
}
Esempio n. 20
0
    /* The argument has been expressed in a long-form, i.e. prefixed
     * by --
     * Decode and act on the argument.
     * The associated_value will only be required by some arguments.
     * Return whether one or both were required.
     */
int
process_long_form_argument(const char *argument, const char *associated_value)
{
    if(stringcompare(argument, "addhashcode") == 0) {
        GlobalState.add_hashcode_tag = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "append") == 0) {
        process_argument(APPEND_TO_OUTPUT_FILE_ARGUMENT, associated_value);
        return 2;
    }
    else if(stringcompare(argument, "checkfile") == 0) {
        process_argument(CHECK_FILE_ARGUMENT, associated_value);
        return 2;
    }
    else if(stringcompare(argument, "checkmate") == 0) {
        process_argument(MATCH_CHECKMATE_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "duplicates") == 0) {
        process_argument(DUPLICATES_FILE_ARGUMENT, associated_value);
        return 2;
    }
    else if(stringcompare(argument, "evaluation") == 0) {
        /* Output an evaluation is required with each move. */
        GlobalState.output_evaluation = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "fencomments") == 0) {
        /* Output an evaluation is required with each move. */
        GlobalState.add_FEN_comments = TRUE;
	/* Turn off any separate setting of output_FEN_comment. */
	GlobalState.output_FEN_string = FALSE;
        return 1;
    }
    else if(stringcompare(argument, "fuzzydepth") == 0) {
        /* Extract the depth. */
        int depth = 0;

        if(sscanf(associated_value, "%d",&depth) == 1){
            if(depth >= 0) {
		GlobalState.fuzzy_match_duplicates = TRUE;
                GlobalState.fuzzy_match_depth = depth;
            }
            else {
                fprintf(GlobalState.logfile,
                        "--%s requires a number greater than or equal to zero.\n", argument);
                exit(1);
            }
        }
        else {
            fprintf(GlobalState.logfile,
                    "--%s requires a number following it.\n", argument);
            exit(1);
        }
        return 2;
    }
    else if(stringcompare(argument, "help") == 0) {
        process_argument(HELP_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "keepbroken") == 0) {
        GlobalState.keep_broken_games = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "linelength") == 0) {
        process_argument(LINE_WIDTH_ARGUMENT,
                         associated_value);
        return 2;
    }
    else if(stringcompare(argument, "markmatches") == 0) {
        if(*associated_value != '\0') {
	    GlobalState.add_position_match_comments = TRUE;
	    GlobalState.position_match_comment = copy_string(associated_value);
	}
	else {
              fprintf(GlobalState.logfile,
                        "--markmatches requires a comment string following it.\n");
              exit(1);
	}
	return 2;
    }
    else if(stringcompare(argument, "nochecks") == 0) {
        GlobalState.keep_checks = FALSE;
        return 1;
    }
    else if(stringcompare(argument, "nocomments") == 0) {
        process_argument(DONT_KEEP_COMMENTS_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "noduplicates") == 0) {
        process_argument(DONT_KEEP_DUPLICATES_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "nofauxep") == 0) {
        GlobalState.suppress_redundant_ep_info = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "nomovenumbers") == 0) {
        GlobalState.keep_move_numbers = FALSE;
        return 1;
    }
    else if(stringcompare(argument, "nonags") == 0) {
        process_argument(DONT_KEEP_NAGS_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "noresults") == 0) {
        GlobalState.keep_results = FALSE;
        return 1;
    }
    else if(stringcompare(argument, "notags") == 0) {
        if(GlobalState.tag_output_format == ALL_TAGS ||
           GlobalState.tag_output_format == NO_TAGS) {
            GlobalState.tag_output_format = NO_TAGS;
        }
        else {
            fprintf(GlobalState.logfile,
                    "--notags clashes with another argument.\n");
            exit(1);
        }
        return 1;
    }
    else if(stringcompare(argument, "nounique") == 0) {
        process_argument(SUPPRESS_ORIGINALS_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "novars") == 0) {
        process_argument(DONT_KEEP_VARIATIONS_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "selectonly") == 0) {
          unsigned long selection = 0;

          /* Extract the selected match number. */
          if(sscanf(associated_value, "%lu",&selection) == 1){
              if(selection > 0) {
                  GlobalState.matching_game_number = selection;
              }
              else {
                  fprintf(GlobalState.logfile,
                        "--%s requires a number greater than zero.\n", argument);
                  exit(1);
              }
          }
          else {
              fprintf(GlobalState.logfile,
                        "--%s requires a number greater than zero following it.\n", argument);
              exit(1);
          }
          return 2;
    }
    else if(stringcompare(argument, "output") == 0) {
        process_argument(WRITE_TO_OUTPUT_FILE_ARGUMENT, associated_value);
        return 2;
    }
    else if(stringcompare(argument, "plylimit") == 0) {
          int limit = 0;

          /* Extract the limit. */
          if(sscanf(associated_value, "%d",&limit) == 1){
              if(limit >= 0) {
                  GlobalState.output_ply_limit = limit;
              }
              else {
                  fprintf(GlobalState.logfile,
                        "--%s requires a number greater than or equal to zero.\n", argument);
                  exit(1);
              }
          }
          else {
              fprintf(GlobalState.logfile,
                        "--%s requires a number following it.\n", argument);
              exit(1);
          }
          return 2;
    }
    else if(stringcompare(argument, "seven") == 0) {
        process_argument(SEVEN_TAG_ROSTER_ARGUMENT, "");
        return 1;
    }
    else if(stringcompare(argument, "stalemate") == 0) {
        GlobalState.match_only_stalemate = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "totalplycount") == 0) {
        GlobalState.output_total_plycount = TRUE;
        return 1;
    }
    else if(stringcompare(argument, "version") == 0) {
        fprintf(GlobalState.logfile, "pgn-extract %s\n", CURRENT_VERSION);
	exit(0);
        return 1;
    }
    else {
        fprintf(GlobalState.logfile,
                "Unrecognised long-form argument: --%s\n",
                argument);
        exit(1);
        return 1;
    }
}
/* TargetData.t -> string */
CAMLprim value llvm_targetdata_as_string(LLVMTargetDataRef TD) {
    char *StringRep = LLVMCopyStringRepOfTargetData(TD);
    value Copy = copy_string(StringRep);
    LLVMDisposeMessage(StringRep);
    return Copy;
}
Esempio n. 22
0
/**
	$scopy : string -> string
	<doc>Make a copy of a string</doc>
**/
static value builtin_scopy( value s ) {
	val_check(s,string);
	return copy_string( val_string(s), val_strlen(s) );
}
Esempio n. 23
0
/*
 * we'll be initialising values, 
 * assigning ids to all identities
 * and allocating memory to these.
 * */
void initializeAllValues(int debugId)
{
	int i=0, j=0;
	int ID;
	ID = GetId();
	cc_id = (ID - 13) / 16 ;

	cc_number = cc_id;



	copy_string(mtCb.queue[CC_QUEUE][cc_number].name, 20,"QQ", 2, 1, cc_number);
	copy_string(mtCb.cc[cc_number].name, 20,"CC", 2, -1, cc_number);

	mtCb.cc[cc_number].money.name[0] = 'M';
	mtCb.cc[cc_number].money.name[1] = 'C';
	mtCb.cc[cc_number].money.name[2] = 'C';
	mtCb.cc[cc_number].money.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].money.name[4] = '\0';
	mtCb.cc[cc_number].state.name[0] = 'S';
	mtCb.cc[cc_number].state.name[1] = 'C';
	mtCb.cc[cc_number].state.name[2] = 'C';
	mtCb.cc[cc_number].state.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].state.name[4] = '\0';
	mtCb.cc[cc_number].currentCustId.name[0] = 'C';
	mtCb.cc[cc_number].currentCustId.name[1] = 'C';
	mtCb.cc[cc_number].currentCustId.name[2] = 'U';
	mtCb.cc[cc_number].currentCustId.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].currentCustId.name[4] = 'C';
	mtCb.cc[cc_number].currentCustId.name[5] = '\0';
	mtCb.cc[cc_number].currentCustGrpId.name[0] = 'C';
	mtCb.cc[cc_number].currentCustGrpId.name[1] = 'C';
	mtCb.cc[cc_number].currentCustGrpId.name[2] = 'G';
	mtCb.cc[cc_number].currentCustGrpId.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].currentCustGrpId.name[4] = 'C';
	mtCb.cc[cc_number].currentCustGrpId.name[5] = '\0';
	mtCb.cc[cc_number].msgFromCust.name[0] = 'M';
	mtCb.cc[cc_number].msgFromCust.name[1] = 'C';
	mtCb.cc[cc_number].msgFromCust.name[2] = 'U';
	mtCb.cc[cc_number].msgFromCust.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].msgFromCust.name[4] = 'C';
	mtCb.cc[cc_number].msgFromCust.name[5] = '\0';
	mtCb.cc[cc_number].msgBuffer.name[0] = 'M';
	mtCb.cc[cc_number].msgBuffer.name[1] = 'B';
	mtCb.cc[cc_number].msgBuffer.name[2] = '0' + cc_number;
	mtCb.cc[cc_number].msgBuffer.name[3] = 'C';
	mtCb.cc[cc_number].msgBuffer.name[4] = '\0';
	mtCb.cc[cc_number].msgByMan.name[0] = 'M';
	mtCb.cc[cc_number].msgByMan.name[1] = 'B';
	mtCb.cc[cc_number].msgByMan.name[2] = 'M';
	mtCb.cc[cc_number].msgByMan.name[3] = '0' + cc_number;
	mtCb.cc[cc_number].msgByMan.name[4] = 'C';
	mtCb.cc[cc_number].msgByMan.name[5] = '\0';
	createMv(&mtCb.cc[cc_number].state);
	createMv(&mtCb.cc[cc_number].money);
	createMv(&mtCb.cc[cc_number].currentCustId);
	createMv(&mtCb.cc[cc_number].currentCustGrpId);
	createMv(&mtCb.cc[cc_number].msgFromCust);
	createMv(&mtCb.cc[cc_number].msgByMan);
	createMv(&mtCb.cc[cc_number].msgBuffer);

	setMv(&mtCb.cc[cc_number].msgByMan, INVALID_MSG);
	setMv(&mtCb.cc[cc_number].money, 0);
	setMv(&mtCb.cc[cc_number].msgByMan, INVALID_MSG);
	setMv(&mtCb.cc[cc_number].currentCustId, -1);
	setMv(&mtCb.cc[cc_number].currentCustGrpId, -1);
	setMv(&mtCb.cc[cc_number].msgFromCust, INVALID_MSG);
	setMv(&mtCb.cc[cc_number].msgBuffer, INVALID_MSG);

	num_cust.name[0]='C';
	num_cust.name[1]='U';
	num_cust.name[2]='\0';

	mtCb.numCustGrp= cc_id * 2;	
	i = ( cc_id * 2 )+1;
	while( mtCb.numCustGrp <= i)
	{
			
		mtCb.custGrp[mtCb.numCustGrp].grpId = mtCb.numCustGrp;
		mtCb.custGrp[mtCb.numCustGrp].numCust = 5; 
		copy_string(mtCb.custGrp[mtCb.numCustGrp].name, 20,"CG", 2, -1, mtCb.numCustGrp);
		mtCb.custGrp[mtCb.numCustGrp].location.name[0] = 'L';
		mtCb.custGrp[mtCb.numCustGrp].location.name[1] = 'C';
		mtCb.custGrp[mtCb.numCustGrp].location.name[2] = 'G';
		mtCb.custGrp[mtCb.numCustGrp].location.name[3] = '0' + mtCb.custGrp[mtCb.numCustGrp].grpId;
		mtCb.custGrp[mtCb.numCustGrp].location.name[4] = '\0';
		createMv(&mtCb.custGrp[mtCb.numCustGrp].location);
		setMv(&mtCb.custGrp[mtCb.numCustGrp].location, START);
		mtCb.custGrp[mtCb.numCustGrp].state.name[0] = 'S';
		mtCb.custGrp[mtCb.numCustGrp].state.name[1] = 'C';
		mtCb.custGrp[mtCb.numCustGrp].state.name[2] = 'G';
		mtCb.custGrp[mtCb.numCustGrp].state.name[3] = '0' + mtCb.custGrp[mtCb.numCustGrp].grpId;
		mtCb.custGrp[mtCb.numCustGrp].state.name[4] = '\0';
		createMv(&mtCb.custGrp[mtCb.numCustGrp].state);


		j=0;
		{
			mtCb.custGrp[mtCb.numCustGrp].cust[j].selfId = j;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].grpId = mtCb.numCustGrp;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].money = CUST_MONEY;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].IAMTicketBuyer = 0;
			copy_string(mtCb.custGrp[mtCb.numCustGrp].cust[j].name, 20,"CU", 2, mtCb.numCustGrp, j);
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[0] = 'S';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[1] = 'C';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[2] = 'U';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[3] = '0' + j;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[4] = '0' + mtCb.numCustGrp;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].state.name[5] = '\0';
			createMv(&mtCb.custGrp[mtCb.numCustGrp].cust[j].state);

			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[0] = 'L';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[1] = 'C';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[2] = 'U';
			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[3] = '0' + j;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[4] = '0' + mtCb.numCustGrp;
			mtCb.custGrp[mtCb.numCustGrp].cust[j].location.name[5] = '\0';
			createMv(&mtCb.custGrp[mtCb.numCustGrp].cust[j].location);

		}
		mtCb.custGrp[mtCb.numCustGrp].cust[0].IAMTicketBuyer = 1;
		mtCb.numCustGrp++;
	}
}
Esempio n. 24
0
void create_filesystem_impl(unsigned char * out_file){
	unsigned char * root_dir;
	struct unsigned_char_ptr_to_unsigned_char_ptr_map files;
	struct unsigned_char_ptr_to_unsigned_char_ptr_map directories;
	struct unsigned_char_ptr_list directory_keys;
	struct unsigned_char_list tmp;
	struct memory_pool_collection mpc;

	const char * filesystem_files[NUM_FILES][2] = {
		{"./data-structures/void_ptr_compare.h", "/./data-structures/void_ptr_compare.h"},
		{"./data-structures/void_ptr_memory_pool.h", "/./data-structures/void_ptr_memory_pool.h"},
		{"./data-structures/generic.h.memory_pool", "/./data-structures/generic.h.memory_pool"},
		{"./data-structures/void_ptr_to_unsigned_int_map.h", "/./data-structures/void_ptr_to_unsigned_int_map.h"},
		{"./data-structures/generic.h.binary_search", "/./data-structures/generic.h.binary_search"},
		{"./data-structures/struct_constant_description_ptr_list.h", "/./data-structures/struct_constant_description_ptr_list.h"},
		{"./data-structures/struct_type_description_memory_pool.h", "/./data-structures/struct_type_description_memory_pool.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_unsigned_char_ptr_map.h"},
		{"./data-structures/struct_normalized_declarator_ptr_list.h", "/./data-structures/struct_normalized_declarator_ptr_list.h"},
		{"./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"},
		{"./data-structures/struct_macro_definition_ptr_list.h", "/./data-structures/struct_macro_definition_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_namespace_object_ptr_list.h", "/./data-structures/struct_namespace_object_ptr_list.h"},
		{"./data-structures/generic.h.list", "/./data-structures/generic.h.list"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/generic.h.map", "/./data-structures/generic.h.map"},
		{"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_macro_parameter_ptr_list.h", "/./data-structures/struct_macro_parameter_ptr_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/generic.h.merge_sort", "/./data-structures/generic.h.merge_sort"},
		{"./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"},
		{"./data-structures/struct_constant_initializer_level_ptr_list.h", "/./data-structures/struct_constant_initializer_level_ptr_list.h"},
		{"./data-structures/struct_normalized_declaration_element_ptr_list.h", "/./data-structures/struct_normalized_declaration_element_ptr_list.h"},
		{"./data-structures/unsigned_int_list.h", "/./data-structures/unsigned_int_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/replace_tool.h", "/./data-structures/replace_tool.h"},
		{"./data-structures/struct_preprocessor_file_context_ptr_list.h", "/./data-structures/struct_preprocessor_file_context_ptr_list.h"},
		{"./data-structures/struct_switch_frame_ptr_list.h", "/./data-structures/struct_switch_frame_ptr_list.h"},
		{"./data-structures/unsigned_int_binary_search.h", "/./data-structures/unsigned_int_binary_search.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_binary_search.h"},
		{"./data-structures/struct_asm_lexer_token_ptr_list.h", "/./data-structures/struct_asm_lexer_token_ptr_list.h"},
		{"./data-structures/binary_exponential_buffer.h", "/./data-structures/binary_exponential_buffer.h"},
		{"./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h", "/./data-structures/struct_void_ptr_to_unsigned_int_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_linker_symbol_ptr_list.h", "/./data-structures/struct_linker_symbol_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"},
		{"./data-structures/struct_type_traversal_ptr_list.h", "/./data-structures/struct_type_traversal_ptr_list.h"},
		{"./data-structures/char_list.h", "/./data-structures/char_list.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_scope_level_ptr_list.h", "/./data-structures/struct_scope_level_ptr_list.h"},
		{"./data-structures/struct_asm_instruction_ptr_list.h", "/./data-structures/struct_asm_instruction_ptr_list.h"},
		{"./data-structures/struct_c_lexer_state_ptr_list.h", "/./data-structures/struct_c_lexer_state_ptr_list.h"},
		{"./data-structures/struct_unsigned_char_list_ptr_list.h", "/./data-structures/struct_unsigned_char_list_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_asm_lexer_state_ptr_list.h", "/./data-structures/struct_asm_lexer_state_ptr_list.h"},
		{"./data-structures/unsigned_int_merge_sort.h", "/./data-structures/unsigned_int_merge_sort.h"},
		{"./data-structures/struct_c_lexer_token_memory_pool.h", "/./data-structures/struct_c_lexer_token_memory_pool.h"},
		{"./data-structures/unsigned_char_ptr_list.h", "/./data-structures/unsigned_char_ptr_list.h"},
		{"./data-structures/struct_parser_node_memory_pool.h", "/./data-structures/struct_parser_node_memory_pool.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"},
		{"./data-structures/struct_preloader_instruction_list.h", "/./data-structures/struct_preloader_instruction_list.h"},
		{"./data-structures/struct_normalized_specifier_ptr_list.h", "/./data-structures/struct_normalized_specifier_ptr_list.h"},
		{"./data-structures/struct_linker_symbol_memory_pool.h", "/./data-structures/struct_linker_symbol_memory_pool.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/unsigned_char_list.h", "/./data-structures/unsigned_char_list.h"},
		{"./data-structures/struct_asm_lexer_token_memory_pool.h", "/./data-structures/struct_asm_lexer_token_memory_pool.h"},
		{"./data-structures/struct_linker_object_ptr_merge_sort.h", "/./data-structures/struct_linker_object_ptr_merge_sort.h"},
		{"./data-structures/struct_special_macro_definition_ptr_list.h", "/./data-structures/struct_special_macro_definition_ptr_list.h"},
		{"./data-structures/struct_parser_operation_stack.h", "/./data-structures/struct_parser_operation_stack.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h", "/./data-structures/struct_struct_c_lexer_token_ptr_list_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_compare.h", "/./data-structures/unsigned_char_ptr_compare.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair_merge_sort.h"},
		{"./data-structures/struct_linker_object_ptr_list.h", "/./data-structures/struct_linker_object_ptr_list.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_c_lexer_token_ptr_list.h", "/./data-structures/struct_c_lexer_token_ptr_list.h"},
		{"./data-structures/unsigned_int_stack.h", "/./data-structures/unsigned_int_stack.h"},
		{"./data-structures/char_ptr_list.h", "/./data-structures/char_ptr_list.h"},
		{"./data-structures/generic.h.stack", "/./data-structures/generic.h.stack"},
		{"./data-structures/void_ptr_list.h", "/./data-structures/void_ptr_list.h"},
		{"./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_c_lexer_token_ptr_compare.h", "/./data-structures/struct_c_lexer_token_ptr_compare.h"},
		{"./data-structures/struct_preprocessor_if_branch_ptr_list.h", "/./data-structures/struct_preprocessor_if_branch_ptr_list.h"},
		{"./data-structures/struct_asm_instruction_memory_pool.h", "/./data-structures/struct_asm_instruction_memory_pool.h"},
		{"./data-structures/unsigned_int_ptr_list.h", "/./data-structures/unsigned_int_ptr_list.h"},
		{"./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h", "/./data-structures/struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_type_description_ptr_list.h", "/./data-structures/struct_type_description_ptr_list.h"},
		{"./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h", "/./data-structures/unsigned_char_ptr_to_struct_constant_description_ptr_map.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_binary_search.h"},
		{"./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h", "/./data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair_merge_sort.h"},
		{"./parser.h", "/./parser.h"},
		{"./linker.h", "/./linker.h"},
		{"./filesystem/filesystem_compiler.h", "/./filesystem/filesystem_compiler.h"},
		{"./heap_memory_pool.h", "/./heap_memory_pool.h"},
		{"./io.h", "/./io.h"},
		{"./kernel/private_kernel_interface.h", "/./kernel/private_kernel_interface.h"},
		{"./kernel/user_proc.h", "/./kernel/user_proc.h"},
		{"./kernel/public_kernel_interface.h", "/./kernel/public_kernel_interface.h"},
		{"./kernel/kernel_state.h", "/./kernel/kernel_state.h"},
		{"./kernel/core_data_types.h", "/./kernel/core_data_types.h"},
		{"./kernel/queue.h", "/./kernel/queue.h"},
		{"./core_data_types.h", "/./core_data_types.h"},
		{"./libc/size_t.h", "/./libc/size_t.h"},
		{"./libc/common.h", "/./libc/common.h"},
		{"./libc/putchar.h", "/./libc/putchar.h"},
		{"./libc/stdio.h", "/./libc/stdio.h"},
		{"./libc/unistd.h", "/./libc/unistd.h"},
		{"./libc/string.h", "/./libc/string.h"},
		{"./libc/stdarg.h", "/./libc/stdarg.h"},
		{"./libc/stdlib.h", "/./libc/stdlib.h"},
		{"./libc/assert.h", "/./libc/assert.h"},
		{"./libc/filesystem.h", "/./libc/filesystem.h"},
		{"./lexer.h", "/./lexer.h"},
		{"./preloader.h", "/./preloader.h"},
		{"./memory_pool_collection.h", "/./memory_pool_collection.h"},
		{"./emulators/javascript/index.html", "/./emulators/javascript/index.html"},
		{"./emulators/c/op-cpu.h", "/./emulators/c/op-cpu.h"},
		{"./builtin/includetest2.h", "/./builtin/includetest2.h"},
		{"./builtin/includetest1.h", "/./builtin/includetest1.h"},
		{"./preprocessor.h", "/./preprocessor.h"},
		{"./code_generator.h", "/./code_generator.h"},
		{"code_generator.c", "/code_generator.c"},
		{"io.c", "/io.c"},
		{"lexer.c", "/lexer.c"},
		{"linker.c", "/linker.c"},
		{"parser.c", "/parser.c"},
		{"preloader.c", "/preloader.c"},
		{"preprocessor.c", "/preprocessor.c"},
		{"test/c89/basic-operations.c", "/test/c89/basic-operations.c"},
		{"test/c89/basic-putchar-aa.c", "/test/c89/basic-putchar-aa.c"},
		{"test/c89/basic-putchar-a.c", "/test/c89/basic-putchar-a.c"},
		{"test/c89/basic-putchar-b.c", "/test/c89/basic-putchar-b.c"},
		{"test/c89/constants.c", "/test/c89/constants.c"},
		{"test/c89/empty-main-return-zero.c", "/test/c89/empty-main-return-zero.c"},
		{"test/c89/exotic-declarators.c", "/test/c89/exotic-declarators.c"},
		{"test/c89/filesystem.c", "/test/c89/filesystem.c"},
		{"test/c89/for-loop.c", "/test/c89/for-loop.c"},
		{"test/c89/ignore-local.c", "/test/c89/ignore-local.c"},
		{"test/c89/main_with_parameters.c", "/test/c89/main_with_parameters.c"},
		{"test/c89/malloc-test.c", "/test/c89/malloc-test.c"},
		{"test/c89/many-types.c", "/test/c89/many-types.c"},
		{"test/c89/nested-putchar-a.c", "/test/c89/nested-putchar-a.c"},
		{"test/c89/nested-putchar-a-param-ignored.c", "/test/c89/nested-putchar-a-param-ignored.c"},
		{"test/c89/nested-putchar-a-param-used.c", "/test/c89/nested-putchar-a-param-used.c"},
		{"test/c89/preprocessor_test.c", "/test/c89/preprocessor_test.c"},
		{"test/c89/print.c", "/test/c89/print.c"},
		{"test/c89/putchar-return.c", "/test/c89/putchar-return.c"},
		{"test/c89/string-literal.c", "/test/c89/string-literal.c"},
		{"test/c89/typedef.c", "/test/c89/typedef.c"},
		{"test/c89/use-array.c", "/test/c89/use-array.c"},
		{"test/c89/use-local.c", "/test/c89/use-local.c"},
		{"test/c89/use-reference.c", "/test/c89/use-reference.c"},
		{"test/c89/va_list_call.c", "/test/c89/va_list_call.c"},
		{"test/c89/while-loop.c", "/test/c89/while-loop.c"},
		{"libc/assert.c", "/libc/assert.c"},
		{"libc/filesystem.c", "/libc/filesystem.c"},
		{"libc/fopen.c", "/libc/fopen.c"},
		{"libc/getcwd.c", "/libc/getcwd.c"},
		{"libc/Makefile", "/libc/Makefile"},
		{"libc/malloc.c", "/libc/malloc.c"},
		{"libc/printf.c", "/libc/printf.c"},
		{"libc/l2/putchar.l2", "/libc/l2/putchar.l2"},
		{"libc/string.c", "/libc/string.c"},
		{"kernel/filesystem.c", "/kernel/filesystem.c"},
		{"kernel/kernel_impl.c", "/kernel/kernel_impl.c"},
		{"kernel/kernel_state.c", "/kernel/kernel_state.c"},
		{"kernel/main.c", "/kernel/main.c"},
		{"kernel/putchar.c", "/kernel/putchar.c"},
		{"kernel/queue.c", "/kernel/queue.c"},
		{"kernel/user_proc.c", "/kernel/user_proc.c"},
		{"filesystem/filesystem_compiler.c", "/filesystem/filesystem_compiler.c"},
		{"types/struct_l0_build_info.h","/types/struct_l0_build_info.h"},
		{"types/data-structures/struct_struct_linker_symbol_ptr_list.h","/types/data-structures/struct_struct_linker_symbol_ptr_list.h"},
		{"types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h","/types/data-structures/struct_struct_preprocessor_macro_level_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_list.h","/types/data-structures/struct_void_ptr_list.h"},
		{"types/data-structures/struct_struct_constant_description_ptr_list.h","/types/data-structures/struct_struct_constant_description_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_parameter_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_int_ptr_list.h","/types/data-structures/struct_unsigned_int_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_constant_description_ptr_map.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_list.h","/types/data-structures/struct_struct_c_lexer_token_ptr_list.h"},
		{"types/data-structures/unsigned_int.h","/types/data-structures/unsigned_int.h"},
		{"types/data-structures/struct_struct_namespace_object_ptr_list.h","/types/data-structures/struct_struct_namespace_object_ptr_list.h"},
		{"types/data-structures/struct_struct_asm_instruction_ptr_list.h","/types/data-structures/struct_struct_asm_instruction_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_state_ptr_list.h","/types/data-structures/struct_struct_c_lexer_state_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h","/types/data-structures/struct_struct_normalized_declaration_element_ptr_list.h"},
		{"types/data-structures/struct_char_list.h","/types/data-structures/struct_char_list.h"},
		{"types/data-structures/struct_struct_macro_definition_ptr_list.h","/types/data-structures/struct_struct_macro_definition_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_symbol_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_asm_lexer_state_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_state_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_map.h"},
		{"types/data-structures/struct_char_ptr_list.h","/types/data-structures/struct_char_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_unsigned_char_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_normalized_declarator_ptr_list.h","/types/data-structures/struct_struct_normalized_declarator_ptr_list.h"},
		{"types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h","/types/data-structures/struct_struct_struct_c_lexer_token_ptr_list_ptr_list.h"},
		{"types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h","/types/data-structures/struct_struct_preprocessor_if_branch_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_linker_object_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_scope_level_ptr_list.h","/types/data-structures/struct_struct_scope_level_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h","/types/data-structures/struct_void_ptr_to_unsigned_int_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_map.h"},
		{"types/data-structures/struct_unsigned_char_list.h","/types/data-structures/struct_unsigned_char_list.h"},
		{"types/data-structures/struct_struct_unsigned_char_list_ptr_list.h","/types/data-structures/struct_struct_unsigned_char_list_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_list.h","/types/data-structures/struct_unsigned_char_ptr_list.h"},
		{"types/data-structures/struct_struct_build_target_ptr_list.h","/types/data-structures/struct_struct_build_target_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_struct_c_lexer_token_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_special_macro_definition_ptr_list.h","/types/data-structures/struct_struct_special_macro_definition_ptr_list.h"},
		{"types/data-structures/struct_struct_macro_parameter_ptr_list.h","/types/data-structures/struct_struct_macro_parameter_ptr_list.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_key_value_pair.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_build_target_ptr_map.h"},
		{"types/data-structures/struct_unsigned_int_list.h","/types/data-structures/struct_unsigned_int_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_special_macro_definition_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_linker_object_ptr_list.h","/types/data-structures/struct_struct_linker_object_ptr_list.h"},
		{"types/data-structures/struct_linker_object_ptr.h","/types/data-structures/struct_linker_object_ptr.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_macro_definition_ptr_map.h"},
		{"types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h","/types/data-structures/struct_struct_c_lexer_token_ptr_to_unsigned_char_ptr_map.h"},
		{"types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h","/types/data-structures/struct_struct_preprocessor_file_context_ptr_list.h"},
		{"types/data-structures/struct_struct_type_traversal_ptr_list.h","/types/data-structures/struct_struct_type_traversal_ptr_list.h"},
		{"types/data-structures/struct_void_ptr_to_unsigned_int_map.h","/types/data-structures/struct_void_ptr_to_unsigned_int_map.h"},
		{"types/data-structures/struct_struct_type_description_ptr_list.h","/types/data-structures/struct_struct_type_description_ptr_list.h"},
		{"types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h","/types/data-structures/struct_unsigned_char_ptr_to_struct_namespace_object_ptr_key_value_pair.h"},
		{"types/data-structures/struct_struct_constant_initializer_level_ptr_list.h","/types/data-structures/struct_struct_constant_initializer_level_ptr_list.h"},
		{"types/data-structures/struct_struct_preloader_instruction_list.h","/types/data-structures/struct_struct_preloader_instruction_list.h"},
		{"types/data-structures/struct_struct_normalized_specifier_ptr_list.h","/types/data-structures/struct_struct_normalized_specifier_ptr_list.h"},
		{"types/data-structures/struct_struct_switch_frame_ptr_list.h","/types/data-structures/struct_struct_switch_frame_ptr_list.h"},
		{"types/data-structures/struct_struct_asm_lexer_token_ptr_list.h","/types/data-structures/struct_struct_asm_lexer_token_ptr_list.h"},
		{"types/lexer/struct_common_lexer_state.h","/types/lexer/struct_common_lexer_state.h"},
		{"types/lexer/struct_asm_lexer_token.h","/types/lexer/struct_asm_lexer_token.h"},
		{"types/lexer/enum_c_token_type.h","/types/lexer/enum_c_token_type.h"},
		{"types/lexer/enum_asm_token_type.h","/types/lexer/enum_asm_token_type.h"},
		{"types/lexer/struct_c_lexer_token.h","/types/lexer/struct_c_lexer_token.h"},
		{"types/lexer/struct_c_lexer_state.h","/types/lexer/struct_c_lexer_state.h"},
		{"types/lexer/struct_asm_lexer_state.h","/types/lexer/struct_asm_lexer_state.h"},
		{"types/struct_heap_memory_pool.h","/types/struct_heap_memory_pool.h"},
		{"types/preprocessor/struct_macro_definition.h","/types/preprocessor/struct_macro_definition.h"},
		{"types/preprocessor/struct_preprocessor_file_context.h","/types/preprocessor/struct_preprocessor_file_context.h"},
		{"types/preprocessor/struct_preprocessor_macro_level.h","/types/preprocessor/struct_preprocessor_macro_level.h"},
		{"types/preprocessor/enum_macro_definition_type.h","/types/preprocessor/enum_macro_definition_type.h"},
		{"types/preprocessor/struct_preprocessor_if_branch.h","/types/preprocessor/struct_preprocessor_if_branch.h"},
		{"types/preprocessor/struct_special_macro_definition.h","/types/preprocessor/struct_special_macro_definition.h"},
		{"types/preprocessor/struct_preprocessor_state.h","/types/preprocessor/struct_preprocessor_state.h"},
		{"types/preprocessor/struct_macro_parameter.h","/types/preprocessor/struct_macro_parameter.h"},
		{"types/preprocessor/enum_special_macro_type.h","/types/preprocessor/enum_special_macro_type.h"},
		{"types/code_generator/struct_switch_frame.h","/types/code_generator/struct_switch_frame.h"},
		{"types/code_generator/struct_compile_time_constant.h","/types/code_generator/struct_compile_time_constant.h"},
		{"types/code_generator/struct_constant_initializer_level.h","/types/code_generator/struct_constant_initializer_level.h"},
		{"types/code_generator/struct_type_traversal.h","/types/code_generator/struct_type_traversal.h"},
		{"types/code_generator/enum_copy_method.h","/types/code_generator/enum_copy_method.h"},
		{"types/code_generator/struct_code_gen_state.h","/types/code_generator/struct_code_gen_state.h"},
		{"types/linker/struct_asm_instruction.h","/types/linker/struct_asm_instruction.h"},
		{"types/linker/struct_linker_object.h","/types/linker/struct_linker_object.h"},
		{"types/linker/struct_linker_symbol.h","/types/linker/struct_linker_symbol.h"},
		{"types/enum_build_target_type.h","/types/enum_build_target_type.h"},
		{"types/parser/enum_normalized_declarator_type.h","/types/parser/enum_normalized_declarator_type.h"},
		{"types/parser/enum_add_or_remove.h","/types/parser/enum_add_or_remove.h"},
		{"types/parser/struct_scope_level.h","/types/parser/struct_scope_level.h"},
		{"types/parser/enum_normalized_specifier_type.h","/types/parser/enum_normalized_specifier_type.h"},
		{"types/parser/enum_object_location.h","/types/parser/enum_object_location.h"},
		{"types/parser/struct_normalized_declaration_element.h","/types/parser/struct_normalized_declaration_element.h"},
		{"types/parser/struct_namespace_object.h","/types/parser/struct_namespace_object.h"},
		{"types/parser/struct_first_and_last_namespace_object.h","/types/parser/struct_first_and_last_namespace_object.h"},
		{"types/parser/struct_constant_description.h","/types/parser/struct_constant_description.h"},
		{"types/parser/struct_current_function_change.h","/types/parser/struct_current_function_change.h"},
		{"types/parser/struct_normalized_declarator.h","/types/parser/struct_normalized_declarator.h"},
		{"types/parser/enum_node_type.h","/types/parser/enum_node_type.h"},
		{"types/parser/struct_type_description.h","/types/parser/struct_type_description.h"},
		{"types/parser/struct_namespace_object_change.h","/types/parser/struct_namespace_object_change.h"},
		{"types/parser/struct_namespace_modification.h","/types/parser/struct_namespace_modification.h"},
		{"types/parser/struct_parser_node.h","/types/parser/struct_parser_node.h"},
		{"types/parser/struct_normalized_declaration_set.h","/types/parser/struct_normalized_declaration_set.h"},
		{"types/parser/enum_declaration_or_definition.h","/types/parser/enum_declaration_or_definition.h"},
		{"types/parser/struct_normalized_specifier.h","/types/parser/struct_normalized_specifier.h"},
		{"types/parser/enum_type_class.h","/types/parser/enum_type_class.h"},
		{"types/parser/enum_value_type.h","/types/parser/enum_value_type.h"},
		{"types/parser/enum_normalized_declaration_type.h","/types/parser/enum_normalized_declaration_type.h"},
		{"types/parser/struct_parser_state.h","/types/parser/struct_parser_state.h"},
		{"types/parser/enum_scope_type.h","/types/parser/enum_scope_type.h"},
		{"types/struct_memory_pool_collection.h","/types/struct_memory_pool_collection.h"},
		{"types/preloader/struct_preloader_instruction.h","/types/preloader/struct_preloader_instruction.h"},
		{"types/preloader/enum_preloader_instruction_type.h","/types/preloader/enum_preloader_instruction_type.h"},
		{"types/struct_build_state.h","/types/struct_build_state.h"},
		{"types/struct_build_target.h","/types/struct_build_target.h"}
	};
	unsigned int i;
	memory_pool_collection_create(&mpc);
	initialize_filesystem_datastructures();
	unsigned_char_ptr_to_unsigned_char_ptr_map_create(&files);
	unsigned_char_ptr_to_unsigned_char_ptr_map_create(&directories);
	unsigned_char_list_create(&tmp);
	for(i = 0; i < NUM_FILES; i++){
		unsigned int j = 0;
		if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&files, (unsigned char *)filesystem_files[i][1])){
			printf("Duplicate file: %s\n", filesystem_files[i][1]);
			assert(0 && "Duplicate file in target filesystem.");
		}else{
			unsigned_char_ptr_to_unsigned_char_ptr_map_put(&files, (unsigned char *)&filesystem_files[i][1][0], (unsigned char *)&filesystem_files[i][0][0]);
		}
		while(filesystem_files[i][1][j]){
			unsigned_char_list_add_end(&tmp, (unsigned char)filesystem_files[i][1][j]);
			if(filesystem_files[i][1][j] == '/'){
				unsigned char * s = copy_string(unsigned_char_list_data(&tmp), ((unsigned char *)unsigned_char_list_data(&tmp)) + j, &mpc);
				if(unsigned_char_ptr_to_unsigned_char_ptr_map_exists(&directories, s)){
					heap_memory_pool_free(mpc.heap_pool, s);
				}else{
					unsigned_char_ptr_to_unsigned_char_ptr_map_put(&directories, s, s);
				}
			}
			j++;
		}
		unsigned_char_list_destroy(&tmp);
		unsigned_char_list_create(&tmp);
	}

	/*  Remove the root directory because its inode has already been created */
	root_dir = unsigned_char_ptr_to_unsigned_char_ptr_map_get(&directories, (unsigned char *)"/");
	unsigned_char_ptr_to_unsigned_char_ptr_map_remove(&directories, (unsigned char *)"/");
	heap_memory_pool_free(mpc.heap_pool, root_dir);

	directory_keys = unsigned_char_ptr_to_unsigned_char_ptr_map_keys(&directories);

	create_directories(&directory_keys, &mpc);

	for(i = 0; i < unsigned_char_ptr_list_size(&directory_keys); i++){
		unsigned char * dir = unsigned_char_ptr_list_get(&directory_keys, i);
		printf("Unique Directory: %s\n", dir);
		heap_memory_pool_free(mpc.heap_pool, dir);
	}

	create_files(&files, &mpc);

	unsigned_char_list_destroy(&tmp);
	unsigned_char_ptr_list_destroy(&directory_keys);
	unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&files);
	unsigned_char_ptr_to_unsigned_char_ptr_map_destroy(&directories);
	memory_pool_collection_destroy(&mpc);
	output_filesystem_impl(out_file);  /*  Create l2 file the represents filesystem state */
}
Esempio n. 25
0
/*************************************************************************
 * int main
 *************************************************************************/
int main(int argc, char *argv[])
{
  /* Data structures. */
  int       num_motifs;         /* The number of motifs in the model. */
  MOTIF_T   motifs[2 * MAX_MOTIFS]; /* The motifs. */
  STRING_LIST_T* motif_occurrences = NULL; /* Strings describing occurrences of
                                              motifs */
  BOOLEAN_T has_reverse_strand = FALSE;    /* MEME file contained both strands */
  ARRAY_T*  background;         /* Background probs for alphabet. */
  ORDER_T*  order_spacing;      /* Linear HMM order and spacing. */
  MATRIX_T* transp_freq = NULL; /* Matrix of inter-motif transitions freqs. */
  MATRIX_T* spacer_ave = NULL;  /* Matrix of average spacer lengths. */
  MHMM_T *  the_hmm = NULL;     /* The HMM being constructed. */

  /* Command line parameters. */
  char *    meme_filename;      /* Input file containg motifs. */
  char *    hmm_type_str;       /* HMM type. */
  HMM_T     hmm_type;
  STRING_LIST_T* requested_motifs; /* Indices of requested motifs. */
  int       request_n;          /* The user asked for the first n motifs. */
  double    e_threshold;        /* E-value threshold for motif inclusion. */
  double    complexity_threshold; // For eliminating low-complexity motifs.
  double    p_threshold;        /* p-value threshold for motif occurences. */
  char*     order_string;       /* Motif order and spacing. */
  int       spacer_states;      /* Number of states in each spacer. */
  BOOLEAN_T fim;                /* Represent spacers as free insertion
				   modules? */
  BOOLEAN_T keep_unused;        // Drop unused inter-motif transitions?
  double    trans_pseudo;       /* Transition pseudocount. */
  double    spacer_pseudo;      // Spacer (self-loop) pseudocount. */
  char*     description;        // Descriptive text to be stored in model.
  BOOLEAN_T print_header;       /* Print file header? */
  BOOLEAN_T print_params;       /* Print parameter summary? */
  BOOLEAN_T print_time;         /* Print timing data (dummy: always false). */

  /* Local variables. */
  int       i_motif;

  /**********************************************
   * COMMAND LINE PROCESSING
   **********************************************/
  // Define command line options.
  cmdoption const options[] = {
    {"type", OPTIONAL_VALUE},
    {"description", REQUIRED_VALUE},
    {"motif", REQUIRED_VALUE},
    {"nmotifs", REQUIRED_VALUE},
    {"ethresh", REQUIRED_VALUE},
    {"lowcomp", REQUIRED_VALUE},
    {"pthresh", REQUIRED_VALUE},
    {"order", REQUIRED_VALUE},
    {"nspacer", REQUIRED_VALUE},
    {"fim", NO_VALUE},
    {"keep-unused", NO_VALUE},
    {"transpseudo", REQUIRED_VALUE},
    {"spacerpseudo", REQUIRED_VALUE},
    {"verbosity", REQUIRED_VALUE},
    {"noheader", NO_VALUE},
    {"noparams", NO_VALUE},
    {"notime", NO_VALUE},
    {"quiet", NO_VALUE},
  };
  int option_count = 18;
  int option_index = 0;

  // Define the usage message.
  char      usage[1000] = "";
  strcat(usage, "USAGE: mhmm [options] <MEME file>\n");
  strcat(usage, "\n");
  strcat(usage, "   Options:\n");
  strcat(usage, "     --type [linear|complete|star] (default=linear)\n");
  strcat(usage, "     --description <string> (may be repeated)\n");
  strcat(usage, "     --motif <motif #> (may be repeated)\n");
  strcat(usage, "     --nmotifs <#>\n");
  strcat(usage, "     --ethresh <E-value>\n");
  strcat(usage, "     --lowcomp <value>\n");
  strcat(usage, "     --pthresh <p-value>\n");
  strcat(usage, "     --order <string>\n");
  strcat(usage, "     --nspacer <spacer length> (default=1)\n");
  strcat(usage, "     --fim\n");
  strcat(usage, "     --keep-unused\n");
  strcat(usage, "     --transpseudo <pseudocount>\n");
  strcat(usage, "     --spacerpseudo <pseudocount>\n");
  strcat(usage, "     --verbosity 1|2|3|4|5 (default=2)\n");
  strcat(usage, "     --noheader\n");
  strcat(usage, "     --noparams\n");
  strcat(usage, "     --notime\n");
  strcat(usage, "     --quiet\n");
  strcat(usage, "\n");

  /* Make sure various options are set to NULL or defaults. */
  meme_filename = NULL;
  hmm_type_str = NULL;
  hmm_type = INVALID_HMM;
  requested_motifs = new_string_list();
  request_n = 0;
  e_threshold = 0.0;
  complexity_threshold = 0.0;
  p_threshold = 0.0;
  order_string = NULL;
  spacer_states = DEFAULT_SPACER_STATES,
  fim = FALSE;
  keep_unused = FALSE;
  trans_pseudo = DEFAULT_TRANS_PSEUDO;
  spacer_pseudo = DEFAULT_SPACER_PSEUDO;
  description = NULL;
  print_header = TRUE;
  print_params = TRUE;
  print_time = FALSE;

	simple_setopt(argc, argv, option_count, options);

  // Parse the command line.
  while (1) { 
    int c = 0;
    char* option_name = NULL;
    char* option_value = NULL;
    const char * message = NULL;


    // Read the next option, and break if we're done.
    c = simple_getopt(&option_name, &option_value, &option_index);
    if (c == 0) {
      break;
    } else if (c < 0) {
    	simple_getopterror(&message);
      die("Error processing command line options (%s)\n", message);
    }

    if (strcmp(option_name, "type") == 0) {
			if (option_value != NULL) {
      	hmm_type_str = option_value;
			}
    } else if (strcmp(option_name, "description") == 0) {
      description = option_value;
    } else if (strcmp(option_name, "motif") == 0) {
      add_string(option_value, requested_motifs);
    } else if (strcmp(option_name, "nmotifs") == 0) {
      request_n = atoi(option_value);
    } else if (strcmp(option_name, "ethresh") == 0) {
      e_threshold = atof(option_value);
    } else if (strcmp(option_name, "lowcomp") == 0) {
      complexity_threshold = atof(option_value);
    } else if (strcmp(option_name, "pthresh") == 0) {
      p_threshold = atof(option_value);
    } else if (strcmp(option_name, "order") == 0) {
      order_string = option_value;
    } else if (strcmp(option_name, "nspacer") == 0) {
      spacer_states = atoi(option_value);
    } else if (strcmp(option_name, "fim") == 0) {
      fim = TRUE;
    } else if (strcmp(option_name, "keep-unused") == 0) {
      keep_unused = TRUE;
    } else if (strcmp(option_name, "transpseudo") == 0) {
      trans_pseudo = atof(option_value);
    } else if (strcmp(option_name, "spacerpseudo") == 0) {
      spacer_pseudo = atof(option_value);
    } else if (strcmp(option_name, "verbosity") == 0) {
      verbosity = (VERBOSE_T)atoi(option_value);
    } else if (strcmp(option_name, "noheader") == 0) {
      print_header = FALSE;
    } else if (strcmp(option_name, "noparams") == 0) {
      print_params = FALSE;
    } else if (strcmp(option_name, "notime") == 0) {
      print_time = FALSE;
    } else if (strcmp(option_name, "quiet") == 0) {
      print_header = print_params = print_time = FALSE;
      verbosity = QUIET_VERBOSE;
    }
  }

  // Read the single required argument.
  if (option_index + 1 != argc) {
    fprintf(stderr, "%s", usage);
    exit(1);
  }
  meme_filename = argv[option_index];

  // Set up motif requests. 
  if (request_n != 0) {
    if (get_num_strings(requested_motifs) != 0) {
      die("Can't combine the -motif and -nmotifs options.\n");
    } else {
      for (i_motif = 0; i_motif < request_n; i_motif++) {
        char motif_id[MAX_MOTIF_ID_LENGTH + 1];
        sprintf(motif_id, "%d", i_motif + 1);
        add_string(motif_id, requested_motifs);
      }
    }
  }

  /* Set the model type. */
  hmm_type = convert_enum_type_str(hmm_type_str, LINEAR_HMM, HMM_STRS, 
				   NUM_HMM_T);

  /* Gotta have positive spacer length. */
  if (spacer_states <= 0) {
    die("Negative spacer length (%d).\n", spacer_states);
  }

  /* Make sure motifs weren't selected redundantly. */
  // FIXME: Add tests for complexity threshold.
  if ((get_num_strings(requested_motifs) != 0) && (e_threshold != 0.0)) {
    die("Can't use -motif or -nmotifs with -ethresh.");
  }
  if ((get_num_strings(requested_motifs) != 0) && (order_string != NULL)) {
    die("Can't use -motif or -nmotifs with -order.");
  }
  if ((order_string != NULL) && (e_threshold != 0.0)) {
    die("Can't use -ethresh and -order.");
  }

  /* Prevent trying to build a complete or star model with ordering. */
  if (order_string != NULL) {
    if (hmm_type == COMPLETE_HMM) 
      die("Can't specify motif order with a completely connected model.");
    else if (hmm_type == STAR_HMM)
      die("Can't specify motif order with a star model.");
  } 

  // Parse the order string. 
  order_spacing = create_order(order_string);

  /**********************************************
   * READING THE MOTIFS
   **********************************************/

  BOOLEAN_T read_file = FALSE;
  double pseudocount = 0;

  read_meme_file(
		 meme_filename,
		 "motif-file", // Take bg freq. from motif file.
		 pseudocount,
     REQUIRE_PSPM,
		 &num_motifs,
		 motifs,
		 &motif_occurrences,
		 &has_reverse_strand,
		 &background
		 );

  process_raw_motifs_for_model(
       &num_motifs,
       motifs,
       motif_occurrences,
       requested_motifs,
       has_reverse_strand,
       keep_unused,
       p_threshold,
       e_threshold, 
       complexity_threshold, 
       &order_spacing,
       &transp_freq,
       &spacer_ave,
       trans_pseudo,
       spacer_pseudo
  );

  /**********************************************
   * BUILDING THE HMM
   **********************************************/

  /* Build the motif-based HMM. */
  if (hmm_type == LINEAR_HMM) {

    if (order_spacing != NULL) {
      reorder_motifs(order_spacing, &num_motifs, motifs);
    }
    else {
      die("No order specified for the motifs.\n"
          "For the linear model the motif file must contain motif occurence\n" 
          "data or the motif order must be specified using "
          "the --order option.");
    }

    build_linear_hmm(
      background,
		  order_spacing,
		  spacer_states,
		  motifs,
		  num_motifs, 
		  fim,
		  &the_hmm
    );

  } else if (hmm_type == COMPLETE_HMM) {

    build_complete_hmm(
      background,
		  spacer_states,
		  motifs,
		  num_motifs,
		  transp_freq,
		  spacer_ave,
		  fim,
		  &the_hmm
    );

  } else if (hmm_type == STAR_HMM) {

    build_star_hmm(
      background,
		  spacer_states,
		  motifs,
		  num_motifs,
		  fim,
		  &the_hmm
    );

  }

  // Add some global information.
  copy_string(&(the_hmm->motif_file), meme_filename);

  /**********************************************
   * WRITING THE HMM
   **********************************************/

  /* Print the header. */
  if (print_header)
    write_header(
     program, 
     "",
		 description,
		 meme_filename,
		 NULL,
		 NULL, 
		 stdout
    );

  /* Write the HMM. */
  write_mhmm(verbosity, the_hmm, stdout);

  /* Print the program parameters. */
  if (print_params) {
    printf("Program parameters for mhmm\n");
    printf("  MEME file: %s\n", meme_filename);
    printf("  Motifs:");
    write_string_list(" ", requested_motifs, stdout);
    printf("\n");
    printf("  Model topology: %s\n",
	   convert_enum_type(hmm_type, HMM_STRS, NUM_HMM_T));
    printf("  States per spacer: %d\n", spacer_states);
    printf("  Spacers are free-insertion modules: %s\n",
	   boolean_to_string(fim));
    printf("\n");
  }

  free_array(background);
  free_string_list(requested_motifs);
  free_order(order_spacing);
  free_matrix(transp_freq);
  free_matrix(spacer_ave);
  for (i_motif = 0; i_motif < num_motifs; i_motif++)
    free_motif(&(motifs[i_motif]));
  free_mhmm(the_hmm);
  return(0);
}
Esempio n. 26
0
int get_template(char *buf, SStrInfo *str_info)
{
	int len = 0;
	unsigned int i = 0;
	char *str_type_code = 0;
	char *tmp = strstr(buf, "@");
	STypeCodeStr type_code_str;
	RListIter *it = 0;
	RList *saved_abbr_names = abbr_names;	// save current abbr names, this
											// need templates doesnot take
											// part in abbreviation shcemes

	if (!tmp) {
		goto get_template_err;
	}

	if (!init_type_code_str_struct(&type_code_str)) {
		goto get_template_err;
	}

	abbr_names = r_list_new();

	// get/copy template len/name
	len += (tmp - buf + 1);
	copy_string(&type_code_str, buf, len - 1);
	buf += len;

	if (*buf != '@') {
		copy_string(&type_code_str, "<", 0);
	}

	// get identifier
	while (*buf != '@') {
		if (i) {
			copy_string(&type_code_str, ", ", 0);
		}

		if (get_type_code_string(buf, &i, &str_type_code) != eDemanglerErrOK) {
			len = 0;
			goto get_template_err;
		}
		copy_string(&type_code_str, str_type_code, 0);

		buf += i;
		len += i;
		R_FREE(str_type_code);
	}

	if (*buf != '@') {
		len = 0;
		goto get_template_err;
	}

	copy_string(&type_code_str, ">", 0);
	buf++;
	len++;

	str_info->str_ptr = type_code_str.type_str;
	str_info->len = type_code_str.curr_pos;

get_template_err:
	it = r_list_iterator (abbr_names);
	r_list_foreach (abbr_names, it, tmp) {
		R_FREE(tmp);
	}
Esempio n. 27
0
PREFIX value ml_elm_naviframe_item_style_get(value v_it)
{
        return copy_string(elm_naviframe_item_style_get(
                (Elm_Object_Item*) v_it));
}
Esempio n. 28
0
void set_print_cmd(GraceApp *gapp, const char *cmd)
{
    gapp->rt->print_cmd = copy_string(gapp->rt->print_cmd, cmd);
}
Esempio n. 29
0
void
nsTextFragment::SetTo(const PRUnichar* aBuffer, PRInt32 aLength, PRBool aUpdateBidi)
{
    ReleaseText();

    if (aLength == 0) {
        return;
    }

    PRUnichar firstChar = *aBuffer;
    if (aLength == 1 && firstChar < 256) {
        m1b = sSingleCharSharedString + firstChar;
        mState.mInHeap = PR_FALSE;
        mState.mIs2b = PR_FALSE;
        mState.mLength = 1;

        return;
    }

    const PRUnichar *ucp = aBuffer;
    const PRUnichar *uend = aBuffer + aLength;

    // Check if we can use a shared string
    if (aLength <= 1 + TEXTFRAG_WHITE_AFTER_NEWLINE + TEXTFRAG_MAX_NEWLINES &&
            (firstChar == ' ' || firstChar == '\n' || firstChar == '\t')) {
        if (firstChar == ' ') {
            ++ucp;
        }

        const PRUnichar* start = ucp;
        while (ucp < uend && *ucp == '\n') {
            ++ucp;
        }
        const PRUnichar* endNewLine = ucp;

        PRUnichar space = ucp < uend && *ucp == '\t' ? '\t' : ' ';
        while (ucp < uend && *ucp == space) {
            ++ucp;
        }

        if (ucp == uend &&
                endNewLine - start <= TEXTFRAG_MAX_NEWLINES &&
                ucp - endNewLine <= TEXTFRAG_WHITE_AFTER_NEWLINE) {
            char** strings = space == ' ' ? sSpaceSharedString : sTabSharedString;
            m1b = strings[endNewLine - start];

            // If we didn't find a space in the beginning, skip it now.
            if (firstChar != ' ') {
                ++m1b;
            }

            mState.mInHeap = PR_FALSE;
            mState.mIs2b = PR_FALSE;
            mState.mLength = aLength;

            return;
        }
    }

    // See if we need to store the data in ucs2 or not
    PRInt32 first16bit = FirstNon8Bit(ucp, uend);

    if (first16bit != -1) { // aBuffer contains no non-8bit character
        // Use ucs2 storage because we have to
        m2b = (PRUnichar *)nsMemory::Clone(aBuffer,
                                           aLength * sizeof(PRUnichar));
        if (!m2b) {
            return;
        }

        mState.mIs2b = PR_TRUE;
        if (aUpdateBidi) {
            UpdateBidiFlag(aBuffer + first16bit, aLength - first16bit);
        }

    } else {
        // Use 1 byte storage because we can
        char* buff = (char *)nsMemory::Alloc(aLength * sizeof(char));
        if (!buff) {
            return;
        }

        // Copy data
        LossyConvertEncoding16to8 converter(buff);
        copy_string(aBuffer, aBuffer+aLength, converter);
        m1b = buff;
        mState.mIs2b = PR_FALSE;
    }

    // Setup our fields
    mState.mInHeap = PR_TRUE;
    mState.mLength = aLength;
}
Esempio n. 30
0
EXTERN value alloc_string( const char *str ) {
	if( str == NULL )
		return val_null;
	return copy_string(str,strlen(str));
}