java qr code reader for mobile Using a Specific Perl Function in Objective-C

Creator PDF-417 2d barcode in Objective-C Using a Specific Perl Function

Using a Specific Perl Function
PDF-417 2d Barcode Decoder In Objective-C
Using Barcode Control SDK for iPhone Control to generate, create, read, scan barcode image in iPhone applications.
Printing PDF-417 2d Barcode In Objective-C
Using Barcode encoder for iPhone Control to generate, create PDF417 image in iPhone applications.
If what you want to do is call a specific function, you need to use a slightly more complex method, and there are many different options available The easiest method is to use the perl_call_argv function, which calls a specified function with an array of string arguments, as in this example:
PDF-417 2d Barcode Decoder In Objective-C
Using Barcode recognizer for iPhone Control to read, scan read, scan image in iPhone applications.
Create Barcode In Objective-C
Using Barcode maker for iPhone Control to generate, create bar code image in iPhone applications.
#include <EXTERNh> #include <perlh>
Generate PDF 417 In Visual C#
Using Barcode encoder for .NET framework Control to generate, create PDF417 image in .NET framework applications.
Creating PDF-417 2d Barcode In VS .NET
Using Barcode creation for ASP.NET Control to generate, create PDF 417 image in ASP.NET applications.
-L/usr/local/lib /usr/local/lib/perl5/560/i86pc-solaris-thread-multi/auto/DynaLoader/DynaLoadera -L/usr/local/lib/perl5/560/i86pc-solaris-thread-multi/CORE -lperl -lsocket -lnsl -ldb -ldl -lm -lposix4 -lpthread -lc -lcrypt lsec -D_REENTRANT -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/local/lib/perl5/560/i86pc-solaris-thread-multi/CORE
Create PDF 417 In .NET
Using Barcode maker for .NET Control to generate, create PDF417 image in .NET framework applications.
PDF417 Creator In Visual Basic .NET
Using Barcode generation for Visual Studio .NET Control to generate, create PDF417 image in .NET applications.
AM FL Y
Printing Barcode In Objective-C
Using Barcode drawer for iPhone Control to generate, create bar code image in iPhone applications.
Make Barcode In Objective-C
Using Barcode printer for iPhone Control to generate, create barcode image in iPhone applications.
The embedded call to ExtUtils::Embed introduces all of the definitions, libraries, and header file locations for you so that the program will compile properly The exact output will depend on how your Perl was compiled the following sample was taken from a Solaris 8 x86 installation:
Data Matrix Printer In Objective-C
Using Barcode generator for iPhone Control to generate, create DataMatrix image in iPhone applications.
Encoding Bar Code In Objective-C
Using Barcode creation for iPhone Control to generate, create bar code image in iPhone applications.
20:
EAN-8 Supplement 5 Add-On Generation In Objective-C
Using Barcode creation for iPhone Control to generate, create EAN-8 Supplement 5 Add-On image in iPhone applications.
EAN13 Reader In Java
Using Barcode recognizer for Java Control to read, scan read, scan image in Java applications.
Extending and Embedding Perl
GTIN - 13 Decoder In VS .NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in Visual Studio .NET applications.
Barcode Encoder In .NET Framework
Using Barcode creation for .NET framework Control to generate, create barcode image in VS .NET applications.
static PerlInterpreter *my_perl; main(int argc, char **argv, char **env) { char *print_args[] = {"Hello ", "World!\n", NULL}; my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, argc, argv, env); perl_call_argv("print", G_DISCARD, print_args); perl_destruct(my_perl); perl_free(my_perl); }
DataMatrix Maker In Java
Using Barcode drawer for Android Control to generate, create ECC200 image in Android applications.
Print Data Matrix In None
Using Barcode creation for Excel Control to generate, create DataMatrix image in Microsoft Excel applications.
This calls the print function with the arguments supplied in print_args The G_DISCARD option to the perl_call_argv function indicates that you want to discard any values returned by the Perl function The list of possible C functions you can call is shown in Table 20-8
Encoding GS1-128 In .NET Framework
Using Barcode maker for ASP.NET Control to generate, create GS1 128 image in ASP.NET applications.
Code 128A Drawer In None
Using Barcode creation for Online Control to generate, create ANSI/AIM Code 128 image in Online applications.
DEVELOPING APPLICATIONS
Function
perl_call_argv(char *sub, I32 flags, char **argv) perl_call_va(char *sub, [char *type, arg,] * ["OUT",] [char *type, arg,] * NULL)
Description
This calls a subroutine, sub, using the flags (see Table 20-9, coming up), passing the arguments to the called functions specified in argv Calls the subroutine sub, passing the arguments supplied by the argument pairs type and arg, which specify the argument type and value If an argument "OUT" is seen, then all the arguments following that are taken to be return value pairs of type and variables Evaluates an arbitrary Perl statement, str, instead of calling a specific function The type and arg arguments are pairs of return argument types and values
perl_eval_va(char *str, [char *type, *arg], NULL)
Table 20-8
C Functions for Calling Perl Subroutines
Perl: The Complete Reference
You have already seen an example of the perl_call_argv function The equivalent in perl_eval_va would be
perl_eval_va("print (qw/Hello World!\n/)", NULL);
Note the use of qw to quote the individual arguments, thus saving you from quoting quotes You can do the same thing with perl_call_va:
perl_call_va("print","s","Hello","s","World!\n",NULL);
In all cases, the functions return the number of items returned by the Perl subroutine called, or -1 on error The possible values for the flags argument of perl_call_argv are listed in Table 20-9
Flag
G_SCALAR G_ARRAY G_DISCARD G_NOARGS
Description
Calls the Perl subroutine in a scalar context Calls the Perl subroutine in a list context Forces Perl to remove any information placed onto the stack by the Perl subroutine Indicates that you are not passing parameters to the subroutine you are calling This has the effect of not building or initializing the @_ array for the subroutine being called Calls the Perl subroutine in a void context, and removes any values placed onto the argument stack This places an eval{} around the subroutine call This enables a basic form of error checking around the subroutine you are calling, and also handles die calls accordingly You will have to examine the value of the $@ variable, just as you would within Perl, to ensure that the function executed correctly This flag is meant to be used in conjunction with the G_EVAL flag It indicates that the value of $@ should be updated and/or reset by code that executes after the eval{} block Setting this flag ensures that the contents of $@ contain the return status of the eval{} block
G_VOID G_EVAL
G_KEEPERR
Table 20-9
Execution Flags for Called Subroutines
20:
Extending and Embedding Perl
In all the cases so far, we have casually ignored any return values from the functions we have been calling Using the perl_call_argv or perl_call_va functions, you could take off the values returned by using the stack-manipulation functions that were covered at the start of this chapter That said, you could also put argument values onto the stack in the same way and use a different method of calling the Perl subroutine If you look at the following code, it s complete C source for calling a Perl function called add that adds two numbers together:
#include <EXTERNh> #include <perlh> static PerlInterpreter *my_perl; void perl_add(int a, int b) { int retval; dSP; ENTER; SAVETMPS; PUSHMARK(sp); XPUSHs(sv_2mortal(newSViv(a))); XPUSHs(sv_2mortal(newSViv(b))); PUTBACK; retval = perl_call_pv("add", G_SCALAR); SPAGAIN; if (retval == 1) printf("Returned: %d\n",POPi); PUTBACK; FREETMPS; LEAVE; } int main (int argc, char **Argv, char **env) { char *my_argv[] = { "", "addpl" }; my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, 2, my_argv, (char **)NULL); perl_add(35, 53); perl_destruct(my_perl); perl_free(my_perl); }
Copyright © OnBarcode.com . All rights reserved.