本文整理汇总了C++中relocate函数的典型用法代码示例。如果您正苦于以下问题:C++ relocate函数的具体用法?C++ relocate怎么用?C++ relocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了relocate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msgdomain_read_csharp
msgdomain_list_ty *
msgdomain_read_csharp (const char *resource_name, const char *locale_name,
const char *directory)
{
char *culture_name;
const char *args[4];
const char *gettextexedir;
const char *gettextlibdir;
char *assembly_path;
const char *libdirs[1];
struct locals locals;
/* Assign a default value to the resource name. */
if (resource_name == NULL)
resource_name = "Messages";
/* Convert the locale name to a .NET specific culture name. */
culture_name = xstrdup (locale_name);
{
char *p;
for (p = culture_name; *p != '\0'; p++)
if (*p == '_')
*p = '-';
}
/* Prepare arguments. */
args[0] = directory;
args[1] = resource_name;
args[2] = culture_name;
args[3] = NULL;
/* Make it possible to override the .exe location. This is
necessary for running the testsuite before "make install". */
gettextexedir = getenv ("GETTEXTCSHARPEXEDIR");
if (gettextexedir == NULL || gettextexedir[0] == '\0')
gettextexedir = relocate (LIBDIR "/gettext");
/* Make it possible to override the .dll location. This is
necessary for running the testsuite before "make install". */
gettextlibdir = getenv ("GETTEXTCSHARPLIBDIR");
if (gettextlibdir == NULL || gettextlibdir[0] == '\0')
gettextlibdir = relocate (LIBDIR);
/* Dump the resource and retrieve the resulting output. */
assembly_path = concatenated_pathname (gettextexedir, "msgunfmt.net", ".exe");
libdirs[0] = gettextlibdir;
if (execute_csharp_program (assembly_path, libdirs, 1,
args,
verbose, false,
execute_and_read_po_output, &locals))
/* An error message should already have been provided. */
exit (EXIT_FAILURE);
free (assembly_path);
free (culture_name);
return locals.mdlp;
}
示例2: msgdomain_read_java
msgdomain_list_ty *
msgdomain_read_java (const char *resource_name, const char *locale_name)
{
const char *class_name = "gnu.gettext.DumpResource";
const char *gettextjexedir;
const char *gettextjar;
const char *args[3];
struct locals locals;
#if USEJEXE
/* Make it possible to override the executable's location. This is
necessary for running the testsuite before "make install". */
gettextjexedir = getenv ("GETTEXTJEXEDIR");
if (gettextjexedir == NULL || gettextjexedir[0] == '\0')
gettextjexedir = relocate (GETTEXTJEXEDIR);
#else
gettextjexedir = NULL;
#endif
/* Make it possible to override the gettext.jar location. This is
necessary for running the testsuite before "make install". */
gettextjar = getenv ("GETTEXTJAR");
if (gettextjar == NULL || gettextjar[0] == '\0')
gettextjar = relocate (GETTEXTJAR);
/* Assign a default value to the resource name. */
if (resource_name == NULL)
resource_name = "Messages";
/* Prepare arguments. */
args[0] = resource_name;
if (locale_name != NULL)
{
args[1] = locale_name;
args[2] = NULL;
}
else
args[1] = NULL;
/* Dump the resource and retrieve the resulting output.
Here we use the user's CLASSPATH, not a minimal one, so that the
resource can be found. */
if (execute_java_class (class_name, &gettextjar, 1, false, gettextjexedir,
args,
verbose, false,
execute_and_read_po_output, &locals))
/* An error message should already have been provided. */
exit (EXIT_FAILURE);
return locals.mdlp;
}
示例3: read_resources_file
void
read_resources_file (message_list_ty *mlp, const char *filename)
{
const char *args[2];
const char *gettextexedir;
const char *gettextlibdir;
char *assembly_path;
const char *libdirs[1];
struct locals locals;
/* Prepare arguments. */
args[0] = filename;
args[1] = NULL;
/* Make it possible to override the .exe location. This is
necessary for running the testsuite before "make install". */
gettextexedir = getenv ("GETTEXTCSHARPEXEDIR");
if (gettextexedir == NULL || gettextexedir[0] == '\0')
gettextexedir = relocate (LIBDIR "/gettext");
/* Make it possible to override the .dll location. This is
necessary for running the testsuite before "make install". */
gettextlibdir = getenv ("GETTEXTCSHARPLIBDIR");
if (gettextlibdir == NULL || gettextlibdir[0] == '\0')
gettextlibdir = relocate (LIBDIR);
/* Dump the resource and retrieve the resulting output. */
assembly_path =
xconcatenated_filename (gettextexedir, "msgunfmt.net", ".exe");
libdirs[0] = gettextlibdir;
if (execute_csharp_program (assembly_path, libdirs, 1,
args,
verbose, false,
execute_and_read_po_output, &locals))
/* An error message should already have been provided. */
exit (EXIT_FAILURE);
/* Add the output to mlp. */
{
message_list_ty *read_mlp = locals.mdlp->item[0]->messages;
size_t j;
for (j = 0; j < read_mlp->nitems; j++)
message_list_append (mlp, read_mlp->item[j]);
}
free (assembly_path);
}
示例4: assert
inline void MacroAssembler::load_const(Register t, const AddressLiteral& a) {
assert(t != Z_R0, "R0 not allowed");
// First relocate (we don't change the offset in the RelocationHolder,
// just pass a.rspec()), then delegate to load_const(Register, long).
relocate(a.rspec());
load_const(t, (long)a.value());
}
示例5: bind
void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
// Slow case: call to native.
__ bind(_entry);
__ lgr_if_needed(Z_ARG1, src()->as_register());
__ lgr_if_needed(Z_ARG2, src_pos()->as_register());
__ lgr_if_needed(Z_ARG3, dst()->as_register());
__ lgr_if_needed(Z_ARG4, dst_pos()->as_register());
__ lgr_if_needed(Z_ARG5, length()->as_register());
// Must align calls sites, otherwise they can't be updated atomically on MP hardware.
ce->align_call(lir_static_call);
assert((__ offset() + NativeCall::call_far_pcrelative_displacement_offset) % NativeCall::call_far_pcrelative_displacement_alignment == 0,
"must be aligned");
ce->emit_static_call_stub();
// Prepend each BRASL with a nop.
__ relocate(relocInfo::static_call_type);
__ z_nop();
__ z_brasl(Z_R14, SharedRuntime::get_resolve_static_call_stub());
ce->add_call_info_here(info());
ce->verify_oop_map(info());
#ifndef PRODUCT
__ load_const_optimized(Z_R1_scratch, (address)&Runtime1::_arraycopy_slowcase_cnt);
__ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch);
#endif
__ branch_optimized(Assembler::bcondAlways, _continuation);
}
示例6: _masm
void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
#ifdef COMPILER2
// Stub is fixed up when the corresponding call is converted from calling
// compiled code to calling interpreted code.
// set (empty), G5
// jmp -1
address mark = cbuf.insts_mark(); // Get mark within main instrs section.
MacroAssembler _masm(&cbuf);
address base =
__ start_a_stub(to_interp_stub_size()*2);
if (base == NULL) return; // CodeBuffer::expand failed.
// Static stub relocation stores the instruction address of the call.
__ relocate(static_stub_Relocation::spec(mark));
__ set_metadata(NULL, as_Register(Matcher::inline_cache_reg_encode()));
__ set_inst_mark();
AddressLiteral addrlit(-1);
__ JUMP(addrlit, G3, 0);
__ delayed()->nop();
// Update current stubs pointer and restore code_end.
__ end_a_stub();
#else
ShouldNotReachHere();
#endif
}
示例7: _masm
void CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf) {
// Stub is fixed up when the corresponding call is converted from
// calling compiled code to calling interpreted code.
// mov rmethod, 0
// jmp -4 # to self
address mark = cbuf.insts_mark(); // Get mark within main instrs section.
// Note that the code buffer's insts_mark is always relative to insts.
// That's why we must use the macroassembler to generate a stub.
MacroAssembler _masm(&cbuf);
address base = __ start_a_stub(to_interp_stub_size()*2);
int offset = __ offset();
if (base == NULL) return; // CodeBuffer::expand failed
// static stub relocation stores the instruction address of the call
__ relocate(static_stub_Relocation::spec(mark));
// static stub relocation also tags the Method* in the code-stream.
__ mov_metadata(rmethod, (Metadata*)NULL);
__ movptr(rscratch1, 0);
__ br(rscratch1);
assert((__ offset() - offset) <= (int)to_interp_stub_size(), "stub too big");
__ end_a_stub();
}
示例8: free
/* Returns the pathname, relocated according to the current installation
directory.
This function sets *ALLOCATEDP to the allocated memory, or to NULL if
no memory allocation occurs. So that, after you're done with the return
value, to reclaim allocated memory, you can do: free (*ALLOCATEDP). */
const char *
relocate2 (const char *pathname, char **allocatedp)
{
const char *result = relocate (pathname);
*allocatedp = (result != pathname ? (char *) result : NULL);
return result;
}
示例9: fix_data
/* fix_data -- fix up global refs in the data segment */
void fix_data(uchar *base, int bss) {
int i, u, v;
/* Shift BSS symbols by offset bss */
for (i = 0; i < ndict; i++) {
symbol s = dict[i];
if (s->s_seg == BSS) s->s_value += bss;
}
/* Fix up each symbol */
for (i = 0; i < ndict; i++) {
symbol s = dict[i];
int val;
if (s->s_uchain == -1) continue;
if (dflag > 0) printf("Fixing %s\n", s->s_name);
val = sym_value(s);
/* Run along the use chain, inserting the value */
for (u = s->s_uchain; u != -1; u = v) {
v = *((int *) &base[u]);
put4(&base[u], val);
relocate(u, (s->s_seg == ABS ? R_WORD : R_DATA));
}
}
}
示例10: snake_move
int snake_move(t_map map, t_snake *snake, char vdir, char hdir)
{
relocate(snake->h);
if (vdir == 'U')
{
if (snake->h->y == 0)
return (screen_game_over());
snake->h->y--;
}
if (vdir == 'D')
{
if (snake->h->y == map.h)
return (screen_game_over());
snake->h->y++;
}
if (hdir == 'L')
{
if (snake->h->x == 0)
return (screen_game_over());
snake->h->x--;
}
if (hdir == 'R')
{
if (snake->h->x == map.w)
return (screen_game_over());
snake->h->x++;
}
return (1);
}
示例11: s390_elf_corehdr_create
static void s390_elf_corehdr_create(char **elfcorebuf, size_t *elfcorebuf_sz)
{
Elf64_Phdr *phdr_notes, *phdr_loads;
int mem_chunk_cnt;
void *ptr, *hdr;
u32 alloc_size;
u64 hdr_off;
mem_chunk_cnt = get_mem_chunk_cnt();
alloc_size = 0x1000 + get_cpu_cnt() * 0x300 +
mem_chunk_cnt * sizeof(Elf64_Phdr);
hdr = kzalloc_panic(alloc_size);
/* */
ptr = ehdr_init(hdr, mem_chunk_cnt);
/* */
phdr_notes = ptr;
ptr = PTR_ADD(ptr, sizeof(Elf64_Phdr));
phdr_loads = ptr;
ptr = PTR_ADD(ptr, sizeof(Elf64_Phdr) * mem_chunk_cnt);
/* */
hdr_off = PTR_DIFF(ptr, hdr);
ptr = notes_init(phdr_notes, ptr, ((unsigned long) hdr) + hdr_off);
/* */
hdr_off = PTR_DIFF(ptr, hdr);
loads_init(phdr_loads, ((unsigned long) hdr) + hdr_off);
*elfcorebuf_sz = hdr_off;
*elfcorebuf = (void *) relocate((unsigned long) hdr);
BUG_ON(*elfcorebuf_sz > alloc_size);
}
示例12: COMMAND_FUNC
static COMMAND_FUNC( do_relocate )
{
Data_Obj *dp;
long x,y,t;
const char *obj_name;
dp=pick_obj("subimage");
x=(long) how_many("x offset");
y=(long) how_many("y offset");
t=(long) how_many("t offset");
if( dp==NULL ) return;
obj_name = OBJ_NAME(dp);
INSIST_NONNEGATIVE(x,"x offset","relocate");
INSIST_NONNEGATIVE(y,"y offset","relocate");
INSIST_NONNEGATIVE(t,"t offset","relocate");
if( OBJ_PARENT(dp) == NULL ){
sprintf(ERROR_STRING,
"relocate: object \"%s\" is not a subimage",
OBJ_NAME(dp));
warn(ERROR_STRING);
return;
}
relocate(dp,(index_t)x,(index_t)y,(index_t)t);
}
示例13: _masm
address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) {
// Stub is fixed up when the corresponding call is converted from calling
// compiled code to calling interpreted code.
// set (empty), G5
// jmp -1
if (mark == NULL) {
mark = cbuf.insts_mark(); // Get mark within main instrs section.
}
MacroAssembler _masm(&cbuf);
address base = __ start_a_stub(to_interp_stub_size());
if (base == NULL) {
return NULL; // CodeBuffer::expand failed.
}
// Static stub relocation stores the instruction address of the call.
__ relocate(static_stub_Relocation::spec(mark));
__ set_metadata(NULL, as_Register(Matcher::inline_cache_reg_encode()));
__ set_inst_mark();
AddressLiteral addrlit(-1);
__ JUMP(addrlit, G3, 0);
__ delayed()->nop();
assert(__ pc() - base <= to_interp_stub_size(), "wrong stub size");
// Update current stubs pointer and restore code_end.
__ end_a_stub();
return base;
}
示例14: LatLongKmDiff
void rdr_xlat::XlatArray()
{
int az, rng;
unsigned char *p = src_array;
float km_n, km_e;
if (!dest_array)
return;
if (ApplyTestPattern) {
if (rdr_xlat_testpatterntoggle)
for (az = 0; az < src_ydim; az++)
for (rng = 0; rng < src_xdim; rng++)
{
if (*p == 0)
*p = (rng / 10) % 7;
p++;
}
else
for (az = 0; az < src_ydim; az++)
for (rng = 0; rng < src_xdim; rng++)
{
if (*p == 0)
*p = (az / 10) % 7;
p++;
}
rdr_xlat_testpatterntoggle = !rdr_xlat_testpatterntoggle;
}
LatLongKmDiff(StnRec[dest_stnid].Lat(), StnRec[dest_stnid].Lng(),
StnRec[source_stnid].Lat(), StnRec[source_stnid].Lng(),
&km_n, &km_e);
relocate(src_array, dest_array, src_ydim,
src_xdim, dest_xdim,
SrcScan->rng_res / 1000.0, SrcScan->start_rng / 1000.0, 0,
km_n, km_e);
}
示例15: style_file_prepare
/* Assign a default value to style_file_name if necessary. */
void
style_file_prepare ()
{
if (style_file_name == NULL)
{
const char *user_preference = getenv ("PO_STYLE");
if (user_preference != NULL && user_preference[0] != '\0')
style_file_name = style_file_lookup (xstrdup (user_preference));
else
{
const char *gettextdatadir;
/* Make it possible to override the po-default.css location. This is
necessary for running the testsuite before "make install". */
gettextdatadir = getenv ("GETTEXTDATADIR");
if (gettextdatadir == NULL || gettextdatadir[0] == '\0')
gettextdatadir = relocate (GETTEXTDATADIR);
style_file_name =
xconcatenated_filename (gettextdatadir, "styles/po-default.css",
NULL);
}
}
else
style_file_name = style_file_lookup (style_file_name);
}