Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
Jython C API - jython.h

jython.h

Caricato da: Umberto
Scarica il programma completo

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. char jini[1000];
  5. char jycomand[1006];
  6. char jinicode[1000];
  7. char jyexe[1000];
  8. char jyfun[1000];
  9. char jfexe[1000];
  10. int jy_ini(){
  11.         FILE *fp = fopen("index.set","r");
  12.         fscanf(fp,"%s",jini);
  13.         fscanf(fp,"%s",jinicode);
  14.         fclose(fp);
  15.         return 0;
  16. }
  17. int jy_comand_exe(char jycom[]){
  18.         stpcpy(jycomand,"bash ");
  19.         strcat(jycomand,jini);
  20.         strcat(jycomand," -c \"");
  21.         strcat(jycomand,jycom);
  22.         strcat(jycomand,"\"");
  23.         system(jycomand);
  24.         return 0;
  25. }
  26. int jy_code_new(){
  27.         //printf("%s",jinicode);
  28.         FILE *fop = fopen(jinicode,"w");       
  29.         fprintf(fop,"");
  30.         fclose(fop);
  31.         return 0;
  32. }
  33. int jy_code_add(char code[]){
  34.         //printf("%s",jinicode);
  35.         FILE *fop = fopen(jinicode,"a");       
  36.         fprintf(fop,"%s",code);
  37.         fclose(fop);
  38.         return 0;
  39. }
  40. int jy_code_exe(char arg[]){
  41.         stpcpy(jyexe,"bash ");
  42.         strcat(jyexe,jini);
  43.         strcat(jyexe," ");
  44.         strcat(jyexe,jinicode);
  45.         strcat(jyexe," ");
  46.         strcat(jyexe,arg);
  47.         system(jyexe);
  48.         return 0;
  49. }
  50. int jy_run_mod(char mod[]){
  51.         stpcpy(jyexe,"bash ");
  52.         strcat(jyexe,jini);
  53.         strcat(jyexe," -m ");
  54.         strcat(jyexe,mod);
  55.         system(jyexe);
  56.         return 0;
  57. }
  58. int jy_run_class(char path[]){
  59.         stpcpy(jyexe,"bash ");
  60.         strcat(jyexe,jini);
  61.         strcat(jyexe," --boot ");
  62.         strcat(jyexe,path);
  63.         system(jyexe);
  64.         return 0;
  65. }
  66. int jy_run_console(){
  67.         stpcpy(jyexe,"bash ");
  68.         strcat(jyexe,jini);
  69.         system(jyexe);
  70.         return 0;
  71. }
  72. int jy_code_fun_new(char name[],char code[]){
  73.         stpcpy(jyfun,"def ");
  74.         strcat(jyfun,name);
  75.         strcat(jyfun,"() :\n      ");
  76.         strcat(jyfun,code);
  77.         FILE *fop = fopen(jinicode,"a");       
  78.         fprintf(fop,"%s",jyfun);
  79.         fclose(fop);   
  80.         return 0;
  81. }
  82. int jy_code_fun_call(char name[],char arg[]){
  83.         strcat(jfexe,name);
  84.         strcat(jfexe," (");
  85.         strcat(jfexe,arg);
  86.         strcat(jfexe," )");
  87.         FILE *fop = fopen(jinicode,"a");       
  88.         fprintf(fop,"%s",jfexe);
  89.         fclose(fop);   
  90.         return 0;
  91. }