William Torrez Corea:
> How can I implement these two languages of programming in a program?
...

 If you use `cmd`, system() etc. in perl, you are in fact calling
 another program that might be written in some other language.

 The same is true, using fork() exec() system() etc. in c,
 you could run a perl program from c.

///

 You could use some interface library like 
http://www.swig.org/
 to call whatever code from your c code.

///

 Not really what you asked for, but you can use one program to
 generate code for another program. E.g.
https://aspodata.se/git/c/libaspoutil/get_signames.pl
 extracts signal names from an include file and generates
 c code used to make it easier to convert a string like
 "SIGHUP" to the integer 1 and vice versa.

$ get_signames.pl signal.h 

#ifndef NSIG
#define NSIG 31
#endif

struct intstr signames[] = {
  INTSTR(SIGHUP),       /* 1 */
  INTSTR(SIGINT),       /* 2 */
  INTSTR(SIGQUIT),      /* 3 */
  INTSTR(SIGILL),       /* 4 */
  INTSTR(SIGTRAP),      /* 5 */
  INTSTR(SIGABRT),      /* 6 */
  INTSTR(SIGBUS),       /* 7 */
  INTSTR(SIGFPE),       /* 8 */
  INTSTR(SIGKILL),      /* 9 */
  INTSTR(SIGUSR1),      /* 10 */
  INTSTR(SIGSEGV),      /* 11 */
  INTSTR(SIGUSR2),      /* 12 */
  INTSTR(SIGPIPE),      /* 13 */
  INTSTR(SIGALRM),      /* 14 */
  INTSTR(SIGTERM),      /* 15 */
  INTSTR(SIGSTKFLT),    /* 16 */
  INTSTR(SIGCHLD),      /* 17 */
  INTSTR(SIGCONT),      /* 18 */
  INTSTR(SIGSTOP),      /* 19 */
  INTSTR(SIGTSTP),      /* 20 */
  INTSTR(SIGTTIN),      /* 21 */
  INTSTR(SIGTTOU),      /* 22 */
  INTSTR(SIGURG),       /* 23 */
  INTSTR(SIGXCPU),      /* 24 */
  INTSTR(SIGXFSZ),      /* 25 */
  INTSTR(SIGVTALRM),    /* 26 */
  INTSTR(SIGPROF),      /* 27 */
  INTSTR(SIGWINCH),     /* 28 */
  INTSTR(SIGPOLL),      /* 29 */
  INTSTR(SIGPWR),       /* 30 */
  INTSTR(SIGSYS),       /* 31 */
};
$

Regards,
/Karl Hammar


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to