本文整理汇总了C++中prep函数的典型用法代码示例。如果您正苦于以下问题:C++ prep函数的具体用法?C++ prep怎么用?C++ prep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了prep函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_1b
/* duk_has_prop(), invalid index */
static duk_ret_t test_1b(duk_context *ctx) {
duk_ret_t rc;
prep(ctx);
duk_push_string(ctx, "foo");
rc = duk_has_prop(ctx, 234);
printf("obj.foo -> rc=%d\n", (int) rc);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
示例2: test_1
static duk_ret_t test_1(duk_context *ctx) {
duk_idx_t i, n;
prep(ctx);
duk_replace(ctx, -3); /* -> [ 123 "foo" 345 ] */
n = duk_get_top(ctx);
for (i = 0; i < n; i++) {
printf("%ld: %s\n", (long) i, duk_to_string(ctx, i));
}
return 0;
}
示例3: test_1b
/* duk_has_prop(), invalid index */
int test_1b(duk_context *ctx) {
int rc;
prep(ctx);
duk_push_string(ctx, "foo");
rc = duk_has_prop(ctx, 234);
printf("obj.foo -> rc=%d\n", rc);
printf("final top: %d\n", duk_get_top(ctx));
return 0;
}
示例4: test_1d
/* duk_del_prop(), non-configurable virtual property of a plain string.
* Same behavior when called inside/outside of a Duktape/C activation.
*/
static duk_ret_t test_1d(duk_context *ctx) {
duk_ret_t rc;
prep(ctx);
duk_push_string(ctx, "length");
rc = duk_del_prop(ctx, 2);
printf("delete 'test_string'.length -> rc=%d\n", (int) rc);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
示例5: test_1f
/* duk_del_prop(), DUK_INVALID_INDEX */
static duk_ret_t test_1f(duk_context *ctx) {
duk_ret_t rc;
prep(ctx);
duk_push_string(ctx, "foo");
rc = duk_del_prop(ctx, DUK_INVALID_INDEX);
printf("delete obj.foo -> rc=%d\n", (int) rc);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
示例6: test_1c
/* duk_del_prop(), non-configurable virtual property of a plain string.
* Same behavior when called inside/outside of a Duktape/C activation.
*/
static duk_ret_t test_1c(duk_context *ctx) {
duk_ret_t rc;
prep(ctx);
duk_push_int(ctx, 5);
rc = duk_del_prop(ctx, 2);
printf("delete 'test_string'[5] -> rc=%d\n", (int) rc);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
示例7: test_1c
/* duk_del_prop(), non-configurable virtual property of a plain string,
* called from inside a Duktape/C context.
*/
int test_1c(duk_context *ctx) {
int rc;
prep(ctx);
duk_push_int(ctx, 5);
rc = duk_del_prop(ctx, 2);
printf("delete 'test_string'[5] -> rc=%d\n", rc);
printf("final top: %d\n", duk_get_top(ctx));
return 0;
}
示例8: test_1e
/* duk_del_prop(), DUK_INVALID_INDEX */
int test_1e(duk_context *ctx) {
int rc;
prep(ctx);
duk_push_string(ctx, "foo");
rc = duk_del_prop(ctx, DUK_INVALID_INDEX);
printf("delete obj.foo -> rc=%d\n", rc);
printf("final top: %d\n", duk_get_top(ctx));
return 0;
}
示例9: test_1b
/* duk_del_prop(), non-configurable property (array 'length' property),
* called from inside a Duktape/C context.
*/
int test_1b(duk_context *ctx) {
int rc;
prep(ctx);
duk_push_string(ctx, "length");
rc = duk_del_prop(ctx, 1);
printf("delete arr.length -> rc=%d\n", rc);
printf("final top: %d\n", duk_get_top(ctx));
return 0;
}
示例10: main
int main(int argc, char* argv[]) {
if(argc >= 2){
printf("\nLittle Man Computer simulator v1.0\n");
printf("All command line arguments trigger this help.\n");
printf("\nWhen you start, you will get a ? prompt.\nEnter your data as:\n\n? ADDRESS DATA\n\nAddressess can be between 1 and 99, data can be between 0 and 999.");
printf("\nTwo special editor commands exist, enter them in the ? prompt as:\n\n? COMMAND ARGUMENT\n\n");
printf("100: Run program, enter any number as the argument (nescessary).\n");
printf("101: Print address, enter the address as the argument. 0 prints all stored data.\n");
printf("\nData stored in memory addresses are interpreted as commands if reached by the counter during runtime.");
printf("\nThese commands are the fundamentals of the LMC computer, and are different than the previously mentioned editor commands.\n");
printf("\nYou can store actual data in addresses after the 000 command.\n\n");
printf("1XX: ADD: Add data from memory bank XX to calculator.\n");
printf("2XX: SUB: Subtract data from memory bank XX from calculator.\n");
printf("3XX: STO: Store data from calculator in memory bank XX.\n");
printf("5XX: LDA: Load data from memory bank XX into calculator.\n");
printf("6XX: BR: Branch (jump) to memory bank XX.\n");
printf("7XX: BRZ: Branch (jump) to memory bank XX when calculator is ZERO.\n");
printf("8XX: BRP: Branch (jump) to memory bank XX when calculator is POSITIVE.\n");
printf("901: IN: Ask user for input to be set as calculator value.\n");
printf("902: OUT: Output calculator value.\n");
printf("000: ZZZ: Coffee break, end execution.\n\n");
printf("When your program is running, input prompts triggered with 901 will appear as: *\n\n");
return 0;
}
int address, data, i;
while(1){
printf("? ");
scanf("%d %d", &address, &data);
if(address == 100){
prep();
run(data);
reset();
}
else if(address == 101){
if(data == 0){
for(i = 1; i <= 99; i++){
if(mem[i] != 0){
printf("%d:%d\n", i, mem[i]);
}
}
}
else{
printf("%d:%d\n", data, mem[data]);
}
}
else{
mem[address] = data;
}
}
return 0;
}
示例11: v4l2_reader_enqueue_buffer
int v4l2_reader_enqueue_buffer (v4l2_reader *v, int index) {
v4l2_buffer buffer;
prep (&buffer);
buffer.index = index;
if (0 > ioctl (v->fd, VIDIOC_QBUF, &buffer)) {
log_err ("queuing buffer");
return 0;
} else {
return 1;
}
}
示例12: test_2c
/* duk_has_prop_string(), DUK_INVALID_INDEX */
static duk_ret_t test_2c(duk_context *ctx, void *udata) {
duk_ret_t rc;
(void) udata;
prep(ctx);
rc = duk_has_prop_string(ctx, DUK_INVALID_INDEX, "foo");
printf("obj.foo -> rc=%d\n", (int) rc);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
示例13: start_gen_radius_cert
void start_gen_radius_cert(void)
{
if (nvram_match("cert_running", "1") && pidof("openssl") > 0)
return; //already running
prep();
gen_cert("/jffs/etc/freeradius/certs/server.cnf", TYPE_SERVER, nvram_safe_get("radius_common"), nvram_safe_get("radius_passphrase"));
gen_cert("/jffs/etc/freeradius/certs/ca.cnf", TYPE_CA, nvram_safe_get("radius_common"), nvram_safe_get("radius_passphrase"));
nvram_set("cert_running", "1");
//this takes a long time (depending from the cpu speed)
system("cd /jffs/etc/freeradius/certs && ./bootstrap");
sysprintf("sed \"s/private_key_password = whatever/private_key_password = %s/g\" /etc/freeradius/eap.conf > /jffs/etc/freeradius/eap.conf", nvram_safe_get("radius_passphrase"));
nvram_set("cert_running", "0");
}
示例14: test_2
static duk_ret_t test_2(duk_context *ctx) {
duk_idx_t i, n;
prep(ctx);
duk_copy(ctx, -3, -3); /* nop */
n = duk_get_top(ctx);
for (i = 0; i < n; i++) {
printf("%ld: %s\n", (long) i, duk_to_string(ctx, i));
}
return 0;
}
示例15: test_1c
/* duk_get_prop(), DUK_INVALID_INDEX */
static duk_ret_t test_1c(duk_context *ctx) {
duk_ret_t rc;
prep(ctx);
duk_push_string(ctx, "foo");
rc = duk_get_prop(ctx, DUK_INVALID_INDEX);
printf("obj.foo -> rc=%d, result='%s'\n", (int) rc, duk_to_string(ctx, -1));
duk_pop(ctx);
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}