本文整理汇总了C++中relocate函数的典型用法代码示例。如果您正苦于以下问题:C++ relocate函数的具体用法?C++ relocate怎么用?C++ relocate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了relocate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:alan707,项目名称:senuti,代码行数:58,代码来源:read-csharp.c
示例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;
}
开发者ID:Thor1Khan,项目名称:gettext,代码行数:51,代码来源:read-java.c
示例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);
}
开发者ID:644rosen,项目名称:gettext_gtkbuilder_support,代码行数:48,代码来源:read-resources.c
示例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());
}
开发者ID:mearvk,项目名称:JVM,代码行数:7,代码来源:macroAssembler_s390.inline.hpp
示例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);
}
开发者ID:mearvk,项目名称:JVM,代码行数:31,代码来源:c1_CodeStubs_s390.cpp
示例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
}
开发者ID:MyProgrammingStyle,项目名称:hotspot,代码行数:32,代码来源:compiledIC_sparc.cpp
示例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();
}
开发者ID:benbenolson,项目名称:hotspot_9_mc,代码行数:26,代码来源:compiledIC_aarch64.cpp
示例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;
}
开发者ID:komh,项目名称:libiconv-os2,代码行数:12,代码来源:relocatable.c
示例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));
}
}
}
开发者ID:lukas1994,项目名称:compilers-course-oxford,代码行数:29,代码来源:symtab.c
示例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);
}
开发者ID:Mouradif,项目名称:snake,代码行数:29,代码来源:basic_move.c
示例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);
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:30,代码来源:crash_dump.c
示例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);
}
开发者ID:nasa,项目名称:QuIP,代码行数:26,代码来源:dobj_menu.c
示例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;
}
开发者ID:gaoxiaojun,项目名称:dync,代码行数:34,代码来源:compiledIC_sparc.cpp
示例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);
}
开发者ID:jbuonagurio,项目名称:lrose-core,代码行数:35,代码来源:rdrxlat.C
示例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);
}
开发者ID:Distrotech,项目名称:gettext,代码行数:28,代码来源:color.c
示例16: _masm
address 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.
// movq rbx, 0
// jmp -5 # 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());
if (base == NULL) {
return NULL; // CodeBuffer::expand failed.
}
// Static stub relocation stores the instruction address of the call.
__ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand);
// Static stub relocation also tags the Method* in the code-stream.
__ mov_metadata(rbx, (Metadata*) NULL); // Method is zapped till fixup time.
// This is recognized as unresolved by relocs/nativeinst/ic code.
__ jump(RuntimeAddress(__ pc()));
// Update current stubs pointer and restore insts_end.
__ end_a_stub();
return base;
}
开发者ID:krichter722,项目名称:jdk9-jdk9-hotspot,代码行数:27,代码来源:compiledIC_x86.cpp
示例17: style_file_lookup
/* Lookup the location of the style file. */
static const char *
style_file_lookup (const char *file_name)
{
if (!IS_PATH_WITH_DIR (file_name))
{
/* It's a file name without a directory specification.
If it does not exist in the current directory... */
struct stat statbuf;
if (stat (file_name, &statbuf) < 0)
{
/* ... but it exists in the styles installation location... */
const char *gettextstylesdir = relocate (GETTEXTDATADIR "/styles");
char *possible_file_name =
xconcatenated_filename (gettextstylesdir, file_name, NULL);
if (stat (possible_file_name, &statbuf) >= 0)
{
/* ... then use the file in the styles installation directory. */
return possible_file_name;
}
free (possible_file_name);
}
/* Let the CSS library show a warning. */
}
return file_name;
}
开发者ID:Distrotech,项目名称:gettext,代码行数:29,代码来源:color.c
示例18: gc
void gc(void)
{
static int grew = 0;
unsigned char *temp;
u_int32_t i;
curheap = tospace;
lim = curheap+heapsize-sizeof(cons_t);
for (i=0; i < SP; i++)
Stack[i] = relocate(Stack[i]);
trace_globals(symtab);
#ifdef VERBOSEGC
printf("gc found %d/%d live conses\n", (curheap-tospace)/8, heapsize/8);
#endif
temp = tospace;
tospace = fromspace;
fromspace = temp;
// if we're using > 80% of the space, resize tospace so we have
// more space to fill next time. if we grew tospace last time,
// grow the other half of the heap this time to catch up.
if (grew || ((lim-curheap) < (int)(heapsize/5))) {
temp = realloc(tospace, grew ? heapsize : heapsize*2);
if (temp == NULL)
lerror("out of memory\n");
tospace = temp;
if (!grew)
heapsize*=2;
grew = !grew;
}
if (curheap > lim) // all data was live
gc();
}
开发者ID:andychu,项目名称:femtolisp-google-code,代码行数:34,代码来源:lisp.c
示例19: relocate
void View::setLocation(int inBaseX, int inBaseY)
{
if ((windowImpl) && (flags & WINDOW_IMPL_OWNER))
windowImpl->setLocation(inBaseX, inBaseY);
else
relocate(inBaseX, inBaseY);
}
开发者ID:jefferis,项目名称:rgl,代码行数:7,代码来源:gui.cpp
示例20: get_file_length
struct dsc *loader_arch_load_dsc(const char *name)
{
char *loadaddr;
struct dsc_hdr *dschdr;
int length;
/* get length of file */
length = get_file_length(name);
if (length==0)
return NULL;
/* allocate memory */
loadaddr = malloc(length);
if (loadaddr==NULL)
return NULL;
/* load the file */
load_file(name, loadaddr);
dschdr = (struct dsc_hdr *)loadaddr;
/* relocate it */
relocate(dschdr->relocatedata, loadaddr);
return &dschdr->dscdata;
}
开发者ID:ZhepingYang,项目名称:contiki-1.x,代码行数:25,代码来源:loader-arch-cpc.c
注:本文中的relocate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论