├── A-1 ├── LT.txt ├── ST.txt ├── IM.txt ├── initial.txt └── pass1.java ├── A-2 ├── LT.txt ├── ST.txt ├── pass2.class ├── IM.txt ├── Output.txt ├── initial.txt └── pass2.java ├── A-3 ├── mnt.txt ├── adt.txt ├── mdt.txt ├── macro.class ├── Input.txt └── macro.java ├── A-4 ├── mnt.txt ├── adt.txt ├── mdt.txt ├── macro2.class ├── finput.txt ├── Input.txt └── macro2.java ├── B-3 ├── a1.txt └── line.l ├── C-1 ├── spos │ ├── A-1 │ │ ├── ST.txt │ │ ├── LT.txt │ │ ├── IM.txt │ │ ├── initial.txt │ │ └── pass1.java │ ├── A-2 │ │ ├── ST.txt │ │ ├── LT.txt │ │ ├── pass2.class │ │ ├── IM.txt │ │ ├── Output.txt │ │ ├── initial.txt │ │ └── pass2.java │ ├── A-3 │ │ ├── mnt.txt │ │ ├── adt.txt │ │ ├── mdt.txt │ │ ├── macro.class │ │ ├── Input.txt │ │ └── macro.java │ ├── A-4 │ │ ├── mnt.txt │ │ ├── adt.txt │ │ ├── mdt.txt │ │ ├── macro2.class │ │ ├── finput.txt │ │ ├── Input.txt │ │ └── macro2.java │ ├── B-3 │ │ ├── a1.txt │ │ └── line.l │ ├── B-2 │ │ ├── jk1.txt │ │ └── counter2.l │ ├── B-4 │ │ ├── var1.l │ │ └── var1.y │ ├── B-1 │ │ ├── helloJNI.java │ │ ├── helloJNI.c │ │ └── helloJNI.h │ └── C-1 │ │ ├── fcfs.java │ │ ├── sjf.java │ │ ├── priority.java │ │ └── robbin.java ├── fcfs.java ├── sjf.java ├── priority.java └── robbin.java ├── README.md ├── B-2 ├── jk1.txt └── counter2.l ├── B-4 ├── var1.l └── var1.y └── B-1 ├── helloJNI.java ├── helloJNI.c └── helloJNI.h /A-1/LT.txt: -------------------------------------------------------------------------------- 1 | 0 =2 110 2 | 1 =3 111 3 | -------------------------------------------------------------------------------- /A-1/ST.txt: -------------------------------------------------------------------------------- 1 | 0 A 106 2 | 1 B 107 3 | -------------------------------------------------------------------------------- /A-2/LT.txt: -------------------------------------------------------------------------------- 1 | 0 =2 110 2 | 1 =3 111 3 | -------------------------------------------------------------------------------- /A-2/ST.txt: -------------------------------------------------------------------------------- 1 | 0 A 106 2 | 1 B 107 3 | -------------------------------------------------------------------------------- /A-3/mnt.txt: -------------------------------------------------------------------------------- 1 | INCR1 1 2 | INCR2 5 3 | -------------------------------------------------------------------------------- /A-4/mnt.txt: -------------------------------------------------------------------------------- 1 | INCR1 1 2 | INCR2 5 3 | -------------------------------------------------------------------------------- /B-3/a1.txt: -------------------------------------------------------------------------------- 1 | hi 2 | how are you 3 | 4 | -------------------------------------------------------------------------------- /C-1/spos/A-1/ST.txt: -------------------------------------------------------------------------------- 1 | 0 A 106 2 | 1 B 107 3 | -------------------------------------------------------------------------------- /C-1/spos/A-2/ST.txt: -------------------------------------------------------------------------------- 1 | 0 A 106 2 | 1 B 107 3 | -------------------------------------------------------------------------------- /C-1/spos/A-1/LT.txt: -------------------------------------------------------------------------------- 1 | 0 =2 110 2 | 1 =3 111 3 | -------------------------------------------------------------------------------- /C-1/spos/A-2/LT.txt: -------------------------------------------------------------------------------- 1 | 0 =2 110 2 | 1 =3 111 3 | -------------------------------------------------------------------------------- /C-1/spos/A-3/mnt.txt: -------------------------------------------------------------------------------- 1 | INCR1 1 2 | INCR2 5 3 | -------------------------------------------------------------------------------- /C-1/spos/A-4/mnt.txt: -------------------------------------------------------------------------------- 1 | INCR1 1 2 | INCR2 5 3 | -------------------------------------------------------------------------------- /C-1/spos/B-3/a1.txt: -------------------------------------------------------------------------------- 1 | hi 2 | how are you 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SPOSL 2 | SPPU TE COMP 2015 : All Assignments 3 | -------------------------------------------------------------------------------- /A-3/adt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | &FIRST 3 | &SECOND 4 | INCR2 5 | &ARG1 6 | &ARG2 7 | -------------------------------------------------------------------------------- /A-4/adt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | &FIRST 3 | &SECOND 4 | INCR2 5 | &ARG1 6 | &ARG2 7 | -------------------------------------------------------------------------------- /C-1/spos/A-3/adt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | &FIRST 3 | &SECOND 4 | INCR2 5 | &ARG1 6 | &ARG2 7 | -------------------------------------------------------------------------------- /C-1/spos/A-4/adt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | &FIRST 3 | &SECOND 4 | INCR2 5 | &ARG1 6 | &ARG2 7 | -------------------------------------------------------------------------------- /A-3/mdt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | ADD AREG AR0 3 | LDA BREG AR1 4 | MEND 5 | INCR2 6 | MOV CREG AR2 7 | SUB DREG AR3 8 | MEND 9 | -------------------------------------------------------------------------------- /A-4/mdt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | ADD AREG AR0 3 | LDA BREG AR1 4 | MEND 5 | INCR2 6 | MOV CREG AR2 7 | SUB DREG AR3 8 | MEND 9 | -------------------------------------------------------------------------------- /A-2/pass2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/A-2/pass2.class -------------------------------------------------------------------------------- /A-3/macro.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/A-3/macro.class -------------------------------------------------------------------------------- /C-1/spos/A-3/mdt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | ADD AREG AR0 3 | LDA BREG AR1 4 | MEND 5 | INCR2 6 | MOV CREG AR2 7 | SUB DREG AR3 8 | MEND 9 | -------------------------------------------------------------------------------- /C-1/spos/A-4/mdt.txt: -------------------------------------------------------------------------------- 1 | INCR1 2 | ADD AREG AR0 3 | LDA BREG AR1 4 | MEND 5 | INCR2 6 | MOV CREG AR2 7 | SUB DREG AR3 8 | MEND 9 | -------------------------------------------------------------------------------- /A-4/macro2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/A-4/macro2.class -------------------------------------------------------------------------------- /B-2/jk1.txt: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | class main 3 | { 4 | 5 | int a=2,b=4,c; 6 | c=a+b; 7 | System.out.println("hello" +c); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /C-1/spos/A-2/pass2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/C-1/spos/A-2/pass2.class -------------------------------------------------------------------------------- /C-1/spos/A-3/macro.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/C-1/spos/A-3/macro.class -------------------------------------------------------------------------------- /C-1/spos/A-4/macro2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ashishsalunkhe/System-Programming-and-Operating-Systems-Lab/master/C-1/spos/A-4/macro2.class -------------------------------------------------------------------------------- /A-1/IM.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 S0 3 | IS 4 2 S1 4 | IS 4 3 L0 5 | IS 4 4 L1 6 | IS 1 1 2 7 | IS 2 1 S0 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /A-2/IM.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 S0 3 | IS 4 2 S1 4 | IS 4 3 L0 5 | IS 4 4 L1 6 | IS 1 1 2 7 | IS 2 1 S0 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /A-2/Output.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 106 3 | IS 4 2 107 4 | IS 4 3 110 5 | IS 4 4 111 6 | IS 1 1 2 7 | IS 2 1 106 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /C-1/spos/B-2/jk1.txt: -------------------------------------------------------------------------------- 1 | import java.io.*; 2 | class main 3 | { 4 | 5 | int a=2,b=4,c; 6 | c=a+b; 7 | System.out.println("hello" +c); 8 | } 9 | 10 | -------------------------------------------------------------------------------- /C-1/spos/A-1/IM.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 S0 3 | IS 4 2 S1 4 | IS 4 3 L0 5 | IS 4 4 L1 6 | IS 1 1 2 7 | IS 2 1 S0 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /C-1/spos/A-2/IM.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 S0 3 | IS 4 2 S1 4 | IS 4 3 L0 5 | IS 4 4 L1 6 | IS 1 1 2 7 | IS 2 1 S0 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /A-1/initial.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | MOV CREG =2 5 | MOV DREG =3 6 | ADD AREG BREG 7 | SUB AREG A 8 | A DC 05 9 | B DS 03 10 | END 11 | -------------------------------------------------------------------------------- /A-2/initial.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | MOV CREG =2 5 | MOV DREG =3 6 | ADD AREG BREG 7 | SUB AREG A 8 | A DC 05 9 | B DS 03 10 | END 11 | -------------------------------------------------------------------------------- /C-1/spos/A-2/Output.txt: -------------------------------------------------------------------------------- 1 | AD 1 100 2 | IS 4 1 106 3 | IS 4 2 107 4 | IS 4 3 110 5 | IS 4 4 111 6 | IS 1 1 2 7 | IS 2 1 106 8 | A DL 1 9 | B DL 2 10 | AD 2 11 | -------------------------------------------------------------------------------- /C-1/spos/A-1/initial.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | MOV CREG =2 5 | MOV DREG =3 6 | ADD AREG BREG 7 | SUB AREG A 8 | A DC 05 9 | B DS 03 10 | END 11 | -------------------------------------------------------------------------------- /C-1/spos/A-2/initial.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | MOV CREG =2 5 | MOV DREG =3 6 | ADD AREG BREG 7 | SUB AREG A 8 | A DC 05 9 | B DS 03 10 | END 11 | -------------------------------------------------------------------------------- /A-4/finput.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | ADD AREG AR0 5 | LDA BREG AR1 6 | MOV CREG =2 7 | MOV DREG =3 8 | ADD AREG BREG 9 | A DC 05 10 | B DS 03 11 | END 12 | -------------------------------------------------------------------------------- /C-1/spos/A-4/finput.txt: -------------------------------------------------------------------------------- 1 | START 100 2 | MOV AREG A 3 | MOV BREG B 4 | ADD AREG AR0 5 | LDA BREG AR1 6 | MOV CREG =2 7 | MOV DREG =3 8 | ADD AREG BREG 9 | A DC 05 10 | B DS 03 11 | END 12 | -------------------------------------------------------------------------------- /A-3/Input.txt: -------------------------------------------------------------------------------- 1 | MACRO INCR1 &FIRST,&SECOND 2 | ADD AREG &FIRST 3 | LDA BREG &SECOND 4 | MEND 5 | MACRO INCR2 &ARG1,&ARG2 6 | MOV CREG &ARG1 7 | SUB DREG &ARG2 8 | MEND 9 | START 100 10 | MOV AREG A 11 | MOV BREG B 12 | INCR1 13 | MOV CREG =2 14 | MOV DREG =3 15 | ADD AREG BREG 16 | A DC 05 17 | B DS 03 18 | END 19 | -------------------------------------------------------------------------------- /A-4/Input.txt: -------------------------------------------------------------------------------- 1 | MACRO INCR1 &FIRST,&SECOND 2 | ADD AREG &FIRST 3 | LDA BREG &SECOND 4 | MEND 5 | MACRO INCR2 &ARG1,&ARG2 6 | MOV CREG &ARG1 7 | SUB DREG &ARG2 8 | MEND 9 | START 100 10 | MOV AREG A 11 | MOV BREG B 12 | INCR1 13 | MOV CREG =2 14 | MOV DREG =3 15 | ADD AREG BREG 16 | A DC 05 17 | B DS 03 18 | END 19 | -------------------------------------------------------------------------------- /C-1/spos/A-3/Input.txt: -------------------------------------------------------------------------------- 1 | MACRO INCR1 &FIRST,&SECOND 2 | ADD AREG &FIRST 3 | LDA BREG &SECOND 4 | MEND 5 | MACRO INCR2 &ARG1,&ARG2 6 | MOV CREG &ARG1 7 | SUB DREG &ARG2 8 | MEND 9 | START 100 10 | MOV AREG A 11 | MOV BREG B 12 | INCR1 13 | MOV CREG =2 14 | MOV DREG =3 15 | ADD AREG BREG 16 | A DC 05 17 | B DS 03 18 | END 19 | -------------------------------------------------------------------------------- /C-1/spos/A-4/Input.txt: -------------------------------------------------------------------------------- 1 | MACRO INCR1 &FIRST,&SECOND 2 | ADD AREG &FIRST 3 | LDA BREG &SECOND 4 | MEND 5 | MACRO INCR2 &ARG1,&ARG2 6 | MOV CREG &ARG1 7 | SUB DREG &ARG2 8 | MEND 9 | START 100 10 | MOV AREG A 11 | MOV BREG B 12 | INCR1 13 | MOV CREG =2 14 | MOV DREG =3 15 | ADD AREG BREG 16 | A DC 05 17 | B DS 03 18 | END 19 | -------------------------------------------------------------------------------- /B-4/var1.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | void yyerror(char *); 4 | #include "y.tab.h" 5 | %} 6 | %% 7 | void|int|float|char return BUILTIN; 8 | , return COMMA; 9 | ; return SC; 10 | "\n" return NL; 11 | ")" return RP; 12 | "(" return LP; 13 | [a-zA-Z0-9]* return ID; 14 | %% 15 | 16 | int yywrap(void) { 17 | return 1; 18 | } 19 | -------------------------------------------------------------------------------- /C-1/spos/B-4/var1.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | void yyerror(char *); 4 | #include "y.tab.h" 5 | %} 6 | %% 7 | void|int|float|char return BUILTIN; 8 | , return COMMA; 9 | ; return SC; 10 | "\n" return NL; 11 | ")" return RP; 12 | "(" return LP; 13 | [a-zA-Z0-9]* return ID; 14 | %% 15 | 16 | int yywrap(void) { 17 | return 1; 18 | } 19 | -------------------------------------------------------------------------------- /B-4/var1.y: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | int yylex(void); 4 | void yyerror(char *); 5 | %} 6 | %token COMMA ID BUILTIN SC NL RP LP 7 | %% 8 | var:FUNCT SC NL {printf("VAlid declaration");} 9 | | 10 | ; 11 | FUNCT: FUNCT COMMA ID|FUNCT COMMA BUILTIN|BUILTIN ID|LP FUNCT RP|ID 12 | ; 13 | %% 14 | 15 | 16 | int main(){ yyparse(); return 0;} 17 | void yyerror(char *s) 18 | { 19 | printf(" "); 20 | } 21 | -------------------------------------------------------------------------------- /C-1/spos/B-4/var1.y: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | int yylex(void); 4 | void yyerror(char *); 5 | %} 6 | %token COMMA ID BUILTIN SC NL RP LP 7 | %% 8 | var:FUNCT SC NL {printf("VAlid declaration");} 9 | | 10 | ; 11 | FUNCT: FUNCT COMMA ID|FUNCT COMMA BUILTIN|BUILTIN ID|LP FUNCT RP|ID 12 | ; 13 | %% 14 | 15 | 16 | int main(){ yyparse(); return 0;} 17 | void yyerror(char *s) 18 | { 19 | printf(" "); 20 | } 21 | -------------------------------------------------------------------------------- /B-1/helloJNI.java: -------------------------------------------------------------------------------- 1 | public class helloJNI{ 2 | static{ 3 | System.loadLibrary("hello"); 4 | 5 | } 6 | private native int cal(int a,int b); 7 | private native int sub(int a,int b); 8 | private native int mul(int a,int b); 9 | private native int div(int a,int b); 10 | 11 | public static void main(String[] args) 12 | { 13 | System.out.println("Addition is:"+new helloJNI().cal(5,10)); 14 | 15 | System.out.println("Subtraction is:"+new helloJNI().sub(5,10)); 16 | 17 | System.out.println("Multiplication is:"+new helloJNI().mul(5,10)); 18 | 19 | System.out.println("Division is:"+new helloJNI().div(5,10)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /C-1/spos/B-1/helloJNI.java: -------------------------------------------------------------------------------- 1 | public class helloJNI{ 2 | static{ 3 | System.loadLibrary("hello"); 4 | 5 | } 6 | private native int cal(int a,int b); 7 | private native int sub(int a,int b); 8 | private native int mul(int a,int b); 9 | private native int div(int a,int b); 10 | 11 | public static void main(String[] args) 12 | { 13 | System.out.println("Addition is:"+new helloJNI().cal(5,10)); 14 | 15 | System.out.println("Subtraction is:"+new helloJNI().sub(5,10)); 16 | 17 | System.out.println("Multiplication is:"+new helloJNI().mul(5,10)); 18 | 19 | System.out.println("Division is:"+new helloJNI().div(5,10)); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /B-3/line.l: -------------------------------------------------------------------------------- 1 | 2 | 3 | %{ 4 | int line=0,word=0,ch=0,space=0; 5 | %} 6 | %% 7 | \n {line++;} 8 | [^ \t\n]+ {word++;ch=ch+yyleng;} 9 | [ ]+ {space++;} 10 | %% 11 | int main(int argc,char **argv) 12 | { 13 | FILE *fp; 14 | fp=fopen(argv[1],"r"); 15 | yyin=fp; 16 | yylex(); 17 | printf("\nno of lines %d",line); 18 | printf("\nno of words %d",word); 19 | printf("\nno of characters %d",ch); 20 | printf("\nno of spaces %d",space); 21 | } 22 | int yywrap() 23 | { 24 | return 1; 25 | } 26 | /* 27 | OUTPUT: 28 | jameer@ubuntu:~$ lex exp1/exp.l 29 | jameer@ubuntu:~$ gcc lex.yy.c 30 | jameer@ubuntu:~$ ./a.out exp1/a1.txt 31 | 32 | no of lines 10 33 | no of words 19 34 | no of characters 137 35 | no of spaces 9 36 | jameer@ubuntu:~$ 37 | */ 38 | 39 | -------------------------------------------------------------------------------- /C-1/spos/B-3/line.l: -------------------------------------------------------------------------------- 1 | 2 | 3 | %{ 4 | int line=0,word=0,ch=0,space=0; 5 | %} 6 | %% 7 | \n {line++;} 8 | [^ \t\n]+ {word++;ch=ch+yyleng;} 9 | [ ]+ {space++;} 10 | %% 11 | int main(int argc,char **argv) 12 | { 13 | FILE *fp; 14 | fp=fopen(argv[1],"r"); 15 | yyin=fp; 16 | yylex(); 17 | printf("\nno of lines %d",line); 18 | printf("\nno of words %d",word); 19 | printf("\nno of characters %d",ch); 20 | printf("\nno of spaces %d",space); 21 | } 22 | int yywrap() 23 | { 24 | return 1; 25 | } 26 | /* 27 | OUTPUT: 28 | jameer@ubuntu:~$ lex exp1/exp.l 29 | jameer@ubuntu:~$ gcc lex.yy.c 30 | jameer@ubuntu:~$ ./a.out exp1/a1.txt 31 | 32 | no of lines 10 33 | no of words 19 34 | no of characters 137 35 | no of spaces 9 36 | jameer@ubuntu:~$ 37 | */ 38 | 39 | -------------------------------------------------------------------------------- /B-1/helloJNI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "helloJNI.h" 4 | 5 | // Implementation of native method sayHello() of HelloJNI class 6 | JNIEXPORT jint JNICALL Java_helloJNI_cal(JNIEnv * en, jobject this, jint n, jint m) 7 | 8 | { jint res; 9 | res=n+m; 10 | 11 | return res; 12 | } 13 | JNIEXPORT jint JNICALL Java_helloJNI_sub(JNIEnv * en, jobject this, jint n, jint m) 14 | 15 | { jint res1; 16 | res1=n-m; 17 | 18 | return res1; 19 | } 20 | JNIEXPORT jint JNICALL Java_helloJNI_mul(JNIEnv * en, jobject this, jint n, jint m) 21 | 22 | { jint res2; 23 | res2=n*m; 24 | 25 | return res2; 26 | } 27 | JNIEXPORT jint JNICALL Java_helloJNI_div(JNIEnv * en, jobject this, jint n, jint m) 28 | 29 | { jint res3; 30 | res3=n/m; 31 | 32 | return res3; 33 | } -------------------------------------------------------------------------------- /C-1/spos/B-1/helloJNI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "helloJNI.h" 4 | 5 | // Implementation of native method sayHello() of HelloJNI class 6 | JNIEXPORT jint JNICALL Java_helloJNI_cal(JNIEnv * en, jobject this, jint n, jint m) 7 | 8 | { jint res; 9 | res=n+m; 10 | 11 | return res; 12 | } 13 | JNIEXPORT jint JNICALL Java_helloJNI_sub(JNIEnv * en, jobject this, jint n, jint m) 14 | 15 | { jint res1; 16 | res1=n-m; 17 | 18 | return res1; 19 | } 20 | JNIEXPORT jint JNICALL Java_helloJNI_mul(JNIEnv * en, jobject this, jint n, jint m) 21 | 22 | { jint res2; 23 | res2=n*m; 24 | 25 | return res2; 26 | } 27 | JNIEXPORT jint JNICALL Java_helloJNI_div(JNIEnv * en, jobject this, jint n, jint m) 28 | 29 | { jint res3; 30 | res3=n/m; 31 | 32 | return res3; 33 | } -------------------------------------------------------------------------------- /B-1/helloJNI.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class helloJNI */ 4 | 5 | #ifndef _Included_helloJNI 6 | #define _Included_helloJNI 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: helloJNI 12 | * Method: cal 13 | * Signature: (II)I 14 | */ 15 | JNIEXPORT jint JNICALL Java_helloJNI_cal 16 | (JNIEnv *, jobject, jint, jint); 17 | 18 | /* 19 | * Class: helloJNI 20 | * Method: sub 21 | * Signature: (II)I 22 | */ 23 | JNIEXPORT jint JNICALL Java_helloJNI_sub 24 | (JNIEnv *, jobject, jint, jint); 25 | 26 | /* 27 | * Class: helloJNI 28 | * Method: mul 29 | * Signature: (II)I 30 | */ 31 | JNIEXPORT jint JNICALL Java_helloJNI_mul 32 | (JNIEnv *, jobject, jint, jint); 33 | 34 | /* 35 | * Class: helloJNI 36 | * Method: div 37 | * Signature: (II)I 38 | */ 39 | JNIEXPORT jint JNICALL Java_helloJNI_div 40 | (JNIEnv *, jobject, jint, jint); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /C-1/spos/B-1/helloJNI.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT THIS FILE - it is machine generated */ 2 | #include 3 | /* Header for class helloJNI */ 4 | 5 | #ifndef _Included_helloJNI 6 | #define _Included_helloJNI 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | /* 11 | * Class: helloJNI 12 | * Method: cal 13 | * Signature: (II)I 14 | */ 15 | JNIEXPORT jint JNICALL Java_helloJNI_cal 16 | (JNIEnv *, jobject, jint, jint); 17 | 18 | /* 19 | * Class: helloJNI 20 | * Method: sub 21 | * Signature: (II)I 22 | */ 23 | JNIEXPORT jint JNICALL Java_helloJNI_sub 24 | (JNIEnv *, jobject, jint, jint); 25 | 26 | /* 27 | * Class: helloJNI 28 | * Method: mul 29 | * Signature: (II)I 30 | */ 31 | JNIEXPORT jint JNICALL Java_helloJNI_mul 32 | (JNIEnv *, jobject, jint, jint); 33 | 34 | /* 35 | * Class: helloJNI 36 | * Method: div 37 | * Signature: (II)I 38 | */ 39 | JNIEXPORT jint JNICALL Java_helloJNI_div 40 | (JNIEnv *, jobject, jint, jint); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | #endif 46 | -------------------------------------------------------------------------------- /B-2/counter2.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | %} 4 | 5 | %% 6 | 7 | "++"|"--" {printf("\nincrement or decrement:%s",yytext);} 8 | 9 | import+" "+[a-zA-Z]*.+[a-zA-Z]*.+[a-zA-Z]*.+[a-zA-Z]*. {printf("\nit is a package:%s",yytext);} 10 | "class" { printf("\n start of program:%s",yytext);} 11 | do|while|switch|for { printf("\n loop statement:%s",yytext);} 12 | "System.out.println"|"System.out.print" {printf("\nprint statement:%s",yytext);} 13 | if|else {printf("\n loops:%s",yytext);} 14 | void|int {printf("\n it is return type:%s",yytext);} 15 | "scanner" {printf("\n this is package:%s",yytext);} 16 | try|catch {printf("\n exception handlers:%s",yytext);} 17 | main {printf("\n name of class:%s",yytext);} 18 | int|void|boolean|float|double {printf("\nthis are keywords:%s",yytext);} 19 | private|public|protected {printf("\nspecifier:%s",yytext);} 20 | "+"|"-"|"/"|"*"|"=" {printf("\nOperators:%s",yytext);} 21 | [0-9]* { printf("\nNumber:%s",yytext);} 22 | "("|")"|"{"|";"|"}" { printf("\n puntuation symbol:%s",yytext);} 23 | [a-zA-Z]+\_+[0-9A-Za-z]+ {printf("\nIdentifier:%s",yytext);} 24 | "*/" 25 | 26 | "//"[a-zA-Z0-9!@#.,:$%^&*()_+]*|"/*"[a-zA-Z0-9!@#$%^&*()_+]*"*/" {printf("\n%s is comment",yytext);} 27 | [a-zA-Z]+[_a-zA-Z0-9]* {printf("\nVariable:%s",yytext);} 28 | 29 | %% 30 | 31 | int main() 32 | { 33 | yyin= fopen("jk1.txt","r"); 34 | 35 | yylex(); 36 | 37 | 38 | 39 | 40 | return 0; 41 | } 42 | 43 | int yywrap() 44 | { 45 | return 1; 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /C-1/spos/B-2/counter2.l: -------------------------------------------------------------------------------- 1 | %{ 2 | #include 3 | %} 4 | 5 | %% 6 | 7 | "++"|"--" {printf("\nincrement or decrement:%s",yytext);} 8 | 9 | import+" "+[a-zA-Z]*.+[a-zA-Z]*.+[a-zA-Z]*.+[a-zA-Z]*. {printf("\nit is a package:%s",yytext);} 10 | "class" { printf("\n start of program:%s",yytext);} 11 | do|while|switch|for { printf("\n loop statement:%s",yytext);} 12 | "System.out.println"|"System.out.print" {printf("\nprint statement:%s",yytext);} 13 | if|else {printf("\n loops:%s",yytext);} 14 | void|int {printf("\n it is return type:%s",yytext);} 15 | "scanner" {printf("\n this is package:%s",yytext);} 16 | try|catch {printf("\n exception handlers:%s",yytext);} 17 | main {printf("\n name of class:%s",yytext);} 18 | int|void|boolean|float|double {printf("\nthis are keywords:%s",yytext);} 19 | private|public|protected {printf("\nspecifier:%s",yytext);} 20 | "+"|"-"|"/"|"*"|"=" {printf("\nOperators:%s",yytext);} 21 | [0-9]* { printf("\nNumber:%s",yytext);} 22 | "("|")"|"{"|";"|"}" { printf("\n puntuation symbol:%s",yytext);} 23 | [a-zA-Z]+\_+[0-9A-Za-z]+ {printf("\nIdentifier:%s",yytext);} 24 | "*/" 25 | 26 | "//"[a-zA-Z0-9!@#.,:$%^&*()_+]*|"/*"[a-zA-Z0-9!@#$%^&*()_+]*"*/" {printf("\n%s is comment",yytext);} 27 | [a-zA-Z]+[_a-zA-Z0-9]* {printf("\nVariable:%s",yytext);} 28 | 29 | %% 30 | 31 | int main() 32 | { 33 | yyin= fopen("jk1.txt","r"); 34 | 35 | yylex(); 36 | 37 | 38 | 39 | 40 | return 0; 41 | } 42 | 43 | int yywrap() 44 | { 45 | return 1; 46 | } 47 | 48 | 49 | -------------------------------------------------------------------------------- /C-1/fcfs.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | 4 | public class fcfs 5 | { 6 | 7 | public static void main(String args[]) 8 | { 9 | int n,sum=0; 10 | float total_tt=0,total_waiting=0; 11 | 12 | Scanner s=new Scanner(System.in); 13 | System.out.println("Enter Number Of Process U want 2 Execute---"); 14 | n=s.nextInt(); 15 | int arrival[]=new int[n]; 16 | int cpu[]=new int[n]; 17 | int finish[]=new int[n]; 18 | int turntt[]=new int[n]; 19 | int wait[]=new int[n]; 20 | int process[]=new int[n]; 21 | 22 | // int pro[][]=new int[3][3]; 23 | for(int i=0;icpu[j]) 38 | { 39 | int temp=cpu[i]; 40 | cpu[i]=cpu[j]; 41 | cpu[j]=temp; 42 | 43 | temp=arrival[i]; 44 | arrival[i]=arrival[j]; 45 | arrival[j]=temp; 46 | 47 | temp=process[i]; 48 | process[i]=process[j]; 49 | process[j]=temp; 50 | 51 | 52 | } 53 | } 54 | } 55 | 56 | for(int i=0;icpu[j]) 38 | { 39 | int temp=cpu[i]; 40 | cpu[i]=cpu[j]; 41 | cpu[j]=temp; 42 | 43 | temp=arrival[i]; 44 | arrival[i]=arrival[j]; 45 | arrival[j]=temp; 46 | 47 | temp=process[i]; 48 | process[i]=process[j]; 49 | process[j]=temp; 50 | 51 | 52 | } 53 | } 54 | } 55 | 56 | for(int i=0;ipri[j]) 42 | { 43 | int temp=cpu[i]; 44 | cpu[i]=cpu[j]; 45 | cpu[j]=temp; 46 | 47 | //temp=arrival[i]; 48 | //arrival[i]=arrival[j]; 49 | //arrival[j]=temp; 50 | 51 | temp=process[i]; 52 | process[i]=process[j]; 53 | process[j]=temp; 54 | 55 | temp=pri[i]; 56 | pri[i]=pri[j]; 57 | pri[j]=temp; 58 | 59 | 60 | } 61 | } 62 | } 63 | 64 | for(int i=0;ipri[j]) 42 | { 43 | int temp=cpu[i]; 44 | cpu[i]=cpu[j]; 45 | cpu[j]=temp; 46 | 47 | //temp=arrival[i]; 48 | //arrival[i]=arrival[j]; 49 | //arrival[j]=temp; 50 | 51 | temp=process[i]; 52 | process[i]=process[j]; 53 | process[j]=temp; 54 | 55 | temp=pri[i]; 56 | pri[i]=pri[j]; 57 | pri[j]=temp; 58 | 59 | 60 | } 61 | } 62 | } 63 | 64 | for(int i=0;i 0) 64 | { 65 | sum=sum+tv; 66 | finish[k]=sum; 67 | seq[k]=i; 68 | System.out.print(seq[k]+1+" "); 69 | 70 | k++; 71 | 72 | } 73 | } 74 | } 75 | System.out.println(); 76 | 77 | for(int i=0;i 0) 64 | { 65 | sum=sum+tv; 66 | finish[k]=sum; 67 | seq[k]=i; 68 | System.out.print(seq[k]+1+" "); 69 | 70 | k++; 71 | 72 | } 73 | } 74 | } 75 | System.out.println(); 76 | 77 | for(int i=0;i 0 && st.hasMoreTokens()) 35 | { 36 | p.print(t+" "); 37 | } 38 | 39 | else if(t.matches("\\d*")&& t.length() > 0 && !(st.hasMoreTokens())) 40 | { 41 | p.println(t); 42 | } 43 | else 44 | { 45 | br1=new BufferedReader(new FileReader("ST.txt")); 46 | br2=new BufferedReader(new FileReader("LT.txt")); 47 | if(t.charAt(0)=='S') 48 | { 49 | char a; 50 | int aa; 51 | a=t.charAt(1); 52 | aa = Character.getNumericValue(a); 53 | while((t1=br1.readLine())!=null) 54 | { 55 | StringTokenizer st1=new StringTokenizer(t1,"\t"); 56 | ss=st1.nextToken(); 57 | int index=Integer.parseInt(ss); 58 | if(index==aa) 59 | { 60 | pvalue=st1.nextToken(); 61 | address=st1.nextToken(); 62 | p.println(address); 63 | } 64 | } 65 | } 66 | else if(t.charAt(0)=='L') 67 | { 68 | char a; 69 | int aa; 70 | a=t.charAt(1); 71 | aa = Character.getNumericValue(a); 72 | while((t1=br2.readLine())!=null) 73 | { 74 | StringTokenizer st2=new StringTokenizer(t1,"\t"); 75 | ss=st2.nextToken(); 76 | int index=Integer.parseInt(ss); 77 | if(index==aa) 78 | { 79 | pvalue=st2.nextToken(); 80 | address=st2.nextToken(); 81 | p.println(address); 82 | } 83 | 84 | } 85 | } 86 | else 87 | { 88 | p.print(t+" "); 89 | } 90 | } 91 | 92 | 93 | 94 | } 95 | }p.close(); 96 | } 97 | catch(Exception e) 98 | { 99 | e.printStackTrace(); 100 | } 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /C-1/spos/A-2/pass2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | class pass2 4 | { 5 | public static void main(String args[]) 6 | { 7 | String value=null; 8 | BufferedReader br,br1,br2; 9 | 10 | String input=null; 11 | String t=null; 12 | String t1=null; 13 | String ss=null,ll=null; 14 | String pvalue,address; 15 | try 16 | { 17 | br=new BufferedReader(new FileReader("IM.txt")); 18 | File f=new File("Output.txt"); 19 | PrintWriter p=new PrintWriter(f); 20 | 21 | while((input=br.readLine())!=null) 22 | { 23 | 24 | 25 | StringTokenizer st=new StringTokenizer(input," "); 26 | while (st.hasMoreTokens()) 27 | { 28 | t=st.nextToken(); 29 | // System.out.println(t); 30 | if(t.equals("AD") || t.equals("IS") || t.equals("DL")) 31 | { 32 | p.print(t+" "); 33 | } 34 | else if(t.matches("\\d*")&& t.length() > 0 && st.hasMoreTokens()) 35 | { 36 | p.print(t+" "); 37 | } 38 | 39 | else if(t.matches("\\d*")&& t.length() > 0 && !(st.hasMoreTokens())) 40 | { 41 | p.println(t); 42 | } 43 | else 44 | { 45 | br1=new BufferedReader(new FileReader("ST.txt")); 46 | br2=new BufferedReader(new FileReader("LT.txt")); 47 | if(t.charAt(0)=='S') 48 | { 49 | char a; 50 | int aa; 51 | a=t.charAt(1); 52 | aa = Character.getNumericValue(a); 53 | while((t1=br1.readLine())!=null) 54 | { 55 | StringTokenizer st1=new StringTokenizer(t1,"\t"); 56 | ss=st1.nextToken(); 57 | int index=Integer.parseInt(ss); 58 | if(index==aa) 59 | { 60 | pvalue=st1.nextToken(); 61 | address=st1.nextToken(); 62 | p.println(address); 63 | } 64 | } 65 | } 66 | else if(t.charAt(0)=='L') 67 | { 68 | char a; 69 | int aa; 70 | a=t.charAt(1); 71 | aa = Character.getNumericValue(a); 72 | while((t1=br2.readLine())!=null) 73 | { 74 | StringTokenizer st2=new StringTokenizer(t1,"\t"); 75 | ss=st2.nextToken(); 76 | int index=Integer.parseInt(ss); 77 | if(index==aa) 78 | { 79 | pvalue=st2.nextToken(); 80 | address=st2.nextToken(); 81 | p.println(address); 82 | } 83 | 84 | } 85 | } 86 | else 87 | { 88 | p.print(t+" "); 89 | } 90 | } 91 | 92 | 93 | 94 | } 95 | }p.close(); 96 | } 97 | catch(Exception e) 98 | { 99 | e.printStackTrace(); 100 | } 101 | 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /A-1/pass1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | import java.io.*; 3 | public class pass1 4 | { 5 | static int address=0; 6 | static int sadd[]=new int[10]; 7 | static int ladd[]=new int[10]; 8 | public static void main(String args[]) 9 | { 10 | 11 | BufferedReader br; 12 | OutputStream oo; 13 | String input=null; 14 | 15 | String IS[]={"ADD","SUB","MUL","MOV"}; 16 | String UserReg[]={"AREG","BREG","CREG","DREG"}; 17 | String AD[]={"START","END"}; 18 | String DL[]={"DC","DS"}; 19 | int lc=0; 20 | int scount=0,lcount=0; 21 | int flag=0,flag2=0,stored=0; 22 | 23 | String tokens[]=new String[30]; 24 | String tt=null; 25 | 26 | String sv[]=new String[10]; 27 | String lv[]=new String[10]; 28 | 29 | 30 | 31 | 32 | 33 | try 34 | { 35 | br=new BufferedReader(new FileReader("initial.txt")); 36 | File f = new File("IM.txt"); 37 | File f1 = new File("ST.txt"); 38 | File f2 = new File("LT.txt"); 39 | PrintWriter p = new PrintWriter(f); 40 | PrintWriter p1 = new PrintWriter(f1); 41 | PrintWriter p2 = new PrintWriter(f2); 42 | int k=0,l=0; 43 | 44 | while ((input = br.readLine()) != null) 45 | { 46 | StringTokenizer st = new StringTokenizer(input," "); 47 | while (st.hasMoreTokens()) 48 | { 49 | tt=st.nextToken(); 50 | //System.out.println(tt); 51 | 52 | if(tt.matches("\\d*")&& tt.length() > 2) 53 | { 54 | lc=Integer.parseInt(tt); 55 | p.println(lc); 56 | address=lc-1; 57 | } 58 | else 59 | { 60 | for(int i=0;i 2) 53 | { 54 | lc=Integer.parseInt(tt); 55 | p.println(lc); 56 | address=lc-1; 57 | } 58 | else 59 | { 60 | for(int i=0;i