mr ribić samir, diplpeople.etf.unsa.ba/~samir.ribic/files/pssudzbenik3.doc · web viewprogramskom...

271
ELEKTROTEHNIČKI FAKULTET UNIVERZITETA U SARAJEVU mr Ribić Samir, dipl.el. ing PROJEKTOVANJE SISTEMSKOG SOFTVERA

Upload: others

Post on 02-Jan-2020

13 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

ELEKTROTEHNIČKI FAKULTETUNIVERZITETA U SARAJEVU

mr Ribić Samir, dipl.el. ing

PROJEKTOVANJE SISTEMSKOG

SOFTVERA

(radna skripta)(treće izdanje)

Sarajevo, 2005

Page 2: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

2

Page 3: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

31. VRSTE SISTEMSKOG SOFTVERA

Prije učenja razvoja sistemskog softvera potrebno je upoznati se sa osnovnim vrstama sistemskog softvera

1.1. Sistemski softverSistemski softver je svaki softver namijenjen za izvršenje aplikativnih programa, ali koji nije specifičan ni za jednu posebnu aplikaciju. Sistemski softver tipično uključuje operativne sisteme za kontrolu izvršenja programa, softver za korisničko okruženje kao što su interpretatori komandne linije, prozorski sistemi i desktopi, razvojne alate kao što su asembleri, kompajleri, linkeri biblioteke, interpreteri, generatori unakrsnih referenci, kontrolori verzija, make programi, debageri, profajleri i softver za praćenje te pomoćne alatke za sortiranje, štampanje i editovanje i mnogi drugi softver.

1.2. Sistemski softver za kontrolu izvršenja programa- Operativni sistemiOperativni sistem je softver koji kontroliše izvršenje računarskih programa i pruža pored toga različite servise.- BIOSi i ROM monitori Softver koji se obično nalazi u fiksnoj memoriji ROM i omogućuje minimalni rad računara zaključno sa učitavanjem operativnog sistema dijeli se na BIOSe i monitore. BIOS obično sadrži samo pasivne rutine koje operativni sistemi koriste i koje omogućuju rad sa osnovnim periferijskim uređajima, dok ROM monitori imaju i neke primitivne metode za interakciju s korisnicima.- LoaderiLoader (punilac) smješta korisnički program smješten na periferijskom uređaju u fizičku memoriju obavljajući pri tome relokaciju programa na odgovarajuće adrese i učitavanje dinamičkih biblioteka ako ih program koristi.- SimulatoriSimulator je mašina ili program koji simulira željeno okruženje (može biti drugi računar, hemijski proces, sociološki sistem ili bilo šta drugo) u svrhu učenja ili istraživanja.- EmulatoriSpecijalizovani simulator koji simulira drugu mašinu i arhitekturu u odnosu na onu na kojoj se izvršava omogućivši upotrebu gotovo svog softvera namijenjenog za drugu mašinu naziva se emulator.- DrajveriDrajver je program koji određuje kako će kompjuter komunicirati sa periferijskim uređajem u svrhu standardiziranog rada aplikativnih programa sa periferijskim uređajima.- DBMS ServeriProgrami koji brinu o centralizovanom čuvanju podataka u cilju brzog dobivanja podataka nazivaju se serveri za upravljanje bazom podataka (DataBase Management Server)- SpuleriVrše raspoređivanje slanja podataka na printere kako bi se izbjeglo miješanje podataka na papiru- Mrežni serveriProgrami koji omogućavaju pristup raznim vrstama informacija preko mreže

1.3. Softver za korisničko okruženje- Interpreteri komandne linijeInterpreter komandne linije je program koji čita tekstualne komande od strane korisnika ili iz datoteke i izvršava. Neke od ovih komandi se izvršavaju unutar samog interpretera, dok druge izazivaju startovanje drugih datoteka.- Grafički sistemi prozoraGrafički sistem prozora je softver koji omogućuje da se ekran radne stanice podijeli u pravougaona područja koja se ponašaju kao odvojeni ulazno/izlazni uređaji pod kontrolom različitih aplikativnih programa, što daje korisniku mogućnost da vidi izlaz iz različitih procesa istovremeno i odabere koji će primati ulaz, obično pokazavši na njega mišem.

1.4. Razvojni alati- AsembleriAsembleri prevode program u asemblerskom jeziku u mašinski jezik.- KompajleriKompajler dekodira instrukcije napisane u jeziku višeg nivoa i proizvodi program u asemblerskom ili mašinskom jeziku.- LinkeriLinkeri kombinuju jednu ili više datoteka koje sadrže objektni kod iz separatno prevedenih modula u jedinstvenu datoteku koja sadrži učitljiv ili izvršni kod. Ovaj proces zahtijeva razrješenje referenci među modulima i popravku informacija o relokaciji koje koristi jezgro operativnog sistema prilikom učitavanja datoteke u memoriju radi izvršenja programa koji je u njoj.- ParseriParseri su programi koji dijele kod u funkcionalne komponente. Obično su sastavni dio kompajlera.- Kompajler kompajleri

Page 4: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

4Kompajler kompajleri su alatke koje generišu izvorni kod parsera, interpretera ili kompajlera iz navedenog opisa jezika (obično u BNF formi)- DisasembleriDisasembleri prevode program u mašinskom jeziku u program u asemblerskom jeziku.- DekompajleriDekompajleri prevode program u mašinskom jeziku ili pseudomašinskom kodu u jezik visokog nivoa.- Kros asembleriKrosasembleri su asembleri koji se izvršavaju na drugoj vrsti računarske arhitekture od one čiji se mašinski kod generiše.- Kros kompajleriKrosakompajleri su kompajleri koji se izvršavaju na drugoj vrsti računarske arhitekture od one čiji se mašinski kod generiše.- InterpreteriInterpreteri su programi koji prevođenje izvornog jezika i izvršavanje prevedenog koda obavljaju u istom ciklusu obično obrađujući po jednu liniju u vremenu.- PseudokompajleriPseudokompajleri su varijanta kompajlera koja ne generiše pravi mašinski kod, nego pseudomašinski kod koji je nižeg nivoa od izvornog jezika, ali zahtijeva poseban interpreter za svoje izvršavanje.- PseudoasembleriPseudoasebmleri su varijanta asemblera koja ne generiše pravi mašinski kod, nego pseudomašinski kod koji je nižeg nivoa od izvornog jezika, ali zahtijeva poseban interpreter za svoje izvršavanje.- Profajleri i monitori performansiProfajleri mjere vrijeme provedeno u pojedinačnim dijelovima korisničkog programa u svrhu poboljšanja brzine aplikacije. Monitori performansi mjere zauzeće raznih vrsta resursa (procesora, memorije, diska, mreže...) u sistemu.- Generatori unakrsnih referenciGeneratori unakrsnih referenci prikazuju odnose između različitih procedura u različitim modulima.- Kontrolori verzijaDa bi se izbjegli konflikti između različitih programera koji rade nad istim datotekama izvornog koda, uvode se kontrolori verzija koji čuvaju centralizovano sve datoteke iz navedenog projekta uključivo i njihove ranije verzije.- Translatori izvornog kodaTranslatori izvornog koda prevode program napisan u jednom programskom jeziku višeg nivoa u drugi programski jezik višeg nivoa.- Generatori izvornog koda i CASE alatiGeneratori izvornog koda automatski generišu izvorni kod u višem programskom jeziku ili asemblerskom jeziku na bazi navedenih parametara. Integrisani sa softverom za projektovanje čine CASE alate (Computer Aided Software Engineering)- makeMake je program koji određuje, zavisno od vremena zadnje izmjene datoteka, da li je potrebno pokretati asemblere, kompajlere i linkere nad određenim datotekama.- DebageriDebageri su programi koji pomažu u lociranju i ispravci grešaka u programima. Mogu da prate programe na nivou izvornog i izvršnog koda- BibliotekeSkup potprograma namijenjenih programerima koji obavljaju određene funkcije

1.5. Pomoćne alatke- Editori Programi koji obavljaju funkcije uređivanja, modifikacije i brisanja podataka zovu se editori. Editori mogu biti specijalizovani za tekstualne ili binarne podatke. - SortiračiSortirači su programi za uređivanje podataka određenim redoslijedom- Backup programiBackup programi kopiraju podatke na pomoćni medij radi njihovog čuvanja u slučaju gubitka- Kriptografski programiKriptografski programi šifriraju podatke u nečitljiv oblik radi sprečavanja neovlaštene analize- Kompresioni programiKompresioni programi konvertuju podatke u formate koji zauzimaju manje memorijskih resursa- Mrežni klijentiMrežni klijenti koriste usluge mrežnih servera u svrhu prijema i obrade podataka

1.6. Rezime poglavljaNavedeno je dosta definicija različitih vrsta sistemskog softvera koji obuhvata softver za kontrolu izvršenja programa,

korisničko okruženje, razvojne i pomoćne alatke.

Page 5: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

52. PROCESOR I OPERATIVNI SISTEM ZA KOJE SE GENERIŠE KÔD

Intelov Pentium je danas apsolutno dominantan mikroprocesor, pa će se i u navedenim primjerima on koristiti u razvoju kompajlera. Slijedi upoznavanje sa najvažnijim registrima i instrukcijama ovog procesora:

2.1. Registri

Za aplikativne programe na mikroprocesorima 486 i Pentium bitni su sljedeći 32 bitni registri:

EAX, donjih 16 bita se zove AX, donjih 8 bita se zove AL

EBX, donjih 16 bita se zove BX, donjih 8 bita se zove BL

ECX, donjih 16 bita se zove CX, donjih 8 bita se zove CL

EDX, donjih 16 bita se zove DX, donjih 8 bita se zove DL

ESI, donjih 16 bita se zove SI

EDI, donjih 16 bita se zove DI

ESP, donjih 16 bita se zove SP

EBP, donjih 16 bita se zove BP

EFLAGS koji se sastoji od flegova (jednobitnih vrijednosti), od kojih su najvažniji:

CF – postavlja se na 1 ako se desio aritmetički prijenos,

ZF - postavlja se na 1 ako je rezultat operacije jednak 0,

DF – određuje da li će se registri SI i DI uvećavati ili umanjivati nakon svake instrukcije koje operišu sa memorijskim blokovima (MOVS, SCAS itd),

OF – postavlja se na 1 ako je rezultat operacije između dva predznačena broja broj netačnog predznaka,SF – postavlja se na 1 ako je rezultat operacije negativan broj

FP koprocesor posjeduje osam 128 bitnih registara koji su organizovani u formi kružnog bafera i zovu se ST(0), ST(1) , ST(2) , ST(3) , ST(4) , ST(5) , ST(6) , ST(7) .

2.2. Adresni režimi

Ako se u instrukciji navodi samo ime registra, tada se pristupa vrijednosti koju on sadrži, npr. INC EAX.

Navodi li se ime registra u uglastoj zagradi, uz eventualni pomak, npr.

MOV ESI,[EBP+12] , pristupa se vrijednosti koja se nalazi na adresi koju bi pokazivao navedeni registar kada bi bio uvećan za navedeni pomak. Ako je pomak jednak 0, tada se on ne navodi, npr. ADD ECX,[EBX]

Umjesto apsolutnih adresa, mogu se u asemblerskom kodu navoditi labele, npr.

MOV GLOBALV[20],EAX

Za distinkciju veličine varijable navode se modifikatori BYTE PTR, WORD PTR , DWORD PTR i QWORD PTR, koji predstavljaju 8, 16, 32 ili 64 bit.

Dekadne konstante se navode jednostavno, npr. MOV EDX,1221. Heksadekadne konstante imaju znak h naveden iza konstante. Ako instrukcije imaju dva operanda, rezultantni je obično prvi navedeni operand i on ne može biti konstanta. Nisu dopuštene ni instrukcije koje operišu između dvije memorijske lokacije. Moraju se u tim slučajevima koristiti registri za međurezultate.

2.3. Instrukcije

U tabeli na slici Sl. 2.3.1 dat je spisak korištenih instrukcija. Argumenti instrukcija su navedeni kao $C1 i $C2 i umjesto njih se navode imena registara ili memorijske lokacije kao u podpoglavlju 2.2.

Opšti oblik Opis Primjer

ADD $C1,$C2 Sabira $C1 sa $C2 i rezultat smješta u $C1 ADD EAX,[ESI]

AND $C1,$C2 Logički konjuguje bit po bit $C1 sa $C2 i rezultat smješta u $C1 AND SI,3

CALL $C1 Poziva potprogram na navedenoj adresi CALL PODPROGRAM

CDQ Predznačno proširuje EAX u EDX. Najviši bit registra EAX se kopira u sve bite registra EDX. CDQ

CLD Briše directional flag, potrebno za instrukcije blokova CLD

CMP $C1,$C2 Poredi $C1 sa $C2 i ažurira flegove CMP EAX,PODATAK[8]

Page 6: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

6FADD Sabira dva broja na vrhu FP steka i rezultat smješta na vrh FP steka umjesto njih FADD

FCHS Mijenja predznak broju na vrhu FP steka FCHS

FCOMPP Poredi dva broja na vrhu FP steka, briše ih, a postavlja flegove koprocesora FCOMPP

FDIVR Dijeli broj ispod vrha FP steka sa brojem na vrhu FP steka i rezultat stavlja umjesto njih FDIVR

FILD $C1 Cjelobrojnu vrijednost sa memorijske lokacije stavlja na vrh FP steka FILD DWORD PTR [EBX]

FINIT Inicijalizira matematički koprocesor FINIT

FISTP $C1 Vrijednost sa vrha FP steka konvertuje u cjelobrojnu i stavlja u navedenu memorijsku lokaciju

FISTP DWORD PTR [ESP]

FLD $C1 FP vrijednost iz memorije stavlja na vrh steka FLD QWORD PTR [EBP+2]

FMUL Množi dva broja na vrhu steka i rezultat smješta na vrh steka umjesto njih. FMUL

FSTP $C1 Vrijednost sa vrha FP steka stavlja u navedenu memorijsku lokaciju FSTP REZULTAT

FSTSW AX Flegove koprocesora prebacuje u AX registar FSTSW AX

FSUBR Od broja ispod vrha FP steka oduzme broj na vrhu FP steka i rezultat stavlja umjesto njih FSUBR

IDIV $C1 Predznačno dijeli 64 bitni broj čija je viša riječ u EDX a niža u EAX sa navedenim 32 bitnim registrom ili sadržajem memorijske lokacije, rezultat stavlja u EAX, ostatak u EDX

IDIV ECX

IMUL $C1 Predznačno množi EAX sa navedenim registrom. Viša riječ 64-bitnog rezultata je u EDX a niža u EAX

IMUL ECX

JMP $C1 Program nastavlja izvršavanje od adrese navedene. JMP LABELA2

JNE $C1 Skače na navedenu adresu ako Zero flag nije jednak 1 JNE NETACNO

LEA $C1,$C2 U registar $C1 se smješta adresa operanda $C2 LEA EAX,[ESI+5]

MOV $C1,$C2 U registar $C1 se smješta vrijednost operanda $C2 MOV ECX,EDI

MUL $C1 Nepredznačno množi EAX sa navedenim registrom. Viša riječ 64-bitnog rezultata je u EDX a niža u EAX

MUL ESI

NEG $C1 Mijenja predznak cijelog broja NEG EAX

NOT $C1 Logički invertuje sve bitove cijelog broja NOT DWORD PTR [EDI]OR $C1,$C2 Logička disjunkcija bit po bit $C1 sa $C2 i rezultat smješta u $C1 OR EAX,EDX

POP $C1 Sa adrese koju pokazuje ESP uzima vrijednost, smješta je u navedeni registar i uveća ESP za 4

POP ESI

PUSH $C1 Umanji ESP za 4 i na adresu koju pokazuje ESP smješta navedenu vrijednost PUSH EBP

REP MOVSB Prebacuje blok velik ECX bajtova sa adrese navedene u ESI na adresu koju pokazuje EDI REP MOVSB

RET $N1 Smjesti broj sa vrha steka u programski brojač, čime se vraća iz potprograma i uveća ESP za navedenu vrijednost

RET 8

SAHF Prebacuje bite iz AH u Flag registar SAHF

SAL EAX,$N1 Pomjera ulijevo EAX za navedeni broj bita SAL EAX,4

SETA AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETA AL

SETB AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETB AL

SETE AL Postavlja AL na 1 ako je ZF=1 , inače AL postaje 0 SETE AL

SETG AL Postavlja AL na 1 ako je SF<>OF, ZF=0, inače AL postaje 0 SETG AL

SETL AL Postavlja AL na 1 ako je SF =OF, ZF=0 , inače AL postaje 0 SETL AL

SETNE AL Postavlja AL na 1 ako je CF =1, ZF=0 , inače AL postaje 0 SETNE AL

SUB $C1,$C2 Oduzima $C2 od $C1 i rezultat smješta u $C1 SUB ECX,2

XOR $C1,$C2 Logička ekskluzivna disjunkcija $C1 sa $C2 i rezultat smješta u $C1 XOR EAX,8

Sl. 2.3.1. Instrukcije Intel Pentium korištene u generisanju koda

2.4. Operativni sistemOperativni sistem za koji se generiše kôd u kompajleru koji slijedi je 32 bitni Windows. Generisani programi su

predviđeni da rade na njegovim verzijama počevši od Windows 3.1 sa Win32s, Windows 95, 98, ME, NT (sve verzije – 3.1, 3.5, 3.51 i 4.0),Windows 2000 i Windows XP.

Generisani kôd je za korisnički režim rada i omogućava pozive izuzetno velikog broja sistemskih funkcija. Na ovaj način, jezik ima bogatu podršku u bibliotekama procedura. Sistemske funkcije se nalaze u dinamičkim DLL datotekama.

2.5. Rezime poglavljaIntelovi mikroprocesori 486 i Pentium imaju veliki broj instrukcija i umjeren broj registara. U ovom poglavlju su

navedene samo one instrukcije i adresni režimi koje su zaista korištene u generisanju asemblerskog koda. Generisani kôd je predviđen za korisnički režim rada pod operativnim sistemom Windows-32.

Page 7: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

73. UOBIČAJENI PRISTUPI U RAZVOJU KOMPAJLERA

Osoba zainteresovana za pisanje novog ili analizu postojećeg kompajlera, bilo opisanog u udžbenicima, bilo iz izvornog kôda, uglavnom ima na raspolaganju četiri pristupa:

Iterativni pristup

Primjena generatora koda

Analiza gotovog kompajlera

Crenshawova netehnička metoda

3.1. Iterativni pristupOvaj pristup je najčešće opisan u udžbenicima. Kompajler se dijeli na glavne cjeline: leksički analizator, sintaksni

analizator, semantički analizator, virtuelna mašina, generator koda, interpreter virtuelne mašine i optimizator koda. Cijeli programski jezik i kompajler se prethodno projektuju, a zatim se razvijaju cjeline navedene gornjim redoslijedom, uz objašnjenje teoretskih osnova parsiranja. Prednosti pristupa su

Ovaj pristup je vrlo sistematičan i uglavnom ne divergira od izvorne ideje kako bi konačna verzija jezika trebala da izgleda. Konačna verzija je najčešće podskup nekog klasičnog programskog jezika.

Pristup je primjenjiv za širok dijapazon kompajlera za razne programske jezike, ali i razvoj drugih sistemskih programa: interpretera, translatora, asemblera, uljepšivača izvornog koda, itd.

Mane pristupa su:

Nepogodan je za kratke kurseve. Ono čemu kompajler služi, generisanje koda, dolazi tek na kraju knjige ili kursa, pa je potrebno preći oko 150-200 strana ili gotovo cijeli semestar da bi cijela tema imala smisla.

Već u startu se operiše sa velikim listinzima, jer je odmah zamišljeno praćenje sintakse cijelog jezika.

Obično se generiše kôd za virtuelnu, a ne realnu mašinu. Virtuelne mašine zahtijevaju poseban interpreter (uz to nepreglednog) pseudo koda, što umanjuje kvalitet kompajlera (spor i odvojen od sistema prevedeni program). Te mašine su obično stek orijentisane, za razliku od realnih mašina koje su registarski orijentisane.

Realizacija pojedinih jezičkih koncepata nije u skladu sa njihovim prioritetima. Koncept slogova je manje bitan od koncepta cijelih brojeva, ali se ovim pristupom oba uče istovremeno.

3.2. Primjena generatora kodaVrlo su popularni programi koji se zovu kompajler-kompajleri. Ovi programi (LEX, YACC, Bison, COCO/R) iz

Bacus-Naurove forme generišu izvorni kôd leksičkog i sintaksnog analizatora koji se kasnije ručno proširuje. Prednosti ovog pristupa su:

Skraćeno vrijeme razvoja, jer su dvije faze kompajliranja, leksička i semantička analiza, korektno već urađene.

Prednosti iterativnog pristupa su zadržane.

Mane pristupa su:

Automatski generisani kôd može biti prilično nepregledan, pa je potrebno vrijeme za njegovo shvaćanje.

Upotrebom ovih alata se ne nauči kako se piše kompajler, nego kako se koriste ti alati.

Prevelika je razlika između veličine kompaktne BNF forme i generisanog sintaksnog analizatora nastalog iz te BNF forme.

Ostaje problem jezičkih koncepata različitog prioriteta.

3.3. Analiza gotovog kompajlera Mnogi kompajleri se mogu naći na Internetu sa kompletnim izvornim kodom, a često i propratnom knjigom koja

objašnjava rad kompajlera. Najpoznatiji takvi programi su GNU C i Small C. Izvorni kôd se može slobodno analizirati i modifikovati, mada se iz njega obično ne smiju praviti komercijalni kompajleri. Prednosti pristupa su:

Mnogi besplatni kompajleri predstavljaju pune implementacije programskih jezika po ISO ili ANSI standardima.

Page 8: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

8 Gotovi kompajleri su posebno upotrebljivi za brzi razvoj kros-kompajlera (koji generišu kôd za druge platforme) ili

popravak optimizatora koda.

Mane pristupa su:

Odštampani listinzi ovih kompajlera zauzimaju nekoliko stotina strana. Praćenje takvih listinga je izuzetno teško.

Veliki listing ne daje mnogo informacija o tome kojim putem je on nastao.

Ostaje problem jezičkih koncepata različitog prioriteta.

3.4. Crenshaw-ova netehnička metoda Ova metoda je predložena u seriji članaka na Internetu “Let’s build a compiler”, autora dr Jacka Crenshawa u

periodu 1988-1993. Kreće se sa daleko manjim ambicijama, npr. varijable su jednoslovne i nema ključnih riječi, ali se odmah ide u generisanje koda, dok se sam jezik postepeno razvija. Prednosti pristupa su:

Ako je vremenski faktor problem, čitalac može da odustane dosta rano, a da je ipak naučio suštinu procesa.

Jezički koncepti se uvode prema svom značaju.

Listinzi su u početku vrlo mali i jezgroviti (100-200 linija) a rastu dosta linearno.

Odmah se razvija kôd za realnu mašinu i to generisanjem preglednog asemblerskog koda umjesto nepreglednog mašinskog koda ili pseudokoda.

Mane pristupa su

Može doći do divergencije u razvoju. U originalnoj seriji članaka se to i dogodilo zbog zauzetosti autora i velikog vremenskog trajanja serije članaka, tako da serija nije dovedena do kraja, a tri puta se počinjalo iz početka.

Ponekad prelazak u narednu fazu implementacije nije moguć zbog koncepata koje je nametnula prethodna faza. Na primjer, ako je prethodna faza jezika definisala da se varijable deklarišu na određeni način, koji nije kompatibilan s tipom podataka planiranom za uvođenje u narednoj fazi, tada treba ili odustati od tog tipa ili nanovo napisati dio koda koji implementira deklaraciju varijabli.

Originalna metoda, ne podržava neke bitne elemente savremenih programskih jezika, kao što su slogovi, nizovi, višedimenzionalni nizovi i veze s operativnim sistemom.

Metoda ne podržava optimizaciju koda i oporavak od grešaka.

Pristup objašnjen u ovom radu je, u osnovi, Crenshaw-ov pristup, ali doveden do kraja, bez divergiranja, sa logičnim koracima iz faze u fazu, te sa originalnim programskim jezikom koji se razvija u fazama. Sam kompajler je pisan bez korištenja Crenshawov-og izvornog koda i pruža znatno veće mogućnosti.

3.5. Waterfall i spiralni pristup razvoju informacionih sistemaKlasične“waterfall” metodologije razvoja zasnivaju se na lancu: Analiza, Dizajn, Programiranje, Testiranje,

Održavanje, Napuštanje( Sl. 3.5.1),

Sl. 3.5.1. Klasični “Waterfall” pristup razvoju softvera

Spiralni pristupi (Sl. 3.5.2) podrazumijevaju da se ove faze obavljaju svaki put kada se razvija nova verzija programa, proizišla iz stare. Tako se razvija sve moćniji i moćniji softver. Geometrijska forma spirale vjerno predstavlja ovo širenje softvera.

AnalizaA

DizajnD Progra

mP

TestT Održav

aO

NapuštaN

Page 9: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

9

Sl. 3.5.2. Spiralni pristup u razvoju softvera

3.6. Programski jezik u kome se razvija kompajler Pošto je svrha razvoja kompajlera za FILDZAN-32 njegova primjena u nastavi, odlučeno je da se sam kompajler piše

u programskom jeziku Pascal. Ta odluka danas zvuči neobično, jer se sistemski softver obično piše u jezicima C ili C++, ali bitna prednost Pascala je u njegovoj preglednosti, što je od velike važnosti za nastavu. Treba reći da za Pascal već postoji mnogo dobrih komercijalnih i besplatnih kompajlera kao što su Delphi, Kylix, FreePascal, TurboPascal, Virtual Pascal 2 i P2C. Kompajler za FILDZAN-32 je napisan tako da se lako prevodi bilo kojim od navedenih Pascal-skih kompajlera.

3.7. Hardversko i softversko okruženje za koje se razvija kompajlerJedan od glavnih ciljeva ove metode je razvoj kompajlera koji generiše kôd za konkretno, a ne virtuelno okruženje. S

obzirom da na našem i svjetskom tržištu prevladavaju PC računari sa Intel 486 i Intel Pentium procesorima, izbor ovih mikroprocesora za generisanje koda je sasvim logičan. Ovi procesori uključuju i instrukcije za rad sa realnim brojevima.

Između dva vodeća operativna sistema za ove procesore, Windows i Linux, izabran je Windows kao, u ovom trenutku, popularniji. Potrebne modifikacije kompajlera da generiše kôd za Linux su male.

Očekuje se da će operativni sistemi bazirani na kompatibilnosti s Microsoft Windows platformama i Intelovim mikroprocesora biti aktuelni bar do 2010 godine.

3.8. Rezime poglavljaUobičajeni pristupi, koji se mogu naći u literaturi, za učenje razvoja kompajlera su iterativni pristup, analiza gotovih

kompajlera, primjena generatora koda i Crenshaw-ov netehnički pristup. Svi pristupi imaju svojih prednosti i nedostataka. Za kratke kurseve, koji trebaju da brzo daju konkretne rezultate najpogodniji je Crenshaw-ov pristup, ali je on često nepotpun. U ovom prikazu razvoja kompajlera je korištena unapređena Crenshawova metoda.

A D

PT

O

A D

P

T

OA

D

P T

O

Page 10: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

104. PROSTI ARITMETIČKI IZRAZI

Svaki programer koji je imao iskustva u radu s asemblerskim i višim programskim jezicima prvo uočava drastičnu razliku u pristupu računanju aritmetičkih izraza. U višim programskim jezicima se oponaša klasična forma matematičkih izraza, kakva je u upotrebi još od 18. vijeka. Ova forma je, doduše, prilagođena računarskim tastaturama (kosa crta umjesto razlomačke i zvjezdica umjesto podrazumijevanog množenja), ali su prioriteti računanja sačuvani. Unutar jednog izraza množenje ima prioritet nad sabiranjem, a zagrade nad ostalim operacijama.

4.1. Struktura tipičnih aritmetičkih izrazaAsemblerski jezici (ali i neki viši programski jezici kao što su FORTH, Lisp, Befunge i rane verzije COBOL-a), s

druge strane, imaju instrukcije za istovremeno obavljanje samo jedne aritmetičke operacije nad dva argumenta. Programer mora sam da odredi redoslijed izvršavanja ovakvih instrukcija da bi se dobio tačan rezultat izraza. Međurezultati se moraju čuvati u registrima, memorijskim lokacijama ili na steku. Koliko ovo može biti komplikovano, svjedoči činjenica da je značenje imena prvog višeg programskog jezika FORTRAN zapravo skraćenica od “prevodilac formula”.

Stoga se i u ovom pristupu razvoju kompajlera kreće od prevođenja aritmetičkog izraza sa prioritetima u asemblerski program.

Dva su uobičajena načina rješavanja ovog problema, nerekurzivni i rekurzivni. Nerekurzivni način podrazumijeva prevođenje iz aritmetičke (infiksne) u obrnutu poljsku notaciju (postfiksnu). U ovom radu je primijenjen rekurzivni način, jer on dovodi do kraćih listinga programa i konzistentniji je sa opisom sintakse jezika u proširenoj BNF formi ili sintaksnim dijagramima.

Nakon gledanja jednog tipičnog aritmetičkog izraza 2+3*4-8+(7-6*2) sa jednocifrenim brojevima, ali sa prioritetima i zagradama, uočavaju se cjeline prikazane na slici Sl. 4.1.1.

Sl. 4.1.1. Cjeline u aritmetičkom izrazu 2+3*4-8+(7-6*2)Pogledavši cjelinu C12 (cijeli izraz) uočava se da se izraz sastoji od jednog ili više članova razdvojenih

znakovima plus ili minus. Primjećuje se da i izraz C11 unutar zagrada ima istu strukturu.

Uočena struktura aritmetičkog izraza se predstavlja sintaksnim dijagramom na slici Sl. 4.1.2. Okruglim ili ovalnim znakovima predstavljaju se simboli koji se dalje ne razrađuju (terminalni) a četvrtastim oni simboli koji se razrađuju (neterminalni).

Izraz

Sl. 4.1.2. IzrazGledajući cjeline C1, C4, C5, i C11, te C10 i C9, uočava se da se član izraza sastoji od jednog ili više faktora,

razdvojenih zvjezdicom ili kosom crtom. Sam faktor je cifra ili, kao u cjelini C11, kompletan aritmetički izraz koji počinje otvorenom zagradom. Na slikama Sl. 4.1.3 i Sl. 4.1.4 prikazani su sintaksni dijagrami pojmova Član i Faktor.

Član

Sl. 4.1.3. Član

Član

+

-- Član

Faktor

/

*- Faktor

C1=2 C2=3 C3=4 C4=C2*C3C5=8 C6=7 C7=6

C8=2 C9=C7*C8 C10=7 C11=(C10-C9)

C12=C1+C4-C5+C11

Page 11: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

11Faktor

Sl. 4.1.4. Faktor

4.2. Sintaksna analiza aritmetičkih izrazaPrateći sintaksne dijagrame, lako je sintaksno analizirati izraze. Svaki od dijagrama može se izdvojiti u posebnu

Pascal-sku proceduru, ili predstaviti odgovarajućim pseudokodom. Čvorišta u sintaksnim dijagramima gdje se pojam razdvaja u više podslučaja se mapiraju u uslovna grananja u pseudokodu, a vraćanja na već pročitani simbol u dijagramu se mapiraju u petlje u pseudokodu. Stoga procedure Izraz , Faktor i Član izgledaju u pseudokodu kao na slici Sl. 4.2.1.

Sl. 4.2.1. Pseudokod: Izraz, Član, Faktor

4.3. Generisanje koda za računanje aritmetičke izrazeIntelovi 32 bitni procesori imaju umjeren broj procesorskih registara. Stoga, nije moguće cijeli aritmetički izraz

držati u registrima, ali ga nema smisla ni u potpunosti držati na steku ili memorijskim lokacijama. Pošto je prethodnim operacijama izraz razložen na njegove sastavne komponente, uglavnom se operiše sa glavnim registrom, EAX i pomoćnim registrom EBX. Trenutni međurezultat se uvijek čuva u registru EAX, u kome je i jedan od operanada. Drugi operand je u registru EBX.

Lako je prevesti faktor koji se sastoji od jedne konstante. Dovoljno je izvršiti odgovarajuću komandu MOV EAX,NN da se konstanta smjesti u registar EAX. Npr. konstanta 3 se prevodi u MOV EAX,3

Kada su u pitanju prevođenja izraza ili članova, na primjer, čuvanje u registrima postaje nedovoljno. Stoga se pri uočavanju sabiranja, oduzimanja, množenja ili dijeljenja, registar EAX mora sačuvati na steku, jer će poziv procedure za račun drugog operanda promijeniti sadržaj ovog registra. Po okončanju ove procedure, vrijednost sa steka se stavlja u EBX registar za komutativne operacije. Za nekomutativne operacije registar EAX se prebaci u EBX, a zatim vrijednost sa steka stavlja u EAX registar. Preostaje još da se obavi odgovarajuća ADD, SUB, IMUL ili IDIV instrukcija, čime registar EAX ponovo sadrži međurezultat.

Tako se sabiranje prevodi u

( Izraz )

0

1

9

Izraz:Pozovi ČlanSve dok je naredni simbol “+“ ili “- “ ,pozovi ČlanČlan:Pozovi FaktorSve dok je naredni simbol “*” ili “/“ , pozovi FaktorFaktor:Ako je naredni simbol cifra, faktor je u redu,Ako je naredni simbol “(“pozovi Izraz, zatim očekuj simbol “)”U ostalim slučajevima, prijavi grešku.

Pozovi ČlanSve dok slijedi znak sabiranja, generiši naredne instrukcije

PUSH EAXPozovi ČlanPOP EBXADD EAX,EBX

Page 12: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

12Pozivom procedure Član uvijek se dobija međurezultat u EAX. Instrukcijom POP EBX se u EBX registar smješta

vrijednost sa vrha steka. Ako se sa stekom pažljivo postupa, što će se raditi u cijelom procesu razvoja, na vrhu steka se nalazi sadržaj EAX registra nakon računanja prvog sabirka. Stoga će registar EBX imati vrijednost prvog sabirka, a registar EAX vrijednost drugog sabirka. Posljednjom instrukcijom dobija se zbir u registru EAX.

Kako je i množenje komutativno generisani kôd za množenje je sličan. IMUL instrukcija će uzgred pokvariti sadržaj EDX registra, ali se bitan dio međurezultata čuva u EAX registru.

Pozovi FaktorSve dok slijedi znak množenja, generiši naredne instrukcije

PUSH EAXPozovi FaktorPOP EBXIMUL EBX

Oduzimanje nije komutativno, pa se mora prvi operand smjestiti u EAX, a drugi u EBX. Stoga generisani kôd može izgledati ovako:

Pozovi ČlanSve dok slijedi znak oduzimanja, generiši naredne instrukcije

PUSH EAXPozovi ČlanMOV EBX,EAXPOP EAXSUB EAX,EBX

Dakle, instrukcijom MOV EBX,EAX u registar EBX smiješta se drugi operand, dok će instrukcija POP EAX pokupiti prvi operand sa steka.

Dijeljenje, pored toga što nije komutativno, zahtijeva da se u EDX nalazi predznačno proširen EAX registar, što se radi instrukcijom CDQ. Predznačno proširenje predstavlja kopiranje najvišeg bita EAX registra u sve bite EDX registra.

Pozovi FaktorSve dok slijedi znak dijeljenja, generiši naredne instrukcije

PUSH EAXPozovi FaktorMOV EBX,EAXPOP EAXCDQIDIV EBX

Nakon cijele rutine, registar EAX će sadržati količnik, a EDX ostatak pri dijeljenju.

4.4. Prva verzija kompajleraNakon analize strukture aritmetičkog izraza i pseudokoda za sintaksnu analizu dijelova izraza te generisanja

mašinskog koda, može se pristupiti pisanju prve verzije kompajlera u Pascalu. Na slici Sl. 4.4.1 data je prva verzija kompajlera, koji je prosti prevodilac prostog aritmetičkog izraza koji se unosi sa tastature i prikazuje na ekranu.

Page 13: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

13

Sl. 4.4.1. Prevodilac izraza

program Kompajler;var pozicija: integer; znak: char; linija: string;

procedure Emit(st: string);begin WriteLn(st);end;

procedure Novi;begin pozicija := pozicija + 1; if pozicija <= Length(linija) then znak := linija[pozicija] else Halt;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := ord(znak) - ord('0'); Novi; UzmiKonstantu := rezultat;end;

procedure Izraz; forward;

procedure Faktor;var rezultat: integer;

st: string;begin case znak of '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; Izraz; Novi; end else WriteLn('Greska'); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX');

Emit(' CDQ'); Emit(' IDIV EBX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; end; end;end;

begin pozicija := 0; ReadLn(linija); Novi; Izraz;end.

Iz listinga se uočava da pored procedura pored procedura Izraz, Clan i Faktor, koje su prikazane u pseudokodu postoje i procedure Emit, Novi i UzmiKonstantu. Procedura Emit je prosti ispis stringa na ekranu. Procedura Novi je najznačajnija procedura. Ona varijablu pozicija uvećava za 1 i zatim dohvati odgovarajući znak iz unesene linije u varijablu znak. Ta varijabla sadrži sljedeći simbol. Procedura UzmiKonstantu dohvata jednocifreni broj i koristeći funkciju ord dolazi do njegove numeričke vrijednosti.

4.5. Testni primjerSa tastature se unosi sljedeći izraz:

2+3*4-8+(7-6*2); Kada ovaj primjer prođe kroz kompajler, dobije se asemblerski listing na slici Sl. 4.5.1. (Zadnji simbol u primjeru može biti tačka-zarez, ali i bilo koji drugi jer se ignoriše). Uz asemblerski listing dat je komentar sadržaja registara i steka nakon izvršenja svake od instrukcija

MOV EAX,2 EAX=2, EBX=?, stek =() PUSH EAX EAX=2, EBX=?, stek =(2) MOV EAX,3 EAX=3, EBX=?, stek =(2) PUSH EAX EAX=3, EBX=?, stek =(3,2) MOV EAX,4 EAX=4, EBX=?, stek =(3,2) POP EBX EAX=4, EBX=3, stek =(2) IMUL EBX EAX=12, EBX=3, stek =(2) POP EBX EAX=12, EBX=2, stek =() ADD EAX,EBX EAX=14, EBX=2, stek =() PUSH EAX EAX=14, EBX=2, stek =(14) MOV EAX,8 EAX=8, EBX=2, stek =(14) MOV EBX,EAX EAX=8, EBX=8, stek =(14) POP EAX EAX=14, EBX=8, stek =() SUB EAX,EBX EAX=6, EBX=8, stek =()

PUSH EAX EAX=6, EBX=8, stek =(6) MOV EAX,7 EAX=7, EBX=8, stek =(6) PUSH EAX EAX=7, EBX=8, stek =(7,6) MOV EAX,6 EAX=6, EBX=8, stek =(7,6) PUSH EAX EAX=6, EBX=8, stek =(6,7,6) MOV EAX,2 EAX=2, EBX=8, stek =(6,7,6) POP EBX EAX=2, EBX=6, stek =(7,6) IMUL EBX EAX=12, EBX=6, stek =(7,6) MOV EBX,EAX EAX=12, EBX=12, stek =(7,6) POP EAX EAX=7, EBX=12, stek =(6) SUB EAX,EBX EAX=-5, EBX=12, stek =(6) POP EBX EAX=-5, EBX=6, stek =() ADD EAX,EBX EAX=1, EBX=6, stek =()

Sl. 4.5.1. Asemblerski listing prevedenog koda sa tokom izvršavanja

Dakle, kao rezultat izvršenja programa sa slike Sl. 4.5.1 dobiva se 1, što se slaže sa vrijednošću aritmetičkog izraza. Naravno da bi ručno pisani asemblerski program bio daleko kraći. No, računar gleda ulaz sekvencijalno i ne može odmah pojednostaviti program, jer ne vidi unaprijed da li je uopšte potrebno npr. sačuvati EAX registar. U ovom trenutku optimizacija koda ima niži prioritet jer se može i bez nje. Daleko je bitniji problem što su izrazi samo sa jednocifrenim brojevima, nema varijabli i kontrolnih struktura, niti unarnih operatora. No, najveći nedostatak sadašnje verzije kompajlera

Page 14: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

14je što ona prevodi samo jednu jedinu liniju sa tastature na ekran. Prevedeni kôd se još uvijek ne može asemblirati, i njegovo izvršavanje se simulira na papiru.

4.6. Rezime poglavljaRazvoj kompajlera kreće od prevodioca prostog aritmetičkog izraza. U strukturi jednog tipičnog aritmetičkog izraza

sa zagradama i prioritetima uočavaju se određene cjeline, Izraz, Član i Faktor koje se definišu sintaksnim dijagramima i realizuju odgovarajućim procedurama. U realizacija četiri osnovne aritmetičke operacije se koriste odgovarajuće instrukcije mikroprocesora, a međurezultati se uvijek čuvaju u EAX. Prva verzija kompajlera prevodi samo uneseni aritmetički izraz, s jednocifrenim brojevima sa tastature. Testni primjer za prvu verziju kompajlera je uspješan, no programski jezik u ovom trenutku nema nikakvih kontrolnih struktura, niti mogućnost prevođenja iz datoteka.

Page 15: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

155. PREVOĐENJE IZ DATOTEKA, BLOKOVI, VIŠECIFRENI BROJEVI

Prva verzija kompajlera prevodi samo jedan jedini aritmetički izraz u asemblerski jezik. Aritmetički izraz se ne može sačuvati na disku nego se svaki put mora ponovo unositi. Izlazne asemblerske naredbe se takođe ne mogu direktno proslijediti asembleru u cilju generisanja izvršnog koda.

5.1. Format instrukcijaDa bi se ovaj prevodilac mogao zvati kompajlerom višeg programskog jezika a ne prevodiocem jednog izraza,

neophodno je omogućiti da se izvorni kod iz jedne datoteke prevodi u asemblerski ili mašinski kod u drugoj datoteci. Iako postoje kompajleri koji sve rade u memoriji, ipak su oni koji prevode iz datoteke u datoteku neuporedivo upotrebljiviji. Pored ovoga, ulazni program treba da se sastoji od više naredbi ili aritmetičkih izraza, da bi se uopšte moglo govoriti o programu.

U ovom trenutku donosi se jedna ključna odluka u izboru koncepcije programskog jezika vezano za format pisanja njegovih naredbi. U praksi postoje tri takva formata. Bajtovski format (mašinski jezik, Befunge, Forth) definiše da jedna naredba zauzima jedan bajt ili svega nekoliko njih. Linijski format (asemblerski jezik, Fortran, BASIC, XBASE) određuje da se jedna naredba (ponekad i više od jedne) sadrži u jednoj liniji izvornog koda. Slobodni format (Pascal, Lisp, C, Java) dopušta da se naredbe pišu u više redova. Kako je slobodni format ujedno i najpraktičniji, bit će primijenjen i u programskom jeziku koji se sada razvija.

Odluka o izboru slobodnog formata povlači sljedeću odluku: Da li za oznake početka i kraja grupe naredbi koristiti ključne riječi (kao u Pascalu) ili simbole (kao u C-u). Prepoznavanje simbola je jednostavnije od prepoznavanja ključnih riječi, pa će ovaj jezik više podsjećati na C nego na Pascal, iako će kasnije imati elemenata i jednog i drugog jezika. Osim toga, ključne riječi će biti uvedene znatno kasnije.

5.2. BlokoviSkup naredbi se zove blok i uokviren je vitičastim zagradama. Ipak, iz praktičnih razloga prepoznavanja simbola, prva

vitičasta zagrada je sastavni dio drugih struktura. Iza svake naredbe unutar bloka se nalazi simbol tačka-zarez ( ;). Program se sastoji od vitičaste zagrade i jednog bloka. To se može predstaviti sintaksnim dijagramima na slikama Sl. 5.2.1 i Sl. 5.2.2.

Program:

Sl. 5.2.1. ProgramBlok

Sl. 5.2.2. BlokPseudokod za realizaciju bloka izgleda kao na slici Sl. 5.2.3

Sl. 5.2.3. Pseudokod, relizacija blokova

5.3. Modifikacije procedura kompajlera zbog prevođenja iz datoteke Procedura Novi treba da sada čita znakove iz ulazne datoteke, ignorišući blankove kao i neprintabilne znakove

(ASCII <32) i nove redove. Stoga je ona sada složenija. U pseudokodu procedura Novi izgleda ovako:

Sl. 5.3.1. Pseudokod, procedura Novi

Izraz ; }

{ Blok

Početak sekvenceUvećaj pokazivač unutar linije za 1Ako je pokazivač prešao kraj linije Uvećaj brojač linija za 1, učitaj novu liniju s

diska i pokazivač postavi na 1Varijabli znak dodijeli slovo linije na poziciji pokazivača. Ako je linija prazna,

dodijeli varijabli znak blankoPonavljaj sve dok je znak blanko ili neprintabilan, a nije kraj ulazne datoteke

Sve dok ne slijedi “}” izvrši Izraz i pokupi simbol “;”Pokupi simbol “}”

Page 16: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

16Procedura IdiDo ima kao argument karakter. Ona treba da prijavi grešku ukoliko znak koji slijedi iz ulazne datoteke

nije onaj koji je naveden kao argument ove procedure.

Procedura Greska čiji je argument string, prikazuje tekst greške na ekranu, zatvara datoteke i prekida izvršenje kompajlera. Ovo može zvučati prilično nepraktično, jer ovako dizajnirani kompajler prevodi samo do prve greške. Sa današnjim računarima i interaktivnim radom to ne mora biti problem, što dokazuje uspjeh Turbo Pascala koji je sve do svoje desete verzije (Delphi 2) potpuno zanemarivao oporavak od grešaka. Oporavak od grešaka zahtijeva dosta dodatnog koda što smanjuje razumljivost rada kompajlera.

Procedura Emit se nije mnogo izmijenila. Umjesto na ekran, izlaz se šalje u izlaznu datoteku.

5.4. Modifikacije kompajlera zbog generisanja datoteka sa asemblerskim kodomNije dovoljno samo prevedene aritmetičke izraze usmjeriti u datoteku. Dobijeni asemblerski program treba prevesti

nekim 32-bitnim asemblerom, kakvi su MASM, TASM ili NASM. Osim toga, mora postojati i određeni kôd da se program uspješno završi i vrati kontrolu operativnom sistemu. U programerskom žargonu taj dio koda se zove entry stub ili ulazni kôd i on izgleda kao na slici Sl. 5.4.1 . U suštini je ovim rečeno asembleru da generiše 32 bitni mašinski program, prilagođen Windows operativnom sistemu. Nakon generisanog programa se nalazi poziv rutine za završetak procesa i rezervisano mjesto za 26 varijabli.

Sl. 5.4.1. Entry stub – standardni asemblerski ulazni kôd Procedura Prevedi emituje ovaj ulazni kôd i poziva proceduru Blok. Procedura Prevedi se poziva iz procedure

Glavni, koja otvara ulaznu i izlaznu datoteku. Imena ovih datoteka se navode kao argumenti komandne linije prilikom poziva kompajlera koristeći, npr.:

KOMP32V2 PRIMJER.JEZ PRIMJER.ASM

Iako većina današnjih programa koristi menije umjesto komandne linije, zbog kratkoće programa i koncentracije na proces kompajliranja a ne na korisnički interfejs, ovaj kompajler je realizovan u formi komande iz komandne linije.

5.5. Proširenja aritmetičkih izraza

Napravljene su određene izmjene i u samim aritmetičkim izrazima. Najvažnije je što numeričke konstante nisu više jednocifrene. Dohvatanje konstante se može izvesti algoritmom sa slike Sl. 5.5.1

Sl. 5.5.1. Promijenjeni algoritam za dohvatanje konstanteLako je dodati operaciju ostatka pri dijeljenju koja se, u skladu sa konvencijom iz C-a, označava znakom %.

Dovoljno je obaviti operaciju dijeljenja i nakon nje izvršiti jedno

MOV AX,DX

Uzmi konstantuRezultat postavi na 0Sve dok je znak koji slijedi između 0 i 9 rezultat postavi na 10 * rezultat + vrijednost cifre znaka, pa uzmi novi znakAko je znak blanko dohvati novi

.386 .MODEL FLAT,STDCALL OPTION CASEMAP:NONE EXTRN ExitProcess@4:NEAR .CODE ULAZ: JMP GLAVNIGLAVNI: ..... generisani program ..... PUSH 0 CALL ExitProcess@4 .DATA GLOBALV DD 26 DUP(0) END ULAZ

Page 17: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

17U skladu sa uvođenjem operacije ostatka pri dijeljenju mijenja se sintaksa jezičkog pojma član i ona sada izgleda kao na slici Sl. 5.5.2. Nema potrebe pisati pseudokod, jer je modifikacija odgovarajuće procedure član trivijalna.

Član

Sl. 5.5.2. ČlanJezički pojam Faktor (čija je nova verzija prikazana na slici Sl. 5.5.3) i odgovarajuća procedura proširuju se unarnim minusom. Implementacija unarnog minusa rekurzivno poziva Faktor, a nakon tog pozva dodaje se naredba NEG EAX .

Faktor:

Sl. 5.5.3. FaktorU prilogu 2 na kraju rada dat je listing druge verzije kompajlera. Tamnijom bojom slova su označene izmjene u odnosu na prvu verziju.

5.6. Testni primjerNa slici Sl. 5.6.1 primjer malog programa. Treba kreirati datoteku ulaz2.jez sa sljedećim sadržajem:

{

2+3*8;

6*8*(4-2);

}

Sl. 5.6.1. Primjer za testiranje prve verzije kompajleraIza zadnje vitičaste zagrade potrebno je preći u novi red. Nakon kompajliranja ovog primjera sa

KOMP32V2 ULAZ2.JEZ ULAZ2.ASMdobije se asemblerski listing prikazan na slici Sl. 5.6.2:

.386

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: JMP GLAVNI;{; 2+3*8;GLAVNI: MOV EAX,2 PUSH EAX MOV EAX,3 PUSH EAX

MOV EAX,8 POP EBX IMUL EBX POP EBX ADD EAX,EBX; 6*8*(4-2); MOV EAX,6 PUSH EAX MOV EAX,8 POP EBX IMUL EBX PUSH EAX MOV EAX,4 PUSH EAX

MOV EAX,2 MOV EBX,EAX POP EAX SUB EAX,EBX POP EBX IMUL EBX;};} PUSH 0 CALL [email protected] DD 26 DUP(0)END ULAZ

Sl. 5.6.2. Asemblerski listing dobijen kompajleromPrilikom generisanja listinga dodano je da se linija izvornog koda šalje u asemblerski program kao komentar. Iza te

linije obično slijede asemblerske linije koje implementiraju navedenu liniju koda u višem programskom jeziku. Asemblerski listing još uvijek nije pravi mašinski program. Da bi se on preveo u mašinski program, treba pokrenuti asembler, na primjer Microsoftov MASM 6.14 komandom

ml /c /coff /Fl ulaz2.asm

Faktor

/

*-

Faktor

%

( Izraz )

Numerička konstanta

- Faktor

Page 18: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

18što znači da se prevodi bez linkovanja u Common object file format (coff) uz generisanje listinga. Kao rezultat ovog

asembliranja dobijaju se datoteke ulaz2.obj i ulaz2.lst. Datoteku u OBJ formatu sada treba povezati sa drugim takvim datotekama ili bibliotekama rutina koje se nalaze u LIB datotekama. To se radi programom koji se zove linker. Kao primjer uzima se Microsoftov LINK 5.12 i pokreće sa

link /defaultlib:kernel32.lib /subsystem:console ulaz2.objOvo znači da se ulaz2.obj povezuje sa bibliotekom funkcija kernel32.lib praveći ulaz2.exe Program ULAZ2.EXE

može se pokrenuti, neće pasti, nego se samo uspješno završava ne prikazujući ništa na ekranu. To je i za očekivati, pošto se rezultati izraza samo smještaju u AX po njihovom izvršenju. Program bi se eventualno mogao pratiti korak po korak koristeći debager.

Na slici Sl. 5.6.3 dati su izgled LST datoteke koja daje heksadekadni prikaz generisanog mašinskog koda uz odgovarajući asemblerski kôd, izgled objektne (OBJ) te izvršne (EXE) datoteke. Mnogi kompajleri direktno prevode u objektnu ili izvršnu datoteku. Formati OBJ i EXE datoteka su, međutim, dosta složeni, nepregledni i glomazni i njihov opis je izvan opsega ovog rada. No, poredeći prevedeni kôd u LST datoteci i posebno označene bajtove u OBJ i EXE datotekama na slici Sl. 5.6.3 prepoznaje se da je program korektno preveden u mašinski jezik. Ostatak datoteke OBJ sadrži tabele za relociranje u slučaju spajanja različitih modula. EXE datoteka, pored mašinskog koda testnog programa, sadrži i dio koda koji sprječava izvršavanje programa pod 16-bitnim MS DOS-om, spisak dinamičkih biblioteka i rutina iz njih koje se uvezuju sa korisničkim programom te relokacione tabele

.

Sl. 5.6.3. Izgled OBJ, LST i EXE datoteka

Turbo Dump Version 5.0.16.4 Copyright (c) 1988, 1998 Borland International Display of File ULAZ2.OBJ

000000: 4C 01 03 00 36 5F 84 3D 4C 01 00 00 0B 00 00 00 L...6_.=L....... 000010: 00 00 00 00 2E 74 65 78 74 00 00 00 00 00 00 00 .....text....... 000020: 00 00 00 00 42 00 00 00 8C 00 00 00 CE 00 00 00 ....B........... 000030: 00 00 00 00 01 00 00 00 20 00 30 60 2E 64 61 74 ........ .0`.dat 000040: 61 00 00 00 42 00 00 00 00 00 00 00 68 00 00 00 a...B.......h... 000050: D8 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000060: 40 00 30 C0 2E 64 72 65 63 74 76 65 AA 00 00 00 @.0..drectve.... 000070: 00 00 00 00 0C 00 00 00 40 01 00 00 00 00 00 00 ........@....... 000080: 00 00 00 00 00 00 00 00 00 0A 00 00 EB 00 B8 02 ................ 000090: 00 00 00 50 B8 03 00 00 00 50 B8 08 00 00 00 5B ...P.....P.....[ 0000A0: F7 EB 5B 03 C3 B8 06 00 00 00 50 B8 08 00 00 00 ..[.......P..... 0000B0: 5B F7 EB 50 B8 04 00 00 00 50 B8 02 00 00 00 8B [..P.....P...... 0000C0: D8 58 2B C3 5B F7 EB 6A 00 E8 00 00 00 00 3E 00 .X+.[..j......>. 0000D0: 00 00 07 00 00 00 14 00 00 00 00 00 00 00 00 00 ................ 0000E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0000F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000110: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000120: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000140: 2D 65 6E 74 72 79 3A 55 4C 41 5A 20 2E 66 69 6C -entry:ULAZ .fil 000150: 65 00 00 00 00 00 00 00 FE FF 00 00 67 01 75 6C e...........g.ul 000160: 61 7A 32 2E 61 73 6D 00 00 00 00 00 00 00 00 00 az2.asm......... 000170: 40 63 6F 6D 70 2E 69 64 FC 20 12 00 FF FF 00 00 @comp.id. ...... 000180: 03 00 2E 74 65 78 74 00 00 00 00 00 00 00 01 00 ...text......... 000190: 00 00 03 01 42 00 00 00 01 00 00 00 00 00 00 00 ....B........... 0001A0: 00 00 00 00 00 00 2E 64 61 74 61 00 00 00 00 00 .......data..... 0001B0: 00 00 02 00 00 00 03 01 68 00 00 00 00 00 00 00 ........h....... 0001C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04 00 ................ 0001D0: 00 00 00 00 00 00 00 00 20 00 02 00 5F 55 4C 41 ........ ..._ULA 0001E0: 5A 00 00 00 00 00 00 00 01 00 20 00 02 00 2E 64 Z......... ....d 0001F0: 72 65 63 74 76 65 00 00 00 00 03 00 00 00 03 01 rectve.......... 000200: 0C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000210: 00 00 13 00 00 00 5F 45 78 69 74 50 72 6F 63 65 ......_ExitProce 000220: 73 73 40 34 00 00 00 00 00 00 00 00 00 00 00 00 ss@4............

Turbo Dump Version 5.0.16.4 Copyright (c) 1988, 1998 Borland International Display of File ULAZ2.EXE

000000: 4D 5A 90 00 03 00 00 00 04 00 00 00 FF FF 00 00 MZ.............. 000010: B8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 ........@....... 000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000030: 00 00 00 00 00 00 00 00 00 00 00 00 B0 00 00 00 ................ 000040: 0E 1F BA 0E 00 B4 09 CD 21 B8 01 4C CD 21 54 68 ........!..L.!Th 000050: 69 73 20 70 72 6F 67 72 61 6D 20 63 61 6E 6E 6F is program canno 000060: 74 20 62 65 20 72 75 6E 20 69 6E 20 44 4F 53 20 t be run in DOS 000070: 6D 6F 64 65 2E 0D 0D 0A 24 00 00 00 00 00 00 00 mode....$....... 000080: 5D 17 1D DB 19 76 73 88 19 76 73 88 19 76 73 88 ]....vs..vs..vs. 000090: 19 76 73 88 1D 76 73 88 E5 56 61 88 18 76 73 88 .vs..vs..Va..vs. 0000A0: 52 69 63 68 19 76 73 88 00 00 00 00 00 00 00 00 Rich.vs......... 0000B0: 50 45 00 00 4C 01 03 00 38 5F 84 3D 00 00 00 00 PE..L...8_.=.... 0000C0: 00 00 00 00 E0 00 0F 01 0B 01 05 0C 00 02 00 00 ................ 0000D0: 00 04 00 00 00 00 00 00 00 10 00 00 00 10 00 00 ................ 0000E0: 00 20 00 00 00 00 40 00 00 10 00 00 00 02 00 00 . ....@......... 0000F0: 04 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ................ 000100: 00 40 00 00 00 04 00 00 00 00 00 00 03 00 00 00 .@.............. 000110: 00 00 10 00 00 10 00 00 00 00 10 00 00 10 00 00 ................ 000120: 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 ................ 000130: 08 20 00 00 28 00 00 00 00 00 00 00 00 00 00 00 . ..(........... 000140: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000150: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000160: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000170: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000180: 00 00 00 00 00 00 00 00 00 20 00 00 08 00 00 00 ......... ...... 000190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0001A0: 00 00 00 00 00 00 00 00 2E 74 65 78 74 00 00 00 .........text... 0001B0: 48 00 00 00 00 10 00 00 00 02 00 00 00 04 00 00 H............... 0001C0: 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 60 ............ ..` 0001D0: 2E 72 64 61 74 61 00 00 54 00 00 00 00 20 00 00 .rdata..T.... .. 0001E0: 00 02 00 00 00 06 00 00 00 00 00 00 00 00 00 00 ................ 0001F0: 00 00 00 00 40 00 00 40 2E 64 61 74 61 00 00 00 ....@[email protected]... 000200: 68 00 00 00 00 30 00 00 00 02 00 00 00 08 00 00 h....0.......... 000210: 00 00 00 00 00 00 00 00 00 00 00 00 40 00 00 C0 ............@... 000220: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000240: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0002F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000350: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000360: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0003F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000400: EB 00 B8 02 00 00 00 50 B8 03 00 00 00 50 B8 08 .......P.....P.. 000410: 00 00 00 5B F7 EB 5B 03 C3 B8 06 00 00 00 50 B8 ...[..[.......P. 000420: 08 00 00 00 5B F7 EB 50 B8 04 00 00 00 50 B8 02 ....[..P.....P.. 000430: 00 00 00 8B D8 58 2B C3 5B F7 EB 6A 00 E8 00 00 .....X+.[..j.... 000440: 00 00 FF 25 00 20 40 00 00 00 00 00 00 00 00 00 ...%. @......... 000450: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ ........................................................0005D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0005E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0005F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000600: 38 20 00 00 00 00 00 00 30 20 00 00 00 00 00 00 8 ......0 ...... 000610: 00 00 00 00 46 20 00 00 00 20 00 00 00 00 00 00 ....F ... ...... 000620: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000630: 38 20 00 00 00 00 00 00 75 00 45 78 69 74 50 72 8 ......u.ExitPr 000640: 6F 63 65 73 73 00 4B 45 52 4E 45 4C 33 32 2E 64 ocess.KERNEL32.d 000650: 6C 6C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ll.............. 000660: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000670: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 000680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ .......................................................0009D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0009E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0009F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................

Microsoft (R) Macro Assembler Version 6.14.8444 09/15/02 12:21:42ulaz2.asm

Page 1 - 1

.386

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN

ExitProcess@4:NEAR 00000000 .CODE 00000000 ULAZ: 00000000 EB 00 JMP GLAVNI

;{; 2+3*8;

00000002 GLAVNI: 00000002 B8 00000002 MOV EAX,2 00000007 50 PUSH EAX 00000008 B8 00000003 MOV EAX,3 0000000D 50 PUSH EAX 0000000E B8 00000008 MOV EAX,8 00000013 5B POP EBX 00000014 F7 EB IMUL EBX 00000016 5B POP EBX 00000017 03 C3 ADD EAX,EBX

; 6*8*(4-2); 00000019 B8 00000006 MOV EAX,6 0000001E 50 PUSH EAX 0000001F B8 00000008 MOV EAX,8 00000024 5B POP EBX 00000025 F7 EB IMUL EBX 00000027 50 PUSH EAX 00000028 B8 00000004 MOV EAX,4 0000002D 50 PUSH EAX 0000002E B8 00000002 MOV EAX,2 00000033 8B D8 MOV EBX,EAX 00000035 58 POP EAX 00000036 2B C3 SUB EAX,EBX 00000038 5B POP EBX 00000039 F7 EB IMUL EBX

;};}

0000003B 6A 00 PUSH 0 0000003D E8 00000000 E CALL ExitProcess@4 00000000 .DATA 00000000 0000001A [ GLOBALV DD 26 DUP(0)

00000000 ]

END ULAZ

Page 19: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

195.7. Rezime poglavlja

Format pisanja instrukcija u jeziku koji se razvija u ovom radu je slobodni, a od ove verzije kompajlera moguće je prevoditi iz datoteke u datoteku. Program se više ne sastoji od jednog aritmetičkog izraza, već od bloka naredbi. Novi način prevođenja zahtijeva modifikaciju procedura Novi i Emit, a uvode se procedure IdiDo i Greska. Asemblerski programi zahtijevaju određeni kôd koji se zove Entry stub, pa kompajler generiše i njega. Da bi aritmetički izrazi radili sa višecifrenim brojevima modifikovano je dohvatanje konstante. Dodavanje unarnog minusa i ostatka pri dijeljenju zahtijeva promjenu procedura Faktor i Clan. Iz testnog primjera uspješno se generiše asemblerski listing, a iz asemblerskog listinga se dobijaju objektni i izvršni kôd.

Prilog 2: Verzija izvornog koda kompajlera br. 2

program Kompajler;const OCEKIVANO = 'Ocekivano '; GRIZRAZ = 'Izraz';var ulaz, izlaz: text; pozicija, brojaclinija: integer; znak: char; linija: string;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; until (znak > ' ') or Eof(ulaz)end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

procedure Izraz; forward;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; Izraz; IdiDo(')'); end; else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-']) do begin Emit(' PUSH EAX'); z := znak;

Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; end; end;end;

procedure Blok;begin while znak <> '}' do begin Izraz; IdiDo(';'); end; IdiDo('}');end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; IdiDo('{'); Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ')end;

procedure Glavni;var linija: string;begin Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 20: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

206. VARIJABLE, RELACIONI OPERATORI, USLOVI, PETLJE

Iako sposobna da generiše asemblerski kod, prethodna verzija kompajlera još uvijek ne liči na prevodilac pravog programskog jezika jer nedostaju dvije izuzetno bitne stvari, mogućnost smještanja međurezultata u varijable i mogućnost grananja programa. Stoga je potrebno uvesti elementarne kontrolne strukture, varijable i proširiti aritmetičke izraze.

6.1. Proširenje aritmetičkih izrazaAritmetički izraz se proširuje relacionim operatorima, operatorom dodjeljivanja, te unarnim operatorima. Za razliku

od Pascala, na primjer, dodjeljivanje nije poseban iskaz, nego sastavni dio aritmetičkog izraza (kao u C-u), te je pogodnije za ovu koncepciju razvoja programskog jezika, koja kreće od koncepta izraza.

Operator dodjeljivanja će, privremeno, biti dvotačka “:”. Primjer

a:b:c:2;

dodjeljuje varijabli c vrijednost 2, zatim se varijabla c dodjeli varijabli b, pa varijabla b varijabli a.

Ovaj primjer dovodi do pojma lijeve i desne asocijativnosti operatora. Taj pojam odgovara na pitanje koji operandi se prvi računaju kada je prioritet više upotrijebljenih operatora jednak. Za sabiranje, oduzimanje, množenje i dijeljenje korištena je lijeva asocijativnost. Npr. 3+2-4 će prvo izračunati 3, njemu dodati 2 a zatim od toga oduzeti 4.

Dodjeljivanje je desno asocijativno, što se vidi iz gore navedenog primjera. Već je u prvoj fazi pokazano da se ponavljanje lijevo asocijativnih operatora realizuju while petljom. Suprotno tome, ponavljanje desno asocijativnih operatora realizuje se rekurzijom unutar obrade desnog operanda.

Relacioni operatori su =,>,< i # (različito). Rezultat poređenja dva izraza može biti 0 ako je relacija netačna ili 1 ako je tačna. Ovi operatori nisu asocijativni, jer bi to dovelo do zbunjujućih situacija. Npr. izraz 3>2>1 u matematici je tačan i predstavlja činjenicu da je broj 2 veći od 1 a manji od 3, ali u kontekstu izraza u računaru ima sasvim drugu semantiku. Izraz 3>2 daje vrijednost 1, a zatim se ta vrijednost 1 poredi da li je veća od 1, što nije tačno, pa cijeli izraz vraća vrijednost 0. Pošto takva semantika nije mnogo korisna, neće biti realizovana.

Operatori dodjeljivanja i relacioni operatori trebaju da imaju najniži prioritet. To znači da se mora definisati novi jezički pojam Izraz dodjeljivanja.

Izraz dodjeljivanja

Sl. 6.1.1. Izraz dodjeljivanjaNa dijagramu sa slike Sl. 6.1.1 se vidi da neasocijativni operatori (relacioni) sa desne strane imaju pojam Izraz dok se

za desno asocijativni operator dodjeljivanja sa desne strane nalazi pojam Izraz dodjeljivanja.

Za realizaciju poređenja pomaže instrukcija SETcc AL, gdje cc predstavlja uslov koji predstavlja testiranje flegova, obično vezano za rezultat prethodne instrukcije. Ova instrukcija postavlja AL na 1 ako je uslov ispunjen odnosno na 0 ako nije, upravo ono što treba, bez korištenja uslovnih skokova. Generisani kôd za relacione operatore izgleda kao na slici Sl. 6.1.2

Sl. 6.1.2. Generisani kôd za relacione operatore

Pozovi IzrazPUSH EAXPozovi IzrazPOP EBXCMP EBX,EAXSETE AL ili SETG AL ili SETL AL ili SETNE AL (respektivno na =,>,<,#)AND EAX,0FFh

Izraz

Izraz dodjeljivanja

Izraz

>

<

=

#

:

Page 21: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

21Dakle, analogno operaciji sabiranja, prvi operand se dobija u EBX, a drugi u EAX registru, a poređenje se vrši

CMP EBX,EAX instrukcijom. Rezultat poređenja se dobije u fleg registru, a zatim se odgovarajućom SETE, SETG, SETL ili SETNE instrukcijom postavlja AL registar na željenu vrijednost. Pošto preostala tri bajta registra EAX mogu imati slučajnu vrijednost, posljednjom AND EAX,0FFh se oni postavljaju na nule.

Kod dodjeljivanja, međutim, nije potrebna vrijednost prvog operanda, nego njegova adresa. Uzima se da se ova adresa nalazi u EBX registru. To je dovoljno generalno rješenje, jer se vrijednost ne dodjeljuje samo varijablama, nego i nekim izrazima (npr. onim koji su rezultati pointerskih operacija). Vrijednost drugog operanda se nalazi u EAX registru. Stoga je generisani kôd za ovu operaciju oblika prikazanog na slici Sl. 6.1.3.

Sl. 6.1.3. Generisani kôd za operator dodjeljivanjaU ovoj fazi se još uvijek jednostavnost kompajlera drži u prvom planu. Stoga, imena varijabli, koje se upravo uvode,

su jednoslovna i to predstavljena malim slovima. To, u ovom trenutku, ukida potrebu za tabelom imena varijabli i pretraživanjem iste. Umjesto toga, svih 26 varijabli se može držati u statički alociranom prostoru.

Statički alociran prostor je deklarisan kao GLOBALV DD 26 DUP(0). Ovo znači da će svaka varijabla zauzimati po 4 bajta.

Sl. 6.1.4. Organizacija prostora za globalne varijable

Pogledom na sliku Sl. 6.1.4, uočava se da ako se od ASCII koda imena varijable oduzme ASCII kôd slova 'a' i rezultat pomnoži sa 4, dobije se relativni pomak u odnosu na labelu GLOBALV a time i adresa tražene varijable.

Nad varijablom se mogu obavljati dvije funkcije. Ona se može čitati, ali joj se može i dodijeliti vrijednost. Stoga je potrebno da nakon pristupa varijabli registar EBX ima njenu adresu, a registar EAX njenu vrijednost. Dosljedno dosadašnjem radu, vrijednost varijable c se može dobiti koristeći

LEA EBX,GLOBALV[8]MOV EAX,[EBX]

Da bi se uvele varijable potrebna je izmjena jezičkog pojma Faktor. Pored varijabli, u ovoj verziji kompajlera uvode se i novi unarni operatori. Svi oni se realizuju na isti način kao unarni minus uveden u prethodnoj verziji kompajlera, dakle rekurzivnim pozivom procedure Faktor, a zatim generisanjem koda koji modifikuje registar EAX. Unarni operatori su navedeni u tabeli na slici Sl. 6.1.5:

Oznaka operatora Značenje operatora Instrukcije koje se generišu nakon poziva procedure Faktor

- Aritmetički unarni minus. Promjena predznaka registra EAX NEG EAX

~ Binarna negacija. Pretvaranje svih nula u jedinice a svih jedinica u nule unutar binarnog zapisa registra EAX

NOT EAX

& Adresa operanda. Vraća adresu izraza koji slijedi (tipično varijabla) MOV EAX,EBX

* Pointer/pokazivač. Vraća cijeli broj koji se nalazi na adresi koja se dobije računom izraza

MOV EBX,EAX

MOV EAX,[EBX]

! Logička negacija. Ako je EAX jednak 0 on dobija vrijednost 1, inače dobija vrijednost 0

CMP EAX,0

SETE AL

AND EAX,0FFh

Sl. 6.1.5. Unarni operatori

GLOBALV[0]- GLOBALV[3]Varijabla a

GLOBALV[4]-GLOBALV[7]Varijabla b

GLOBALV[8]...Varijabla c

Izvrši IzrazPUSH EBXIzvrši Izraz dodjeljivanjaPOP EBXMOV [EBX],EAX

Page 22: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

22Uvođenje unarnih operatora zahtijeva da se promijene sintaksni dijagram za jezički pojam Faktor i odgovarajuća

procedura za implementaciju tog jezičkog pojma. Realizacija te procedure data je u okviru listinga u prilozima.

Faktor:

Sl. 6.1.6. FaktorUz dodatak relacionim operatorima, zgodno je uključiti i operatore konjunkcije, disjunkcije i ekskluzivne disjunkcije.

Iz C-a se preuzimaju operatori &,| i ^ koji vrše operacije bit po bit, pa su oni upotrebljivi i za maskiranja bitova. Kako su sve tri operacije komutativne, realizacija je analogna sabiranju, sa kojim se dijeli i prioritet operacije. U tu svrhu se jezički pojam Izraz modifikuje da izgleda kao na slici Sl. 6.1.7.

Sl. 6.1.7. IzrazLogičke operacije se prevode u kôd sa slike Sl. 6.1.8:

Sl. 6.1.8. Generisani kôd za logičke operacijePošto se ne dodaje novi operator prioriteta množenja i dijeljenja, procedura Clan se ne mijenja.

6.2. Uslovi Za realizovanje programskih struktura uslova i petlje, potrebno je koristiti skokove u asemblerskom jeziku. U ovoj

oblasti je generisanje asemblerskog programa jednostavnije od generisanja mašinskog programa, pogotovo kada su u pitanju skokovi unaprijed. To omogućavaju labele. Labele u generisanom listingu imaju oblik L1, L2, L3..., pri čemu je broj iza slova

( Izraz dodjeljivanja )

Numerička konstanta

Faktor

*

&

~

!

-

Varijabla

Član

+

-

-

Član&

|

^

Pozovi ČlanPUSH EAXPozovi ČlanPOP EBXAND EAX,EBX ili OR EAX,EBX ili XOR EAX,EBX

Page 23: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

23L smješten u cjelobrojnu globalnu varijablu TrenLabela. Procedurom NovaLabela se taj broj uveća za 1 i zatim vrati u formi stringa.

Uslov se može predstaviti sintaksnim dijagramom sa slike Sl. 6.2.1

Uslov:

Sl. 6.2.1. Uslov

Jezik još nema ključnih riječi, pa se uslov označava znakom ?, zatim slijedi izraz koji treba da vrati vrijednost 0 ili 1, pa otvorena vitičasta zagrada i blok koji označavaju sekciju koja se izvršava ako je uslov ispunjen. Prethodni znak “?” je prikazan isprekidanim linijama u sintaksnom dijagramu jer se ne prepoznaje u proceduri Uslov koja implementira uslove nego u proceduri Blok. Na kraju jezičkog pojma Uslov nalazi se druga otvorena vitičasta zagrada i sekcija koja se izvršava ako uslov nije ispunjen.

Sl. 6.2.2. Primjer uslova, treća verzija kompajleraNa slici Sl. 6.2.2 dat je primjer uslova koji radi sljedeće: Ako je varijabla a jednaka 3 i varijabla n veća od 8, varijabli

b se dodjeljuje vrijednost 8, a varijabli c vrijednost 2. Ako bar jedan od gornjih uslova nije ispunjen, varijabla b dobija vrijednost 12.

Uslov se smatra ispunjenim ako je rezultat izraza koji se ispituje različit od nule. Izraz ima rezultat u EAX registru. Stoga se uslov može realizovati kodom sa slike Sl. 6.2.3. Na slici se vidi da je potrebno generisati tri nove labele. Ovdje su one označene sa Londa, Linace i Lkrajuslova, a u praksi mogu biti, na primjer, L11, L12 i L13.

Instrukcija CMP EAX,0 postavlja Z fleg na 1 ako je u EAX registru nula, a u protivnom Z fleg se postavi na 0. Stoga instrukcija JNE Londa izaziva skok na labelu Londa ako je EAX=0, a u protivnom se izvrši sljedeća instrukcija koja je bezuslovni skok na labelu Linace. Na kraju bloka koji se izvršava kada je uslov ispunjen, nalazi se skok na labelu Lkrajuslova da bi se preskočila sekcija koja se ne izvršava.

Sl. 6.2.3. Generisani kôd za realizaciju uslova

6.3. PetljeIako konceptualno složenije od uslova petlje su za realizaciju još jednostavnije. Kao sintaksni simbol petlje uzima se

znak &, čije druge dvije upotrebe za adresu varijable i binarnu konjunkciju neće praviti konfuziju jer nema smisla da se u tom kontekstu nalaze na početku naredbe. Petlja se predstavlja sintaksnim dijagramom sa slike Sl. 6.3.1.

? Izraz dodjeljivanja

{ Blok { Blok

? (a=3 & n>8) { b:8; c:2; } { b:12; }

Pozovi Izraz dodjeljivanjaCMP EAX,0JNE LondaJMP Linace

Londa: Pozovi Blok JMP LkrajuslovaLinace: Pozovi BlokLkrajuslova: ....

Page 24: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

24Petlja:

Sl. 6.3.1. PetljaPrimjer

& a<0 { a:a+1}

sve dok je a manje od nula, uvećavaj varijablu a za 1.

Petlja se može realizovati generisanim kodom kao na slici Sl. 6.3.2.

Sl. 6.3.2. Generisanje koda za petljeSa ovim tipom petlje (odgovara while petlji) mogu se realizovati i programi koji zahtijevaju ostala dva popularna tipa

petlji (for i do/repeat).

Programskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog sistema i ne može se realizovati bez asemblerskih potprograma ili poziva sistemskih procedura. Stoga se uvodi specijalni simbol \ , koji predstavlja da od sljedeće linije slijedi asemblerski kôd Nakon ovoga, kompajler jednostavno prepisuje naredne linije u generisani asemblerski kôd, sve dok se ne dođe do linije koja počinje znakom \.

Sintaksni dijagram za asemblersku sekvencu se neće navoditi, jer je asemblerski jezik linijski orijentisan.

6.4. Generalizovani jezički pojam blokJezički pojam Blok, i s njim vezana odgovarajuća procedura se sada mora redizajnirati da uključi uslove, petlje,

asembler i izraz dodjeljivanja, kao na slici Sl. 6.4.1

Blok:

Sl. 6.4.1. Jezički pojam blok

To u realizaciji znači da procedura Blok treba da prepozna odgovarajući simbol i ovisno o njemu pozove odgovarajuću proceduru.

Sada se može realizovati listing treće verzije kompajlera, pod imenom komp32v3, koji je naveden u prilogu 3. Izmjene u odnosu na drugu verziju prikazane su tamnijim slovima.

&Izraz dodjeljivanja { Blok

Luslov:Pozovi Izraz dodjeljivanjaCMP EAX,0JNE LdokJMP Lkrajpetlje

Ldok: Pozovi Blok JMP LuslovLkrajpetlje: ....

&

?

\ Asembler

Izraz dodjeljivanja

Uslov

Petlja

};

Page 25: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

256.5. Testni primjer

Kao primjer programa u ovoj verziji jezika uzeće se traženje kvadratnog korijena cijelog broja Heronovim algoritmom. Koristeći Heronov algoritam, program će naći cijeli dio korijena broja iz varijable n, pazeći da ne dođe do dijeljenja s nulom ili vađenja korijena negativnog broja, a zatim emitovati zvučni signal onoliko puta koliki je rezultat. Zvučni signal se generiše asemblerskim pozivom sistemske funkcije MessageBeep@4, koja se nalazi u biblioteci USER32.DLL, pri čemu se prije poziva mora na stek staviti broj -1.

Treba unijeti sljedeći kôd sa slike Sl. 6.5.1 i snimiti ga pod imenom heron.jez{ n:200; a:n; b:1; & (b<10) { ? (a>0) { a:(a+n/a)/2; b:b+1; } { a:0;

} } q:a; & q>0 {\ extrn MessageBeep@4:near PUSH -1 CALL MessageBeep@4\ q:q-1; } }

Sl. 6.5.1. Traženje kvadratnog korijena Heronovim algoritmomNakon naredbi

komp32v3 heron.jez heron.asm ml /c /coff /Fl heron.asm | morelink /defaultlib:user32.lib kernel32.lib /subsystem:console heron.obj

i startanja prevedenog programa, zvučni signal se čuje 14 puta što je približno korijen iz 200.

6.6. Rezime poglavljaU trećoj verziji jezika aritmetički izrazi su prošireni relacionim i unarnim operatorima. Varijable su statički alocirane

relativno od labele GLOBALV i njihova adresa se izračunava iz ASCII koda jednoslovnog imena varijable. Uslovi i petlje se označavaju simbolima ? i &. Moguće je uključivati asemblerske instrukcije. U ovoj verziji jezika moguće je pisati primjere iz oblasti cjelobrojne numeričke analize.

Prilog 3: Verzija izvornog koda kompajlera br. 3

program Kompajler;const OCEKIVANO = 'Ocekivano '; GRIZRAZ = 'Izraz';

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija: integer; znak: char; linija: string;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);

begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; until (znak > ' ') or Eof(ulaz)end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;

end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

procedure IzrazDodjeljivanja; forward;procedure Blok; forward;

procedure Varijabla;var rezultat: integer; st: string;begin rezultat := (ord(znak) - ord('a')) * 4; Str(rezultat, st);

Page 26: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

26 Emit( ' LEA EBX,GLOBALV[' + st + ']'); Emit(' MOV EAX,[EBX]'); Novi;end;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '~': begin Novi; Faktor; Emit(' NOT EAX'); end; '&': begin Novi; Faktor; Emit(' MOV EAX,EBX'); end; '*': begin Novi; Faktor; Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); end; '!': begin Novi; Faktor; Emit(' CMP EAX,0'); Emit(' SETE AL'); Emit(' AND EAX,0FFh'); end; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja; IdiDo(')'); end; 'a'..'z': Varijabla else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var

z: char;begin Clan; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; '&': begin Emit(' POP EBX'); Emit(' AND EAX,EBX'); end; '|': begin Emit(' POP EBX'); Emit(' OR EAX,EBX'); end; '^': begin Emit(' POP EBX'); Emit(' XOR EAX,EBX'); end; end; end;end;

procedure IzrazDodjeljivanja;var z: char;begin Izraz; case znak of ':': begin Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' MOV [EBX],EAX'); end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz; Emit(' POP EBX'); Emit(' CMP EBX,EAX'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); end; end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); IdiDo('{'); Blok; Emit('L' + skrajuslova + ':');end;

procedure Asembler;

begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do case znak of '&': Petlja; '?': Uslov; '\': Asembler; else begin IzrazDodjeljivanja; IdiDo(';'); end; end; IdiDo('}');end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; IdiDo('{'); Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ')end;

procedure Glavni;var linija: string;begin trenlabela := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 27: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

277. KLJUČNE RIJEČI, STRINGOVI, DINAMIČKI NIZOVI I FUNKCIJE

Prethodna verzija kompajlera omogućava, u kombinaciji s asemblerskim umetnutim kodom, realizaciju raznih programa i za neke čitaoce je dovoljna, ali i dalje ima mnogo slabih tačaka. Tu je prije svega evidentan nedostatak potprograma, jednodimenzionalnih nizova i stringova. Osim toga, jezik je veoma kriptičan i potrebno mu je dodati ključne riječi, kako bi bio razumljiviji.

7.1. Ključne riječiNeka se dodaju prvo ključne riječi. Jezički pojam Blok sada može izgledati kao na slici Sl. 7.1.1.

Blok:

Sl. 7.1.1. BlokZa prepoznavanje ključnih riječi postoje dva pristupa. Jedan je izrada konačnog automata koji se zove skaner ili

leksički analizator. On se zasniva na dodjeli specijalnih simbola ključnim riječima. U primjeru sa slike Sl. 7.1.1 bi trebalo modifikovati proceduru Novi da ako prepozna slovo a da provjeri da li iza njega slijedi slovo k ili s pa ako slijedi k, provjeriti da li slijedi slovo o i ako su sva tri uslova ispunjena tada se vraća simbol za ako, u protivnom se vraća identifikator a, ak, ili čak neki duži identifikator (akcenat, akt itd.). U slučaju da je iza slova a slijedilo slovo s analogno se provjerava da li je riječ o ključnoj riječi asembler ili možda varijabli astronaut. Skanerski pristup je brži, i omogućava odvajanje prepoznavanja ključnih riječi (leksička analiza) od ostatka procesa prevođenja, te samim tim fleksibilniji kompajler. Pristup je konzistentan jer se jednom procedurom dohvataju i jednoslovni i višeslovni jezički simboli. Mana skanerskog pristupa je u relativno dugačkom kodu za ostvarenje jednostavnog zadatka, kao i činjenici da se prosti karakter tip koji prikazuje simbol koji slijedi mora zamijeniti cjelobrojnim ili specijalizovanim, jer 256 znakova nije dovoljno.

Drugi pristup je pristup očekivanih uzoraka (matching) . Ovaj pristup primijenjen je u kompajleru za programski jezik Small C. U ulaznoj liniji se provjerava da li na trenutnom mjestu u ulaznoj slijedi željeni string u cjelini. To znači da će se provjera vršiti više puta, bila ona potrebna ili ne. Osim toga, provjera se mora realizovati posebnom procedurom umjesto prostog poređenja sa narednim simbolom, pa se malo gubi na konzistentnosti. Ali, pristup je dovoljno jednostavan da je izabran za programski jezik razvijan u ovom radu Kako taj jezik ima vrlo malo ključnih riječi, gubitak performansi je neznatan.

Za prepoznavanje uzorka uvodi se funkcija Slijedi. Ova funkcija ima string argument, koji predstavlja očekivanu ključnu riječ, a vraća Boolean, tako da se može pozivati sa

if Slijedi('ako') then ...Algoritam koji realizuje funkciju Slijedi se radi na sljedeći način:

Ako je niz znakova na trenutnoj ulaznoj poziciji jednak stringu navedenom kao parametar, onda se vraća vrijednost tačno i postavi pokazivač pozicije iza tog niza. U protivnom se vrati vrijednost netačno.

Koristeći ovu funkciju slijedi, lako je napisati novu verziju procedure blok i na taj način uvesti ključne riječi.

7.2. Komentari i neignorisanje simbolaStrukturirani programski jezik je nezamisliv bez komentara. Programski jezici obično definišu komentare kao dio

koda koji se ignoriše, pri čemu se komentar smatra dijelom koda između dva specijalna niza simbola ili od jednog simbola do kraja linije.

U ovom jeziku, komentar je predstavljen apostrofom okrenutim na desnu stranu ` . Od tog znaka, do kraja linije tekst se ignoriše. Proceduru Novi je potrebno malo modifikovati da bi dio koda između ovog simbola i kraja linije bio ignorisan.

Ponekad je potrebno dohvatiti i analizirati simbol čak i kada je on blanko, naopaki apostrof ili novi red. Naime, u prethodnoj verziji kompajlera bilo je sasvim normalno napisati

dokako

asemblerr

Asembler

Izraz dodjeljivanja

Uslov

Petlja

};

Page 28: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

28a:1343223;

kao i

a:134 3223;

što je vrlo neuobičajeno, a kada se budu uvele stringovne konstante i neprihvatljivo. Stoga se pored funkcije novi uvodi funkcija NoviSvaki koja radi slično kao Novi, ali ne provjerava da li je riječ o blanku ili komentaru. Ova funkcija ima parametar koji govori da li će se prijavljivati greška ukoliko se, dohvaćajući simbole, došlo do kraja reda ili ne (u tom slučaju kao kraj reda vraća blanko). Procedura UzmiKonstantu se sada modifikuje tako da novu cifru uzima ovom procedurom umjesto procedure Novi.

7.3. Modifikacija uslova i petljiPošto je nepraktično pisati uslove tako da se uvijek navodi i sekcija koja se izvrši kad je uslov ispunjen i ona kad

uslov nije ispunjen, uvodi se ključna riječ inace i jezički pojam Uslov redizajnira kao na slici Sl. 7.3.1 i skladno tome se mijenja odgovarajuća procedura Uslov. Time dio koda koji se izvršava kada uslov nije ispunjen postaje opcionalan.

Uslov:

Sl. 7.3.1. UslovSintaksa petlji se ne mijenja, iako je simbol & zamijenjen ključnom riječju dok. Prepoznavanje ključne riječi dok se

obavlja unutar procedure Blok.

7.4. Modifikacije aritmetičkih izraza i uvođenje stringovaDodjeljivanje simbolom : je takođe zbunjujuće, pa se Izraz dodjeljivanja mijenja da se umjesto znaka : ,

dodjeljivanje vrši koristeći operator := . Taj se operator može, nakon što je prepoznata dvotačka, provjeravati funkcijom slijedi(':='). Izraz dodjeljivanja je prikazan na slici Sl. 7.4.1

Sl. 7.4.1. Izraz dodjeljivanja

Stringovne konstante nije teško dodati, ukoliko se preuzme koncepcija stringova iz C-a. U C-u se stringovi prenose u potprograme i dodjeljuju odgovarajućim varijablama tako što se prenosi adresa početka stringovne konstante. Da bi se znalo gdje je kraj stringovne konstante, na kraju stringa se nalazi bajt sa vrijednošću 0. Stringovne konstante uokvirene su dvostrukim navodnicima.

String konstanta:

Sl. 7.4.2. String konstanta

ako

Izraz dodjeljivanja

{ Blok { Blokinace

Izraz

Izraz dodjeljivanja

Izraz

>

<

=

#

:=

" karakter "

Page 29: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

29Procedura koja prevodi stringovnu konstantu koristi proceduru NoviSvaki uz zabranu prelaska u naredni red. Ona

mora generisati kôd sa slike Sl. 7.4.3

Sl. 7.4.3. Generisani kôd za stringovne konstanteIz ovoga se vidi da se mora prvo prekinuti kodni segment i reći asembleru da se ova konstanta smjesti u segment sa

podacima, kako bi se izbjeglo izvršavanje besmislenih instrukcija koje slučajno imaju isti operacioni kôd kao bajtovi predstavljeni ASCII kodovima. Nakon ovoga ponovo se navodi kodni segment i instrukcija kojom se u EAX registar donosi adresa toga stringa. Ova adresa će se kasnije moći prosljeđivati Windows API funkcijama kao argument. U specijalnom slučaju, prazan string se prevodi u Lnn DB 0.

Ideja iz jezika C o pristupu nizovima cijelih brojeva koristeći pokazivačke varijable, omogućava vrlo jednostavno dodavanje jednodimenzionalnih nizova. Uz pretpostavku da varijabla sadrži adresu nekog prostora u memoriji (koji se može u ovom trenutku dobiti dodjeljivanjem stringovne konstante varijabli ili pozivom Windows API funkcije GlobalAlloc u asemblerskom modulu) i ako se taj prostor iskoristi za smještanje elemenata niza, tada je dovoljno u sintaksi varijable dodati opcionalni indeks unutar uglastih zagrada, kao što se vidi na sintaksnom dijagramu sa slike Sl. 7.4.4:

Varijabla:

Sl. 7.4.4. VarijablaAdresa elementa niza tada se može dobiti po formuli

Adresa=vrijednost varijable predstavljene slovom + 4 * vrijednost izraza dodjeljivanjaStoga se element niza dobija koristeći kôd sa slike Sl. 7.4.5.

Sl. 7.4.5. Generisani kôd za dobijanje elementa nizaInstrukcija SAL pomjera registar EAX za dva bita ulijevo, što efektivno predstavlja množenje sa 4. U skladu sa

dosadašnjim standardom, adresa elementa niza se dobija u registru EBX, a njegova vrijednost u registru EAX.

7.5. Funkcije i procedurePošto je jezik koji se razvija sličan C-u, gdje se kreće od izraza, a ne iskaza, dodavanje funkcija automatski rješava i

problem dodavanja procedura ili običnih potprograma. Procedure su prosto funkcije čija se vrijednost zanemaruje, a obični potprogrami pored toga nemaju argumenata.

Poziv funkcije se vrši unutar izraza i sintaksno je prikazan na slici Sl. 7.5.1:

Sl. 7.5.1. Poziv funkcijeKao u implementaciji većine modernih programskih jezika, parametri se prije poziva funkcije smještaju na stek.

Slovo [ Izraz dodjeljivanja ]

Veliko slovo

maloslovo

Izraz dodjeljivanja

,

( )

.DATALnn db "String koji je koristen",0.CODEMOV EAX,OFFSET Lnn

PUSH EAX Pozovi IzrazDodjeljivanja; POP EBX SAL EAX,2 ADD EBX,EAX MOV EAX,[EBX]

Page 30: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

30U definiciji funkcije se za sada ne navode parametri, iako se oni mogu navesti pri pozivu. Stoga, ova verzija

kompajlera nema provjeru broja i tipa parametara funkcija i smatraće se da sve funkcije imaju po 26 parametara.

Imajući ovo u vidu, generisani kôd za poziv funkcije izgleda kao na slici Sl. 7.5.2 :

Sl. 7.5.2. Poziv funkcije, generisani kôd

Podatak o tome koliko su memorije na steku zauzeli parametri, a koji se smješta u ECX, koristiće se u samoj funkciji.

Definicija funkcije data je na sintaksnom dijagramu na slici Sl. 7.5.3.

Funkcija:

Sl. 7.5.3. FunkcijaIme funkcije obavezno počinje velikim slovom iza koga slijedi više malih slova. Ovo je učinjeno da bi se razlikovale

funkcije po imenu od varijabli, koje su predstavljene malim slovima.

Ako iza imena funkcije slijedi znak { , tada slijedi tijelo funkcije. Ukoliko iza imena funkcije slijedi znak ; tada je samo u pitanju deklarisanje funkcije, čije se tijelo nalazi u drugom modulu (drugoj .JEZ ili .OBJ datoteci).

Definisanje funkcije koja je implementirana u drugom modulu se realizuje prostom upotrebom pseudoinstrukcije EXTRN: EXTRN P_imefunkcije:NEAR

Funkcije koje imaju tijelo se prevode znatno složenije. Na steku se rezerviše prostor za svih 26 parametara, koji iznosi 104 bajta (26*4). Parametri se označavaju sa @a, @b, ... , @z, pri čemu @a predstavlja prvi parametar naveden u pozivu, a @z predstavlja 26-ti parametar. Naravno, većina parametara neće biti iskorištena , pa se neiskorišteni parametri mogu upotrijebiti kao lokalne varijable. Registar ECX, kako je već rečeno, sadrži veličinu dijela steka potrošenog za parametre, a za lokalne varijable ostaje 104-ECX bajtova. Lokalnim varijablama i parametrima se pristupa relativno u odnosu na EBP registar, pa EBP registar treba pokazivati na vrh steka u trenutku poziva. Sam stek pointer se mora umanjiti kako bi se iz funkcija pozivale druge funkcije, a zatim na stek stavila povratna adresa. Sve navedeno se postiže kodom slike Sl. 7.5.4.

Primjećuje se da nema posebnog koda za vraćanje vrijednosti funkcije. Ona se jednostavno već nalazi u EAX registru kao rezultat posljednjeg aritmetičkog izraza unutar bloka. Instrukcija RET 104 pored povratka iz potprograma ujedno i vrati poziciju stek pointera na vrijednost prije stavljanja prvog argumenta. Ovaj kôd će se pojednostaviti nakon uvođenja provjera argumenata, u narednom poglavlju.

Sl. 7.5.4. Generisani kôd za tijelo funkcijeRealizacija funkcija, dinamičkih nizova i stringova dovodi do nove sintaksne definicije pojma faktor i skladno s tim

odgovarajuće procedure:

funkcija

Veliko slovo

maloslovo ;

{ Blok

Za svaki parametar:Pozovi IzrazdodjeljivanjaPUSH EAX

MOV ECX,ukupna veličina svih parametaraCALL P_funkcija

P_ImeFunkcije: POP EDX ADD ESP,ECX SUB ESP,104 PUSH EDX PUSH EBP MOV EBP,ESP Pozovi Blok POP EBP RET 104

Page 31: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

31Faktor:

Sl. 7.5.5. Faktor

Numeričku konstantu, varijablu ili poziv funkcije moguće je razlikovati po tome da li počinju cifrom, malim ili velikim slovom.

Lokalne varijable se implementiraju sljedećim kodom

LEA EBX,[EBP+n]MOV EAX,[EBX]

gdje se n računa izrazom n=108-(ord(znak)- ord('a'))*4 .

U ovom izrazu, znak predstavlja ime varijable bez simbola @.

7.6. Testni primjer

Na slici Sl. 7.6.1 dat je program u četvrtoj verziji jezika koji prikazuje na ekranu za brojeve od 1 do 10: broj, ime broja, kvadrat, kub, faktorijel (rekurzivno) te proste faktore tog broja. Program se zove tabbroj.jez i kompajlira koristeći

komp32v4 tabbroj.jez tabbroj.asm ml /c /coff /Fl tabbroj.asm | morelink /defaultlib:user32.lib kernel32.lib /subsystem:console tabbroj.obj

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String konstanta

Poziv funkcije

@

Page 32: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

32

funkcija Prikazistring {asembler extrn GetStdHandle@4:near extrn WriteConsoleA@20:near MOV EAX,-11 ; -11 je parametar za STDOUT PUSH EAX CALL GetStdHandle@4 ; Uzmi hendl za STDOUT MOV ECX,0 ; Petlja koja racuna duzinu stringa MOV EBX,[EBP+108]DUZ: CMP BYTE PTR [EBX],0 JE IZR INC ECX INC EBX JMP DUZIZR: PUSH DWORD PTR 0 ; Rezervisano LEA EBX,[EBP+104] PUSH EBX ; Pointer na broj karaktera koji su prikazani PUSH ECX ; Broj karaktera koji se pisu MOV EBX,[EBP+108] PUSH EBX ; Pointer na string PUSH EAX ; Handle CALL WriteConsoleA@20 ; Ispisi string\}

funkcija Zamijeniznak { asembler MOV EBX,[EBP+108] ; Adresa stringa ADD EBX,[EBP+104] ; Redni broj karaktera MOV EAX,[EBP+100] ; ASCII kod karaktera koji mijenjamo MOV [EBX],AL ; Upisuje karakter\}

funkcija Novired { @a:=" "; Zamijeniznak(@a,0,13); Zamijeniznak(@a,1,10); Prikazistring(@a);}

funkcija Prikazibroj { @q:=" "; ` Alociramo bafer @c:=@a;` Negativne brojeve oznaci indikatorom ako (@c<0) { @i:=1; @c:=-@c; } inace { @i:=0; }`maksimalno 9 cifara @p:=9; ako (@c=0) { Zamijeniznak(@q,@p,48);@p:=@p-1;} dok (@c>0) { @o:=(@c % 10); `ostatke dijeljenja u bafer Zamijeniznak(@q,@p,@o+48); @c:=@c/10; ` stalno dijeli s 10 @p:=@p-1; } ako (@i=1) { Zamijeniznak(@q,@p,45); @p:=@p-1; } @q:=@q+@p+1; ` Pomjeri pokazivac pocetka stringa Prikazistring(@q);

}

funkcija Fact{ ako (@a=0) { 1; } inace { @a*Fact(@a-1); }}

funkcija Tabela{ Prikazistring("Tabela"); Novired(); n:=1; dok (n<11) { Prikazibroj (n); Prikazistring(" "); Prikazistring(a[n]); Prikazistring(" "); Prikazibroj (n*n); Prikazistring(" "); Prikazibroj (n*n*n); Prikazistring(" "); Prikazibroj (Fact(n)); Prikazistring(" Djeljiv sa "); m:=1; dok !(m>n) { ako (n%m=0) { Prikazibroj(m); Prikazistring(" "); } m:=m+1; } n:=n+1; Novired(); }}

funkcija Postavinazive{ a:=" "; ` Prostor za niz a[1]:="Jedan"; a[2]:="Dva"; a[3]:="Tri"; a[4]:="Cetiri"; a[5]:="Pet"; a[6]:="Sest"; a[7]:="Sedam"; a[8]:="Osam"; a[9]:="Devet"; a[10]:="Deset";}

{ Postavinazive(); Tabela();}

Sl. 7.6.1. Tablica brojeva, četvrta verzija kompajlera

Funkcija Prikazistring realizovana je u asembleru, jer poziva Windows API funkcije GetStdHandle i WriteConsole. Ove funkcije predstavljaju način ispisa stringa na ekranu koristeći Windowsove sistemske funkcije za rad s konzolnim aplikacijama.

Funkcija GetStdHandle je sistemska funkcija koja vraća broj pridružen ulaznom uređaju, izlaznom uređaju ili uređaju greške. U Windows API funkcijama definisana je ovako

HANDLE GetStdHandle( DWORD nStdHandle // input, output, or error device );

pa je potrebno na stek prije njenog poziva staviti konstantu -11, koja predstavlja STDOUT.

Funkcija WriteConsole je definisana ovako

Page 33: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

33BOOL WriteConsole( HANDLE hConsoleOutput, // handle to a console screen buffer CONST VOID *lpBuffer, // pointer to buffer to write from DWORD nNumberOfCharsToWrite, // number of characters to write LPDWORD lpNumberOfCharsWritten,//pointer to number of chars written LPVOID lpReserved // reserved );

Windows-ova konvencija je da se parametri za API funkcije smještaju na stek obrnutim redom u odnosu na onaj koji je definisan u zaglavlju funkcije. Asemblerski potprogram priprema sve parametre i smješta ih potrebnim redoslijedom.

Pošto još nema naredbi za pristup pojedinačnim karakterima, u asembleru je napisana i funkcija Zamijeniznak, koja se poziva sa tri parametra, prvi je adresa stringa, drugi redni broj karaktera koji mijenjamo i treći ASCII kôd koji upisujemo.

Ostale funkcije su pisane bez pomoći asemblera. Funkcija Novired ispisuje string koji sadrži kodove CR i LF, čime se prelazi u novi red. Funkcija Prikazibroj pretvara cijeli broj u njegovu ASCII reprezentaciju, koristeći uzastopno dijeljenje sa 10 uz prikazivanje ostataka, a zatim se ta ASCII reprezentacija prikazuje na ekranu, koristeći funkciju PrikaziString. Posebno je interesantna funkcija Fact koja rekurzivno računa faktorijel, koristeći definiciju faktorijela. Dakle, jezik već u ovoj fazi podržava i tako složene stvari kao što je rekurzija. Glavna funkcija Tabela je dobro strukturirana i shvatljiva svakome ko poznaje bar jedan viši programski jezik. Jedino treba reći da se u unutrašnjoj petlji (sa m kao brojačem) vrši poređenje ostatka (pri dijeljenju n sa m ) sa brojem 0 i ako je ostatak jednak 0, tada se prikazuje broj kao djelilac. U funkciji Postavinazive se globalnoj varijabli a pridruži adresa stringa koji ima dosta blankova. Ovaj string služi samo kao rezervisani prostor za 10 pokazivača na nove stringove koji sadrže imena brojeva.

Izvršenje programa Tabbroj daje kao rezultat

1 Jedan 1 1 1 Djeljiv sa 12 Dva 4 8 2 Djeljiv sa 1 23 Tri 9 27 6 Djeljiv sa 1 34 Cetiri 16 64 24 Djeljiv sa 1 2 45 Pet 25 125 120 Djeljiv sa 1 56 Sest 36 216 720 Djeljiv sa 1 2 3 67 Sedam 49 343 5040 Djeljiv sa 1 78 Osam 64 512 40320 Djeljiv sa 1 2 4 89 Devet 81 729 362880 Djeljiv sa 1 3 910 Deset 100 1000 3628800 Djeljiv sa 1 2 5 10

što je i trebalo dobiti. EXE verzija programa je velika svega 4 kilobajta, jer nema opterećujuće biblioteke, kao u svim drugim kompajlerima. Ova verzija jezika je sasvim upotrebljiva za mnoge primjene iako programi pisani u njoj zahtijevaju dosta hakerskih trikova. Tu se prije svega misli na povremenu upotrebu asemblerskog koda. Ipak, asemblerske i druge funkcije se već u ovoj verziji kompajlera mogu izdvojiti i posebno kompajlirati i linkovati, te na taj način formirati jezgro programske biblioteke, što u mnogome olakšava programiranje.

7.7. Rezime poglavljaČetvrta verzija kompajlera uvodi ključne riječi. Ključne riječi se mogu prepoznavati skanerom, koji provjerava slovo

po slovo kao konačni automat ili očekivanim uzorkom, poređenjem sa cijelim očekivanim stringom. Odabran je princip očekivanih uzoraka, i uzorci se provjeravaju procedurom Slijedi. Dodane su ključne riječi ako, dok, inace, funkcija i asembler. Dodjeljivanje vrijednosti varijabli se vrši simbolom :=. Stringovne konstante se prevode u instrukciju koja registru EAX dodjeljuje adresu stringa. Uvedeni su jednodimenzionalni nizovi, vezani uz pojam pointera. Moguće je pozivati funkcije sa varijabilnim brojem parametara. Parametri se mogu koristiti kao lokalne varijable. Funkcije mogu biti i u eksternim modulima. Testni primjer uključuje cjelobrojnu aritmetiku i ispis na ekran.

Ovo je najznačajnija verzija kompajlera. Dovoljno je kratka da se može prikazati za jedan nastavni blok-čas, ali opet dovoljno velika da uključuje većinu koncepata iterativnih programskih jezika.

Page 34: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

34

program Kompajler;const GRIZRAZ = 'Izraz'; DUGAKONST = 'Konstanta prevazilazi liniju'; OCEKIVANO = 'Ocekivano '; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; OCEKDOD = 'Ocekivano dodjeljivanje';

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija: integer; znak: char; linija: string;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu: integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); NoviSvaki(false); end;

if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat;end;

function Slijedi(ocekivano: string): Boolean;begin if copy(linija, pozicija, Length(ocekivano)) = ocekivano then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

procedure IzrazDodjeljivanja; forward;procedure Blok; forward;

procedure PokazivacINiz;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' SAL EAX,2'); Emit(' ADD EBX,EAX'); Emit(' MOV EAX,[EBX]'); IdiDo(']');end;

procedure StringKonstanta;var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst);end;

procedure PozivFunkcije;var lokalnih: integer; ImeFunkcije, st: string;begin ImeFunkcije := ''; while ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) do begin ImeFunkcije := ImeFunkcije + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi; lokalnih := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja; Emit(' PUSH EAX'); lokalnih := lokalnih + 4; if znak <> ')' then IdiDo(','); end; IdiDo(')'); Str(lokalnih, st); Emit(' MOV ECX,' + st); Emit(' CALL P_' + ImeFunkcije);end;

procedure Varijabla(glob: Boolean);var rezultat: integer; st: string;begin if glob then begin rezultat := (ord(znak) - ord('a'))

* 4; Str(rezultat, st); Emit(' LEA EBX,GLOBALV[' + st +']'); end else begin Novi; if (znak < 'a') or (znak > 'z') then Greska('Lokalna'); rezultat := 108 - (ord(znak) - ord('a')) * 4; Str(rezultat, st); Emit(' LEA EBX,[EBP+' + st + ']'); end; Emit(' MOV EAX,[EBX]'); Novi; if znak = '[' then PokazivacINiz;end;

procedure Faktor;var rezultat: integer; st: string;begin case znak of '-': begin Novi; Faktor; Emit(' NEG EAX'); end; '~': begin Novi; Faktor; Emit(' NOT EAX'); end; '&': begin Novi; Faktor; Emit(' MOV EAX,EBX'); end; '*': begin Novi; Faktor; Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); end; '!': begin Novi; Faktor; Emit(' CMP EAX,0'); Emit(' SETE AL'); Emit(' AND EAX,0FFh'); end; '"': StringKonstanta; '0'..'9': begin rezultat := UzmiKonstantu; Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja; IdiDo(')'); end; '@': Varijabla(false); 'A'..'Z': PozivFunkcije; 'a'..'z': Varijabla(true) else Greska(GRIZRAZ); end;end;

procedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end;

Page 35: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

35 '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan; case z of '+': begin Emit(' POP EBX'); Emit(' ADD EAX,EBX'); end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' SUB EAX,EBX'); end; '&': begin Emit(' POP EBX'); Emit(' AND EAX,EBX'); end; '|': begin Emit(' POP EBX'); Emit(' OR EAX,EBX'); end; '^': begin Emit(' POP EBX'); Emit(' XOR EAX,EBX'); end; end; end;end;

procedure IzrazDodjeljivanja;var z: char;begin Izraz; case znak of ':': begin if not (Slijedi(':=')) then Greska(OCEKDOD); Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja; Emit(' POP EBX'); Emit(' MOV [EBX],EAX'); end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz; Emit(' POP EBX'); Emit(' CMP EBX,EAX'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); end; end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace') then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja; Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok') then Petlja else if Slijedi('ako') then Uslov else if Slijedi('asembler') then Asembler else begin IzrazDodjeljivanja; IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija;var ImeFunkcije: string;begin if (znak < 'A') or (znak > 'Z') then Greska(IMEFUN); ImeFunkcije := znak;

Novi; while (znak >= 'a') and (znak <= 'z') do begin ImeFunkcije := ImeFunkcije + znak; Novi; end; case znak of '{': begin Emit('P_' + ImeFunkcije + ':'); Emit(' POP EDX'); Emit(' ADD ESP,ECX'); Emit(' SUB ESP,104'); Emit(' PUSH EDX'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); IdiDo('{'); Blok; Emit(' POP EBP'); Emit(' RET 104'); Emit('PUBLIC P_' + ImeFunkcije); end; ';': begin Emit('extrn P_' + ImeFunkcije + ':near'); IdiDo(';'); end else Greska(DEFFUN); end;end;

procedure Prevedi;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; Novi; while (Slijedi('funkcija')) do begin Novi; DefFunkcija; end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Emit('GLOBALV DD 26 DUP(0)'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 36: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

368. DEKLARACIJE VARIJABLI, STANDARDNE FUNKCIJE

Iako već prihvatljiva da u nekim kraćim kursevima kompajlera bude i finalna, prethodna verzija kompajlera ima četiri ozbiljna nedostatka:

Jednoslovna imena varijabli ograničavaju jezik na 26 lokalnih/parametarskih i toliko globalnih varijabli. Iako je to često dovoljno, postoje situacije kada nije. Sem toga, ova imena nisu dovoljno deskriptivna.

Jedini tip je 32 bitni cijeli broj koji se slučajno poklapa sa pointerom.

Programski jezik nema nikakve semantičke analize. Sasvim je legalno napisati izraz tipa 5:=2+a; što će upisati vrijednost zbira konstante 2 i varijable a, na neku slučajnu lokaciju gdje je u tom trenutku pokazivao EBX registar. Funkcija može biti deklarisana više puta, a grešku će primijetiti tek asembler.

Poziv potprograma nije standardan, pa se sistemske funkcije moraju pozivati iz asemblerskog modula.

8.1. Tabela identifikatoraUvođenje višeslovnih imena varijabli zahtijeva napuštanje statičkog načina alokacije varijabli i pravljenje tabele

identifikatora. Tabela identifikatora TabIdent je niz slogova

TIdent=record ime:string[20]; duzina:integer; adresa:integer; nivo:integer; vrsta:Tvrsta; tip:Ttip; pod1:integer; pod2:integer; pod3:integer;end;

koji čuvaju ime identifikatora, dužinu, relativnu adresu identifikatora u skupu svih varijabli unutar funkcije ili globalnih varijabli, nivo koji predstavlja identifikator funkcije kojoj varijabla pripada (ili 0 za globalne), vrstu identifikatora (funkcija, lokalna varijabla, globalna varijabla, parametar), tip identifikatora (karakter, cijeli broj, pointer na karakter, pointer na cijeli broj), kao i tri dodatna podatka za šire objašnjenje identifikatora.

Ova promjena u koncepciji zahtijeva dodavanje novih procedura, kao i da neke procedure u kompajleru budu proširene, a neke čak i nanovo napisane, čime kompajler postaje gotovo duplo duži u odnosu na prethodnu verziju.

Procedura NoviIdent dodaje identifikator u tabelu identifikatora. Dodavanje se vrši trivijalno, uvećanjem brojača identifikatora ukupnoident za 1, a zatim upisom svih devet parametara ove procedure u odgovarajuća polja konkretnog sloga tabele identifikatora.

U svrhu traženja željenog identifikatora u ovoj tabeli uvodi se funkcija NadjiIdent koja ima za parametre ime identifikatora, nivo koji predstavlja identifikator funkcije kojoj varijabla pripada (ili 0 za globalne), vrstu uslova i dodatni podatak. Ova funkcija treba da vrati poziciju navedenog identifikatora u tabeli identifikatora, ili vrijednost 0 ako identifikator nije nađen. Pretraživanje se vrši sekvencijalno jer identifikatori nisu sortirani. No, ono se vrši s kraja prema početku, kako bi lokalne varijable bile nađene prije istoimenih globalnih. Značenje parametra “vrsta uslova” dato je u tabeli na slici Sl. 8.1.1.Broj Značenje

1 Traži lokalnu varijablu, globalnu varijablu, parametar funkcije ili funkciju koja ima ime kao navedena a nalazi se u funkciji koja se trenutno prevodi ili glavnom programu

2 Traži lokalnu varijablu, globalnu varijablu, parametar funkcije ili funkciju koja ima kao navedena a nalazi se u ili funkciji koja se trenutno prevodi ili u glavnom programu ako se on u tom trenu prevodi

3 Rezervisano

4 Traži parametar funkcije koja se prevodi u ovom trenutku po njegovom rednom broju

Sl. 8.1.1. Parametar Vrsta uslovaProcedura UzmiIdent vraća string vrijednost koja predstavlja niz slova. Algoritam koji implementira tu proceduru

izgleda ovako:

Page 37: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

37Postavi rezultantni string na prazan stringSve dok slijedi slovo dodaj ga na rezultantni string, i uzmi sljedeći znakAko je sljedeći znak blanko ili komentar dohvati ga kako bi ga rutine ignorisale

Procedura DeklIdent objedinjuje UzmiIdent i NadjiIdent, tj. dohvata identifikator i traži da li on već postoji u tabeli, te ako postoji prijavljuje grešku.

Sada je potrebno proširiti sintaksu jezika. Prvo treba definisati pojam identifikatora, koji je prikazan na slici Sl. 8.1.2.

Identifikator:

Sl. 8.1.2. IdentifikatorRealizacija jezičkog pojma Identifikator urađena je u proceduri UzmiIdent.

8.2. TipoviPostoje četiri tipa varijabli, cijeli, karakter, te pointeri na njih. Oni se zajedno definišu u pojmu ImeTipa, (Sl. 8.2.1)

koji je implementiran u funkcijama SlijediDekTipa i TipDek. Funkcija

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;

provjerava da li slijedi navedeno ime tipa ili pointer na njega. Ako ne slijedi ni jedno ni drugo, funkcija vraća false. Ime tipa se navodi kao niz karaktera, a u varijablu tip funkcija vraća oznaku tipa ili pointera na njega. Ove oznake se navode kao parametri stip i ptip i mogu biti karakter, cijeli, pkarakter i pcijeli. Rogobatna sintaksa funkcije TipDek se prevazilazi funkcijom

function SlijediDekTipa(var tip: TTip):Boolean

koja vraća true ako slijedi ime bilo kojeg tipa, a kao bočni efekt u varijabli tip se dobije oznaka tog tipa.

ImeTipa

Sl. 8.2.1. Ime tipa Veličina prostora koji zauzima pojedinačna varijabla nekog tipa dobija se funkcijom DuzinaTipa. Za tip karakter,

ta vrijednost iznosi 1 bajt, dok za tipove cijeli, pkarakter i pcijeli veličina prostora je 4 bajta.

8.3. Deklarisanje varijabli i nova struktura programaNakon uvođenja identifikatora i imena tipa, može se pristupiti deklarisanju varijabli. Deklaracija varijabli izgleda kao

na slici Sl. 8.3.1.

Deklaracija varijabli:

Sl. 8.3.1. Deklaracija varijabli

Identifikator

,

;ImeTipa

cijeli *

karakter *

Slovo (veliko ili malo)

Slovo (veliko ili malo)

_

Cifra

Page 38: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

38Na primjer:

cijeli Duzina, Sirina;karakter * ime;

U suštini, deklaracija svake nove varijable jednostavno povećava ukupnu veličinu prostora za same varijable, bilo u prostoru za globalne varijable, bilo na steku za lokalne varijable. Tada se u slogu koji predstavlja dati identifikator upiše relativna adresa gdje se nalazi varijabla kojoj se pristupa. Dakle, u generisanom asemblerskom kodu se ne čuva ime varijable.

Pojam programa sada uključuje deklaraciju varijabli, definiciju funkcija i glavni blok. Varijable i funkcije se mogu u programu neograničeno puta ponavljati. Ako se u glavnom bloku nalazi samo zatvorena zagrada, tada je riječ o biblioteci funkcija. Nova definicija pojma Program nalazi se na slici Sl. 8.3.2.

Program:

Sl. 8.3.2. ProgramDeklaracija funkcije će biti prikazana kasnije.

8.4. Izrazi i semantikaUvođenje jedinstvenog sistema identifikatora zahtijeva izmjenu jezičkog pojma Faktor u kome se zbog toga ukida

sintaksa lokalnih varijabli sa znakom @, te prepoznavanje funkcije tako što joj ime počinje velikim slovom. Sada je pogodan trenutak i za uvođenje znakovne konstante koja se, kao u C-u, navodi između jednostrukih navodnika. Jezički pojam Faktor sada izgleda kao na slici Sl. 8.4.1

Faktor:

Sl. 8.4.1. Faktor

Deklaracijavarijabli

Deklaracijafunkcije

{ Blok

}

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String konstanta

Poziv funkcije

‘ Slovo ‘

Page 39: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

39Realizacija slovne konstante je trivijalna i svodi se na prostu MOV AL,konstanta instrukciju. No, iako se sintaksno ne

mijenjaju ostali jezički pojmovi koji sačinjavaju izraz, procedure koje ga realizuju potrebno je radikalno promijeniti. Razlog tome je uvođenje semantike i različitih tipova.

Ozbiljan semantički problem da je u prethodnim verzijama kompajlera moguće napisati 5+3:=a-8; rješava se uvođenjem varijabilnog parametra dod u sve procedure koje realizuju aritmetičke izraze. Prilikom obrade dijela izraza, ovom parametru daje se vrijednost true, ako se tom dijelu izraza može dodijeliti vrijednost. Tipično, to su varijable, elementi nizova i lokacije na koje pokazuju pointeri. Ovaj parametar će se provjeravati u proceduri IzrazDodjeljivanja nakon prvog poziva procedure Izraz i prijaviti greška ukoliko on nema tačnu vrijednost.

Procedurama koje predstavljaju dijelove aritmetičkih izraza dodaje se još jedan varijabilni parametar. Preko tog parametra se vraća tip dijela aritmetičkog izraza, tj. da li je karakter, cijeli broj, pointer itd.

Jezik koji se ovdje razvija spada u jezike slabe tipiziranosti i omogućava automatske konverzije između podataka različitih tipova prilikom dodjeljivanja. To znači da je legalno napisati

a:=’#’+1;gdje je a cjelobrojna varijabla. Iako su sabirci u gornjem zbiru različitog tipa (karakter i cijeli broj), ipak rezultat

predstavlja cijeli broj 36, jer je ASCII kôd znaka # jednak 35.

Cijeli brojevi i pointeri zahtijevaju četiri bajta za njihovo predstavljanje, dok se karakteri mogu smjestiti u jedan bajt. Baš kao što se za smještanje cijelih brojeva u toku izraza koriste registri EAX, EBX i stek, za karaktere se koriste AL, BL i stek, pri čemu se zbog karakteristika steka na stek smještaju čitavi EAX/EBX registri.

U primjeru “a:=’#’+1” kompajler generiše kôd za smještanje konstante 35 u registar AL, ali nakon toga nalazi cjelobrojnu konstantu 1, zaključuje da je ipak riječ o izrazu sa 32 bitnim rezultatom pa registar AL konvertuje u EAX i nastavlja da generiše kôd kao da je riječ o sabiranju dva 32 bitna broja. Konverzija registra AL u EAX se vrši postavljanjem viših 24 bita na nula instrukcijom AND.

Većina udžbenika o kompajlerima izbjegava miješanje različitih tipova podataka unutar jednog aritmetičkog izraza. Razlog je u tome što je broj potrebnih konverzija jednak kvadratu broja tipova koji se u tom izrazu mogu pojaviti. Razrješenju tog problema pomažu tablice, navedene u sljedećoj tački.

8.5. Tablice generisanog koda za različite operandePošto ima dosta kombinacija lijevog i desnog operanda, za sve binarne i unarne operatore potrebno je napraviti

odgovarajuće tablice koje određuju kakav će se kôd generisati zavisno od operatora i tipa operanada. Pri prikazu generisanog koda, dio koji se jednom ili više puta ponavlja (ukoliko se dati operator uzastopno ponavlja više puta) stavljen je u vitičaste zagrade.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

+Samo za slučaj sabiranja dva karaktera rezultat je tipa karakter, u svim ostalim slučajevima rezultat je cijeli broj

karakter Clan{PUSH EAXClanPOP EBXADD AL,BL}

Clan{PUSH EAXClanPOP EBXAND EBX,0FFhADD EAX,EBX}

Nije dopušteno Nije dopušteno

cijeli Clan{PUSH EAXClanPOP EBXAND EAX,0FFhADD EAX,EBX}

Clan{PUSH EAXClanPOP EBXADD EAX,EBX}

Nije dopušteno Nije dopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

Sl. 8.5.1. Generisani kôd za sabiranje zavisno od tipova argumenata

Page 40: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

40

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

-Samo za slučaj oduzimanja dva karaktera

rezultat je tipa karakter, u svim ostalim slučajevima rezultat je cijeli broj

karakter Clan{PUSH EAXClanMOV EBX,EAXPOP EAXSUB AL,BL}

Clan{PUSH EAXClanMOV EBX,EAXPOP EAXAND EAX,0FFhSUB EAX,EBX}

Nije dopušteno Nije dopušteno

cijeli Clan{PUSH EAXClanMOV EBX,EAXPOP EAXAND EBX,0FFhSUB EAX,EBX}

Clan{PUSH EAXClanMOV EBX,EAXPOP EAXSUB EAX,EBX}

Nije dopušteno Nije dopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

Sl. 8.5.2. Generisani kôd za oduzimanje zavisno od tipova argumenata

Iz tabela sa sabiranje i oduzimanje (Sl. 8.5.1 i Sl. 8.5.2) vidi se da pointerski tipovi ne mogu učestvovati u operacijama sabiranja i oduzimanja. Samo ako su oba operanda karakteri koriste se instrukcije ADD AL,BL ili SUB AL,BL. Ako je jedan operand karakter ubacuje se AND EAX,0FFh ili AND EBX,0FFh. Na ovaj način se tri viša bajta EAX ili EBX registra postavljaju na nule, bez izmjena registara AL odnosno BL. To predstavlja efikasnu konverziju između karaktera i cijelih brojeva. Ako su oba operanda cijeli brojevi, nema dodatnih instrukcija.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

&

rezultat je karakter ako su oba argumenta tog tipa, inače cijeli

Cijeli ili karakter

Clan{PUSH EAXClanPOP EBXAND EAX,EBX}

Clan{PUSH EAXClanPOP EBXAND EAX,EBX}

Nije dopušteno Nije dopušteno

|

tip kao kod &

Cijeli ili karakter

Clan{PUSH EAXClanPOP EBXOR EAX,EBX}

Clan{PUSH EAXClanPOP EBXOR EAX,EBX}

Nije dopušteno Nije dopušteno

^

tip kao kod &

Cijeli ili karakter

Clan{PUSH EAXClanPOP EBXXOR EAX,EBX}

Clan{PUSH EAXClanPOP EBXXOR EAX,EBX}

Nije dopušteno Nije dopušteno

Sl. 8.5.3. Generisani kôd za logičke operacije zavisno od tipova argumenata

Logičke operacije (Sl. 8.5.3) nemaju prijenosa, jer se obavljaju bit po bit. Kod ovih instrukcija nema potrebe za specijalnim slučajevima u kodu.

Page 41: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

41

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

*

Tip rezultata je uvijek cijeli broj

karakter Faktor{PUSH EAXFaktorPOP EBXAND EAX,0FFhAND EBX,0FFhIMUL EBX}

Faktor{PUSH EAXFaktorPOP EBXAND EBX,0FFhIMUL EBX}

Nije dopušteno Nije dopušteno

cijeli Faktor{PUSH EAXFaktorPOP EBXAND EAX,0FFhIMUL EBX}

Faktor{PUSH EAXFaktorPOP EBXIMUL EBX}

Nije dopušteno Nije dopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

Sl. 8.5.4. Generisani kôd za množenje zavisno od tipova argumenata

Na slici Sl. 8.5.4 se vidi da pri množenju nisu dopušteni pointeri kao faktori, a da se faktori koji su tipa karakter trebaju prije množenja konvertovati u cijeli broj instrukcijama AND EAX,0ffh ili AND EBX,0ffh.

Operacija Desni

Lijevi

Karakter Cijeli karakter * cijeli *

/

Tip rezultata je uvijek cijeli broj

karakter Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhAND EBX,0FFhCDQIDIV EBX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhCDQIDIV EBX}

Nije dopušteno Nije dopušteno

cijeli Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EBX,0FFhCDQIDIV EBX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXCDQIDIV EBX}

Nije dopušteno Nije dopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

Sl. 8.5.5. Generisani kôd za dijeljenje zavisno od tipova argumenata

Page 42: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

42

Operacija Desni

Lijevi

Karakter Cijeli karakter * cijeli *

%

Tip rezultata je uvijek cijeli broj

karakter Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhAND EBX,0FFhCDQIDIV EBXMOV EAX,EDX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EAX,0FFhCDQIDIV EBXMOV EAX,EDX}

Nije dopušteno Nije dopušteno

cijeli Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXAND EBX,0FFhCDQIDIV EBXMOV EAX,EDX}

Faktor{PUSH EAXFaktorMOV EBX,EAXPOP EAXCDQIDIV EBXMOV EAX,EDX}

Nije dopušteno Nije dopušteno

karakter * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

cijeli * Nije dopušteno Nije dopušteno Nije dopušteno Nije dopušteno

Sl. 8.5.6. Generisani kôd za ostatak pri dijeljenju zavisno od tipova argumenata

Na slikama Sl. 8.5.5 i Sl. 8.5.6 se vidi da pri dijeljenju i ostatku pri dijeljenju nisu dopušteni pointeri kao operandi, a da se operandi koji su tipa karakter trebaju prije dijeljenja konvertovati u cijeli broj instrukcijama AND EAX,0ffh ili AND EBX,0ffh.

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

:=

Tip rezultata je tip koji ima operand sa lijeve strane operatora

karakter IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],AL

cijeli IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

karakter * Nije dopušteno IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

cijeli * Nije dopušteno IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

IzrazPUSH EBXIzrazdodjeljPOP EBXMOV [EBX],EAX

Sl. 8.5.7. Generisani kôd za dodjeljivanje zavisno od tipova argumenata

Iz tabele Sl. 8.5.7 vidi se da se karakter ne smije dodijeliti pointeru, a da je međusobna razlika svih ostalih kombinacija tipova operanada u tome što ako se s lijeve strane izraza dodjeljivanja nalazi varijabla karakterskog tipa, da se na navedenu adresu na koji pokazuje registar EBX upisuje sadržaj registra AL. Pointerske varijable se mogu dodjeljivati cjelobrojnim i obrnuto, bez eksplicitnog navođenja imena tipa (type casting).

Page 43: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

43

Operacija Desni

Lijevi

Karakter cijeli karakter * cijeli *

= # < >

Tip rezultata je uvijek cijeli broj. Promijeniti instrukciju SETE u

Za = SETE

Za < SETL

Za > SETG

Za # SETNE

karakter IzrazPUSH EAXIzrazPOP EBXCMP BL,ALSETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXAND EAX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

cijeli IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

karakter * IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

cijeli * IzrazPUSH EAXIzrazPOP EBXAND EBX,0FFhCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

IzrazPUSH EAXIzrazPOP EBXCMP EBX,EAX SETE ALAND EAX,0FFh

Sl. 8.5.8. Generisani kôd za poređenje zavisno od tipova argumenata

Tabela na slici Sl. 8.5.8 obuhvata sva četiri relaciona operatora, pri čemu je za svaki navedeni operator potrebno upisati odgovarajuću SETxx instrukciju.

Unarni operatori i generisani kôd za njih su navedeni na slici Sl. 8.5.9.

Operacija Karakter cijeli karakter * cijeli *

Unarni - Nije dopušteno FaktorNEG EAX(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Unarni * Nije dopušteno Nije dopušteno FaktorMOV EBX,EAXMOV EAX,[EBX]AND EAX,0FFh(rez. tip je karakter )

FaktorMOV EBX,EAXMOV EAX,[EBX](rez. tip je cijeli)

Unarni & FaktorMOV EAX,EBX(rez. tip je karakter *)

FaktorMOV EAX,EBX(rez. tip je cijeli *)

FaktorMOV EAX,EBX(rez. tip je cijeli *)

FaktorMOV EAX,EBX(rez. tip je cijeli *)

Unarni ! CMP EAX,0 SETE ALAND EAX,0FFh(rez. tip je karakter )

CMP EAX,0SETE AL(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Unarni ~ FaktorNOT AL(rez. tip je karakter )

FaktorNOT EAX(rez. tip je cijeli )

Nije dopušteno Nije dopušteno

Sl. 8.5.9. Generisani kôd za unarne operatore zavisno od tipova argumenata

Na bazi gornjih tabela se mijenjaju funkcije Clan, Faktor, Izraz i IzrazDodjeljivanja. Iskorištavaju se uočene pravilnosti u generisanom kodu, jer nema potrebe mnogo puta ponavljati isti skup naredbi.

8.6. Funkcije i provjera parametaraDeklaracija funkcije se u ovoj verziji kompajlera proširuje definisanjem svih parametara i lokalnih varijabli koje

funkcija može imati, kao na slici Sl. 8.6.1.

Page 44: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

44

Sl. 8.6.1. Deklaracija funkcije

Deklarisanje parametara i lokalnih varijabli se realizuje tako da se za svaki prepoznati identifikator dodaju podaci o njemu u tabelu identifikatora, pri čemu se za nivo uzima pozicija identifikatora funkcije u tabeli svih identifikatora.

Po Windowsovom standardu svi parametri, bez obzira na veličinu, moraju biti poravnati na adrese djeljive sa 4. Pod poravnanjem se podrazumijeva smještanje svih podataka tako da počinju od adrese djeljive s nekim paranim brojem. Lokalne varijable moraju biti poravnate na adrese djeljive sa 4 ako je njihova dužina djeljiva sa 4. Prema redoslijedu smještanja parametara na stek razlikuju se konvencije:

a) C call, parametri se smještaju na stek PUSH instrukcijama u obrnutom redoslijedu u odnosu na navedeni u pozivu funkcije, a poziciju stek pointera vraća u prvobitno stanje glavni program. Ovaj način poziva se koristi u Windows API funkciji wvsprintf i svim funkcijama biblioteke MSVCRT.DLL (biblioteka Microsoft C kompajlera)

b) Pascal call, parametri se smještaju na stek PUSH instrukcijama u istom redoslijedu u odnosu na navedeni, a poziciju stek pointera vraća u prvobitno stanje potprogram. Koristi se u svim sistemskim pozivima za Windows 3.1 aplikacije

c) StdCall, parametri se smještaju na stek PUSH instrukcijama u obrnutom redoslijedu u odnosu na navedeni, a poziciju stek pointera vraća u prvobitno stanje potprogram. Koristi se u većini Win32 API funkcija.

d) Fast Call, parametri su u registrima, koristi se pri pozivu DOS interapta

e) Inline Call, parametri se navode u memorijskom bloku, (na fiksnoj lokaciji ili neposredno iza CALL instrukcije= obično se interno koristi u asemblerskim programima.

Najlakše je prilagoditi postojeći kompajler da generiše pozive po Pascal Call standardu, pa će ovaj način poziva biti i implementiran. Pri tome će se ime potprograma generisati od imena funkcije iza kojeg slijedi znak @ i ukupan broj bajtova koliko zauzimaju parametri. Tako na primjer funkcija čije je ime Racunaj i koja ima tri parametra će u generisanom kodu imati ime Racunaj@12. Ovo je učinjeno da bi se postigla izvjesna kompatibilnost sa Win32 API funkcijama koje imaju interno iste ovakve nazive, a kojih postoji preko 9000.

Windows API funkcije, međutim, koriste standard StdCall, koje zahtijeva suprotan redoslijed postavljanja parametara na stek od standarda Pascal Call. Ovaj problem je rješiv tako što se pri pozivu ovih funkcija navode parametri obrnutim redoslijedom u odnosu na onaj kojim se parametri navode u jeziku C i kako su definisan u standardnoj dokumentaciji za Windows API.

Generisani kôd za definiciju funkcije izgleda kao na slici Sl. 8.6.2.

Sl. 8.6.2. Definicija funkcije, generisani kôdPostavljanje EBP registra na mjesto gdje se ESP nalazio prije alokacije prostora za lokalne varijable, omogućava da

se lokalnim varijablama pristupa sa MOV EAX,[EBP-nn] a parametrima sa MOV EAX,[EBP+nn]. Odgovarajuće konstante nn se računaju prilikom deklaracija lokalnih varijabli i parametara i nalaze se u polju adresa tabele identifikatora. Za parametre, prije dohvatanja prvog parametra ovo polje ima vrijednost 0, a zatim se uvećava za ((duzinavarijable-1) div 4 + 1)*4 nakon

PUSH EBPRacunaj@12: (zavisno od imena i prostora za parametre) MOV EBP,ESP SUB ESP,velicina prostora za lokalne varijable Pozovi Blok; MOV ESP,EBP POP EBP RET velicina prostora za parametre PUBLIC Racunaj@12

Identifi-kator ( Identifi-

katorImeTipa Ime

Tipa )

,

{ BlokDeklaracia varijabli

funkcija

;

Page 45: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

45svakog deklarisanog parametra. Za lokalne varijable, prije dohvatanja prve lokalne varijable, ovo polje ima vrijednost 0, a zatim se, kako se redom dohvataju varijable, po apsolutnoj vrijednosti uvećava za duzinavarijable, a upisuje se negativna vrijednost.

Generisani kôd za poziv funkcije, prikazan na slici Sl. 8.6.3 se vrlo malo promijenio od prethodne verzije kompajlera

Sl. 8.6.3. Generisani kôd za poziv funkcije

Globalnim varijablama se i sada pristupa sa MOV EAX,GLOBALV[nn] pri čemu se nn nalazi u polju adresa tabele identifikatora. Ako je varijabla tipa karakter registar EAX treba zamijeniti registrom AL. Prilikom deklaracije globalnih varijabli prije dohvatanja prve globalne varijable ovo polje ima vrijednost 0, a zatim se kako se redom dohvataju varijable po apsolutnoj vrijednosti uvećava za duzinavarijable.

Koristeći sve ove informacije, može se napisati nova verzija kompajlera. Navedena je u prilogu broj 5.

8.7. Testni primjerPrimjer programa u petoj verziji jezika može biti identičan prethodnom primjeru, uz izbacivanje potrebe da se dijelovi

pišu u asembleru. Ipak, pošto dosadašnji primjeri nisu imali ulaz, dodano je da se unese ime korisnika na početku, a zatim ono i prikaže na ekranu. Za čitanje se koristi API funkcija ReadConsoleA, koja ima iste parametre kao i WriteConsoleA, samo što zahtijeva standardni hendl –10, umjesto –11.

Primjer se prevodi koristeći

komp32v5 tabbroj2.jez tabbro2j.asm ml /c /coff /Fl tabbroj2.asm | morelink /defaultlib:user32.lib kernel32.lib /subsystem:console tabbroj2.obj

Izvorni kôd primjera naveden je na slici Sl. 8.7.1

Za svaki parametar (osim ako se karakter prosljeđuje pointeru što je greška):Pozovi IzrazdodjeljivanjaAko se karakter prosljeđuje cijelim brojevima generiši AND EAX,0FFhPUSH EAX

MOV ECX,ukupna veličina svih parametaraCALL funkcija@duzinaparametaraAko funkcija vraća karakter generiši AND EAX,0FFh

Page 46: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

46

cijeli funkcija GetStdHandle(cijeli brhan);cijeli funkcija WriteConsoleA(cijeli rez,cijeli * upisano, cijeli upisati,karakter * bafer,cijeli han);cijeli funkcija ReadConsoleA(cijeli rez,cijeli * upisano, cijeli upisati,karakter * bafer,cijeli han);cijeli * a; ` Ovo je zapravo niz pointera na stringovecijeli * ime;cijeli funkcija Prikazistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-11); duz:=0; dok (poruka[duz]#0) { duz:=duz+1;} WriteConsoleA(0,&priv,duz,poruka,handle);}cijeli funkcija Unesistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-10); duz:=30; ReadConsoleA(0,&priv,duz,poruka,handle);}cijeli funkcija Novired () { karakter * dvoznak; dvoznak:=" "; dvoznak[0]:=13; dvoznak[1]:=10; Prikazistring(dvoznak);}cijeli funkcija Predstavljanje (){ ime:=" "; Unesistring(ime); Prikazistring("Tabelu generisao "); Prikazistring(ime); Novired();}cijeli funkcija Prikazibroj (cijeli broj){ cijeli cifra,negativan,pokazivac,ostatak; karakter * bafer; bafer:=" "; ` Alociramo bafer cifra:=broj;` Negativne brojeve oznaci indikatorom ako (cifra<0) { negativan:=1; cifra:=-cifra; } inace { negativan:=0; }`maksimalno 9 cifara pokazivac:=9; ako (cifra=0) { bafer[pokazivac]:='0'; pokazivac:=pokazivac-1; } dok (cifra>0) { ostatak:=(cifra % 10); `ostatke dijeljenja u bafer bafer[pokazivac]:=ostatak+'0'; cifra:=cifra/10; ` stalno dijeli s 10 pokazivac:=pokazivac-1; } ako (negativan=1) {

bafer[pokazivac]:='-'; pokazivac:=pokazivac-1; } bafer:=&(bafer[pokazivac+1]); ` Pomjeri pokazivac pocetka stringa Prikazistring(bafer);}cijeli funkcija Fact(cijeli a){ ako (a=0) { 1; } inace { a*Fact(a-1); }}cijeli funkcija Tabela(){ cijeli m,n; Prikazistring("Tabela"); Novired(); n:=1; dok (n<11) { Prikazibroj (n); Prikazistring(" "); Prikazistring(a[n]); Prikazistring(" "); Prikazibroj (n*n); Prikazistring(" "); Prikazibroj (n*n*n); Prikazistring(" "); Prikazibroj (Fact(n)); Prikazistring(" Djeljiv sa "); m:=1; dok !(m>n) { ako (n%m=0) { Prikazibroj(m); Prikazistring(" "); } m:=m+1; } n:=n+1; Novired(); }}cijeli funkcija Postavinazive(){ a:=" "; ` Prostor za niz a[1]:="Jedan"; a[2]:="Dva"; a[3]:="Tri"; a[4]:="Cetiri"; a[5]:="Pet"; a[6]:="Sest"; a[7]:="Sedam"; a[8]:="Osam"; a[9]:="Devet"; a[10]:="Deset";}{ Predstavljanje(); Postavinazive(); Tabela();}

Sl. 8.7.1. Primjer: Tablica brojeva bez asemblerskih modula

8.8. Rezime poglavljaOva verzija kompajlera predstavlja veliki skok naprijed i omogućava realizaciju većine aplikacija koje koriste cijele brojeve i stringove. Uvedeni su tipovi cijeli, cijeli *, realni i realni *. Program se sada sastoji iz deklaracija varijabli, deklaracija funkcija i tijela programa Imena varijabli se sastoje iz više slova, pa je potrebna tablica identifikatora. Pri pozivu funkcija provjerava se broj i tipovi argumenata. Uvođenje tipova usložnjava aritmetičke izraze i zahtijeva pažljivo praćenje generisanog koda za svaku kombinaciju operanada različitog tipa. U testnim primjerima opada potreba za asemblerom.

Page 47: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

47Prilog 5: Verzija izvornog koda kompajlera br. 5program Kompajler;const MAXIDENT = 1024; DUGAKONST = 'Konstanta prevazilazi liniju'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator';

type TVrsta = (funkcija, lokalna, globalna, parametar); TTip = (karakter, cijeli, pkarakter, pcijeli); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident: integer; t: TTip; dod: Boolean;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);

end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi; UzmiKonstantu := rezultat; t := cijeli; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true;

if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;begin TipDek := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; Novi end else tip := stip; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;begin case tip of cijeli, pcijeli, pkarakter: DuzinaTipa := 4; karakter: DuzinaTipa := 1; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 4: Uslov := (TabIdent[n].nivo = nivo) and

Page 48: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

48 (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta = parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean);var t1: TTip;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; IdiDo(']'); dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) =

'''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if (t1 = karakter) and (t2 in [pkarakter, pcijeli]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); velsteka := velsteka + 4; Emit(' PUSH EAX'); if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh0');end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; dod := true; if znak = '[' then PokazivacINiz(t, dod);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of

cijeli: Emit(' NEG EAX'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin

Page 49: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

49

NoviSvaki(true); Emit(' MOV AL,''' + znak + '''');

Page 50: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

50

Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); Str(rezultat, st); Emit(' MOV EAX,' + st); end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end;

Page 51: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

51 else Greska(GRIZRAZ); end;end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX'); Novi; Faktor(t2, dod); dod := false; if ((t1 <> cijeli) and (t1 <> karakter)) or ((t2 <> cijeli) and (t2 <> karakter)) then Greska(POGRMNOZ); t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin Emit(' PUSH EAX'); z := znak; Novi; Clan(t2, dod); dod := false; if ((t1 <> cijeli) and (t1 <> karakter)) or ((t2 <> cijeli) and (t2 <> karakter)) then Greska(NEDOPARIT); case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin

t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean;begin Izraz(t1, dod1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); Novi; IzrazDodjeljivanja(t2, dod); Emit(' POP EBX'); if (t2 = karakter) and (t1 <> karakter) and (t1 <> cijeli) then Greska(DODJPOINT); if t1 = karakter then Emit(' MOV [EBX],AL') else Emit(' MOV [EBX],EAX'); t := t1; end; {:} '=', '>', '<', '#': begin Emit(' PUSH EAX'); z := znak; Novi; Izraz(t2, dod); Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi;

IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident;

Page 52: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

52 aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, 0); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, 0); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st);

Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.386'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, 0);

globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB ' + st + ' DUP(0)'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 53: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

539. REALNI BROJEVI

Na listi prioriteta koje treba implementirati slijede realni (floating point) brojevi. Iako se mnogi problemi koji zahtijevaju upotrebu ovih brojeva mogu riješiti i cjelobrojnom aritmetikom uz potrebno skaliranje (fixed point), preostaju problemi kod kojih je aritmetika u pokretnom zarezu nezamjenjiva.

9.1. KoprocesorIzbor procesora 486 i Pentium za ciljnu arhitekturu navodi da se aritmetika u pokretnom zarezu realizuje koristeći

instrukcije koprocesora koji je u njih ugrađen, umjesto pisanja posebnih potprograma. Čak i za procesore 386 i 486SX (kojima koprocesor nedostaje), Windows 95 obezbjeđuje softverske emulatore koprocesora.

Instrukcije za rad u pokretnom zarezu su drugačije koncipirane od instrukcija za cjelobrojnu aritmetiku. One ne operišu sa uobičajenim registrima, nego imaju interni stek na koji može da stane osam konstanti, velikih 32, 64 ili 80 bita.

Kao optimalna veličina FP brojeva uzeće se 64 bita, tj. dvostruka preciznost. Brojevi u memoriji su predstavljeni po IEEE-754 standardu. Po ovom standardu, bitovi 0-51 predstavljaju mantisu, bitovi 52-62 predstavljaju eksponent, a bit 63 predznak broja.

9.2. Realne konstantePrije svega je potrebno proširiti sintaksu numeričke konstante. Gotovo svi programski jezici poznaju realne brojeve u

formi “2.4E-8” , što predstavlja 2,4·108 u klasičnom obliku. Pri tome se mogu izostaviti predznak eksponenta, čitav eksponentski dio ili necijeli dio frakcije. Stoga nova sintaksa za numeričke konstante izgleda kao na slici Sl. 9.2.1

Numerička konstanta

Sl. 9.2.1. Numerička konstanta

Konvertovanje brojeva iz uobičajenog dekadnog formata tipa “2.4E-8” u format “binarna mantisa i eksponent” je složen, neportabilan, posao koji je podložan numeričkim greškama. Na sreću, većina 32-bitnih asemblera već poznaje ovaj format konstanti, pa je dovoljno proslijediti izvorno napisan broj asembleru, koji će pravilno upisati u memoriju konstante oblika

KONST DQ 2.4E-8

Stoga je nova verzija procedure UzmiKonstantu razmjerno jednostavna. Ova procedura pored računa cjelobrojne konstante, sve njene znakove pridodaje na jedan string, koji je u globalnoj varijabli realnakonstanta. Ako se pri dohvaćanju znakova naiđe na znak ‘.’ ili ‘E’, prestaje se s računom cjelobrojne konstante, ali se nastavlja pridodavanje znakova na spomenutu globalnu string varijablu, uz stalnu provjeru sintakse.

U okviru procedure Faktor, prilikom obrade numeričkih konstanti se provjeri da li je procedura UzmiKonstantu vratila cjelobrojnu ili realnu vrijednost. U slučaju cjelobrojne vrijednosti generiše se uobičajena MOV EAX,nn instrukcija. Ako je u pitanju realna konstanta, tada se vrijednost te konstante ne treba staviti u EAX registar nego na vrh FP steka. Da bi se to postiglo treba generisati sljedeći kôd

.DATAL12 DQ 2.4E-8.CODE FLD L12

pri čemu su oznaka labele i konstanta dati radi ilustracije.

9.3. Komunikacija između FP steka i memorije

Cifra.

Cifra E

+

-

Cifra

Page 54: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

54FP stek je ograničen na svega osam konstanti, za razliku od steka adresiranog ESP registrom za koji je operativni

sistem rezervisao nekoliko desetina kilobajta. To onemogućava rekurzivno računanje nekih funkcija, pa je potrebno omogućiti privremeno čuvanje međurezultata FP operacija i na steku adresiranom ESP registrom. U tu svrhu, kao i radi konverzije između formata, se uvode sljedeće procedure:

CijeliNaFPStek (sadržaj cjelobrojnog registra se prebacuje na vrh FP steka) generiše sljedeći kôd

Ako se posmatra samo nižih osam bita cijelog broja generiši AND registar,0FFh MOV INTTOFP,registar FILD DWORD PTR INTTOFP

FPStekUCijeli (broj s vrha FP steka se prebacuje u cjelobrojni registar. Kao privremena lokacija u memoriji koristi se vrh ESP adresiranog steka) generiše sljedeći kôd

ADD ESP,-4 FISTP DWORD PTR [ESP] POP registar

CPUStekCijeliNaFPStek (cijeli broj sa vrha ESP adresiranog steka prebacuje se na vrh FP steka) generiše sljedeći kôd

Ako se posmatra samo nižih osam bita cijelog broja generiši AND DWORD PTR [ESP],0FFhFILD DWORD PTR [ESP]ADD ESP,4

FPUStekNaStek (broj u pokretnom zarezu se prebacuje sa vrha FP steka na vrh ESP adresiranog steka) generiše sljedeći kôd

ADD ESP,-8 FSTP QWORD PTR [ESP]

StekNaFPUStek (broj u pokretnom zarezu se prebacuje sa vrha ESP adresiranog steka na vrh FP steka) generiše sljedeći kôd

FLD QWORD PTR [ESP]ADD ESP,8

Gore navedene funkcije potrebne su i zato što ne postoje instrukcije za direktno prebacivanje podataka iz FP internog steka u cjelobrojne registre.

9.4. Aritmetičke operacijeAritmetičke operacije nad realnim brojevima za slučaj sabiranja, oduzimanja, množenja i dijeljenja uvijek kao rezultat

imaju realan broj, bez obzira da li je drugi argument ovih operacija cijeli broj, realni broj ili karakter.

Sabiranje u kome je bar jedan sabirak FP broj se može realizovati kodom sa slike Sl. 9.4.1.

Sl. 9.4.1. Generisanje koda za sabiranje u pokretnom zarezu

Pozovi ČlanAko je prvi član cijeli broj ili karakter generiši PUSH EAX inače pozovi FPUStekNaStekPozovi ČlanAko nijedan član nije realan broj, generiši kôd kao i ranije, prema tablicama iz

prethodnog poglavljaAko je drugi član cijeli broj ili karakter a prvi član je bio realni broj pozovi

CijeliNaFPStek za registar EAX Ako je prvi član cijeli broj ili karakter pozovi CPUStekCijeliNaFP, a ako je realni pozovi

StekNaFPUStekGeneriši FADD

Page 55: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

55Potreba za privremenim čuvanjem podataka na procesorskom steku, radi omogućivanja rekurzije, dovodi do

redundantnog koda u još izraženijem obliku nego kod cjelobrojne aritmetike. Za sada se zanemaruje taj problem, jer je u ovom trenutku tačnost i jednostavnost kompajlera u prvom planu.

Realizacija oduzimanja, množenja i dijeljenja se ne razlikuje mnogo od realizacije sabiranja. Kod ove tri operacije je potrebno umjesto FADD respektivno generisati instrukcije FSUBR, FMUL i FDIVR, koje kao i FADD obavljaju operaciju nad dva broja na vrhu FP steka, uklone ih sa FP steka i rezultat opet ostavljaju na vrh FP steka. Za množenje i dijeljenje poziv funkcije Član se zamjenjuje pozivom funkcije Faktor.

U slučaju poređenja koristi se instrukcija FCOMPP, kao na slici Sl. 9.4.2. Instrukcija FCOMPP poredi brojeve na vrhu steka, ali rezultat smješta u koprocesorske flegove. Da bi se ovi flegovi mogli testirati, instrukcijom FSTFW AX se oni smještaju u AX registar, a zatim instrukcijom SAHF prebacuju u F registar.

Instrukcija SETE se mijenja zavisno od relacijskog operatora u

'=': SETE AL '>': SETA AL '<': SETB AL '#': SETNE AL

Zanimljivo je da instrukcija FSTFW AX pakuje flegove tako da izgleda kao da se FP operacije porede nepredznačeno, iako je u pitanju predznačeno poređenje.

Sl. 9.4.2. Generisanje koda za poređenje dva realna broja

9.5. Realne varijableUvođenje dva nova tipa, realni i realni * , zahtijeva redefiniciju pojma ImeTipa :

Ime tipa:

Sl. 9.5.1. Ime tipaČitanje sadržaja realne varijable se obavlja koristeći sljedeće dvije instrukcije, od kojih je jedna već poznata

LEA EBX,adresaFLD QWORD PTR [EBX]

karakter

cijeli

*

*

realni *

Pozovi IzrazAko je prvi član cijeli broj ili karakter generiši PUSH EAX inače pozovi FPUStekNaStekPozovi IzrazAko je prvi član cijeli broj ili karakter generiši POP EBXAko nijedan član nije realan broj, generiši kod kao i ranije, prema tablicama iz

prethodnog poglavljaAko je drugi član cijeli broj ili karakter a prvi član je bio realni broj pozovi

CijeliNaFPStek za registar EAX Ako je prvi član cijeli broj ili karakter a drugi član je bio realni broj pozovi

CijeliNaFPStek za registar EBX Ako je prvi član realni pozovi StekNaFPUStekGeneriši FCOMPPGeneriši FSTSW AXGeneriši SAHFGeneriši SETE ALGeneriši AND EAX,0FFh

Page 56: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

56Međutim, kada je riječ o dodjeli vrijednosti varijabli instrukcija FLD sa lijeve strane operatora dodjeljivanja je ne

samo nepotrebna, nego i štetna jer ostavlja na FP steku konstantu i tako ga prepunjava. Pošto se unaprijed ne zna da li slijedi znak dodjeljivanja, ovo se mora neutralisati instrukcijom FSTP ST(0). Stoga se dodjela vrijednosti, kada figurišu i realne varijable, obavlja kodom sa slike Sl. 9.5.2:

Sl. 9.5.2.Sl. 9.5.3.Sl. 9.5.4.

Sl. 9.5.5. Generisanje koda za dodjeljivanje vrijednosti realnim promjenjivim

9.6. Funkcije realnog argumenta i unarni operatoriAnalognim pravilima konverzije tipova se proširuje i poziv funkcije. Svaki realni parametar na steku zauzima po 8

bajtova i umjesto prostog generisanja PUSH EAX instrukcije (slučaj ostalih tipova), ovdje se poziva procedura FPUStekNaStek. Ako je na mjestu realnog parametra u pozivu proslijeđena cjelobrojna ili karakter varijabla, prije poziva procedure FPUStekNaStek treba pozvati CijeliNaFPStek sa parametrom EAX, što će konvertovati cijeli broj u realni. Ukoliko se realna vrijednost prosljeđuje cjelobrojnom parametru, treba pozvati FPStekUCijeli prije generisanja instrukcija PUSH EAX.

Samo tri unarna operatora operatora imaju smisla u radu s realnim brojevima. To su -, & i *. Unarni minus treba da generiše instrukciju FCHS koja mijenja predznak broja na vrhu FP steka. Operator adrese pored promjene tipa, pored uobičajene MOV EAX,EBX instrukcije treba da uništi broj na vrhu FP steka koristeći FSTP ST(0) instrukciju. Operator vrijednosti na koju pointer pokazuje za tip realni * ,umjesto instrukcije MOV EAX,[EBX] , treba generisati instrukcije FSTP ST(0) i FLD QWORD PTR [EBX].

Za razliku od Fortran-a, Pascal-a i BASIC-a, transcendentne funkcije nisu sastavni dio ovog jezika. One se mogu prosto dodati u naknadno napisanim bibliotekama.

Minorna izmjena je potrebna u Entry stub dijelu generisanog koda. Mašina koja se podrazumijeva je 486, umjesto 386, te je potrebno inicijalizirati koprocesor instrukcijom FINIT, i dodati pomoćnu lokaciju INTTOFP DD 0.

Sada je moguće napisati šestu verziju kompajlera, koja je data u prilogu 6.

9.7. Testni primjerPrimjer programa u šestoj verziji jezika je jedna od numeričkih metoda. Metodom sekante (koja radi u

ekstrapolacionom i interpolacionom režimu rada) se rješava jednačina

. Kod ove metode naredna tačka se dobija formulom

Funkcija čija se nula traži navodi se unutar tijela funkcije f. Treba primijetiti da je funkcija sqrt napisana kao asemblerski potprogram, jer je to sa ovim procesorom jednostavnije i brže od vlastite implementacije Heronovog algoritma. Funkcija Prikazidecimalnibroj prikazuje broj na 5 decimala, tako što već poznatom funkcijom Prikazibroj ispiše cijeli, a zatim razlomljeni dio izraza. Kompajliranje ovog primjera se vrši na uobičajeni način, s tim što mu je ime sekanta.jez.

Pozovi IzrazPrijavi grešku ako izraz nije dodjeljivGeneriši PUSH EBX Ako je prvi izraz realni broj generiši FSTP ST(0)Pozovi IzrazDodjeljivanjaGeneriši POP EBXAko je drugi izraz cijeli broj ili karakter a prvi član je bio realni broj pozovi

CijeliNaFPStek za registar EAX Ako je prvi izraz cijeli broj ili karakter a drugi član je bio realni broj pozovi FPStekUCijeli

za registar EAX Ako je prvi izraz karakter generiši MOV [EBX],ALAko je prvi izraz realni broj generiši FSTP QWORD PTR [EBX]Ako je prvi izraz cijeli broj generiši MOV [EBX],EAX

Page 57: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

57

cijeli funkcija GetStdHandle(cijeli brhan);cijeli funkcija WriteConsoleA(cijeli rez,cijeli * upisano, cijeli upisati,karakter * bafer,cijeli han);cijeli funkcija ReadConsoleA(cijeli rez,cijeli * upisano, cijeli upisati,karakter * bafer,cijeli han);

cijeli * ime;

cijeli funkcija Prikazistring (karakter * poruka){ cijeli handle,priv,duz; handle:=GetStdHandle(-11); duz:=0; dok (poruka[duz]#0) { duz:=duz+1;} WriteConsoleA(0,&priv,duz,poruka,handle);} cijeli funkcija Novired () { karakter * dvoznak; dvoznak:=" "; dvoznak[0]:=13; dvoznak[1]:=10; Prikazistring(dvoznak);}

cijeli funkcija Prikazibroj (cijeli broj){ cijeli cifra,negativan,pokazivac,ostatak; karakter * bafer; bafer:=" "; ` Alociramo bafer cifra:=broj;` Negativne brojeve oznaci indikatorom ako (cifra<0) { negativan:=1; cifra:=-cifra; } inace { negativan:=0; }

`maksimalno 9 cifara pokazivac:=9; ako (cifra=0) { bafer[pokazivac]:='0'; pokazivac:=pokazivac-1; } dok (cifra>0) { ostatak:=(cifra % 10); `ostatke dijeljenja u bafer bafer[pokazivac]:=ostatak+'0'; cifra:=cifra/10; ` stalno dijeli s 10 pokazivac:=pokazivac-1; } ako (negativan=1) { bafer[pokazivac]:='-'; pokazivac:=pokazivac-1; } bafer:=&(bafer[pokazivac+1]); ` Pomjeri pokazivac pocetka stringa Prikazistring(bafer);}

realni funkcija abs(realni x){ ako (x>0) { x;} inace {-x;}

}

realni funkcija sqrt(realni x){ asembler FLD QWORD PTR [EBP+8] FSQRT\}

cijeli funkcija Prikazidecimalnibroj(realni x){ cijeli c,nn,q; realni o; c:=x; o:=abs(x-c); Prikazibroj(c); Prikazistring("."); nn:=100000*o; q:=10; dok q<100000 { ako (nn<q) {Prikazistring("0");} q:=q*10; } Prikazibroj(nn); Novired();}

realni funkcija f(realni x){ sqrt(x)-2;}

cijeli funkcija Racun(){ realni x,predx,novix; cijeli i,q; i:=0; predx:=0; x:=1; dok ( (i<2000) & (abs(x-predx) >0.000001) ) { novix:=x-(f(x)*(x-predx))/(f(x)-f(predx)); predx:=x; x:=novix; Prikazidecimalnibroj(x); i:=i+1; }}

{ Racun();}----------------------------Rezultat

2.000003.414214.089184.003414.000024.000004.00000

Sl. 9.7.1. Primjer Metoda sekante

9.8. Rezime poglavljaZahvaljujući ugrađenom matematičkom koprocesoru dodavanje realne aritmetike je razmjerno jednostavno. Realne

konstante se prosto prosljeđuju asembleru jer svi moderni asembleri poznaju eksponencijalnu sintaksu. Koprocesor radi na principu steka i potrebne su konverzione procedure između koprocesorskog steka i cjelobrojnih registara.

Page 58: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

58Prilog 6: Verzija izvornog koda kompajlera br. 6program Kompajler;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator';

type TVrsta = (funkcija, lokalna, globalna, parametar); TTip = (karakter, cijeli, realni, pkarakter, pcijeli, prealni); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija, realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident: integer; t: TTip; dod: Boolean;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; end;end;

procedure NovaLabela(var ImeLabele: string);begin

trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; end;

if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak < '0') or (znak > '9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;begin TipDek := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; Novi end else tip := stip; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then

Page 59: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

59 a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;begin case tip of cijeli, pcijeli, pkarakter, prealni: DuzinaTipa := 4; karakter: DuzinaTipa := 1; realni: DuzinaTipa := 8; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta = parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja

(var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean);var t1: TTip;begin Novi; Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; IdiDo(']'); dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;

begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); case t2 of realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st);

Page 60: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

60

Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh0');end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); realni:

Page 61: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

61 Emit(' FLD QWORD PTR [EBX]'); cijeli: Emit(' MOV EAX,[EBX]'); else Emit(' MOV EAX,[EBX]'); end; dod := true; if znak = '[' then PokazivacINiz(t, dod);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod);

end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+ realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end; end; end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end;end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR '); else Greska(NEDOPFP); end

end else begin t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin

Page 62: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

62 t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; end; t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean;begin Izraz(t1, dod1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR [EBX]'); else Emit(' MOV [EBX],EAX'); end; t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter);

if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh');

t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0');

NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, 0); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, 0); imaistogtipa := true; if znak = ',' then begin Novi;

Page 63: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

63 imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa: Integer; ImeVarijable, st: string; tip: TTip;

imaistogtipa: Boolean;begin Emit('.486'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, 0); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{');

if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB ' + st + ' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 64: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

6410.SLOŽENI TIPOVI PODATAKA

Dosadašnje smještanje nizova, definisanih preko pointera, u statički navedene stringove prilično ograničava veličinu koju niz može da ima. Iako se taj problem može prevazići primjenom API funkcije GlobalAlloc, i dalje se osjeća nedostatak definisanih nizova određene veličine u samom programskom jeziku. Pored ovoga, treba uvesti i višedimenzionalne nizove. Drugi složeni tip koji treba uvesti su slogovi (strukture u C-u), tj. skup podataka različitog tipa pod istim imenom. Konačno, da bi bilo moguće praviti Windows aplikacije koje rade u grafičkom okruženju, neophodno je i uvesti pointere na funkcije ili neki drugi način da se funkcija može pozvati, iako se u trenutku kompajliranja ne zna o kojoj je funkciji riječ. Kombinovano sa slogovima, to je i korak ka jeziku koji omogućava objektno orijentisano programiranje.

10.1. Višedimenzionalni nizoviDeklarisanje višedimenzionalnih nizova se vrši navođenjem broja elemenata svake dimenzije iza oznake tipa, pri

čemu je donji indeks nizova uvijek 0. Npr.,

cijeli [2,3] a;

će rezervisati prostor za cijele brojeve a[0,0] a[0,1] a[0,2] a[1,0] a[1,1] i a[1,2] .

Jedan ili više pozitivnih cijelih brojeva razdvojenih zarezima unutar uglastih zagrada naziva se deklaracioni dimenzijski modifikator. Jedan ili više numeričkih izraza razdvojenih zarezima unutar uglastih zagrada naziva se lista indeksa. Sintaksno se mogu predstaviti kao na slici Sl. 10.1.1

Deklaracioni dimenzijski modifikator Lista indeksa

Sl. 10.1.1. Deklaracioni dimenzijski modifikator i lista indeksaAdresa početka elementa jednodimenzionalnog niza se dobija formulom

AdresaElementa=AdresaPočetkaNiza+Index*VeličinaElementaNiza

Za dvodimenzionalne nizove ova formula iznosi

AdresaElementa=AdresaPočetkaNiza+(BrojElemenataDrugeDimenzije*IndexPrveDimenzije+IndexDrugeDimenzije)*VeličinaElementaNiza

Za trodimenzionalne nizove ova formula iznosi

AdresaElementa=AdresaPočetkaNiza+(BrojElemenataDrugeDimenzije*BrojElemenataTrećeDimenzije*IndexPrveDimenzije+ BrojElemenataTrećeDimenzije*IndexDrugeDimenzije+IndexTrećeDimenzije)*VeličinaElementaNiza

Formula se može generalizovati

AdresaElementa=AdresaPočetkaNiza+(Indexn+((i=1,n-1,Indexi)*(j=i+1,n,BrojElemenataj)))VeličinaElementa

ili generisati kodom sa slike Sl. 10.1.2, (koji će svoje mjesto naći u proceduri PokazivacINiz ) uz pretpostavku da registar EBX sadrži adresu početka niza

KonstantaIzraz dodjeljivanja

,

[ ]

,

[ ]

Generiši MOV EAX,0 Povećaj brojač dimenzija Generisi PUSH EAX Pozovi IzrazDodjeljivanja Generisi POP EBX Ako nije zadnji indeks generiši MOV DX,ProizvodBrojElemenataNarednihDimenzija i

generiši MUL EDXGeneriši ADD EBX,EAXGeneriši MOV EAX,EBXGeneriši množenje EAX sa veličinom elementa

Page 65: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

65Sl. 10.1.2. Pseudokod i generisanje mašinskog koda za račun elementa

višedimenzionalnog niza

Preuzima se koncept iz C-a da su nizovi i pointeri kompatibilni kada se prenose kao parametri, pri čemu se nizu ne može dodijeliti vrijednost, iako je sintaksa višedimenzionalnih nizova drugačija. Za niz se alocira onoliko bajtova koliki je proizvod svih dimenzija pomnožen sa veličinom pojedinačnog argumenta, a za pointer četiri bajta. Da bi se znalo koliko prostora treba alocirati, u slog tabele TabIdent dodaje se broj dimenzija niza i broj elemenata u svakoj dimenziji. Ovaj sadržaj se kopira u globalni niz dimenzije i varijablu ukdim po potrebi. Shodno ovom proširuje se procedura DuzinaTipa.

U dosadašnjim verzijama kompajlera iza imena varijable mogao je biti opcionalni indeks niza. Sada, kada se dodaju višedimenzionalni nizovi, slogovi i indirektni pozivi funkcija, jezički pojam varijabla izgleda kao na slici Sl. 10.1.3.

Varijabla:

Sl. 10.1.3. VarijablaMale zagrade iza imena varijable omogućavaju indirektni poziv funkcije.

10.2. Indirektni poziv funkcijePointerskoj varijabli moguće je dodijeliti ime funkcije, čime ona pokazuje na potprogram. Kada se iza pointerske

varijable stave zagrade, tada će se generisati poziv potprograma takav da adresa na koju se skače nije konstantna, nego se čita s druge adrese. Kôd koji se generiše koristeći novu proceduru IndirektniPoziv izgleda kao na slici Sl. 10.2.1.

Sl. 10.2.1. Generisanje koda za indirektni poziv funkcijeProcedura IndirektniPoziv je jako slična proceduri PozivFunkcije, osim što ne provjerava tip i broj argumenata

prilikom generisanja poziva funkcije. Dosadašnja funkcija PozivFunkcije uključuje i varijantu kada iza imena funkcije ne slijede zagrade. Tada se u EAX registru vraća adresa početka funkcije.

Tip rezultata koji vraćaju indirektno pozvane funkcije je dereferencirani tip varijable u kojoj se nalazi adresa funkcije. Na primjer, ako je varijabli koja je pokazivač na realni broj dodijeljena adresa funkcije, ova funkcija će vratiti realni broj.

Indirektni pozivi funkcija su moćan mehanizam koji treba koristiti sa velikim oprezom pošto mala greška može lako da dovede do kraha programa. Iako se argumenti ne provjeravaju prilikom indirektnog poziva, funkcije normalno prihvaćaju samo onaj broj i tip argumenata koliko ih ima u deklaraciji. Ukoliko je funkcija pozvana sa drugačijim brojem argumenata od očekivanog, stek pointer neće biti u ispravnom položaju i to će izazvati krah. S druge strane, kako ECX registar u trenutku poziva funkcije sadrži veličinu memorije koju su zauzeli argumenti, uz pomoć asemblerskih modula moguće je praviti funkcije sa promjenjivim brojem argumenata.

Identifikator [ Lista indeksa

Izraz dodjeljivanja

,

()

Generiši labelu i lokaciju na kojoj se smješta duga riječ, npr L15 DD (?)Generiši MOV L15,EAXZa svaki izraz do zatvorene zagrade pozovi IzrazDodjeljivanja i odgovarajuće smještanje podataka na stekGeneriši MOV ECX,velicinastekaGeneriši indirektni poziv CALL L15

Page 66: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

66Indirektni tip poziva omogućava uzajamnu rekurziju, tj. da funkcija P poziva funkciju Q, a funkcija Q da poziva

funkciju P. To se postiže tako da se prije definicije funkcija definišu dvije pointerske varijable, unutar samih funkcija poziv uzajamno rekurzivnih vrši koristeći indirektni poziv, a dodjela adresa funkcija pointerskim varijablama obavi na početku glavnog programa.

10.3. SlogoviSlogovi se definišu rekurzivno, jer član sloga može biti novi slog, kao i niz, odnosno matrica, a također su mogući

nizovi slogova. U mnogim programskim jezicima svaka slogovska struktura predstavlja poseban tip. Kako jezik FILDZAN-32 nema korisničkih tipova, sve varijable koje predstavljaju slogove su tipa slog, a kao numerička oznaka pojedine slogovske strukture koristi se polje pod3 u tabeli identifikatora.

Dodavanje tipa slog zahtijeva izmjenu jezičkog pojma ImeTipa, što je prikazano na slici uz odgovarajuće promjene funkcija TipDek i SlijediDekTipa. Dio koda iz procedure Varijabla , koji generiše kôd za čitanje sadržaja pointerskih varijabli prebačen je u proceduru PEmit da se izbjegne njegovo dupliranje nakon uvođenja pointera na slogove.

ImeTipa:

Sl. 10.3.1. Jezički pojam ImeTipa

Jezički pojam Deklaracija sloga, implementiran u proceduri DeklaracijaSloga izgleda kao na slici Sl. 10.3.2.

Sl. 10.3.2. Deklaracija slogaPrimjer:

slog { cijeli x1,y1; cijeli x2,y2; karakter[80] poruka;} texbox;

Implementacija deklaracije sloga, prikazana na slici Sl. 10.3.3 u osnovi dodaje u tabelu identifikatora za svako polje u slogu novi identifikator pri čemu se za vrstu identifikatora navodi polje. Dodatni podaci koji se navode u tabeli slogova su oznaka sloga, oznaka podsloga i relativna pozicija polja u bajtima od početka sloga.

karakter *Deklaracionidimenzijskimodifikator

realni *Deklaracionidimenzijskimodifikator

cijeli*

Deklaracionidimenzijskimodifikator

slog*

Deklaracionidimenzijskimodifikator

Deklaracija sloga

{ ImeTipa Identifikator imena polja

,

;

}

Page 67: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

67

Sl. 10.3.3. Aktivnosti pri deklarisanju sloga, pseudokodCijeli slog (tj. varijabla slogovnog tipa) ima svoju poziciju u tabeli identifikatora, u koju se upisuje prilikom

deklaracije varijable ili parametara funkcije. OznakaSloga nije ta pozicija, nego redni broj deklarisanog sloga koji se svaki put kada započne deklarisanje novog sloga ili podsloga, uvećava za jedan.

Varijabla zadnji čuva podatke o zadnjem definisanom ili upotrijebljenom slogu. Ti podaci su njegova dužina, redni broj sloga po redoslijedu deklarisanja i pozicija u tabeli identifikatora gdje se nalazi njegovo ime. Pomoću varijable zadnji prevaziđen je problem različite strukture različitih slogova. Procedura DuzinaTipa će za slogove vratiti dužinu zadnjeg definisanog ili upotrijebljenog sloga. U proceduri varijabla se provjeri da li je u pitanju niz/matrica slogova. Ako jeste, dužina tipa se dijeli sa ukupnim brojem elemenata.

Pretraživač identifikatora NadjiIdent treba da traži poziciju polja u tabeli identifikatora. Do sada rezervisani, tip pretraživanja 3 će obaviti ovaj zadatak.

Nad slogovima je dopušteno od operacija samo dodjeljivanje čitavog sloga drugom slogu. Kako konkretna slogovna struktura nema imena uzeta je konvencija da se slog može dodijeliti drugom slogu samo ako su jednake dužine. Dodjela sloga slogu ili stavljanje sloga na stek se vrši naredbom REP MOVSB. Prije ove naredbe, ESI treba da pokazuje na izvorni slog, EDI na odredišni ili mjesto na vrhu steka, ECX na dužinu sloga, a direction flag treba biti jednak 0.

Na slici Sl. 10.3.4 dat je generisani kôd za smještanje sloga na stek i dodjeljivanje jedne slogovne varijable drugoj.

MOV ECX,duzinasloga SUB ESP,duzinasloga MOV ESI,EBX MOV EDI,ESP CLD REP MOVSB

Smještanje sloga na stek

PUSH EBX Izraz dodjeljivanja POP EDI MOV ESI,EBX CLD MOV ECX,duzina sloga REP MOVSB

Dodjeljivanje slogovnih varijabliSl. 10.3.4. Generisanje koda za operacije sa kompletnim slogovima

Implementacija elementa sloga, tj. adrese i vrijednosti polja, navedena u proceduri ElementSloga je slična implementaciji varijabli, osim što se nakon dobijanja adrese varijable (cijelog sloga) u EBX registru, generiše instrukcija ADD EBX,pozicijapolja, kako bi registar EBX pokazivao na početak samog polja.

Realizacija elementa sloga zahtijeva izmjenu jezičkog pojma Faktor Sl. 10.3.5. Na kraj ovog jezičkog pojma se dodaje pojam ElementSloga ukoliko se na kraju pojma Faktor nalazi simbol “.”. Napomena: Ovo je izmijenjeno u odnosu na prethodno izdanje skripte (gdje je element sloga bio iza varijable) kako bi se moglo pristupiti elementu sloga na koji pokazuje pointer.

Povećaj ukupni broj slogova za jedan i postavi dužinu sloga na nulu.Za svaki tip koji se pojavljuje u deklaraciji sloga (*) Ako je tip slog ili pointer na slog, podslog se dobija rekurzivnim pozivom

deklaracije sloga, a za proste tipove podslog je sam slog.Preuzmi ime identifikatora polja.Potraži da li već postoji takav identifikator u tablici identifikatora za taj nivo i tu

oznaku sloga i ako ima prijavi grešku.Upiši ime polja u tablicu identifikatora zajedno sa oznakom podsloga i samog

sloga, te trenutnom duzinom sloga.Uvećaj dužinu sloga za dužinu tipaSve dok slijedi znak ‘,’ vrati se na tačku (*)Dužinu sloga poravnaj na vrijednost djeljivu sa 4.Očekuj simbol ‘;’

Ako nema više tipova, očekuj simbol ‘}’.

Page 68: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

68

Sl. 10.3.5. Jezički pojam Faktor

Kako element sloga može takođe biti slog, jezički pojam ElementSloga treba da ponavlja generisanje adresa za pristup podpoljima i njegova struktura izgleda kao na slici Sl. 10.3.6

Sl. 10.3.6. Jezički pojam ElementSloga

( Izraz dodjeljivanja )

Numerička konstanta

Faktor*

&

~

!

-

Varijabla

" String konstanta

Poziv funkcije

‘ Slovo ‘

. Element sloga

Identifikator imena polja

.

Page 69: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

69

10.4. Testni primjerPrimjer programa u ovoj verziji jezika je jedna jednostavna Windows GUI aplikacija. Program generiše osnovni

prozor na kome se nalaze tri dugmeta, od kojih pritisak na jedno aktivira poruku na ekranu, drugo pokreće aplikaciju Solitaire, a treće crta jedan krug na ekranu.

Počevši od treće verzije jezika svi dosadašnji primjeri su bile Windows konzolne aplikacije, tj. aplikacije koje koriste tekstualni korisnički interfejs i nemaju reakcija na asinhrone događaje kao što je pritisak na miša ili preklapanje između prozora/procesa.

Windows GUI aplikacije, s druge strane, primaju poruke u red čekanja i odgovaraju na njih. To se obično vrši primjenom GetMessage i DispatchMessage API funkcija koje čitaju poruku i pozivaju odgovarajući potprogram da se poruka obradi.

Potprogram za obradu poruke (koja je zapravo jedan slog), je definisan u opisu tzv. klase prozora, u njenom polju lpfnWndProc. Klasa prozora predstavlja slog koji se ili popunjava pri startu programa ili uzima već gotov (kao što je “BUTTON”). Tu klasu navodimo prilikom kreiranja prozora, kao jedan od parametara funkcije CreateWindow.

Glavni prozor odgovara na tri vrste poruka, otvaranje programa (kada kreira podprozore koji su zapravo dugmad), zatvaranje prozora (kada šalje poruku koja završava GetMessage/DispatchMessage petlju) i komandu (kada zavisno od podprozora koji ju je poslao poziva funkciju MessageBox za ispis poruke, WinExec za start programa ili Ellipse za prikaz elipse čiji je specijalni slučaj krug).

Prozori se međusobno identifikuju konstantom koja se zove rukovatelj prozora (handle). Pored toga, prikaz elipse zahtijeva konstantu device context kao jedan od parametara, koji se uzima funkcijom GetDC.

Detaljniji opis ovoga primjera oduzeo bi dosta prostora. O načinu programiranja za Windows pogledati u referenci [PETZOLD-01].

Program se prevodi sa:

komp32v7 wincircle.jez wincircle.asm ml /c /coff /Fl wincircle.asm | morelink /defaultlib: user32.lib kernel32.lib gdi32.lib /subsystem:windows wincircle.obj

Činjenica da ovaj primjer radi, pokazuje da je jezik već dovoljno moćan da se u njemu, uz dosta truda, realizuje bilo koja aplikacija koja koristi standardni Windows API . Interesantno je da je prevedeni EXE kôd dosta kratak, svega 4608 bajtova, iako još nije implementirana optimizacija koda. U većini drugih programskih jezika, sem asemblera, ovaj primjer bi imao veći prevedeni kôd: od 12 kilobajta (Delphi u Object Pascal režimu) do nekoliko megabajta (neki vizuelni alati koji zahtijevaju veliki runtime, npr. Oracle Forms)

Page 70: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

70

cijeli funkcija RegisterClassExA(cijeli * wndclass);cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, cijeli c,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,cijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija GetStockObject ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijeli c,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b, karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c);cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija GetDC ( cijeli a) ;cijeli funkcija Ellipse (cijeli a, cijeli b, cijeli c,cijeli d,cijeli e);cijeli funkcija ReleaseDC (cijeli a, cijeli b);

cijeli hWnd ; cijeli ka,kb,kc;slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } msg ; ` a message structure

slog { cijeli cbsize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wndclass ; ` window class structure

cijeli nCmdShow;karakter * lpszCmdLine;cijeli hPrevInstance;cijeli hInstance;karakter[30] pstr;cijeli funkcija WndProc(cijeli lParam,cijeli wParam,cijeli wMessage,cijeli hWnd) { cijeli obradjena,WSCHILD,WSVISIBLE,hDC; obradjena:=0; ako (wMessage=1) `WM_CREATE { WSCHILD := 1073741824; `$40000000; WSVISIBLE := 268435456; `$10000000; ka:=CreateWindowExA (0,hInstance,0,hWnd, 40,120,20,140, WSCHILD | WSVISIBLE,"Poruka","BUTTON",0); kb:=CreateWindowExA (0,hInstance,0,hWnd,

40,120,60,140, WSCHILD | WSVISIBLE,"Soliter","BUTTON",0); kc:=CreateWindowExA (0,hInstance,0,hWnd, 40,120,100,140, WSCHILD | WSVISIBLE,"Krug","BUTTON",0);

obradjena:=1;

} ako (wMessage=2) `WM_DESTROY { PostQuitMessage (0) ; obradjena:=1; }

ako (wMessage=273) `WM_COMMAND { ako (lParam=ka) { MessageBoxA (0,"Poruka","Pritisnut taster",0); } ako (lParam=kb) { WinExec (" ","c:\windows\sol.exe"); } ako (lParam=kc) { hDC:=GetDC (hWnd); Ellipse(200,200,0,0,hDC); ReleaseDC(hDC,hWnd); }

obradjena:=1; }

ako (obradjena=0) { DefWindowProcA (lParam,wParam,wMessage,hWnd) ; } } { nCmdShow:=10; hInstance:=GetModuleHandleA (0); wndclass.cbsize:=48; wndclass.style := 0 ; wndclass.lpfnWndProc := WndProc ; wndclass.cbClsExtra := 0 ; wndclass.cbWndExtra := 0 ; wndclass.hInstance := hInstance ; wndclass.hIcon := 0 ; wndclass.hCursor := LoadCursorA (32512,0) ; `IDC_ARROW wndclass.hbrBackground := GetStockObject(2); wndclass.lpszMenuName := 0; wndclass.lpszClassName := "PROBNA" ; wndclass.hIconSm:=0; ako (!(RegisterClassExA (&wndclass))) { 0 ; } inace { hWnd := CreateWindowExA ( 0,hInstance,0,0, 400,400,4,4,13565952, `WS_OVERLAPPEDWINDOW "Prim","PROBNA",512); ShowWindow ( nCmdShow,hWnd) ; UpdateWindow(hWnd) ; dok (GetMessageA (0, 0, 0,&msg)) { TranslateMessage (&msg) ; DispatchMessageA (&msg) ; } msg.wParam ; } }

Sl. 10.4.1. Windows grafička aplikacija

10.5. Rezime poglavljaVišedimenzionalni nizovi zahtijevaju nešto složeniji algoritam pristupa odgovarajućem elementu niza od

jednodimenzionalnih. Pojam varijable je proširen tako da može da predstavlja i element višedimenzionalnog niza, polje sloga ili da predstavlja adresu funkcije koja se može indirektno pozvati navođenjem argumenata u zagradi iza imena varijable. Indirektni poziv predstavlja CALL instrukciju na adresu koja je navedena u pointerskoj varijabli. Slogovi se sastoje od polja koja se upisuju u tabelu identifikatora, ali i svaki definisani slog ima svoju oznaku. Uvijek se pamti koji je zadnji definisani ili korišteni slog. U sadašnjoj verziji jezika moguće je pisati i grafičke aplikacije.

Page 71: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

71Prilog 7: Verzija izvornog koda kompajlera br. 7program Kompajler;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR='Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG='Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ ='Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator'; MAXDIMOV ='Maksimalan broj dimenzija'; INDSTATC = 'Indeks statickog niza nije cijeli'; PREVDIM = 'Prevazidjen broj dimenzija'; NESLDIM = 'Ne slaze se broj dimenzija'; POLJEPOS = 'Polje vec postoji'; SLOGPOLJE = 'Samo slogovi mogu imati polja'; NEDEKPOLJE = 'Nedeklarisano polje'; SLOGSLOGU = 'Slog se moze dodijeliti samoslogu'; SLOGRAZDUZ = 'Slogovi razlicite duzine'; INDNOPOINT = 'Indirektna funkcija bez pointera'; SLOGNEPOR = 'Slogovi se ne mogu porediti';

type TVrsta = (funkcija, lokalna, globalna, parametar, polje); TTip = (karakter, cijeli, realni, slog, pkarakter, pcijeli, prealni, pslog); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; ukupdim: integer; dim: array[0..MAXDIM] of integer; end;

TZadnjiSlog = record duzina: integer; pozimena: integer; idopisasloga: integer end;

var ulaz, izlaz: text; pozicija, trenlabela, brojaclinija, aktnivo: integer; znak: char; linija, realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent; ukupnoident, ukupnoslogova, ukdim: integer; t: TTip; dod: Boolean;

zadnji: TZadnjiSlog; dimenzije: array[0..MAXDIM]of integer;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);var i: integer;begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; ukupdim := ukdim; for i := 0 to MAXDIM do dim[i] := dimenzije[i]; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure Emit(st: string);begin WriteLn(izlaz, st);end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if not (Eof(ulaz)) then ReadLn(ulaz, linija); Emit(';' + linija); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz)end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;

end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta:=realnakonstanta + znak; NoviSvaki(false); end; end; if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta:=realnakonstanta + znak; NoviSvaki(false); end; if (znak<'0')or(znak>'9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta+ znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end

Page 72: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

72 else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;var tipind: TTip; kraj, x, poi: Boolean;begin TipDek := false; poi := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; poi := true; Novi end else tip := stip; ukdim := 0; if znak = '[' then begin if poi then tip := pcijeli else tip := ptip; IdiDo('['); repeat ukdim := ukdim + 1; if ukdim > MAXDIM then Greska(MAXDIMOV); dimenzije[ukdim] := UzmiKonstantu(tipind, x); if tipind <> cijeli then Greska(INDSTATC); kraj := true; if znak = ',' then begin Novi; kraj := false; end; until kraj; IdiDo(']'); end; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); if not (a) then a := TipDek('slog', tip, slog, pslog); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;var elem, i: integer;begin case tip of cijeli: DuzinaTipa := 4; pcijeli, pkarakter, prealni, pslog: begin if ukdim = 0 then DuzinaTipa := 4 else begin elem := 4 * ord(tip = pcijeli) + 1 * ord(tip = pkarakter) + 8 * ord(tip = prealni) + zadnji.duzina * ord(tip = pslog); for i := 1 to ukdim do elem := elem * dimenzije[i]; DuzinaTipa := elem; end end; karakter: DuzinaTipa := 1;

realni: DuzinaTipa := 8; slog: DuzinaTipa := zadnji.duzina; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 3: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta = polje) and (TabIdent[n].nivo = nivo) and (TabIdent[n].pod3 = p1); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta = parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean; idpoz: Integer);var t1: TTip; navdim,dsvedim,i: Integer; st: string;begin navdim := 0;

Emit(' PUSH EAX'); Emit(' MOV EAX,0'); repeat Novi; navdim := navdim + 1; if navdim > MAXDIM then Greska(PREVDIM); Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); if znak = ',' then begin dsvedim:=1; for i:=navdim+1 to TabIdent[idpoz].ukupdim do dsvedim:=dsvedim* TabIdent[idpoz].dim[i]; Str(dsvedim, st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; Emit(' ADD EBX,EAX'); Emit(' MOV EAX,EBX'); until znak <> ','; Emit(' POP EBX'); if (navdim <> TabIdent[idpoz].ukupdim) and (not ((navdim = 1) and (TabIdent[idpoz].ukupdim = 0))) then Greska(NESLDIM); IdiDo(']'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; pslog: begin t := slog; Str(DuzinaTipa(t), st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;

Page 73: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

73

begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

procedure PEmit(idpoz: Integer);var i: integer;begin if TabIdent[idpoz].ukupdim = 0 then Emit(' MOV EAX,[EBX]') else Emit(' MOV EAX,EBX'); ukdim := TabIdent[idpoz].ukupdim;

Page 74: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

74 for i := 0 to MAXDIM do dimenzije[i] := TabIdent[idpoz].dim[i];end;

function DeklaracijaSloga(nivo: integer): integer;var ImePolja: string; oznakasloga, podslog, duzinasloga, zapukdim, i, poz: integer; tip: TTip; imaistogtipa: Boolean; zdimenzije: array[0..MAXDIM] of integer;begin zapukdim := ukdim; for i := 0 to MAXDIM do zdimenzije[i] := dimenzije[i]; IdiDo('{'); ukupnoslogova := ukupnoslogova + 1; oznakasloga := ukupnoslogova; duzinasloga := 0; poz := 0; while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then podslog := DeklaracijaSloga(nivo) else podslog := oznakasloga; repeat UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, podslog); if poz <> 0 then Greska(POLJEPOS); NoviIdent(ImePolja, DuzinaTipa(tip), 0, nivo, polje, tip, podslog, duzinasloga, oznakasloga); duzinasloga := duzinasloga + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (duzinasloga mod 4) <> 0 do duzinasloga := duzinasloga + 1; IdiDo(';'); end; IdiDo('}'); zadnji.duzina := duzinasloga; zadnji.pozimena := poz; zadnji.idopisasloga := OznakaSloga; DeklaracijaSloga := OznakaSloga; ukdim := zapukdim; for i := 0 to MAXDIM do dimenzije[i] := zdimenzije[i];end;

procedure ElementSloga (idpoz: integer; var t: TTip; var dod: Boolean);var poz, nivo, idsloga: integer; Imepolja, st: string;begin if t <> slog then Greska(SLOGPOLJE); nivo := TabIdent[idpoz].nivo; idsloga := TabIdent[idpoz].pod3; while znak = '.' do begin Novi; UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, idsloga); if poz = 0 then Greska(NEDEKPOLJE); Str(TabIdent[poz].pod2, st); Emit(' ADD EBX,' + st); t := TabIdent[poz].tip; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin idsloga := TabIdent[poz].pod1; zadnji.duzina := TabIdent[poz].duzina; zadnji.pozimena := poz; zadnji.idopisasloga :=

TabIdent[poz].pod3; end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(poz); end; end;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka, duzprvogsloga, duzdrugogsloga, m1: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; duzprvogsloga := 0; duzdrugogsloga := 0; if znak <> '(' then begin velsteka := 0; for parametara := 1 to TabIdent[idpoz].pod1 do begin n := NadjiIdent('', idpoz, 4, parametara); velsteka := velsteka + ( (TabIdent[n].duzina - 1) div 4 + 1) * 4; end; Str(velsteka, st); Emit(' MOV EAX,OFFSET ' + imefunkcije + '@' + st); t := pcijeli; dod := false; end else begin IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if t2 = slog then duzdrugogsloga := TabIdent[n].duzina;

if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); case t2 of slog: begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); m1 := ((duzprvogsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh'); end;end;procedure IndirektniPoziv(var t: TTip);var m1, velsteka, duzsloga: Integer; straddr, st: string; t1: TTip;begin velsteka := 0; NovaLabela(straddr); Emit('.DATA'); st := 'L' + straddr + ' DD ?'; Emit(st); Emit('.CODE'); Emit(' MOV L' + straddr + ',EAX'); IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); case t1 of slog: begin duzsloga := DuzinaTipa(t1); m1 := ((duzsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP');

Page 75: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

75 Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; FPUStekNaStek; end else begin velsteka := velsteka + 4; Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL L' + straddr); case t of pcijeli: t := cijeli; prealni: t := realni; pkarakter: t := karakter; pslog: t := slog; else Greska(INDNOPOINT) end;end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin zadnji.duzina := TabIdent[idpoz].duzina; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; end; pslog: begin rezultat:=1; for i:=1 to TabIdent[idpoz].

ukupdim do rezultat:=rezultat* TabIdent[idpoz].dim[i]; if rezultat<>0 then

zadnji.duzina := TabIdent[idpoz].duzina div rezultat

else zadnji.duzina:=4; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; PEmit(idpoz); end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(idpoz); end; if TabIdent[idpoz].ukupdim = 0 then dod := true else dod := false; while znak ='[' do begin PokazivacINiz(t, dod, idpoz); end; if znak = '(' then IndirektniPoziv(t);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer;

st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; slog: t := pslog; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; pslog: begin t := slog; end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin

rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+ realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end; end; end; '(': begin Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end; if znak = '.' then ElementSloga(zadnji.pozimena,t,dod);end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR '); else Greska(NEDOPFP); end end else begin t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh');

Page 76: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

76 if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end; t1 := t; end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then

Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; end; t1 := t; end;end;procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean; duzprvogsloga, duzdrugogsloga: Integer; st: string;begin duzprvogsloga := 0; duzdrugogsloga := 0; Izraz(t1, dod1); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); if t2 = slog then duzdrugogsloga := DuzinaTipa(t2); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); if t1 = slog then begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); Emit(' POP EDI'); Emit(' MOV ESI,EBX'); Emit(' CLD'); Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); end else Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(DODJPOINT); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR [EBX]'); slog: Emit(' REP MOVSB'); else Emit(' MOV [EBX],EAX'); end;

t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if (t1 = slog) or (t2 = slog) then Greska(SLOGNEPOR); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then

Page 77: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

77 linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok); NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i, p3: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip)-1)div 4+1)*4;

NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, p3); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta=parametar)then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa + DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, p3); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4)<>0do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije+'@'+st+':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC '+ImeFunkcije+ '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;procedure Prevedi;var globadresa, p3: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.486');

Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(0) else p3 := 0; repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, p3); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:'); Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB '+st+' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;procedure Glavni;var linija: string;begin trenlabela := 0; ukupnoident := 0; aktnivo := 0; ukupnoslogova := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;begin Glavniend.

Page 78: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

7811.PREDPROCESIRANJE I OPTIMIZACIJA KODA

Došlo se do faze u kojoj se sam kompajler više neće mijenjati. Uočljivo je, međutim, da jeziku nedostaju predefinisani tipovi, konstante te makronaredbe, odnosno uključivanje kompletnih datoteka izvornog koda, kako se iste sekvence koda ne bi morale više puta kucati. Svi ovi problemi se mogu riješiti predprocesorom. Osim toga, već u prvoj verziji kompajlera je uočeno da je generisani kôd prevelik, pa je potrebno pristupiti optimizaciji generisanog koda.

11.1. Struktura kompajlera Predprocesor i postprocesor se nalaze u posebnim modulima (unit) i u suštini predstavljaju velika proširenja

dosadašnjih procedura Novi i Emit. Ove procedure su premještene iz glavnog modula u module predpr8.pas i postpr8.pas. Posljednja verzija kompajlera nema oznaka izmjena u odnosu na prethodnu verziju

11.2. Predprocesorska direktiva #definirajPredprocesor je sličan predprocesoru iz jezika C. Ako se na početku linije nalazi znak #, to predstavlja

predprocesorsku direktivu. Tipična sintaksa direktive #definiraj izgleda ovako:

#definiraj SIMBOL TekstSimbolaU daljnjem radu prilikom obrade linije sve pojave navedenog simbola zamjenjuju se tekstom. Ako je tekst simbola

duži od jedne linije, na njenom kraju se stavlja znak \.

Primjer:

#definiraj PI 3.14159265#definiraj PETLJA dok(i<2)\ { i:=i+1;}

U ovom primjeru je definisana konstanta PI i sada je u korisničkom programu moguće pisati a:=PI/2. Pored ovoga navođenjem simbola PETLJA, zamjenjuje se cijela petlja navedena u njegovom tijelu.

Definisanje konstanti predprocesorom rješava pitanje imena tipova. Tako se može navesti:

#definiraj KOMPLEKSNI slog {realni x;realni i;}

i dalje pisati

KOMPLEKSNI a,b,c,d;

Uz pomoć predprocesora, čak je moguće uvesti objekte sa jednim nivoom nasljeđivanja. Na slici Sl. 11.2.1 se vidi kako se uz pomoć predprocesora može, uz dosta discipline pri pisanju, postići sintaksa slična sintaksi u objektno orijentisanim jezicima, tj. “metode” (u suštini pointeri na funkcije) , “klase” (zapravo slogovi) i “nasljeđivanje” (ponavljanje istih polja uz pomoć predprocesora).

Sl. 11.2.1. Rudimentarno OOP uz pomoć predprocesora

11.3. Direktive uslovnog kompajliranjaU jeziku FILDZAN-32 omogućeno je da se određeni dijelovi koda kompajliraju ako je neki simbol definisan (ili

nedefiniran) koristeći direktivu #definiraj. U protivnom, linije izvornog koda se ignorišu kao da su komentari. Direktive uslovnog kompajliranja su #postoji, #nepostoji i #dalje.

#postoji SIMBOLAko je navedeni simbol ranije definisan, naredni dio programa će se prevoditi, a ako ne ignorisat će se. Ovo

ignorisanje će ići sve do direktive #dalje

#nepostoji SIMBOLAko navedeni simbol nije ranije definisan, naredni dio programa će se prevoditi, a ako je definisan ignorisat će se.

Ovo ignorisanje će ići sve do direktive #dalje

#dalje Završava blok započet naredbama #postoji ili #nepostoji.

#definiraj METODA cijeli *#definiraj OTAC cijeli p1,p2; METODA a;#definiraj SIN OTAC cijeli p3;#definiraj OBJEKT slog {#definiraj INSTANCE }#definiraj INIT .a:=x;cijeli funkcija x (cijeli a){ 1;` tijelo metode}

OBJEKT OTAC INSTANCE xxx;OBJEKT SIN INSTANCE yyy;{ xxx INIT yyy INIT xxx.p1:=2; yyy.p1:=3; yyy.p3:=3; xxx.a(50);}

Page 79: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

79

Sl. 11.3.1. Upotreba direktiva #postoji i #nepostojiU primjeru sa slike Sl. 11.3.1 se, ako je definisan simbol WINDOWS, prikazuje poruka koristeći funkciju

MessageBox, a ako ne, poruka se upisuje u datoteku.

11.4. Direktiva #dodaj za uključivanje datotekeSintaksa naredbe za uključivanje kompletne datoteke sa izvornim kodom glasi:

#dodaj ImeDatoteke Od mjesta u izvornom kodu programa neposredno iza direktive #dodaj se uključuje kompletna datoteka i sada se

generiše asemblerski kôd iz te datoteke, sve dok se ona ne iscrpi. Nakon toga se nastavlja kompajliranje glavne datoteke. Nije dopušteno gniježđenje datoteka

Primjer:

#dodaj osnovniprozor.h

11.5. Realizacija predprocesoraRealizacija predprocesora nije pretjerano složena. Treba definisati bafer od (npr.) 200 K u kome će stojati stringovi

koji predstavljaju vrijednost koja se stavlja i niz definicija koje sadrže imena simbola te poziciju u ovom baferu gdje se nalazi dati string.

Procedura Novi sada izgleda nešto drugačije nego u sedmoj verziji kompajlera. Kako se direktivom #dodaj može preusmjeriti na drugu ulaznu datoteku, provjerava se koja je ulazna datoteka u pitanju i ReadLn obavlja iz nje. Nakon instrukcije ReadLn se poziva rutina Predprocesiraj. U okviru ove rutine se provjerava da li linija počinje predprocesorskom direktivom.

Najviše posla ima ako se prepozna direktiva #definiraj. Ona je implementirana u proceduri PpDefin i najprije rastavi ime simbola od njegove vrijednosti. Definisanje simbola se vrši njegovim dodavanjem u tabelu simbola, a njegova definicija se dodaje u bafer opisa simbola simbola.

Direktive #postoji i #nepostoji (implementirane u procedurama PpPostoji i PpNePostoji) provjeravaju prisustvo navedenog simbola u tabeli i tako postave varijablu ObradaLinije na true ili false. U rutini Predprocesiraj se ova varijabla provjeri i ako je jednaka false, linija teksta se proglašava praznom. Direktiva #dalje (implementirana u Predprocesiraj) postavlja tu varijablu na true. Direktiva #dodaj (implementirana u Predprocesiraj) otvara pomoćnu datoteku i preusmjerava čitanje na nju.

U drugom dijelu rutine Predprocesiraj se prođe kroz cijelu tabelu predprocesorskih simbola i koristeći paskalsku funkciju Pos pretražuje pojava danih simbola u ulaznoj liniji. Ako ih ima, simbol na tom mjesto u izvornom kodu se zamjenjuje kompletnim stringom koji se nalazi u definiciji. Ako definicija simbola sadrži drugi simbol, ova će petlja ekspandovati i njega.

Rutina se zasniva na činjenici da stringovi u 32-bitnim implementacijama Pascala mogu biti veoma dugački. Eventualno portiranje kompajlera u drugi programski jezik treba imati tu činjenicu u vidu.

Jezik FILDZAN-32 je završen, uključujući i predprocesor. U prilogu 9 dat je izvorni kôd predprocesora .

11.6. Optimizacija koda

Gledano makroskopski, ovaj kompajler generiše veoma kratak kôd. U usporedbi sa bilo kojim kompajlerom viših programskih jezika za Windows, koji u izvršni kôd uključuju velike biblioteke, manje od 3 Kb za prazan program izgleda skoro kao rekord. Razlog ovome je što FILDZAN-32 generiše vrlo mali startni kôd.

Ali, posmatrajući pojedinačne naredbe, kako su prevedene, uviđa se da ima jako mnogo nepotrebnih asemblerskih instrukcija. Razlog ovome je što kompajler kada prevodi aritmetičke izraze prilikom nailaska na operator ne zna unaprijed da li

#definiraj WINDOWS 1#postoji WINDOWS MessageBox(0,”Poruka”,”Na ekranu”,0);#dalje#nepostoji WINDOWS UpisiUDatoteku(”Poruka”);#dalje

Page 80: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

80će slijediti konstanta, varijabla ili kompletan izraz, pa se priprema za najgori slučaj. To rezultuje vrlo čestim stavljanjem podataka na stek, ili pomoćne registre. Za primjer se može uzeti prevođenje proste instrukcije n:=n+1; Ona se prevodi u

; n:=n+1; LEA EBX,GLOBALV[400] MOV EAX,[EBX] PUSH EBX LEA EBX,GLOBALV[400] MOV EAX,[EBX] PUSH EAX MOV EAX,1 POP EBX ADD EAX,EBX POP EBX MOV [EBX],EAX

dok je najkraći mogući kôd

; n:=n+1; INC GLOBALV[400]

Uklanjanje nepotrebnih instrukcija se može izvesti modifikacijom procedure Emit. Umjesto da se generisana asemblerska naredba odmah šalje u izlaznu datoteku, ona se najprije stavlja u bafer od 15 instrukcija. Kada se ovaj bafer popuni, prvo se traži nekoliko karakterističnih uzoraka sekvenci asemblerskih naredbi i one se pokušavaju zamijeniti kraćim sekvencama. Ako to ne uspije, naredba koja je najranije ušla u bafer se šalje u izlaznu datoteku i stvara se mjesto za novu naredbu u baferu. Ovo se zove peephole optimizacija. Prepozna li se pseudo instrukcija .END, optimizacija se izvede još jednom i pošalju se u datoteku sve instrukcije iz bafera.

Prepoznavanje uzoraka je složen problem. Sekvenca koja je na procesoru 386 brža, može biti sporija na procesoru Pentium IV od neke druge sekvence. Ovaj zadatak prilično usporava kompajler, pa će se realizovati optimizovanje samo nekoliko najčešćih uzoraka.

Uzorci se sastoje od više instrukcija, a one mogu da sadrže parametre. Parametri se označavaju sa $C1, $C2 za proizvoljne literale, ili sa $N1, $N2 za brojeve. Stoga se se uzorci ne mogu prepoznavati prostim poređenjem, nego je potrebna odgovarajuća funkcija. Ta funkcija se zove Uzorak i ima četiri string parametra: string koji se traži, stvarna vrijednost, varijable u koje vraćamo vrijednosti prvog i drugog $ parametra u uzorku. Primjer

uzorak(‘ MOV EAX,$C1’,’ MOV EAX,ECX’,v1,v2) će vratiti true, jer su uzorci slični, u varijabli v1 se dobija string ‘ECX’ dok v2 dobija prazan string.

Funkcija uzorak poredi uzorke algoritmom sa slike Sl. 11.6.1.

Sl. 11.6.1. Algoritam pretraživanja uzorkaObrada slučajeva za $C i $N sekvence realizovana je u procedurama KarakterSl i BrojSl.

Ako su traženi i stvarni string jednaki, odmah se vrati s tačnom vrijednošćuPostavi pokazivače na početak traženog i stvarnog stringaIzvršavaj petlju do kraja traženog stringaAko se u traženom stringu na datom mjestu nalazi simbol $, uvećaj pokazivač u

traženom stringu za 1, provjeri da li slijede simboli C ili N, a iza njih simboli 1 ili 2, oba puta uvećavajući pokazivač u traženom stringu. Ukoliko se prepoznaju sekvence $C1, $C2, $N1 ili $N2 treba ih specijalno obraditi. Specijalna obrada nadovezuje redom znakove stvarnog stringa, stalno uvećavajući njegov pokazivač, na prvu ili drugu izlaznu varijablu sve dok se ne dođe do kraja stvarnog stringa, znaka zarez, a za numeričke konstante i prvog nenumeričkog znaka.

Ako su znakovi na trenutnoj poziciji u traženom i stvarnom stringu različiti, izađi iz funkcije s netačnim rezultatom.

Uvećaj za jedan pokazivače traženog i stvarnog stringa.Na kraju petlje izađi iz funkcije sa tačnim rezultatom

Page 81: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

81

ADD $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

Ako je $C1 jednak ESP relativna promjena ESP je $C2

AND $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

CALL $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

CDQ Koristi EAX

CLD Irelevantna

CMP $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

FADD Koristi FPU

FCHS Koristi FPU

FCOMPP Koristi FPU

FDIVR Koristi FPU

FILD $C1 Koristi FPU

FINIT Koristi FPU

FISTP $C1 Koristi FPU

FLD $C1 Koristi FPU

FMUL Koristi FPU

FSTP $C1 Koristi FPU

FSTSW AX Koristi FPU, briše EAX

FSUBR Koristi FPU

IDIV $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

IMUL $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

JMP $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

JNE $C1 Pretpostavlja se da briše EAX, EBX i koristi FPU

LEA $C1,$C2 Ako je $C1 jednak EAX (AL) ili EBX (BL), briše ih. Ako $C2 sadrži EAX ili EBX, koristi ih.

MOV $C1,$C2 Ako je $C1 jednak EAX (AL) ili EBX (BL), briše ih. Ako $C2 sadrži EAX ili EBX, koristi ih. Ako $C1 sadrži EAX ili EBX, a nije jednak njima koristi ih.

MUL $C1 Koristi EAX, ako je $C1 jednak EBX, koristi i EBX

NEG $C1 Ako $C1 sadrži EAX ili EBX, koristi ih.

NOT $C1 Ako $C1 sadrži EAX ili EBX, koristi ih.

OR $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

POP $C1 Ako je $C1 jednak EAX ili EBX, briše ih. Relativna promjena ESP je -4

PUSH $C1 Ako $C1 sadrži EAX ili EBX, koristi ih. Relativna promjena ESP je –4

REP MOVSB Irelevantna

RET $N1 Relativna promjena ESP je $N1+4

SAHF Koristi EAX

SAL EAX,$N1 Koristi EAX

SETA AL Briše EAX

SETB AL Briše EAX

SETE AL Briše EAX

SETG AL Briše EAX

SETL AL Briše EAX

SETNE AL Briše EAX

SUB $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

XOR $C1,$C2 Ako bilo koji od $C1 ili $C2 sadrži EAX ili EBX, koristi ih.

Sl. 11.6.2. Efekti pojedinih instrukcija relevantni za optimizaciju

Page 82: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

82Da bi se znalo koje instrukcije iz peephole bafera je moguće izbaciti treba ažurirati sljedeće indikatore:

- Da li grupa instrukcija mijenja EAX prije nego ga čita

- Da li grupa instrukcija uopšte čita EAX

- Da li grupa instrukcija mijenja EBX prije nego ga čita

- Da li grupa instrukcija uopšte čita EBX

- Da li grupa instrukcija koristi floating point instrukcije

- Na kojoj se poziciji nalazi ESP registar u odnosu na početak grupe instrukcija

Procedura obradistanje za svaku od instrukcija koja joj se proslijedi ažurira navedenih šest indikatora.

Instrukcije koje su korištene za generisanje koda se mogu smjestiti u tabelu na slici Sl. 11.6.2 po njihovom ponašanju:

Optimizacijska pravila implementirana u osmoj verziji kompajlera su:

1) Sekvenca PUSH EAX / instrukcije koje ne mijenjaju EAX / POP EAX povlači izbacivanje PUSH EAX i POP EAX instrukcija. Unutar ove sekvence ESP mora biti na istom nivou, dakle sekvenca mora imati jednak broj PUSH i POP instrukcija. Dualno pravilo se primjenjuje ako se zamijene EAX i EBX.

2) Sekvenca PUSH EAX / instrukcije koje ne mijenjaju EBX / POP EBX povlači izbacivanje POP EBX i zamjenu PUSH EAX instrukcije instrukcijom MOV EBX,EAX. Unutar ove sekvence ESP mora biti na istom nivou, dakle sekvenca mora imati jednak broj PUSH i POP instrukcija. Dualno pravilo se primjenjuje ako se zamijene EAX i EBX.

3) Sekvenca LEA EBX,adresa / PUSH EBX / instrukcije koje ne mijenjaju EBX / POP EBX povlači izbacivanje LEA EBX,adresa i PUSH EBX te zamjenu POP EBX instrukcije instrukcijom LEA EBX,adresa. Unutar ove sekvence ESP mora biti na istom nivou, dakle sekvenca mora imati jednak broj PUSH i POP instrukcija

4) Ako nakon instrukcije LEA EBX,adresa slijedi instrukcija koja briše EBX prije instrukcije koja ga koristi, instrukcija LEA EBX, adresa se može obrisati.

5) Ako nakon instrukcije MOV EAX,adresa slijedi instrukcija koja briše EAX prije instrukcije koja ga koristi, instrukcija MOV EAX, adresa se može obrisati. Dualno pravilo se primjenjuje ako se zamijene EAX i EBX.

6) Ako iza instrukcije FLD slijedi sekvenca instrukcija koje ne koriste FPU a nakon njih instrukcija FSTP ST(0) (odbacivanje podatka) instrukcije FLD i FSTP ST(0) se mogu obrisati.

7) U sekvenci ADD ESP,-8 / FSTP QWORD PTR [ESP] / Instrukcije koje ne koriste FPU/ FLD QWORD PTR [ESP] / ADD ESP,8 sve četiri instrukcije koje uokviruju ostale instrukcije se mogu brisati.

8) Instrukcije koje nemaju efekta kao što su MOV EAX,EAX ; MOV EBX,EBX ;ADD EAX,0 ili ADD EBX,0 se mogu brisati

9) Ako su dvije uzastopne iste MOV instrukcije , jedna se može brisati

10) Ako iza MOV registar,konst slijedi ADD registar,konst ovo se može svesti na jednu MOV instrukciju koja dodjeljuje implicitni zbir

11) Ako iza instrukcije MOV registar,konst slijedi NEG registar, to se može zamijeniti sa MOV registar,-konst. Ovim je riješen problem unarnog minusa koji je u nekim jezicima sastavni dio konstante.

12) Ako su dvije uzastopne iste ADD instrukcije , mogu se svesti na jednu sa implicitnim zbirom

13) Sekvence tipa MOV reg1,reg2 / ADD reg3,reg1 / MOV reg1,reg3 se mijenjaju sekvencama ADD reg3,reg2 / MOV reg1,reg3. Umjesto registara ovdje se mogu javljati i memorijske lokacije, a pored ADD instrukcije ista sekvenca je moguća i sa instrukcijama AND, SUB, MOV, OR, XOR.

14) Sekvence tipa PUSH reg1 / MOV reg2,reg3 / MOV reg1,reg4 / POP reg4 znače da se reg1 i reg4 mogu obrisati. Ova sekvenca se javlja kao rezultat drugih optimizacija.

Procedura Optimizuj, koja se poziva iz procedure Emit provjerava sve ove slučajeve i izbacuje odnosno zamjenjuje nepotrebne instrukcije.

Ovih 14 jednostavnih pravila skraćuju asemblerski generisani program za oko 30 %. Realizacija samog optimizatora je nešto usložnjena kako bi pretraživanje išlo brže. Uvođenje optimizacije usporava proces kompajliranja. Sedma verzija kompajlera je prevodila prethodni primjer na Pentium-u 100 za 0,2 s, dok osmoj verziji za isti zadatak treba oko 2,5 s.

Page 83: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

8311.7. Testni primjer optimizacije

Kao testni primjer uzet je program predstavljen u prvoj koloni slike Sl. 11.7.1 :

cijeli a;{ a:=2; a:=a+a+1;}

Izvorni kôd

Neoptimizirani kôd iz 7. Verzije kompajlera

Uočene redundante sekvence

Optimizovani kôd iz 8. verzije

cijeli a;{ a:=2; a:=a+a+1;}

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: FINIT JMP GLAVNI;cijeli a;;{; a:=2;GLAVNI: LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EBX MOV EAX,2 POP EBX MOV [EBX],EAX; a:=a+a+1; LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EBX LEA EBX,GLOBALV[0] MOV EAX,[EBX] PUSH EAX LEA EBX,GLOBALV[0] MOV EAX,[EBX] POP EBX ADD EAX,EBX PUSH EAX MOV EAX,1 POP EBX ADD EAX,EBX POP EBX MOV [EBX],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Nepotrebno MOV EAX 13 MOV EAX,[EBX]14 PUSH EBX15 MOV EAX,2Nepotrebno LEA/PUSH/POP12 LEA EBX,GLOBALV[0]13 PUSH EBX14 MOV EAX,215 POP EBXNasao nepotrebno LEA12 LEA EBX,GLOBALV[0]13 MOV [EBX],EAX14; a:=a+a+1;15 LEA EBX,GLOBALV[0] Nepotrebno MOV EAX 12 MOV EAX,[EBX]13 PUSH EBX14 LEA EBX,GLOBALV[0]15 MOV EAX,[EBX]Nasao nepotrebno LEA12 LEA EBX,GLOBALV[0]13 MOV EAX,[EBX]14 PUSH EAX15 LEA EBX,GLOBALV[0]Nasao nepotrebno LEA13 LEA EBX,GLOBALV[0]14 MOV EAX,[EBX]15 POP EBXNepotrebno PUSH /POP EBX12 PUSH EAX13 MOV EAX,DWORD PTR GLOBALV[0]14 POP EBXNepotrebna trojka11 MOV EAX,DWORD PTR GLOBALV[0]12 MOV EBX,EAX13 MOV EAX,DWORD PTR GLOBALV[0]Nepotrebno PUSH /POP EBX13 PUSH EAX14 MOV EAX,115 POP EBXNepotrebno LEA/PUSH/POP7 LEA EBX,GLOBALV[0]8 PUSH EBX9 MOV EBX,DWORD PTR GLOBALV[0]10 MOV EAX,DWORD PTR GLOBALV[0]11 ADD EAX,EBX12 MOV EBX,EAX13 MOV EAX,114 ADD EAX,EBX15 POP EBXNasao nepotrebno LEA10 LEA EBX,GLOBALV[0]11 MOV [EBX],EAX12;}13;}14 PUSH 015 CALL ExitProcess@4Prevedeno bez greske

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: FINIT JMP GLAVNI;;cijeli a;;{; a:=2;GLAVNI: MOV EAX,2 MOV DWORD PTR GLOBALV[0],EAX; a:=a+a+1; MOV EBX,DWORD PTR GLOBALV[0] MOV EAX,DWORD PTR GLOBALV[0] ADD EAX,EBX MOV EBX,EAX MOV EAX,1 ADD EAX,EBX MOV DWORD PTR GLOBALV[0],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Optimalni kôd

.486

.MODEL FLAT,STDCALLOPTION CASEMAP:NONEEXTRN ExitProcess@4:NEAR.CODEULAZ: JMP GLAVNI;;cijeli a;;{; a:=2;GLAVNI: MOV DWORD PTR GLOBALV[0],2; a:=a+a+1; MOV EAX,DWORD PTR GLOBALV[0] ADD EAX,DWORD PTR GLOBALV[0] INC EAX MOV DWORD PTR GLOBALV[0],EAX;};} PUSH 0 CALL [email protected] DB 4 DUP(0)INTTOFP DD 0END ULAZ

Sl. 11.7.1. Primjer rada optimizatoraKada ne bi bilo optimizacije, (kao u verziji 7 kompajlera) prevedeni kôd bi izgledao kao u drugoj koloni. U

kompajleru je uključeno da prikazuje sekvence koje pronalazi optimizator nakon zaključka da se one mogu zamijeniti kraćim sekvencama. U trećoj koloni se vidi da je optimizator djelovao ukupno 11 puta u ovako malom programu.

Page 84: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

84Rezultat optimizacije je dat u gornjem dijelu četvrte kolone na slici Sl. 11.7.1. Ovo još nije najbolji kôd koji se može

generisati. Uz povećanje broja pravila (što u ovom radu nije učinjeno) može se približiti optimalnom kodu iz donjeg dijela četvrte kolone.

I na većim programima uočavaju se uštede od oko 30%-40%, iako je implementirano prilično malo optimizacijskih pravila.

11.8. Rezime poglavljaPredprocesor omogućava zamjenu dijelova koda konstantama, uključivanje čitavih listinga izvornog koda, te uslovno

kompajliranje. Predprocesor je baziran na baferu u kome se čuvaju definicije zamjenskih simbola. Promijenjene su procedure Novi i Emit i projekt organizovan u tri modula. Optimizator radi na principu zadrške nekoliko instrukcija i traženja karakterističnih sekvenci koje se zamjenjuju kraćim sekvencama. Pri izboru sekvenci prati se upotreba registara EAX, EBX, ESP i FP steka.

Ovim je razvoj jezika, na nivou ovog rada, završen. Sada treba isprobati nekoliko primjera iz realnog svijeta.

Page 85: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

8512. TESTNI PRIMJERI

Nakon realizacije posljednje verzije kompajlera slijedi njegovo testiranje. Kompajler je isproban na aplikacijama iz realnog svijeta, iz raznih oblasti primjene.

12.1. Primjer: Baze podataka i korisnički interfejsPošto su baze podataka uz igre, obradu teksta i sistemski softver najpopularnija kategorija softvera, završni primjer

programa u jeziku FILDZAN-32 je mala baza podataka u Accessovom MDB formatu kojoj se pristupa koristeći SQL i ODBC. Ne bi bilo bitne razlike ni da je u pitanju MS SQL Server ili Oracle RDBMS. Sastoji se od jedne tabele koja predstavlja telefonski imenik. Imenik se može pretraživati, a u njega se mogu unositi podaci. Polja u tabeli IMENIK su

IME CHAR(20), PREZIME CHAR(20), ADRESA CHAR(20), TELEFON CHAR(20)

Ovaj database primjer koristi, pored Windows API funkcija navedenih u prethodnom poglavlju i mnoge API funkcije iz oblasti ODBC-a. Konekcija sa ODBC sistemom se uspostavlja koristeći SQLAllocEnv, za pripremu okruženja, SQLAllocConnect za rezervisanje prostora u memoriji za konekciju, SQLDriverConnect koji zaista vrši konekciju sa datim sistemom za upravljanje bazom podataka. Prostor u memoriji za naredbu se rezerviše koristeći SQLAllocStmt, a oslobađa

koristeći SQLFreeStmt.

SQL Naredba se izvršava peko funkcije SQLExecDirect. Ako ona vraća podatke, slog se preuzima koristeći SQLFetch, a odgovarajuće polje se dobije funkcijom SQLGetData. Konekcija se prekida sa SQLDisconnect a memorija oslobađa sa SQLFreeConnect.

Na slici se vidi prozor sa formularom za pretraživanje i unošenje navedene baze podataka. Na njemu se nalaze četiri labele, četiri editna polja i tri tastera.

Obrada poruka koje generišu ovi tasteri se vrši na standardan način, kao u primjeru iz prethodnog poglavlja

Sl. 12.1.1. Izgled ekrana demonstracione ODBC aplikacijeKompajliranje i linkovanje ovog primjera zahtijeva još jednu dodatnu biblioteku prilikom linkovanja.

komp32v7 odbc.jez odbc.asm ml /c /coff /Fl odbc.asmlink /defaultlib: user32.lib kernel32.lib gdi32.lib odbc.lib /subsystem:windows odbc.obj

Datoteke odbc.jez i odbc.h sa finalnim primjerima date su na slikama Sl. 12.1.2 i Sl. 12.1.3.

Page 86: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

86

#dodaj odbc.hcijeli funkcija Konekcija(){ cijeli velicina,rez; karakter [2000] punistring; rez:=SQLAllocEnv(&ehan);

rez:=SQLAllocConnect(&chan,ehan); rez:=SQLDriverConnect(0,&velicina, 1900, punistring, 70,"DRIVER={Microsoft Access Driver (*.mdb)};DBQ=test.mdb",hWnd,chan); rez:=SQLAllocStmt(&shan,chan);}cijeli funkcija Diskonekcija(){ cijeli rez; rez:=SQLFreeStmt(0,shan); rez:=SQLDisconnect(chan); rez:=SQLFreeConnect(chan);}cijeli funkcija Insert(){ karakter [500] komanda; karakter * kk; karakter [30] polje; karakter [2] navodnik; cijeli rez; navodnik [0]:=39;navodnik[1]:=0; komanda[0]:=0; lstrcat("INSERT INTO IMENIK(IME,PREZIME,ADRESA,TELEFON) VALUES(",komanda); GetWindowTextA(30,polje,ka); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kb); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kc); NAV;POLJE;NAV;ZAREZ; GetWindowTextA(30,polje,kd); NAV;POLJE;NAV; lstrcat(")",komanda); ako (lstrlenA(polje)>4) { Konekcija(); rez:=SQLExecDirect(lstrlenA(komanda),komanda,shan); Diskonekcija(); } inace { MessageBoxA(0,"Greska","Kratak broj",0);}}cijeli funkcija Select(){ karakter[500] komanda; karakter [2] navodnik; karakter [30] polje; cijeli rez,indikator; navodnik [0]:=39;navodnik[1]:=0; komanda[0]:=0; lstrcat("SELECT IME,PREZIME,ADRESA,TELEFON FROM IMENIK WHERE 1=1 ",komanda); GetWindowTextA(30,polje,ka); ako (lstrlenA(polje))>1 { lstrcat(" AND IME=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kb); ako (lstrlenA(polje))>1 { lstrcat(" AND PREZIME=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kc); ako (lstrlenA(polje))>1 { lstrcat(" AND ADRESA=",komanda);NAV;POLJE;NAV; } GetWindowTextA(30,polje,kd); ako (lstrlenA(polje))>1 { lstrcat(" AND TELEFON=",komanda);NAV;POLJE;NAV; } Konekcija(); rez:=SQLExecDirect(lstrlenA(komanda),komanda,shan); rez:=SQLFetch(shan); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,1,shan); SetWindowTextA(polje,ka); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,2,shan); SetWindowTextA(polje,kb); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,3,shan); SetWindowTextA(polje,kc); rez:=SQLGetData(&indikator,30,polje,SQLCHAR,4,shan); SetWindowTextA(polje,kd); Diskonekcija();}cijeli funkcija PraznaForma() { karakter [1] prazna; prazna[0]:=0;

SetWindowTextA(prazna,ka); SetWindowTextA(prazna,kb); SetWindowTextA(prazna,kc); SetWindowTextA(prazna,kd); }

cijeli funkcija WndProc(cijeli lParam,cijeli wParam,cijeli wMessage,cijeli hWnd) { cijeli obradjena; obradjena:=0; ako (wMessage=1) `WM_CREATE { ka:=CreateWindowExA(0,hInstance,0,hWnd,20,120,20,140, UOKVIRENO,0,"EDIT",0); kb:=CreateWindowExA(0,hInstance,0,hWnd,20,120,60,140, UOKVIRENO,0,"EDIT",0);kc:=CreateWindowExA(0,hInstance,0,hWnd,20,120,100,140, UOKVIRENO,0,"EDIT",0);kd:=CreateWindowExA(0,hInstance,0,hWnd,20,120,140,140, UOKVIRENO,0,"EDIT",0);ke:=CreateWindowExA(0,hInstance,0,hWnd,20,120,180,140, UOKVIRENO,"Nadji","BUTTON",0);kf:=CreateWindowExA(0,hInstance,0,hWnd,20,120,220,140, UOKVIRENO,"Unesi","BUTTON",0);kk:=CreateWindowExA(0,hInstance,0,hWnd,20,120,260,140, UOKVIRENO,"Prazna forma","BUTTON",0);kg:=CreateWindowExA (0,hInstance,0,hWnd,20,120,20,10, UOKVIRENO,"Ime ","STATIC",0);kh:=CreateWindowExA (0,hInstance,0,hWnd,20,120,60,10, UOKVIRENO,"Prezime ","STATIC",0);ki:=CreateWindowExA(0,hInstance,0,hWnd,20,120,100,10, UOKVIRENO,"Adresa ","STATIC",0);kj:=CreateWindowExA(0,hInstance,0,hWnd,20,120,140,10, UOKVIRENO,"Telefon ","STATIC",0); obradjena:=1; } ako (wMessage=2) `WM_QUIT {PostQuitMessage (0) ; obradjena:=1; } ako (wMessage=273) `WM_COMMAND { ako (lParam=ke) { Select(); } ako (lParam=kf) { Insert(); } ako (lParam=kk) { PraznaForma(); } obradjena:=1; } ako (obradjena=0) { DefWindowProcA lParam,wParam,wMessage,hWnd); } } { nCmdShow:=10; hInstance:=GetModuleHandleA (0); wndclass.cbsize:=48; wndclass.style := 0 ; wndclass.lpfnWndProc := WndProc ; wndclass.cbClsExtra := 0 ; wndclass.cbWndExtra := 0 ; wndclass.hInstance := hInstance ; wndclass.hIcon := 0 ; wndclass.hCursor := LoadCursorA (32512,0) ; wndclass.hbrBackground := GetStockObject(3); wndclass.lpszMenuName := 0; wndclass.lpszClassName := "PROBNA" ; wndclass.hIconSm:=0; ako (!(RegisterClassExA (&wndclass))) { 0 ; } inace { hWnd := CreateWindowExA ( 0,hInstance,0,0, 400,400,4,4,13565952,"ODBC Database Demo","PROBNA",512); ShowWindow ( nCmdShow,hWnd) ; UpdateWindow(hWnd) ; dok (GetMessageA (0, 0, 0,&msg)) { TranslateMessage (&msg) ; DispatchMessageA (&msg) ; } msg.wParam ; } }

Sl. 12.1.2. Datoteka ODBC.JEZ

Page 87: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

87cijeli funkcija RegisterClassExA(cijeli * wndclass);cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, cijeli c,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,cijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija GetStockObject ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijeli c,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b, karakter * c,cijeli d);cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija lstrcat ( karakter * a,karakter * b) ;cijeli funkcija GetWindowTextA (cijeli a, karakter * b,cijeli c);cijeli funkcija SetWindowTextA (karakter * b,cijeli c);

cijeli funkcija SQLAllocEnv(cijeli * EnvironHandle);cijeli funkcija SQLAllocConnect(cijeli * ConnectionHandle,cijeli EnvironHandle);cijeli funkcija SQLDriverConnect(cijeli DriverCompletion,cijeli * StringLengthDPtr, cijeli BufferLength, cijeli * OutConnectionString, cijeli StringLengthJ,cijeli * InConnectionString,cijeli WindowHandle, cijeli ConnectionHandle);` DRIVER={Microsoft Access Driver (*.mdb)};DBQ=cijeli funkcija SQLAllocStmt(cijeli * StatementHandle,cijeli ConnectionHandle);cijeli funkcija SQLExecDirect(cijeli TextLen,cijeli * StatementText,cijeli StatementHandle);cijeli funkcija SQLDisconnect(cijeli ConnectionHandle);cijeli funkcija SQLFreeConnect(cijeli ConnectionHandle);cijeli funkcija lstrlenA (karakter * a);cijeli funkcija wvsprintfA(realni * broj,karakter * format, karakter * bafer );cijeli funkcija SQLFreeStmt(cijeli fOption,cijeli hstmt);cijeli funkcija SQLFetch(cijeli StatementHandle);cijeli funkcija SQLGetData(cijeli * StrLenOrInd,cijeli BufferLength,

cijeli * TargetValue,cijeli TargetType,cijeli ColumnNumber, cijeli StatementHandle);cijeli hWnd ; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } msg ; ` a message structure

slog { cijeli cbsize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wndclass ; ` window class structure

cijeli nCmdShow;karakter * lpszCmdLine;cijeli hPrevInstance;cijeli hInstance;cijeli ka,kb,kc,kd,ke,kf,kg,kh,ki,kj,kk;cijeli ehan,chan,shan;

#definiraj UOKVIRENO 1350631424#definiraj NAV lstrcat(navodnik,komanda)#definiraj POLJE lstrcat(polje,komanda)#definiraj ZAREZ lstrcat(",",komanda)#definiraj SQLDRIVERPROMPT 2#definiraj SQLCHAR 1

Sl. 12.1.3. Datoteka ODBC.H

12.2. Primjer: MultimedijaNa slici Sl. 12.2.1 je dat prosti program koji šalje na zvučnik sadržaj WAV datoteke, koristeći funkciju PlaySound.

Ovaj primjer ujedno ilustruje učitavanje dinamičkih biblioteka. Funkcija LoadLibraryA učitava cijelu dinamičku biblioteku, dok funkcija GetProcAddress vraća adresu pojedine procedure u njoj.cijeli * PlaySound;cijeli funkcija LoadLibraryA(karakter * ime);cijeli funkcija GetProcAddress(karakter * ime,cijeli hl); cijeli hl;{

hl:=LoadLibraryA("WINMM.DLL"); PlaySound:=GetProcAddress("PlaySound",hl); PlaySound(131072,0,"c:\PJESMA.WAV");}

Sl. 12.2.1. Datoteka sound.jez

12.3. Primjer: Web ServerU jeziku FILDZAN-32 napisan je mali Web server, sposoban da prikazuje statičke web stranice sa hiperlinkovima, na

mašini, lokalnoj mreži ili Internetu. Web server koristi Winsock biblioteku, odnosno funkcije WSAStartup (inicijalizacija okruženja), WSACleanup (uklanjanje okruženja), accept (prihvatanje konekcije i njeno povezivanje s soketom), closesocket (uklanjanje soketa iz tabele), send (slanje podataka prijemnom soketu) , recv (prijem podatka od drugog soketa), socket (kreiranje krajnje tačke za komunikaciju i vraćanje soketa), listen (slušanje da li u konekciji nailazi neki soket i bind (dodjela lokalnog imena neimenovanom soketu).

Listing programa dat je na slici Sl. 12.3.1. Princip Web servera je u suštini jednostavan. Nakon što je povezan soket da osluškuje port 80 (HTTP) očekuje se zahtjev od strane klijenta. U okviru ovog zahtjeva obično dolazi komanda GET praćena imenom datoteke i verzijom protokola. Nakon parsiranja imena, otvara se datoteka sa tim imenom i njen sadržaj se pošalje klijentskom soketu koristeći funkciju send.

Page 88: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

88

#definiraj HTTPPORT 80#definiraj CETRSTOCETIRI "HTTP/1.1\ 404 Content-Type: text/html \ <h1>Nema stranice</h1><hr><i>Ibrik\ Web Server, v1.0-(c) 2002-2003 by \ Kenan Kalajdzic"#definiraj CETRSTO "HTTP/1.1 400 \ Content-Type: text/html <h1>Bad \ Request</h1><hr><i>Ibrik Web \ Server, v1.0 - (c) 2002-2003 by \ Kenan Kalajdzic"#definiraj INDEXPAGE "/index.htm"#definiraj WEBDIR "D:/thp/%s"#definiraj METODLEN 16#definiraj PAGELEN 256#definiraj SOCKADDRIN slog { \karakter fam1,fam2,port1,port2; \cijeli inaddr; karakter [8] \sinzero; }#definiraj BUFSIZE 1024#definiraj SOCKET cijeli#definiraj SOCKSTREAM 1#definiraj SOCKETERROR (-1)#definiraj INVALIDSOCKET (~0)#definiraj INADDRANY 0#definiraj PFINET 2#definiraj STRADDRINLEN 16#definiraj FILEATTRIBUTENORMAL 128#definiraj OPENEXISTING 3#definiraj GENERICREAD 2147483648#definiraj INVALIDHANDLEVALUE (-1)#definiraj WSADATA slog { cijeli \ wVersion;\ cijeli wHighVersion;\ karakter [257] szDescription;\ karakter [129] szSystemStatus;\ cijeli iMaxSocketsiMaxUdpDg;\ karakter * lpVendorInfo;}SOCKET sd, newsd;cijeli f,imebr;cijeli wsVersion; cijeli bytes, pos;karakter [BUFSIZE] buf;karakter * ptr, ptr2 ;SOCKADDRIN sin, rhost; cijeli rlen;cijeli dalje,petlja;WSADATA wsaData;cijeli funkcija WSAStartup (cijeli * adr,cijeli ver);cijeli funkcija WSACleanup ();cijeli funkcija GetVersion ();cijeli funkcija accept(cijeli * a,cijeli * b,cijeli c);cijeli funkcija closesocket(cijeli socket);cijeli funkcija send(cijeli a, cijeli b, karakter * c,cijeli d);cijeli funkcija socket(cijeli a,cijeli b,cijeli c);cijeli funkcija listen(cijeli a,cijeli b);cijeli funkcija bind(cijeli a,cijeli * sockp,cijeli sock);cijeli funkcija wvsprintfA(cijeli * kom,karakter * fmt,karakter * dest);cijeli funkcija CreateFileA(cijeli hTemplateFile, cijeli dwFlagsAndAttributes,cijeli dwCreationDisposition, karakter * lpSecurityAttributes, cijeli dwShareMode,cijeli dwDesiredAccess,karakter * lpFileName,);cijeli funkcija ReadFile( cijeli lpOverlapped, cijeli * lpNumberOfBytesRead, cijeli nNumberOfBytesToRead, cijeli * lpBuffer, cijeli hFile);cijeli funkcija CloseHandle(cijeli hobject);cijeli funkcija MessageBoxA(cijeli opcije,karakter * poruka, karakter * naslov,cijeli handle);cijeli funkcija ExitProcess(cijeli kod);

cijeli funkcija recv(cijeli a,cijeli b,cijeli * c,cijeli sock);cijeli funkcija lstrcmp(karakter * a,karakter * b);cijeli funkcija lstrcpy(karakter * a,karakter * b);slog { karakter [METODLEN] method; karakter [PAGELEN] page;} req;cijeli funkcija hasnewline(karakter * ptr){ cijeli ima,n; ima:=0; dok (* ptr # 0) & (ima =0) { ako (* ptr = 13) { * ptr := 0; ima:=1; } ptr:=&(ptr[1]); } n:=ima;}karakter * funkcija getstr(karakter * dest, karakter * src, cijeli max){ karakter * rez; karakter m; max := max-1; dok ( src[0] # ' ') & (max >0) { dest[0] := src[0]; src := &(src[1]); dest := &(dest[1]); max := max-1; } * dest := 0; rez := &(src[1]);}cijeli funkcija errexit(karakter * title){ MessageBoxA(0,"Upozorenje", title,0); WSACleanup(); ExitProcess(-1);}

{ ako (GetVersion() < 2147483648) { wsVersion := 2; ` Win NT } inace { wsVersion := 257; ` Win 9x } ako (WSAStartup (&wsaData,wsVersion )){ errexit("WSAStartup"); } sd:= socket(0,SOCKSTREAM,PFINET); ako (sd=INVALIDSOCKET) { errexit("socket"); } sin.fam1 := PFINET; sin.fam2 := 0; sin.port1 := 0; sin.port2 := HTTPPORT; sin.inaddr := INADDRANY; ako (bind(STRADDRINLEN,&sin,sd)= SOCKETERROR){ errexit("bind"); } ako (listen(1,sd)=SOCKETERROR) { errexit("listen"); } dok (1 ) { rlen := STRADDRINLEN; newsd:=accept(&rlen,&rhost,sd); ako (newsd= INVALIDSOCKET) { errexit("accept"); } pos := 0; bytes :=0; dok (bytes < BUFSIZE) { buf[bytes]:=0; bytes := bytes+1; }

petlja :=1; bytes := 1; dok (bytes # 0 ) & petlja { dalje:=1; bytes := recv(0,BUFSIZE-pos, &buf[pos], newsd); ako (bytes = SOCKETERROR) { ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } dalje :=0; } ako(hasnewline(buf)&dalje) { dalje := 0; petlja := 0; } ako dalje { pos := pos+bytes; } } getstr( req.page, getstr(req.method, buf, METODLEN),PAGELEN); dalje :=1; ako (lstrcmp("GET", req.method)){ dalje :=1; send(0,100,CETRSTO,newsd); ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } dalje := 0; } ako(!lstrcmp("/",req.page)& dalje) { lstrcpy(INDEXPAGE,req.page); } ako dalje { imebr:=req.page; imebr:=imebr+1; wvsprintfA(&imebr,WEBDIR,buf); f := CreateFileA(0, FILEATTRIBUTENORMAL, OPENEXISTING,0,0, GENERICREAD,buf); ako f = INVALIDHANDLEVALUE { send(0,80, CETRSTOCETIRI,newsd); ako (closesocket(newsd)<0){ errexit("closesocket"); } dalje:=0; } inace { petlja:=1; dok (petlja ) { ako (!ReadFile(0,&bytes, BUFSIZE,buf,f)) { petlja:=0; } ako (bytes = 0) { petlja:=0; } ako petlja { ako send(0,bytes,buf, newsd) =SOCKETERROR) { petlja:=0; } } } ako (!CloseHandle(f)) { errexit("CloseHandle"); } } ako (closesocket(newsd) = SOCKETERROR) { errexit("closesocket"); } } }}

Sl. 12.3.1. Web server

Page 89: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

8912.4. Primjer: Numerička analiza

Pogledati primjer “Metoda sekante” na slici Sl. 9.7.1 s obzirom da se očuvala kompatibilnost sa tom verzijom kompajlera.

12.5. Rezime poglavljaZavršni primjeri pokazuju zrelost koju je jezik dostigao. Unatoč jednostavnom optimizatoru i kompajleru, izvršne

verzije svih testnih programa su dužine ispod 10 kilobajta. Raznovrsnost oblasti a već odlično demonstrira da se ovim kompajlerom mogu praviti gotovo sve klasične aplikacije. Testni primjeri su poslužili za otkrivanje grešaka u kompajleru, ali i pokazali da je sa ovom verzijom jezika moguće praviti aplikacije iz oblasti korisničkog interfejsa, baza podataka, multimedije, dvodimenzionalne i trodimenzionalne grafike, lokalnih i globalnih mreža, numeričke analize i gotovo svih drugih oblasti softvera. FILDZAN-32 definitivno nije najjednostavniji programski jezik za realizaciju ovih aplikacija, ali je jedan od rijetkih koji pruža uvid u internu implementaciju softvera.

Page 90: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

90Prilog 8: Verzija izvornog koda kompajlera br. 8, glavni program

program Kompajler;uses predpr8, postpr8;const MAXIDENT = 1024; MAXDIM = 10; DUGAKONST = 'Konstanta prevazilazi liniju'; REALKONST = 'Realna konstanta'; OCEKIVANO = 'Ocekivano '; REDEKLAR = 'Redeklarisan identifikator'; PROSTNIZ = 'Prosti tip ne moze biti niz'; NEKORARG = 'Nekorektan broj argumenata'; NEKDODJP = 'Losa dodjela pointeru'; NEDEKL = 'Nedeklarisano '; GRIZRAZ = 'Izraz'; POGRMNOZ = 'Pogresan tip u ' + 'mnozenju ili dijeljenju'; NEDOPFP = ' Nedopustena FP operacija'; NEDOPARIT = 'Nedopusteni tip u aritmetici'; OCEKDOD = 'Ocekivano dodjeljivanje'; NEDODJ = 'Izraz se ne moze dodijeliti'; DODJPOINT = 'Losa dodjela pointeru'; TIPUSL = 'Neodgovarajuci tip uslova'; TUSLPET = 'Neodgovarajuci uslov u petlji'; IMEFUN = 'Ocekivano ime funkcije'; DEFFUN = 'Definicija funkcije'; ARGNEKOM = 'Argument nekompatibilan' + ' s operatorom'; OCIDENT = 'Ocekivan Identifikator'; MAXDIMOV = 'Maksimalan broj dimenzija'; INDSTATC = 'Indeks statickog niza nije cijeli'; PREVDIM = 'Prevazidjen broj dimenzija'; NESLDIM = 'Ne slaze se broj dimenzija'; POLJEPOS = 'Polje vec postoji'; SLOGPOLJE = 'Samo slogovi mogu imati polja'; NEDEKPOLJE = 'Nedeklarisano polje'; SLOGSLOGU = 'Slog se moze dodijeliti samo slogu'; SLOGRAZDUZ = 'Slogovi razlicite duzine'; INDNOPOINT = 'Indirektna funkcija bez pointera'; SLOGNEPOR = 'Slogovi se ne mogu porediti';

type TVrsta = (funkcija, lokalna, globalna, parametar, polje); TTip = (karakter, cijeli, realni, slog, pkarakter, pcijeli, prealni, pslog); TIdent = record ime: string[20]; duzina: integer; adresa: integer; nivo: integer; vrsta: TVrsta; tip: TTip; pod1: integer; pod2: integer; pod3: integer; ukupdim: integer; dim: array[0..MAXDIM] of integer; end;

TZadnjiSlog = record duzina: integer; pozimena: integer; idopisasloga: integer end;

var trenlabela, aktnivo: integer; realnakonstanta: string; TabIdent: array[0..MAXIDENT] of TIdent;

ukupnoident, ukupnoslogova, ukdim: integer; t: TTip; dod: Boolean; zadnji: TZadnjiSlog; dimenzije: array[0..MAXDIM] of integer;

procedure NoviIdent(pime: string; pduzina: integer; padresa: integer; pnivo: integer; pvrsta: TVrsta; ptip: TTip; ppod1: integer; ppod2: integer; ppod3: integer);var i: integer;begin ukupnoident := ukupnoident + 1; with TabIdent[ukupnoident] do begin ime := pime; duzina := pduzina; adresa := padresa; nivo := pnivo; vrsta := pvrsta; tip := ptip; pod1 := ppod1; pod2 := ppod2; pod3 := ppod3; ukupdim := ukdim; for i := 0 to MAXDIM do dim[i] := dimenzije[i]; end;end;

procedure NovaLabela(var ImeLabele: string);begin trenlabela := trenlabela + 1; Str(trenlabela, ImeLabele);end;

procedure Greska(poruka: string);begin WriteLn(poruka); WriteLn(brojaclinija, ':', linija); Close(ulaz); Close(izlaz); Halt;end;

procedure NoviSvaki(greskakrln: Boolean);begin pozicija := pozicija + 1; if pozicija > Length(linija) then begin if greskakrln then Greska(DUGAKONST) else znak := ' '; end else znak := linija[pozicija];end;

procedure IdiDo(z: char);begin if (znak <> z) then Greska(OCEKIVANO + z); Novi;end;

function UzmiKonstantu (var t: TTip; var dod: Boolean): integer;var rezultat: integer;begin rezultat := 0; realnakonstanta := ''; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak = '.') or (znak = 'e') or (znak = 'E') then begin if znak = '.' then begin realnakonstanta := realnakonstanta

+ znak; NoviSvaki(false); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; end; if (znak = 'e') or (znak = 'E') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); if (znak = '+') or (znak = '-') then begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; if (znak < '0') or (znak > '9') then Greska(REALKONST); while (znak >= '0') and (znak <= '9') do begin realnakonstanta := realnakonstanta + znak; NoviSvaki(false); end; end; UzmiKonstantu := 0; t := realni; end else begin UzmiKonstantu := rezultat; t := cijeli; end; if (znak = ' ') or (znak = '`') then Novi; dod := false;end;

function Slijedi(ocekivano: string; dslovoiza: Boolean): Boolean;var ureduiza: Boolean; n: integer; znak: char;begin if dslovoiza then ureduiza := true else begin n := pozicija + Length(ocekivano); ureduiza := true; if Length(linija) >= n then begin znak := linija[n]; if ((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z')) then ureduiza := false end end; if ureduiza and (copy(linija, pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1; end else Slijedi := false;end;

function TipDek(imetipa: string; var tip: TTip; stip, ptip: TTip): Boolean;var tipind: TTip; kraj, x, poi: Boolean;begin TipDek := false; poi := false; if Slijedi(imetipa, false) then begin TipDek := true; Novi; if znak = '*' then begin tip := ptip; poi := true; Novi

Page 91: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

91 end else tip := stip; ukdim := 0; if znak = '[' then begin if poi then tip := pcijeli else tip := ptip; IdiDo('['); repeat ukdim := ukdim + 1; if ukdim > MAXDIM then Greska(MAXDIMOV); dimenzije[ukdim] := UzmiKonstantu(tipind, x); if tipind <> cijeli then Greska(INDSTATC); kraj := true; if znak = ',' then begin Novi; kraj := false; end; until kraj; IdiDo(']'); end; endend;

function SlijediDekTipa(var tip: TTip): Boolean;var a: Boolean;begin a := false; if not (a) then a := TipDek('cijeli', tip, cijeli, pcijeli); if not (a) then a := TipDek('karakter', tip, karakter, pkarakter); if not (a) then a := TipDek('realni', tip, realni, prealni); if not (a) then a := TipDek('slog', tip, slog, pslog); SlijediDekTipa := a;end;

function DuzinaTipa(tip: TTip): Integer;var elem, i: integer;begin case tip of cijeli: DuzinaTipa := 4; pcijeli, pkarakter, prealni, pslog: begin if ukdim = 0 then DuzinaTipa := 4 else begin elem := 4*ord(tip = pcijeli)+ 1 * ord(tip = pkarakter) + 8 * ord(tip = prealni) + zadnji.duzina * ord(tip = pslog); for i := 1 to ukdim do elem := elem * dimenzije[i]; DuzinaTipa := elem; end end; karakter: DuzinaTipa := 1; realni: DuzinaTipa := 8; slog: DuzinaTipa := zadnji.duzina; else DuzinaTipa := 4; end;end;

function NadjiIdent(ident: string; nivo, tuslova, p1: integer): integer;var n, poz: integer; nadjen, Uslov: Boolean;begin n := ukupnoident; nadjen := false; poz := 0; while (n > 0) and (not (nadjen)) do begin case tuslova of 1: Uslov := (TabIdent[n].ime = ident) and

(TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo) or (TabIdent[n].nivo = 0)); 2: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta in [lokalna, globalna, parametar, funkcija]) and ((TabIdent[n].nivo = nivo)); 3: Uslov := (TabIdent[n].ime = ident) and (TabIdent[n].vrsta = polje) and (TabIdent[n].nivo = nivo) and (TabIdent[n].pod3 = p1); 4: Uslov := (TabIdent[n].nivo = nivo) and (TabIdent[n].pod2 = p1) and (TabIdent[n].vrsta = parametar) else Uslov := false; end; if Uslov then begin nadjen := true; poz := n; end; n := n - 1; end; NadjiIdent := poz;end;

procedure UzmiIdent(var ident: string);begin if znak in ['a'..'z', 'A'..'Z'] then begin ident := znak; NoviSvaki(false); end else Greska(OCIDENT); while (znak in ['a'..'z', 'A'..'Z', '0'..'9', '_']) do begin ident := ident + znak; NoviSvaki(false); end; if (znak = ' ') or (znak = '`') then Novi;end;

procedure DeklIdent(var ident: string; nivo: integer);begin UzmiIdent(ident); if NadjiIdent(ident, nivo, 2, 0) <> 0 then Greska(REDEKLAR);end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean); forward;procedure Blok; forward;

procedure PokazivacINiz(var t: TTip; var dod: Boolean; idpoz: Integer);var t1: TTip; navdim,dsvedim,i: Integer; st: string;begin navdim := 0; Emit(' PUSH EAX'); Emit(' MOV EAX,0'); repeat Novi; navdim := navdim + 1; if navdim > MAXDIM then Greska(PREVDIM); Emit(' PUSH EAX'); IzrazDodjeljivanja(t1, dod); Emit(' POP EBX'); if znak = ',' then begin dsvedim:=1; for i:=navdim+1 to TabIdent[idpoz].ukupdim do dsvedim:=dsvedim* TabIdent[idpoz].dim[i]; Str(dsvedim, st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; Emit(' ADD EBX,EAX');

Emit(' MOV EAX,EBX'); until znak <> ','; Emit(' POP EBX'); if (navdim <> TabIdent[idpoz].ukupdim) and (not ((navdim = 1) and (TabIdent[idpoz].ukupdim = 0))) then Greska(NESLDIM); IdiDo(']'); case t of pkarakter: begin t := karakter; end; pcijeli: begin Emit(' SAL EAX,2'); t := cijeli; end; prealni: begin Emit(' FSTP ST(0)'); Emit(' SAL EAX,3'); t := realni; end; pslog: begin t := slog; Str(DuzinaTipa(t), st); Emit(' MOV EDX,' + st); Emit(' MUL EDX'); end; else Greska(PROSTNIZ) end; Emit(' ADD EBX,EAX'); case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]') else Emit(' MOV EAX,[EBX]'); end; dod := true;end;

procedure StringKonstanta(var t: TTip; var dod: Boolean);var st, strtekst: string;begin NovaLabela(strtekst); Emit('.DATA'); st := 'L' + strtekst + ' DB '''; repeat NoviSvaki(true); if znak <> '"' then st := st + znak; until znak = '"'; IdiDo('"'); st := st + ''',0'; if copy(st, length(st) - 3, 2) = '''''' then st := 'L' + strtekst + ' DB 0'; Emit(st); Emit('.CODE'); Emit(' MOV EAX,OFFSET L' + strtekst); t := pkarakter; dod := false;end;

Page 92: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

92

procedure PEmit(idpoz: Integer);var i: integer;begin if TabIdent[idpoz].ukupdim = 0 then Emit(' MOV EAX,[EBX]') else Emit(' MOV EAX,EBX'); ukdim := TabIdent[idpoz].ukupdim; for i := 0 to MAXDIM do dimenzije[i] := TabIdent[idpoz].dim[i];end;

function DeklaracijaSloga(nivo: integer): integer;var ImePolja: string; oznakasloga, podslog, duzinasloga, zapukdim, i, poz: integer; tip: TTip; imaistogtipa: Boolean; zdimenzije: array[0..MAXDIM] of integer;begin zapukdim := ukdim; for i := 0 to MAXDIM do zdimenzije[i] := dimenzije[i]; IdiDo('{');

Page 93: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

93 ukupnoslogova := ukupnoslogova + 1; oznakasloga := ukupnoslogova; duzinasloga := 0; poz := 0; while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then podslog := DeklaracijaSloga(nivo) else podslog := oznakasloga; repeat UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, podslog); if poz <> 0 then Greska(POLJEPOS); NoviIdent(ImePolja, DuzinaTipa(tip), 0, nivo, polje, tip, podslog, duzinasloga, oznakasloga); duzinasloga := duzinasloga + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (duzinasloga mod 4) <> 0 do duzinasloga := duzinasloga + 1; IdiDo(';'); end; IdiDo('}'); zadnji.duzina := duzinasloga; zadnji.pozimena := poz; zadnji.idopisasloga := OznakaSloga; DeklaracijaSloga := OznakaSloga; ukdim := zapukdim; for i := 0 to MAXDIM do dimenzije[i] := zdimenzije[i];end;

procedure ElementSloga (idpoz: integer; var t: TTip; var dod: Boolean);var poz, nivo, idsloga: integer; Imepolja, st: string;begin if t <> slog then Greska(SLOGPOLJE); nivo := TabIdent[idpoz].nivo; idsloga := TabIdent[idpoz].pod3; while znak = '.' do begin Novi; UzmiIdent(ImePolja); poz := NadjiIdent(ImePolja, nivo, 3, idsloga); if poz = 0 then Greska(NEDEKPOLJE); Str(TabIdent[poz].pod2, st); Emit(' ADD EBX,' + st); t := TabIdent[poz].tip; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin idsloga := TabIdent[poz].pod1; zadnji.duzina := TabIdent[poz].duzina; zadnji.pozimena := poz; zadnji.idopisasloga := TabIdent[poz].pod3; end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(poz); end; end;end;

procedure CijeliNaFPStek(reg: string; osmobitni: Boolean);begin if osmobitni then Emit(' AND ' + reg + ',0FFh'); Emit(' MOV INTTOFP,' + reg); Emit(' FILD DWORD PTR INTTOFP');end;

procedure FPStekUCijeli(reg: string);begin

Emit(' ADD ESP,-4'); Emit(' FISTP DWORD PTR [ESP]'); Emit(' POP ' + reg);end;

procedure CPUStekCijeliNaFPStek(osmobitni: Boolean);begin if osmobitni then Emit(' AND DWORD PTR [ESP],0FFh'); Emit(' FILD DWORD PTR [ESP]'); Emit(' ADD ESP,4');end;

procedure FPUStekNaStek;begin Emit(' ADD ESP,-8'); Emit(' FSTP QWORD PTR [ESP]');end;

procedure StekNaFPUStek;begin Emit(' FLD QWORD PTR [ESP]'); Emit(' ADD ESP,8');end;

procedure PozivFunkcije (idpoz: integer; var t: TTip; var dod: Boolean);var parametara, N, velsteka, duzprvogsloga, duzdrugogsloga, m1: integer; t1, t2: TTip; ImeFunkcije, st: string;begin ImeFunkcije := TabIdent[idpoz].ime; parametara := 0; velsteka := 0; duzprvogsloga := 0; duzdrugogsloga := 0; if znak <> '(' then begin velsteka := 0; for parametara := 1 to TabIdent[idpoz].pod1 do begin n := NadjiIdent('', idpoz, 4, parametara); velsteka := velsteka + ( (TabIdent[n].duzina - 1) div 4 + 1) * 4; end; Str(velsteka, st); Emit(' MOV EAX,OFFSET ' + imefunkcije + '@' + st); t := pcijeli; dod := false; end else begin IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); parametara := parametara + 1; n := NadjiIdent('', idpoz, 4, parametara); if n = 0 then Greska(NEKORARG); t2 := TabIdent[n].tip; if t2 = slog then duzdrugogsloga := TabIdent[n].duzina; if (t1 in [karakter, realni]) and (t2 in [pkarakter, pcijeli, prealni]) then Greska(NEKDODJP); if (t1 = karakter) and (t2 = cijeli) then Emit(' AND EAX,0FFh'); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); case t2 of slog: begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); m1 := ((duzprvogsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1;

Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; case t1 of realni: ; karakter: CijeliNaFPStek('EAX', true); else CijeliNaFPStek('EAX', false); end; FPUStekNaStek; end else begin velsteka := velsteka + 4; if t1 = realni then FPStekUCijeli('EAX'); Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); if TabIdent[idpoz].pod1 <> parametara then Greska(NEKORARG); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL ' + ImeFunkcije + '@' + st); dod := false; t := TabIdent[idpoz].tip; if t = karakter then Emit(' AND EAX,0FFh'); end;end;

procedure IndirektniPoziv(var t: TTip);var m1, velsteka, duzsloga: Integer; straddr, st: string; t1: TTip;begin velsteka := 0; NovaLabela(straddr); Emit('.DATA'); st := 'L' + straddr + ' DD ?'; Emit(st); Emit('.CODE'); Emit(' MOV L' + straddr + ',EAX'); IdiDo('('); while (znak <> ')') do begin IzrazDodjeljivanja(t1, dod); case t1 of slog: begin duzsloga := DuzinaTipa(t1); m1 := ((duzsloga - 1) div 4 + 1) * 4; velsteka := velsteka + m1; Str(duzsloga, st); Emit(' MOV ECX,' + st); Str(m1, st); Emit(' SUB ESP,' + st); Emit(' MOV ESI,EBX'); Emit(' MOV EDI,ESP'); Emit(' CLD'); Emit(' REP MOVSB'); end; realni: begin velsteka := velsteka + 8; FPUStekNaStek; end else begin velsteka := velsteka + 4; Emit(' PUSH EAX'); end; end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); Str(velsteka, st); Emit(' MOV ECX,' + st); Emit(' CALL L' + straddr);

Page 94: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

94 case t of pcijeli: t := cijeli; prealni: t := realni; pkarakter: t := karakter; pslog: t := slog; else Greska(INDNOPOINT) end;end;

procedure Varijabla (idpoz: integer; var t: TTip; var dod: Boolean; glob: Boolean);var rezultat: integer; st: string;begin rezultat := TabIdent[idpoz].adresa; t := TabIdent[idpoz].tip; Str(rezultat, st); if glob then Emit(' LEA EBX,GLOBALV[' + st + ']') else begin if rezultat >= 0 then Emit(' LEA EBX,[EBP+' + st + ']') else Emit(' LEA EBX,[EBP' + st + ']'); end; case t of karakter: Emit(' MOV AL,[EBX]'); realni: Emit(' FLD QWORD PTR [EBX]'); slog: begin zadnji.duzina := TabIdent[idpoz].duzina; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; end; pslog: begin rezultat:=1; for i:=1 to TabIdent[idpoz].

ukupdim do rezultat:=rezultat* TabIdent[idpoz].dim[i]; if rezultat<>0 then zadnji.duzina := TabIdent[idpoz].

duzina div rezultat else zadnji.duzina:=4; zadnji.pozimena := idpoz; zadnji.idopisasloga := TabIdent[idpoz].pod3; PEmit(idpoz); end; cijeli: Emit(' MOV EAX,[EBX]'); else PEmit(idpoz); end; if TabIdent[idpoz].ukupdim = 0 then dod := true else dod := false; while znak ='[' do begin PokazivacINiz(t, dod, idpoz); end; if znak = '(' then IndirektniPoziv(t);end;

procedure Faktor(var t: TTip; var dod: Boolean);var rezultat, poz: integer; st, fpkonst, ime, err: string;begin err := ARGNEKOM; case znak of '-': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' NEG EAX'); realni: Emit(' FCHS'); else Greska(err); end; dod := false; end; '~': begin Novi; Faktor(t, dod); case t of

cijeli: Emit(' NOT EAX'); karakter: Emit(' NOT AL'); else Greska(err); end; dod := false; end; '&': begin Novi; Faktor(t, dod); Emit(' MOV EAX,EBX'); case t of cijeli: t := pcijeli; karakter: t := pkarakter; slog: t := pslog; realni: begin t := prealni; Emit(' FSTP ST(0)'); end; else t := pcijeli; end; dod := false; end; '*': begin Novi; Faktor(t, dod); Emit(' MOV EBX,EAX'); if t = prealni then begin Emit(' FSTP ST(0)'); Emit(' FLD QWORD PTR [EBX]'); end else Emit(' MOV EAX,[EBX]'); case t of pcijeli: t := cijeli; pkarakter: begin t := karakter; Emit(' AND EAX,0FFh'); end; prealni: t := realni; pslog: begin t := slog; end; else Greska(err); end; dod := true; end; '!': begin Novi; Faktor(t, dod); case t of cijeli: Emit(' CMP EAX,0'); karakter: Emit(' CMP AL,0'); else Greska(err); end; Emit(' SETE AL'); Emit(' AND EAX,0FFh'); dod := false; t := cijeli; end; '"': begin StringKonstanta(t, dod); end; '''': begin NoviSvaki(true); Emit(' MOV AL,''' + znak + ''''); Novi; IdiDo(''''); t := karakter; end; '0'..'9': begin rezultat := UzmiKonstantu(t, dod); case t of cijeli: begin Str(rezultat, st); Emit(' MOV EAX,' + st); end; realni: begin NovaLabela(fpkonst); Emit('.DATA'); st := 'L' + fpkonst + ' DQ '+realnakonstanta; Emit(st); Emit('.CODE'); Emit(' FLD L' + fpkonst); end; end; end; '(': begin

Novi; IzrazDodjeljivanja(t, dod); IdiDo(')'); end; 'A'..'Z', 'a'..'z': begin UzmiIdent(ime); poz := NadjiIdent(ime, aktnivo, 1, 0); if poz = 0 then Greska(NEDEKL + ime); case TabIdent[poz].vrsta of funkcija: PozivFunkcije(poz, t, dod); lokalna, parametar: Varijabla(poz, t, dod, false); globalna: Varijabla(poz, t, dod, true) end end; else Greska(GRIZRAZ); end; if znak = '.' then ElementSloga(zadnji.pozimena,t,pod);end;

procedure Clan(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Faktor(t1, dod); t := t1; while (znak in ['*', '/', '%']) do begin z := znak; if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; Novi; Faktor(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(POGRMNOZ); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '*': Emit(' FMUL '); '/': Emit(' FDIVR '); else Greska(NEDOPFP); end end else begin t := cijeli; case z of '*': begin Emit(' POP EBX'); if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); Emit(' CDQ'); if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end; t1 := t;

Page 95: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

95 end;end;

procedure Izraz(var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip;begin Clan(t1, dod); t := t1; while (znak in ['+', '-', '&', '|', '^']) do begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Clan(t2, dod); dod := false; if (not (t1 in [cijeli, karakter, realni])) or (not (t2 in [cijeli, karakter, realni])) then Greska(NEDOPARIT); if (t1 = realni) or (t2 = realni) then begin t := realni; if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter); if t1 <> realni then CPUStekCijeliNaFPStek(t1 = karakter) else StekNaFPUStek; case z of '+': Emit(' FADD '); '-': Emit(' FSUBR '); else Greska(NEDOPFP); end end else begin case z of '+': begin Emit(' POP EBX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' ADD AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EBX,0FFh'); if t2 = karakter then Emit(' AND EAX,0FFh'); Emit(' ADD EAX,EBX'); end; end; '-': begin Emit(' MOV EBX,EAX'); Emit(' POP EAX'); if (t1 = karakter) and (t2 = karakter) then begin t := karakter; Emit(' SUB AL,BL'); end else begin t := cijeli; if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' SUB EAX,EBX'); end; end; '&', '|', '^': begin if (t1 = karakter) and (t2 = karakter) then t := karakter else t := cijeli; Emit(' POP EBX'); case z of '&': Emit(' AND EAX,EBX'); '|': Emit(' OR EAX,EBX'); '^': Emit(' XOR EAX,EBX'); end; end; end; end;

t1 := t; end;end;

procedure IzrazDodjeljivanja (var t: TTip; var dod: Boolean);var z: char; t1, t2: TTip; dod1: Boolean; duzprvogsloga, duzdrugogsloga: Integer; st: string;begin duzprvogsloga := 0; duzdrugogsloga := 0; Izraz(t1, dod1); if t1 = slog then duzprvogsloga := DuzinaTipa(t1); t := t1; dod := dod1; case znak of ':': begin if not (Slijedi(':=', true)) then Greska(OCEKDOD); if not (dod1) then Greska(NEDODJ); Emit(' PUSH EBX'); if (t1 = realni) then Emit(' FSTP ST(0)'); Novi; IzrazDodjeljivanja(t2, dod); if t2 = slog then duzdrugogsloga := DuzinaTipa(t2); if ((t1 = slog) and (t2 <> slog)) or ((t1 <> slog) and (t2 = slog)) then Greska(SLOGSLOGU); if t1 = slog then begin if duzprvogsloga <> duzdrugogsloga then Greska(SLOGRAZDUZ); Emit(' POP EDI'); Emit(' MOV ESI,EBX'); Emit(' CLD'); Str(duzprvogsloga, st); Emit(' MOV ECX,' + st); end else Emit(' POP EBX'); if (t2 in [karakter, realni]) and (t1 in [pkarakter, pcijeli, prealni]) then Greska(DODJPOINT); if (t1 = realni) and (t2 <> realni) then CijeliNaFPStek('EAX', t2 = karakter); if (t1 <> realni) and (t2 = realni) then FPStekUCijeli('EAX'); case t1 of karakter: Emit(' MOV [EBX],AL'); realni: Emit(' FSTP QWORD PTR[EBX]'); slog: Emit(' REP MOVSB'); else Emit(' MOV [EBX],EAX'); end; t := t1; end; {:} '=', '>', '<', '#': begin if t1 <> realni then Emit(' PUSH EAX') else FPUStekNaStek; z := znak; Novi; Izraz(t2, dod); if (t1 = slog) or (t2 = slog) then Greska(SLOGNEPOR); if t1 <> realni then Emit(' POP EBX'); if (t1 = realni) or (t2 = realni) then begin if t2 <> realni then CijeliNaFPStek('EAX', t2 = karakter);

if t1 <> realni then CijeliNaFPStek('EBX', t1 = karakter) else StekNaFPUStek; Emit(' FCOMPP '); Emit(' FSTSW AX'); Emit(' SAHF'); case z of '=': Emit(' SETE AL'); '>': Emit(' SETA AL'); '<': Emit(' SETB AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end else begin if (t1 = karakter) and (t2 = karakter) then Emit(' CMP BL,AL') else begin if t1 = karakter then Emit(' AND EAX,0FFh'); if t2 = karakter then Emit(' AND EBX,0FFh'); Emit(' CMP EBX,EAX'); end; case z of '=': Emit(' SETE AL'); '>': Emit(' SETG AL'); '<': Emit(' SETL AL'); '#': Emit(' SETNE AL'); end; Emit(' AND EAX,0FFh'); t := cijeli; end; end end;end;

procedure Uslov;var sonda, sinace, skrajuslova: string;begin Novi; IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TIPUSL); Emit(' CMP EAX,0'); NovaLabela(sonda); NovaLabela(sinace); NovaLabela(skrajuslova); Emit(' JNE L' + sonda); Emit(' JMP L' + sinace); IdiDo('{'); Emit('L' + sonda + ':'); Blok; Emit(' JMP L' + skrajuslova); Emit('L' + sinace + ':'); if Slijedi('inace', false) then begin Novi; IdiDo('{'); Blok; end; Emit('L' + skrajuslova + ':');end;

procedure Asembler;begin repeat ReadLn(ulaz, linija); if linija <> '\' then Emit(linija); if eof(ulaz) then linija := '\'; until linija[1] = '\'; pozicija := 1; znak := linija[pozicija]; IdiDo('\');end;

procedure Petlja;var sdok, skrajpetlje, suslov: string;begin Novi; NovaLabela(suslov); Emit('L' + suslov + ':'); IzrazDodjeljivanja(t, dod); if t <> cijeli then Greska(TUSLPET); Emit(' CMP EAX,0'); NovaLabela(sdok);

Page 96: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

96 NovaLabela(skrajpetlje); Emit(' JNE L' + sdok); Emit(' JMP L' + skrajpetlje); IdiDo('{'); Emit('L' + sdok + ':'); Blok; Emit(' JMP L' + suslov); Emit('L' + skrajpetlje + ':');end;

procedure Blok;begin while znak <> '}' do begin if Slijedi('dok', false) then Petlja else if Slijedi('ako', false) then Uslov else if Slijedi('asembler', false) then Asembler else begin IzrazDodjeljivanja(t, dod); IdiDo(';'); end; end; IdiDo('}');end;

procedure DefFunkcija(ftip: TTip);var parametara, paradresa, lokadresa, pfunkc, i, p3: integer; ImeFunkcije, imeparametra, imevarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin if not (((znak >= 'a') and (znak <= 'z')) or ((znak >= 'A') and (znak <= 'Z'))) then Greska(IMEFUN); DeklIdent(ImeFunkcije, 0); NoviIdent(ImeFunkcije, 4, 0, 0, funkcija, ftip, 0, 0, 0); pfunkc := ukupnoident; aktnivo := pfunkc; IdiDo('('); parametara := 0; lokadresa := 0; paradresa := 0; while znak <> ')' do begin if SlijediDekTipa(tip) then begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; DeklIdent(ImeParametra, pfunkc); parametara := parametara + 1; paradresa := paradresa + ((DuzinaTipa(tip) - 1) div 4 + 1) * 4; NoviIdent(ImeParametra, DuzinaTipa(tip), paradresa, pfunkc, parametar, tip, pfunkc, parametara, p3); end; if znak <> ')' then IdiDo(','); end; IdiDo(')'); for i := ukupnoident downto 0 do if (TabIdent[i].nivo = pfunkc) and (TabIdent[i].vrsta = parametar) then TabIdent[i].adresa := paradresa + 8 - TabIdent[i].adresa; TabIdent[pfunkc].pod1 := parametara; case znak of '{': begin IdiDo('{'); while SlijediDekTipa(tip) do begin if (tip = slog) or (tip = pslog) then p3 := DeklaracijaSloga(pfunkc) else p3 := 0; repeat DeklIdent(ImeVarijable, pfunkc); lokadresa := lokadresa +

DuzinaTipa(tip); NoviIdent(ImeVarijable, DuzinaTipa(tip), -lokadresa, pfunkc, lokalna, tip, pfunkc, parametara, p3); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (lokadresa mod 4) <> 0 do lokadresa := lokadresa + 1; IdiDo(';'); end; Str(paradresa, st); Emit(ImeFunkcije + '@' + st + ':'); Emit(' PUSH EBP'); Emit(' MOV EBP,ESP'); Str(lokadresa, st); Emit(' SUB ESP,' + st); Blok; Emit(' MOV ESP,EBP'); Emit(' POP EBP'); Str(paradresa, st); Emit(' RET ' + st); Emit('PUBLIC ' + ImeFunkcije + '@' + st); end; ';': begin Str(paradresa, st); Emit('extrn ' + ImeFunkcije + '@' + st + ':near'); IdiDo(';'); end else Greska(DEFFUN); end; aktnivo := 0;end;

procedure Prevedi;var globadresa, p3: Integer; ImeVarijable, st: string; tip: TTip; imaistogtipa: Boolean;begin Emit('.486'); Emit('.MODEL FLAT,STDCALL'); Emit('OPTION CASEMAP:NONE'); Emit('EXTRN ExitProcess@4:NEAR'); Emit('.CODE'); Emit('ULAZ:'); Emit(' FINIT'); Emit(' JMP GLAVNI'); pozicija := 0; globadresa := 0; Novi; while SlijediDekTipa(tip) do begin if Slijedi('funkcija', false) then begin Novi; DefFunkcija(tip); end else begin if (tip=slog) or (tip=pslog) then p3 := DeklaracijaSloga(0) else p3 := 0; repeat DeklIdent(ImeVarijable, 0); NoviIdent(ImeVarijable, DuzinaTipa(tip), globadresa, 0, globalna, tip, 0, 0, p3); globadresa := globadresa + DuzinaTipa(tip); imaistogtipa := true; if znak = ',' then begin Novi; imaistogtipa := false; end; until imaistogtipa; while (globadresa mod 4) <> 0 do globadresa := globadresa + 1; IdiDo(';'); end end; IdiDo('{'); if znak <> '}' then begin Emit('GLAVNI:');

Blok; Emit(' PUSH 0'); Emit(' CALL ExitProcess@4'); Emit('.DATA'); Str(globadresa, st); Emit('GLOBALV DB '+st+' DUP(0)'); Emit('INTTOFP DD 0'); Emit('END ULAZ') end else begin Emit('GLAVNI:'); Emit('END'); end;end;

procedure Glavni;var linija: string;begin initpp; trenlabela := 0; ukupnoident := 0; aktnivo := 0; ukupnoslogova := 0; Assign(ulaz, paramstr(1)); Assign(izlaz, paramstr(2)); brojaclinija := 0; linija := ''; Reset(ulaz); Rewrite(izlaz); Prevedi; Close(ulaz); Close(izlaz); WriteLn('Prevedeno bez greske');end;

begin Glavniend.

Page 97: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

97

Prilog 9: Verzija izvornog koda kompajlera br. 8, predprocesorunit predpr8;interfaceprocedure Novi;procedure InitPp;var ulaz, privulaz: text; pozicija, brojaclinija: integer; znak: char; linija: string;implementationuses postpr8;const MAXCHAR = 200000; MAXDEFINICIJE = 50;type Tdefinicije = record ime: string[20]; pocetak: integer; kraj: integer; end;var bafer: array[1..MAXCHAR] of char; definicije: array[1..MAXDEFINICIJE] of TDefinicije; bafertop: integer; deftop: integer; glavnadat: Boolean; ObradaLinije: Boolean;

procedure InitPp;begin bafertop := 0; deftop := 0; glavnadat := true; ObradaLinije := true;end;

procedure PpDefin;var duz, i, n: integer; radi: Boolean; imes: string;

begin duz := Length(linija); if deftop < MAXDEFINICIJE then deftop := deftop + 1; n := 12; imes := ''; radi := true; while (n <= duz) and radi do begin if linija[n] in ['a'..'z', 'A'..'Z'] then imes := imes + linija[n] else radi := false; n := n + 1; end; if imes <> '' then begin definicije[deftop].ime := imes; definicije[deftop].pocetak := bafertop; radi := true; while radi do begin radi := false; if Length(linija) > 0 then if linija[Length(linija)] = '\' then begin radi := true; linija := copy(linija, 1, Length(linija) - 1); end; for i := n to Length(linija) do begin if bafertop < MAXCHAR then bafertop := bafertop + 1; bafer[bafertop] := linija[i]; n := 1; end; if radi then begin

if glavnadat then ReadLn(ulaz, linija) else ReadLn(privulaz, linija); end; end; definicije[deftop].kraj := bafertop; end; linija := '';end;

procedure PpPostoji;var imes: string; postoji: Boolean; i: integer;begin imes := copy(linija, 10, Length(linija) - 9); postoji := false; for i := 1 to deftop do if definicije[i].ime = imes then postoji := true; if not (postoji) then Obradalinije := false else ObradaLinije := true; linija := '';end;

procedure PpNePostoji;var imes: string; postoji: Boolean; i: integer;begin imes := copy(linija, 12, Length(linija) - 11); postoji := false; for i := 1 to deftop do if definicije[i].ime = imes then postoji := true; if postoji then Obradalinije := false else ObradaLinije := true; linija := '';end;

procedure Predprocesiraj;var i, n, j, duz: integer; imes, glava, rep: string; mijenjano: Boolean;begin if linija = '#dalje' then begin obradalinije := true; linija := ''; end; if not (obradalinije) then linija := ''; duz := Length(linija); if duz > 11 then if copy(linija, 1, 11) = '#definiraj ' then PpDefin; if duz > 9 then if copy(linija, 1, 9) = '#postoji ' then PpPostoji; if duz > 11 then if copy(linija, 1, 11) = '#nepostoji ' then PpNePostoji;

if duz > 7 then if (copy(linija, 1, 7) = '#dodaj ') and glavnadat then begin imes := copy(linija, 8,

Length(linija) - 7); Assign(privulaz, imes); Reset(privulaz); glavnadat := false; linija := ''; end; repeat mijenjano:=false; for i := 1 to deftop do repeat n := Pos(definicije[i].ime, linija); if (n + Length(definicije[i].ime)) <= Length(linija) then if linija[n +Length( definicije[i].ime)] in ['a'..'z', 'A'..'Z'] then n := 0; if n > 1 then if linija[n - 1] in ['a'..'z', 'A'..'Z'] then n := 0; if n > 0 then begin glava := copy(linija,1,n-1); rep := copy(linija, n + Length(definicije[i].ime), Length(linija)); linija := glava; for j := definicije[i].pocetak + 1 to definicije[i].kraj do linija := linija + bafer[j]; linija := linija + rep; mijenjano:=true; end; until n <= 0; until not(mijenjano)end;

procedure Novi;begin repeat pozicija := pozicija + 1; if pozicija > Length(linija) then begin brojaclinija := brojaclinija + 1; if glavnadat and not (Eof(ulaz)) then begin ReadLn(ulaz, linija); Predprocesiraj; end else begin if not (glavnadat) and not (Eof(privulaz)) then begin ReadLn(privulaz, linija); Predprocesiraj; end else begin if not (glavnadat) then begin glavnadat := true; Close(privulaz); end; end; end; Emit(';' + copy(linija, 1, 250)); pozicija := 1; end; if Length(linija) > 0 then znak := linija[pozicija] else znak := ' '; if (znak = '`') then pozicija := Length(linija); until ((znak > ' ') and (znak <> '`')) or Eof(ulaz);end;

end.

Page 98: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

98Prilog 10: Verzija izvornog koda kompajlera br. 8, postprocesor-optimizatorunit postpr8;interfaceprocedure Emit(st: string);var izlaz: text;

implementationconst dubina = 15; da = true; ne = false;

var bafer: array[1..dubina] of string; vrhbafera: integer; briseeax, koristieax, briseebx, koristiebx, koristifpu: Boolean; dubinasteka: integer;

function StrToInt(st: string): integer;var i, s, rez: integer;begin rez := 0; if st[1] = '-' then s := 2 else s := 1; for i := s to Length(st) do rez := 10 * rez + (ord(st[i]) - ord('0')); if st[1] = '-' then rez := -rez; StrToInt := rez;end;

procedure KarakterSl(var char1: string; var radi: Boolean; tekst: string; var pt: integer);var radi2: Boolean;begin char1 := ''; radi2 := true; if pt > Length(tekst) then radi := false else while radi2 do begin char1 := char1 + tekst[pt]; pt := pt + 1; if pt > Length(tekst) then radi2 := false else begin if tekst[pt] = ',' then radi2 := false end; end;end;

procedure BrojSl(var char1: string; var radi: Boolean; tekst: string; var pt: Integer);var radi2: Boolean;begin char1 := ''; radi2 := true; if pt > Length(tekst) then radi := false else begin if (tekst[pt] < '0') or (tekst[pt] > '9') then radi := false; while radi2 do begin char1 := char1 + tekst[pt]; pt := pt + 1; if pt > Length(tekst) then radi2 := false else begin if (tekst[pt] < '0') or (tekst[pt] > '9') then radi2 := false end; end; endend;

function Uzorak(uporedba, tekst: string; var char1, char2: string): Boolean;var pu, pt: integer;

radi: Boolean;begin pt := 1; pu := 1; char1 := ''; char2 := ''; radi := true; if Length(tekst) = 0 then radi := false; if uporedba = tekst then Uzorak := true else begin while (pu <= Length(uporedba)) and radi do begin if uporedba[pu] = '$' then begin pu := pu + 1; case uporedba[pu] of 'C': begin pu := pu + 1; case uporedba[pu] of '1': begin KarakterSl(char1, radi, tekst, pt); end; '2': begin KarakterSl(char2, radi, tekst, pt); end; end; end; 'N': begin pu := pu + 1; case uporedba[pu] of '1': begin BrojSl(char1, radi, tekst, pt); end; '2': begin BrojSl(char2, radi, tekst, pt); end; end; end; end end else begin if uporedba[pu] <> tekst[pt] then radi := false; pt := pt + 1; end; pu := pu + 1; end; Uzorak := radi; end;end;

procedure Status(breax, koreax, brebx, korebx: Boolean; dubst: integer; korfpu: Boolean);begin briseeax := breax; koristieax := koreax; briseebx := brebx; koristiebx := korebx; koristifpu := korfpu; dubinasteka := dubinasteka + dubst;end;

procedure LeaMovSt(var c1, c2: string; var koreax, korebx, breax, brebx: Boolean);begin if (c1 = 'EAX') or (c1 = 'AL') then breax := true; if (c1 = 'EBX') or (c1 = 'BL') then brebx := true; if ((Pos('EAX', c1) > 0) and (c1 <> 'EAX')) or (Pos('EAX', c2) > 0) or (c2 = 'AL') then koreax := true; if ((Pos('EBX', c1) > 0) and (c1 <> 'EBX')) or (Pos('EBX', c2) > 0) or (Pos('BL', c2) > 0) then korebx := true;end;

procedure PopSt(var c1, c2: string; var incsp: integer; var breax, brebx: Boolean);

begin if (c1 = 'EAX') then breax := true; if (c1 = 'EBX') then brebx := true; incsp := 4;end;

procedure PushSt(var c1, c2: string; var incsp: integer; var koreax, korebx: Boolean);begin if Pos('EAX', c1) > 0 then koreax := true; if Pos('EBX', c1) > 0 then korebx := true; incsp := -4;end;

procedure AddSubst(var c1, c2: string; var incsp: integer; var koreax, korebx: Boolean; sub: Boolean);begin if c1 = 'ESP' then incsp := StrToInt(c2); if sub then incsp := -incsp; if (Pos('EAX', c1) > 0) or (Pos('EAX', c2) > 0) or (c1 = 'AL') or (c2 = 'AL') then koreax := true; if (Pos('EBX', c1) > 0) or (Pos('EBX', c2) > 0) or (c1 = 'BL') or (c2 = 'BL') then korebx := true;end;

procedure LogicalSt(var c1, c2: string; var koreax, korebx: Boolean);begin if (Pos('EAX', c1) > 0) or (Pos('EAX', c2) > 0) or (c1 = 'AL') or (c2 = 'AL') then koreax := true; if (Pos('EBX', c1) > 0) or (Pos('EBX', c2) > 0) or (c1 = 'BL') or (c2 = 'BL') then korebx := true;end;

procedure SkokSt(var breax, brebx, korfp: Boolean);begin breax := true; brebx := true; korfp := true;end;

procedure DivMulSt(var koreax, korebx: Boolean; var c1: string);begin koreax := true; if (Pos('EBX', c1) > 0) then korebx := true;end;

procedure ObradiStanje(tr: string);var c1, c2: string; breax, koreax, brebx, korebx, korfp: Boolean; incsp: integer; prvoslovo, drugoslovo: char;begin breax := false; koreax := false; brebx := false; korebx := false; incsp := 0; korfp := true; if Length(tr) > 3 then begin prvoslovo := tr[2]; drugoslovo := tr[3]; end else begin prvoslovo := ' '; drugoslovo := ' '; end;

if prvoslovo < 'K' then

Page 99: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

99 case prvoslovo of 'A': begin if Uzorak(' ADD $C1,$C2', tr, c1, c2) then AddSubst(c1, c2, incsp, koreax, korebx, false) else if Uzorak(' AND $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'C': begin if Uzorak(' CALL $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) else if Uzorak(' CDQ', tr, c1, c2) then koreax := true else if Uzorak(' CLD', tr, c1, c2) then c1 := c1 else if Uzorak(' CMP $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'F': begin case drugoslovo of 'A': begin if Uzorak(' FADD ', tr, c1, c2) then korfp := true end; 'C': begin if Uzorak(' FCHS', tr, c1, c2) then korfp := true else if Uzorak(' FCOMPP ', tr, c1, c2) then korfp := true end; 'D': begin if Uzorak(' FDIVR ', tr, c1, c2) then korfp := true end; 'I': begin if Uzorak(' FILD $C1', tr, c1, c2) then korfp := true else if Uzorak(' FINIT', tr, c1, c2) then korfp := true else if Uzorak(' FISTP $C1', tr, c1, c2) then korfp := true end; 'L': begin if Uzorak(' FLD $C1', tr, c1, c2) then korfp := true end; 'M': begin if Uzorak(' FMUL ', tr, c1, c2) then korfp := true end; 'S': begin if Uzorak(' FSTP $C1', tr, c1, c2) then korfp := true else if Uzorak(' FSTSW AX', tr, c1, c2) then korfp := true else if Uzorak(' FSUBR ', tr, c1, c2) then korfp := true end end end; 'I': begin if Uzorak(' IDIV $C1', tr, c1, c2) then DivMulSt(koreax, korebx, c1) else if Uzorak(' IMUL $C1', tr, c1, c2) then

DivMulSt(koreax, korebx, c1) end; 'J': begin if Uzorak(' JMP $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) else if Uzorak(' JNE $C1', tr, c1, c2) then SkokSt(breax, brebx, korfp) end; end; if prvoslovo >= 'K' then case prvoslovo of

'L': begin if Uzorak(' LEA $C1,$C2', tr, c1, c2) then LeaMovSt(c1, c2, koreax, korebx, breax, brebx) end; 'M': begin if Uzorak(' MOV $C1,$C2', tr, c1, c2) then LeaMovSt(c1, c2, koreax, korebx, breax, brebx) else if Uzorak(' MUL $C1', tr, c1, c2) then DivMulSt(koreax, korebx, c1) end; 'N': begin if Uzorak(' NEG $C1', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) else if Uzorak(' NOT $C1', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'O': begin if Uzorak(' OR $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; 'P': begin if Uzorak(' POP $C1', tr, c1, c2) then PopSt(c1, c2, incsp, breax, brebx) else if Uzorak(' PUSH $C1', tr, c1, c2) then PushSt(c1, c2, incsp, koreax, korebx) end; 'R': begin if Uzorak(' REP MOVSB', tr, c1, c2) then c1 := c1 else if Uzorak(' RET $N1', tr, c1, c2) then incsp := StrToInt(c1) + 4 end; 'S': begin case drugoslovo of 'A': begin if Uzorak(' SAHF', tr, c1, c2) then koreax := true else if Uzorak(' SAL EAX,$N1', tr, c1, c2) then koreax := true end; 'E': begin if Uzorak(' SETA AL', tr, c1, c2) then breax := true else if Uzorak(' SETB AL', tr, c1, c2) then breax := true else if Uzorak(' SETE AL', tr, c1, c2) then breax := true else if Uzorak(' SETG AL', tr, c1, c2) then breax := true else if Uzorak(' SETL AL', tr, c1, c2) then breax := true

else if Uzorak(' SETNE AL',tr, c1, c2) then breax := true end; 'U': begin if Uzorak(' SUB $C1,$C2', tr, c1, c2) then AddSubst(c1, c2, incsp, koreax, korebx, true) end end end; 'X': begin if Uzorak(' XOR $C1,$C2', tr, c1, c2) then LogicalSt(c1, c2, koreax, korebx) end; end; Status(breax, koreax, brebx, korebx, incsp, korfp);end;

procedure Dump(what: string; j, i: integer);var k: integer;begin WriteLn(what); for k := j to i do WriteLn(k, bafer[k]); ReadLn;end;

procedure Obrisi(n: integer);var i: integer;begin for i := n + 1 to dubina do bafer[i - 1] := bafer[i]; vrhbafera := vrhbafera - 1;end;

procedure PushEaxOptim(pusheax: Boolean; var j: integer);var i: integer; izlaz, mebx, meax: Boolean;

begin dubinasteka := 0; Status(ne, ne, ne, ne, 0, ne); izlaz := false; meax := false; mebx := false; i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if (dubinasteka = 0) and not (izlaz) then begin if (bafer[i] = ' POP EAX') and not (meax) then begin

Page 100: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

100

//dump('Nepotrebno PUSH/POP EAX',j,i); Obrisi(i); if pusheax then Obrisi(j) else bafer[j] := ' MOV EAX,EBX'; izlaz := true; end; if (bafer[i] = ' POP EBX') and not (mebx) then begin//dump('Nepotrebno PUSH /POP EBX',j,i); Obrisi(i); if pusheax then bafer[j] := ' MOV EBX,EAX' else Obrisi(j); izlaz := true; end; end; if not (izlaz) then ObradiStanje(bafer[i]); if briseeax and not (meax) then meax := true; if briseebx and not (mebx) then mebx := true; until izlaz;end;

procedure LeaEbxOptim(var j: integer; adresa: string);

Page 101: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

101var i, k, n: integer; c1, c2, p: string; izlaz: Boolean;

begin dubinasteka := 0; Status(ne, ne, ne, ne, 0, ne); izlaz := false; i := j; if i + 1 < vrhbafera then if Uzorak(' PUSH EBX', bafer[i + 1], c1, c2) then begin ObradiStanje(bafer[i + 1]); i := i + 2; repeat if i >= vrhbafera then izlaz := true; if not (izlaz) then ObradiStanje(bafer[i]); if (dubinasteka = 0) and not (izlaz) then if Uzorak(' POP EBX', bafer[i], c1, c2) then begin//dump('Nepotrebno LEA/PUSH/POP',j,i); bafer[i] := ' LEA EBX,' + adresa; Obrisi(j + 1); Obrisi(j); izlaz := true; end; i := i + 1; until izlaz; end else begin i := i + 1; repeat if i >= vrhbafera then izlaz := true; if not (izlaz) then ObradiStanje(bafer[i]); if (koristiebx) and not (izlaz) then begin if Pos('[EBX]', bafer[i]) < 1 then izlaz := true; end; if (briseebx) and not (izlaz) then begin// dump('Nasao nepotrebno LEA',j,i); for k := j + 1 to i - 1 do begin n := Pos('[EBX]', bafer[k]); if n >= 1 then begin if Pos('EAX', bafer[k]) > 0 then p := 'DWORD PTR ' else p := ''; bafer[k] := copy(bafer[k], 1, n - 1) + p + adresa + copy(bafer[k], n + 5, Length(bafer[k]) - n - 4); end; end; Obrisi(j); izlaz := true; end; i := i + 1; until izlaz; end;

end;

procedure MovViskaOptim(var j: integer; c1: string);var i: integer; izlaz, zaeax, zaebx: Boolean;

begin Status(ne, ne, ne, ne, 0, ne); izlaz := false; zaeax := false; zaebx := false; if (c1 = 'EAX') or (c1 = 'AL') then zaeax := true else if c1 = 'EBX' then zaebx := true else izlaz := true;

i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if not (izlaz) then begin ObradiStanje(bafer[i]); if zaeax then begin if koristieax then izlaz := true; if briseeax then begin//dump(' Nepotrebno MOV EAX ',j,i); Obrisi(j); izlaz := true; end; end; if zaebx then begin if koristiebx then izlaz := true; if briseebx then begin//dump(' Nepotrebno MOV EBX ',j,i); Obrisi(j); izlaz := true; end; end;

end until izlaz;end;

procedure FldOptim(var j: integer);var i: integer; izlaz: Boolean;begin Status(ne, ne, ne, ne, 0, ne); izlaz := false; i := j; repeat i := i + 1; if i >= vrhbafera then izlaz := true; if not (izlaz) then begin ObradiStanje(bafer[i]); if koristifpu then izlaz := true; if bafer[i] = ' FSTP ST(0)' then begin//dump(' Nepotrebno FLD/FSTP ',j,i); Obrisi(i); Obrisi(j); izlaz := true; end; if (i < vrhbafera - 1) and not (izlaz) then if (bafer[i] = ' ADD ESP,-8') and (bafer[i + 1] = ' FSTP QWORD PTR [ESP]') then begin i := i + 2; dubinasteka := 0; while (i < vrhbafera - 1) and not (izlaz) do begin ObradiStanje(bafer[i]); if (bafer[i] = ' FLD QWORD PTR [ESP]') and (bafer[i + 1] = ' ADD ESP,8') and (dubinasteka = 0) then begin// dump('Nepotr. FP na ESP stek',j,i+1); bafer[i + 1] := bafer[j]; Obrisi(i); Obrisi(j + 2); Obrisi(j + 1); Obrisi(j); izlaz := true; end; i := i + 1; end;

end; end until izlaz;end;

procedure Jednostruke(var j: integer);begin if (bafer[j] = ' MOV EAX,EAX') or (bafer[j] = ' MOV EBX,EBX') or (bafer[j] = ' ADD EAX,0') or

(bafer[j] = ' ADD EBX,0') then begin// dump('Nepotrebna instrukcija',j,j); Obrisi(j); endend;

procedure Parovi(var j: integer);var c1, c2, c3, c4, nep, st: string;begin nep := 'Nepotreban par'; if bafer[j][1] = 'M' then begin if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) and Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4) then begin if ((c1 = c4) and (c2 = c3)) or ((c1 = c3) and (c2 = c4)) then begin// dump(nep,j,j+1); Obrisi(j + 1); end; end else if Uzorak(' MOV $C1,$N2', bafer[j], c1, c2) and Uzorak(' ADD $C1,$N2', bafer[j + 1], c3, c4) then begin if c1 = c3 then begin// dump(nep,j,j+1); Str(StrToInt(c2) + StrToInt(c4), st); bafer[j] := ' MOV ' + c1 + ',' + st; Obrisi(j + 1); end; end else if Uzorak(' MOV $C1,$N2', bafer[j], c1, c2) and (bafer[j + 1] = ' NEG AX') then begin// dump(nep,j,j+1); bafer[j] := ' MOV ' + c1 + '-' + c2; Obrisi(j + 1); end; end else if Uzorak(' ADD $C1,$N2', bafer[j], c1, c2) and Uzorak(' ADD $C1,$N2', bafer[j + 1], c3, c4) then begin if c1 = c3 then begin// dump(nep,j,j+1); Str(StrToInt(c2) + StrToInt(c4), st); bafer[j] := ' ADD ' + c1 + ',' + st; Obrisi(j + 1); end; end;

end;

procedure Trojke(var j: integer);var c1, c2, c3, c4, c5, c6, nep: string;begin nep := 'Nepotrebna trojka'; if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) and Uzorak(' MOV $C1,$C2', bafer[j + 2], c5, c6)// Izvrnuto zbog brzine and ( (Uzorak(' ADD $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' AND $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' SUB $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' XOR $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4)) or (Uzorak(' OR $C1,$C2', bafer[j + 1], c3, c4))) then begin if (c1 = c4) and (c1 = c5) then begin// dump(nep,j,j+2); if copy(bafer[j + 1], 2, 2) <> 'OR' then bafer[j + 1] := copy(bafer[j + 1], 1, 5) + c3 + ',' + c2 else bafer[j + 1] := copy(bafer[j +

Page 102: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

102 1], 1, 4) + c3 + ',' + c2; Obrisi(j); end; end;end;

procedure Cetvorke(var j: integer);var c1, c2, c3, c4, c5, c6, c7, c8, nep: string;beginnep := 'Nepotrebna cetvorka'; if Uzorak(' PUSH $C1', bafer[j], c1, c2) and Uzorak(' POP $C1', bafer[j + 3], c7, c8) // Izvrnuto zbog brzine and Uzorak(' MOV $C1,$C2', bafer[j + 1], c3, c4) and Uzorak(' MOV $C1,$C2', bafer[j + 2], c5, c6) and (c1 = c5) and (c3 = c6) and (c6 = c7) then begin// dump(nep,j,j+4); if (Pos('DWORD', c4) < 1) and (c4 <> 'EAX') and (c4 <> 'EBX') and (c4 <> 'ECX') then c4 := 'DWORD PTR ' + c4; bafer[j] := ' MOV ' + c3 + ',' + c1; bafer[j + 1] := ' MOV ' + c1 + ',' + c4; Obrisi(j + 3); Obrisi(j + 2); end;end;

procedure Optimizuj;var c1, c2: string; j: integer;begin j := 1; while j <= vrhbafera - 1 do begin if (Length(bafer[j]) > 3) and (bafer[j][1] = ' ') then begin if Uzorak(' PUSH EAX', bafer[j], c1, c2) then PushEaxOptim(true, j); if Uzorak(' PUSH EBX', bafer[j], c1, c2) then PushEaxOptim(false, j); if Uzorak(' MOV $C1,$C2', bafer[j], c1, c2) then MovViskaOptim(j, c1); if Uzorak(' LEA EBX,$C1', bafer[j], c1, c2) then LeaEbxOptim(j, c1); if Uzorak(' FLD $C1', bafer[j], c1, c2) then FldOptim(j); if j < vrhbafera - 3 then Cetvorke(j); if j < vrhbafera - 2 then Trojke(j); if j < vrhbafera - 1 then Parovi(j);

Jednostruke(j); end; j := j + 1; end;end;

procedure Emit(st: string);var i: integer;begin if st = '.486' then begin vrhbafera := 0; dubinasteka := 0; end; vrhbafera := vrhbafera + 1; if vrhbafera >= dubina then Optimizuj; if vrhbafera > dubina then begin WriteLn(izlaz, bafer[1]); Obrisi(1); vrhbafera := dubina; end; bafer[vrhbafera] := st; if Length(st) >= 3 then

if copy(st, 1, 3) = 'END' then begin Optimizuj; for i := 1 to vrhbafera do WriteLn(izlaz, bafer[i]); end

end;

end.

Page 103: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Prilog 11: Prikaz finalne verzije jezika FILDZAN-32 u EBNFProgram = { (DeklaracijaVarijabli | DeklaracijaFunkcije) } "{" ( {DeklaracijaVarijabli} Blok | "}" ) .DeklaracijaVarijabli = ImeTipa Identifikator { "," Identifikator } ";" { ImeTipa Identifikator { "," Identifikator } ";"} .ImeTipa = ( "cijeli" ["*"] [DeklaracioniDimenzijskiModifikator] | "realni" ["*"] [DeklaracioniDimenzijskiModifikator] | "karakter" ["*"] [DeklaracioniDimenzijskiModifikator] | "slog" ["*"] DeklaracijaSloga [DeklaracioniDimenzijskiModifikator] ) .DeklaracijaFunkcije = ImeTipa "funkcija" Identifikator "(" [ ImeTipa Identifikator { "," ImeTipa Identifikator } ] ")" ( ";" | "{" [DeklaracijaVarijabli] Blok ) .DeklaracioniDimenzijskiModifikator = "[" NumerickaKonstanta { "," NumerickaKonstanta } "]" .DeklaracijaSloga = "{" ImeTipa Identifikator { "," Identifikator } ";" { ImeTipa Identifikator { "," Identifikator } ";" } "}" .Blok = { ( "dok" Petlja | "ako" Uslov | IzrazDodjeljivanja ";" | "asembler" AsemblerskiModul) } "}" .Uslov = IzrazDodjeljivanja "{" Blok [ "inace" "{" Blok ] .Petlja = IzrazDodjeljivanja "{" Blok .AsemblerskiModul = {BiloKojiZnak} "\" .IzrazDodjeljivanja = Izraz [ ( ("="| "#" | ">" | "<" ) Izraz | ":=" IzrazDodjeljivanja ) ] .Izraz = Clan { ("-" | "+" | "&" | "|" | "^") Clan } .Clan = Faktor { ("*" | "/" | "%") Faktor } .Faktor = ( ("-" | "~" | "&" | "*" | "!") Faktor | NumerickaKonstanta | "(" IzrazDodjeljivanja ")" | Varijabla | '"' StringKonstanta | PozivFunkcije | "'" BiloKojiZnakOsimNavodnika "'" ) [( "." Identifikator | ListaIndeksa ) { ( "." Identifikator | ListaIndeksa ) } ) ].Varijabla = Identifikator [ ( "(" [ IzrazDodjeljivanja { "," IzrazDodjeljivanja } ] ")" .StringKonstanta = { BiloKojiZnakOsimNavodnika } '"' .ListaIndeksa = "[" IzrazDodjeljivanja { "," IzrazDodjeljivanja } "]" .PozivFunkcije = Identifikator "(" [ IzrazDodjeljivanja { "," IzrazDodjeljivanja } ] ")" .NumerickaKonstanta = Cifra { Cifra } [ "." Cifra { Cifra } ] [ "E" [ ( "+" | "-" )] Cifra { Cifra } ] .Identifikator = Slovo { Slovo | Cifra | "_" } .Slovo = ("A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" | "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ) .Cifra = ("0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ) .BiloKojiZnakOsimNavodnika = (Slovo | Cifra | "~" | "!" | "@" | "#" | "$" | "%" | "^" | "&" | "*" | "(" | ")" | "-" | "_" | "=" | "+" | "[" | "{" | "]" | "}" | "|" | "\" | ":" | ";" | "<" | "," | "." | ">" | "/" | "?" | "`" | ")" ) .BiloKojiZnak = (BiloKojiZnakOsimNavodnika | '"' | "'" ) .

Page 104: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

13.TEORIJA JEZIKA I PARSIRANJA

Kompajler razvijen u prethodnim poglavljima razvijen je spiralnom metodom, pri čemu je veća pažnja posvećivana generisanju koda nego sintaksnoj i semantičkoj analizi. U složenijim kompajlerima sintaksna analiza može biti veoma zahtjevna, i ova slika o razvoju kompajlera neće biti kompletna bez uvoda u teoriju formalnih gramatika i parsiranja.

13.1. Formalne gramatikeFormalna gramatika je način opisa formalnog jezika, tj. skupa nizova simbola sastavljenih iz određenog konačnog

alfabeta. Ime je dobila formalna gramatika zbog analogije sa konceptom gramatike u ljudskim jezicima.

Osnovna ideja iza ovih gramatika je da se generišu nizovi znakova koji počinju specijalnim startnim simbolom i primjene pravila koja određuju kako se određena kombinacija simbola može zamijeniti drugom kombinacijom simbola. Na primjer, ako se alfabet sastoji od znakova 'a' i 'b', a startni simbol je 'S', uz sljedeća pravila:

1. S -> aSb 2. S -> ba tada se može napisati "S" kao "aSb" zamjenom simbola 'S' sa "aSb" (pravilo 1), a zatim prepisati "aSb" kao "aaSbb"

primjenom istog pravila. To se ponavlja sve dok rezultat ne sadrži samo simbole iz alfabeta. U našem primjeru može se dalje prepisati S kao što slijedi: S -> aSb -> aaSbb -> aababb. Jezik ove gramatike se onda sastoji od svih stringova koji se mogu generisati na ovaj način: ba, abab, aababb, aaababbb, itd.

13.2. Kontekstno osjetljiva gramatikaKontekstno osjetljiva gramatika je formalna gramatika G = (N, T, P, S) čija su sva pravila P oblika

αAβ -> αγβ

gdje A neterminalni simbol, α i β su nizovi neterminalnih i terminalnih simbola, a γ neprazan niz neterminalnih i terminalnih simbola , uz dodatno pravilo koje je dopušteno ako se S ne nalazi sa desne strane nijednog pravila:

S -> ε

Gdje je ε prazan niz

Pojam “Kontekstno osjetljiva” potiče od činjenice da α i β definišu kontekst u kome se A može transformisati sa γ ili ne. To je različito od kontekstno slobodnih gramatika gdje se kontekst neterminalnih simbola ne uzima u razmatranje. Formalni jezik opisan kontekstno osjetljivom gramatikom se naziva kontekstno osjetljiv jezik.

U prirodnim jezicima je čest slučaj da riječ nije odgovarajuća na određenom mjestu u datom kontekstu.

13.3. Nesažimajuća gramatikaDruga definicija kontekstno osjetljive gramatike definiše je kao formalnu gramatiku koja ima ograničenje na pravila

α -> β u skupu P tako da je | α | ≤ | β | gdje je | α | dužina simbola α. Takva gramatika se zove nesažimajuća gramatika jer nijedno od pravila ne smanjuje veličinu niza simbola koji se razvija.

Iako različite, kontekstno osjetljiva i nesažimajuća gramatika su ekvivalentne jer definišu istu klasu jezika osim što nesažimajuća gramatika ne može generisati jezik koji sadrži simbol praznog prostora. Ali, ako se jezik L može opisati kontekstno osjetljivom gramatikom, on se (izuzev praznog simbola) može predstaviti i nesažimajućom gramatikom.

13.4. Kontekstno slobodna gramatikaKontekstno slobodna gramatika je formalna gramatika čija su sva pravila oblika:

V -> w

Gdje je V neterminalni simbol, a w niz koji se sastoji od terminalnih i/ili neterminalnih. Pojam kontekstno slobodna znači da se varijabla V uvijek može zamijeniti sa w, bez obzira u kojem je kontekstu. Formalni jezik je kontekstno slobodan ako postoji kontekstno slobodna gramatika koja ga generiše.

Kontekstno slobodnom gramatikom se definišu gotovo svi programski jezici i na bazi nje se prave parseri/sintaksni analizatori.

13.5. Regularna gramatikaRegularna gramatika je formalna gramatika u kojoj sva pravila imaju jedan od sljedećih oblika:

A -> a gdje je A neterminalni simbol dok je a terminalni simbol

Page 105: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

A -> aB gdje su A i B neterminalni simbol dok je a terminalni simbol

A -> ε gdje je A neterminalni simbol

Alternativno, drugo pravilo se može pisati kao A -> Ba.

Primjer: Gramatika G sa N = {S, A}, Σ = {a, b, c}, P pravila su

S -> aS

S -> bA

A -> ε

A -> cA

i S kao startni simbol. Ova gramatika opisuje isti jezik kao regularni izraz a*bc*.

Regularna gramatika opisuje konačne automate i regularne jezike. Koristi se u leksičkoj analizi.

13.6. Parsiranje Prevođenje iz jednog jezika u drugi zahtjeva parsiranje. Parsiranje je proces identifikacije strukture podataka. Ono

određuje da li ulazni podaci imaju određenu strukturu. Da bi se obavilo parsiranje potrebna je gramatika, koja će definisati skup pravila. Pravila su određeni uzorci podataka koja dalje mogu da imaju reference na druga pravila. Zavisno od skupa pravila mogu se definisati parseri odozgo prema dolje ili odozdo prema gore.

13.7. LL ParsiranjePrevodilac ne generiše rečenice u izvornom jeziku, nego ih prepoznaje. To znači da koraci koji vode do konstrukcije

rečenice moraju biti izvedeni iz gotove rečenice. Dok je za jezike kao što je Pascal taj zadatak relativno jednostavan, dosta je složen za jezike poput Fortrana ili C++a.

Razvijajući programski jezik FILDZAN32 bez posebnog navođenja korišten je način parsiranja odozgo nadolje, takozvani rekurzivni silazak. Gramatike jezika Pascal i Modula 2 se definišu tako da se može primijeniti ovaj način parsiranja.

Suština metoda je da se kreće od startnog simbola (npr. “program”) i pokušava dobiti rečenica primjenom sekvence pravila. To se čini gledajući sljedeći terminalni simbol na ulazu.

Kao ilustracija ove metode neka posluži sljedeća jednostavna gramatika: G = { N , T , S , P } N = { A , B } T = { x , y , z } S = A P = A : xB (1) B : z (2) B : yB (3)

Ako treba parsirati rečenicu xyyz, koja je sastavljena od terminalnih simbola ove gramatike, kreće se od ciljnog simbola i ulaznog niza

Rečenička forma S = A Ulazni niz xyyz

Nad rečeničkom formom 1 se primjeni jedino moguće pravilo (1) da se dobije

Rečenička forma xB Ulazni niz xyyz

Za sada je u redu, jer se slažu početni simboli rečeničke forme i ulaznog niza. Stoga treba iz neterminalnog simbola B izvesti yyz.

Rečenička forma B Ulazni niz yyz

Može se odabrati bilo pravilo (2) ili (3) u obradi neterminalnog simbola B, ali se iz ulaznog stringa vidi da je (3) pravi izbor. Primjenom tog pravila dobija se:

Rečenička forma yB Ulazni niz yyz

Što znači da se iz neterminalnog simbola B mora izvesti yz.

Rečenička forma B Ulazni niz yz

To nas ponovo vodi do pravila (3) i dobijamo

Page 106: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Rečenička forma yB Ulazni niz yz

što povlači da se iz neterminalnog simbola B mora izvesti terminalni simbol z direktno, što se postiže pravilom (2).

Primjer rečenica koje se ne mogu prepoznati ovom gramatikom su xxxx ili xyyyy.

Ova metoda se zove LL(k) parsiranje. Naziv potiče od toga što se ulazni string skenira s lijeva na desno (prvo L) primjenjujući pravila na prvi lijevi neterminalni simbol (drugo L) gledajući maksimalno k terminalnih simbola da se odredi koje pravilo primijeniti u datom stanju. U našem primjeru, k=1, te LL(1) je najčešći slučaj LL(k) parsiranja.

Lako je napisati LL(1) parser, ali pisanje gramatike u takvom obliku zna biti složen posao, pogotovo što se ne može svaka gramatika transformisati u ovaj oblik. Evo primjera kako se mogu vršiti potrebne transformacije da bi se dobila LL(1) kompatibilna gramatika:

Neka je u nekoj gramatici REPEAT petlja predstavljena u obliku: RepeatStatement = "REPEAT" StatementSequence "UNTIL" Condition | "REPEAT" StatementSequence "FOREVER" .

Oba oblika počinju rezervisanom riječju REPEAT, što zbunjuje parser. Ali, ako se definiše: RepeatStatement = "REPEAT" StatementSequence TailRepeatStatement . TailRepeatStatement = "UNTIL" Condition | "FOREVER" .

nema problema s parsiranjem. No, u sljedećem slučaju Statement = IfStatement | OtherStatement . IfStatement = "IF" Condition "THEN" Statement | "IF" Condition "THEN" Statement "ELSE" Statement .

čak nakon rastavljanja pravila i dalje postoji neodređenost. Statement = IfStatement | OtherStatement . (1, 2) IfStatement = "IF" Condition "THEN" Statement IfTail . (3) IfTail = "ELSE" Statement | e . (4, 5)

Ova neodređenost se obično rješava pravilom da ELSE se odnosi na zadnji THEN. U FILDZAN-32, ovaj problem je izbjegnut, uvođenjem obaveznih vitičastih zagrada u naredbi ako.

13.8. LR ParsiranjeDrugi popularni način parsiranja je LR(k) parsiranje. Ove oznake predstavljaju da se u ovoj metodi ulazni podaci

čitaju sa Lijeva na desno, razvijajući stalno krajnji desni (Right) simbol, gledajući unaprijed najviše k simbola. U praksi je k najčešće 1 ili 0.

Tehnika je bazirana na principu odozdo nagore. Kreće se od ulazne sekvence i praveći redukcije, teži se da se dođe do ciljnog simbola. Redukcija rečenice se ne postiže zamjenom desne strane pravila čija lijeva strana sadrži odgovarajući neterminalni simbol, nego zamjenom lijeve strane pravila koje se slaže sa desnom stranom.

Parsiranje odozdo nagore može koristiti stek za parsiranje koji sadrži dio mogućih rečeničnih formi terminalnih i neterminalnih simbola. Svaki put kada se čita terminalni simbol iz ulaznog stringa, on se smješta na stek za parsiranje, zatim se ispituju elementi na vrhu steka da se vidi da li se može obaviti redukcija. Neki terminalni simboli mogu dugo stojati na steku sve dok se ne oslobode. To je različito od parsera sa rekurzivnim spuštanjem koji oslobađa terminalne simbole čim ih je pročitao i koji smješta neterminalne komponente parcijalne rečenične forme samo implicitno kao niz nedovršenih poziva potprograma za obradu neterminalnih simbola.

Evo primjera za gramatiku koja nije LL(1) tipa definisanu kao Goal = Expression "." . (1) Expression = Expression "-" Term | Term . (2, 3) Term = "a" (4)

I treba parsirati ulazni niz "a - a - a ." .

Ovo su akcije koje će se obaviti

Step Action Using production Stack 1 read a a 2 reduce 4 Term 3 reduce 3 Expression 4 read - Expression - 5 read a Expression - a 6 reduce 4 Expression - Term 7 reduce 2 Expression 8 read - Expression - 9 read a Expression - a 10 reduce 4 Expression - Term 11 reduce 2 Expression 12 read . Expression . 13 reduce 1 Goal

Page 107: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Cilj je dostignut i rečenica je ispravna

Ipak, postavlja se pitanje u ovom primjeru zašto nije korišteno pravilo Goal=Expression kada je reduciran string "a" u Expression nakon koraka 3? Da bi se primijenila redukcija, naravno da je potrebno da lijeva strana pravila bude na steku za parsiranje, ali je samo po sebi nedovoljno. Kada postoji više mogućih desnih strana koje se slažu sa elementima na vrhu steka za parsiranje, pravi parser treba da primjeni odgovarajuću strategiju, gledajući unaprijed ulazni string da odluči koje će pravilo primijeniti.

Ovakvi parseri se upravljaju tablicama, gdje odgovarajuća strategija u odgovarajućem trenutku biva određena gledanjem u pravougaonu matricu, čija jedna dimenzija predstavlja stanje parsiranja (tj. poziciju koju je parser dosegao unutar gramatičkih pravila) , a druga predstavlja trenutni simbol (tj. terminalni ili neterminalni simbol gramatike). Elementi tabele prihvataju ulazni string kao korektan, odbacuju kao nekorektan, prelaze u druga stanja ili vrše redukciju primjenom odgovarajućeg pravila. Umjesto smještanja na stek samih simbola kako je bilo navedeno u prethodnom primjeru, algoritam za parsiranje smješta ili skida elemente koji predstavljaju stanje parsiranja - shift operacije koje smještaju novodosegnuto stanje na stek i reduce operacije koje skidaju onoliko elemenata sa steka koliko je simbola na desnoj strani pravila koje se primjenjuje. Algoritam se može opisati kao:

BEGIN GetSYM(InputSymbol); (* first Sym in sentence *) State := 1; Push(State); Parsing := TRUE; REPEAT Entry := Table[State, InputSymbol]; CASE Entry.Action OF shift: State := Entry.NextState; Push(State); IF IsTerminal(InputSymbol) THEN GetSYM(InputSymbol) (* accept *) END reduce: FOR I := 1 TO Length(Rule[Entry].RightSide) DO Pop END; State := Top(Stack); InputSymbol := Rule[Entry].LeftSide; reject: Report(Failure); Parsing := FALSE accept: Report(Success); Parsing := FALSE END UNTIL NOT Parsing END

Algoritam je jednostavan, ali je pravljenje tabele za parsiranje dosta teško. Ovdje neće biti navedeno kako se to radi, ali za gornji primjer tabela za parsiranje može izgledati ovako (bez elemenata za odbacivanje)

Symbol

Goal Expression Term "a" "-" "." State

1 Accept Shift 2 Shift 3 Shift 4 2 Shift 5 Reduce 1 3 Reduce 3 Reduce 3 4 Reduce 4 Reduce 4 5 Shift 6 Shift 4 6 Reduce 2 Reduce 2

Parsiranje stringa "a - a - a ." će teći na sljedeći način:.

State Symbol Stack Action

1 a 1 Shift to state 4, accept a 4 - 1 4 Reduce by (4) Term = a 1 Term 1 Shift to state 3 3 - 1 3 Reduce by (3) Expression = Term 1 Expression 1 Shift to state 2 2 - 1 2 Shift to state 5, accept - 5 a 1 2 5 Shift to state 4, accept a 4 - 1 2 5 4 Reduce by (4) Term = a 5 Term 1 2 5 Shift to state 6 6 - 1 2 5 6 Reduce by (2) Expression = Expression - Term 1 Expression 1 Shift to state 2 2 - 1 2 Shift to state 5, accept - 5 a 1 2 5 Shift to state 4, accept a 4 . 1 2 5 4 Reduce by (4) Term = a 5 Term 1 2 5 Shift to state 6 6 . 1 2 5 6 Reduce by (2) Expression = Expression - Term 1 Expression 1 Shift to state 2 2 . 1 2 Reduce by (1) Goal = Expression 1 Goal 1 Accept as completed

Page 108: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Tablice mogu biti dosta velike pa se u memoriji često smještaju pomoću metoda za rijetke matrice. Kao u slučaju LL(1) parsera potrebno je osigurati da se izbjegnu neodređenosti između pravila koje se nazivaju "Shift/reduce" konflikti. Pravljenje tablica i provjera konflikta se ostavlja generatorima parsera.

LR(k) parsiranje je mnogo moćnije od LL(k) parsiranja, i intuitivno konstruisane gramatike zahtijevaju daleko manje transformacija da se napravi gramatika iz koje se može generisati LR(k) parser. Na primjer, LR(k) parsiranje podržava lijevu rekurziju, dok LL(k) ne podržava. Također, tablice predstavljaju brži način parsiranja od velikog broja uslova. LR parseri imaju prednost u lakšem dodavanju oporavka od grešaka. Nedostaci LR parsera u odnosu na LL parsere su u veličini tablica koje LR parseri oni moraju imati, težem dodavanju semantike i generisanog koda i često čudnim porukama o greškama.

13.9. Generatori parseraPravljenje parsera je toliko standardiziran posao da postoje i programi koji ih generišu iz opisa gramatike jezika.

Mogu se podijeliti na generatore leksičkih analizatora, generatore LR parsera i generatore LL parsera.

Najpoznatiji generator leksičkih analizatora je LEX, i njegova besplatna varijanta FLEX. Leksički analizator generisan ovakvim programom je, na primjer, sposoban da ključnu riječ BEGIN prizna kao jedan simbol, dok riječ BEGI predstavlja četiri simbola. Slijedi dio ulazne datoteke koja se koristi za generisanje leksičkog analizatora (skanera) koji prepoznaje programski jezik Pascal, a koju prihvata YACC.

[a-zA-Z]([a-zA-Z0-9])* if (is_keyword(yytext, kw)) {return(kw);} else {return(IDENTIFIER);}":=" return(ASSIGNMENT);'({NQUOTE}|'')+' return(CHARACTER_STRING);":" return(COLON);"," return(COMMA);[0-9]+ return(DIGSEQ);"." return(DOT);".." return(DOTDOT);"=" return(EQUAL);">=" return(GE);">" return(GT);"[" return(LBRAC);"<=" return(LE);

LEX sarađuje sa generatorom LR parsera YACC (Yet Another Compiler Compiler) čija se besplatna varijanta zove Bison. Iz definicije gramatike kakva je data na kraju klasične knjige Kernighan-Ritchie, "Programski jezik C" može se generisati parser, obično napisan u jeziku C, zajedno sa tabelama. Na slici je dat dio ulazne datoteke koja se koristi za generisanje parsera koji prepoznaje programski jezik Pascal, a koju prihvata YACC.program : program_heading semicolon block DOT ;

program_heading : _PROGRAM identifier | _PROGRAM identifier LPAREN identifier_list RPAREN ;

identifier_list : identifier_list comma identifier | identifier ;

block : label_declaration_part constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part statement_part ;

module : constant_definition_part type_definition_part variable_declaration_part procedure_and_function_declaration_part ;

Parseri LEX i YACC su izrađeni i u verzijama koje generišu izvorni kod parsera u drugim programskim jezicima pored jezika C. Tako na primjer program TPLY - TP Lex and Yacc generiše izvorni kod za Turbo Pascal.

Eikhound je generator generalizovanih LR parsera koji može prevesti svaku kontekstno slobodnu gramatiku, uključujući i one koje generišu shift/reduce konflikte.

Jedan od generatora LL(1) parsera zove se COCO/R i napravljen je u različitim verzijama za razne jezike izvornog koda koji se generiše. Prednost ovog generatora je u vrlo preglednom ulaznom formatu (standardni BNF) i čitljivom izlaznom kodu. Ovaj generator iz iste ulazne datoteke pravi i leksičke analizatore. . Na slici je dat dio ulazne datoteke koja se koristi za generisanje leksičkog analizatora (skanera) koji prepoznaje programski jezik Pascal, a koju prihvata COCO/R.

Page 109: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

TOKENS identifier = letter { letter | digit } . integer = digit { digit } | digit { digit } CONTEXT ("..") . real = digit { digit } "." digit { digit } [ "E" ["+" | "-"] digit { digit } ] | digit { digit } "E" ["+" | "-"] digit { digit } . string = "'" { noQuote1 | "''" } "'" .

PRODUCTIONS

Pascal = "program" NewIdent [ ExternalFiles ] ";" Block "." . ExternalFiles = "(" NewIdentList ")" . Block = DeclarationPart StatementPart . DeclarationPart = LabelDeclarations ConstDefinitions TypeDefinitions VarDeclarations { ProcDeclarations } .

/* ---------------------------------------------------------------- */

LabelDeclarations = [ "label" Labels ";" ] . Labels = Label { "," Label } . Label = UnsignedInt .

/* -------------------------------------------------------------------- */

ConstDefinitions = [ "const" ConstDef { ConstDef } ] .

ConstDef = NewIdent "=" Constant ";" .

O načinu pripreme ulaznih datoteka za spomente generatore parsera potrebno je pročitati njihovu dokumentaciju. Generatori parsera se inače zovu i kompajler-kompajleri.

13.10. Rezime poglavljaDetaljnije znanje o pravljenju kompajlera može se steći upoznavanjem teorije formalne lingvistike i parsiranja.

Gramatika programskog jezika je definisana skupom neterminalnih simbola, skupom terminalnih simbola, jezičkim pravilima i početnim ili ciljnim simbolom. Gramatike se dijele na formalne, kontekstno neovisne, kontekstno osjetljive i regularne. Za kontekstno neovisne gramatike se prave parseri koji obavljaju sintaksnu analizu. LL parsiranje je metoda koja radi od vrha ka dnu razvijajući stalno ulazni string i zavisno od sljedećeg terminalnog simbola poziva odgovarajući potprogram. LR parsiranje koristi stek i tablice kako bi se prepoznao odgovarajući jezički pojam i ova metoda ide odozdo nagore. LR parseri pokrivaju širu klasu gramatika od LL parsera. Parseri se mogu praviti generatorima parsera kakvi su Yacc i COCO/R.

Page 110: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

14. OSNOVNI WIN32 API PROGRAM

Nakon što je napisan kompajler, slijedi pisanje sistemskih funkcija. Sretna je okolnost što operativni sistem Windows već ima ogroman broj sistemskih funkcija tako da je samo potrebno pozivati ih. Radi razumijevanja rada testnih aplikacija, kao i razumijevanja koncepta sistemskih poziva pod operativnim sistemom Windows, slijedi nekoliko lekcija koje govore o načinu korištenja Windows sistemskih funkcija.

14.1. Hello WorldNajprimitivniji FILDZAN32 Windows program izgleda kao na slici Sl. 14.1.1.

Cijeli funkcija MessageBoxA(cijeli a,karakter * b, karakter * c, cijeli d);{ MessageBoxA(0,"Zdravo", "Fildzanski pozdrav", 0); 0;}

Sl. 14.1.1. Primitivni Win32 program

14.2. Prosti Prozor

Programi koji prikazuju prozor na ekranu imaju standardizovani izgled kao na slici Sl. 14.2.1: cijeli funkcija RegisterClassExA(cijeli * wndclass);cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, cijeli c,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,cijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijeli c,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b, karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c);cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0;

ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} `WM_DESTROY ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_APPLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC_ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_APPLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registracija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140, 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiranje!",0); } inace {

ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } } }

Sl. 14.2.1. Osnovni prozorOvo je jedan od najkraćih primjera koji generiše osnovni prozor pod Windowsom. Slijedi objašnjenje rada u četiri

koraka.

Page 111: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

14.3. Korak 1: Registracija prozorske klaseProzorska klasa čuva informacije o tipu prozora uključujući njegovu prozorsku proceduru koja ga kontroliše, male i

velike ikone prozora i pozadinske boje, Na ovaj način moguće je registrovati klasu jednom i kreirati prozora koliko se želi bez specificiranja svih tih atributa svaki put, mada se oni mogu po želji mijenjati za pojedinačne prozore. Prozorske klase nemaju veze sa C++ klasama. ` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_APPLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC_ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_APPLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registracija!",0); } inace {

Ovaj se kod koristi u glavnom programu za registraciju prozorske klase. Sada će se popuniti struktura WNDCLASSEX i poziva funkcija RegisterClassEx()

Članovi strukture utiču na klasu prozora kako slijedi:

cbSize : Veličina strukture.

style : Stil klase, CS_xxxxx, on se obično postavlja na 0..

lpfnWndProc :Pokazivač na proceduru koja obraðuje poruke za ovu klasu prozora.

cbClsExtra : Količina dodatnih podataka alociranih za ovu klasu u memoriji. Obično 0.

cbWndExtra: Količina dodatnih podataka u memoriji alociranih po prozoru. Obično 0...

hInstance : Handle koji pokazuje na instancu aplikacije (dobiven funkcijom GetModuleHandle)

hIcon : Velika (32x32) ikona koja se prikazuje prilikom AltTab.

hCursor : Kurzor koji se prikazuje preko prozora ove klase.

hbrBackground: Oznaka četke za pozadinu za postavljanje boje ovog prozora

lpszMenuName: Ime menija u resursnom dijelu datoteke za prozore ove klase

lpszClassName: Ime kojim se klasa identificira

hIconSm : Mala (16x16) ikona koja se pojavljuje u taskbaru i u gornjem lijevom uglu prozora.

U praksi se ova struktura ne pamti, nego se najčešæe kopira, niti ima potrebe pamtiti je. Neophodno je imati help datoteke kada se želi modifikovati neki od parametara..

Nakon što je ova struktura popunjena, poziva se RegisterClassEx i provjeravaju greške. U slučaju greške prikaže se poruka i prekida program izlaskom iz glavnog programa.

14.4. Korak 2: Kreiranje prozoraNakon što je klasa registrovana, slijedi kreiranje prozora pomoću nje. To se radi pomoću funkcije CreateWindowEx,

čiji će parametri sada biti objašnjeni.. ` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140, 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiranje!",0); } inace {

Zadnji parametar, 512 je prošireni windows stil koji daje drugačiji izgled ivice. Može se eksperimentirati i sa drugim vrijednostima..

Page 112: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Ime klase "FILDZANKLASA" kaže sistemu kakvu vrstu prozora da kreira. U datom primjeru, treba kreirati prozor od klase koja je upravo registrovana, pa će se njeno ime i koristiti. Nakon toga se navodi ime prozora ili naslov koji se prikazuje u naslovnom dijelu prozora..

Parametar koji u datom primjeru ima vrijednost 13565952 (WS_OVERLAPPEDWINDOW) je parametar stila prozora. Ima više različitih stilova i korisno je eksperimentisati sa njima da se vidi šta koji radi..

Sljedeća četiri parametra (120,140,100,200) su visina prozora, širina prozora, y koordinata i x koordinata x i y koordinate gornjeg lijevog ugla i širina i visina prozora. Jedinice su u pikselima, ishodište koordinatnog sistema je gornji lijevi ugao, tako da y osa raste prema dolje, a x osa prema desno.

Sljedeća četiri parametra (0,hinstance,0,0) su pokazivač na dodatne podatke o kreiranju prozora, te hendlovi na instancu aplikacije, meni i roditeljski prozor. Ekranska unosna polja ili dugmad predstavljaju podprozore i za njih je potrebno postaviti vrijednost Parent. U ovom primjeru, ovo je glavni prozor i on nema roditeljskog prozora..

Čest uzrok grešaka u programima je što se ne provjerava rezultat funkcija. CreateWindow() često pada i kod iskusnih programera, stoga je potrebno uvijek provjeravati njen rezultat! ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiranje!",0); }

Nakon što je prozor kreiran i provjerena ispravnost njegovog hendla, sada je potrebno prikazati i ažurirati prozor. Konstanta 10 (SW_SHOW) znači da se prozor treba prikazati. ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd);

14.5. Korak 3: Petlja porukaOvo je srce cijelog programa, praktično sve što program radio prolazi kroz ovu tačku.

` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; }

GetMessage() preuzima poruku iz reda čekanja korisničke aplikacije. Svaki put kada korisnik pomjeri miša, otkuca nešto na tastaturi, klikne na meni prozora ili uradi mnogo drugih stvari, poruke se generišu od strane sistema i smjeste u red čekanja korisničkog programa. Pozivom GetMessage() zahtijeva se da se sljedeća poruka izbaci iz reda čekanja i preda programu za procesiranje. Ako nema poruke GetMessage prelazi u čekanje do nailaska nove. Ukoliko to predstavlja problem, neki programi koriste poruku PeekMessage() koja radi isto kao GetMessage, samo što nastavlja rad ako u redu čekanja nema novih poruka..

TranslateMessage() dodatno procesira poruke tastature kao što je generisanje poruka WM_CHAR da se šalju zajedno sa WM_KEYDOWN porukom. Poruka DispatchMessage šalje poruku prozoru kome je poruka namijenjena. To može biti glavni prozor aplikacije, ali i bilo koji drugi prozor, korisnička kontrola ili neki prozor kreiran od strane sistema ili druge aplikacije. O tome ne treba brinuti jer se je jedini zadatak programa da preuzme i pošalje poruku, a sistem rješava kako će opna doći do odgovarajućeg prozora..

14.6. Korak 4: Prozorska proceduraAko je petlja poruka srce programa, prozorska procedura je njegov mozak. Na ovom mjestu se obraðuju sve poruke

poslane prozoru.. ` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

Prozorska procedura se poziva za svaku poruku. HWND parametar je hendl prozora, tj. onaj na koga se poruka odnosi. To je bitan podatak jer svi prozori iste klase dijele istu prozorsku proceduru, pa se oni meðusobno razlikuju po HWND parametru.

Page 113: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

WM_CLOSE se šalje kada korisnik pritisne taster Close ili Alt+F4. To će izazvati uništavanje prozora i inače, ali je ovdje obrada izdvojena kako bi se mogao dodati eventualni kod koji posprema ostale podatke prije uništenja prozora, kao što je upit korisnika za snimanje datoteka..

Poziv funkcije DestroyWindow() šalje poruku WM_DESTROY prozoru koji treba biti uništen, uništavajući potom sve njegove podprozore. Na prijem ove poruke poziva se funkcija PostQuitMessage. Ova funkcija šalje WM_QUIT petlji za prozore. Ova se poruka nikada ne dobija, jer ona izaziva da GetMessage() vrati netačnu vrijednost čime se prekida obrada poruka.

14.7. Obrada porukaSada prozor postoji mada može da radi jedino

ono što mu omogućava DefWindowProc(), proširivanja, maksimiziranja, ali nikakav drugi kod. Dodatne funkcionalnosti se mogu dodavati obradom pojedinačnih poruka. Obrada poruke predstavlja širenje prozorske procedure dodavanjem aktivnosti u slučaju prijema poruke.

U proceduru WndProc() dodaće se kod koji prikazuje ime programa kada se klikne mišem unutar prozora. Trenutno u WndProc postoji sljedeće: ` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

Da se obradi klik na lijevi taster miša, dodaje se obrada poruke WM_LBUTTONDOWN. Obrada poruke znači njeno dodavanje u WndProc kao na sljedećoj slici: ` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (msg=513) { ` DODANOobrada:=1;} ` Poruka WM_LBUTTONDOWN ` DODANO ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;} }

Sada treba napisati šta će se dogoditi kada se uđe u taj dio programa. Kod koji se želi dodati je prikaz imena datoteke korisničkog programima. U kasnijim primjerima će se samo prikazivati kod koji se želi integrisati u program, u cilju smanjenja kucanja.. GetModuleFileNameA (MAXPATH, szFileName, hInstance); MessageBoxA(0, "This program is:",szFileName, hwnd);

Gore prikazani kod će se izvršiti kada se klikne mišem na formu programa i dodaje se u osnovnu Windows aplikaciju:

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} ` Poruka WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} ` Poruka WM_DESTROY ako (msg=513) { ` GetModuleFileNameA (MAXPATH, szFileName, hInstance); MessageBoxA(0, "This program is:",szFileName, hwnd); obrada:=1;} ` Poruka WM_LBUTTONDOWN ` ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;} }

Nakon modifikacije ovog koda treba ga kompajlirati. Klik na prozor izaziva poruku sa imenom EXE programa. Dodane su varijable hInstance i szFileName. Prvi parametar funkcije GetModuleFIleName je HINSTANCE koji se odnosi na izvršni program (dakle EXE datoteka). Ta se vrijednost dobija funkcijom GetModuleHandle, koja za parametar NULL vraća

Page 114: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

oznaku datoteke u kojoj se nalazi proces koji ju je pozvao. Drugi parametar funkcije je pokazivač na mjesto gdje će se primiti ime datoteke i staza do navedenog modula i taj parametar je tima LPTSTR, odnosno pokazivač niz karaktera.: #definiraj MAXPATH 260cijeli funkcija GetModuleFileNameA (cijeli a,karakter * b,cijeli c);karakter [MAXPATH] szFileName;

MAX_PATH definiše maksimalnu veličinu imena datoteke.

Nakon poziva GetModuleFileName, bafer szFileName će se napuniti stringom koji sadrži ime naše EXE datoteke. Taj parametar se prosljeðuje funkciji MessageBox, čime se prikaže na ekranu..

Ukoliko dodavanje koda nije rezultovalo ispravnim kompajliranjem, slijedi kompletan kod.cijeli funkcija RegisterClassExA(cijeli * wndclass);cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, cijeli c,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,cijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijeli c,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b, karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c);cijeli funkcija GetModuleHandleA ( cijeli a) ;#definiraj MAXPATH 260cijeli funkcija GetModuleFileNameA (cijeli a,karakter * b,cijeli c);karakter [MAXPATH] szFileName;cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0;

ako (msg=16){ DestroyWindow(hwnd); obrada:=1;} `WM_CLOSE ako (msg=2) {PostQuitMessage(0); obrada:=1;} `WM_DESTROY ako (msg=513) { ` GetModuleFileNameA (MAXPATH, szFileName, hInstance); MessageBoxA(0, "This program is:",szFileName, hwnd); obrada:=1;} ` Poruka WM_LBUTTONDOWN ` ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_APPLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC_ARROW wc.hbrBackground := 6; `COLOR_WINDOW_FRAME wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_APPLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registracija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,120,140, 100,200, 13565952, ` ,WS_OVERLAPPEDWINDOW "Windows aplikacija","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiranje!",0); } inace {

ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } } }

14.8. Šta je to poruka?Razumijevanje petlje poruka i cijele strukture u kojoj se šalju poruke windows programa je od suštinskog značaja za

pisanje svega osim najtrivijalnijih poruka. Sada će se malo više pažnje posvetiti cijelom procesu radi izbjegavanja kasnijih konfuzija. Pogled na datoteke zaglavlja u kompajlerima za C pokazuje sljedeće definicije:

#define WM_INITDIALOG 0x0110#define WM_COMMAND 0x0111

#define WM_LBUTTONDOWN 0x0201

Page 115: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Poruke se koriste za komunikaciju između mnogih podsistema. Ukoliko se želi da neki prozor ili kontrola (koja je samo specijalizovani prozor) obavi neku akciju, šalje joj se poruka. Drugi prozor može takođe da zahtjeve za aktivnosti našeg prozora pozove porukom. Ako se dogodi kucanje na tastaturi ili pomicanje miša sistem šalje poruku prozoru na koji poruka utiče. Zadatak prozorske procedure je da odgovori na navedene poruke.

Svaka poruka Windowsa može da ima do dva parametra, wParam i lParam. Unatoč imenu, pod Win32 oba parametra su 32 bitna. Ove parametre ne koristi svaka poruka, a i one koje ih koriste mogu ih interpretirati na različite načine. Tako na primjer, poruka WM_CLOSE ne koristi ni jedan parametar, a poruka WM_COMMAND koristi oba. U Parametru wParam kod poruke WM_COMMAND se u višoj riječi nalaz notifikacijska poruka, a u nižoj identifikator kontrole koja je poslala poruku. U parametru lParam se nalazi handle prozora ili kontrole koji je poslao poruku.

Slanje poruke se vrši funkcijama PostMessage() ili SendMessage(). PostMessage() samo smjesti poruku u red čekanja i odmah se vrati, tako da poruka može ali i ne mora biti obrađena. SendMessage() šalje poruku direktno prozoru i ne vraća se dok prozor ne završi procesiranje poruke. Na ovaj način moguće je, na primjer, zatvoriti prozor slanjem poruke WM_CLOSE tom prozoru koristeći funkciju PostMessage(0,0,WM_CLOSE,hwnd);

14.9. Komunikacija sa dijaloškim prozorimaDijaloškim prozorima se šalju poruke u svrhu komunikacije sa njim Poruka pojedinoj kontroli na dijalogu se može

poslati korištenjem funkcije GetDlgItem() koja na bazi identifikatora vraća hendl kontrole i zatim upotrebom funkcije SendMessage () ili upotrebom SendDlgItemMessage() koja kombinuje oba koraka.

14.10. Šta je red čekanja poruka?Ukoliko u trenutku obrade poruke WM_PAINT korisnik otkuca nešto na tastaturi, šta se treba dogoditi? Prekinuti

iscrtavanje da bi se obradili tasteri ili ih ignorisati. Nijedno rješenje nije dobro, nego postoji red čekanja u koji se smještaju poruke kada se pošalju i nakon obrade ovih poruka one se uklanjaju. To omogućuje da se poruke ne gube dok se obrađuju druge poruke.

14.11. Šta je petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); }

Petlja poruka poziva GetMessage() koja pregleda red čekanja. Ako je red čekanja prazan, program se zaustavlja i čeka da se poruka pojavi.

Kada se desi događaj koji ubacuje poruku u red čekanja (npr. pritisak na taster miša), GetMessage() vraća pozitivnu vrijednost indicirajući da postoji poruka koja se treba obraditi i da je ona napunjena članovima MSG strukture koja joj je dodijeljena. Ova funkcija vraća vrijednost 0 ako primi poruku WM_QUIT i negativnu vrijednost ako se dogodila greška.

Preuzimanje poruke u Msg varijablu i njeno prosljeđivanje funkciji TranslateMessage() je opcionalni korak koji prevodi virtualni taster u karakterske poruke. Nakon što je to urađeno, poruka se prosljeđuje funkciji DispatchMessage(). Ova funkcija provjeri kojem je prozoru namijenjena i traži prozorsku proceduru koja obrađuje taj prozor. Nakon toga poziva tu proceduru šaljući kao parametar hendl prozora, poruku, wParam i lParam.

U prozorskoj proceduri se provjeri poruka i njeni parametri i obrađuje po želji. Ukoliko se poruka posebno ne obrađuje, poziva se DefWindowProc() koja obavlja podrazumijevane akcije, što često znači da se ništa ne radi.

Po završetku prozorske procedure, DispatchMessage() se vrati i petlja se ponovo izvršava. Prozorska procedura se ne poziva magično iz sistema, nju zapravo poziva korisnički program funkcijom DispatchMessage. Ukoliko se to želi, isti efekat se može postići korištenjem GetWindowLong() funkcije koja za navedeni hendl nalazi prozorsku proceduru i direktno je zvati indirektnim pozivom funkcije. Ipak to neće raditi u složenijim aplikacijama, pošto su neki efekti koje implicitno radi DispatchMessage zanemareni.

Aplikacija provodi većinu vremena u petlji za poruke. Kada se želi izaći iz te petlje, GetMessage() treba da vrati vrijednost 0 da se dođe do kraja WinMain funkcije. To obavlja PostQuitMessage(). Ona u red čekanja dodaje poruku WM_QUIT i umjesto vraćanja pozitivne vrijednosti GetMessage() puni Msg strukturu i vraća vrijednost 0. Polje wParam strukture Msg sadrži vrijednost koja je proslijeđena funkciji PostQuitMessage i ona se može ili ignorisati ili iskoristiti kao izlazni kod pri završetku procesa.

14.12. Rezime poglavljaAplikacije koje nemaju prozore se mogu pisati na klasični način. Windows aplikacije sa prozorima su bazirane na

petljama i porukama. Svaka windows aplikacija, koja treba da prikaže standardni prozor ima četiri faze: pripremu i registraciju

Page 116: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

prozorske klase, kreiranje prozora, petlju poruka i obradu poruka u prozorskoj proceduri. Slanje poruke u glavnoj petlji automatski pokreće proceduru za obradu prozora, a ova procedura je definisana u prozorskoj klasi.

Page 117: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

15.KORISNIČKI INTERFEJS I GRAFIČKE PRIMITIVE

Jedan od najvažnijih zadataka aplikacija napisanih u bilo kom programskom jeziku je komunikacija sa korisnikom. U ovom poglavlju će biti riječi o tome kako se mogu primati ulazni podaci od korisnika pod operativnim sistemom Windows, prilagođeno za FILDZAN-32.Prema načinu interakcije sa korisnikom, postoje tri vrste aplikacija, servisi koji nemaju nikakvu interakciju osim kroz konfiguracione datoteke ili Registry, konzolne aplikacije, koje komuniciraju preko tastature i tekstualnog izlaza i GUI aplikacije, koje imaju kompletan skup korisničkih kontrola.

15.1. Servisne aplikacijeOvo su obično sistemski procesi koji se startaju automatski po startu operativnog sistema. Ove aplikacije direktno ne

komuniciraju sa korisnikom, nego primaju poruke od sistema. Tako na primjer, aplikacije koje predstavljaju Web server ne prikazuju ništa na ekranu, niti očitavaju išta sa tastature, nego obavljaju prijemom i slanjem podataka kroz socket funkcije. Servisne aplikacije u užem smislu se mogu startati i kada korisnik nije uopšte prijavljen na računar.

15.2. Konzolne aplikacije

Već su prvi primjeri u FILDZAN-32 koji su se uspjeli kompajlirati predstavljali ovakve aplikacije. Konzola je interfejs koji omogućava ulaz/izlaz aplikacijama koje rade u znakovnom režimu. Konzola se sastoji od ulaznog bafera i jednog ili više ekranskih bafera. Ulazni bafer sadrži red ulaznih slogova od kojih svaki uključuje informacije u ulaznom događaju. Ekranski bafer je dvodimenzionalni niz znakova i informacija o boji za izlaz na prozoru konzole.

Win32 dopušta funkcije visokog i niskog nivoa za pristup konzoli. Funkcije visokog nivoa su orijentisane prema znakovima i omogućavaju redirekciju podataka. Funkcije niskog nivoa prate ulaze sa tastature kao što su pojedinačni tasteri, događaje miša i omogućuju bolju kontrolu izlaza na ekran.

Konzolne aplikacije se ne pišu ni na kakav poseban način. Treba jedino znati da jezik FILDZAN32 koji se razvija sam po sebi nema naredbe kao što su writeln ili scanf, pa treba napisati program koristeći Win32 API.

Najvažnije funkcije visokog nivoa su GetStdHandle , ReadConsoleA i WriteConsoleA, koje su objašnjene u testnim primjerima šestog i sedmog poglavlja.

Od funkcija niskog nivoa treba spomenuti funkciju PeekConsoleInput kojom se mogu očitavati tasteri bez čekanja.

15.3. Grafičke kontroleGrafičke aplikacije imaju drugačiji pristup ulaznim podacima od tekstualnih. Na ekranu se nalaze različite kontrole

(dugmad, editna polja, kombinovane liste i slično)

Sve Windows kontrole su zapravo prozori. To je bitno za znati, jer se tako mnoge funkcije namijenjene prozorima mogu koristiti i za kontrole. Tako na primjer, postavljanje naslova prozora ili upis podrazumijevane vrijednosti u editno polje obavljaju iste funkcije.

Dva su pristupa pravljenju Windows kontrola. Jedan je preko resursnih dijaloga i zahtijeva upotrebu resursnog editora ili jezika za resursne skripte. Resursi se odvojeno kompajliraju i povezuju sa glavnim programom. To su binarni podaci koji opisuju izgled kontrola. Prednost pristupa je u mogućnosti ekstrakcije ekranskih formi iz izvršnog programa u cilju njihove popravke ili prevođenja na druge jezike. Druga prednost je što je osnovni program kraći. Treća prednost je što resursni editori mogu biti grafičke, vizuelne aplikacije, pa je njihova priprema razmjerno jednostavna. Nedostaci pristupa su potreba za posebnim kompajlerom resursa i veća rasparčanost koda jer se on nalazi i u datoteci sa programom i u datoteci sa resursom.

Windows kontrole se mogu dobiti i direktnim pozivom CreateWindowExA funkcije za svaku kontrolu. Kako resursni kompajler za FILDZAN32 još nije napisan, koristiće se drugi metod.

Dio parametara iz CreateWindowExA koji su korišteni za kreiranje osnovne Windows aplikacije se mogu primijeniti i ovdje, dok se drugi dio mijenja. Tako na primjer, za Windows kontrole nema potrebe registrovati klasu prozora, jer već postoji nekoliko standardnih:

BUTTON - dugmad, checkbox-ovi i radio tasteri

LISTBOX – liste podataka

COMBOBOX - kombinovane liste podataka

EDIT - unosna polja

Page 118: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SCROLLBAR - klizna traka

STATIC - statični tekst

SysAnimate32- kontrola koja prikazuje AVI datoteku

msctls_hotkey32- kontrola koja predefiniše taster za brži pristup nekoj opciji

msctls_progress32- mjerač realizacije nekog posla

msctls_statusbar32 - statusna traka

ToolbarWindow32 - alatna traka

tooltips_class32 - informacioni prozorčić

msctls_trackbar32 - potenciometarska kontrola

msctls_updown32 - kontrola za unos podatka uz mogućnost uvećanja i umanjenja njegove vrijednosti tasterima

SysHeader32 - zaglavlje pogleda na podatke u formi liste

SysListView32 - Pogled na podatke u formi liste, koji omogućuje i pojedine ikone

SysTabControl32 - Tab kontrola, omogućuje prikaz podataka u formi odvojenih kartica

SysTreeView32 - Pogled stabla, hijerarhijski prikaz podataka

RichEdit - Omogućuje unos tekstova koji mogu biti u boji i sadržati dodatne podatke

Sa kontrolama se komunicira slanjem poruka kontroli funkcijom SendMessage ili odgovarajućim funkcijama za obradu prozora.

Kontrole vraćaju prozoru poruku WM_COMMAND, WM_NOTIFY, WM_HSCROLL ili WM_VSCROLL, zavisno od same kontrole. U okviru wParam i lParam parametara nalaze se dodatne informacije koje govore o poruci.

15.4. Funkcije grafičkih kontrola kroz primjerNa slici Sl. 15.4.1 data je ekranska forma aplikacije za unos podataka o zainteresovanim licima za uvođenje

kablovske televizije. Na ovoj formi se nalaze sve standardne Windows kontrole, koje se nalaze u USER32.DLL biblioteci.

Sl. 15.4.1. Forma aplikacijeNa ovoj formi se uočava da postoje kontrole tipa edit polja, listbox, combobox, checkbox, memo polja, menu,

dugmad, scroll bar, statički tekst, iscrtani logo firme, ispisani tekst i menu. Sada će se pogledati cijeli listing programa, a zatim vidjeti kako se definiše pojedina vrsta kontrola i kako se očitavaju podaci koje ona šalje.

Page 119: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

cijeli funkcija RegisterClassExA(cijeli * wndclass);cijeli funkcija ShowWindow ( cijeli a,cijeli b) ;cijeli funkcija UpdateWindow(cijeli hWnd) ;cijeli funkcija GetMessageA (cijeli a, cijeli b, cijeli c,cijeli * d);cijeli funkcija TranslateMessage (cijeli * d) ;cijeli funkcija DispatchMessageA (cijeli * d) ;cijeli funkcija CreateWindowExA(cijeli a,cijeli b,cijeli c, cijeli d,cijeli e,cijeli f,cijeli g,cijeli h,cijeli i, karakter * j,karakter * k,cijeli l);cijeli funkcija LoadCursorA ( cijeli a,cijeli b) ;cijeli funkcija LoadIconA ( cijeli a,cijeli b) ;cijeli funkcija DestroyWindow ( cijeli a) ;cijeli funkcija PostQuitMessage ( cijeli a) ;cijeli funkcija DefWindowProcA (cijeli a, cijeli b, cijeli c,cijeli d);cijeli funkcija MessageBoxA (cijeli a, karakter * b, karakter * c,cijeli d);cijeli funkcija WinExec (karakter * b, karakter * c);cijeli funkcija GetModuleHandleA ( cijeli a) ;cijeli funkcija SendMessageA (karakter * a,cijeli b, cijeli c, cijeli d);cijeli funkcija GetWindowTextA (cijeli a,karakter * b, cijeli c);cijeli funkcija IsDlgButtonChecked(cijeli a, cijeli b);cijeli funkcija SetScrollRange(cijeli a,cijeli b, cijeli c, cijeli d, cijeli e);cijeli funkcija SetScrollPos(cijeli a,cijeli b, cijeli c, cijeli d);cijeli funkcija GetScrollPos(cijeli a,cijeli b);cijeli funkcija BeginPaint(cijeli * a,cijeli b);cijeli funkcija EndPaint(cijeli * a,cijeli b);cijeli funkcija Ellipse(cijeli a, cijeli b, cijeli c,cijeli d, cijeli e);cijeli funkcija MoveToEx(cijeli * a, cijeli b, cijeli c,cijeli d);cijeli funkcija LineTo(cijeli a, cijeli b, cijeli c);cijeli funkcija TextOutA(cijeli a,cijeli * b,cijeli c,cijeli d,cijeli e);cijeli funkcija CreateMenu();cijeli funkcija CreatePopupMenu();cijeli funkcija AppendMenuA(karakter * a,cijeli b, cijeli c, cijeli d);cijeli funkcija SetMenu(cijeli a,cijeli b);

cijeli hInstance;karakter * klasa;slog { cijeli cbSize; cijeli style; cijeli * lpfnWndProc; cijeli cbClsExtra; cijeli cbWndExtra; cijeli hInstance; cijeli hIcon; cijeli hCursor; cijeli hbrBackground; karakter * lpszMenuName; karakter * lpszClassName; cijeli hIconSm; } wc; ` Klasa prozora cijeli hwnd; slog { cijeli hwnd; cijeli message; cijeli wParam; cijeli lParam; cijeli time; slog { cijeli x; cijeli y; } pt; } Msg; ` Poruka

slog { cijeli hdc; cijeli fErase; slog { cijeli left,top,right,bottom; } rcPaint; cijeli fRestore; cijeli fIncUpdate; cijeli [32] rgbReserved; } pstruct;

cijeli hEdit1,hEdit2,hGroup1,hRadio1,hRadio2,hCheck1, hMemo1,hListBox1,hCombo1,hScroll1,hButton1,hStatic1,hStatic2,hStatic3,hStatic4,hStatic5,hStatic6,hdc,hMenu,hSubMenu;

cijeli funkcija KreirajKontrole(){ hEdit1:=CreateWindowExA(0,hInstance,0,hwnd,21,161,16,64, 1350565888, ` ws_child or ws_visible or ws_border "","EDIT",512);

hEdit2:=CreateWindowExA(0,hInstance,0,hwnd,21,161,48,64, 1350565888, ` ws_child or ws_visible or ws_border "","EDIT",512);

hGroup1:=CreateWindowExA(0,hInstance,0,hwnd,57,217,80,16, 1342177287, ` ws_child or ws_visible or bs_groupbox "Spol","BUTTON",0);

hRadio1:=CreateWindowExA(0,hInstance,105,hGroup1,17,113,16,24, 1342177289, ` ws_child or ws_visible or bs_autoradiobutton "Muški","BUTTON",0);

hRadio2:=CreateWindowExA(0,hInstance,106,hGroup1,17,113,32,24, 1342177289, ` ws_child or ws_visible or bs_autoradiobutton "Ženski","BUTTON",0);

hCheck1:=CreateWindowExA(0,hInstance,107,hwnd,17,209,152,16, 1342177283, ` ws_child or ws_visible or bs_autocheckbox "Uplatio uvođenje","BUTTON",512);

hMemo1:=CreateWindowExA(0,hInstance,0,hwnd,89,185,216,16, 1350565892, ` ws_child or ws_visible or ws_border or es_multiline "Memo","EDIT",512);

hListBox1:=CreateWindowExA(0,hInstance,0,hwnd,97,200,24,272, 1352663043, ` ws_child or ws_visible or ws_border or lbs_standard "List1","LISTBOX",512);

SendMessageA("1.Samo TV program",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("2.TV i Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("3.Samo Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("4.TV s kodiranimkanalima",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("5.Puni paket",0,384,hListBox1); ` 384 LB_ADDSTRING

hCombo1:=CreateWindowExA(0,hInstance,0,hwnd,100,145,144,272, 1350566402, ` ws_child or ws_visible or ws_border or cbs_dropdown or cbs_hasstrings "COmbobox1","COMBOBOX",0); SendMessageA("Maršala Tita",0,323,hCombo1); ` 323 CB_ADDSTRING SendMessageA("Alipašina",0,323,hCombo1); ` 323 CB_ADDSTRING

hScroll1:=CreateWindowExA(0,hInstance,0,hwnd,21,185,192,272, 1342177280, ` ws_child or ws_visible or sbs_horz "","SCROLLBAR",0); SetScrollRange(1,100,1,2,hScroll1);

hButton1:=CreateWindowExA(0,hInstance,0,hwnd,25,75,256,288, 1342177280, ` ws_child or ws_visible or bs_pushbutton "Unesi","BUTTON",0);

hStatic1:=CreateWindowExA(0,hInstance,0,hwnd,14,57,16,8, 1342177291, `ws_child or ws_visible or ss_simple "Prezime","STATIC",0);

hStatic2:=CreateWindowExA(0,hInstance,0,hwnd,14,37,50,8, 1342177291, `ws_child or ws_visible or ss_simple "Ime","STATIC",0);

hStatic3:=CreateWindowExA(0,hInstance,0,hwnd,14,72,200,16, 1342177291, `ws_child or ws_visible or ss_simple "Napomena","STATIC",0);

hStatic4:=CreateWindowExA(0,hInstance,0,hwnd,14,103,8,272,

Page 120: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

1342177291, `ws_child or ws_visible or ss_simple "Vrsta usluge","STATIC",0);

hStatic5:=CreateWindowExA(0,hInstance,0,hwnd,14,78,128,280, 1342177291, `ws_child or ws_visible or ss_simple "Adresa","STATIC",0);

hStatic6:=CreateWindowExA(0,hInstance,0,hwnd,13,190,176,280, 1342177291, `ws_child or ws_visible or ss_simple "Stepen realizacije","STATIC",0);

hMenu:=CreateMenu(); hSubMenu := CreatePopupMenu(); AppendMenuA( "O& programu",200,0,hSubMenu); AppendMenuA( "I&zlaz",201,0,hSubMenu); AppendMenuA("&Meni",hSubMenu,16,hMenu); SetMenu(hMenu,hwnd);

}

cijeli funkcija OnWMHScroll(cijeli wParam,cijeli lParam){ cijeli nPos;

ako (lParam=hScroll1)& (wParam & 65535 =5) `SB_THUMBTRACK { nPos:=wParam / 65536; SetScrollPos(1,nPos,2,hScroll1); }}

cijeli funkcija OnWMCommand(cijeli wParam,cijeli lParam){ karakter [200] rezultat; cijeli nItem;

ako (lParam=0) { ako (wParam & 65535 = 201) { PostQuitMessage(0); } ako (wParam & 65535 = 200) { MessageBoxA(0,"O programu", "Ovo je aplikacija koja demonstrira kontrole i GDI",0); }

} ako (lParam=hButton1) { GetWindowTextA(200,rezultat,hEdit1); MessageBoxA(0,"Prezime",rezultat,hwnd); GetWindowTextA(200,rezultat,hEdit2); MessageBoxA(0,"Ime",rezultat,hwnd); GetWindowTextA(200,rezultat,hCombo1); MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1); MessageBoxA(0,"Napomena",rezultat,hwnd); ako IsDlgButtonChecked(105,hGroup1)=1 { MessageBoxA(0,"Spol","Muski",hwnd); } ako IsDlgButtonChecked(106,hGroup1)=1 { MessageBoxA(0,"Spol","Zenski",hwnd); }

ako IsDlgButtonChecked(107,hwnd)=1 { MessageBoxA(0,"Status","Platio",hwnd); } nItem := SendMessageA(0,0,392,hListBox1); ` LB_GETCURSEL ako nItem=2 { MessageBoxA(0,"TV","Ne koristi TV",hwnd); } ako (GetScrollPos(2,hScroll1)>50) { MessageBoxA(0,"Realizovanost","Preko 50",0); } }

}

cijeli funkcija OnWMPaint(cijeli hwnd){ hdc:=BeginPaint(&pstruct,hwnd); MoveToEx(0,250,400,hdc); LineTo(250,480,hdc); LineTo(310,480,hdc); LineTo(310,400,hdc); LineTo(250,400,hdc); TextOutA(5,"CBLTV",253,403,hdc); Ellipse(294,470,264,410, hdc); EndPaint(&pstruct,hwnd);}

` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=15){ OnWMPaint(hwnd); obrada:=1;}` WM_PAINT ako (msg=2) {PostQuitMessage(0); obrada:=1;}` WM_DESTROY ako (msg=273) {OnWMCommand(wParam,lParam); obrada:=1;} ` Poruka WM_COMMAND ako (msg=276) {OnWMHScroll(wParam,lParam); obrada:=1;} ` Poruka WM_HSCROLL ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;}

}

` Glavni program{

` Korak 1: Registracija prozorske klase hInstance:=GetModuleHandleA(0); wc.cbSize := 48; wc.style := 0; wc.lpfnWndProc := WndProc; wc.cbClsExtra := 0; wc.cbWndExtra := 0; wc.hInstance := hInstance; wc.hIcon := LoadIconA(32512,0); `IDI_APPLICATION wc.hCursor := LoadCursorA(32512,0); ` IDC_ARROW wc.hbrBackground := 5; `SIVA wc.lpszMenuName := 0; wc.lpszClassName := "FILDZANKLASA"; wc.hIconSm := LoadIconA(32512,0); `IDI_APPLICATION

ako (!RegisterClassExA(&wc)) { MessageBoxA(0, "Greska","Neuspjela registracija!",0); } inace {` Korak 2: Kreiranje prozora hwnd:=CreateWindowExA(0,hInstance,0,0,383,535, 177,108, 13565952, ` WS_OVERLAPPEDWINDOW "Forma za unos","FILDZANKLASA",512); ako (hwnd = 0) { MessageBoxA(0, "Greska","Neuspjelo kreiranje!",0); } inace { KreirajKontrole(); ShowWindow(10,hwnd); `SW_SHOW UpdateWindow(hwnd); ` Korak 3: Petlja poruka dok (GetMessageA(0,0,0,&Msg) > 0) { TranslateMessage(&Msg); DispatchMessageA(&Msg); } Msg.wParam; } } }

Sl. 15.4.2. Aplikacija sa podprozorima - kontrolama

Page 121: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Na listingu Sl. 15.4.2 se vidi da se registracija prozorske klase uopšte nije promijenila, izuzev boje pozadine. Dijelu koda za kreiranje prozora je dodan poziv funkcije KreirajKontrole nakon što je kreiran glavni program, dok je glavna petlja poruka identična osnovnoj verziji. Prozorska procedura obrađuje pet poruka.` Korak 4: Prozorska proceduracijeli funkcija WndProc(cijeli lParam, cijeli wParam, cijeli msg, cijeli hwnd){ cijeli obrada; obrada:=0; ako (msg=16){ DestroyWindow(hwnd); obrada:=1;}` WM_CLOSE ako (msg=15){ OnWMPaint(hwnd); obrada:=1;}` WM_PAINT ako (msg=2) {PostQuitMessage(0); obrada:=1;}` WM_DESTROY ako (msg=273) {OnWMCommand(wParam,lParam); obrada:=1;} ` Poruka WM_COMMAND ako (msg=276) {OnWMHScroll(wParam,lParam); obrada:=1;}` Poruka WM_HSCROLL ako (obrada#1) { DefWindowProcA(lParam,wParam,msg,hwnd); } inace {0;} }

Poruka WM_COMMAND (broj 273) se šalje glavnom prozoru svaki put kada se izabere neka opcija na meniju ili pritisne neki ekranski taster, radio taster ili checkbox. Ova poruka uz parametre wparam i lparam šalje dodatne vrijednosti koji određuju kontrolu.

Poruka WM_PAINT (broj 15) se šalje glavnom prozoru svaki put kada se treba iscrtati dio prozora.

Horizontalne klizne trake (scrollbar) šalju poruke WM_HSCROLL (broj 276).

15.5. MenijiKreiranje menija se vrši funkcijom CreateMenu(), a podmenija funkcijom CreatePopupMenu(). Ove funkcije interno

kreiraju menije, i dodijele mu identifikator, handle. To se vidi na dijelu koda koji se nalazi na kraju funkcije KreirajKontrole() hMenu:=CreateMenu(); hSubMenu := CreatePopupMenu(); AppendMenuA( "O& programu",200,0,hSubMenu); AppendMenuA( "I&zlaz",201,0,hSubMenu); AppendMenuA("&Meni",hSubMenu,16,hMenu); SetMenu(hMenu,hwnd);

Za dodavanje opcija menija koristi se funkcija AppendMenuA, čiji prvi parametar predstavlja tekst opcije, drugi parametar predstavlja broj koji će meni proslijediti uz poruku WM_COMMAND ili handle podmenija. Treći parametar predstavlja status menija i ima vrijednost 0 ako je riječ o opciji, a 16 ako je riječ o podmeniju. Moguće je još mnogo različitih statusa. Posljednji parametar predstavlja handle menija ili podmenija kome se pridružuje ova opcija.

Meni se dodjeljuje prozoru primjenom opcije SetMenu, čiji je prvi parametar handle menija, a drugi je handle prozora.

Izbor opcije u meniju šalje glavnom prozoru poruku WM_COMMAND. Odgovor na opcije se vidi u sljedećem dijelu koda unutar funkcije OnWMCommand

ako (lParam=0) { ako (wParam & 65535 = 201) { PostQuitMessage(0); } ako (wParam & 65535 = 200) { MessageBoxA(0,"O programu", "Ovo je aplikacija koja demonstrira kontrole i GDI",0); } }

Poruka WM_COMMAND koja je stigla od menija u parametru lParam ima vrijednost 0, a nižih 16 bita parametra wParam predstavlja konstantu koja je data uz drugi parametar funkcije AppendMenuA.

15.6. Dugme - ButtonKontrola oblika dugmeta se kreira kao i svaki prozor, CreateWindowExA funkcijom. U našem primjeru, to je naredba

hButton1:=CreateWindowExA(0,hInstance,0,hwnd,25,75,256,288, 1342177280, ` ws_child or ws_visible or bs_pushbutton "Unesi","BUTTON",0);

Kao što se vidi, klasa prozora je BUTTON, a stil je kombinacija ws_child , ws_visible i bs_pushbutton. Treći parametar je hwnd, što znači da je riječ o kontroli koja ima roditelja, tj. prozor kome će se slati poruke. Posljednji parametar je 0 što znači da nema specijalnog okvira.

Page 122: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Prepoznavanje da je taster pritisnut može se vršiti u obradi poruke WM_COMMAND, što se vidi iz sljedećeg dijela koda unutar funkcije OnWMCommand: ako (lParam=hButton1) { ... }

Parametar lParam poruke WM_COMMAND sadrži handle tastera koji je pritisnut, hButton1. U okviru obrade ovog tastera se nalazi kod koji očitava vrijednosti svih kontrola i prikazuje ih na ekranu koristeći MessageBoxA.

15.7. Editna i memo poljaNajvažnija kontrola za unos podataka su polja za unos teksta ili editna polja. Ove kontrole imaju klasu EDIT kao u

sljedećem dijelu kodahEdit1:=CreateWindowExA(0,hInstance,0,hwnd,21,161,16,64, 1350565888, ` ws_child or ws_visible or ws_border "","EDIT",512);

hEdit2:=CreateWindowExA(0,hInstance,0,hwnd,21,161,48,64, 1350565888, ` ws_child or ws_visible or ws_border "","EDIT",512);

Memo polja se razlikuju od običnih editnih polja po tome što imaju dodatni stil es_multilinehMemo1:=CreateWindowExA(0,hInstance,0,hwnd,89,185,216,16, 1350565892, ` ws_child or ws_visible or ws_border or es_multiline "Memo","EDIT",512);

Očitavanje vrijednosti kontrole se svodi na čitanje naslova prozora funkcijom GetWindowTextA unutar obrade pritiska na dugme. Prvi argument ove funkcije je broj bajtova koliki tekst treba da bude, drugi je adresa na koju se tekst smješta a treći je hendl kontrole. U sljedećem dijelu koda se primljeni podaci prikazuju u poruci (prava aplikacija bi ih upisala u bazu podataka)GetWindowTextA(200,rezultat,hEdit1); MessageBoxA(0,"Prezime",rezultat,hwnd); GetWindowTextA(200,rezultat,hEdit2); MessageBoxA(0,"Ime",rezultat,hwnd); GetWindowTextA(200,rezultat,hCombo1); MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1); MessageBoxA(0,"Napomena",rezultat,hwnd);

U složenijim slučajevima editno polje treba dodatno kontrolisati, recimo zabranjujući da se nenumeričke vrijednosti uopšte mogu otkucati. To se radi obradom poruka koje editno polje direktno šalje glavnom prozoru.

15.8. Grupe kontrola i radio tasteriRadio tasteri su okruglog oblika i omogućavaju izbor jedne od više opcija. Svaki radio taster predstavlja poseban

prozor klase BUTTON. Da bi se znalo između kojih radio tastera se odabira opcija, formira se grupa tastera (group box) koja je takođe prozor klase BUTTON, ali sa kombinacijom stilova ws_child, ws_visible i bs_groupbox, kao što se vidi iz dijela koda:

hGroup1:=CreateWindowExA(0,hInstance,0,hwnd,57,217,80,16, 1342177287, ` ws_child or ws_visible or bs_groupbox "Spol","BUTTON",0);

Radio tasteri imaju kombinaciju stilova ws_child, ws_visible i bs_autoradiobutton. Ono što je bitno primijetiti da se za roditeljski prozor ne navodi handle od glavnog prozora, nego od grupe tastera hGroup1, te da su koordinate relativne u odnosu grupu kontrola. Pored toga, svaki radio taster treba da ima svoju specijalnu numeričku oznaku koja je treći parametar i koja u narednim linijama ima vrijednosti 105, odnosno 106. hRadio1:=CreateWindowExA(0,hInstance,105,hGroup1,17,113,16,24, 1342177289, ` ws_child or ws_visible or bs_autoradiobutton "Muški","BUTTON",0);

hRadio2:=CreateWindowExA(0,hInstance,106,hGroup1,17,113,32,24, 1342177289, ` ws_child or ws_visible or bs_autoradiobutton "Ženski","BUTTON",0);

Očitavanje vrijednosti radio tastera se vrši funkcijom IsDlgButtonChecked, čiji prvi argument ima vrijednost ranije navedene numeričke oznake, a drugi je handle na grupu tastera. Ako je taster izabran, ova će funkcija vratiti tačnu vrijednost, što se vidi na sljedećem dijelu koda.ako IsDlgButtonChecked(105,hGroup1)=1 { MessageBoxA(0,"Spol","Muski",hwnd); } ako IsDlgButtonChecked(106,hGroup1)=1 { MessageBoxA(0,"Spol","Zenski",hwnd); }

Page 123: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

15.9. Kontrolne kućice (checkbox)Kontrolnom kućicom (checkbox) se omogućuje unos podataka koji imaju vrijednosti tipa tačno/netačno. Ova

komponenta se kreira kao i obični tasteri (prozor klase BUTTON) uz stil koji je kombinacija stilova ws_child, ws_visible i bs_autocheckbox. I kod ove komponente je potrebno navesti internu oznaku (koja u sljedećem dijelu koda ima vrijednost 107)hCheck1:=CreateWindowExA(0,hInstance,107,hwnd,17,209,152,16, 1342177283, ` ws_child or ws_visible or bs_autocheckbox "Uplatio uvođenje","BUTTON",512);

Očitavanje vrijednosti ove komponente se takođe vrši funkcijom IsDlgButtonChecked, kao u sljedećem dijelu koda:

ako IsDlgButtonChecked(107,hwnd)=1 { MessageBoxA(0,"Status","Platio",hwnd); }

15.10. Liste podataka (listbox)Liste podataka (listbox) služe za izbor podataka poredanih jedan iznad drugog. I ova kontrola se kreira kao prozor, ali

koji je klase LISTBOX. Stil je kombinacija ws_child , ws_visible , ws_border i lbs_standard. Kreiranom listboxu, treba poslati vrijednosti koristeći funkciju SendMessageA. Prvi argument ove funkcije (lParam) je pointer na niz karaktera koji se dodaje u listbox, drugi je 0 (wParam), treći je 384 ( poruka LB_ADDSTRING) a četvrti je handle na listbox.hListBox1:=CreateWindowExA(0,hInstance,0,hwnd,97,200,24,272, 1352663043, ` ws_child or ws_visible or ws_border or lbs_standard "List1","LISTBOX",512);

SendMessageA("1.Samo TV program",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("2.TV i Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("3.Samo Internet",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("4.TV s kodiranimkanalima",0,384,hListBox1); ` 384 LB_ADDSTRING SendMessageA("5.Puni paket",0,384,hListBox1); ` 384 LB_ADDSTRING

Da bi se saznalo koja je opcija listbox-a odabrana, pošalje se poruka LB_GETCURSEL (392) listboxu uz lparam i wparam parametre jednake 0. nItem := SendMessageA(0,0,392,hListBox1); ` LB_GETCURSEL ako nItem=2 { MessageBoxA(0,"TV","Ne koristi TV",hwnd); }

15.11. Kombinovane liste (combo box)Kombinovanjem listboxa i editnog polja dobija se combo box. On je prozor klase COMBOBOX, i kreira se i puni

slično LISTBOXu, s tim što je stil prozora kombinacija ws_child, ws_visible, ws_border, cbs_dropdown i cbs_hasstrings a kod poruke za punjenje 323 (cb_addstring). Nazivi ulica su stavljeni u combobox koji je tipa dropdown, što znači da je moguće dokucavati uneseni tekst. Druga dva tipa su simple koji je fiksnog izgleda i dropdownlist koji je promjenjive veličine, ali je tekst moguće samo izabrati, ne i dokucavati.

hCombo1:=CreateWindowExA(0,hInstance,0,hwnd,100,145,144,272, 1350566402, ` ws_child or ws_visible or ws_border or cbs_dropdown or cbs_hasstrings "COmbobox1","COMBOBOX",0); SendMessageA("Maršala Tita",0,323,hCombo1); ` 323 CB_ADDSTRING SendMessageA("Alipašina",0,323,hCombo1); ` 323 CB_ADDSTRING

Očitavanje stringa koji je izabran u ComboBoxu se može obaviti očitavanjem naslova prozora. MessageBoxA(0,"Adresa",rezultat,hwnd); GetWindowTextA(200,rezultat,hMemo1);

15.12. Statički tekstPored odgovora na WM_PAINT poruku, statički tekst se takođe može realizovati u formi podprozora klase static. O

iscrtavanju ovakvih tekstova na formama brine kasnije sam Windows. hStatic1:=CreateWindowExA(0,hInstance,0,hwnd,14,57,16,8, 1342177291, `ws_child or ws_visible or ss_simple "Prezime","STATIC",0);

hStatic2:=CreateWindowExA(0,hInstance,0,hwnd,14,37,50,8, 1342177291, `ws_child or ws_visible or ss_simple "Ime","STATIC",0);

hStatic3:=CreateWindowExA(0,hInstance,0,hwnd,14,72,200,16,

Page 124: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

1342177291, `ws_child or ws_visible or ss_simple "Napomena","STATIC",0);

hStatic4:=CreateWindowExA(0,hInstance,0,hwnd,14,103,8,272, 1342177291, `ws_child or ws_visible or ss_simple "Vrsta usluge","STATIC",0);

hStatic5:=CreateWindowExA(0,hInstance,0,hwnd,14,78,128,280, 1342177291, `ws_child or ws_visible or ss_simple "Adresa","STATIC",0);

hStatic6:=CreateWindowExA(0,hInstance,0,hwnd,13,190,176,280, 1342177291, `ws_child or ws_visible or ss_simple "Stepen realizacije","STATIC",0);

15.13. Klizna traka (scrollbar)Iako se daleko češće koristi za pregled velikih slika ili skupova korisničkih kontrola koje ne mogu stati na ekran,

horizontalna klizna traka se može koristiti i za unos podataka čija vrijednost nije egzaktna nego približna. Pomicanje klizne trake izaziva poruku WM_HSCROLL (broj 276). U programu je ova poruka obrađena u funkciji OnWMHScrollcijeli funkcija OnWMHScroll(cijeli wParam,cijeli lParam){ cijeli nPos;

ako (lParam=hScroll1)& (wParam & 65535 =5) `SB_THUMBTRACK { nPos:=wParam / 65536; SetScrollPos(1,nPos,2,hScroll1); }}

Postoji više načina pomicanja klizne trake, povlačenjem kvadratića na njoj, klikom na strelice ili klikom u prazna polja. Ovdje je obrađeno samo povlačenje kvadratića (u nižoj riječi wParama vrijednost 5, poruka SB_THUMBTRACK). Prilikom povlačenja kvadratića na kliznoj traci(ali samo u tom slučaju), viša riječ parametra wparam će sadržati novu poziciju. Ta pozicija neće biti zadržana ako se ne pozove funkcija SetScrollPos, čiji prvi parametar znači da li će se klizna traka ponovo iscrtati, drugi parametar definiše njenu novu poziciju. Treći parametar govori da li je riječ o horizontalnoj kliznoj traci, vertikalnoj kliznoj traci samog prozora ili odvojenoj kontroli (vrijednost 2). Četvrti parametar je handle na kliznu traku.

Trenutna pozicija klizne trake se dobija funkcijom GetScrollPos, čiji prvi parametar predstavlja vrstu klizne trake (u našem slučaju 2, odvojena kontrola), a drugi je hendl na kliznu traku. U ovom dijelu koda se provjerava da li klizna traka ima vrijednost preko 50.ako (GetScrollPos(2,hScroll1)>50) { MessageBoxA(0,"Realizovanost","Preko 50",0); }

15.14. Iscrtane slike i WM_PAINT porukaZa iscrtavanje grafike postoji jedan poseban podsistem koji se zove GDI, graphic device interface. On omogućava

širok izbor grafičkih elemenata kao što su linije, krugovi, elipse, ispunjeni likovi, bitmape, tekstualne poruke, i slično

Većina ovih funkcija koristi jedan specijalni identifikator dijela prozora po kome se crta, koji se zove hdc (handle to device context - kontekst uređaja). On se dobija pozivom odgovarajućih funkcija iz hendla na prozor, hwnd. Razlog zbog čega API funkcije za crtanje razdvajaju prozor od njegovog konteksta uređaja je u činjenici da prozor ima okvir i korisnu površinu i da crtanje po korisnoj površini ne mijenja sadržaj okvira i obrnuto.

Nije, međutim dobro iscrtavati sliku bilo kada. Iscrtavanje drugih prozora u sistemu lako prekriva iscrtanu sliku, pa se ono što je iscrtano izgubi. Stoga je iscrtavanje potrebno obaviti svaki put kada je primljena poruka WM_PAINT (poruka broj 15). Ovu poruku šalje sistem kada je prozor doživio takvu promjenu da ga je potrebno ponovo crtati (recimo, otkriven nakon što je bio prekriven ili su mu promijenjene dimenzije.

Unutar funkcije OnWMPaint iscrtava se predviđeni lik. Funkcijom BeginPaint, koja ima dva parametra: struktura za crtanje i handle na prozor, daje se informacija Windowsu da se počinje sa iscrtavanjem. Struktura za crtanje je slog koji sadrži informacije o pravougaoniku koji se iscrtava. Rezultat funkcije BeginPaint je handle na kontekst uređaja (device context). Crtanje se završava funkcijom EndPaint koja ima iste argumente.cijeli funkcija OnWMPaint(cijeli hwnd){ hdc:=BeginPaint(&pstruct,hwnd); MoveToEx(0,250,400,hdc); LineTo(250,480,hdc); LineTo(310,480,hdc); LineTo(310,400,hdc); LineTo(250,400,hdc); TextOutA(5,"CBLTV",253,403,hdc); Ellipse(294,470,264,410, hdc); EndPaint(&pstruct,hwnd);

Page 125: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

}

Između funkcija BeginPaint i EndPaint mogu se vidjeti funkcije za crtanje. Prvi parametar funkcije MoveToEx, koja služi za postavljanje početne tačke je pointer na slog koji bi vratio prethodne koordinate ili vrijednost 0 ukoliko prethodne koordinate nije potrebno očitavati. Drugi parametar predstavlja y koordinatu tačke, treći parametar predstavlja x koordinatu, a četvrti hendl na kontekst uređaja. Tačka postavljena funkcijom MoveToEx je početna tačka za iscrtavanje linija. Linije se dalje iscrtava do tačke čije su y i x koordinate navedene kao prvi i drugi parametar funkcije LineTo. Krajnja tačka tako iscrtane linije postaje početna tačka za novu liniju.

Ispis teksta se obavlja funkcijom TextOutA. Prvi argument ove funkcije je broj bajtova koliko je velik string koji se ispisuje, drugi je sam string, treći i četvrti su same koordinate stringa a posljednji je handle na kontekst uređaja.

Moguće je iscrtavati i elipse. Funkcija Ellipse za argumente ima redom: y koordinatu donjeg desnog ugla kvadrata koji je opisuje, x koordinatu donjeg desnog ugla kvadrata koji je opisuje, y koordinatu gornjeg lijevog ugla kvadrata koji je opisuje, x koordinatu donjeg lijevog ugla kvadrata koji je opisuje i handle na kontekst uređaja.

15.15. Rezime poglavljaPod windowsom kontrole su takođe prozori. Svaka kontrola se kreira funkcijom CreateWindowExA i ima nekoliko

predefinisanih klasa. Sve kontrole osim radio tastera trebaju da za roditelja imaju glavni prozor. Radio tasteri se smještaju u grupe. Podaci koje kontrole šalju se očitavaju na različite načine. Dodatno iscrtani grafički elementi se trebaju crtati kao odgovor na poruku WM_PAINT. Sve funkcije za crtanje dio su podsistema koji se zove GDI i kao argument imaju handle na kontekst uređaja koji se prosljeđuje kao zadnji argument funkcija za crtanje.

- .

Page 126: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

16.SPISAK WIN32API FUNKCIJA

U prethodnim poglavljima upoznato je sa osnovama Windows API-ja. Sada slijedi spisak svih API funkcija koje savremene verzije Windowsa pružaju.

16.1. Najvažniji podsistemi Windows API-ja

Windows API je kompilacija različitih skupova funkcija namijenjenih programerima. Najvažniji njegovi dijelovi su:

- Windows Kernel

- Korisnički interfejs

- Grafički podsistem GDI

- Funkcije za slanje poruka MAPI

- Funkcije za rad sa interfejsom za telefon TAPI

- COM, objektni model za kooperaciju odvojenih aplikacija

- OLE/Active X, nadgradnja COMa za pravljenje aplikacija čije su komponente druge aplikacije

- ODBC, funkcije za pristup bazama podataka

- Kontrole unaprijeđenog korisničkog interfejsa

- DirectX, nadgradnja COMa za direktni pristup grafičkom hardveru i zvuku

- RASAPI za pristup preko modema

- Winsock za pravljenje Internet aplikacija

-MCI, za pristup multimedijalnim uređajima.

-OPENGL za trodimenzionalnu grafiku

- Standardni dijalozi

Api funkcija ima mnogo i jedini način da se one nauče je analizom gotovih programa. Stoga većina Windows API aplikacija ima standardan izgled. Tako na primjer, ODBC aplikacije izgledaju kao na slici Sl. 16.1.1:

Sl. 16.1.1. Osnovna ODBC aplikacija

Page 127: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

16.2. DLL datoteke u kojima se nalaze funkcijeStandardnim API funkcijama windowsa smatraju se one koje se nalaze u sljedećim DLL datotekama:

ACLUI.DLL Korisnički interfejs za kontrolu prava pristupaACTIVEDS.DLL Active Directory ServicesADVAPI32.DLL Razni sistemski pozivi uključujući sigurnost i registrybdnapi.DLL Web TV bibliotekabignums.dll Račun sa velikim brojevimaCAP.DLL DijagnostikaCOMCTL32.DLL Savremene kontrole korisničkog interfejsaCOMDLG32.DLL Standardni dijaloziCRTDLL.DLL Standardna C biblioteka, printf, sin itdCRYPT32.DLL Kriptografske funkcijectl3d32.dll Trodimenzionalni izgled kontrolad3dim.DLL Proširenje arhitekture Direct3DD3DRM.DLL Direct3D vektorske funkcije d3dxof.DLL Direct3D aplikacijska bibliotekadapi.DLL Za pristup direktoriju MS Exchangeaddraw.dll Direct Draw, glavna datotekadflayout.dll Definisanje rasporeda podataka u složeniim dokumentimaDINPUT.DLL DirectInput (za DirectX pristup joysticku, tastaturi, mišu)dlcapi.dll Pristupanje DLC protokolu za HP mrežne štampačeDPLAY.DLL DirectPlay, za igranje preko mrežeDPLAYX.DLL DirectPlay, proširenjeDSETUP.DLL Za instalaciju DirectXDSOUND.DLL DirectSound, zvuk u DirectXdynloader.dll Analiza OBJ datotekaedbbcli.DLL Alatke za MS Exchange servergc.dll Garbage collectorGDI32.DLL Grafičke biblioteke za prikaz linija i bitmapaglide2x.dll 3D biblioteka za 3DFX 3D grafičke akceleratoreglu32.dll Pomoćne funkcije koje OpenGL aplikacije koriste za prikaz 3D grafikeGLUT32.DLL Varijanta OpenGL sa izmjenjenim imenima funkcijaHLINK.DLL Rad sa hiperlinkovimaICMP.DLL Za komandu PINGICMUI.DLL Korisnički interfejs za Microsoft Color Matching System imagehlp.dll Za analiziranje EXE datotekaIMM32.DLL Unošenje azijskih UNICODE znakovaiphlpapi.DLL Informacije o mrežnoj konfiguraciji i statisticiIPROP.DLL Implementacija OlePropertySetKERNEL32.DLL Upravljanje memorijom i I/O operacijamaloadperf.dll Upravljanje perfomance monitoromLSAPI32.DLL Informacije o licenciranjulz32.dll Kompresija podatakamapi32.dll Slanje i obrada EMAIL porukamgmtapi.DLL Biblioteka za upravljanje resursima preko SNMPMPR.DLL Punjenje Network Neighboorhooda spiskom mašinaMPRAPI.DLL Pristup funkcijama za rutiranjeMSACM32.DLL Upravljanje audio kompresijommscms.DLL Color Matching biblioteka (prilikom štampe)MSI.DLL Windows InstallerMSLSP32.DLL Informacije o licenciranjuMSVCRT.DLL Microsoft C runtime bibliotekaMSVCRTD.DLL Microsoft C runtime biblioteka, debug verzija

MSVFW32.DLL Video for WindowsMSWSOCK.DLL Microsoftove nestandardne Winsock funkcijeNAL.DLL Sloj abstrakcije mreženetapi32.dll Za pristup Microsoftovim mrežamaNTDLL.DLL Za pristup internim funkcijama Windowsa NTNTMSAPI.DLL Removable Storage API (proširenje diskova trakama)

ODBC32.DLL Pristup bazama podatakaODBCCP32.dll Podešavanje ODBCole32.dll Osnovne OLE funkcijeOLEAUT32.DLL Ole automatizacijaoledlg.DLL OLE dijalozi (Insert Object)OLEPRO32.DLL Microsoftove vlastite OLE funkcijeopengl.dll Silicon Graphics OpenGL bibliotekaopengl32.dll Microsoft OpenGL Bibliotekapdh.dll Performance Data Helper penwin32.dll Za Windows koji se upravlja olovkompkdp32.dll Za Windows koji se upravlja olovkomPSAPI.DLL Spisak procesa koji se izvršavajuRASAPI32.DLL RAS Pristup sistemu preko modemarasdlg.dll Dijalozi koji se koriste u RASrassapi.dll RAS administracijske funkcijeRESUTILS.DLL Pristup Windows resursimaRICHED20.DLL RichEdit kontrolarpcns4.dll Name Service u pozivu udaljene procedure (RPC)RPCRT4.DLL API za poziv udaljene procedureRTM.DLL Upravljač tabelom rutiranjaSecur32.DLL Windows sigurnosne funkcijeSETUPAPI.DLL Instalacija WindowsaSHELL32.DLL Veza između aplikacije i FileManagera, ExploreraSHFOLDER.DLL Pristup specijalnim folderima (My Documents)SHLWAPI.DLL Pomoćne funkcije za pristup stazama, urlovima, registriju i bojamasnmpapi.dll Pristup SNMP funkcijama za praćenje mreže i serverasvrapi.dll Kontrola dijeljenih (share) resursa na Microsoft mrežitapi32.dll Telefonski APITOOLHELP.DLL Funkcije za debagiranje i praćenje sistemaURL.DLL Pokretanje Web browsera preko URL adreseURLMON.DLL Proširenje OLE32USER32.DLL Najbitnije funkcije za rad sa prozorima i kontrolamaUSERENV.DLL Pristup korisničkim profajlovimaversion.dll Informacije o broju verzije izvršnog programawebpost.dll Slanje Web stranica na internetwin32spl.dll Pristup printer spooleruWINFAX.DLL Rad sa telefaxomWININET.DLL Microsoft Internet funkcijewinmm.dll Windows multimedia APIwintrust.dll Autentifikacija tajnim i javnim ključemWOW32.dll Podrška 16 bitnim aplikacijamaWS2_32.DLL Winsock 2.0wsock32.dll Winsock APIwst.dll Working Set Tuner (optimalan broj stranica u RAMu)

16.3. Spisak API funkcijaSada su navedene sve dokumentovane funkcije koje se nalaze u pojedinim bibliotekama, a koje je moguće pozvati iz

FILDZAN-32 ili drugih programskih jezika. Puna sintaksa svake od njih, namjena i način korištenja mogu se naći na Internetu ili na CD-ovima Microsoft Developers Network. Ovdje su navedeni ime funkcije, biblioteka, oznaka NM/AW, broj parametara i kratki opis funkcije. Ako je navedena oznaka AW, tada se pri deklaraciji i pozivu funkcije njenom imenu dodaje slovo A za Ascii stringove ili W za Unicode stringove (npr CreateWindowEx se u Fildzan32 piše CreateWindowExA). Pri oznaci NM ovog sufiksa nema.

Page 128: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

AbortDoc,GDI32.DLL,NM,1, stops the current print job and erases everything drawn since the last call to the StartDoc function.AbortPath,GDI32.DLL,NM,1, closes and discards any paths in the specified device context.AbortPrinter,WINMM.DLL,NM,1, deletes a printer?s spool file if the printer is configured for spooling.AbortSystemShutdown,ADVAPI32.DLL,AW,1, stops a system shutdown started by using the InitiateSystemShutdown function.accept,WS2_32.DLL,NM,3, extracts the first connection on the queue of pending connections on socket s.accept,WSOCK32.DLL,NM,3, extracts the first connection on the queue of pending connections on socket s.AcceptEx,MSWSOCK.DLL,NM,8, combines several socket functions into a single API/kernel transition.AcceptEx,WSOCK32.DLL,NM,8, combines several socket functions into a single API/kernel transition.AcceptSecurityContext,SECUR32.DLL,NM,9,This function enables the server part of a transport application to establish a security context between the server and a remote client.AccessCheck,ADVAPI32.DLL,NM,8 is used by a server application to check aclient?s access to an object against the access control associatedwith the object.AccessCheckAndAuditAlarm,ADVAPI32.DLL,AW,11, performs an access validation and generates corresponding audit messages.AccessNtmsLibraryDoor,NTMSAPI.DLL,NM,3, unlocks the door of the specified library. If the library is busy, RSM queues the request and returns successfully.acmDriverAdd,MSACM32.DLL,AW,5, adds a driver to the list of available ACM drivers.acmDriverClose,MSACM32.DLL,NM,2, closes a previously opened ACM driver instance.acmDriverDetails,MSACM32.DLL,AW,3, queries a specified ACM driver to determine its capabilities.acmDriverEnum,MSACM32.DLL,NM,3 enumerates the available ACM drivers,continuing until there are no more drivers or the callback functionreturns FALSE.acmDriverID,MSACM32.DLL,NM,3 returns the handle of an ACM driveridentifier associated with an open ACM driver instance or streamhandle.acmDriverMessage,MSACM32.DLL,NM,4 sends a user-defined message to a given ACM driver instance.acmDriverOpen,MSACM32.DLL,NM,3 opens the specified ACM driver andreturns a driver instance handle that can be used to communicatewith the driver.acmDriverPriority,MSACM32.DLL,NM,3, modifies the priority and state of an ACM driver.acmDriverRemove,MSACM32.DLL,NM,2, removes an ACM driver from the list of available ACM drivers.acmFilterChoose,MSACM32.DLL,AW,1, creates an ACM-defined dialog box that enables the user to select a waveform-audio filter.acmFilterDetails,MSACM32.DLL,AW,3 queries the ACM for details about a filter with a specific waveform-audio filter tag.acmFilterEnum,MSACM32.DLL,AW,5, enumerates waveform-audio filters available for a given filter tag from an ACM driver.acmFilterTagDetails,MSACM32.DLL,AW,3, queries the ACM for details about a specific waveform-audio filter tag.acmFilterTagEnum,MSACM32.DLL,AW,5, will return MMSYSERR_NOERROR (zero) if no filter tags are to be enumerated.acmFormatChoose,MSACM32.DLL,AW,1 function creates an ACM-defined dialog box that enables the user to select a waveform-audio format.acmFormatDetails,MSACM32.DLL,AW,3, queries the ACM for format details for a specific waveform-audio format tag.acmFormatEnum,MSACM32.DLL,AW,5, enumerates waveform-audio formats available for a given format tag from an ACM driver.acmFormatSuggest,MSACM32.DLL,NM,5 queries the ACM or a specified ACMdriver to suggest a destination format for the supplied sourceformat.acmFormatTagDetails,MSACM32.DLL,AW,3, queries the ACM for details on a specific waveform-audio format tag.acmFormatTagEnum,MSACM32.DLL,AW,5, enumerates waveform-audio format tags available from an ACM driver.acmGetVersion,MSACM32.DLL,NM,0, returns the version number of the ACM.acmMetrics,MSACM32.DLL,NM,3, returns various metrics for the ACM or related ACM objects.acmStreamClose,MSACM32.DLL,NM,2 closes an ACM conversion stream. If the function is successful, the handle is invalidated.acmStreamConvert,MSACM32.DLL,NM,3, requests the ACM to perform a conversion on the specified conversion stream.acmStreamMessage,MSACM32.DLL,NM,4, sends a driver-specific message to an ACM driver.acmStreamOpen,MSACM32.DLL,NM,8, opens an ACM conversion stream.acmStreamPrepareHeader,MSACM32.DLL,NM,3, prepares an ACMSTREAMHEADER structure for an ACM stream conversion.acmStreamReset,MSACM32.DLL,NM,2 stops conversions for a given ACM stream. All pending buffers are marked as done and returned to the application.acmStreamSize,MSACM32.DLL,NM,4, returns a recommended size for a source or destination buffer on an ACM stream.acmStreamUnprepareHeader,MSACM32.DLL,NM,3 cleans up the preparation performed by the acmStreamPrepareHeader </native/sdk/win32/vfw/src/mmfu5dwy.htm> function for an ACM stream.AcquireCredentialsHandle,SECUR32.DLL,AW,9,Acquires a handle to preexisting credentials of a security principal.AcsLan,DLCAPI.DLL,NM,2 communicates with IBM mainframes or networkperipheral devices, such as printers connected directly to thenetwork, by using the data link control (DLC) protocol.ActivateKeyboardLayout,USER32.DLL,NM,2 The ActivateKeyboardLayout function activates a different keyboard layout and sets the active keyboard layout for the entire system rather than the calling thread.AddAccessAllowedAce,ADVAPI32.DLL,NM,4, adds an access-allowed ACE to an ACL.AddAccessDeniedAce,ADVAPI32.DLL,NM,4, adds an access-denied ACE to an ACL.AddAce,ADVAPI32.DLL,NM,5, adds one or more ACEs to a specified ACL.AddAtom,KERNEL32.DLL,AW,1, adds a character string to the local atom table and returns a unique value (an atom) identifying the string.AddAuditAccessAce,ADVAPI32.DLL,NM,6, adds a system-audit ACE to a system ACL.AddFontResource,GDI32.DLL,AW,1, adds the font resource from the specified file to the Windows font table.AddForm,WINMM.DLL,AW,3, adds a form to the list of available forms that can be selected for the specified printer.AddJob,WINMM.DLL,AW,5 obtains a path string that specifies a file that you can use to store a spooled print job. AddMonitor,WINMM.DLL,AW,3 installs a local printer monitor and links the configuration, data, and monitor files. AddNtmsMediaType,NTMSAPI.DLL,NM,3, adds the specified media type to the specified library if there is not currently a relation in the library object. The function then creates the system media pools if they do not exist.AddPort,WINMM.DLL,AW,3, adds the name of a port to the list of supported ports.AddPrinter,WINMM.DLL,AW,3 adds a printer to the list of supported printers for a specified server. AddPrinterConnection,WINMM.DLL,AW,1, adds a connection to the specified printer for the current user.

AddPrinterDriver,WINMM.DLL,AW,3, installs a local or remote printer driver and links the configuration, data, and driver files.AddPrintProcessor,WINMM.DLL,AW,5 installs a print processor on thespecified server and adds the print-processor name to an internallist of supported print processors.AddPrintProvidor,WINMM.DLL,AW,3, installs a local printer provider and links the configuration, data, and provider files.AdjustTokenGroups,ADVAPI32.DLL,NM,6, adjusts groups in the specified access token.AdjustTokenPrivileges,ADVAPI32.DLL,NM,6 enables or disables privileges in the specified access token.AdjustWindowRect,USER32.DLL,NM,3 calculates the required size of the window rectangle, based on the desired client-rectangle size.AdjustWindowRectEx,USER32.DLL,NM,4 calculates the required size of thewindow rectangle, based on the desired size of the clientrectangle.ADsBuildEnumerator,ACTIVEDS.DLL,NM,2 Builds an enumerator object for the specified Active Directory container object.ADsBuildVarArrayInt,ACTIVEDS.DLL,NM,3 Builds a VARIANT array from an array of DWORDS.ADsBuildVarArrayStr,ACTIVEDS.DLL,NM,3 Builds a VARIANT array from an array of Unicode strings.ADsEnumerateNext,ACTIVEDS.DLL,NM,4 Populates a VARIANT arrray with elements fetched from the indicated enumerator object. ADsFreeEnumerator,ACTIVEDS.DLL,NM,1 Frees an enumerator object previously created through ADsBuildEnumerator ADsGetLastError,ACTIVEDS.DLL,NM,5 Retrieves the calling thread?s last-error code value.ADsGetObject,ACTIVEDS.DLL,NM,3 In Active Directory, bind to an object given its path and primaryinterface identifier (IID).ADsOpenObject,ACTIVEDS.DLL,NM,6 In Active Directory, bind to an object using username and passwordcredentials.ADsSetLastError,ACTIVEDS.DLL,NM,3 Sets the calling thread?s last-error code value.AdvancedDocumentProperties,WINMM.DLL,AW,5 displays a printerconfiguration dialog box for the specified printer, allowing theuser to configure that printer.AllocateAndInitializeSid,ADVAPI32.DLL,NM,11, allocates and initializes a security identifier (SID) with up to eight subauthorities.AllocateLocallyUniqueId,ADVAPI32.DLL,NM,1, allocates a locally unique identifier (LUID).AllocateNtmsMedia,NTMSAPI.DLL,NM,6, allocates a piece of available media.AllocConsole,KERNEL32.DLL,NM,0, allocates a new console for the calling process.AngleArc,GDI32.DLL,NM,6, moves the current position to the ending point of the arc.AnimatePalette,GDI32.DLL,NM,4 replaces entries in the specified logical palette. AnimateWindow,USER32.DLL,NM,3, enables you to produce special effects when showing or hiding windows.AnyPopup,USER32.DLL,NM,0, indicates whether an owned, visible, top- level pop-up, or overlapped window exists on the screen.AppendMenu,USER32.DLL,AW,4, appends a new item to the end of the specified menu bar, drop-down menu, submenu, or shortcut menu.ApplyControlToken,SECUR32.DLL,NM,2,Provides a way to apply a control token to a security context.Arc,GDI32.DLL,NM,9, draws an elliptical arc.ArcTo,GDI32.DLL,NM,9, draws an elliptical arc.AreAllAccessesGranted,ADVAPI32.DLL,NM,2, checks whether a set of requested access rights has been granted.AreAnyAccessesGranted,ADVAPI32.DLL,NM,2, tests whether any of a set of requested access rights has been granted.AreFileApisANSI,KERNEL32.DLL,NM,0, determines whether a set of Win32 file functions is using the ANSI or OEM character set code page.ArrangeIconicWindows,USER32.DLL,NM,1, arranges all the minimized (iconic) child windows of the specified parent window.AssociateColorProfileWithDevice,MSCMS.DLL,AW,3, associates a specified color profile with a specified device.AttachThreadInput,USER32.DLL,NM,3, fails if either of the specified threads does not have a message queue.auxGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given auxiliary output device.auxGetNumDevs,WINMM.DLL,NM,0, retrieves the number of auxiliary output devices present in the system.auxGetVolume,WINMM.DLL,NM,2, retrieves the current volume setting of the specified auxiliary output device.auxOutMessage,WINMM.DLL,NM,4, sends a message to the given auxiliary output device.auxSetVolume,WINMM.DLL,NM,2, sets the volume of the specified auxiliary output device.BackupEventLog,ADVAPI32.DLL,AW,2, saves the specified event log to a backup file.BackupFree,EDBBCLI.DLL,NM,1, frees a backup memory buffer.BackupRead,KERNEL32.DLL,NM,7, reads data associated with a specified file or directory into a buffer.BackupSeek,KERNEL32.DLL,NM,6, seeks forward in a data stream initially accessed by using the BackupRead or BackupWrite function.BackupWrite,KERNEL32.DLL,NM,7, writes a stream of data from a buffer to a specified file or directory.BatchExport,DAPI.DLL,AW,1, exports objects from the Microsoft Exchange Server directory.BatchImport,DAPI.DLL,AW,1, imports directory service objects from a text file in a single function call.Beep,KERNEL32.DLL,NM,2, generates simple tones on the speaker.BeginDeferWindowPos,USER32.DLL,NM,1 allocates memory for a multiple-window - position structure and returns the handle to thestructure.BeginPaint,USER32.DLL,NM,2 prepares the specified window for paintingand fills a PAINTSTRUCT structure with information about thepainting.BeginPath,GDI32.DLL,NM,1, opens a path bracket in the specified device context.BeginUpdateResource,KERNEL32.DLL,AW,2 returns a handle that can be usedby the UpdateResource function to add, delete, or replace resourcesin an executable file.bind,WS2_32.DLL,NM,3, is used on an unconnected socket before subsequent calls to the connect or listen functions.bind,WSOCK32.DLL,NM,3, is used on an unconnected socket before subsequent calls to the connect or listen functions.BindImage,IMAGEHLP.DLL,NM,3, computes the virtual address of each imported function.BindImageEx,IMAGEHLP.DLL,NM,5, computes the virtual address of each function that is imported.BindMoniker,OLE32.DLL,NM,4,This function locates an object by means of its moniker, activates the object if it is inactive, and retrieves a pointer to the specified interface on that object.BitBlt,GDI32.DLL,NM,9 performs a bit-block transfer of the color datacorresponding to a rectangle of pixels from the specified sourcedevice context into a destination device context.BringWindowToTop,USER32.DLL,NM,1, brings the specified window to the top of the Z order.BroadcastSystemMessage,USER32.DLL,AW,5, sends a message to the specified recipients.BstrFromVector,OLEAUT32.DLL,NM,2,Returns a BSTR, assigning each element of the vector to a character in the BSTR.BuildCommDCB,KERNEL32.DLL,AW,2, fills a specified DCB structure with values specified in a device-control string.BuildCommDCBAndTimeouts,KERNEL32.DLL,AW,3 translates a device-definitionstring into appropriate device-control block codes and then placesthese codes into a device control block.

Page 129: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

BuildDisplayTable,MAPI32.DLL,NM,10, creates a display table from the property page data contained in one or more DTPAGE structures.BuildExplicitAccessWithName,ADVAPI32.DLL,AW,5, initializes an EXPLICIT_ACCESS structure with data specified by the caller.BuildImpersonateExplicitAccessWithName,ADVAPI32.DLL,AW,6, is provided for future use.BuildImpersonateTrustee,ADVAPI32.DLL,AW,2, is provided for future use.BuildSecurityDescriptor,ADVAPI32.DLL,AW,9, allocates and initializes a new security descriptor.BuildTrusteeWithName,ADVAPI32.DLL,AW,2, initializes a TRUSTEE structure.BuildTrusteeWithSid,ADVAPI32.DLL,AW,2, initializes a TRUSTEE structure.CallMsgFilter,USER32.DLL,AW,2 passes the specified message and hookcode to the hook procedures associated with the WH_SYSMSGFILTER andWH_MSGFILTER hooks.CallNamedPipe,KERNEL32.DLL,AW,7 connects to a message-type pipe (and waits if an instance of the pipe is not available), writes to and reads from the pipe, and then closes the pipe. CallNextHookEx,USER32.DLL,NM,4, passes the hook information to the next hook procedure in the current hook chain.CallWindowProc,USER32.DLL,AW,5, passes message information to the specified window procedure.CancelDC,GDI32.DLL,NM,1, cancels any pending operation on the specified device context (DC).CancelIo,KERNEL32.DLL,NM,1 cancels all pending input and output (I/O)operations that were issued by the calling thread for the specifiedfile handle.CancelNtmsLibraryRequest,NTMSAPI.DLL,NM,2, cancels outstanding RSM requests, such as calls to the CleanNtmsDrive function. If the library is busy, RSM queues the cancellation and returns success.CancelNtmsOperatorRequest,NTMSAPI.DLL,NM,2, cancels the specified RSM operator request.CancelWaitableTimer,KERNEL32.DLL,NM,1, sets the specified ?waitable? timer to the inactive state.CascadeWindows,USER32.DLL,NM,5, cascades the specified windows or the child windows of the specified parent window.CertAddCertificateContextToStore,CRYPT32.DLL,NM,4, adds a certificate context to the certificate store.CertAddCRLContextToStore,CRYPT32.DLL,NM,4, adds a certificate revocation list (CRL) context to the certificate store.CertAddCTLContextToStore,CRYPT32.DLL,NM,4, adds a certificate trust list (CTL) context to a certificate store.CertAddEncodedCertificateToStore,CRYPT32.DLL,NM,6, creates a certificate context from an encoded certificate and adds it to the certificate store.CertAddEncodedCRLToStore,CRYPT32.DLL,NM,6, creates a certificate revocation list (CRL) context from an encoded CRL and adds it to the certificate store. The function makes a copy of the CRL context before adding it to the store.CertAddEncodedCTLToStore,CRYPT32.DLL,NM,6, creates a certificate trust list (CTL) context from an encoded CTL and adds it to the certificate store. The function makes a copy of the CTL context before adding it to the store.CertAddEnhancedKeyUsageIdentifier,CRYPT32.DLL,NM,2, adds a usage identifier object identifier (OID) to the enhanced key usage (EKU) extended property of the certificate.CertAddSerializedElementToStore,CRYPT32.DLL,NM,8,Adds a serialized certificate, certificate revocation list (CRL), or certificate trust list (CTL) element to the store.CertAlgIdToOID,CRYPT32.DLL,NM,1,Converts a CryptoAPI algorithm identifier (ALG_ID) to an Abstract Syntax Notation One (ASN.1) object identifier (OID) string.CertCloseStore,CRYPT32.DLL,NM,2, closes a certificate store handle and reduces the reference count on the store. There needs to be a corresponding call to CertCloseStore for each successful call to the CertOpenStore or CertDuplicateStore functions.CertCompareCertificate,CRYPT32.DLL,NM,3, compares two certificates to determine whether they are identical.CertCompareCertificateName,CRYPT32.DLL,NM,3, compares two certificate CERT_NAME_BLOB structures to determine whether they are identical. The CERT_NAME_BLOB structures are used for the subject and the issuer of certificates.CertCompareIntegerBlob,CRYPT32.DLL,NM,2, compares two integer BLOBs to determine whether they represent equal numeric values.CertComparePublicKeyInfo,CRYPT32.DLL,NM,3, compares two encoded public keys to determine whether they are identical.CertCreateCertificateContext,CRYPT32.DLL,NM,3, creates a certificate context from an encoded certificate. The created context is not persisted to a certificate store. The function makes a copy of the encoded certificate within the created context.CertCreateCRLContext,CRYPT32.DLL,NM,3, creates a certificate revocation list (CRL) context from an encoded CRL. The created context is not persisted to a certificate store. It makes a copy of the encoded CRL within the created context.CertCreateCTLContext,CRYPT32.DLL,NM,3, creates a certificate trust list (CTL) context from an encoded CTL. The created context is not persisted to a certificate store. The function makes a copy of the encoded CTL within the created context.CertDeleteCertificateFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate context from the certificate store.CertDeleteCRLFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate revocation list (CRL) context from the certificate store.CertDeleteCTLFromStore,CRYPT32.DLL,NM,1, deletes the specified certificate trust list (CTL) context from a certificate store.CertDuplicateCertificateContext,CRYPT32.DLL,NM,1,Duplicates a certificate context by incrementing its reference count.CertDuplicateCRLContext,CRYPT32.DLL,NM,1, duplicates a certificate revocation list (CRL) context by incrementing its reference count.CertDuplicateCTLContext,CRYPT32.DLL,NM,1, duplicates a certificate trust list (CTL) context by incrementing its reference count.CertDuplicateStore,CRYPT32.DLL,NM,1,Duplicates a store handle by incrementing the store's reference count.CertEnumCertificateContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extended property associated with a certificate context.CertEnumCertificatesInStore,CRYPT32.DLL,NM,2,Retrieves the first or next certificate in a certificate store. Used in a loop, this function can retrieve in sequence all certificates in a certificate store.CertEnumCRLContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extended property associated with a certificate revocation list (CRL) context.CertEnumCTLContextProperties,CRYPT32.DLL,NM,2, retrieves the first or next extended property associated with a certificate trust list (CTL) context. Used in a loop, this function can retrieve in sequence all extended properties associated with a CTL context.CertEnumCTLsInStore,CRYPT32.DLL,NM,2, retrieves the first or next certificate trust list (CTL) context in a certificate store. Used in a loop, this function can retrieve in sequence all CTL contexts in a certificate store.CertFindAttribute,CRYPT32.DLL,NM,3, finds the first attribute in the CRYPT_ATTRIBUTE array, as identified by its object identifier (OID).CertFindCertificateInStore,CRYPT32.DLL,NM,6,Finds the first or next certificate context in a certificate store that matches a search criteria established by the dwFindType and its associated pvFindPara.CertFindCTLInStore,CRYPT32.DLL,NM,6, finds the first or next certificate trust list (CTL) context that matches search criteria established by the dwFindType and its associated pvFindPara.

CertFindExtension,CRYPT32.DLL,NM,3, finds the first extension in the CERT_EXTENSION array, as identified by its object identifier (OID).CertFindRDNAttr,CRYPT32.DLL,NM,2, finds the first RDN attribute identified by its object identifier (OID) in a list of the Relative Distinguished Names (RDN).CertFindSubjectInCTL,CRYPT32.DLL,NM,5, attempts to find the specified subject in a certificate trust list (CTL).CertFreeCertificateContext,CRYPT32.DLL,NM,1,Frees a certificate context by decrementing its reference count. When the reference count goes to zero, CertFreeCertificateContext frees the memory occupied by a certificate context.CertFreeCRLContext,CRYPT32.DLL,NM,1, frees a certificate revocation list (CRL) context by decrementing its reference count. When the reference count goes to zero, CertFreeCRLContext frees the memory occupied by a CRL context.CertFreeCTLContext,CRYPT32.DLL,NM,1, frees a certificate trust list (CTL) context by decrementing its reference count. When the reference count goes to zero, CertFreeCTLContext frees the memory occupied by a CTL context.CertGetCertificateContextProperty,CRYPT32.DLL,NM,4, retrieves the information contained in an extended property of a certificate context.CertGetCRLContextProperty,CRYPT32.DLL,NM,4, gets an extended property for the specified certificate revocation list (CRL) context.CertGetCRLFromStore,CRYPT32.DLL,NM,4,Gets the first or next certificate revocation list (CRL) context from the certificate store for the specified issuer.CertGetCTLContextProperty,CRYPT32.DLL,NM,4, retrieves an extended property of a certificate trust list (CTL) context.CertGetEnhancedKeyUsage,CRYPT32.DLL,NM,4, returns information from the enhanced key usage (EKU) extension or the EKU extended property of a certificate. EKUs indicate valid uses of the certificate.CertGetIntendedKeyUsage,CRYPT32.DLL,NM,4, acquires the intended key usage bytes from a certificate. The intended key usage can be in either the szOID_KEY_USAGE (CertGetIssuerCertificateFromStore,CRYPT32.DLL,NM,4,Retrieves the certificate context from the certificate store for the first or next issuer of the specified subject certificate. The new Certificate Chain Verification Functions are recommended instead of the use of this function.CertGetSubjectCertificateFromStore,CRYPT32.DLL,NM,3,Returns from a certificate store a subject certificate context uniquely identified by its issuer and serial number.CertIsRDNAttrsInCertificateName,CRYPT32.DLL,NM,4, compares the attributes in the certificate name with the specified CERT_RDN to determine whether all attributes are included there.CertNameToStr,CRYPT32.DLL,AW,5,Converts an encoded name in a CERT_NAME_BLOB structure to a null-terminated character string.CertOIDToAlgId,CRYPT32.DLL,NM,1, converts the Abstract Syntax Notation One (ASN.1) object identifier (OID) string to the CryptoAPI algorithm identifier (ALG_ID).CertOpenStore,CRYPT32.DLL,NM,5,Opens a certificate store using a specified store provider type.CertOpenSystemStore,CRYPT32.DLL,AW,2, is a simplified function used to open the most common system certificate store. To open certificate stores with more complex requirements, such as file-based or memory-based stores, use CertOpenStore.CertRDNValueToStr,CRYPT32.DLL,AW,4, converts a name in a CERT_RDN_VALUE_BLOB to a null-terminated character string.CertRemoveEnhancedKeyUsageIdentifier,CRYPT32.DLL,NM,2, removes a usage identifier object identifier (OID) from the enhanced key usage (EKU) extended property of the certificate.CertSaveStore,CRYPT32.DLL,NM,6,Saves the certificate store to a file or to a memory BLOB.CertSerializeCertificateStoreElement,CRYPT32.DLL,NM,4, serializes a certificate context's encoded certificate and its encoded properties. The result can be persisted to storage so that the certificate and properties can be retrieved at a later time.CertSerializeCRLStoreElement,CRYPT32.DLL,NM,4, serializes an encoded certificate revocation list (CRL) context and the encoded representation of its properties.CertSerializeCTLStoreElement,CRYPT32.DLL,NM,4, serializes an encoded certificate trust list (CTL) context and the encoded representation of its properties. The result can be persisted to storage so that the CTL and properties can be retrieved later.CertSetCertificateContextProperty,CRYPT32.DLL,NM,4, sets an extended property for a specified certificate context.CertSetCRLContextProperty,CRYPT32.DLL,NM,4, sets an extended property for the specified certificate revocation list (CRL) context.CertSetCTLContextProperty,CRYPT32.DLL,NM,4, sets an extended property for the specified certificate trust list (CTL) context.CertSetEnhancedKeyUsage,CRYPT32.DLL,NM,2, sets the enhanced key usage (EKU) property for the certificate.CertStrToName,CRYPT32.DLL,AW,7,Converts a null-terminated X.500 string to an encoded certificate name.CertVerifyCRLRevocation,CRYPT32.DLL,NM,4, check a CRL to determine whether a subject's certificate has or has not been revoked. The new Certificate Chain Verification Functions are recommended instead of the use of this function.CertVerifyCRLTimeValidity,CRYPT32.DLL,NM,2, verifies the time validity of a CRL.CertVerifyCTLUsage,CRYPT32.DLL,NM,7, verifies that a subject is trusted for a specified usage by finding a signed and time-valid CTL with the usage identifiers that contain the subject.CertVerifyRevocation,CRYPT32.DLL,NM,7,Checks the revocation status of the certificates contained in the rgpvContext array. If a certificate in the list is found to be revoked, no further checking is done.CertVerifySubjectCertificateContext,CRYPT32.DLL,NM,3, performs the enabled verification checks on a certificate by checking the validity of the certificate's issuer. The new Certificate Chain Verification Functions are recommended instead this function.CertVerifyTimeValidity,CRYPT32.DLL,NM,2, verifies the time validity of a certificate.CertVerifyValidityNesting,CRYPT32.DLL,NM,2, verifies that a subject certificate's time validity nests correctly within its issuer's time validity.ChangeClipboardChain,USER32.DLL,NM,2, removes a specified window from the chain of clipboard viewers.ChangeDisplaySettings,USER32.DLL,AW,2, changes the display settings to the specified graphics mode.ChangeIdleRoutine,MAPI32.DLL,NM,7, changes some or all of the characteristics of a FNIDLE - based idle routine.ChangeNtmsMediaType,NTMSAPI.DLL,NM,3, moves the specified PMID to the specified target media pool and sets the PMID's media type identifier to the media type of the target media pool.ChangeServiceConfig,ADVAPI32.DLL,AW,11, changes the configuration parameters of a service.CharLower,USER32.DLL,AW,1, converts a character string or a single character to lowercase.CharLowerBuff,USER32.DLL,AW,2, converts uppercase characters in a buffer to lowercase characters.CharNext,USER32.DLL,AW,1 returns a pointer to the next character in a string. CharNextEx,USER32.DLL,AW,3 The CharNextExA function retrieves the pointer to the next character in a string. CharPrev,USER32.DLL,AW,2, returns a pointer to the preceding character in a string.CharPrevEx,USER32.DLL,AW,4 retrieves the pointer to the preceding character in a string. CharToOem,USER32.DLL,AW,2, translates a string into the OEM-defined character set.CharToOemBuff,USER32.DLL,AW,3, translates a specified number of characters in a string into the OEM-defined character set.CharUpper,USER32.DLL,AW,1, converts a character string or a single character to uppercase.CharUpperBuff,USER32.DLL,AW,2, converts lowercase characters in a buffer to uppercase characters.

Page 130: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

CheckBitmapBits,MSCMS.DLL,NM,9, checks whether the pixels in a specified bitmap lie within the output gamut of a specified transform.CheckColors,MSCMS.DLL,NM,5, determines whether the colors in an array lie within the output gamut of a specified transform.CheckDlgButton,USER32.DLL,NM,3, changes the check state of a button control.CheckMenuItem,USER32.DLL,NM,3, sets the state of the specified menu item's check mark attribute to either checked or unchecked.CheckMenuRadioItem,USER32.DLL,NM,5, checks a specified menu item and makes it a radio item.CheckRadioButton,USER32.DLL,NM,4 adds a check mark to (checks) aspecified radio button in a group and removes a check mark from(clears) all other radio buttons in the group.CheckSumMappedFile,IMAGEHLP.DLL,NM,5, computes the checksum of the specified image file.ChildWindowFromPoint,USER32.DLL,NM,3, determines which, if any, of the child windows belonging to a parent window contains the specified point. ChildWindowFromPointEx,USER32.DLL,NM,4 determines which, if any, of the child windows belonging to the specified parent window contains the specified point. ChooseColor,COMDLG32.DLL,AW,1, creates a Color common dialog box that enables the user to select a color.ChooseFont,COMDLG32.DLL,AW,1, creates a Font common dialog box that enables the user to choose attributes for a logical font.ChoosePixelFormat,GDI32.DLL,NM,2 compares the generic pixel formats supported by Windows NT and any device pixel formats supported by special hardware accelerators with the pixel format you described, and returns the best match.Chord,GDI32.DLL,NM,9, draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a ?secant?).CleanNtmsDrive,NTMSAPI.DLL,NM,2, queues a cleaning request for the specified drive for cleaning.ClearCommBreak,KERNEL32.DLL,NM,1 restores character transmission for aspecified communications device and places the transmission line ina nonbreak state.ClearCommError,KERNEL32.DLL,NM,3 retrieves information about acommunications error and reports the current status of acommunications device.ClearEventLog,ADVAPI32.DLL,AW,2, clears the specified event log, and optionally saves the current copy of the logfile to a backup file.ClientToScreen,USER32.DLL,NM,2, replaces the client coordinates in the POINT structure with the screen coordinates.ClipCursor,USER32.DLL,NM,1, confines the cursor to a rectangular area on the screen.CloseClipboard,USER32.DLL,NM,0, closes the clipboard.CloseColorProfile,MSCMS.DLL,NM,1,This CloseColorProfile closes an open profile handle.CloseDesktop,USER32.DLL,NM,1, closes an open handle to a desktop object.CloseEnhMetaFile,GDI32.DLL,NM,1 closes an enhanced-metafile devicecontext and returns a handle that identifies an enhanced-formatmetafile.CloseEventLog,ADVAPI32.DLL,NM,1, closes the specified event log.CloseFigure,GDI32.DLL,NM,1, closes an open figure in a path.CloseHandle,KERNEL32.DLL,NM,1, closes an open object handle.CloseIMsgSession,MAPI32.DLL,NM,1, closes a message session and all the messages created within that session.CloseMetaFile,GDI32.DLL,NM,1, closes a metafile device context and returns a handle that identifies a Windows-format metafile.CloseNtmsNotification,NTMSAPI.DLL,NM,1, closes the specified open notification channel.CloseNtmsSession,NTMSAPI.DLL,NM,1, closes the specified RSM session.ClosePrinter,WINMM.DLL,NM,1, closes the specified printer object.CloseServiceHandle,ADVAPI32.DLL,NM,1 closes the handles created with OpenSCManager, OpenService or CreateServiceclosesocket,WS2_32.DLL,NM,1, closes a socket.closesocket,WSOCK32.DLL,NM,1, closes a socket.CloseWindow,USER32.DLL,NM,1, minimizes (but does not destroy) the specified window.CloseWindowStation,USER32.DLL,NM,1, closes an open window station handle.CLSIDFromProgID,OLE32.DLL,NM,2,Looks up a CLSID in the registry, given a ProgID.CLSIDFromString,OLE32.DLL,NM,2,Converts a string generated by the StringFromCLSID function back into the original CLSID.ClusWorkerCheckTerminate,RESUTILS.DLL,NM,1,The ClusWorkerCheckTerminate utility function determines whether a worker thread should exit as soon as possible.ClusWorkerCreate,RESUTILS.DLL,NM,3,The ClusWorkerCreate utility function creates a worker thread.ClusWorkerTerminate,RESUTILS.DLL,NM,1,The ClusWorkerTerminate utility function terminates a worker thread.CoAddRefServerProcess,OLE32.DLL,NM,0,Increments a global per-process reference count.CoBuildVersion,OLE32.DLL,NM,0,4.2 CoBuildVersion This function is obsolete. Requirements OS Versions: Windows CE 3.0 and later. Header: Objbase.h. Link Library: Ole32.lib.CoCopyProxy,OLE32.DLL,NM,2,This function makes a private copy of the specified proxy.CoCreateFreeThreadedMarshaler,OLE32.DLL,NM,2,Creates an aggregatable object capable of context-dependent marshaling.CoCreateGuid,OLE32.DLL,NM,1,Creates a GUID, a unique 128-bit integer used for CLSIDs and interface identifiers.CoCreateInstance,OLE32.DLL,NM,5,ExCreates an instance of a specific class on a specific machine.CoCreateInstanceEx,OLE32.DLL,NM,6,Creates an instance of a specific class on a specific machine.CoDisconnectObject,OLE32.DLL,NM,2,This function disconnects all remote process connections being maintained on behalf of all the interface pointers that point to a specified object. Only the process that actually manages the object should call CoDisconnectObject.CoDosDateTimeToFileTime,OLE32.DLL,NM,3,Converts the MS-DOS representation of the time and date to a FILETIME structure, which Win32 uses to determine the date and time.CoFileTimeNow,OLE32.DLL,NM,1, Pointer to return the FILETIME structure.CoFileTimeToDosDateTime,OLE32.DLL,NM,3,Converts a FILETIME into MS-DOS date and time values.CoFreeAllLibraries,OLE32.DLL,NM,0, This function frees all the DLLs that have been loaded with the CoLoadLibrary function (called internally by CoGetClassObject), regardless of whether they are currently in use.CoFreeLibrary,OLE32.DLL,NM,1,This function frees a library that, when loaded, was specified to be freed explicitly.CoFreeUnusedLibraries,OLE32.DLL,NM,0,Unloads any DLLs that are no longer in use and that, when loaded, were specified to be freed automatically.CoGetCallContext,OLE32.DLL,NM,2, Interface identifier (IID) of the call context that is being requested.CoGetCallerTID,OLE32.DLL,NM,1,Returns a GUID identifying the callers thread.CoGetClassObject,OLE32.DLL,NM,5,FromURL Returns a factory object for a given CLSID.CoGetClassObjectFromURL,URLMON.DLL,NM,10, Returns a factory object for a given CLSID.CoGetCurrentLogicalThreadId,OLE32.DLL,NM,1, This function is not yet supported.CoGetCurrentProcess,OLE32.DLL,NM,0, This function returns a value that is unique to the current thread. CoGetCurrentProcess can be used to avoid thread ID reuse problems. DWORD CoGetCurrentProcess(void); Return Value Unique DWORD value identifying the current thread.CoGetInstanceFromFile,OLE32.DLL,NM,8,This function creates a new object and initializes it from a file using IPersistFile::Load.

CoGetInterfaceAndReleaseStream,OLE32.DLL,NM,3,This function unmarshals a buffer containing an interface pointer and releases the stream when an interface pointer has been marshaled from another thread to the calling thread.CoGetMalloc,OLE32.DLL,NM,2,4.2 CoGetMalloc This function retrieves a pointer to the default OLE task memory allocator (which supports the system implementation of the IMallocCoGetMarshalSizeMax,OLE32.DLL,NM,6,4.2 CoGetMarshalSizeMax This function returns an upper bound on the number of bytes needed to marshal the specified interface pointer to theCoGetObject,OLE32.DLL,NM,4, Converts a display name into a moniker that identifies the object named, and then binds to the object identified by the moniker.CoGetPSClsid,OLE32.DLL,NM,2,This function returns the CLSID of the DLL that implements the proxy and stub for the specified interface.CoGetStandardMarshal,OLE32.DLL,NM,6,4.2 CoGetStandardMarshal This function creates a default, or standard, marshaling object in either the client process or the server process,CoGetState,OLE32.DLL,NM,1, This function is not yet supported.CoGetTIDFromIPID,OLE32.DLL,NM,1, This function is not yet supported.CoGetTreatAsClass,OLE32.DLL,NM,2,4.2 CoGetTreatAsClass This function returns the CLSID of an object that can emulate the specified object. HRESULT CoGetTreatAsClass( REFCLSIDCoImpersonateClient,OLE32.DLL,NM,0,Allows the server to impersonate the client of the current call for the duration of the call.CoInitialize,OLE32.DLL,NM,1 Initializes the COM library on the current thread and identifies the concurrency model as single-thread apartment CoInitializeEx,OLE32.DLL,NM,2,Initializes the COM library for use by the calling thread, sets the thread's concurrency model, and creates a new apartment for the thread if one is required.CoInitializeSecurity,OLE32.DLL,NM,9,Registers security and sets the default security values for the process. This function is called exactly once per process, either explicitly or implicitly. It can be called by the client, server, or both.CoIsHandlerConnected,OLE32.DLL,NM,1, This function determines whether a remote object is connected to the corresponding in-process object.CoIsOle1Class,OLE32.DLL,NM,1,This function determines if a given CLSID represents an OLE 1 object.CoLoadLibrary,OLE32.DLL,NM,2,Loads a specific DLL into the caller's process. CoLoadLibrary is equivalent to LoadLibraryEx. CoLoadLibrary does not do anything about the lifetime of the library.CoLockObjectExternal,OLE32.DLL,NM,3,4.2 CoLockObjectExternal This function is called either to lock an object to ensure that it stays in memory, or to release such a lock. CallCoMarshalHresult,OLE32.DLL,NM,2,This function marshals an HRESULT to the specified stream, from which it can be unmarshaled using the CoUnmarshalHresult function.CoMarshalInterface,OLE32.DLL,NM,6, This function writes into a stream the data required to initialize a proxy object in some client process. The COM library in the client process calls the CoUnmarshalInterface function to extract the data and initialize the proxy.CoMarshalInterThreadInterfaceInStream,OLE32.DLL,NM,3,Marshals an interface pointer from one thread to another thread in the same process.CombineRgn,GDI32.DLL,NM,4 combines two regions and stores the result in a third region. CombineTransform,GDI32.DLL,NM,3, concatenates two world-space to page- space transformations.CommConfigDialog,KERNEL32.DLL,AW,3, displays a driver-supplied configuration dialog box.CommDlgExtendedError,COMDLG32.DLL,NM,0, can return general error codes for any of the common dialog box functions.CommitUrlCacheEntry,WININET.DLL,AW,11,Stores data in the specified file in the Internet cache and associates it with the specified URL.CompareFileTime,KERNEL32.DLL,NM,2, compares two 64-bit file times.CompareString,KERNEL32.DLL,AW,6 compares two character strings, usingthe locale specified by the given identifier as the basis for thecomparison.CompleteAuthToken,SECUR32.DLL,NM,2, completes an authentication token.ConfigurePort,WINMM.DLL,AW,3, displays the port-configuration dialog box for a port on the specified server.connect,WS2_32.DLL,NM,3, establishes a connection to a specifed socket.connect,WSOCK32.DLL,NM,3, is used to create a connection to the to the specified destination.ConnectNamedPipe,KERNEL32.DLL,NM,2 enables a named pipe server process to wait for a client process to connect to an instance of a named pipe. ConnectToPrinterDlg,WINMM.DLL,NM,2, displays a dialog box that lets users browse and connect to printers on a network.ContinueDebugEvent,KERNEL32.DLL,NM,3 enables a debugger to continue a thread that previously reported a debugging event. ControlService,ADVAPI32.DLL,NM,3, sends a control code to a Win32-based service.ConvertDefaultLocale,KERNEL32.DLL,NM,1, converts a special default locale value to an actual locale identifier.ConvertThreadToFiber,KERNEL32.DLL,NM,1 converts the current thread into a fiber.CopyAcceleratorTable,USER32.DLL,AW,3, copies the specified accelerator table.CopyEnhMetaFile,GDI32.DLL,AW,2, copies the contents of an enhanced- format metafile to a specified file.CopyFile,KERNEL32.DLL,AW,3 copies an existing file to a new file. CopyFileEx,KERNEL32.DLL,AW,6, copies an existing file to a new file.CopyIcon,USER32.DLL,NM,1, copies the specified icon from another module to the current module.CopyImage,USER32.DLL,NM,5 creates a new image (icon, cursor, orbitmap) and copies the attributes of the specified image to the newone.CopyLZFile,LZ32.DLL,NM,2, is obsolete.CopyMetaFile,GDI32.DLL,AW,2, copies the content of a Windows-format metafile to the specified file.CopyRect,USER32.DLL,NM,2, copies the coordinates of one rectangle to another.CopySid,ADVAPI32.DLL,NM,3, copies a security identifier (SID) to a buffer.CoQueryAuthenticationServices,OLE32.DLL,NM,2,4.2 CoQueryAuthenticationServices This function retrieves a list of the authentication services registered when the process called . HRESULTCoQueryClientBlanket,OLE32.DLL,NM,7, This function is called by the server to find out about the client that invoked the method executing on the current thread.CoQueryProxyBlanket,OLE32.DLL,NM,8,4.2 CoQueryProxyBlanket This function retrieves the authentication information the client uses to make calls on the specified proxy. HRESULTCoQueryReleaseObject,OLE32.DLL,NM,1, This function is not yet supported.CoRegisterChannelHook,OLE32.DLL,NM,2, This function is not yet supported.CoRegisterClassObject,OLE32.DLL,NM,5,Registers an EXE class object with OLE so other applications can connect to it. EXE object applications should call CoRegisterClassObject on startup.CoRegisterMallocSpy,OLE32.DLL,NM,1, This function registers an implementation of the IMallocSpy interface in OLE, thereafter requiring OLE to call its wrapper methods around every call to the corresponding IMalloc method.CoRegisterMessageFilter,OLE32.DLL,NM,2,Registers with OLE the instance of an IMessageFilter interface, which is to be used for handling concurrency issues on the current thread. Only one message filter can be registered for each thread.CoRegisterPSClsid,OLE32.DLL,NM,2,This function enables a downloaded DLL to register its custom interfaces within its running process so that the marshaling code will be able to marshal those interfaces.CoReleaseMarshalData,OLE32.DLL,NM,1,This function destroys a previously marshaled data packet.

Page 131: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

CoReleaseServerProcess,OLE32.DLL,NM,0,Decrements the global per-process reference count.CoResumeClassObjects,OLE32.DLL,NM,0,4.2 CoResumeClassObjects This function is called by a server that can register multiple class objects to inform the OLE SCM about all registeredCoRevertToSelf,OLE32.DLL,NM,0,This function restores the authentication information on a thread of execution.CoRevokeClassObject,OLE32.DLL,NM,1, This function informs OLE that a class object, previously registered with the CoRegisterClassObject function, is no longer available for use.CoRevokeMallocSpy,OLE32.DLL,NM,0,This function revokes a registered IMallocSpy object.CoSetProxyBlanket,OLE32.DLL,NM,8,Sets the authentication information that will be used to make calls on the specified proxy. This is a helper function for IClientSecurity::SetBlanket.CoSetState,OLE32.DLL,NM,1, This function is not yet supported.CoSuspendClassObjects,OLE32.DLL,NM,0,4.2 CoSuspendClassObjects This function prevents any new activation requests from the SCM on all class objects registered within the process.CoSwitchCallContext,OLE32.DLL,NM,2, This function switches the call context object used by CoGetCallContext.CoTaskMemAlloc,OLE32.DLL,NM,1,Allocates a block of task memory in the same way that IMalloc::Alloc does.CoTaskMemFree,OLE32.DLL,NM,1,Frees a block of task memory previously allocated through a call to the CoTaskMemAlloc or CoTaskMemRealloc function.CoTaskMemRealloc,OLE32.DLL,NM,2,Changes the size of a previously allocated block of task memory.CoTreatAsClass,OLE32.DLL,NM,2, This function establishes or removes an emulation, in which objects of one class are treated as objects of a different class.CoUninitialize,OLE32.DLL,NM,0,Closes the COM library on the current thread, unloads all DLLs loaded by the thread, frees any other resources that the thread maintains, and forces all RPC connections on the thread to close.CoUnmarshalHresult,OLE32.DLL,NM,2, Pointer to the stream from which the HRESULT is to be unmarshaled.CoUnmarshalInterface,OLE32.DLL,NM,3,4.2 CoUnmarshalInterface This function initializes a newly created proxy using data written into the stream by a previous call to the function, andCountClipboardFormats,USER32.DLL,NM,0 retrieves the number of different data formats currently on the clipboard. CPlApplet,ODBCCP32.DLL,NM,4, is a library-defined callback function that serves as the entry point for a Control Panel application.CreateAcceleratorTable,USER32.DLL,AW,2, creates an accelerator table.CreateAntiMoniker,OLE32.DLL,NM,1, Address of IMoniker* pointer variable that receives the interface pointer to the new anti-moniker.CreateAsyncBindCtx,URLMON.DLL,NM,4, Creates an asynchronous bind context for use with asynchronous monikers.CreateBindCtx,OLE32.DLL,NM,2,This function supplies a pointer to an implementation of IBindCtx, an object that stores information about a particular moniker-binding operation.CreateBitmap,GDI32.DLL,NM,5, creates a bitmap with the specified width, height, and color format (color planes and bits per pixel).CreateBitmapIndirect,GDI32.DLL,NM,1 creates a bitmap with thespecified width, height, and color format (color planes and bitsper pixel).CreateBrushIndirect,GDI32.DLL,NM,1, creates a logical brush that has the specified style, color, and pattern.CreateCaret,USER32.DLL,NM,4, creates a new shape for the system caret and assigns ownership of the caret to the specified window.CreateClassMoniker,OLE32.DLL,NM,2,Creates a class moniker that refers to the given class.CreateColorTransform,MSCMS.DLL,AW,4, creates a color transform that applications can use to perform color management.CreateCompatibleBitmap,GDI32.DLL,NM,3 creates a bitmap compatiblewith the device that is associated with the specified devicecontext.CreateCompatibleDC,GDI32.DLL,NM,1, can only be used with devices that support raster operations.CreateConsoleScreenBuffer,KERNEL32.DLL,NM,5, creates a console screen buffer and returns a handle of it.CreateCursor,USER32.DLL,NM,7 creates a cursor having the specified size, bit patterns, and hot spot. CreateDataAdviseHolder,OLE32.DLL,NM,1,Supplies a pointer to the OLE implementation of IDataAdviseHolder on the data advise holder object.CreateDataCache,OLE32.DLL,NM,4,Supplies a pointer to a new instance of an OLE-provided implementation of a data cache.CreateDC,GDI32.DLL,AW,4, creates a device context (DC) for a device by using the specified name.CreateDesktop,USER32.DLL,AW,6, returns a handle that can be used to access the desktop.CreateDeviceLinkProfile,MSCMS.DLL,NM,4, creates a device link profile from a set of color profiles, using the specified intents.CreateDialogIndirectParam,USER32.DLL,AW,5, creates a modeless dialog box from a dialog box template in memory.CreateDialogParam,USER32.DLL,AW,5, creates a modeless dialog box from a dialog box template resource.CreateDIBitmap,GDI32.DLL,NM,6 creates a device-dependent bitmap (DDB)from a device-independent bitmap (DIB) and, optionally, sets thebitmap bits.CreateDIBPatternBrush,GDI32.DLL,NM,2 creates a logical brush that has the pattern specified by the specified device-independent bitmap (DIB). CreateDIBPatternBrushPt,GDI32.DLL,NM,2 creates a logical brush that has the pattern specified by the device-independent bitmap (DIB). CreateDIBSection,GDI32.DLL,NM,6, creates a device-independent bitmap (DIB) that applications can write to directly.CreateDirectory,KERNEL32.DLL,AW,2, creates a new directory.CreateDirectoryEx,KERNEL32.DLL,AW,3 creates a new directory with a specified path that retains the attributes of a specified template directory.CreateDiscardableBitmap,GDI32.DLL,NM,3, creates a discardable bitmap that is compatible with the specified device.CreateDispTypeInfo,OLEAUT32.DLL,NM,3,Creates simplified type information for use in an implementation of IDispatch.CreateEllipticRgn,GDI32.DLL,NM,4, creates an elliptical region.CreateEllipticRgnIndirect,GDI32.DLL,NM,1, creates an elliptical region.CreateEnhMetaFile,GDI32.DLL,AW,4, creates a device context for an enhanced-format metafile.CreateEnvironmentBlock,USERENV.DLL,NM,3, retrieves the environment variables for the specified user. This block can then be passed to the CreateProcessAsUser function.CreateErrorInfo,OLEAUT32.DLL,NM,1, This function creates an instance of a generic error object. CreateEvent,KERNEL32.DLL,AW,4, creates a named or unnamed event object.CreateFiber,KERNEL32.DLL,NM,3 allocates a fiber object, assigns it astack, and sets up execution to begin at the specified startaddress, typically the fiber function.CreateFile,KERNEL32.DLL,AW,7, creates or opens file CreateFileMapping,KERNEL32.DLL,AW,6, creates a named or unnamed file- mapping object for the specified file.CreateFileMoniker,OLE32.DLL,NM,2,creates a file moniker based on the specified path.CreateFont,GDI32.DLL,AW,14, creates a logical font that has specific characteristics.

CreateFontIndirect,GDI32.DLL,AW,1, creates a logical font that has the characteristics specified in the specified structure.CreateFormatEnumerator,URLMON.DLL,NM,3, Creates an object that implements IEnumFORMATETC over a static array of FORMATETC structures.CreateGenericComposite,OLE32.DLL,NM,3,4.2 CreateGenericComposite This function performs a generic composition of two monikers and supplies a pointer to the resulting composite moniker.CreateHalftonePalette,GDI32.DLL,NM,1 creates a halftone palette for the specified device context. CreateHatchBrush,GDI32.DLL,NM,2, creates a logical brush that has the specified hatch pattern and color.CreateIC,GDI32.DLL,AW,4 creates an information context for the specified device. CreateIcon,USER32.DLL,NM,7, creates an icon that has the specified size, colors, and bit patterns.CreateIconFromResource,USER32.DLL,NM,4, creates an icon or cursor from resource bits describing the icon.CreateIconFromResourceEx,USER32.DLL,NM,7, creates an icon or cursor from resource bits describing the icon.CreateIconIndirect,USER32.DLL,NM,1, creates an icon or cursor from an ICONINFO structure.CreateILockBytesOnHGlobal,OLE32.DLL,NM,3,Creates a byte array object, using global memory as the physical device, which is intended to be the compound file foundation.CreateIoCompletionPort,KERNEL32.DLL,NM,4 can associate an instance of an opened file with a newly created or an existing input/output completion port; or it can create an input/output completion port without associating it with a file.CreateIProp,MAPI32.DLL,NM,6, creates a property data object, that is, an IPropData object.CreateItemMoniker,OLE32.DLL,NM,3,This function creates an item moniker that identifies an object within a containing object (typically a compound document).CreateMailslot,KERNEL32.DLL,AW,4 creates a mailslot with the specifiedname and returns a handle that a mailslot server can use to performoperations on the mailslot.CreateMappedBitmap,COMCTL32.DLL,NM,5, creates a bitmap for use in a toolbar.CreateMDIWindow,USER32.DLL,AW,10, creates a multiple document interface (MDI) child window.CreateMenu,USER32.DLL,NM,0, creates a menu.CreateMetaFile,GDI32.DLL,AW,1, creates a device context for a Windows-meta file.CreateMultiProfileTransform,MSCMS.DLL,NM,6, accepts an array of profiles or a single device link profile and creates a color transform thatCreateMutex,KERNEL32.DLL,AW,3, creates a named or unnamed mutex object.CreateNamedPipe,KERNEL32.DLL,AW,8 creates an instance of a named pipe and returns a handle for subsequent pipe operations.CreateNtmsMedia,NTMSAPI.DLL,AW,4,The CreateNtmsMediaPool function creates a new application media pool.CreateNtmsMediaPool,NTMSAPI.DLL,AW,6, creates a new application media pool.CreateOleAdviseHolder,OLE32.DLL,NM,1, instantiates an advise holder object for managing compound document notifications. It passes out a pointer toCreatePalette,GDI32.DLL,NM,1, creates a logical color palette.CreatePatternBrush,GDI32.DLL,NM,1, creates a logical brush with the specified bitmap pattern.CreatePen,GDI32.DLL,NM,3, creates a logical pen that has the specified style, width, and color.CreatePenIndirect,GDI32.DLL,NM,1, creates a logical cosmetic pen that has the style, width, and color specified in a structure.CreatePipe,KERNEL32.DLL,NM,4, creates an anonymous pipe, and returns handles to the read and write ends of the pipe.CreatePointerMoniker,OLE32.DLL,NM,2, This function creates a pointer moniker based on a pointer to an object.CreatePolygonRgn,GDI32.DLL,NM,3, creates a polygonal region.CreatePolyPolygonRgn,GDI32.DLL,NM,4, creates a region consisting of a series of polygons.CreatePopupMenu,USER32.DLL,NM,0, creates a drop-down menu, submenu, or shortcut menu.CreatePrivateObjectSecurity,ADVAPI32.DLL,NM,6 allocates and initializesa self-relative security descriptor for a new protected server?sis being created.CreateProcess,KERNEL32.DLL,AW,10, creates a new process and its primary thread.CreateProcessAsUser,ADVAPI32.DLL,AW,11, creates a new process and its primary thread.CreateProfileFromLogColorSpace,MSCMS.DLL,AW,2, converts a logical color space to aCreatePropertySheetPage,COMCTL32.DLL,AW,1, creates a new page for a property sheet.CreateRectRgn,GDI32.DLL,NM,4 creates a rectangular region.CreateRectRgnIndirect,GDI32.DLL,NM,1, creates a rectangular region.CreateRemoteThread,KERNEL32.DLL,NM,7, creates a thread that runs in the address space of another process.CreateRoundRectRgn,GDI32.DLL,NM,6, creates a rectangular region with rounded corners.CreateScalableFontResource,GDI32.DLL,AW,4, creates a font resource file for a scalable font.CreateSemaphore,KERNEL32.DLL,AW,4, creates a named or unnamed semaphore object.CreateService,ADVAPI32.DLL,AW,13, creates a service object and adds it to the specified service control manager database.CreateSolidBrush,GDI32.DLL,NM,1, creates a logical brush that has the specified solid color.CreateStatusWindow,COMCTL32.DLL,AW,4, creates a status window, which is typically used to display the status of an application.CreateStdDispatch,OLEAUT32.DLL,NM,4,Creates a standard implementation of the IDispatch interface through a single function call. This simplifies exposing objects through Automation.CreateStreamOnHGlobal,OLE32.DLL,NM,3,Creates a stream object stored in global memory.CreateTable,MAPI32.DLL,NM,9 creates structures and an object handle for a table data object an ITableData object which can be used to create table contents.CreateTapePartition,KERNEL32.DLL,NM,4 reformats a tape.CreateTextServices,RICHED20.DLL,NM,3,creates an instance of a text services object. CreateThread,KERNEL32.DLL,NM,6, creates a thread to execute within the address space of the calling process.CreateToolbarEx,COMCTL32.DLL,NM,13, creates a toolbar window and adds the specified buttons to the toolbar.CreateToolhelp32Snapshot,TOOLHELP.DLL,NM,2, takes a snapshot of the specified processes in the system, as well as the heaps, modules, and threads used by these processes.CreateTypeLib,OLEAUT32.DLL,NM,3, creates a type library in the current file format.CreateTypeLib2,OLEAUT32.DLL,NM,3, creates a type library in the current file format.CreateUpDownControl,COMCTL32.DLL,NM,12, creates an up-down control.CreateUrlCacheEntry,WININET.DLL,AW,5,Creates a local file name for saving the cache entry based on the specified URL and the file extension.CreateUrlCacheGroup,WININET.DLL,NM,2,Generates cache group identifications.CreateURLMoniker,URLMON.DLL,NM,3, Creates a URL moniker from either a full URL string or from a base context URL moniker and a partial URL string.CreateUserProfile,USERENV.DLL,AW,5 creates a user profile with the specified account name and preferred name.CreateWaitableTimer,KERNEL32.DLL,AW,3, creates a ?waitable? timer object.CreateWindow,USER32.DLL,AW,1 creates an overlapped, pop-up, or childwindowCreateWindowEx,USER32.DLL,AW,12 creates an overlapped, pop-up, or childwindow with an extended style; otherwise, this function isidentical to the CreateWindow function.CreateWindowStation,USER32.DLL,AW,4, creates a window station object.CryptAcquireContext,ADVAPI32.DLL,AW,5,used to acquire a handle to a particular key container within a particular CSP. CryptCreateHash,ADVAPI32.DLL,NM,5,used to initiate the hashing of a stream of data. It returns to the caller a handle to a CSP hash object.

Page 132: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

CryptDecodeMessage,CRYPT32.DLL,NM,13,Decodes, decrypts, and verifies a cryptographic message.CryptDecodeObject,CRYPT32.DLL,NM,7, decodes a structure of the type indicated by the lpszStructType parameter. The use of CryptDecodeObjectEx is recommended as an API that performs the same function with significant performance improvements.CryptDecrypt,ADVAPI32.DLL,NM,6,The CryptDecryptAndVerifyMessageSignature function decrypts a message and verifies its signature.CryptDecryptAndVerifyMessageSignature,CRYPT32.DLL,NM,9, decrypts a message and verifies its signature.CryptDecryptMessage,CRYPT32.DLL,NM,6, decodes and decrypts a message.CryptDeriveKey,ADVAPI32.DLL,NM,5,generates cryptographic keys derived from base data. CryptDestroyHash,ADVAPI32.DLL,NM,1,destroys the hash object referenced by the hHash parameter. CryptDestroyKey,ADVAPI32.DLL,NM,1,releases the handle referenced by the hKey parameter. CryptEncodeObject,CRYPT32.DLL,NM,5, encodes a structure of the type indicated by the value of the lpszStructType parameter. The use of CryptEncodeObjectEx is recommended as an API that performs the same function with significant performance improvements.CryptEncrypt,ADVAPI32.DLL,NM,7,is used to encrypt data.CryptEncryptMessage,CRYPT32.DLL,NM,7, encrypts and encodes a message.CryptEnumOIDFunction,CRYPT32.DLL,NM,6, enumerates the registered object identifier (OID) functions.CryptExportKey,ADVAPI32.DLL,NM,6,used to export cryptographic keys out of a cryptographic service provider in a secure manner.CryptExportPublicKeyInfo,CRYPT32.DLL,NM,5, exports the public key information associated with the corresponding private key of the provider. For an updated version of this function, see CryptExportPublicKeyInfoEx.CryptExportPublicKeyInfoEx,CRYPT32.DLL,NM,8, exports the public key information associated with the provider's corresponding private key.CryptFormatObject,CRYPT32.DLL,NM,9, formats the encoded data and returns a Unicode string in the allocated buffer according to the certificate encoding type.CryptFreeOIDFunctionAddress,CRYPT32.DLL,NM,2, releases a handle returned by CryptGetOIDFunctionAddress or CryptGetDefaultOIDFunctionAddress by decrementing the reference count on the function handle.CryptGenKey,ADVAPI32.DLL,NM,4,generates random cryptographic keys for use with the CSP module.CryptGenRandom,ADVAPI32.DLL,NM,3,fills a buffer with random bytes.CryptGetDefaultOIDDllList,CRYPT32.DLL,NM,4, acquires the list of the names of DLL files that contain registered default object identifier (OID) functions for a specified function set and encoding type.CryptGetDefaultOIDFunctionAddress,CRYPT32.DLL,NM,6, loads the DLL that contains a default function address.CryptGetHashParam,ADVAPI32.DLL,NM,5,retrieves data that governs the operations of a hash object. CryptGetKeyParam,ADVAPI32.DLL,NM,5,retrieves data that govern the operations of a key. CryptGetMessageCertificates,CRYPT32.DLL,NM,5, returns the handle of an open certificate store containing the message's certificates and CRLs. This function calls CertOpenStore using provider type CERT_STORE_PROV_PKCS7 as its lpszStoreProvider parameter.CryptGetMessageSignerCount,CRYPT32.DLL,NM,3, returns the number of signers of a signed message.CryptGetOIDFunctionAddress,CRYPT32.DLL,NM,6, searches the list of registered and installed functions for an encoding type and object identifier (OID) match.CryptGetOIDFunctionValue,CRYPT32.DLL,NM,7, queries a value associated with an OID.CryptGetProvParam,ADVAPI32.DLL,NM,5,retrieves parameters that govern the operations of a CSP.CryptGetUserKey,ADVAPI32.DLL,NM,3,retrieves a handle to a permanent user key pair, such as the user?s signature key pair.CryptHashCertificate,CRYPT32.DLL,NM,7, hashes the entire encoded content of a certificate including its signature.CryptHashData,ADVAPI32.DLL,NM,4,used to compute the cryptographic hash on a stream of data.CryptHashMessage,CRYPT32.DLL,NM,9, creates a hash of the message.CryptHashPublicKeyInfo,CRYPT32.DLL,NM,7, encodes the public key information in a CERT_PUBLIC_KEY_INFO structure and computes the hash of the encoded bytes. The hash created is used with key identifier functions.CryptHashSessionKey,ADVAPI32.DLL,NM,3,used to compute the cryptographic hash on a key object. CryptHashToBeSigned,CRYPT32.DLL,NM,6, computes the hash of the encoded content from a signed and encoded certificate. The hash is performed on only theCryptImportKey,ADVAPI32.DLL,NM,6,is used to transfer a cryptographic key from a key blob to the CSP.CryptImportPublicKeyInfo,CRYPT32.DLL,NM,4, converts and imports the public key information into the provider and returns a handle of the public key. CryptImportPublicKeyInfoEx provides a revised version of this function.CryptImportPublicKeyInfoEx,CRYPT32.DLL,NM,7, imports public key information into the cryptographic service provider (CSP) and returns a handle of the public key.CryptInitOIDFunctionSet,CRYPT32.DLL,NM,2,The CryptInitOIDFunctionSet initializes and returns the handle of the OID function set identified by a supplied function set name.CryptInstallOIDFunctionAddress,CRYPT32.DLL,NM,6, installs a set of callable object identifier (OID) function addresses.CryptMsgCalculateEncodedLength,CRYPT32.DLL,NM,6, calculates the maximum number of bytes need for an encoded cryptographic message given the message type, encoding parameters, and total length of the data to be encoded.CryptMsgClose,CRYPT32.DLL,NM,1, closes a cryptographic message handle. At each call to this function, the reference count on the message is reduced by one. When the reference count reaches zero, the message is fully released.CryptMsgControl,CRYPT32.DLL,NM,4, performs a control operation after a message has been decoded by a final call to the CryptMsgUpdate function.CryptMsgCountersign,CRYPT32.DLL,NM,4, countersigns an existing signature in a message.CryptMsgCountersignEncoded,CRYPT32.DLL,NM,7, countersigns an existing PKCS #7 message signature.CryptMsgEncodeAndSignCTL,CRYPT32.DLL,NM,6, encodes a CTL and creates a signed message containing the encoded CTL.This function first encodes the CTL pointed to by pCtlInfo and then calls CryptMsgSignCTL to sign the encoded message.CryptMsgGetAndVerifySigner,CRYPT32.DLL,NM,6, verifies a cryptographic message's signature.CryptMsgGetParam,CRYPT32.DLL,NM,5, acquires a message parameter after a cryptographic message has been encoded or decoded. This function is called after the final CryptMsgUpdate call.CryptMsgOpenToDecode,CRYPT32.DLL,NM,6,Opens a cryptographic message for decoding and returns a handle of the opened message.CryptMsgOpenToEncode,CRYPT32.DLL,NM,6, opens a cryptographic message for encoding and returns a handle of the opened message. The message remains open until CryptMsgClose is called.CryptMsgSignCTL,CRYPT32.DLL,NM,7, creates a signed message containing an encoded CTL.CryptMsgUpdate,CRYPT32.DLL,NM,4, adds contents to a cryptographic message.CryptMsgVerifyCountersignatureEncoded,CRYPT32.DLL,NM,7, verifies the countersignature of a message.

CryptRegisterDefaultOIDFunction,CRYPT32.DLL,NM,4,The CryptRegisterDefaultOIDFunction registers a DLL containing the default function to be called for the specified encoding type and function name. Unlike CryptRegisterOIDFunction, the function name to be exported by the DLL cannot be overridden.CryptRegisterOIDFunction,CRYPT32.DLL,NM,5,Registers a DLL that contains the function to be called for the specified encoding type, function name, and object identifier (OID).CryptReleaseContext,ADVAPI32.DLL,NM,2,is used to release a handle to a CSP and a key container.CryptSetHashParam,ADVAPI32.DLL,NM,4,in theory, customizes the operations of a hash object. CryptSetKeyParam,ADVAPI32.DLL,NM,4,customizes various aspects of a key?s operations.CryptSetOIDFunctionValue,CRYPT32.DLL,NM,7, sets a value for the specified encoding type, function name, OID, and value name.CryptSetProvider,ADVAPI32.DLL,AW,2,is used to specify the current user default CSP. CryptSetProvParam,ADVAPI32.DLL,NM,4,customizes the operations of a CSP.CryptSignAndEncodeCertificate,CRYPT32.DLL,NM,9,Security SDK content provides details about using authentication, authorization, cryptography, and related technologies in the Microsoft Windows Server, Windows, and Windows NT platforms.CryptSignAndEncryptMessage,CRYPT32.DLL,NM,8, creates a hash of the specified content, signs the hash, encrypts the content, hashes the encrypted contents and the signed hash, and then encodes both the encrypted content and the signed hash.CryptSignCertificate,CRYPT32.DLL,NM,9, signs theCryptSignHash,ADVAPI32.DLL,AW,6,is used to sign a piece of data.CryptSignMessage,CRYPT32.DLL,NM,7, creates a hash of the specified content, signs the hash, and then encodes both the original message content and the signed hash.CryptUnregisterDefaultOIDFunction,CRYPT32.DLL,NM,3, removes the registration of a DLL containing the default function to be called for the specified encoding type and function name.CryptUnregisterOIDFunction,CRYPT32.DLL,NM,3, removes the registration of a DLL containing the function to be called for the specified encoding type, function name, and OID.CryptVerifyCertificateSignature,CRYPT32.DLL,NM,5,Verifies the signature of a certificate, certificate revocation list (CRL), or certificate request by using the public key in a CERT_PUBLIC_KEY_INFO structure.CryptVerifyDetachedMessageHash,CRYPT32.DLL,NM,8, verifies a detached hash.CryptVerifyDetachedMessageSignature,CRYPT32.DLL,NM,8, verifies a signed message containing a detached signature or signatures.CryptVerifyMessageHash,CRYPT32.DLL,NM,7, verifies the hash of specified content.CryptVerifyMessageSignature,CRYPT32.DLL,NM,7,Verifies a signed message's signature.CryptVerifySignature,ADVAPI32.DLL,AW,6,is used to verify a signature against a hash object.DAPIAllocBuffer,DAPI.DLL,NM,2, allocates or reallocates a block of memory.DAPIEnd,DAPI.DLL,NM,1, closes a directory operation session.DAPIFreeMemory,DAPI.DLL,NM,1, releases or frees a block of memory.DAPIGetSiteInfo,DAPI.DLL,AW,3, retrieves the site information for a directory service agent.DAPIRead,DAPI.DLL,AW,6, reads (exports) attributes from a directory object.DAPIStart,DAPI.DLL,AW,2, initializes a directory operation session.DAPIUninitialize,DAPI.DLL,NM,1, terminates background processes.DAPIWrite,DAPI.DLL,AW,7, writes (imports) information to a directory object.DceErrorInqText,RPCRT4.DLL,AW,2, returns the message text for a status code.DdeAbandonTransaction,USER32.DLL,NM,3 abandons the specifiedasynchronous transaction and releases all resources associated withthe transaction.DdeAccessData,USER32.DLL,NM,2, provides access to the data in the specified dynamic data exchange (DDE) object.DdeAddData,USER32.DLL,NM,4, adds data to the specified dynamic data exchange (DDE) object.DdeClientTransaction,USER32.DLL,NM,8, begins a data transaction between a client and a server.DdeCmpStringHandles,USER32.DLL,NM,2, compares the values of two string handles.DdeConnect,USER32.DLL,NM,4 establishes a conversation with a server application that supports the specified service name and topic name pair. DdeCreateStringHandle,USER32.DLL,AW,3 creates a handle that identifies the string pointed to by the psz parameter. DdeConnectList,USER32.DLL,NM,5 establishes a conversation with allserver applications that support the specified service name andtopic name pair.DdeCreateDataHandle,USER32.DLL,NM,7 creates a dynamic data exchange(DDE) object and fills the object with data from the specifiedbuffer.DdeDisconnect,USER32.DLL,NM,1 terminates a conversation started byeither the DdeConnect or DdeConnectList function and invalidatesthe specified conversation handle.DdeDisconnectList,USER32.DLL,NM,1, destroys the specified conversation list and terminates all conversations associated with the list.DdeEnableCallback,USER32.DLL,NM,3 enables or disables transactions fora specific conversation or for all conversations currentlyestablished by the calling application.DdeFreeDataHandle,USER32.DLL,NM,1, frees a dynamic data exchange (DDE) object and deletes the data handle associated with the object.DdeFreeStringHandle,USER32.DLL,NM,2, frees a string handle in the calling application.DdeGetData,USER32.DLL,NM,4, copies data from the specified dynamic data exchange (DDE) object to the specified local buffer.DdeGetLastError,USER32.DLL,NM,1 returns the most recent error code set by the failure of a Dynamic Data Exchange Management Library (DDEML) function and resets the error code to DMLERR_NO_ERROR. DdeImpersonateClient,USER32.DLL,NM,1, impersonates a dynamic data exchange (DDE) client application in a DDE client conversation.DdeInitialize,USER32.DLL,AW,4, registers an application with the Dynamic Data Exchange Management Library (DDEML).DdeKeepStringHandle,USER32.DLL,NM,2, increments the usage count associated with the specified handle.DdeNameService,USER32.DLL,NM,4 registers or unregisters the service names a dynamic data exchange (DDE) server supports.DdePostAdvise,USER32.DLL,NM,3 causes the system to send an XTYP_ADVREQ transaction to the calling (server) application?s dynamic data exchange (DDE) callback function for each client with an active advise loop on the specified topic and item.DdeQueryConvInfo,USER32.DLL,NM,3 obtains information about a dynamic data exchange (DDE) transaction and about the conversation in which the transaction takes place. DdeQueryNextServer,USER32.DLL,NM,2 obtains the next conversation handle in the specified conversation list. DdeQueryString,USER32.DLL,AW,5 copies text associated with a string handle into a buffer. +DdeReconnect,USER32.DLL,NM,1 allows a client Dynamic Data Exchange Management Library (DDEML) application to attempt to reestablish a conversation with a service that has terminated a conversation with the client. DdeSetQualityOfService,USER32.DLL,NM,3 specifies the quality of service a raw DDE application desires for future DDE conversations it initiates.DdeSetUserHandle,USER32.DLL,NM,3, associates an application-defined 32- bit value with a conversation handle or a transaction identifier.DdeUnaccessData,USER32.DLL,NM,1, unaccesses a dynamic data exchange (DDE) object.DdeUninitialize,USER32.DLL,NM,1 frees all Dynamic Data ExchangeManagement Library (DDEML) resources associated with the callingapplication.DeallocateNtmsMedia,NTMSAPI.DLL,NM,3, deallocates the side associated with the specified logical media.DebugActiveProcess,KERNEL32.DLL,NM,1, allows a debugger to attach to an active process and then debug it.

Page 133: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

DebugBreak,KERNEL32.DLL,NM,0 causes a breakpoint exception to occur inthe current process so that the calling thread can signal thedebugger and force it to take some action.DecommissionNtmsMedia,NTMSAPI.DLL,NM,2, moves a side from the Available state to the Decommissioned state.DecryptMessage,SECUR32.DLL,NM,4,Decrypts a message by using Negotiate.DefDlgProc,USER32.DLL,AW,4 carries out default message processing fora window procedure belonging to an application-defined dialog boxclass.DefFrameProc,USER32.DLL,AW,5 provides default processing for anywindow messages that the window procedure of a multiple documentinterface (MDI) frame window does not process.DefineDosDevice,KERNEL32.DLL,AW,3 lets an application define, redefine, or delete MS-DOS device names. DefMDIChildProc,USER32.DLL,AW,4 provides default processing for anywindow message that the window procedure of a multiple documentinterface (MDI) child window does not process.DefWindowProc,USER32.DLL,AW,4 calls the default window procedure toprovide default processing for any window messages that anapplication does not process.DeinitMapiUtil,MAPI32.DLL,NM,0 releases utility functions calledexplicitly by the ScInitMapiUtil function or implicitly by theMAPIInitialize function.DeleteAce,ADVAPI32.DLL,NM,2, deletes an ACE from an ACL.DeleteColorTransform,MSCMS.DLL,NM,1, deletes a given color transform.DeleteCriticalSection,KERNEL32.DLL,NM,1, releases all resources used by an unowned critical section object.DeleteDC,GDI32.DLL,NM,1, deletes the specified device context (DC).DeleteEnhMetaFile,GDI32.DLL,NM,1, deletes an enhanced-format metafile or an enhanced-format metafile handle.DeleteFiber,KERNEL32.DLL,NM,1, deletes an existing fiber.DeleteFile,KERNEL32.DLL,AW,1, deletes an existing file.DeleteForm,WINMM.DLL,AW,2, removes a form name from the list of supported forms.DeleteMenu,USER32.DLL,NM,3, deletes an item from the specified menu.DeleteMetaFile,GDI32.DLL,NM,1, deletes a Windows-format metafile or Windows-format metafile handle.DeleteMonitor,WINMM.DLL,AW,3, removes a printer monitor added by the AddMonitor function.DeleteNtmsDrive,NTMSAPI.DLL,NM,2, deletes a drive from the RSM database. The drive must have a dwOperationalState of NTMS_NOT_PRESENT.DeleteNtmsLibrary,NTMSAPI.DLL,NM,2, deletes a library, and all the devices contained in the library, from the RSM database. All media in the library is moved to the offline library.DeleteNtmsMedia,NTMSAPI.DLL,NM,2, deletes a physical piece of offline media from RSM by removing all references to the specified media from the database.DeleteNtmsMediaPool,NTMSAPI.DLL,NM,2, deletes the specified application media pool.DeleteNtmsMediaType,NTMSAPI.DLL,NM,3, deletes the specified media type relation from the specified library, provided that the library does not contain any physical media objects of the specified media type.DeleteObject,GDI32.DLL,NM,1 deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. DeletePort,WINMM.DLL,AW,3, displays a dialog box that allows the user to delete a port name.DeletePrinter,WINMM.DLL,NM,1, deletes the specified printer object.DeletePrinterConnection,WINMM.DLL,AW,1 deletes a connection to aprinter that was established by a call to AddPrinterConnection orConnectToPrinterDlg.DeletePrinterDriver,WINMM.DLL,AW,3 removes the specified printer-driver name from the list of names of supported drivers for aserver.DeletePrintProcessor,WINMM.DLL,AW,3, removes a printer processor added by the AddPrintProcessor function.DeletePrintProvidor,WINMM.DLL,AW,3, removes a printer provider added by the AddPrintProvidor function.DeleteSecurityContext,SECUR32.DLL,NM,1, deletes the local data structures associated with the specified security context.DeleteService,ADVAPI32.DLL,NM,1 marks the specified service for deletion from the service control manager database. DeleteUrlCacheEntry,WININET.DLL,AW,1,Removes the file associated with the source name from the cache, if the file exists.DeleteUrlCacheGroup,WININET.DLL,NM,4,Releases the specified GROUPID and any associated state in the cache index file.DeregisterEventSource,ADVAPI32.DLL,NM,1, closes a handle to the specified event log.DeregisterIdleRoutine,MAPI32.DLL,NM,1, removes a FNIDLE - based idle routine from the MAPI system.DescribePixelFormat,GDI32.DLL,NM,4 obtains information about thepixel format identified by iPixelFormat of the device associatedwith hdc.DestroyAcceleratorTable,USER32.DLL,NM,1, destroys an accelerator table.DestroyCaret,USER32.DLL,NM,0, destroys the caret?s current shape, frees the caret from the window, and removes the caret from the screen.DestroyCursor,USER32.DLL,NM,1, destroys a cursor and frees any memory the cursor occupied.DestroyEnvironmentBlock,USERENV.DLL,NM,1, frees environment variables created by the CreateEnvironmentBlock function.DestroyIcon,USER32.DLL,NM,1, destroys an icon and frees any memory the icon occupied. DestroyMenu,USER32.DLL,NM,1 destroys the specified menu and frees any memory that the menu occupies. DestroyPrivateObjectSecurity,ADVAPI32.DLL,NM,1 deletes a protected server object?s security descriptor.DestroyPropertySheetPage,COMCTL32.DLL,NM,1, destroys a property sheet not been passed to the PropertySheet function.DestroyWindow,USER32.DLL,NM,1, destroys the specified window.DeviceCapabilities,WINMM.DLL,AW,5, retrieves the capabilities of a printer device driver.DeviceIoControl,KERNEL32.DLL,NM,8 sends a control code directly to a specified device driver, causing the corresponding device to perform the specified operation. DialogBoxIndirectParam,USER32.DLL,AW,5, creates a modal dialog box from a dialog box template in memory.DialogBoxParam,USER32.DLL,AW,5, creates a modal dialog box from a dialog box template resource.DirectDrawCreate,DDRAW.DLL,NM,3,creates an instance of a DirectDraw object.DirectDrawCreateClipper,DDRAW.DLL,NM,3,creates an instance of a DirectDrawClipper object not associated with a DirectDraw object.DirectDrawEnumerate,DDRAW.DLL,AW,2,enumerates the primary DirectDraw display device and a nondisplay device (such as a 3-D accelerator that has no 2-D capabilities), if one is installed.DirectInputCreate,DINPUT.DLL,AW,4,This function creates a DirectInput object that supports the IDirectInput COM interface.DirectPlayCreate,DPLAY.DLL,NM,3,Creates an instance of a DirectPlay object. DirectPlayCreate,DPLAYX.DLL,NM,3,Creates an instance of a DirectPlay object. DirectPlayEnumerate,DPLAY.DLL,NM,2,Enumerates the DirectPlay service providers installed on the system. DirectPlayEnumerate,DPLAYX.DLL,AW,2,Enumerates the DirectPlay service providers installed on the system. DirectPlayLobbyCreate,DPLAYX.DLL,AW,5,Creates an instance of a DirectPlayLobby object. DirectXFileCreate,D3DXOF.DLL,NM,1,Creates an instance of a DirectXFile object.DirectXRegisterApplication,DSETUP.DLL,AW,2,Registers an ISV's game as an application designed to work with DirectPlayLobby. DirectXSetup,DSETUP.DLL,AW,3,Installs one or more DirectX components.

DisableNtmsObject,NTMSAPI.DLL,NM,3, disables the specified RSM object.DisableThreadLibraryCalls,KERNEL32.DLL,NM,1, lets a DLL disable the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notification calls.DisassociateColorProfileFromDevice,MSCMS.DLL,AW,3, disassociates a specified color profile with a specified device on a specified computer.DisconnectNamedPipe,KERNEL32.DLL,NM,1, disconnects the server end of a named pipe instance from a client process.DismountNtmsDrive,NTMSAPI.DLL,NM,2, queues a command to move the media in the specified drive to its storage slot. This function should be paired with the MountNtmsMedia function.DismountNtmsMedia,NTMSAPI.DLL,NM,4, queues a command to move the specified media in a drive to its storage. This function should be paired with the MountNtmsMedia function.DispatchMessage,USER32.DLL,AW,1, dispatches a message to a window procedure.DispGetIDsOfNames,OLEAUT32.DLL,NM,4,Uses type information to convert a set of names to DISPIDs. This is the recommended implementation of IDispatch::GetIDsOfNames.DispGetParam,OLEAUT32.DLL,NM,5, This function retrieves a parameter from the DISPPARAMS structure, checks both named parameters and positional parameters, and coerces the parameter to the specified type.DispInvoke,OLEAUT32.DLL,NM,8,Automatically calls member functions on an interface, given the type information for the interface. You can describe an interface with type information and implement IDispatch::Invoke for the interface using this single call.DlgDirList,USER32.DLL,AW,5, fills the specified list box with the names of all files matching the specified path or filename.DlgDirListComboBox,USER32.DLL,AW,5, fills the specified combo box with a directory listing.DlgDirSelectComboBoxEx,USER32.DLL,AW,4, retrieves the current selection from a combo box filled by using the DlgDirListComboBox function.DlgDirSelectEx,USER32.DLL,AW,4, retrieves the current selection from a single-selection list box.DllDebugObjectRPCHook,OLE32.DLL,NM,2, This function is not yet supported.DllEntryPoint,EDBBCLI.DLL,NM,3, is an optional method of entry into a dynamic-link library (DLL).DllEntryPoint,MSCMS.DLL,NM,3, is an optional method of entry into a dynamic-link library (DLL).DocumentProperties,WINMM.DLL,AW,6 retrieves or modifies printerinitialization information or displays a printer-configurationdialog box for the specified printer.DoDragDrop,OLE32.DLL,NM,4,Carries out an OLE drag and drop operation.DosDateTimeToFileTime,KERNEL32.DLL,NM,3, converts MS-DOS date and time values to a 64-bit file time.DosDateTimeToVariantTime,OLEAUT32.DLL,NM,3,Converts the MS-DOS representation of time to the date and time representation stored in a variant.DPtoLP,GDI32.DLL,NM,3, converts device coordinates into logical coordinates.DragAcceptFiles,SHELL32.DLL,NM,2, registers whether a window accepts dropped files.DragDetect,USER32.DLL,NM,3 captures the mouse and tracks its movement until the user releases the left button, presses the ESC key, or moves the mouse outside the ?drag rectangle? around the specified point.DragFinish,SHELL32.DLL,NM,1, releases memory that Windows allocated for use in transferring filenames to the application.DragQueryFile,SHELL32.DLL,AW,4, retrieves the filenames of dropped files.DragQueryPoint,SHELL32.DLL,NM,2, retrieves the position of the mouse pointer at the time a file was dropped.DrawAnimatedRects,USER32.DLL,NM,4 draws a wire-frame rectangle andanimates it to indicate the opening of an icon or the minimizing ormaximizing of a window.DrawCaption,USER32.DLL,NM,4, draws a window caption.DrawDibBegin,MSVFW32.DLL,NM,8 changes parameters of a DrawDib DC or initializes a new DrawDib DC.DrawDibChangePalette,MSVFW32.DLL,NM,4, sets the palette entries used for drawing DIBs.DrawDibClose,MSVFW32.DLL,NM,1, closes a DrawDib DC and frees the resources DrawDib allocated for it.DrawDibDraw,MSVFW32.DLL,NM,13, draws a DIB to the screen.DrawDibEnd,MSVFW32.DLL,NM,1 clears the flags and other settings of aDrawDib DC that are set by the DrawDibBegin or DrawDibDrawfunctions.DrawDibGetBuffer,MSVFW32.DLL,NM,4, retrieves the location of the buffer used by DrawDib for decompression.DrawDibGetPalette,MSVFW32.DLL,NM,1, retrieves the palette used by a DrawDib DC.DrawDibOpen,MSVFW32.DLL,NM,0, opens the DrawDib library for use and creates a DrawDib DC for drawing.DrawDibProfileDisplay,MSVFW32.DLL,NM,1, determines settings for the display system when using DrawDib functions.DrawDibRealize,MSVFW32.DLL,NM,3, realizes the palette of the DrawDib DC for use with the specified DC.DrawDibSetPalette,MSVFW32.DLL,NM,2 sets the palette used for drawing DIBs.DrawDibStart,MSVFW32.DLL,NM,2, prepares a DrawDib DC for streaming playback.DrawDibStop,MSVFW32.DLL,NM,1, frees the resources used by a DrawDib DC for streaming playback.DrawDibTime,MSVFW32.DLL,NM,2, retrieves timing information about the drawing operation and is used during debug operations.DrawEdge,USER32.DLL,NM,4, draws one or more edges of rectangle.DrawEscape,GDI32.DLL,NM,4 accesses drawing capabilities of a video display that are not directly available through the graphics device interface (GDI). DrawFocusRect,USER32.DLL,NM,2, draws a rectangle in the style used to indicate that the rectangle has the focus.DrawFrameControl,USER32.DLL,NM,4, draws a frame control of the specified type and style.DrawIcon,USER32.DLL,NM,4, draws an icon in the client area of the window of the specified device context.DrawIconEx,USER32.DLL,NM,9 draws an icon or cursor in the client area of the window of the specified device context, performing the specified raster operations, and stretching or compressing the icon or cursor as specified. DrawInsert,COMCTL32.DLL,NM,3, draws the insert icon in the parent window of the specified drag list box.DrawMenuBar,USER32.DLL,NM,1, redraws the menu bar of the specified window.DrawState,USER32.DLL,AW,10, displays an image and applies a visual effect to indicate a state, such as a disabled or default state.DrawStatusText,COMCTL32.DLL,AW,4, draws the specified text in the style of a status window with borders.DrawText,USER32.DLL,AW,5, draws formatted text in the specified rectangle.DrawTextEx,USER32.DLL,AW,6 draws formatted text in the specified rectangle.DriveType,SHELL32.DLL,NM,1 Determines the drive type based on the drive number.DumpCAP,CAP.DLL,NM,0,Write data for the current instance of CAP.DLL. The name of the text file is APPNAME.CAP. DuplicateHandle,KERNEL32.DLL,NM,7, duplicates an object handle.DuplicateToken,ADVAPI32.DLL,NM,3, creates a new access token that duplicates one already in existence.DuplicateTokenEx,ADVAPI32.DLL,NM,6, creates a new access token that duplicates an existing token.EjectNtmsCleaner,NTMSAPI.DLL,NM,4, ejects the cleaning cartridge from the currently reserved cleaner slot.EjectNtmsMedia,NTMSAPI.DLL,NM,4, ejects the specified medium from the port of the current library. If the library is busy, RSM queues EjectNtmsMedia and returns success.

Page 134: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Ellipse,GDI32.DLL,NM,5 draws an ellipse. The center of the ellipse is the center of the specified bounding rectangle. EmptyClipboard,USER32.DLL,NM,0, empties the clipboard and frees handles to data in the clipboard.EmptyWorkingSet,PSAPI.DLL,NM,1, removes as many pages as possible from the working set of the specified process.EnableIdleRoutine,MAPI32.DLL,NM,2 enables or disables a FNIDLE based idle routine.EnableMenuItem,USER32.DLL,NM,3, enables, disables, or grays the specified menu item.EnableNtmsObject,NTMSAPI.DLL,NM,3, enables the specified object.EnableScrollBar,USER32.DLL,NM,3, enables or disables one or both scroll bar arrows.EnableWindow,USER32.DLL,NM,2, enables or disables mouse and keyboard input to the specified window or control.EncryptMessage,SECUR32.DLL,NM,4,Encrypts a message to provide privacy by using Negotiate.EndDialog,USER32.DLL,NM,2, destroys a modal dialog box, causing the system to end any processing for the dialog box.EndDoc,GDI32.DLL,NM,1 ends a print job. This function replaces the ENDDOC printer escape. EndDocPrinter,WINMM.DLL,NM,1, returns an error if the print job was not started by calling the StartDocPrinter function.EndPage,GDI32.DLL,NM,1 informs the device that the application has finished writing to a page. EndPagePrinter,WINMM.DLL,NM,1, indicates the end of one page and the beginning of the next page for the specified printer.EndPaint,USER32.DLL,NM,2, marks the end of painting in the specified window.EndPath,GDI32.DLL,NM,1, closes a path bracket and selects the path defined by the bracket into the specified device context.EndUpdateResource,KERNEL32.DLL,AW,2, ends a resource update in an executable file.EnterCriticalPolicySection,USERENV.DLL,NM,1, pauses the application of policy to allow applications to safely read policy settings.EnterCriticalSection,KERNEL32.DLL,NM,1, waits for ownership of the specified critical section object.EnumCalendarInfo,KERNEL32.DLL,AW,4, enumerates calendar information for a specified locale.EnumChildWindows,USER32.DLL,NM,3, enumerates the child windows that belong to the specified parent window by passing the handle of each child window, in turn, to an application-defined callback function.EnumClipboardFormats,USER32.DLL,NM,1, lets you enumerate the data formats that are currently available on the clipboard.EnumColorProfiles,MSCMS.DLL,AW,5, enumerates all the profiles satisfying the given enumeration criteria.EnumDateFormats,KERNEL32.DLL,AW,3 enumerates the long or short dateformats that are available for a specified locale, including dateformats for any alternate calendars.EnumDependentServices,ADVAPI32.DLL,AW,6 provides the name and status of each service that depends on the specified service; that is, the specified service must be running before the dependent services can run. EnumDesktopWindows,USER32.DLL,NM,3 enumerates all windows in a desktopby passing the handle of each window, in turn, to an application-defined callback function.EnumDeviceDrivers,PSAPI.DLL,NM,3, retrieves the load address for each device driver in the system.EnumDisplayMonitors,USER32.DLL,NM,4 enumerates display monitors (including invisible pseudo-monitors associated with the mirroring drivers) that intersect a region formed by the intersection of a specified clipping rectangle and the visible region of a device context.EnumDisplaySettings,USER32.DLL,AW,3 obtains information about one of a display device?s graphics modes.EnumEnhMetaFile,GDI32.DLL,NM,5 enumerates the records within anenhanced-format metafile by retrieving each record and passing itto the specified callback function.EnumerateNtmsObject,NTMSAPI.DLL,NM,6, enumerates the RSM objects contained in the lpContainerId parameter.EnumerateSecurityPackages,SECUR32.DLL,AW,2,Returns an array of SecPkgInfo structures that describe the security packages available to the client.EnumFontFamilies,GDI32.DLL,AW,4, enumerates the fonts in a specified font family that are available on a specified device.EnumFontFamiliesEx,GDI32.DLL,AW,5 enumerates all fonts in the systemthat match the font characteristics specified by the LOGFONTstructure.EnumFonts,GDI32.DLL,AW,4, enumerates the fonts available on a specified device.EnumForms,WINMM.DLL,AW,6 enumerates the forms supported by the specified printer. EnumJobs,WINMM.DLL,AW,8 initializes an array of either JOB_INFO_1 orJOB_INFO_2 structures with data describing the specified print jobsfor the specified printer.EnumMetaFile,GDI32.DLL,NM,4 enumerates the records within a Windows-format metafile by retrieving each record and passing it to the specified callback function. EnumMonitors,WINMM.DLL,AW,6 initializes an array of structures with data describing the monitors for the specified server. EnumObjects,GDI32.DLL,NM,4, enumerates the pens or brushes available for the specified device context.EnumPorts,WINMM.DLL,AW,5, can succeed even if the server specified by pName does not have a printer defined.EnumPrinterDrivers,WINMM.DLL,AW,7, enumerates all of the printer drivers installed on the specified printer server.EnumPrinters,WINMM.DLL,AW,7, enumerates available printers, print servers, domains, or print providers.EnumPrintProcessorDatatypes,WINMM.DLL,AW,7, enumerates the data types that a specifed print processor supports.EnumPrintProcessors,WINMM.DLL,AW,7, enumerates the print processors installed on the specified server.EnumProcesses,PSAPI.DLL,NM,3, retrieves the process identifier for each process object in the system.EnumProcessModules,PSAPI.DLL,NM,4, retrieves a handle for each module in the specified process.EnumProps,USER32.DLL,AW,2 enumerates all entries in the property listof a window by passing them, one by one, to the specified callbackfunction.EnumPropsEx,USER32.DLL,AW,3 enumerates all entries in the propertylist of a window by passing them, one by one, to the specifiedcallback function.EnumProtocols,MSWSOCK.DLL,AW,3,Important is a Microsoft-specific extension to the Windows Sockets 1.EnumProtocols,WSOCK32.DLL,AW,3,Important is a Microsoft-specific extension to the Windows Sockets 1.EnumResourceLanguages,KERNEL32.DLL,AW,5 searches a module for eachresource of the specified type and name and passes the language ofeach resource it locates to a defined callback function.EnumResourceNames,KERNEL32.DLL,AW,4 searches a module for each resourceof the specified type and passes the name of each resource itlocates to an application-defined callback function.EnumResourceTypes,KERNEL32.DLL,AW,3 searches a module for resources andpasses each resource type it finds to an application-definedcallback function.EnumServicesStatus,ADVAPI32.DLL,AW,8 enumerates services in the specified service control manager database. EnumSystemCodePages,KERNEL32.DLL,AW,2 enumerates the code pages that are either installed on or supported by a system.

EnumSystemLocales,KERNEL32.DLL,AW,2, enumerates the locales that are either installed on or supported by a system.EnumThreadWindows,USER32.DLL,NM,3 enumerates all nonchild windows associated with a thread by passing the handle of each window, in turn, to an application-defined callback function.EnumTimeFormats,KERNEL32.DLL,AW,3, enumerates the time formats that are available for a specified locale.EnumWindows,USER32.DLL,NM,2 enumerates all top-level windows on thescreen by passing the handle of each window, in turn, to anapplication-defined callback function.EnumWindowStations,USER32.DLL,AW,2, enumerates only those window stations for which the calling process has WINSTA_ENUMERATE access.EqualPrefixSid,ADVAPI32.DLL,NM,2, tests two security-identifier (SID) prefix values for equality.EqualRect,USER32.DLL,NM,2 determines whether the two specifiedrectangles are equal by comparing the coordinates of their upper-left and lower-right corners.EqualRgn,GDI32.DLL,NM,2, checks the two specified regions to determine whether they are identical.EqualSid,ADVAPI32.DLL,NM,2, tests two security identifier (SID) values.EraseTape,KERNEL32.DLL,NM,3 erases all or part of a tape. Escape,GDI32.DLL,NM,5, allows applications to access capabilities of a particular device not directly available through GDI.EscapeCommFunction,KERNEL32.DLL,NM,2, directs a specified communications device to perform an extended function.ExcludeClipRect,GDI32.DLL,NM,5 creates a new clipping region thatconsists of the existing clipping region minus the specifiedrectangle.ExcludeUpdateRgn,USER32.DLL,NM,2 prevents drawing within invalid areasof a window by excluding an updated region in the window from aclipping region.ExitProcess,KERNEL32.DLL,NM,1,l does not return until no threads are in their DLL initialization or detach routines.ExitThread,KERNEL32.DLL,NM,1, ends a thread.ExitWindowsEx,USER32.DLL,NM,2, returns as soon as it has initiated the shutdown.ExpandEnvironmentStrings,KERNEL32.DLL,AW,3, expands environment-variable strings and replaces them with their defined values.ExpandEnvironmentStringsForUser,USERENV.DLL,AW,4, expands the source string by using the environment block established for the specified user.ExportNtmsDatabase,NTMSAPI.DLL,NM,1, creates a consistent set of database files in the RSM database directory.ExportSecurityContext,SECUR32.DLL,NM,4, creates a serialized representation of a security context that can later be imported into a different process by calling ImportSecurityContext.ExtCreatePen,GDI32.DLL,NM,5, creates a logical cosmetic or geometric pen that has the specified style, width, and brush attributes.ExtCreateRegion,GDI32.DLL,NM,3, creates a region from the specified region and transformation data.ExtensionPropSheetPageProc,SETUPAPI.DLL,NM,3 specifies an application-defined callback function that receives the address of the AddPropSheetPageProc function, which resides in the module that creates a property sheet.ExtEscape,GDI32.DLL,NM,6, allows applications to access capabilities of a particular device that are not available through GDI.ExtFloodFill,GDI32.DLL,NM,5, fills an area of the display surface with the current brush.ExtractAssociatedIcon,SHELL32.DLL,AW,3 returns the handle of an indexedicon found in a file or an icon found in an associated executablefile.ExtractIcon,SHELL32.DLL,AW,3 retrieves the handle of an icon from thespecified executable file, dynamic-link library (DLL), or iconfile.ExtractIconEx,SHELL32.DLL,AW,5 retrieves the handle of an icon from thespecified executable file, dynamic-link library (DLL), or iconfile.ExtSelectClipRgn,GDI32.DLL,NM,3 combines the specified region with the current clipping region by using the specified mode. ExtTextOut,GDI32.DLL,AW,8, draws a character string by using the currently selected font.FatalAppExit,KERNEL32.DLL,AW,2 displays a message box and terminates the application when the message box is closed.FatalExit,KERNEL32.DLL,NM,1, transfers execution control to the debugger.FaxAbort,WINFAX.DLL,NM,2, A fax client application calls the FaxAbort function to terminate a fax job.FaxAccessCheck,WINFAX.DLL,NM,2, A fax client application calls the FaxAccessCheck function to query the fax access privileges of a user.FaxClose,WINFAX.DLL,NM,1, closes the following types of fax handles: A fax server handle returned by a call the FaxConnectFaxServer function A fax port handle returned by a callFaxCompleteJobParams,WINFAX.DLL,AW,2, creates both a FAX_COVERPAGE_INFO structure and a FAX_JOB_PARAM structure for a fax client application.FaxConnectFaxServer,WINFAX.DLL,AW,2, connects a fax client application to the local fax server.FaxEnableRoutingMethod,WINFAX.DLL,AW,3, enables or disables a fax routing method for a specific fax device. A fax administration application typically calls this function for device management.FaxEnumGlobalRoutingInfo,WINFAX.DLL,AW,3, enumerates all fax routing methods associated with a specific fax server.FaxEnumJobs,WINFAX.DLL,AW,3, enumerates all queued and active fax jobs on the fax server to which the client has connected. The function returns detailed information for each fax job to the fax client application.FaxEnumPorts,WINFAX.DLL,AW,3, enumerates all fax devices currently attached to the fax server to which the client has connected. The function returns detailed information for each fax port to the fax client application.FaxEnumRoutingMethods,WINFAX.DLL,AW,3, enumerates all fax routing methods for a specific fax device. The function returns information about each routing method to a fax client application.FaxFreeBuffer,WINFAX.DLL,NM,1, releases resources associated with a buffer allocated previously as the result of a function call by a fax client application.FaxGetConfiguration,WINFAX.DLL,AW,2, returns to a fax client application the global configuration settings for the fax server to which the client has connected.FaxGetDeviceStatus,WINFAX.DLL,AW,2, returns to a fax client application current status information for the fax device of interest.FaxGetJob,WINFAX.DLL,AW,3, A fax client application calls the FaxGetJob function to retrieve detailed information for the specified queued or active fax job. The function returns the information in a FAX_JOB_ENTRY structure.FaxGetLoggingCategories,WINFAX.DLL,AW,3, returns to a fax client application the current logging categories for the fax server to which the client has connected.FaxGetPageData,WINFAX.DLL,NM,6, returns to a fax client application the first page of data for a fax job. The fax job must be an outbound job, but it can be queued or active.FaxGetPort,WINFAX.DLL,AW,2, returns information for a specified fax port to a fax client application.FaxGetRoutingInfo,WINFAX.DLL,AW,4, returns to a fax client application routing information for a fax routing method that is associated with a specific fax device.FaxInitializeEventQueue,WINFAX.DLL,NM,5, creates a fax event queue for the calling fax client application. The queue enables the application to receive notifications of asynchronous events from the fax server.FaxOpenPort,WINFAX.DLL,NM,4, returns a fax port handle to a fax client application. The port handle is required when the application calls other fax client functions that facilitate device management and fax document routing.

Page 135: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

FaxPrintCoverPage,WINFAX.DLL,AW,2, prints a fax transmission cover page to the specified device context for a fax client application. A device context handle is obtained by using the FaxStartPrintJob function.FaxSendDocument,WINFAX.DLL,AW,5,ForBroadcast A fax client application calls the FaxSendDocumentForBroadcast function to queue several fax jobs that will transmit the same outgoing fax transmission to several recipients.FaxSendDocumentForBroadcast,WINFAX.DLL,AW,5, A fax client application calls the FaxSendDocumentForBroadcast function to queue several fax jobs that will transmit the same outgoing fax transmission to several recipients.FaxSetConfiguration,WINFAX.DLL,AW,2, A fax client application calls the FaxSetConfiguration function to change the global configuration settings for the fax server to which the client has connected.FaxSetGlobalRoutingInfo,WINFAX.DLL,AW,2, A fax management application calls the FaxSetGlobalRoutingInfo function to modify fax routing method data, such as routing priority, that applies globally to the fax server.FaxSetJob,WINFAX.DLL,AW,4, A fax client application calls the FaxSetJob function to pause, resume, cancel, or restart a specified fax job.FaxSetLoggingCategories,WINFAX.DLL,AW,3, A fax client application calls the FaxSetLoggingCategories function to modify the current logging categories for the fax server to which the client has connected.FaxSetPort,WINFAX.DLL,AW,2, A fax client application calls the FaxSetPort function to change the configuration of the fax port of interest.FaxSetRoutingInfo,WINFAX.DLL,AW,4, A fax management application calls the FaxSetRoutingInfo function to modify the routing information for a fax routing method that is associated with a specific fax device.FaxStartPrintJob,WINFAX.DLL,AW,4, A fax client application calls the FaxStartPrintJob function to start printing an outbound fax transmission on the specified fax printer. The function returns a handle to a device context.FBadColumnSet,MAPI32.DLL,NM,1 tests the validity of a table column setfor use by a service provider in a subsequent call to theIMAPITable::SetColumns method.FBadEntryList,MAPI32.DLL,NM,1, validates a list of MAPI entry identifiers.FBadProp,MAPI32.DLL,NM,1, validates a specified property.FBadPropTag,MAPI32.DLL,NM,1, validates a specified property tag.FBadRestriction,MAPI32.DLL,NM,1, validates a restriction used to limit a table view.FBadRglpNameID,MAPI32.DLL,NM,2, validates an array of structures that describe named properties and verifies their allocation.FBadRglpsz,MAPI32.DLL,AW,2 validates all strings in an array of Unicode strings.FBadRow,MAPI32.DLL,NM,1, validates a row in a table.FBadRowSet,MAPI32.DLL,NM,1, validates all table rows included in a set of table rows.FBadSortOrderSet,MAPI32.DLL,NM,1, validates a sort order set by verifying its memory allocation.FBinFromHex,MAPI32.DLL,NM,2 converts a string representation of a hexadecimal number to binary data.FEqualNames,MAPI32.DLL,NM,2, determines whether two MAPI named properties are the same.FileTimeToDosDateTime,KERNEL32.DLL,NM,3, converts a 64-bit file time to MS-DOS date and time values. FileTimeToLocalFileTime,KERNEL32.DLL,NM,2, converts a file time based on the Coordinated Universal Time (UTC) to a local file time.FileTimeToSystemTime,KERNEL32.DLL,NM,2, converts a 64-bit file time to system time format.FillConsoleOutputAttribute,KERNEL32.DLL,NM,5 sets the text and background color attributes for a specified number of charactercells, beginning at the specified coordinates in a screen buffer.FillConsoleOutputCharacter,KERNEL32.DLL,AW,5 writes a character to the screen buffer a specified number of times, beginning at the specified coordinates. FillPath,GDI32.DLL,NM,1 closes any open figures in the current pathand fills the path?s interior by using the current brush andpolygon-filling mode.FillRect,USER32.DLL,NM,3, fills a rectangle by using the specified brush.FillRgn,GDI32.DLL,NM,3, fills a region by using the specified brush.FindAtom,KERNEL32.DLL,AW,1 searches the local atom table for thespecified character string and retrieves the atom associated withthat string.FindClose,KERNEL32.DLL,NM,1, closes the specified search handle.FindCloseChangeNotification,KERNEL32.DLL,NM,1, stops change notification handle monitoring.FindClosePrinterChangeNotification,WINMM.DLL,NM,1 closes a change notification object created by calling the FindFirstPrinterChangeNotification function.FindCloseUrlCache,WININET.DLL,NM,1,Closes the specified cache enumeration handle.FindDebugInfoFile,IMAGEHLP.DLL,NM,3, locates a debug (.dbg) file.FindExecutable,SHELL32.DLL,AW,3, retrieves the name and handle to the executable (.FindExecutableImage,IMAGEHLP.DLL,NM,3, locates an executable file.FindFirstChangeNotification,KERNEL32.DLL,AW,3 creates a change notification handle and sets up initial change notification filter conditions.FindFirstFile,KERNEL32.DLL,AW,2, searches a directory for a file whose name matches the specified filename.FindFirstFileEx,KERNEL32.DLL,AW,6, searches a directory for a file whose name and attributes match those specified in the function call.FindFirstFreeAce,ADVAPI32.DLL,NM,2, retrieves a pointer to the first free byte in an access-control list (ACL).FindFirstPrinterChangeNotification,WINMM.DLL,NM,3, creates a change notification object and returns a handle to the object.FindFirstUrlCacheEntry,WININET.DLL,AW,3,Begins the enumeration of the Internet cache.FindFirstUrlCacheEntryEx,WININET.DLL,AW,10,Starts a filtered enumeration of the Internet cache.FindFirstUrlCacheGroup,WININET.DLL,NM,6,Initiates the enumeration of the cache groups in the Internet cache.FindMediaType,URLMON.DLL,NM,2,Class Retrieves the CLSID for the specified media type.FindMediaTypeClass,URLMON.DLL,NM,4, Retrieves the CLSID for the specified media type.FindNextChangeNotification,KERNEL32.DLL,NM,1 requests that the operating system signal a change notification handle the next time it detects an appropriate change. FindNextFile,KERNEL32.DLL,AW,2, continues a file search from a previous call to the FindFirstFile function.FindNextPrinterChangeNotification,WINMM.DLL,NM,3 retrieves information about the most recent change notification for a change notification object associated with a printer or print server. FindNextUrlCacheEntry,WININET.DLL,AW,3,Retrieves the next entry in the Internet cache.FindNextUrlCacheEntryEx,WININET.DLL,AW,6,Finds the next cache entry in a cache enumeration started by the FindFirstUrlCacheEntryEx function.FindNextUrlCacheGroup,WININET.DLL,NM,3,Retrieves the next cache group in a cache group enumeration started by FindFirstUrlCacheGroup.FindResource,KERNEL32.DLL,AW,3 determines the location of a resource with the specified type and name in the specified module. FindResourceEx,KERNEL32.DLL,AW,4 determines the location of the resourcewith the specified type, name, and language in the specifiedmodule.FindText,COMDLG32.DLL,AW,1 creates a system-defined modeless dialog boxthat lets the user specify a string to search for and options touse when searching for text in a document.FindWindow,USER32.DLL,AW,2 retrieves the handle to the top-levelwindow whose class name and window name match the specifiedstrings.

FindWindowEx,USER32.DLL,AW,4 retrieves the handle to a window whose class name and window name match the specified strings.FixBrushOrgEx,GDI32.DLL,NM,4, is not implemented in the Win32 API.FlashWindow,USER32.DLL,NM,2, flashes the window only once; for repeated flashing, the application should create a system timer.FlatSB_EnableScrollBar,COMCTL32.DLL,NM,3,Enables or disables one or both flat scroll bar direction buttons.FlatSB_GetScrollInfo,COMCTL32.DLL,NM,3,Retrieves the information for a flat scroll bar.FlatSB_GetScrollPos,COMCTL32.DLL,NM,2,Retrieves the thumb position in a flat scroll bar.FlatSB_GetScrollProp,COMCTL32.DLL,NM,3,Retrieves the properties for a flat scroll bar. FlatSB_GetScrollRange,COMCTL32.DLL,NM,4,Retrieves the scroll range for a flat scroll bar.FlatSB_SetScrollInfo,COMCTL32.DLL,NM,4,Sets the information for a flat scroll bar.FlatSB_SetScrollPos,COMCTL32.DLL,NM,4,Sets the current position of the thumb in a flat scroll bar.FlatSB_SetScrollProp,COMCTL32.DLL,NM,4,Sets the properties for a flat scroll bar. FlatSB_SetScrollRange,COMCTL32.DLL,NM,5,Sets the scroll range of a flat scroll bar.FlatSB_ShowScrollBar,COMCTL32.DLL,NM,3,Shows or hides a flat scroll bar. FlattenPath,GDI32.DLL,NM,1 transforms any curves in the path that isselected into the current device context (DC), turning each curveinto a sequence of lines.FloodFill,GDI32.DLL,NM,4, fills an area of the display surface with the current brush.FlushConsoleInputBuffer,KERNEL32.DLL,NM,1 flushes the console input buffer. All input records currently in the input buffer are discarded. FlushFileBuffers,KERNEL32.DLL,NM,1, clears the buffers for the specified file and causes all buffered data to be written to the file. FlushInstructionCache,KERNEL32.DLL,NM,3, flushes the instruction cache for the specified process.FlushViewOfFile,KERNEL32.DLL,NM,2, writes to the disk a byte range within a mapped view of a file.FmtIdToPropStgName,IPROP.DLL,NM,2,Converts a property set format identifier (FMTID) to its storage or stream name.FoldString,KERNEL32.DLL,AW,5, maps one string to another, performing a specified transformation option.FormatMessage,KERNEL32.DLL,AW,7, formats a message string.FPropCompareProp,MAPI32.DLL,NM,3, compares two property values using a binary relational operator.FPropContainsProp,MAPI32.DLL,NM,3 compares two property values,generally strings or binary arrays, to see if one contains theother.FPropExists,MAPI32.DLL,NM,2 searches for a given property tag in anIMAPIProp interface or an interface derived from IMAPIProp, such asIMessage or IMAPIFolder.FrameRect,USER32.DLL,NM,3, draws a border around the specified rectangle by using the specified brush.FrameRgn,GDI32.DLL,NM,5, draws a border around the specified region by using the specified brush.FreeConsole,KERNEL32.DLL,NM,0, detaches the calling process from its console.FreeContextBuffer,SECUR32.DLL,NM,1,Enables callers of security package functions to free a memory buffer that was allocated by the security package as a result of calls to InitializeSecurityContext (General) and AcceptSecurityContext (General).FreeCredentialsHandle,SECUR32.DLL,NM,1,Notifies the security system that the credentials are no longer needed. An application calls this function to free the credential handle acquired in the call to the AcquireCredentialsHandle (General) function.FreeDDElParam,USER32.DLL,NM,2, frees the memory specified by the lParam parameter of a posted DDE message.FreeEnvironmentStrings,KERNEL32.DLL,AW,1 frees a block of environment strings.FreeGPOList,USERENV.DLL,AW,1, frees the specified linked list of GPOs.FreeLibrary,KERNEL32.DLL,NM,1, decrements the reference count of the loaded dynamic-link library (DLL) module.FreeLibraryAndExitThread,KERNEL32.DLL,NM,2 decrements the reference count of a loaded dynamic-link library (DLL) by one, and then calls ExitThread to terminate the calling thread. FreePadrlist,MAPI32.DLL,NM,1 destroys an ADRLIST structure and freesassociated memory, including memory allocated for all member arraysand structures.FreePrinterNotifyInfo,WINMM.DLL,NM,1 frees a system-allocated bufferthat was returned by the FindNextPrinterChangeNotificationfunction.FreePropVariantArray,IPROP.DLL,NM,2, calls PropVariantClear on each of the PROPVARIANT structures in the rgvars array to make the value zero for each of the members of the array.FreePropVariantArray,OLE32.DLL,NM,2, calls PropVariantClear on each of the PROPVARIANT structures in the rgvars array to make the value zero for each of the members of the array.FreeProws,MAPI32.DLL,NM,1 destroys an SRowSet structure and freesassociated memory, including memory allocated for all member arraysand structures.FreeResource,KERNEL32.DLL,NM,1, is obsolete.FreeSid,ADVAPI32.DLL,NM,1, frees a security identifier (SID) previously allocated by using the AllocateAndInitializeSid function.FtAddFt,MAPI32.DLL,NM,4, adds one unsigned 64-bit integer to another.FtgRegisterIdleRoutine,MAPI32.DLL,NM,5, adds a FNIDLE - based idle routine to the MAPI system.FtMulDw,MAPI32.DLL,NM,3, multiplies an unsigned 64-bit integer by an unsigned 32-bit integer.FtMulDwDw,MAPI32.DLL,NM,2, multiplies one unsigned 32-bit integer by another.FtNegFt,MAPI32.DLL,NM,2, computes the two?s complement of an unsigned 64-bit integer.FtpCommand,WININET.DLL,AW,6,Sends commands directly to an FTP server.FtpCreateDirectory,WININET.DLL,AW,2,Creates a new directory on the FTP server.FtpDeleteFile,WININET.DLL,AW,2,Deletes a file stored on the FTP server.FtpFindFirstFile,WININET.DLL,AW,5,Searches the specified directory of the given FTP session. File and directory entries are returned to the application in the WIN32_FIND_DATA structure.FtpGetCurrentDirectory,WININET.DLL,AW,3,Retrieves the current directory for the specified FTP session.FtpGetFile,WININET.DLL,AW,7,Retrieves a file from the FTP server and stores it under the specified file name, creating a new local file in the process.FtpGetFileEx,WININET.DLL,NM,7,retrieves a file from the FTP server and stores it under the specified file name, creating a new local file in the process.FtpGetFileSize,WININET.DLL,NM,2,Retrieves the file size of the requested FTP resource.FtpOpenFile,WININET.DLL,AW,5,Initiates access to a remote file on an FTP server for reading or writing.FtpPutFile,WININET.DLL,AW,5,Stores a file on the FTP server.FtpPutFileEx,WININET.DLL,NM,5,This function stores a file on the FTP server.FtpRemoveDirectory,WININET.DLL,AW,2,Removes the specified directory on the FTP server.FtpRenameFile,WININET.DLL,AW,3,Renames a file stored on the FTP server.FtpSetCurrentDirectory,WININET.DLL,AW,2,Changes to a different working directory on the FTP server.FtSubFt,MAPI32.DLL,NM,4, subtracts one unsigned 64-bit integer from another.GdiComment,GDI32.DLL,NM,3, copies a comment from a buffer into a specified enhanced format metafile.GdiFlush,GDI32.DLL,NM,0, flushes the calling thread?s current batch.GdiGetBatchLimit,GDI32.DLL,NM,0, returns the batch limit.GdiSetBatchLimit,GDI32.DLL,NM,1, sets the maximum number of functions that can be accumulated in the calling thread?s current batch.

Page 136: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

GenerateConsoleCtrlEvent,KERNEL32.DLL,NM,2 sends a specified signal to aconsole process group that shares the console associated with thecalling process.GenerateCopyFilePaths,MSCMS.DLL,NM,9,graphics, GraphicsDrivers, Reference, GenerateCopyFilePathsGetAcceptExSockaddrs,MSWSOCK.DLL,NM,8, parses the data obtained from a call to the AcceptEx function and passes the local and remote addresses to a SOCKADDR structure. GetAcceptExSockaddrs,WSOCK32.DLL,NM,8, parses the data obtained from a call to the AcceptEx function and passes the local and remote addresses to a SOCKADDR structure. GetAclInformation,ADVAPI32.DLL,NM,4, retrieves information about an access-control list (ACL).GetACP,KERNEL32.DLL,NM,0, retrieves the current ANSI code-page identifier for the system.GetActiveObject,OLEAUT32.DLL,NM,3,Retrieves a pointer to a running object that has been registered with OLE.GetActiveWindow,USER32.DLL,NM,0, retrieves the window handle to the active window associated with the thread that calls the function.GetAddressByName,MSWSOCK.DLL,AW,10,Important is a Microsoft-specific extension to the Windows Sockets 1.GetAddressByName,WSOCK32.DLL,AW,10,Important is a Microsoft-specific extension to the Windows Sockets 1.GetAllUsersProfileDirectory,USERENV.DLL,AW,2, retrieves the path to the root of the All Users profile.GetAltMonthNames,OLEAUT32.DLL,NM,2,Retrieves the secondary (altername) month names.GetAppliedGPOList,USERENV.DLL,AW,5, retrieves the list of GPOs applied for the specified user or computer and the specified extension.GetArcDirection,GDI32.DLL,NM,1, returns the current arc direction for the specified device context..GetAspectRatioFilterEx,GDI32.DLL,NM,2, retrieves the setting for the current aspect-ratio filter. GetAsyncKeyState,USER32.DLL,NM,1 determines whether a key is up ordown at the time the function is called, and whether the key waspressed after a previous call to GetAsyncKeyState.GetAtomName,KERNEL32.DLL,AW,3, retrieves a copy of the character string associated with the specified local atom.GetAttribIMsgOnIStg,MAPI32.DLL,NM,3, retrieves attributes of properties on an IMessage object supplied by the OpenIMsgOnIStg function.GetAuditedPermissionsFromAcl,ADVAPI32.DLL,AW,4, returns the audited access rights for a specified trustee.GetBinaryType,KERNEL32.DLL,AW,2, determines whether a file is executable, and if so, what type of executable file it is.GetBitmapBits,GDI32.DLL,NM,3, is obsolete.GetBitmapDimensionEx,GDI32.DLL,NM,2, retrieves the dimensions of a SetBitmapDimensionEx function.GetBkColor,GDI32.DLL,NM,1, returns the current background color for the specified device context.GetBkMode,GDI32.DLL,NM,1, returns the current background mix mode for a specified device context.GetBoundsRect,GDI32.DLL,NM,3 obtains the current accumulated bounding rectangle for a specified device context. GetBrushOrgEx,GDI32.DLL,NM,2, retrieves the current brush origin for the specified device context.GetCapture,USER32.DLL,NM,0, retrieves the handle of the window (if any) that has captured the mouse.GetCaretBlinkTime,USER32.DLL,NM,0, returns the elapsed time, in milliseconds, required to invert the caret?s pixels.GetCaretPos,USER32.DLL,NM,1, copies the caret?s position, in client coordinates, to the specified POINT structure.GetCharABCWidths,GDI32.DLL,AW,4 retrieves the widths, in logicalunits, of consecutive characters in a given range from the currentTrueType font.GetCharABCWidthsFloat,GDI32.DLL,AW,4 retrieves the widths, in logicalunits, of consecutive characters in a specified range from thecurrent font.GetCharacterPlacement,GDI32.DLL,AW,6 retrieves information about a character string, such as character widths, caret positioning, ordering within the string, and glyph rendering.GetCharWidth,GDI32.DLL,AW,4 retrieves the widths, in logicalcoordinates, of consecutive characters in a specified range fromthe current font.GetCharWidth32,GDI32.DLL,AW,4 retrieves the widths, in logicalcoordinates, of consecutive characters in a specified range fromthe current font.GetCharWidthFloat,GDI32.DLL,AW,4, retrieves the fractional widths of consecutive characters in a specified range from the current font.GetClassFile,OLE32.DLL,NM,2,OrMime Retrieves the CLSID of the object to instantiate for the specified file.GetClassFileOrMime,URLMON.DLL,NM,7, Retrieves the CLSID of the object to instantiate for the specified file.GetClassInfo,USER32.DLL,AW,3, retrieves information about a window class.GetClassInfoEx,USER32.DLL,AW,3 retrieves information about a windowclass, including the handle of the small icon associated with thewindow class.GetClassLong,USER32.DLL,AW,2 retrieves the specified 32-bit (long)value from the WNDCLASSEX structure associated with the specifiedwindow.GetClassName,USER32.DLL,AW,3, retrieves the name of the class to which the specified window belongs.GetClassURL,URLMON.DLL,NM,2, GetClassURL Function Not currently implemented. GetClassWord,USER32.DLL,NM,2 retrieves the 16-bit (word) value at thespecified offset into the extra class memory for the window classto which the specified window belongs.GetClientRect,USER32.DLL,NM,2 retrieves the coordinates of a window?s client area. GetClipboardData,USER32.DLL,NM,1, retrieves data from the clipboard in a specified format.GetClipboardFormatName,USER32.DLL,AW,3, retrieves from the clipboard the name of the specified registered format.GetClipboardOwner,USER32.DLL,NM,0, retrieves the window handle of the current owner of the clipboard.GetClipboardSequenceNumber,USER32.DLL,NM,0, returns the clipboard sequence number for the current window station.GetClipboardViewer,USER32.DLL,NM,0, retrieves the handle of the first window in the clipboard viewer chain.GetClipBox,GDI32.DLL,NM,2 retrieves the dimensions of the tightestbounding rectangle that can be drawn around the current visiblearea on the device.GetClipCursor,USER32.DLL,NM,1, retrieves the screen coordinates of the rectangular area to which the cursor is confined.GetClipRgn,GDI32.DLL,NM,2 retrieves a handle identifying the currentapplication-defined clipping region for the specified devicecontext.GetCMMInfo,MSCMS.DLL,NM,2, retrieves various information about the color management module (CMM) that created the specified color transform.GetColorAdjustment,GDI32.DLL,NM,2 retrieves the color adjustmentvalues for the specified device context.GetColorDirectory,MSCMS.DLL,AW,3, retrieves the path of the Windows COLOR directory on a specified machine.GetColorProfileElement,MSCMS.DLL,NM,6, copies data from a specified tagged profile element of a specified color profile into a buffer.GetColorProfileElementTag,MSCMS.DLL,NM,3, retrieves the tag name specified by dwIndex in the tag table of a given color profile, where dwIndex is a one-based index into that table.

GetColorProfileFromHandle,MSCMS.DLL,NM,3,Given a handle to an open color profile, the GetColorProfileFromHandle function will copy the contents of the profile into a buffer supplied by the application.GetColorProfileHeader,MSCMS.DLL,NM,2, retrieves the header of a color profile.GetCommandLine,KERNEL32.DLL,AW,0 returns a pointer to the command-line string for the current process. GetCommConfig,KERNEL32.DLL,NM,3 gets the current configuration of a communications device.GetCommMask,KERNEL32.DLL,NM,2, retrieves the value of the event mask for a specified communications device.GetCommModemStatus,KERNEL32.DLL,NM,2, retrieves modem control-register values.GetCommProperties,KERNEL32.DLL,NM,2 fills a buffer with informationabout the communications properties for a specified communicationsdevice.GetCommState,KERNEL32.DLL,NM,2 fills in a device-control block (a DCBstructure) with the current control settings for a specifiedcommunications device.GetCommTimeouts,KERNEL32.DLL,NM,2, retrieves the time-out parameters for all read and write operations on a specified communications device.GetCompressedFileSize,KERNEL32.DLL,AW,2, obtains the compressed size of a file.GetComputerName,KERNEL32.DLL,AW,2, retrieves the computer name of the current system.GetComputerObjectName,SECUR32.DLL,AW,3, retrieves the local computer's name in a specified format.GetConsoleCP,KERNEL32.DLL,NM,0 Windows NT: returns the identity of theinput code page used by the console associated with the callingprocess.GetConsoleCursorInfo,KERNEL32.DLL,NM,2 retrieves information about thesize and visibility of the cursor for the specified console screenbuffer.GetConsoleMode,KERNEL32.DLL,NM,2 reports the current input mode of aconsole?s input buffer or the current output mode of a consolescreen buffer.GetConsoleOutputCP,KERNEL32.DLL,NM,0 Windows NT: returns the identity ofthe output code page used by the console associated with thecalling process.GetConsoleScreenBufferInfo,KERNEL32.DLL,NM,2, retrieves information about the specified console screen buffer.GetConsoleTitle,KERNEL32.DLL,AW,2, retrieves the title bar string for the current console window.GetConvertStg,OLE32.DLL,NM,1, returns the current value of the convert bit for the specified storage object.GetCountColorProfileElements,MSCMS.DLL,NM,2, retrieves the number of tagged elements in a given color profile.GetCPInfo,KERNEL32.DLL,NM,2, retrieves information about any valid installed or available code page.GetCurrencyFormat,KERNEL32.DLL,AW,6, formats a number string as a currency string for a specified locale.GetCurrentDirectory,KERNEL32.DLL,AW,2 retrieves the current directory for the current process. GetCurrentHwProfile,ADVAPI32.DLL,AW,1, retrieves the display name and globally unique identifier (GUID) string for the hardware profile.GetCurrentObject,GDI32.DLL,NM,2, obtains a handle to a device context? s currently selected object of a specified type.GetCurrentPositionEx,GDI32.DLL,NM,2, retrieves the current position in logical coordinates.GetCurrentProcess,KERNEL32.DLL,NM,0, returns a pseudohandle for the current process.GetCurrentProcessId,KERNEL32.DLL,NM,0, returns the process identifier of the calling process.GetCurrentThread,KERNEL32.DLL,NM,0, returns a pseudohandle for the current thread.GetCurrentThreadId,KERNEL32.DLL,NM,0, returns the thread identifier of the calling thread. GetCursor,USER32.DLL,NM,0, retrieves the handle of the current cursor.GetCursorPos,USER32.DLL,NM,1, retrieves the cursor?s position, in screen coordinates.GetDateFormat,KERNEL32.DLL,AW,6 formats a date as a date string for a specified locale.GetDC,USER32.DLL,NM,1, retrieves a handle of a display device context (DC) for the client area of the specified window.GetDCEx,USER32.DLL,NM,3, retrieves the handle of a display device (DC) context for the specified window.GetDCOrgEx,GDI32.DLL,NM,2, obtains the final translation origin for a specified device context (DC).GetDefaultCommConfig,KERNEL32.DLL,AW,3, gets the default configuration for a communications device.GetDefaultUserProfileDirectory,USERENV.DLL,AW,2, retrieves the path to the root of the Default User profile.GetDesktopWindow,USER32.DLL,NM,0, returns the handle of the Windows desktop window.GetDeviceCaps,GDI32.DLL,NM,2, retrieves device-specific information about a specified device.GetDeviceDriverBaseName,PSAPI.DLL,AW,3, retrieves the base name of the specified device driver.GetDeviceDriverFileName,PSAPI.DLL,AW,3, retrieves the fully qualified path for the specified device driver.GetDialogBaseUnits,USER32.DLL,NM,0 returns the system's dialog baseunits, which are the average width and height of characters in thesystem font.GetDIBColorTable,GDI32.DLL,NM,4 retrieves RGB (red, green, blue) color values from a range of entries in the color table of the DIB section bitmap that is currently selected into a specified device context.GetDIBits,GDI32.DLL,NM,7, retrieves the bits of the specified bitmap and copies them into a buffer using the specified format.GetDiskFreeSpace,KERNEL32.DLL,AW,5, retrieves information about the specified disk, including the amount of free space on the disk.GetDiskFreeSpaceEx,KERNEL32.DLL,AW,4, lets you avoid the arithmetic required by the GetDiskFreeSpace function.GetDlgCtrlID,USER32.DLL,NM,1, returns the identifier of the specified control.GetDlgItem,USER32.DLL,NM,2, retrieves the handle of a control in the specified dialog box. GetDlgItemInt,USER32.DLL,NM,4, translates the text of a specified control in a dialog box into an integer value.GetDlgItemText,USER32.DLL,AW,4, retrieves the title or text associated with a control in a dialog box.GetDoubleClickTime,USER32.DLL,NM,0, retrieves the current double-click time for the mouse.GetDriveType,KERNEL32.DLL,AW,1, determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.GetEffectiveClientRect,COMCTL32.DLL,NM,3, calculates the dimensions of a rectangle in the client area.GetEffectiveRightsFromAcl,ADVAPI32.DLL,AW,3, retrieves the effective access rights that an ACL allows for a specified trustee.GetEnhMetaFile,GDI32.DLL,AW,1, creates a handle that identifies the enhanced-format metafile stored in the specified file.GetEnhMetaFileBits,GDI32.DLL,NM,3, retrieves the contents of the specified enhanced-format metafile and copies them into a buffer.GetEnhMetaFileDescription,GDI32.DLL,AW,3 retrieves an optional textdescription from an enhanced-format metafile and copies the stringto the specified buffer.GetEnhMetaFileHeader,GDI32.DLL,NM,3 retrieves the record containing the header for the specified enhanced-format metafile. GetEnhMetaFilePaletteEntries,GDI32.DLL,NM,3, retrieves optional palette entries from the specified enhanced metafile.

Page 137: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

GetEnvironmentStrings,KERNEL32.DLL,AW,0, returns the address of the environment block for the current process.GetEnvironmentVariable,KERNEL32.DLL,AW,3 retrieves the value of thespecified variable from the environment block of the callingprocess.GetErrorInfo,OLEAUT32.DLL,NM,2,Obtains the error information pointer set by the previous call to SetErrorInfo in the current logical thread.GetExitCodeProcess,KERNEL32.DLL,NM,2 retrieves the termination status ofthe specified process.GetExitCodeThread,KERNEL32.DLL,NM,2, retrieves the termination status of the specified thread.GetExpandedName,LZ32.DLL,AW,2 retrieves the original name of acompressed file, if the file was compressed by using the MicrosoftFile Compression Utility (COMPRESS.GetExplicitEntriesFromAcl,ADVAPI32.DLL,AW,3 retrieves an array ofEXPLICIT_ACCESS structures that describe the access-control entries(ACEs) in an access-control list (ACL).GetFileAttributes,KERNEL32.DLL,AW,1, returns attributes for a specified file or directory.GetFileAttributesEx,KERNEL32.DLL,AW,3, obtains attribute information about a specified file or directory.GetFileInformationByHandle,KERNEL32.DLL,NM,2, retrieves information about a specified file.GetFileSecurity,ADVAPI32.DLL,AW,5, obtains specified information about the security of a file or directory.GetFileSize,KERNEL32.DLL,NM,2, retrieves the size, in bytes, of the specified file.GetFileTime,KERNEL32.DLL,NM,4, retrieves the date and time that a file was created, last accessed, and last modified.GetFileTitle,COMDLG32.DLL,AW,3, returns the name of the file identified by the lpszFile parameter.GetFileType,KERNEL32.DLL,NM,1 returns the type of the specified file.GetFileVersionInfo,VERSION.DLL,AW,4, returns version information about a specified file.GetFileVersionInfoSize,VERSION.DLL,AW,2 determines whether operating system can obtain version information about a specifiedfile.GetFocus,USER32.DLL,NM,0 retrieves the handle of the window that hasthe keyboard focus, if the window is associated with the callingthread?s message queue.GetFontData,GDI32.DLL,NM,5, retrieves font metric data for a TrueType font.GetFontLanguageInfo,GDI32.DLL,NM,1, returns information about the currently selected font for the specified display context.GetForegroundWindow,USER32.DLL,NM,0 returns the handle of theforeground window (the window with which the user is currentlyworking).GetForm,WINMM.DLL,AW,6, initializes a FORM_INFO_1 structure with data describing the specified form for a printer.GetFullPathName,KERNEL32.DLL,AW,4, retrieves the full path and filename of a specified file.GetGlyphOutline,GDI32.DLL,AW,7 retrieves the outline or bitmap for acharacter in the TrueType font that is selected into the specifieddevice context.GetGPOList,USERENV.DLL,AW,6, retrieves the list of GPOs for the specified user or computer.GetGraphicsMode,GDI32.DLL,NM,1, retrieves the current graphics mode for the specified device context.GetGuiResources,USER32.DLL,NM,2 returns the count of handles to graphical user interface (GUI) objects in use by the specified process. GetHandleInformation,KERNEL32.DLL,NM,2, obtains information about certain properties of an object handle.GetHGlobalFromILockBytes,OLE32.DLL,NM,2, retrieves a global memory handle to a byte array object created using the CreateILockBytesOnHGlobal function.GetHGlobalFromStream,OLE32.DLL,NM,2, This function retrieves the global memory handle to a stream that was created through a call to the CreateStreamOnHGlobal function.gethostbyaddr,WS2_32.DLL,NM,3 retrieves the host information corresponding to a network address.gethostbyaddr,WSOCK32.DLL,NM,3 retrieves the hostinformation corresponding to a network address.gethostbyname,WS2_32.DLL,NM,1, retrieves host information corresponding to a host name from a host database.Note The gethostbyname function has been deprecated by the introduction of the getaddrinfo function.gethostbyname,WSOCK32.DLL,NM,1, retrieves host information corresponding to a host name from a host database.Note The gethostbyname function has been deprecated by the introduction of the getaddrinfo function.gethostname,WS2_32.DLL,NM,2, retrieves the standard host name for the local computer.gethostname,WSOCK32.DLL,NM,2, retrieves the standard host name for the local computer.GetIconInfo,USER32.DLL,NM,2, retrieves information about the specified icon or cursor.GetImageConfigInformation,IMAGEHLP.DLL,NM,2, locates and returns the load configuration data of an image.GetImageUnusedHeaderBytes,IMAGEHLP.DLL,NM,2, returns the offset and size of the part of the PE header that is currently unused.GetInputState,USER32.DLL,NM,0, determines whether there are mouse- button or keyboard messages in the calling thread?s message queue.GetJob,WINMM.DLL,AW,6, retrieves print-job data for the specified printer.GetKBCodePage,USER32.DLL,NM,0 returns the current Windows code page. GetKernelObjectSecurity,ADVAPI32.DLL,NM,5, retrieves a copy of the security descriptor protecting a kernel object.GetKerningPairs,GDI32.DLL,AW,3, retrieves the character-kerning pairs for the currently selected font for the specified device context.GetKeyboardLayout,USER32.DLL,NM,1, retrieves the active keyboard layout for a specified thread.GetKeyboardLayoutList,USER32.DLL,NM,2 retrieves the keyboard layouthandles corresponding to the current set of input locales in thesystem.GetKeyboardLayoutName,USER32.DLL,AW,1, retrieves the name of the active keyboard layout.GetKeyboardState,USER32.DLL,NM,1 copies the status of the 256 virtual keys to the specified buffer. GetKeyboardType,USER32.DLL,NM,1, retrieves information about the current keyboard.GetKeyNameText,USER32.DLL,AW,3, retrieves a string that represents the name of a key.GetKeyState,USER32.DLL,NM,1, retrieves the status of the specified virtual key.GetLargestConsoleWindowSize,KERNEL32.DLL,NM,1 returns the size of thelargest possible console window, based on the current font and thesize of the display.GetLastActivePopup,USER32.DLL,NM,1, determines which pop-up window owned by the specified window was most recently active.GetLastError,KERNEL32.DLL,NM,0, returns the calling thread?s last-error code value.GetLengthSid,ADVAPI32.DLL,NM,1, returns the length, in bytes, of a valid SID structure.GetLocaleInfo,KERNEL32.DLL,AW,4, always retrieves information in text format.GetLocalTime,KERNEL32.DLL,NM,1 retrieves the current local date and time. GetLogicalDrives,KERNEL32.DLL,NM,0, returns a bitmask representing the currently available disk drives.GetLogicalDriveStrings,KERNEL32.DLL,AW,2, fills a buffer with strings that specify valid drives in the system.GetMailslotInfo,KERNEL32.DLL,NM,5, retrieves information about the specified mailslot.GetMapMode,GDI32.DLL,NM,1 retrieves the current mapping mode. GetMappedFileName,PSAPI.DLL,AW,4, checks if the specified address is within a memory-mapped file in the address space of the specified process. If so, the function returns the name of the memory-mapped file.GetMenu,USER32.DLL,NM,1, retrieves the handle of the menu assigned to the given window.

GetMenuCheckMarkDimensions,USER32.DLL,NM,0, returns the dimensions of the default check mark bitmap.GetMenuContextHelpId,USER32.DLL,NM,1, retrieves the help context identifier associated with the specified menu.GetMenuDefaultItem,USER32.DLL,NM,3 determines the default menu item on the specified menu.GetMenuItemCount,USER32.DLL,NM,1, determines the number of items in the specified menu.GetMenuItemID,USER32.DLL,NM,2, retrieves the menu item identifier of a menu item located at the specified position in a menu.GetMenuItemInfo,USER32.DLL,AW,4, retrieves information about a menu item.GetMenuItemRect,USER32.DLL,NM,4, retrieves the bounding rectangle for the specified menu item.GetMenuState,USER32.DLL,NM,3 retrieves the menu flags associated with the specified menu item. GetMenuString,USER32.DLL,AW,5, copies the text string of the specified menu item into the specified buffer.GetMessage,USER32.DLL,AW,4, retrieves a message from the calling thread?s message queue and places it in the specified structure.GetMessageExtraInfo,USER32.DLL,NM,0, gets the extra message information for the current thread.GetMessagePos,USER32.DLL,NM,0, returns a long value that gives the cursor position in screen coordinates.GetMessageTime,USER32.DLL,NM,0 returns the message time for the lastmessage retrieved by the GetMessage function from the currentthread?s message queue.GetMetaFile,GDI32.DLL,AW,1, creates a handle that identifies the given Windows-format metafile.GetMetaFileBitsEx,GDI32.DLL,NM,3, retrieves the contents of a Windows- format metafile and copies them into the specified buffer.GetMetaRgn,GDI32.DLL,NM,2, retrieves the current metaregion for the specified device context.GetMiterLimit,GDI32.DLL,NM,2, returns the miter limit for the specified device context.GetModuleBaseName,PSAPI.DLL,AW,4, retrieves the base name of the specified module.GetModuleFileName,KERNEL32.DLL,AW,3, retrieves the full path and filename for the executable file containing the specified module.GetModuleFileNameEx,PSAPI.DLL,AW,4, retrieves the fully-qualified path for the file containing the specified module.GetModuleHandle,KERNEL32.DLL,AW,1 returns a module handle for thespecified module if the file has been mapped into the address spaceof the calling process.GetModuleInformation,PSAPI.DLL,NM,4, retrieves information about the specified module in the MODULEINFO structure.GetMonitorInfo,USER32.DLL,AW,2, lets you obtain information about a display monitor.GetMultipleTrustee,ADVAPI32.DLL,AW,1, is provided for future use.GetMultipleTrusteeOperation,ADVAPI32.DLL,AW,1, is provided for future use.GetNameByType,MSWSOCK.DLL,AW,3, obtains the name of a network service.GetNameByType,WSOCK32.DLL,AW,3, obtains the name of a network service.GetNamedPipeHandleState,KERNEL32.DLL,AW,7 GetNamedPipeHandleStatespecified named pipe.GetNamedPipeInfo,KERNEL32.DLL,NM,5, retrieves information about the specified named pipe.GetNamedSecurityInfo,ADVAPI32.DLL,AW,8, retrieves a copy of the security descriptor for an object specified by name.GetNearestColor,GDI32.DLL,NM,2 returns a color value identifying acolor from the system palette that will be displayed when thespecified color value is used.GetNearestPaletteIndex,GDI32.DLL,NM,2 retrieves the index for theentry in the specified logical palette most closely matching aspecified color value.GetNextDlgGroupItem,USER32.DLL,NM,3 retrieves the handle of the firstcontrol in a group of controls that precedes (or follows) thespecified control in a dialog box.GetNextDlgTabItem,USER32.DLL,NM,3 retrieves the handle of the firstcontrol that has the WS_TABSTOP style that precedes (or follows)the specified control.GetNtmsMediaPoolName,NTMSAPI.DLL,AW,4, retrieves the specified media pool's full name hierarchy.GetNtmsObjectAttribute,NTMSAPI.DLL,AW,6, retrieves the extended attribute (named private data) from the specified RSM object.GetNtmsObjectInformation,NTMSAPI.DLL,AW,3, returns an object's information structure for the specified object.GetNtmsObjectSecurity,NTMSAPI.DLL,NM,7, reads the security descriptor for the specified RSM object.GetNtmsRequestOrder,NTMSAPI.DLL,NM,3, gets the order that the specified request will be processed in the library queue.GetNumberFormat,KERNEL32.DLL,AW,6, formats a number string as a number string customized for a specified locale.GetNumberOfConsoleInputEvents,KERNEL32.DLL,NM,2, retrieves the number of unread input records in the console?s input buffer.GetNumberOfConsoleMouseButtons,KERNEL32.DLL,NM,1, retrieves the number of buttons on the mouse used by the current console.GetNumberOfEventLogRecords,ADVAPI32.DLL,NM,2 retrieves the number of records in the specified event log. GetObject,GDI32.DLL,AW,3 obtains information about a specified graphics object. GetObjectType,GDI32.DLL,NM,1 identifies the type of the specified object.GetOEMCP,KERNEL32.DLL,NM,0, retrieves the current OEM code-page identifier for the system.GetOldestEventLogRecord,ADVAPI32.DLL,NM,2, retrieves the absolute record number of the oldest record in the specified event log.GetOpenClipboardWindow,USER32.DLL,NM,0, retrieves the handle of the window that currently has the clipboard open.GetOpenFileName,COMDLG32.DLL,AW,1 creates an Open common dialog box thatlets the user specify the drive, directory, and the name of a fileor set of files to open.GetOpenFileNamePreview,MSVFW32.DLL,AW,1, selects a file by using the Open dialog box.GetOutlineTextMetrics,GDI32.DLL,AW,3, retrieves text metrics for TrueType fonts.GetOverlappedResult,KERNEL32.DLL,NM,4 returns the results of anoverlapped operation on the specified file, named pipe, orcommunications device.GetPaletteEntries,GDI32.DLL,NM,4, retrieves a specified range of palette entries from the given logical palette.GetParent,USER32.DLL,NM,1, retrieves the handle of the specified child window?s parent window.GetPath,GDI32.DLL,NM,4 retrieves the coordinates defining theendpoints of lines and the control points of curves found in thepath that is selected into the specified device context.getpeername,WS2_32.DLL,NM,3 retrieves the name of thepeer to which a socket is connected.getpeername,WSOCK32.DLL,NM,3 retrieves the name of thepeer to which a socket is connected.GetPixel,GDI32.DLL,NM,3, retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.GetPixelFormat,GDI32.DLL,NM,1, obtains the index of the currently selected pixel format of the specified device context.GetPolyFillMode,GDI32.DLL,NM,1, retrieves the current polygon fill mode.GetPrinter,WINMM.DLL,AW,5, retrieves information about a specified printer.GetPrinterData,WINMM.DLL,AW,6, retrieves printer-configuration data for the specified printer.GetPrinterDriver,WINMM.DLL,AW,6, retrieves driver data for the specified printer.

Page 138: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

GetPrinterDriverDirectory,WINMM.DLL,AW,6, retrieves the path of the printer-driver directory.GetPrintProcessorDirectory,WINMM.DLL,AW,6, retrieves the path for the print processor on the specified server.GetPriorityClass,KERNEL32.DLL,NM,1, returns the priority class for the specified process.GetPriorityClipboardFormat,USER32.DLL,NM,2, returns the first available clipboard format in the specified list.GetPrivateObjectSecurity,ADVAPI32.DLL,NM,5 retrieves information from a protectedserver object?s security descriptor.GetPrivateProfileInt,KERNEL32.DLL,AW,4 retrieves an integer associatedwith a key in the specified section of the given initializationfile.GetPrivateProfileSection,KERNEL32.DLL,AW,4, retrieves all of the keys and values for the specified section from an initialization file.GetPrivateProfileSectionNames,KERNEL32.DLL,AW,3, retrieves the names of all sections in an initialization file.GetPrivateProfileString,KERNEL32.DLL,AW,6, retrieves a string from the specified section in an initialization file.GetPrivateProfileStruct,KERNEL32.DLL,AW,5 retrieves the data associated with the specified key in the given section of an initialization file.GetProcAddress,KERNEL32.DLL,NM,2, returns the address of the specified exported dynamic-link library (DLL) function.GetProcessAffinityMask,KERNEL32.DLL,NM,3 obtains a process affinity mask for the specified process and the system affinity mask for the system.GetProcessHeap,KERNEL32.DLL,NM,0, obtains a handle to the heap of the calling process.GetProcessMemoryInfo,PSAPI.DLL,NM,3, retrieves information about the memory usage of the specified process in the PROCESS_MEMORY_COUNTERS structure.GetProcessPriorityBoost,KERNEL32.DLL,NM,2, returns the priority boost control state of the specified process.GetProcessShutdownParameters,KERNEL32.DLL,NM,2, retrieves shutdown parameters for the currently calling process.GetProcessTimes,KERNEL32.DLL,NM,5, obtains timing information about a specified process.GetProcessVersion,KERNEL32.DLL,NM,1 obtains the major and minor versionnumbers of the Windows version on which a specified process expectsto run.GetProcessWindowStation,USER32.DLL,NM,0, returns a handle of the window station associated with the calling process.GetProcessWorkingSetSize,KERNEL32.DLL,NM,3, obtains the minimum and maximum working set sizes of a specified process.GetProfileInt,KERNEL32.DLL,AW,3, retrieves an integer from the specified key name in the given section of the WIN.GetProfilesDirectory,USERENV.DLL,AW,2, retrieves the path to the root directory where all user profiles are stored.GetProfileSection,KERNEL32.DLL,AW,3, retrieves all of the keys and values for the specified section of the WIN.GetProfileString,KERNEL32.DLL,AW,5, retrieves the string associated with the specified key in the given section of the WIN.GetProfileType,USERENV.DLL,NM,1, retrieves the type of profile loaded for the current user.GetProp,USER32.DLL,AW,2, retrieves a data handle from the property list of the given window.getprotobyname,WS2_32.DLL,NM,1 information corresponding to a protocol name.getprotobyname,WSOCK32.DLL,NM,1 information corresponding to a protocol name.getprotobynumber,WS2_32.DLL,NM,1 getprotobynumberretrieves protocolinformation corresponding to a protocol number.getprotobynumber,WSOCK32.DLL,NM,1 retrieves protocolinformation corresponding to a protocol number.GetPS2ColorRenderingDictionary,MSCMS.DLL,NM,5, retrieves the PostScript Level 2 color rendering dictionary from the specified profile.GetPS2ColorRenderingIntent,MSCMS.DLL,NM,4, retrieves the PostScript Level 2 color rendering intent from a profile.GetPS2ColorSpaceArray,MSCMS.DLL,NM,6, retrieves the PostScript Level 2 color space array from a profile.GetQueuedCompletionStatus,KERNEL32.DLL,NM,5, attempts to dequeue an I/O completion packet from a specified input/output completion port.GetQueueStatus,USER32.DLL,NM,1, returns flags that indicate the type of messages found in the calling thread?s message queue. GetRasterizerCaps,GDI32.DLL,NM,2, returns flags indicating whether TrueType fonts are installed in the system. GetRegionData,GDI32.DLL,NM,3, fills the specified buffer with data describing a region.GetRgnBox,GDI32.DLL,NM,2, retrieves the bounding rectangle of the specified region.GetROP2,GDI32.DLL,NM,1, retrieves the foreground mix mode of the specified device context.GetSaveFileName,COMDLG32.DLL,AW,1 creates a Save common dialog box that lets the user specify the drive, directory, and name of a file to save. GetSaveFileNamePreview,MSVFW32.DLL,AW,1 selects a file by using the SaveAs dialog box.GetScrollInfo,USER32.DLL,NM,3 retrieves the parameters of a scrollbar, including the minimum and maximum scrolling positions, thepage size, and the position of the scroll box (thumb).GetScrollPos,USER32.DLL,NM,2, retrieves the current position of the scroll box (thumb) in the specified scroll bar.GetScrollRange,USER32.DLL,NM,4 retrieves the current minimum and maximum scroll box (thumb) positions for the specified scroll barGetSecurityDescriptorControl,ADVAPI32.DLL,NM,3 retrieves a securitydescriptor?s control and revision information.GetSecurityDescriptorDacl,ADVAPI32.DLL,NM,4 retrieves a pointer to thediscretionary access-control list (ACL) in a specified securitydescriptor.GetSecurityDescriptorGroup,ADVAPI32.DLL,NM,3, retrieves the primary group information from a security descriptor.GetSecurityDescriptorLength,ADVAPI32.DLL,NM,1, returns the length, in bytes, of a structurally valid SECURITY_DESCRIPTOR structure.GetSecurityDescriptorOwner,ADVAPI32.DLL,NM,3, retrieves the owner information from a security descriptor.GetSecurityDescriptorSacl,ADVAPI32.DLL,NM,4 retrieves a pointer to thesystem access-control list (ACL) in a specified securitydescriptor.GetSecurityInfo,ADVAPI32.DLL,NM,8 retrieves a copy of the security descriptor for an object specified by a handle. getservbyname,WS2_32.DLL,NM,2 getservbynameinformation corresponding to a service name and protocol.getservbyname,WSOCK32.DLL,NM,2 information corresponding to a service name and protocol.getservbyport,WS2_32.DLL,NM,2, retrieves service information corresponding to a port and protocol.getservbyport,WSOCK32.DLL,NM,2, retrieves service information corresponding to a port and protocol.GetService,MSWSOCK.DLL,AW,7,Important is a Microsoft-specific extension to the Windows Sockets 1.GetService,WSOCK32.DLL,AW,7,Important is a Microsoft-specific extension to the Windows Sockets 1.GetServiceDisplayName,ADVAPI32.DLL,AW,4 obtains the display name that is associated with a particular service. .GetServiceKeyName,ADVAPI32.DLL,AW,4, obtains the service name that is associated with a particular service?s display name.GetShortPathName,KERNEL32.DLL,AW,3, obtains the short path form of a specified input path.

GetSidIdentifierAuthority,ADVAPI32.DLL,NM,1 returns the address of theSID_IDENTIFIER_AUTHORITY structure in a specified securityidentifier (SID).GetSidLengthRequired,ADVAPI32.DLL,NM,1 returns the length, in bytes, ofthe buffer required to store a SID structure with a specifiednumber of subauthorities.GetSidSubAuthority,ADVAPI32.DLL,NM,2, returns the address of a specified subauthority in a SID structure.GetSidSubAuthorityCount,ADVAPI32.DLL,NM,1, returns the address of the field in a SID structure containing the subauthority count.getsockname,WS2_32.DLL,NM,3, retrieves the current name for the specified socket descriptor in name.getsockname,WSOCK32.DLL,NM,3, retrieves the current name for the specified socket descriptor in name.getsockopt,WS2_32.DLL,NM,5 retrieves a socket option.getsockopt,WSOCK32.DLL,NM,5 retrieves a socket option.GetStandardColorSpaceProfile,MSCMS.DLL,AW,4, retrieves the color profile registered for the specified standard color space.GetStartupInfo,KERNEL32.DLL,AW,1 retrieves the contents of the STARTUPINFO structure that was specified when the calling process was created. GetStdHandle,KERNEL32.DLL,NM,1, returns a handle for the standard input, standard output, or standard error device.GetStockObject,GDI32.DLL,NM,1, retrieves a handle to one of the predefined stock pens, brushes, fonts, or palettes.GetStretchBltMode,GDI32.DLL,NM,1, retrieves the current stretching mode.GetStringType,KERNEL32.DLL,AW,5 returns character-type information for the characters in the specified source string.GetStringTypeEx,KERNEL32.DLL,AW,5, returns character-type information for the characters in the specified source string.GetSubMenu,USER32.DLL,NM,2, retrieves the handle of the drop-down menu or submenu activated by the specified menu item.GetSysColor,USER32.DLL,NM,1, retrieves the current color of the specified display element.GetSysColorBrush,USER32.DLL,NM,1, retrieves a handle identifying a logical brush that corresponds to the specified color index.GetSystemDefaultLangID,KERNEL32.DLL,NM,0, retrieves the system default language identifier.GetSystemDefaultLCID,KERNEL32.DLL,NM,0, retrieves the system default locale identifier.GetSystemDirectory,KERNEL32.DLL,AW,2, retrieves the path of the Windows system directory.GetSystemInfo,KERNEL32.DLL,NM,1, returns information about the current system.GetSystemMenu,USER32.DLL,NM,2 allows the application to access thewindow menu (also known as the System menu or the Control menu) forcopying and modifying.GetSystemMetrics,USER32.DLL,NM,1, retrieves various system metrics and system configuration settings.GetSystemPaletteEntries,GDI32.DLL,NM,4 retrieves a range of palette entries from the system palette that is associated with the specified device context. GetSystemPaletteUse,GDI32.DLL,NM,1, retrieves the current state of the system (physical) palette for the specified device context.GetSystemPowerStatus,KERNEL32.DLL,NM,1 retrieves the power status of the system. GetSystemTime,KERNEL32.DLL,NM,1, retrieves the current system date and time.GetSystemTimeAdjustment,KERNEL32.DLL,NM,3 determines whether the system is applying periodic time adjustments to its time-of-day clock at each clock interrupt, along with the value and period of any such adjustments.GetSystemTimeAsFileTime,KERNEL32.DLL,NM,1, obtains the current system date and time.GetTapeParameters,KERNEL32.DLL,NM,4, retrieves information that describes the tape or the tape drive. GetTapePosition,KERNEL32.DLL,NM,5, retrieves the current address of the tape, in logical or absolute blocks.GetTapeStatus,KERNEL32.DLL,NM,1, indicates whether the tape device is ready to process tape commands.GetTempFileName,KERNEL32.DLL,AW,4, creates a name for a temporary file.GetTempPath,KERNEL32.DLL,AW,2, retrieves the path of the directory designated for temporary files.GetTextAlign,GDI32.DLL,NM,1, retrieves the text the specified device context.GetTextCharacterExtra,GDI32.DLL,NM,1, retrieves the current intercharacter spacing for the specified device context.GetTextCharset,GDI32.DLL,NM,1 obtains a character-set identifier forthe font that is currently selected into a specified devicecontext.GetTextColor,GDI32.DLL,NM,1, retrieves the current text color for the specified device context.GetTextExtentExPoint,GDI32.DLL,AW,7 retrieves the number of characters in a specified string that will fit within a specified space and fills an array with the text extent for each of those characters.GetTextExtentPoint,GDI32.DLL,AW,4, computes the width and height of the specified string of text.GetTextExtentPoint32,GDI32.DLL,AW,4, computes the width and height of the specified string of text.GetTextFace,GDI32.DLL,AW,3, retrieves the typeface name of the font that is selected into the specified device context.GetTextMetrics,GDI32.DLL,AW,2 fills the specified buffer with the,metrics for the currently selected font.GetThreadContext,KERNEL32.DLL,NM,2, retrieves the context of the specified thread.GetThreadDesktop,USER32.DLL,NM,1, returns a handle to the desktop associated with a specified thread.GetThreadLocale,KERNEL32.DLL,NM,0, returns the calling thread?s current locale.GetThreadPriority,KERNEL32.DLL,NM,1, returns the priority value for the specified thread.GetThreadPriorityBoost,KERNEL32.DLL,NM,2, returns the priority boost control state of the specified thread.GetThreadSelectorEntry,KERNEL32.DLL,NM,3, retrieves a descriptor table entry for the specified selector and thread.GetThreadTimes,KERNEL32.DLL,NM,5, obtains timing information about a specified thread.GetTickCount,KERNEL32.DLL,NM,0 retrieves the number of milliseconds that have elapsed since Windows was started. GetTimeFormat,KERNEL32.DLL,AW,6, formats a time as a time string for a specified locale.GetTimestampForLoadedLibrary,IMAGEHLP.DLL,NM,1, returns the timestamp of a loaded image.GetTimeZoneInformation,KERNEL32.DLL,NM,1, retrieves the current time-zone parameters.GetTokenInformation,ADVAPI32.DLL,NM,5, retrieves a specified type of information about an access token.GetTopWindow,USER32.DLL,NM,1 examines the Z order of the child windows associated with the specified parent window and retrieves the handle of the child window at the top of the Z order. GetTrusteeName,ADVAPI32.DLL,AW,1, retrieves the trustee name from a TRUSTEE structure.GetTrusteeType,ADVAPI32.DLL,AW,1, retrieves the value assigned to the TrusteeType member of a specified TRUSTEE structure.GetTypeByName,MSWSOCK.DLL,AW,2,Important is a Microsoft-specific extension to the Windows Sockets 1.GetTypeByName,WSOCK32.DLL,AW,2,Important is a Microsoft-specific extension to the Windows Sockets 1.GetUpdateRect,USER32.DLL,NM,3 retrieves the coordinates of thesmallest rectangle that completely encloses the update region ofthe specified window.

Page 139: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

GetUpdateRgn,USER32.DLL,NM,3, retrieves the update region of a window by copying it into the specified region.GetUrlCacheEntryInfo,WININET.DLL,AW,3,Retrieves information about a cache entry.GetUrlCacheEntryInfoEx,WININET.DLL,AW,7,Retrieves information on the cache entry associated with the specified URL, taking into account any redirections that are applied in offline mode by the HttpSendRequest function.GetUrlCacheGroupAttribute,WININET.DLL,AW,7,Retrieves the attribute information of the specified cache group.GetUserDefaultLangID,KERNEL32.DLL,NM,0 retrieves the user-default language identifier. GetUserDefaultLCID,KERNEL32.DLL,NM,0, retrieves the user-default locale identifier.GetUserName,ADVAPI32.DLL,AW,2, retrieves the user name of the current thread.GetUserNameEx,SECUR32.DLL,AW,3, retrieves the name of the user or other security principal associated with the calling thread. You can specify the format of the returned name.GetUserObjectInformation,USER32.DLL,AW,5 returns information about awindow station or desktop object.GetUserObjectSecurity,USER32.DLL,NM,5 retrieves security information for the specified user object. GetUserProfileDirectory,USERENV.DLL,AW,3, retrieves the path to the root directory of the specified user's profile.GetVersion,KERNEL32.DLL,NM,0 returns the current version number of Windows and information about the operating system platform.GetViewportExtEx,GDI32.DLL,NM,2, retrieves the x-extents and y-extents of the current viewport for the specified device context.GetViewportOrgEx,GDI32.DLL,NM,2 retrieves the x-coordinates and y-coordinates of the viewport origin for the specified devicecontext.GetVolumeInformation,KERNEL32.DLL,AW,8, returns information about a file system and volume whose root directory is specified.GetWindow,USER32.DLL,NM,2, retrieves the handle of a window that has the specified relationship (Z order or owner) to the specified window. GetWindowContextHelpId,USER32.DLL,NM,1, retrieves the help context identifier, if any, associated with the specified window.GetWindowDC,USER32.DLL,NM,1 retrieves the handle of a display device (DC)context for the specified window.GetWindowExtEx,GDI32.DLL,NM,2 retrieves the x-extents and y-extents of the windowfor the specified device context.GetWindowLong,USER32.DLL,AW,2, retrieves information about the specified window.GetWindowOrgEx,GDI32.DLL,NM,2, retrieves the x-coordinates and y- coordinates of the window origin for the specified device context.GetWindowPlacement,USER32.DLL,NM,2 retrieves the show state and therestored, minimized, and maximized positions of the specifiedwindow.GetWindowRect,USER32.DLL,NM,2, retrieves the dimensions of the bounding rectangle of the specified window.GetWindowRgn,USER32.DLL,NM,2, obtains a copy of the window region of a window.GetWindowsDirectory,KERNEL32.DLL,AW,2, retrieves the path of the Windows directory.GetWindowText,USER32.DLL,AW,3, copies the text of the specified window? s title bar (if it has one) into a buffer.GetWindowTextLength,USER32.DLL,AW,1 retrieves the length, incharacters, of the specified window?s title bar text (if the windowhas a title bar).GetWindowThreadProcessId,USER32.DLL,NM,2, retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. GetWindowWord,USER32.DLL,NM,2, is obsolete.GetWinMetaFileBits,GDI32.DLL,NM,5 converts the enhanced-formatrecords from a metafile into Windows-format records and stores theconverted records in the specified buffer.GetWorldTransform,GDI32.DLL,NM,2, retrieves the current world-space to page-space transformation.GetWsChanges,PSAPI.DLL,NM,3, retrieves information about the pages that have been added to the working set of the specified process since the InitializeProcessForWsWatch function initiated monitoring.glAccum,OPENGL.DLL,NM,2, operates on the accumulation buffer.glAccum,OPENGL32.DLL,NM,2, operates on the accumulation buffer.glAlphaFunc,OPENGL.DLL,NM,2, specifies the alpha test function.glAlphaFunc,OPENGL32.DLL,NM,2, specifies the alpha test function.glAreTexturesResident,OPENGL.DLL,NM,3, determines whether specified texture objects are resident.glAreTexturesResident,OPENGL32.DLL,NM,3, determines whether specified texture objects are resident.glArrayElement,OPENGL.DLL,NM,1, specifies the array elements used to render a vertex.glArrayElement,OPENGL32.DLL,NM,1, specifies the array elements used to render a vertex.glBindTexture,OPENGL.DLL,NM,2, enables the creation of a named texture that is bound to a texture target.glBindTexture,OPENGL32.DLL,NM,2, enables the creation of a named texture that is bound to a texture target.glBitmap,OPENGL.DLL,NM,7, draws a bitmap.glBitmap,OPENGL32.DLL,NM,7, draws a bitmap.glBlendFunc,OPENGL.DLL,NM,2, specifies pixel arithmetic.glBlendFunc,OPENGL32.DLL,NM,2, specifies pixel arithmetic.glCallList,OPENGL.DLL,NM,1, executes a display list.glCallList,OPENGL32.DLL,NM,1, executes a display list.glCallLists,OPENGL.DLL,NM,3, executes a list of display lists.glCallLists,OPENGL32.DLL,NM,3, executes a list of display lists.glClear,OPENGL.DLL,NM,1, clears buffers to preset values.glClear,OPENGL32.DLL,NM,1, clears buffers to preset values.glClearAccum,OPENGL.DLL,NM,4, clears values for the accumulation buffer.glClearAccum,OPENGL32.DLL,NM,4, clears values for the accumulation buffer.glClearColor,OPENGL.DLL,NM,4, specifies clear values for the color buffers.glClearColor,OPENGL32.DLL,NM,4, specifies clear values for the color buffers.glClearDepth,OPENGL.DLL,NM,2, specifies the clear value for the depth buffer.glClearDepth,OPENGL32.DLL,NM,2, specifies the clear value for the depth buffer.glClearIndex,OPENGL.DLL,NM,1, specifies the clear value for the color- index buffers.glClearIndex,OPENGL32.DLL,NM,1, specifies the clear value for the color- index buffers.glClearStencil,OPENGL.DLL,NM,1, specifies the clear value for the stencil buffer.glClearStencil,OPENGL32.DLL,NM,1, specifies the clear value for the stencil buffer.glColor3b,OPENGL.DLL,NM,3 set the current colorglColor3b,OPENGL32.DLL,NM,3 set the current colorglColor3bv,OPENGL.DLL,NM,1 set the current colorglColor3bv,OPENGL32.DLL,NM,1 set the current colorglColor3d,OPENGL.DLL,NM,3 set the current colorglColor3d,OPENGL32.DLL,NM,3 set the current colorglColor3dv,OPENGL.DLL,NM,1 set the current colorglColor3dv,OPENGL32.DLL,NM,1 set the current colorglColor3f,OPENGL.DLL,NM,3 set the current colorglColor3f,OPENGL32.DLL,NM,3 set the current colorglColor3fv,OPENGL.DLL,NM,1 set the current colorglColor3fv,OPENGL32.DLL,NM,1 set the current colorglColor3i,OPENGL.DLL,NM,3 set the current colorglColor3i,OPENGL32.DLL,NM,3 set the current colorglColor3iv,OPENGL.DLL,NM,1 set the current color

glColor3iv,OPENGL32.DLL,NM,1 set the current colorglColor3s,OPENGL.DLL,NM,3 set the current colorglColor3s,OPENGL32.DLL,NM,3 set the current colorglColor3sv,OPENGL.DLL,NM,1 set the current colorglColor3sv,OPENGL32.DLL,NM,1 set the current colorglColor3ub,OPENGL.DLL,NM,3 set the current colorglColor3ub,OPENGL32.DLL,NM,3 set the current colorglColor3ubv,OPENGL.DLL,NM,1 set the current colorglColor3ubv,OPENGL32.DLL,NM,1 set the current colorglColor3ui,OPENGL.DLL,NM,3 set the current colorglColor3ui,OPENGL32.DLL,NM,3 set the current colorglColor3uiv,OPENGL.DLL,NM,1 set the current colorglColor3uiv,OPENGL32.DLL,NM,1 set the current colorglColor3us,OPENGL.DLL,NM,3 set the current colorglColor3us,OPENGL32.DLL,NM,3 set the current colorglColor3usv,OPENGL.DLL,NM,1 set the current colorglColor3usv,OPENGL32.DLL,NM,1 set the current colorglColor4b,OPENGL.DLL,NM,4 set the current colorglColor4b,OPENGL32.DLL,NM,4 set the current colorglColor4bv,OPENGL.DLL,NM,1 set the current colorglColor4bv,OPENGL32.DLL,NM,1 set the current colorglColor4d,OPENGL.DLL,NM,4 set the current colorglColor4d,OPENGL32.DLL,NM,4 set the current colorglColor4dv,OPENGL.DLL,NM,1 set the current colorglColor4dv,OPENGL32.DLL,NM,1 set the current colorglColor4f,OPENGL.DLL,NM,4 set the current colorglColor4f,OPENGL32.DLL,NM,4 set the current colorglColor4fv,OPENGL.DLL,NM,1 set the current colorglColor4fv,OPENGL32.DLL,NM,1 set the current colorglColor4i,OPENGL.DLL,NM,4 set the current colorglColor4i,OPENGL32.DLL,NM,4 set the current colorglColor4iv,OPENGL.DLL,NM,1 set the current colorglColor4iv,OPENGL32.DLL,NM,1 set the current colorglColor4s,OPENGL.DLL,NM,4 set the current colorglColor4s,OPENGL32.DLL,NM,4 set the current colorglColor4sv,OPENGL.DLL,NM,1 set the current colorglColor4sv,OPENGL32.DLL,NM,1 set the current colorglColor4ub,OPENGL.DLL,NM,4 set the current colorglColor4ub,OPENGL32.DLL,NM,4 set the current colorglColor4ubv,OPENGL.DLL,NM,1 set the current colorglColor4ubv,OPENGL32.DLL,NM,1 set the current colorglColor4ui,OPENGL.DLL,NM,4 set the current colorglColor4ui,OPENGL32.DLL,NM,4 set the current colorglColor4uiv,OPENGL.DLL,NM,1 set the current colorglColor4uiv,OPENGL32.DLL,NM,1 set the current colorglColor4us,OPENGL.DLL,NM,4 set the current colorglColor4us,OPENGL32.DLL,NM,4 set the current colorglColor4usv,OPENGL.DLL,NM,1 set the current colorglColor4usv,OPENGL32.DLL,NM,1 set the current colorglColorMask,OPENGL.DLL,NM,4, specifies whether the individual color components in the frame buffer can or cannot be written.glColorMask,OPENGL32.DLL,NM,4, specifies whether the individual color components in the frame buffer can or cannot be written.glColorMaterial,OPENGL.DLL,NM,2, causes a material color to track the current color.glColorMaterial,OPENGL32.DLL,NM,2, causes a material color to track the current color.glColorPointer,OPENGL.DLL,NM,4, defines an array of colors.glColorPointer,OPENGL32.DLL,NM,4, defines an array of colors.glCopyPixels,OPENGL.DLL,NM,5, copies pixels in the frame buffer.glCopyPixels,OPENGL32.DLL,NM,5, copies pixels in the frame buffer.glCopyTexImage1D,OPENGL.DLL,NM,7, copies pixels from the frame buffer into a one-dimensional texture image.glCopyTexImage1D,OPENGL32.DLL,NM,7, copies pixels from the frame buffer into a one-dimensional texture image.glCopyTexImage2D,OPENGL.DLL,NM,4, copies pixels from the frame buffer into a two-dimensional texture image.glCopyTexImage2D,OPENGL32.DLL,NM,4, copies pixels from the frame buffer into a two-dimensional texture image.glCopyTexSubImage1D,OPENGL.DLL,NM,3, copies a sub-image of a one- dimensional texture image from the frame buffer.glCopyTexSubImage1D,OPENGL32.DLL,NM,3, copies a sub-image of a one- dimensional texture image from the frame buffer.glCopyTexSubImage2D,OPENGL.DLL,NM,4, copies a sub-image of a two- dimensional texture image from the frame buffer.glCopyTexSubImage2D,OPENGL32.DLL,NM,4, copies a sub-image of a two- dimensional texture image from the frame buffer.glCullFace,OPENGL.DLL,NM,1, specifies whether front- or back-facing facets can be culled.glCullFace,OPENGL32.DLL,NM,1, specifies whether front- or back-facing facets can be culled.glDeleteLists,OPENGL.DLL,NM,2, deletes a contiguous group of display lists.glDeleteLists,OPENGL32.DLL,NM,2, deletes a contiguous group of display lists.glDeleteTextures,OPENGL.DLL,NM,2, deletes named textures.glDeleteTextures,OPENGL32.DLL,NM,2, deletes named textures.glDepthFunc,OPENGL.DLL,NM,1, specifies the value used for depth-buffer comparisons.glDepthFunc,OPENGL32.DLL,NM,1, specifies the value used for depth-buffer comparisons.glDepthMask,OPENGL.DLL,NM,1, enables or disables writing into the depth buffer.glDepthMask,OPENGL32.DLL,NM,1, enables or disables writing into the depth buffer.glDepthRange,OPENGL.DLL,NM,4, specifies the mapping of z values from normalized device coordinates to window coordinates.glDepthRange,OPENGL32.DLL,NM,4, specifies the mapping of z values from normalized device coordinates to window coordinates.glDisable,OPENGL.DLL,NM,1 disable OpenGL capabilities.glDisable,OPENGL32.DLL,NM,1 disable OpenGL capabilities.glDisableClientState,OPENGL.DLL,NM,1 disable array.glDisableClientState,OPENGL32.DLL,NM,1 disable array.glDrawArrays,OPENGL.DLL,NM,3, specifies multiple primitives to render.glDrawArrays,OPENGL32.DLL,NM,3, specifies multiple primitives to render.glDrawBuffer,OPENGL.DLL,NM,1, specifies which color buffers are to be drawn into.glDrawBuffer,OPENGL32.DLL,NM,1, specifies which color buffers are to be drawn into.glDrawElements,OPENGL.DLL,NM,4, renders primitives from array data.glDrawElements,OPENGL32.DLL,NM,4, renders primitives from array data.glDrawPixels,OPENGL.DLL,NM,5, writes a block of pixels to the frame buffer.glDrawPixels,OPENGL32.DLL,NM,5, writes a block of pixels to the frame buffer.glEdgeFlag,OPENGL.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlag,OPENGL32.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlagPointer,OPENGL.DLL,NM,2, defines an array of edge flags.glEdgeFlagPointer,OPENGL32.DLL,NM,2, defines an array of edge flags.glEdgeFlagv,OPENGL.DLL,NM,1 flag edges as either boundary or nonboundaryglEdgeFlagv,OPENGL32.DLL,NM,1 flag edges as either boundary or nonboundaryglEnable,OPENGL.DLL,NM,1 enable OpenGL capabilities.

Page 140: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

glEnable,OPENGL32.DLL,NM,1 enable OpenGL capabilities. glEnableClientState,OPENGL.DLL,NM,1 enable array.glEnableClientState,OPENGL32.DLL,NM,1 enable array.glEnd,OPENGL.DLL,NM,0 delimit the vertices of a primitive or a group of like primitives.glEnd,OPENGL32.DLL,NM,0 delimit the vertices of a primitive or a group of like primitives.glEndList,OPENGL.DLL,NM,0 create or replace a display list.glEndList,OPENGL32.DLL,NM,0 create or replace a display list.glEvalCoord1d,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord1d,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord1dv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1dv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1f,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1f,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1fv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord1fv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2d,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2d,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2dv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2dv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2f,OPENGL.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2f,OPENGL32.DLL,NM,2 evaluate enabled one- and two-dimensional maps.glEvalCoord2fv,OPENGL.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalCoord2fv,OPENGL32.DLL,NM,1 evaluate enabled one- and two-dimensional maps.glEvalMesh1,OPENGL.DLL,NM,3 compute a one- or two-dimensional grid of points or lines.glEvalMesh1,OPENGL32.DLL,NM,3 compute a one- or two-dimensional grid of points or lines.glEvalMesh2,OPENGL.DLL,NM,5 compute a one- or two-dimensional grid of points or lines.glEvalMesh2,OPENGL32.DLL,NM,5 compute a one- or two-dimensional grid of points or lines.glEvalPoint1,OPENGL.DLL,NM,1 generate and evaluate a single point in a mesh.glEvalPoint1,OPENGL32.DLL,NM,1 generate and evaluate a single point in a mesh.glEvalPoint2,OPENGL.DLL,NM,2 generate and evaluate a single point in a mesh.glEvalPoint2,OPENGL32.DLL,NM,2 generate and evaluate a single point in a mesh.glFeedbackBuffer,OPENGL.DLL,NM,3, controls feedback mode.glFeedbackBuffer,OPENGL32.DLL,NM,3, controls feedback mode.glFinish,OPENGL.DLL,NM,0, blocks until all OpenGL execution is complete.glFinish,OPENGL32.DLL,NM,0, blocks until all OpenGL execution is complete.glFlush,OPENGL.DLL,NM,0, forces execution of OpenGL functions in finite time.glFlush,OPENGL32.DLL,NM,0, forces execution of OpenGL functions in finite time.glFogf,OPENGL.DLL,NM,2 specify fog parameters.glFogf,OPENGL32.DLL,NM,2 specify fog parameters.glFogfv,OPENGL.DLL,NM,2 specify fog parameters.glFogfv,OPENGL32.DLL,NM,2 specify fog parameters.glFogi,OPENGL.DLL,NM,2 specify fog parameters.glFogi,OPENGL32.DLL,NM,2 specify fog parameters.glFogiv,OPENGL.DLL,NM,2 specify fog parameters.glFogiv,OPENGL32.DLL,NM,2 specify fog parameters.glFrontFace,OPENGL.DLL,NM,1, specifies which of the clockwise and counterclockwise facets are front-facing and back-facing.glFrontFace,OPENGL32.DLL,NM,1, specifies which of the clockwise and counterclockwise facets are front-facing and back-facing.glFrustum,OPENGL.DLL,NM,12, multiplies the current matrix by a perspective matrix.glFrustum,OPENGL32.DLL,NM,12, multiplies the current matrix by a perspective matrix.glGenLists,OPENGL.DLL,NM,1, generates a contiguous set of empty display lists.glGenLists,OPENGL32.DLL,NM,1, generates a contiguous set of empty display lists.glGenTextures,OPENGL.DLL,NM,2, generates texture names.glGenTextures,OPENGL32.DLL,NM,2, generates texture names.glGetBooleanv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetBooleanv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetClipPlane,OPENGL.DLL,NM,2, returns in equation the four coefficients of the plane equation for plane.glGetClipPlane,OPENGL32.DLL,NM,2, returns in equation the four coefficients of the plane equation for plane.glGetDoublev,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetDoublev,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetError,OPENGL.DLL,NM,0, returns error information.glGetError,OPENGL32.DLL,NM,0, returns error information.glGetFloatv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetFloatv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetIntegerv,OPENGL.DLL,NM,2 return the value or values of a selected parameter.glGetIntegerv,OPENGL32.DLL,NM,2 return the value or values of a selected parameter.glGetLightfv,OPENGL.DLL,NM,3 return light source parameter values.glGetLightfv,OPENGL32.DLL,NM,3 return light source parameter values.glGetLightiv,OPENGL.DLL,NM,3 return light source parameter values.glGetLightiv,OPENGL32.DLL,NM,3 return light source parameter values.glGetMapdv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapdv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMapfv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapfv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMapiv,OPENGL.DLL,NM,3 return evaluator parameters.glGetMapiv,OPENGL32.DLL,NM,3 return evaluator parameters.glGetMaterialfv,OPENGL.DLL,NM,3 return material parameters.glGetMaterialfv,OPENGL32.DLL,NM,3 return material parameters.glGetMaterialiv,OPENGL.DLL,NM,3 return material parameters.glGetMaterialiv,OPENGL32.DLL,NM,3 return material parameters.glGetPixelMapfv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapfv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPixelMapuiv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapuiv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPixelMapusv,OPENGL.DLL,NM,2 return the specified pixel map.glGetPixelMapusv,OPENGL32.DLL,NM,2 return the specified pixel map.glGetPointerv,OPENGL.DLL,NM,2, returns the address of a vertex data array.glGetPointerv,OPENGL32.DLL,NM,2, returns the address of a vertex data array.glGetPolygonStipple,OPENGL.DLL,NM,1, returns the polygon stipple pattern.glGetPolygonStipple,OPENGL32.DLL,NM,1, returns the polygon stipple pattern.glGetString,OPENGL.DLL,NM,1, returns a string describing the current OpenGL connection.glGetString,OPENGL32.DLL,NM,1, returns a string describing the current OpenGL connection.glGetTexEnvfv,OPENGL.DLL,NM,3 return texture environment parameters.glGetTexEnvfv,OPENGL32.DLL,NM,3 return texture environment parameters.glGetTexEnviv,OPENGL.DLL,NM,3 return texture environment parameters.glGetTexEnviv,OPENGL32.DLL,NM,3 return texture environment parameters.glGetTexGendv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGendv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexGenfv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGenfv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexGeniv,OPENGL.DLL,NM,3 return texture coordinate generation parameters.glGetTexGeniv,OPENGL32.DLL,NM,3 return texture coordinate generation parameters.glGetTexImage,OPENGL.DLL,NM,5, returns a texture image.glGetTexImage,OPENGL32.DLL,NM,5, returns a texture image.

glGetTexLevelParameterfv,OPENGL.DLL,NM,4 return texture parameter values for a specific level of detail.glGetTexLevelParameterfv,OPENGL32.DLL,NM,4 return texture parameter values for a specific level of detail.glGetTexLevelParameteriv,OPENGL.DLL,NM,4 return texture parameter values for a specific level of detail.glGetTexLevelParameteriv,OPENGL32.DLL,NM,4 return texture parameter values for a specific level of detail.glGetTexParameterfv,OPENGL.DLL,NM,3 return texture parameter values.glGetTexParameterfv,OPENGL32.DLL,NM,3 return texture parameter values.glGetTexParameteriv,OPENGL.DLL,NM,3 return texture parameter values.glGetTexParameteriv,OPENGL32.DLL,NM,3 return texture parameter values.glHint,OPENGL.DLL,NM,2, specifies implementation-specific hints.glHint,OPENGL32.DLL,NM,2, specifies implementation-specific hints.glIndexd,OPENGL.DLL,NM,2 set the current color index.glIndexd,OPENGL32.DLL,NM,2 set the current color index.glIndexdv,OPENGL.DLL,NM,1 set the current color index.glIndexdv,OPENGL32.DLL,NM,1 set the current color index.glIndexf,OPENGL.DLL,NM,1 set the current color index.glIndexf,OPENGL32.DLL,NM,1 set the current color index.glIndexfv,OPENGL.DLL,NM,1 set the current color index.glIndexfv,OPENGL32.DLL,NM,1 set the current color index.glIndexi,OPENGL.DLL,NM,1 set the current color index.glIndexi,OPENGL32.DLL,NM,1 set the current color index.glIndexiv,OPENGL.DLL,NM,1 set the current color index.glIndexiv,OPENGL32.DLL,NM,1 set the current color index.glIndexMask,OPENGL.DLL,NM,1, controls the writing of individual bits in the color-index buffers.glIndexMask,OPENGL32.DLL,NM,1, controls the writing of individual bits in the color-index buffers.glIndexPointer,OPENGL.DLL,NM,3, defines an array of color indexes.glIndexPointer,OPENGL32.DLL,NM,3, defines an array of color indexes.glIndexs,OPENGL.DLL,NM,1 set the current color index.glIndexs,OPENGL32.DLL,NM,1 set the current color index.glIndexsv,OPENGL.DLL,NM,1 set the current color index.glIndexsv,OPENGL32.DLL,NM,1 set the current color index.glInitNames,OPENGL.DLL,NM,0, initializes the name stack.glInitNames,OPENGL32.DLL,NM,0, initializes the name stack.glInterleavedArrays,OPENGL.DLL,NM,3, simultaneously specifies and enables several interleaved arrays in a larger aggregate array.glInterleavedArrays,OPENGL32.DLL,NM,3, simultaneously specifies and enables several interleaved arrays in a larger aggregate array.glIsEnabled,OPENGL.DLL,NM,1 tests whether a capability is enabled.glIsEnabled,OPENGL32.DLL,NM,1 tests whether a capability is enabled.glIsList,OPENGL.DLL,NM,1 tests for display list existence.glIsList,OPENGL32.DLL,NM,1 tests for display list existence.glIsTexture,OPENGL.DLL,NM,1, determines if a name corresponds to a texture.glIsTexture,OPENGL32.DLL,NM,1, determines if a name corresponds to a texture.glLightf,OPENGL.DLL,NM,3 set light source parameters.glLightf,OPENGL32.DLL,NM,3 set light source parameters.glLightfv,OPENGL.DLL,NM,3 set light source parameters.glLightfv,OPENGL32.DLL,NM,3 set light source parameters.glLighti,OPENGL.DLL,NM,3 set light source parameters.glLighti,OPENGL32.DLL,NM,3 set light source parameters.glLightiv,OPENGL.DLL,NM,3 set light source parameters.glLightiv,OPENGL32.DLL,NM,3 set light source parameters.glLightModelf,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModelf,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModelfv,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModelfv,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModeli,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModeli,OPENGL32.DLL,NM,2 set the lighting model parameters.glLightModeliv,OPENGL.DLL,NM,2 set the lighting model parameters.glLightModeliv,OPENGL32.DLL,NM,2 set the lighting model parameters.glLineStipple,OPENGL.DLL,NM,2, specifies the line stipple pattern.glLineStipple,OPENGL32.DLL,NM,2, specifies the line stipple pattern.glLineWidth,OPENGL.DLL,NM,1, specifies the width of rasterized lines.glLineWidth,OPENGL32.DLL,NM,1, specifies the width of rasterized lines.glListBase,OPENGL.DLL,NM,1, makes an additional level of indirection available.glListBase,OPENGL32.DLL,NM,1, makes an additional level of indirection available.glLoadIdentity,OPENGL.DLL,NM,0, replaces the current matrix with the identity matrix.glLoadIdentity,OPENGL32.DLL,NM,0, replaces the current matrix with the identity matrix.glLoadMatrixd,OPENGL.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixd,OPENGL32.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixf,OPENGL.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadMatrixf,OPENGL32.DLL,NM,1 replace the current matrix with an arbitrary matrix.glLoadName,OPENGL.DLL,NM,1, loads a name onto the name stack.glLoadName,OPENGL32.DLL,NM,1, loads a name onto the name stack.glLogicOp,OPENGL.DLL,NM,1, specifies a logical pixel operation for color index rendering.glLogicOp,OPENGL32.DLL,NM,1, specifies a logical pixel operation for color index rendering.glMap1d,OPENGL.DLL,NM,4 define a one-dimensional evaluator.glMap1d,OPENGL32.DLL,NM,4 define a one-dimensional evaluator.glMap1f,OPENGL.DLL,NM,6 define a one-dimensional evaluator.glMap1f,OPENGL32.DLL,NM,6 define a one-dimensional evaluator.glMap2d,OPENGL.DLL,NM,7 define a two-dimensional evaluator.glMap2d,OPENGL32.DLL,NM,7 define a two-dimensional evaluator.glMap2f,OPENGL.DLL,NM,10 define a two-dimensional evaluator.glMap2f,OPENGL32.DLL,NM,10 define a two-dimensional evaluator.glMapGrid1d,OPENGL.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid1d,OPENGL32.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid1f,OPENGL.DLL,NM,3 define a one- or two-dimensional mesh.glMapGrid1f,OPENGL32.DLL,NM,3 define a one- or two-dimensional mesh.glMapGrid2d,OPENGL.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid2d,OPENGL32.DLL,NM,5 define a one- or two-dimensional mesh.glMapGrid2f,OPENGL.DLL,NM,6 define a one- or two-dimensional mesh.glMapGrid2f,OPENGL32.DLL,NM,6 define a one- or two-dimensional mesh.glMaterialf,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialf,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMaterialfv,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialfv,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMateriali,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMateriali,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMaterialiv,OPENGL.DLL,NM,3 specify material parameters for the lighting model.glMaterialiv,OPENGL32.DLL,NM,3 specify material parameters for the lighting model.glMatrixMode,OPENGL.DLL,NM,1, sets the current matrix mode.glMatrixMode,OPENGL32.DLL,NM,1, sets the current matrix mode.glMultMatrixd,OPENGL.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glMultMatrixd,OPENGL32.DLL,NM,1 multiply the current matrix by an arbitrary matrix.

Page 141: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

glMultMatrixf,OPENGL.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glMultMatrixf,OPENGL32.DLL,NM,1 multiply the current matrix by an arbitrary matrix.glNewList,OPENGL.DLL,NM,2 create or replace a display list.glNewList,OPENGL32.DLL,NM,2 create or replace a display list.glNormal3b,OPENGL.DLL,NM,3 set the current normal vector.glNormal3b,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3bv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3bv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3d,OPENGL.DLL,NM,3 set the current normal vector.glNormal3d,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3dv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3dv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3f,OPENGL.DLL,NM,3 set the current normal vector.glNormal3f,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3fv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3fv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3i,OPENGL.DLL,NM,3 set the current normal vector.glNormal3i,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3iv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3iv,OPENGL32.DLL,NM,1 set the current normal vector.glNormal3s,OPENGL.DLL,NM,3 set the current normal vector.glNormal3s,OPENGL32.DLL,NM,3 set the current normal vector.glNormal3sv,OPENGL.DLL,NM,1 set the current normal vector.glNormal3sv,OPENGL32.DLL,NM,1 set the current normal vector.glNormalPointer,OPENGL.DLL,NM,3, defines an array of normals.glNormalPointer,OPENGL32.DLL,NM,3, defines an array of normals.GlobalAddAtom,KERNEL32.DLL,AW,1 adds a character string to the globalatom table and returns a unique value (an atom) identifying thestring.GlobalAlloc,KERNEL32.DLL,NM,2, allocates the specified number of bytes from the heap.GlobalCompact,KERNEL32.DLL,NM,1, is obsolete.GlobalDeleteAtom,KERNEL32.DLL,NM,1, decrements the reference count of a global string atom.GlobalFindAtom,KERNEL32.DLL,AW,1 searches the global atom table for thespecified character string and retrieves the global atom associatedwith that string.GlobalFix,KERNEL32.DLL,NM,1, is obsolete.GlobalFlags,KERNEL32.DLL,NM,1, returns information about the specified global memory object.GlobalFree,KERNEL32.DLL,NM,1, frees the specified global memory object and invalidates its handle.GlobalGetAtomName,KERNEL32.DLL,AW,3, retrieves a copy of the character string associated with the specified global atom. GlobalHandle,KERNEL32.DLL,NM,1, retrieves the handle associated with the specified pointer to a global memory block.GlobalLock,KERNEL32.DLL,NM,1, locks a global memory object and returns a pointer to the first byte of the object?s memory block.GlobalMemoryStatus,KERNEL32.DLL,NM,1 obtains information about thecomputer system?s current usage of both physical and virtualmemory.GlobalReAlloc,KERNEL32.DLL,NM,3, changes the size or attributes of a specified global memory object.GlobalSize,KERNEL32.DLL,NM,1, retrieves the current size, in bytes, of the specified global memory object.GlobalUnfix,KERNEL32.DLL,NM,1, is obsolete.GlobalUnWire,KERNEL32.DLL,NM,1, is obsolete.GlobalWire,KERNEL32.DLL,NM,1 is obsolete. glOrtho,OPENGL.DLL,NM,12, multiplies the current matrix by an orthographic matrix.glOrtho,OPENGL32.DLL,NM,12, multiplies the current matrix by an orthographic matrix.glPassThrough,OPENGL.DLL,NM,1, places a marker in the feedback buffer.glPassThrough,OPENGL32.DLL,NM,1, places a marker in the feedback buffer.glPixelMapfv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapfv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelMapuiv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapuiv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelMapusv,OPENGL.DLL,NM,3 set up pixel transfer maps.glPixelMapusv,OPENGL32.DLL,NM,3 set up pixel transfer maps.glPixelStoref,OPENGL.DLL,NM,2, can be used to set any pixel store parameter.glPixelStoref,OPENGL32.DLL,NM,2, can be used to set any pixel store parameter.glPixelStorei,OPENGL.DLL,NM,2 set pixel storage modes.glPixelStorei,OPENGL32.DLL,NM,2 set pixel storage modes.glPixelTransferf,OPENGL.DLL,NM,2, can be used to set any pixel transfer parameter.glPixelTransferf,OPENGL32.DLL,NM,2, can be used to set any pixel transfer parameter.glPixelTransferi,OPENGL.DLL,NM,2 set pixel storage modes.glPixelTransferi,OPENGL32.DLL,NM,2 set pixel storage modes.glPixelZoom,OPENGL.DLL,NM,2, specifies values for the x and y zoom factors.glPixelZoom,OPENGL32.DLL,NM,2, specifies values for the x and y zoom factors.glPointSize,OPENGL.DLL,NM,1, specifies the diameter of rasterized points.glPointSize,OPENGL32.DLL,NM,1, specifies the diameter of rasterized points.glPolygonMode,OPENGL.DLL,NM,2, selects a polygon rasterization mode.glPolygonMode,OPENGL32.DLL,NM,2, selects a polygon rasterization mode.glPolygonStipple,OPENGL.DLL,NM,1, sets the polygon stippling pattern.glPolygonStipple,OPENGL32.DLL,NM,1, sets the polygon stippling pattern.glPopAttrib,OPENGL.DLL,NM,0, restores the values of the state variables saved with the last glPushAttrib command.glPopAttrib,OPENGL32.DLL,NM,0, restores the values of the state variables saved with the last glPushAttrib command.glPopClientAttrib,OPENGL.DLL,NM,0, restores the values of the client- state variables last saved with glPushClientAttrib.glPopClientAttrib,OPENGL32.DLL,NM,0, restores the values of the client- state variables last saved with glPushClientAttrib.glPopMatrix,OPENGL.DLL,NM,0 pop the current matrix stack.glPopMatrix,OPENGL32.DLL,NM,0 pop the current matrix stack.glPrioritizeTextures,OPENGL.DLL,NM,3, sets the residence priority of textures.glPrioritizeTextures,OPENGL32.DLL,NM,3, sets the residence priority of textures.glPushAttrib,OPENGL.DLL,NM,1, takes one argument, a mask that indicates which groups of state variables to save on the attribute stack.glPushAttrib,OPENGL32.DLL,NM,1, takes one argument, a mask that indicates which groups of state variables to save on the attribute stack.glPushClientAttrib,OPENGL.DLL,NM,1 save groups of client-state variables on the client-attribute stack.glPushClientAttrib,OPENGL32.DLL,NM,1 save groups of client-state variables on the client-attribute stack.glPushMatrix,OPENGL.DLL,NM,0, pushes the current matrix stack down by one, duplicating the current matrix.glPushMatrix,OPENGL32.DLL,NM,0, pushes the current matrix stack down by one, duplicating the current matrix.glPushName,OPENGL.DLL,NM,1, causes name to be pushed onto the name stack, which is initially empty.glPushName,OPENGL32.DLL,NM,1, causes name to be pushed onto the name stack, which is initially empty.

glRasterPos2d,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2d,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2f,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2f,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2i,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2i,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2s,OPENGL.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2s,OPENGL32.DLL,NM,2 specify the raster position for pixel operations.glRasterPos2sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos2sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3d,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3d,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3f,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3f,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3i,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3i,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3s,OPENGL.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3s,OPENGL32.DLL,NM,3 specify the raster position for pixel operations.glRasterPos3sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos3sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4d,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4d,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4dv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4dv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4f,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4f,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4fv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4fv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4i,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4i,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4iv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4iv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4s,OPENGL.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4s,OPENGL32.DLL,NM,4 specify the raster position for pixel operations.glRasterPos4sv,OPENGL.DLL,NM,1 specify the raster position for pixel operations.glRasterPos4sv,OPENGL32.DLL,NM,1 specify the raster position for pixel operations.glReadBuffer,OPENGL.DLL,NM,1, selects a color buffer source for pixels.glReadBuffer,OPENGL32.DLL,NM,1, selects a color buffer source for pixels.glReadPixels,OPENGL.DLL,NM,7, reads a block of pixels from the frame buffer.glReadPixels,OPENGL32.DLL,NM,7, reads a block of pixels from the frame buffer.glRectd,OPENGL.DLL,NM,4 draw a rectangle.glRectd,OPENGL32.DLL,NM,4 draw a rectangle.glRectdv,OPENGL.DLL,NM,2 draw a rectangle.glRectdv,OPENGL32.DLL,NM,2 draw a rectangle.glRectf,OPENGL.DLL,NM,4 draw a rectangle.glRectf,OPENGL32.DLL,NM,4 draw a rectangle.glRectfv,OPENGL.DLL,NM,2 draw a rectangle.glRectfv,OPENGL32.DLL,NM,2 draw a rectangle.glRecti,OPENGL.DLL,NM,4 draw a rectangle.glRecti,OPENGL32.DLL,NM,4 draw a rectangle.glRectiv,OPENGL.DLL,NM,2 draw a rectangle.glRectiv,OPENGL32.DLL,NM,2 draw a rectangle.glRects,OPENGL.DLL,NM,4 draw a rectangle.glRects,OPENGL32.DLL,NM,4 draw a rectangle.glRectsv,OPENGL.DLL,NM,2 draw a rectangle.glRectsv,OPENGL32.DLL,NM,2 draw a rectangle.glRenderMode,OPENGL.DLL,NM,1, sets the rasterization mode.glRenderMode,OPENGL32.DLL,NM,1, sets the rasterization mode.glRotated,OPENGL.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotated,OPENGL32.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotatef,OPENGL.DLL,NM,4 multiply the current matrix by a rotation matrix.glRotatef,OPENGL32.DLL,NM,4 multiply the current matrix by a rotation matrix.glScaled,OPENGL.DLL,NM,3 multiply the current matrix by a general scaling matrix.glScaled,OPENGL32.DLL,NM,3 multiply the current matrix by a rotation matrix.glScalef,OPENGL.DLL,NM,3 multiply the current matrix by a rotation matrix.glScalef,OPENGL32.DLL,NM,3 multiply the current matrix by a rotation matrix.glScissor,OPENGL.DLL,NM,4, defines the scissor box.glScissor,OPENGL32.DLL,NM,4, defines the scissor box.glSelectBuffer,OPENGL.DLL,NM,2, establishes a buffer for selection mode values.glSelectBuffer,OPENGL32.DLL,NM,2, establishes a buffer for selection mode values.glShadeModel,OPENGL.DLL,NM,1 selects flat or smooth shading.glShadeModel,OPENGL32.DLL,NM,1 selects flat or smooth shading.glStencilFunc,OPENGL.DLL,NM,3, sets the function and reference value for stencil testing.glStencilFunc,OPENGL32.DLL,NM,3, sets the function and reference value for stencil testing.glStencilMask,OPENGL.DLL,NM,1, controls the writing of individual bits in the stencil planes.glStencilMask,OPENGL32.DLL,NM,1, controls the writing of individual bits in the stencil planes.glStencilOp,OPENGL.DLL,NM,3, sets the stencil test actions.glStencilOp,OPENGL32.DLL,NM,3, sets the stencil test actions.glTexCoord1d,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord1d,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord1dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1f,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1f,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1i,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1i,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1s,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1s,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord1sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord1sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2d,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2d,OPENGL32.DLL,NM,2 set the current texture coordinates.

Page 142: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

glTexCoord2dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2f,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2f,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2i,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2i,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord2s,OPENGL.DLL,NM,2 set the current texture coordinates.glTexCoord2s,OPENGL32.DLL,NM,2 set the current texture coordinates.glTexCoord2sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord2sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3d,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3d,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3f,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3f,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3i,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3i,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord3s,OPENGL.DLL,NM,3 set the current texture coordinates.glTexCoord3s,OPENGL32.DLL,NM,3 set the current texture coordinates.glTexCoord3sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord3sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4d,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4d,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4dv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4dv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4f,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4f,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4fv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4fv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4i,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4i,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4iv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4iv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoord4s,OPENGL.DLL,NM,4 set the current texture coordinates.glTexCoord4s,OPENGL32.DLL,NM,4 set the current texture coordinates.glTexCoord4sv,OPENGL.DLL,NM,1 set the current texture coordinates.glTexCoord4sv,OPENGL32.DLL,NM,1 set the current texture coordinates.glTexCoordPointer,OPENGL.DLL,NM,4, defines an array of texture coordinates.glTexCoordPointer,OPENGL32.DLL,NM,4, defines an array of texture coordinates.glTexEnvf,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvf,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnvfv,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvfv,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnvi,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnvi,OPENGL32.DLL,NM,3 set texture environment parameters.glTexEnviv,OPENGL.DLL,NM,3 set texture environment parameters.glTexEnviv,OPENGL32.DLL,NM,3 set texture environment parameters.glTexGend,OPENGL.DLL,NM,2 control the generation of texture coordinates.glTexGend,OPENGL32.DLL,NM,2 control the generation of texture coordinates.glTexGendv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGendv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGenf,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGenf,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGenfv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGenfv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGeni,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGeni,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexGeniv,OPENGL.DLL,NM,3 control the generation of texture coordinates.glTexGeniv,OPENGL32.DLL,NM,3 control the generation of texture coordinates.glTexImage1D,OPENGL.DLL,NM,4 specifies a one-dimensional texture image.glTexImage1D,OPENGL32.DLL,NM,4 specifies a one-dimensional texture image.glTexImage2D,OPENGL.DLL,NM,9, specifies a two-dimensional texture image.glTexImage2D,OPENGL32.DLL,NM,9, specifies a two-dimensional texture image.glTexParameterf,OPENGL.DLL,NM,3 set texture parameters.glTexParameterf,OPENGL32.DLL,NM,3 set texture parameters.glTexParameterfv,OPENGL.DLL,NM,3 set texture parameters.glTexParameterfv,OPENGL32.DLL,NM,3 set texture parameters.glTexParameteri,OPENGL.DLL,NM,3 set texture parameters.glTexParameteri,OPENGL32.DLL,NM,3 set texture parameters.glTexParameteriv,OPENGL.DLL,NM,3 set texture parameters.glTexParameteriv,OPENGL32.DLL,NM,3 set texture parameters.glTexSubImage1D,OPENGL.DLL,NM,7, specifies a portion of an existing one-dimensional texture image.glTexSubImage1D,OPENGL32.DLL,NM,7, specifies a portion of an existing one-dimensional texture image..glTexSubImage2D,OPENGL.DLL,NM,9, specifies a portion of an existing one-dimensional texture image.glTexSubImage2D,OPENGL32.DLL,NM,9, specifies a portion of an existing one-dimensional texture image.glTranslated,OPENGL.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslated,OPENGL32.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslatef,OPENGL.DLL,NM,3 multiply the current matrix by a translation matrix.glTranslatef,OPENGL32.DLL,NM,3 multiply the current matrix by a translation matrix.gluBeginCurve,GLU32.DLL,NM,1 delimit a NURBS curve definition.gluBeginPolygon,GLU32.DLL,NM,1 delimit a polygon description.gluBeginSurface,GLU32.DLL,NM,1 delimit a NURBS surface definition.gluBeginTrim,GLU32.DLL,NM,1 delimit a NURBS trimming loop definition.gluBuild1DMipmaps,GLU32.DLL,NM,6 creates 1-D mipmaps.gluBuild2DMipmaps,GLU32.DLL,NM,7, creates 2-D mipmaps.gluCylinder,GLU32.DLL,NM,9, draws a cylinder.gluDeleteNurbsRenderer,GLU32.DLL,NM,1, destroys a NURBS object.gluDeleteQuadric,GLU32.DLL,NM,1, destroys a quadric object.gluDeleteTess,GLU32.DLL,NM,1, destroys a tessellation object.gluDisk,GLU32.DLL,NM,7, draws a disk.gluEndCurve,GLU32.DLL,NM,1 delimit a NURBS curve definition.gluEndPolygon,GLU32.DLL,NM,1 delimit a polygon description.gluEndSurface,GLU32.DLL,NM,1 delimit a NURBS surface definition.gluEndTrim,GLU32.DLL,NM,1 delimit a NURBS trimming loop definition.gluErrorString,GLU32.DLL,NM,1 produces an error string from an OpenGL or GLU error code.

gluGetNurbsProperty,GLU32.DLL,NM,3, gets a NURBS property.gluLoadSamplingMatrices,GLU32.DLL,NM,4, loads NURBS sampling and culling matrices.gluLookAt,GLU32.DLL,NM,18, defines a viewing transformation.gluNewNurbsRenderer,GLU32.DLL,NM,0, creates a NURBS object.gluNewQuadric,GLU32.DLL,NM,0, creates a quadric object.gluNewTess,GLU32.DLL,NM,0, creates a tessellation object.gluNextContour,GLU32.DLL,NM,2, marks the beginning of another contour.gluNurbsCallback,GLU32.DLL,NM,3, defines a callback for a NURBS object.gluNurbsCurve,GLU32.DLL,NM,7, defines the shape of a NURBS curve.gluNurbsProperty,GLU32.DLL,NM,3, sets a NURBS property.gluNurbsSurface,GLU32.DLL,NM,11, defines the shape of a NURBS surface.gluOrtho2D,GLU32.DLL,NM,8, defines a 2-D orthographic projection matrix.gluPartialDisk,GLU32.DLL,NM,11, draws an arc of a disk.gluPerspective,GLU32.DLL,NM,8, sets up a perspective projection matrix.gluPickMatrix,GLU32.DLL,NM,9, defines a picking region.gluProject,GLU32.DLL,NM,12, maps object coordinates to window coordinates.gluPwlCurve,GLU32.DLL,NM,5, describes a piecewise linear NURBS trimming curve.gluQuadricCallback,GLU32.DLL,NM,3, defines a callback for a quadric object.gluQuadricDrawStyle,GLU32.DLL,NM,2, specifies the draw style for quadrics rendered with qobj.gluQuadricNormals,GLU32.DLL,NM,2, specifies what kind of normals are to be used for quadrics.gluQuadricOrientation,GLU32.DLL,NM,2, specifies inside or outside orientation for quadrics.gluQuadricTexture,GLU32.DLL,NM,2, specifies whether quadrics are to be textured.gluScaleImage,GLU32.DLL,NM,9, scales an image to an arbitrary size.gluSphere,GLU32.DLL,NM,5, draws a sphere.gluTessCallback,GLU32.DLL,NM,3, defines a callback for a tessellation object.gluTessVertex,GLU32.DLL,NM,3, describes a vertex on a polygon that the user is defining.gluUnProject,GLU32.DLL,NM,12, maps window coordinates to object coordinates.glVertex2d,OPENGL.DLL,NM,2 specify a vertex.glVertex2d,OPENGL32.DLL,NM,2 specify a vertex.glVertex2dv,OPENGL.DLL,NM,1 specify a vertex.glVertex2dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2f,OPENGL.DLL,NM,2 specify a vertex.glVertex2f,OPENGL32.DLL,NM,2 specify a vertex.glVertex2fv,OPENGL.DLL,NM,1 specify a vertex.glVertex2fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2i,OPENGL.DLL,NM,2 specify a vertex.glVertex2i,OPENGL32.DLL,NM,2 specify a vertex.glVertex2iv,OPENGL.DLL,NM,1 specify a vertex.glVertex2iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex2s,OPENGL.DLL,NM,2 specify a vertex.glVertex2s,OPENGL32.DLL,NM,2 specify a vertex.glVertex2sv,OPENGL.DLL,NM,1 specify a vertex.glVertex2sv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3d,OPENGL.DLL,NM,3 specify a vertex.glVertex3d,OPENGL32.DLL,NM,3 specify a vertex.glVertex3dv,OPENGL.DLL,NM,1 specify a vertex.glVertex3dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3f,OPENGL.DLL,NM,3 specify a vertex.glVertex3f,OPENGL32.DLL,NM,3 specify a vertex.glVertex3fv,OPENGL.DLL,NM,1 specify a vertex.glVertex3fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3i,OPENGL.DLL,NM,3 specify a vertex.glVertex3i,OPENGL32.DLL,NM,3 specify a vertex.glVertex3iv,OPENGL.DLL,NM,1 specify a vertex.glVertex3iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex3s,OPENGL.DLL,NM,3 specify a vertex.glVertex3s,OPENGL32.DLL,NM,3 specify a vertex.glVertex3sv,OPENGL.DLL,NM,1 specify a vertex.glVertex3sv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4d,OPENGL.DLL,NM,4 specify a vertex.glVertex4d,OPENGL32.DLL,NM,4 specify a vertex.glVertex4dv,OPENGL.DLL,NM,1 specify a vertex.glVertex4dv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4f,OPENGL.DLL,NM,4 specify a vertex.glVertex4f,OPENGL32.DLL,NM,4 specify a vertex.glVertex4fv,OPENGL.DLL,NM,1 specify a vertex.glVertex4fv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4i,OPENGL.DLL,NM,4 specify a vertex.glVertex4i,OPENGL32.DLL,NM,4 specify a vertex.glVertex4iv,OPENGL.DLL,NM,1 specify a vertex.glVertex4iv,OPENGL32.DLL,NM,1 specify a vertex.glVertex4s,OPENGL.DLL,NM,4 specify a vertex.glVertex4s,OPENGL32.DLL,NM,4 specify a vertex.glVertex4sv,OPENGL.DLL,NM,1 specify a vertex.glVertex4sv,OPENGL32.DLL,NM,1 specify a vertex.glVertexPointer,OPENGL.DLL,NM,4, defines an array of vertex data.glVertexPointer,OPENGL32.DLL,NM,4, defines an array of vertex data.glViewport,OPENGL.DLL,NM,4, sets the viewport.glViewport,OPENGL32.DLL,NM,4, sets the viewport.GopherCreateLocator,WININET.DLL,AW,7,Creates a Gopher or Gopher+ locator string from the selector string's component parts.GopherFindFirstFile,WININET.DLL,AW,6,Uses a Gopher locator and search criteria to create a session with the server and locate the requested documents, binary files, index servers, or directory trees.GopherGetAttribute,WININET.DLL,AW,8,Retrieves the specific attribute information from the server.GopherGetLocatorType,WININET.DLL,AW,2,Parses a Gopher locator and determines its attributes.GopherOpenFile,WININET.DLL,AW,5,Begins reading a Gopher data file from a Gopher server.GrayString,USER32.DLL,AW,9, draws gray text at the specified location.Heap32First,TOOLHELP.DLL,NM,3, retrieves information about the first block of a heap that has been allocated by a process.Heap32ListFirst,TOOLHELP.DLL,NM,2, retrieves information about the first heap that has been allocated by a specified process.Heap32ListNext,TOOLHELP.DLL,NM,2, retrieves information about the next heap that has been allocated by a process.Heap32Next,TOOLHELP.DLL,NM,1, retrieves information about the next block of a heap that has been allocated by a process.HeapAlloc,KERNEL32.DLL,NM,3, allocates a block of memory from a heap.HeapCompact,KERNEL32.DLL,NM,2, attempts to compact a specified heap.HeapCreate,KERNEL32.DLL,NM,3, creates a heap object that can be used by the calling process.HeapDestroy,KERNEL32.DLL,NM,1, destroys the specified heap object.HeapFree,KERNEL32.DLL,NM,3, frees a memory block allocated from a heap by the HeapAlloc or HeapReAlloc function.

Page 143: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

HeapLock,KERNEL32.DLL,NM,1, attempts to acquire the critical section object, or lock, that is associated with a specified heap.HeapReAlloc,KERNEL32.DLL,NM,4, reallocates a block of memory from a heap.HeapSize,KERNEL32.DLL,NM,3, returns the size, in bytes, of a memory block allocated from a heap by the HeapAlloc or HeapReAlloc function.HeapUnlock,KERNEL32.DLL,NM,1, releases ownership of the critical section object, or lock, that is associated with a specified heap.HeapValidate,KERNEL32.DLL,NM,3, attempts to validate a specified heap.HeapWalk,KERNEL32.DLL,NM,2, enumerates the memory blocks in a specified heap.HexFromBin,MAPI32.DLL,NM,3, converts a binary number into a string representation of a hexadecimal number.HideCaret,USER32.DLL,NM,1, removes the caret from the screen.HiliteMenuItem,USER32.DLL,NM,4, highlights or removes the highlighting from an item in a menu bar.HlinkClone,HLINK.DLL,NM,5, HlinkClone Function Not currently supported. HlinkCreateBrowseContext,HLINK.DLL,NM,3, Creates an empty, default instance of the system browse context object.HlinkCreateExtensionServices,HLINK.DLL,NM,7, HlinkCreateExtensionServices Function Not currently supported. HlinkCreateFromData,HLINK.DLL,NM,6, Creates a standard hyperlink object from a Component Object Model (COM) object that supports the IDataObject interface.HlinkCreateFromMoniker,HLINK.DLL,NM,8, Creates a new system hyperlink object from a moniker, a location string, and a friendly name string (used for displaying the hyperlink).HlinkCreateFromString,HLINK.DLL,NM,8, Creates a new hyperlink object from strings representing the hyperlink target, the location within the target, and a friendly name.HlinkCreateShortcut,HLINK.DLL,NM,6,FromString HlinkCreateShortcutFromString Function Not currently supported. HlinkCreateShortcutFromMoniker,HLINK.DLL,NM,7, HlinkCreateShortcutFromMoniker Function Not currently supported. HlinkCreateShortcutFromString,HLINK.DLL,NM,7, HlinkCreateShortcutFromString Function Not currently supported. HlinkGetSpecialReference,HLINK.DLL,NM,2, Retrieves a string for a given value from the HLSR enumeration.HlinkGetValueFromParams,HLINK.DLL,NM,3, HlinkGetValueFromParams Function Not currently supported. HlinkGoBack,URLMON.DLL,NM,1, Executes a hyperlink jump backward within the navigation stack.HlinkGoForward,URLMON.DLL,NM,1, Executes a hyperlink jump forward within the navigation stack.HlinkIsShortcut,HLINK.DLL,NM,1, HlinkIsShortcut Function Not currently supported. HlinkNavigate,HLINK.DLL,NM,6,String Executes a hyperlink jump, specified by a string, to a new document or object. For information about how this function relates to HlinkSimpleNavigateToString, see the Remarks section.HlinkNavigateMoniker,URLMON.DLL,NM,2, Executes a hyperlink jump, specified by a moniker, to a new document or object. For information about how this function relates to the HlinkSimpleNavigateToMoniker function, see the Remarks section.HlinkNavigateString,URLMON.DLL,NM,2, Executes a hyperlink jump, specified by a string, to a new document or object. For information about how this function relates to HlinkSimpleNavigateToString, see the Remarks section.HlinkNavigateToStringReference,HLINK.DLL,NM,9, Creates a hyperlink site from strings representing the hyperlink target, the location within the target, and a friendly name, and then navigates to that site.HlinkOnNavigate,HLINK.DLL,NM,7, Notifies a hyperlink browse context and hyperlink frame, if it exists, that a hyperlink target has been navigated to.HlinkOnRenameDocument,HLINK.DLL,NM,4, HlinkOnRenameDocument Function Not currently supported. HlinkParseDisplayName,HLINK.DLL,NM,5, HlinkParseDisplayName Function Not currently supported. HlinkPreprocessMoniker,HLINK.DLL,NM,3, HlinkPreprocessMoniker Function Not currently supported. HlinkQueryCreateFromData,HLINK.DLL,NM,1, Determines if a new hyperlink can be created from an IDataObject interface.HlinkResolveMonikerForData,HLINK.DLL,NM,7, HlinkResolveMonikerForData Function Not currently supported. HlinkResolveShortcut,HLINK.DLL,NM,6,ToString HlinkResolveShortcutToString Function Not currently supported. HlinkResolveShortcutToMoniker,HLINK.DLL,NM,3, HlinkResolveShortcutToMoniker Function Not currently supported. HlinkResolveShortcutToString,HLINK.DLL,NM,3, HlinkResolveShortcutToString Function Not currently supported. HlinkResolveStringForData,HLINK.DLL,NM,7, HlinkResolveStringForData Function Not currently supported. HlinkSetSpecialReference,HLINK.DLL,NM,2, Inserts a string into a specified member of the HLSR enumeration.HlinkSimpleNavigateToMoniker,URLMON.DLL,NM,8, Executes a hyperlink jump, specified by a moniker, to a new document or object. For information about how this function relates to the HlinkNavigateMoniker function, see the Remarks section.HlinkSimpleNavigateToString,URLMON.DLL,NM,8, Executes a hyperlink jump to a new document or object. For information about how this function relates to HlinkNavigateString, see the Remarks section.HlinkTranslateURL,HLINK.DLL,NM,3, HlinkTranslateURL Function Not currently supported. HlinkUpdateStackItem,HLINK.DLL,NM,6, HlinkUpdateStackItem Function Not currently supported. HrAddColumns,MAPI32.DLL,NM,4 adds or moves columns to the beginning of an existing table.HrAddColumnsEx,MAPI32.DLL,NM,5, adds or moves columns to the beginning of an existing table.HrAllocAdviseSink,MAPI32.DLL,NM,3 creates an advise sink object, givena context specified by the calling implementation and a callbackfunction to be triggered by an event notification.HrBackupClose,EDBBCLI.DLL,NM,1, closes the file that is being backed up.HrBackupEnd,EDBBCLI.DLL,NM,1, cleans up after a backup operation is finished.HrBackupGetBackupLogs,EDBBCLI.DLL,AW,3, obtains the list of log files to back up.HrBackupGetDatabaseNames,EDBBCLI.DLL,AW,3, obtains the list of attached databases on the remote computer.HrBackupOpenFile,EDBBCLI.DLL,AW,4 opens a remote file for backup and performs whatever client and server side operations are necessary to prepare for the backup.HrBackupPrepare,EDBBCLI.DLL,AW,5, connects to a remote Microsoft Exchange Server database and prepares it for backup.HrBackupRead,EDBBCLI.DLL,NM,4, reads one block from a backup file.HrBackupTruncateLogs,EDBBCLI.DLL,NM,1, deletes the committed database log files.HrComposeEID,MAPI32.DLL,NM,7, creates a compound entry identifier for an object, usually a message in a message store.HrComposeMsgID,MAPI32.DLL,NM,6 creates an ASCII string representing acompound entry identifier for an object, usually a message in amessage store.HrDecomposeEID,MAPI32.DLL,NM,7 separates the compound entry identifier of an object, usually a message in a message store, into the entry identifier of that object within the store and the store's entry identifier.

HrDecomposeMsgID,MAPI32.DLL,NM,6 separates the ASCII representation of the compound entry identifier of an object, usually a message in a message store, into the entry identifier of that object within the store and the store's entry identifier.HrDispatchNotifications,MAPI32.DLL,NM,1, forces dispatching of all queued notifications.HrEntryIDFromSz,MAPI32.DLL,NM,3, recreates an entry identifier from its ASCII encoding.HrGetOneProp,MAPI32.DLL,NM,3 retrieves the value of a single propertyfrom a property interface, that is, an interface derived fromIMAPIProp.HrIStorageFromStream,MAPI32.DLL,NM,4, layers an IStorage interface onto an IStream object.HrQueryAllRows,MAPI32.DLL,NM,6 retrieves all rows of a table.HrRestoreEnd,EDBBCLI.DLL,NM,1, cleans up after a restore operation has been performed.HrRestoreGetDatabaseLocations,EDBBCLI.DLL,AW,3, obtains the database locations for the server and service.HrRestorePrepare,EDBBCLI.DLL,AW,3, connects to a remote Microsoft Exchange Server database and prepares it for restore.HrRestoreRegister,EDBBCLI.DLL,AW,8 registers a restore operation, interlocking all subsequent restore operations and preventing the restore target from starting until HrRestoreRegisterComplete is called.HrRestoreRegisterComplete,EDBBCLI.DLL,NM,2 completes a restore operation, allowing subsequent restore operations.HrSetCurrentBackupLog,EDBBCLI.DLL,AW,3, sets the last log number that was backed up.HrSetOneProp,MAPI32.DLL,NM,2, sets or changes the value of a single property on a property interface, that is, an interface derived from IMAPIProp .HrSzFromEntryID,MAPI32.DLL,NM,3, encodes an entry identifier into an ASCII string.HrThisThreadAdviseSink,MAPI32.DLL,NM,2, creates an advise sink that wraps an existing advise sink for thread safety.HrValidateIPMSubtree,MAPI32.DLL,NM,5, adds standard interpersonal message (IPM) folders to a message store.htonl,WS2_32.DLL,NM,1 converts a u_long from host toTCP/IP network byte order.htonl,WSOCK32.DLL,NM,1 converts a u_long from host toTCP/IP network byte order.htons,WS2_32.DLL,NM,1 converts a u_short from host toTCP/IP network byte order.htons,WSOCK32.DLL,NM,1 converts a u_short from host toTCP/IP network byte order.HttpAddRequestHeaders,WININET.DLL,AW,4,Adds one or more HTTP request headers to the HTTP request handle.HttpEndRequest,WININET.DLL,AW,4,Ends an HTTP request that was initiated by HttpSendRequestEx.HttpOpenRequest,WININET.DLL,AW,8,Creates an HTTP request handle.HttpQueryInfo,WININET.DLL,AW,5,Retrieves header information associated with an HTTP request.HttpSendRequest,WININET.DLL,AW,5,Sends the specified request to the HTTP server.HttpSendRequestEx,WININET.DLL,AW,5,Sends the specified request to the HTTP server.ICClose,MSVFW32.DLL,NM,1, closes a compressor or decompressor.ICCompressorChoose,MSVFW32.DLL,NM,6, displays a dialog box in which a user can select a compressor.ICCompressorFree,MSVFW32.DLL,NM,1, frees the resources in the COMPVARS structure used by other VCM functions.ICGetDisplayFormat,MSVFW32.DLL,NM,6, determines the best format available for displaying a compressed image.ICGetInfo,MSVFW32.DLL,NM,3, obtains information about a compressor.ICImageCompress,MSVFW32.DLL,NM,7, compresses an image to a given size.ICImageDecompress,MSVFW32.DLL,NM,5, decompresses an image without using initialization functions.ICInfo,MSVFW32.DLL,NM,3, retrieves information about specific installed compressors or enumerates the installed compressors.ICInstall,MSVFW32.DLL,NM,5, installs a new compressor or decompressor.ICLocate,MSVFW32.DLL,NM,5 finds a compressor or decompressor that can handle images with the specified formats, or finds a driver that can decompress an image with a specified format directly to hardware.IcmpCloseHandle,ICMP.DLL,NM,1,closes a handle opened by a call to IcmpCreateFile.IcmpCreateFile,ICMP.DLL,NM,0, opens a handle on which ICMP Echo Requests can be issued.IcmpParseReplies,ICMP.DLL,NM,2, parses the reply buffer provided and returns the number of ICMP responses found.IcmpSendEcho,ICMP.DLL,NM,8,sends an ICMP Echo request and returns any replies.IcmpSendEcho2,ICMP.DLL,NM,11,sends an ICMP Echo request and returns either immediately (if Event or ApcRoutine is non-NULL) or returns after the specified time-out.ICOpen,MSVFW32.DLL,NM,3, opens a compressor or decompressor.ICOpenFunction,MSVFW32.DLL,NM,4, opens a compressor or decompressor defined as a function.ICRemove,MSVFW32.DLL,NM,3, removes an installed compressor.ICSendMessage,MSVFW32.DLL,NM,4, sends a message to a compressor.ICSeqCompressFrame,MSVFW32.DLL,NM,5, compresses one frame in a sequence of frames.ICSeqCompressFrameEnd,MSVFW32.DLL,NM,1 ends sequence compression thatwas initiated by using the ICSeqCompressFrameStart andICSeqCompressFrame functions.ICSeqCompressFrameStart,MSVFW32.DLL,NM,2 initializes resources forcompressing a sequence of frames using the ICSeqCompressFramefunction.IIDFromString,OLE32.DLL,NM,2,4.2 IIDFromString This function converts a string generated by the function back into the original interface identifier (IID). WINOLEAPIImageAddCertificate,IMAGEHLP.DLL,NM,3, is used to add a certificate to the specified file.ImageDirectoryEntryToData,IMAGEHLP.DLL,NM,4, obtains access to image-specific data.ImageEnumerateCertificates,IMAGEHLP.DLL,NM,5, is used to return information about the certificates currently contained in an image file.ImageGetCertificateData,IMAGEHLP.DLL,NM,4, is used to retrieve a complete certificate from a file.ImageGetCertificateHeader,IMAGEHLP.DLL,NM,3, is used to retrieve the header of the specified certificate, up to, but not including, the section offset array.ImageGetDigestStream,IMAGEHLP.DLL,NM,5, retrieves the requested data from the specified image file.ImagehlpApiVersion,IMAGEHLP.DLL,NM,0, retrieves the information about the version of the library installed on the system.ImagehlpApiVersionEx,IMAGEHLP.DLL,NM,1, modifies the information about the version of the library used by the application.ImageList_Add,COMCTL32.DLL,NM,3, adds an image or images to an image list.ImageList_AddIcon,COMCTL32.DLL,NM,2, adds an icon to an image list.ImageList_AddMasked,COMCTL32.DLL,NM,3, copies the bitmap to an internal data structure.ImageList_BeginDrag,COMCTL32.DLL,NM,4, begins dragging an image.ImageList_Create,COMCTL32.DLL,NM,5, creates a new image list.ImageList_Destroy,COMCTL32.DLL,NM,1, destroys an image list.ImageList_DragEnter,COMCTL32.DLL,NM,3 locks updates to the specifiedwindow during a drag operation and displays the drag image at thespecified position within the window.ImageList_DragLeave,COMCTL32.DLL,NM,1, unlocks the specified window and hides the drag image, allowing the window to be updated.ImageList_DragMove,COMCTL32.DLL,NM,2, moves the image that is being dragged during a drag-and-drop operation.ImageList_DragShowNolock,COMCTL32.DLL,NM,1, shows or hides the image being dragged.ImageList_Draw,COMCTL32.DLL,NM,6, draws an image list item in the specified device context.

Page 144: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

ImageList_DrawEx,COMCTL32.DLL,NM,10, draws an image list item in the specified device context.ImageList_DrawIndirect,COMCTL32.DLL,NM,1,Draws an image list image based on an IMAGELISTDRAWPARAMS structureImageList_Duplicate,COMCTL32.DLL,NM,1,Creates a duplicate of an existing image list.ImageList_EndDrag,COMCTL32.DLL,NM,0, ends a drag operation.ImageList_GetBkColor,COMCTL32.DLL,NM,1, retrieves the current background color for an image list.ImageList_GetDragImage,COMCTL32.DLL,NM,2, retrieves the temporary image list that is used for the drag image.ImageList_GetIcon,COMCTL32.DLL,NM,3, creates an icon or cursor based on an image and mask in an image list.ImageList_GetIconSize,COMCTL32.DLL,NM,3, retrieves the dimensions of images in an image list.ImageList_GetImageCount,COMCTL32.DLL,NM,1, retrieves the number of images in an image list.ImageList_GetImageInfo,COMCTL32.DLL,NM,3, retrieves information about an image.ImageList_LoadImage,COMCTL32.DLL,AW,7 Creates an image list from the specified bitmap.ImageList_Merge,COMCTL32.DLL,NM,6, creates a new image by combining two existing images.ImageList_Read,COMCTL32.DLL,NM,1, reads an image list from a stream.ImageList_Remove,COMCTL32.DLL,NM,2, removes an image from an image list.ImageList_Replace,COMCTL32.DLL,NM,4, replaces an image in an image list with a new image.ImageList_ReplaceIcon,COMCTL32.DLL,NM,3, replaces an image with an icon.ImageList_SetBkColor,COMCTL32.DLL,NM,2, sets the background color for an image list.ImageList_SetDragCursorImage,COMCTL32.DLL,NM,4 creates a new drag imageby combining the specified image (typically a mouse cursor image)with the current drag image.ImageList_SetIconSize,COMCTL32.DLL,NM,3, sets the dimensions of images in an image list and removes all images from the list.ImageList_SetImageCount,COMCTL32.DLL,NM,2,Resizes an existing image list.ImageList_SetOverlayImage,COMCTL32.DLL,NM,3, adds a specified image to the list of images to be used as overlay masks.ImageList_Write,COMCTL32.DLL,NM,2, writes an image list to a stream.ImageLoad,IMAGEHLP.DLL,NM,2, maintains a list of loaded DLLs.ImageNtHeader,IMAGEHLP.DLL,NM,1, locates the IMAGE_NT_HEADERS structure in a PE image and returns a pointer to the data.ImageRemoveCertificate,IMAGEHLP.DLL,NM,2, is used to remove the specified certificate from the given file.ImageRvaToSection,IMAGEHLP.DLL,NM,3, locates a relative virtual address (RVA) within the image header of a file that is mapped as a file and returns a pointer to the section table entry for that RVA.ImageRvaToVa,IMAGEHLP.DLL,NM,4, locates a relative virtual address (RVA) within the image header of a file that is mapped as a file and returns the virtual address of the corresponding byte in the file.ImageUnload,IMAGEHLP.DLL,NM,1, is used to deallocate resources from a previous call to the ImageLoad function.ImmAssociateContext,IMM32.DLL,NM,2, associates the specified input context with the specified window.ImmAssociateContextEx,IMM32.DLL,NM,3, changes the association between the input method context and the specified window or its children.ImmConfigureIME,IMM32.DLL,AW,4, displays the configuration dialog box for the IME of the specified input locale identifier (HKL).ImmCreateContext,IMM32.DLL,NM,0, creates a new input context, allocating memory for the context and initializing it.ImmCreateIMCC,IMM32.DLL,NM,1, (Windows CE .NET Application Development)This function enables an input method editor (IME) to create a new input method context (IMC) component that is a member of an IMC. (Windows CE .NET 4.2)ImmDestroyContext,IMM32.DLL,NM,1, releases the input context and frees any memory associated with it.ImmDestroyIMCC,IMM32.DLL,NM,1, Handle to the IMC component.ImmDisableIME,IMM32.DLL,NM,1, disables the input method editor (IME) for a thread or all threads in a process.ImmEnumInputContext,IMM32.DLL,NM,3, retrieves the input context for the specified thread.ImmEnumRegisterWord,IMM32.DLL,AW,6 enumerates the register strings having the specified reading string, style, and register string.ImmEscape,IMM32.DLL,AW,4, accesses capabilities of particular IMEs that are not available through other IMM APIs. and is used mainly for country-specific operations.ImmGenerateMessage,IMM32.DLL,NM,1,This function enables an input method editor (IME) to generate messages that are sent to the window associated with the input method context (IMC).ImmGetCandidateList,IMM32.DLL,AW,4, retrieves a specified candidate list, copying the list to the specified buffer.ImmGetCandidateListCount,IMM32.DLL,AW,2 retrieves the size of the candidate lists.ImmGetCandidateWindow,IMM32.DLL,NM,3, gets information about the candidate list window.ImmGetCompositionFont,IMM32.DLL,AW,2 retrieves information about the logical font currently used to display characters in the composition window.ImmGetCompositionString,IMM32.DLL,AW,4, retrieves information about the composition string.ImmGetCompositionWindow,IMM32.DLL,NM,2 retrieves information about the composition window.ImmGetContext,IMM32.DLL,NM,1, retrieves the input context associated with the specified window.ImmGetConversionList,IMM32.DLL,AW,6, retrieves the conversion result list of characters or words without generating any IME-related messages.ImmGetConversionStatus,IMM32.DLL,NM,3, gets the current conversion status.ImmGetDefaultIMEWnd,IMM32.DLL,NM,1, gets the default window handle to the IME class.ImmGetDescription,IMM32.DLL,AW,3, copies the description of the IME to the specified buffer.ImmGetGuideLine,IMM32.DLL,AW,4 retrieves information about errors.ImmGetHotKey,IMM32.DLL,NM,4, This function retrieves the value of the input method editor (IME) hot key.ImmGetIMCCLockCount,IMM32.DLL,NM,1, Handle to the IMC component.ImmGetIMCCSize,IMM32.DLL,NM,1, Handle to the IMC component.ImmGetIMCLockCount,IMM32.DLL,NM,1,This function enables an input method editor (IME) to get the lock count of the input method context (IMC).ImmGetIMEFileName,IMM32.DLL,AW,3, gets the filename of the IME associated with the specified keyboard layout.ImmGetImeMenuItems,IMM32.DLL,AW,6, retrieves the menu items that are registered in the IME menu of a specified input context.ImmGetOpenStatus,IMM32.DLL,NM,1, checks whether the IME is open or closed.ImmGetProperty,IMM32.DLL,NM,2, gets the property and capabilities of the IME associated with the specified keyboard layout.ImmGetRegisterWordStyle,IMM32.DLL,AW,3, gets a list of the styles support by the IME associated with the specified keyboard layout.ImmGetStatusWindowPos,IMM32.DLL,NM,2, gets the position of the status window.ImmGetVirtualKey,IMM32.DLL,NM,1 recovers the original virtual-keyvalue associated with a key input message that has already beenprocessed by the IME.ImmInstallIME,IMM32.DLL,AW,2, installs an IME into the system.

ImmIsIME,IMM32.DLL,NM,1, checks whether the specified handle identifies an IME.ImmIsUIMessage,IMM32.DLL,AW,4, checks for messages intended for the IME window and sends those messages to the specified window.ImmLockIMC,IMM32.DLL,NM,1,C This function enables an input method editor (IME) to get a pointer to an input method context (IMC) component that can be a member of the IMC.ImmLockIMCC,IMM32.DLL,NM,1, This function enables an input method editor (IME) to get a pointer to an input method context (IMC) component that can be a member of the IMC.ImmNotifyIME,IMM32.DLL,NM,4, notifies the IME about changes to the status of the input context.ImmRegisterWord,IMM32.DLL,AW,4, registers a string into the dictionary of the IME associated with the specified input locale.ImmReleaseContext,IMM32.DLL,NM,2, releases the input context and unlocks the memory associated in the context.ImmReSizeIMCC,IMM32.DLL,NM,2,This function changes the size of an input method context (IMC) component.ImmSetCandidateWindow,IMM32.DLL,NM,2, sets information about the candidate list window.ImmSetCompositionFont,IMM32.DLL,AW,2, sets the logical font to be used to display characters in the composition window.ImmSetCompositionString,IMM32.DLL,AW,6, sets the characters, attributes, and clauses of the composition and reading strings.ImmSetCompositionWindow,IMM32.DLL,NM,2, causes a IMN_SETSCOMPOSITIONWINDOW message to be sent to the application.ImmSetConversionStatus,IMM32.DLL,NM,3 sets the current conversion status.ImmSetHotKey,IMM32.DLL,NM,4,This function is called by the IME control panel application to set the value of the input method editor (IME) hot key.ImmSetOpenStatus,IMM32.DLL,NM,2, opens or closes the IME.ImmSetStatusWindowPos,IMM32.DLL,NM,2, sets the position of the status window.ImmSimulateHotKey,IMM32.DLL,NM,2 simulates the specified IME hot key,causing the same response as if the user had pressed the hot key inthe specified window.ImmUnlockIMC,IMM32.DLL,NM,1, Handle to the IMC. (Windows CE .NET 4.2)ImmUnlockIMCC,IMM32.DLL,NM,1,This function reduces the lock count for the input method context (IMC) component.ImmUnregisterWord,IMM32.DLL,AW,4 removes a register string from thedictionary of the IME associated with the specified keyboardlayout.ImpersonateDdeClientWindow,USER32.DLL,NM,2 enables a Dynamic Data Exchange (DDE) server application to impersonate a DDE client application's security context.ImpersonateLoggedOnUser,ADVAPI32.DLL,NM,1, lets the calling thread impersonate a user.ImpersonateNamedPipeClient,ADVAPI32.DLL,NM,1, impersonates a named-pipe client application.ImpersonateSecurityContext,SECUR32.DLL,NM,1,Allows a server to impersonate a client by using a token previously obtained by a call to AcceptSecurityContext (General) or QuerySecurityContextToken.ImpersonateSelf,ADVAPI32.DLL,NM,1, obtains an access token that impersonates the security context of the calling process.ImportNtmsDatabase,NTMSAPI.DLL,NM,1, causes RSM to import the database files from the database Export directory at the next restart of the RSM.ImportSecurityContext,SECUR32.DLL,AW,4,Imports a security context. The security context must have been exported to the process calling ImportSecurityContext by a previous call to ExportSecurityContext.InetIsOffline,URL.DLL,NM,1,Determines whether or not the system is connected to the Internet.inet_addr,WS2_32.DLL,NM,1, converts a string containing an (Ipv4) Internet Protocol dotted address into a proper address for the IN_ADDR structure.inet_addr,WSOCK32.DLL,NM,1, converts a string containing an (Ipv4) Internet Protocol dotted address into a proper address for the IN_ADDR structure.inet_ntoa,WS2_32.DLL,NM,1 converts an (Ipv4) Internet network address into a string in Internet standard dotted format.inet_ntoa,WSOCK32.DLL,NM,1 converts an (Ipv4) Internet network address into a string in Internet standard dotted format.InflateRect,USER32.DLL,NM,3, increases or decreases the width and height of the specified rectangle.InitAtomTable,KERNEL32.DLL,NM,1, initializes the local atom table and sets it to the specified size.InitCommonControls,COMCTL32.DLL,NM,0 Registers and initializes the common control window classes. This function is obsolete.InitCommonControlsEx,COMCTL32.DLL,NM,1,Registers specific common control classes from the common control dynamic-link library InitializeAcl,ADVAPI32.DLL,NM,3, creates a new ACL structure.InitializeCriticalSection,KERNEL32.DLL,NM,1, initializes a critical section object.InitializeFlatSB,COMCTL32.DLL,NM,1,Initializes flat scroll bars for a particular window. InitializeProcessForWsWatch,PSAPI.DLL,NM,1, initiates monitoring of the working set of the specified process. You must call this function before calling the GetWsChanges function.InitializeSecurityContext,SECUR32.DLL,AW,12,Initiates the client side, outbound security context from a credential handle by using the Negotiate security package.InitializeSecurityDescriptor,ADVAPI32.DLL,NM,2, initializes a new security descriptor.InitializeSid,ADVAPI32.DLL,NM,3 initializes a security identifier (SID).InitiateSystemShutdown,ADVAPI32.DLL,AW,5, displays a dialog box that notifies the user that the system is shutting down.InitSecurityInterface,SECUR32.DLL,AW,0, returns a pointer to an SSPI dispatch table. This function enables clients to use SSPI without binding directly to an implementation of the interface.InjectNtmsCleaner,NTMSAPI.DLL,NM,5, allows a cleaner cartridge to be inserted into the specified library unit.InjectNtmsMedia,NTMSAPI.DLL,NM,4, allows media to be inserted into the port of the specified library. If the library is busy, RSM queues InjectNtmsMedia and returns success.InSendMessage,USER32.DLL,NM,0 specifies whether the current windowprocedure is processing a message that was sent from another threadby a call to the SendMessage function.InsertMenu,USER32.DLL,AW,5, inserts a new menu item into a menu, moving other items down the menu.InsertMenuItem,USER32.DLL,AW,4, inserts a new menu item at the specified position in a menu.InstallColorProfile,MSCMS.DLL,AW,2, installs a given profile for use on a specified machine. The profile is also copied to the COLOR directory.InterlockedCompareExchange,KERNEL32.DLL,NM,3 performs an atomic comparison of the values specified in the Destination and Comperand parameters and exchange of the values, based on the outcome of the comparison.InterlockedDecrement,KERNEL32.DLL,NM,1 both decrements (decreases byone) the value of the specified 32-bit variable and checks theresulting value.InterlockedExchange,KERNEL32.DLL,NM,2, atomically exchanges a pair of 32- bit values.InterlockedExchangeAdd,KERNEL32.DLL,NM,2, performs an atomic addition of the Increment value to the value pointed to by Addend.InterlockedIncrement,KERNEL32.DLL,NM,1 both increments (increases by one) the value of the specified 32-bit variable and checks the resulting value. InternetAttemptConnect,WININET.DLL,NM,1,Attempts to make a connection to the Internet.InternetAutodial,WININET.DLL,NM,2,Causes the modem to automatically dial the default Internet connection.InternetAutodialHangup,WININET.DLL,NM,1,Disconnects an automatic dial-up connection.

Page 145: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

InternetCanonicalizeUrl,WININET.DLL,AW,4,Canonicalizes a URL, which includes converting unsafe characters and spaces into escape sequences.InternetCheckConnection,WININET.DLL,AW,3,Allows an application to check if a connection to the Internet can be established.InternetCloseHandle,WININET.DLL,NM,1,Closes a single Internet handle.InternetCombineUrl,WININET.DLL,AW,5,Combines a base and relative URL into a single URL. The resultant URL is canonicalized (see InternetCanonicalizeUrl).InternetConfirmZoneCrossing,WININET.DLL,AW,4,Checks for changes between secure and nonsecure URLs. Always inform the user when a change occurs in security between two URLs. Typically, an application should allow the user to acknowledge the change through interaction with a dialog box.InternetConnect,WININET.DLL,AW,8,Opens an File Transfer Protocol (FTP), Gopher, or HTTP session for a given site.InternetCrackUrl,WININET.DLL,AW,4,Cracks a URL into its component parts.InternetCreateUrl,WININET.DLL,AW,4,Creates a URL from its component parts.InternetDial,WININET.DLL,NM,5,Initiates a connection to the Internet using a modem.InternetErrorDlg,WININET.DLL,NM,5,Displays a dialog box for the error that is passed to InternetErrorDlg, if an appropriate dialog box exists.InternetFindNextFile,WININET.DLL,AW,2,Continues a file search started as a result of a previous call to FtpFindFirstFile or GopherFindFirstFile.InternetGetConnectedState,WININET.DLL,NM,2,Retrieves the connected state of the local system.InternetGetConnectedStateEx,WININET.DLL,NM,4,Retrieves the connected state of the specified Internet connection.InternetGetCookie,WININET.DLL,AW,4,Retrieves the cookie for the specified URL.InternetGetLastResponseInfo,WININET.DLL,AW,3,Retrieves the last error description or server response on the thread calling this function.InternetGoOnline,WININET.DLL,NM,3,Prompts the user for permission to initiate connection to a URL.InternetHangUp,WININET.DLL,NM,2,Instructs the modem to disconnect from the Internet.InternetLockRequestFile,WININET.DLL,NM,2,Places a lock on the file that is being used.InternetOpen,WININET.DLL,AW,5,Initializes an application's use of the WinINet functions.InternetOpenUrl,WININET.DLL,AW,6,Opens a resource specified by a complete FTP, Gopher, or HTTP URL.InternetQueryDataAvailable,WININET.DLL,NM,4,Queries the server to determine the amount of data available.InternetQueryOption,WININET.DLL,AW,4,Queries an Internet option on the specified handle.InternetReadFile,WININET.DLL,NM,4,Reads data from a handle opened by the InternetOpenUrl, FtpOpenFile, GopherOpenFile, or HttpOpenRequest function.InternetReadFileEx,WININET.DLL,AW,4,Reads data from a handle opened by the InternetOpenUrl or HttpOpenRequest function.InternetSetCookie,WININET.DLL,AW,3,Creates a cookie associated with the specified URL.InternetSetDialState,WININET.DLL,NM,3,This function is obsolete. Do not use.InternetSetFilePointer,WININET.DLL,NM,5,Sets a file position for InternetReadFile. This is a synchronous call; however, subsequent calls to InternetReadFile might block or return pending if the data is not available from the cache and the server does not support random access.InternetSetOption,WININET.DLL,AW,4,Sets an Internet option.InternetSetOptionEx,WININET.DLL,AW,5,Implemented only as a stub that calls the InternetSetOption function; InternetSetOptionEx has no functionality of its own. Do not use this function at this time.InternetSetStatusCallback,WININET.DLL,AW,2,Sets up a callback function that WinINet functions can call as progress is made during an operation.InternetTimeFromSystemTime,WININET.DLL,AW,4,Formats a date and time according to the HTTP version 1.0 specification.InternetTimeToSystemTime,WININET.DLL,AW,3,Converts an HTTP time/date string to a SYSTEMTIME structure.InternetUnlockRequestFile,WININET.DLL,NM,1,Unlocks a file that was locked using InternetLockRequestFile.InternetWriteFile,WININET.DLL,NM,4,Writes data to an open Internet file.IntersectClipRect,GDI32.DLL,NM,5 creates a new clipping region fromthe intersection of the current clipping region and the specifiedrectangle.IntersectRect,USER32.DLL,NM,3 calculates the intersection of two source rectangles and places the coordinates of the intersection rectangle into the destination rectangle. InvalidateRect,USER32.DLL,NM,3, adds a rectangle to the specified window?s update region.InvalidateRgn,USER32.DLL,NM,3, invalidates the client area within the window.InventoryNtmsLibrary,NTMSAPI.DLL,NM,3, queues an inventory of the specified library. If the library is busy, RSM queues InventoryNtmsLibrary and returns success.InvertRect,USER32.DLL,NM,2 inverts a rectangle in a window byperforming a logical NOT operation on the color values for eachpixel in the rectangle?s interior.InvertRgn,GDI32.DLL,NM,2, inverts the colors in the specified region.ioctlsocket,WS2_32.DLL,NM,3, can be used on any socket in any state.ioctlsocket,WSOCK32.DLL,NM,3, can be used on any socket in any state.IsAccelerator,OLE32.DLL,NM,4,Determines whether the keystroke maps to an accelerator in the given accelerator table.IsAsyncMoniker,URLMON.DLL,NM,1, Tests to determine whether a moniker supports asynchronous binding.IsBadCodePtr,KERNEL32.DLL,NM,1, determines whether the calling process has read access to the memory at the specified address.IsBadHugeReadPtr,KERNEL32.DLL,NM,2, verifies that the calling process has read access to the specified range of memory. IsBadHugeWritePtr,KERNEL32.DLL,NM,2, verifies that the calling process has write access to the specified range of memory.IsBadReadPtr,KERNEL32.DLL,NM,2, verifies that the calling process has read access to the specified range of memory.IsBadStringPtr,KERNEL32.DLL,AW,2, verifies that the calling process has read access to a range of memory pointed to by a string pointer.IsBadWritePtr,KERNEL32.DLL,NM,2, verifies that the calling process has write access to the specified range of memory.IsCharAlpha,USER32.DLL,AW,1, determines whether a character is an alphabetic character.IsCharAlphaNumeric,USER32.DLL,AW,1, determines whether a character is either an alphabetic or a numeric character.IsCharLower,USER32.DLL,AW,1, determines whether a character is lowercase.IsCharUpper,USER32.DLL,AW,1, determines whether a character is uppercase.IsChild,USER32.DLL,NM,2, tests whether a window is a child window or descendant window of a specified parent window.IsClipboardFormatAvailable,USER32.DLL,NM,1, determines whether the clipboard contains data in the specified format.IsColorProfileTagPresent,MSCMS.DLL,NM,3, reports whether a specified International Color Consortium (ICC) tag is present in the specified color profile.IsColorProfileValid,MSCMS.DLL,NM,2, allows an application to determine whether the specified profile is a valid International Color Consortium (ICC) profile that can be used for color management.IsDBCSLeadByte,KERNEL32.DLL,NM,1 determines whether a character is alead byte / that is, the first byte of a character in a double-byte character set (DBCS).IsDBCSLeadByteEx,KERNEL32.DLL,NM,2 determines whether a character is alead byte / that is, the first byte of a character in a double-byte character set (DBCS).IsDebuggerPresent,KERNEL32.DLL,NM,0, indicates whether the calling process is running under the context of a debugger.

IsDialogMessage,USER32.DLL,AW,2 determines whether a message isintended for the specified dialog box and, if it is, processes themessage.IsDlgButtonChecked,USER32.DLL,NM,2 determines whether a button control has a check mark next to it or whether a three-state button control is grayed, checked, or neither. IsEqualGUID,OLE32.DLL,NM,2, GUID to compare to rguid2. rguid2 [in] GUID to compare to rguid1.IsIconic,USER32.DLL,NM,1, determines whether the specified window is minimized (iconic).IsMenu,USER32.DLL,NM,1, determines whether a handle is a menu handle.IsProcessorFeaturePresent,KERNEL32.DLL,NM,1 determines whether thespecified processor feature is supported by at least one processoron the current machine.IsRectEmpty,USER32.DLL,NM,1, determines whether the specified rectangle is empty.IsTextUnicode,ADVAPI32.DLL,NM,3, determines whether a buffer probably contains a form of Unicode text.IsValidAcl,ADVAPI32.DLL,NM,1 validates an access-control list (ACL).IsValidCodePage,KERNEL32.DLL,NM,1 determines whether a specified code page isvalid.IsValidIid,OLE32.DLL,NM,1,4.2 IsValidIid This function is obsolete. Last updated on Wednesday, April 13, 2005 B) 2005IsValidInterface,OLE32.DLL,NM,1,4.2 IsValidInterface This function is obsolete. Last updated on Wednesday, April 13, 2005 B)IsValidLocale,KERNEL32.DLL,NM,2, applies a validity test to a locale identifier.IsValidPtrIn,OLE32.DLL,NM,2,4.2 IsValidPtrIn This function is obsolete. Last updated on Wednesday, April 13, 2005 B) 2005IsValidPtrOut,OLE32.DLL,NM,2,4.2 IsValidPtrOut This function is obsolete. IsValidSecurityDescriptor,ADVAPI32.DLL,NM,1, determines whether the components of a security descriptor are valid.IsValidSid,ADVAPI32.DLL,NM,1 validates a SID structure by verifying thatthe revision number is within a known range and that the number ofsubauthorities is less than the maximum.IsValidURL,URLMON.DLL,NM,3, Determines if a specified string is a valid URL.IsWindow,USER32.DLL,NM,1, determines whether the specified window handle identifies an existing window.IsWindowEnabled,USER32.DLL,NM,1, determines whether the specified window is enabled for mouse and keyboard input.IsWindowUnicode,USER32.DLL,NM,1, determines whether the specified window is a native Unicode window.IsWindowVisible,USER32.DLL,NM,1, retrieves the visibility state of the specified window.IsZoomed,USER32.DLL,NM,1, determines whether a window is maximized.joyGetDevCaps,WINMM.DLL,AW,3, queries a joystick to determine its capabilities.joyGetNumDevs,WINMM.DLL,NM,0, queries the joystick driver for the number of joysticks it supports.joyGetPos,WINMM.DLL,NM,2, queries a joystick for its position and button statusjoyGetPosEx,WINMM.DLL,NM,2, queries a joystick for its position and button status.joyGetThreshold,WINMM.DLL,NM,2, queries a joystick for its current movement threshold.joyReleaseCapture,WINMM.DLL,NM,1, releases the specified captured joystick.joySetCapture,WINMM.DLL,NM,4 captures a joystick by causing itsmessages to be sent to the specified window.joySetThreshold,WINMM.DLL,NM,2, sets the movement threshold of a joystick.keybd_event,USER32.DLL,NM,4, synthesizes a keystroke.KillTimer,USER32.DLL,NM,2, destroys the specified timer.LaunchWizard,MAPI32.DLL,NM,5 Call LaunchWizard to add the MSEMS service.LBItemFromPt,COMCTL32.DLL,NM,4, retrieves the index of the item at the specified point in a list box.LCMapString,KERNEL32.DLL,AW,6, maps one character string to another, performing a specified locale-dependent transformation.LeaveCriticalPolicySection,USERENV.DLL,NM,1, resumes the background application of policy. This function closes the handle to the policy section.LeaveCriticalSection,KERNEL32.DLL,NM,1, releases ownership of the specified critical section object.LHashValOfNameSys,OLEAUT32.DLL,AW,3,Computes a hash value for a name that can then be passed to ITypeComp::Bind, ITypeComp::BindType, ITypeLib::FindName, orlineAccept,TAPI32.DLL,NM,3, accepts the specified offered call.lineAddProvider,TAPI32.DLL,AW,3, installs a new telephony service provider into the telephony system.lineAddToConference,TAPI32.DLL,NM,2, adds the call specified by hConsultCall to the conference call specified by hConfCall.lineAgentSpecific,TAPI32.DLL,NM,5 allows the application to accessproprietary handler-specific functions of the agent handlerassociated with the address.lineAnswer,TAPI32.DLL,NM,3, answers the specified offering call.lineBlindTransfer,TAPI32.DLL,AW,3 performs a blind or single-steptransfer of the specified call to the specified destinationaddress.lineClose,TAPI32.DLL,NM,1, closes the specified open line device.lineCompleteCall,TAPI32.DLL,NM,4, specifies how a call that could not be connected normally should be completed instead.lineCompleteTransfer,TAPI32.DLL,NM,4, completes the transfer of the specified call to the party connected in the consultation call.lineConfigDialog,TAPI32.DLL,AW,3 causes the provider of the specified line device to display a dialog box (attached to hwndOwner of the application) to allow the user to configure parameters related to the line device. lineConfigDialogEdit,TAPI32.DLL,AW,6 causes the provider of the specified line device to display a dialog box (attached to hwndOwner of the application) to allow the user to configure parameters related to the line device. lineConfigProvider,TAPI32.DLL,NM,2, causes a service provider to display its configuration dialog box.LineDDA,GDI32.DLL,NM,6 determines which pixels should be highlighted for a line defined by the specified starting and ending points. lineDeallocateCall,TAPI32.DLL,NM,1, deallocates the specified call handle.lineDevSpecific,TAPI32.DLL,NM,5, enables service providers to provide access to features not offered by other TAPI functions.lineDevSpecificFeature,TAPI32.DLL,NM,4, enables service providers to provide access to features not offered by other TAPI functions.lineDial,TAPI32.DLL,AW,3, dials the specified dialable number on the specified call.lineDrop,TAPI32.DLL,NM,3, drops or disconnects the specified call.lineForward,TAPI32.DLL,AW,7 forwards calls destined for the specified address on the specified line, according to the specified forwarding instructions. lineGatherDigits,TAPI32.DLL,AW,7 initiates the buffered gathering of digits on the specified call. lineGenerateDigits,TAPI32.DLL,AW,4 initiates the generation of thespecified digits on the specified call as inband tones using thespecified signaling mode.lineGenerateTone,TAPI32.DLL,NM,5, generates the specified inband tone over the specified call.lineGetAddressCaps,TAPI32.DLL,AW,6, queries the specified address on the specified line device to determine its telephony capabilities.lineGetAddressID,TAPI32.DLL,AW,5 returns the address identifierassociated with an address in a different format on the specifiedline.lineGetAddressStatus,TAPI32.DLL,AW,3, allows an application to query the specified address for its current status.lineGetAgentActivityList,TAPI32.DLL,AW,3 obtains the identities of activities that the application can select using lineSetAgentActivity to indicate what function the agent is actually performing at the moment.

Page 146: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

lineGetAgentCaps,TAPI32.DLL,AW,5, obtains the agent-related capabilities supported on the specified line device.lineGetAgentGroupList,TAPI32.DLL,AW,3 obtains the identities of agent groups (combination of queue, supervisor, skill level, and so on) into which the agent currently logged in on the workstation is permitted to log into on the automatic call distributor. lineGetAgentStatus,TAPI32.DLL,AW,3, obtains the agent-related status on the specified address.lineGetAppPriority,TAPI32.DLL,AW,6 allows an application to determine whether or not it is in the handoff priority list for a particular media mode or Assisted Telephony request mode and, if so, its position in the priority list. lineGetCallInfo,TAPI32.DLL,AW,2, enables an application to obtain fixed information about the specified call.lineGetCallStatus,TAPI32.DLL,NM,2, returns the current status of the specified call.lineGetConfRelatedCalls,TAPI32.DLL,NM,2 returns a list of call handles that are part of the same conference call as the specified call.lineGetCountry,TAPI32.DLL,AW,3 fetches the stored dialing rules and other information related to a specified country, the first country in the country list, or all countries. lineGetDevCaps,TAPI32.DLL,AW,5, queries a specified line device to determine its telephony capabilities.lineGetDevConfig,TAPI32.DLL,AW,3 returns an "opaque" data structure object, the contents of which are specific to the line (service provider) and device class. lineGetIcon,TAPI32.DLL,AW,3 allows an application to retrieve aservice line device-specific (or provider-specific) icon fordisplay to the user.lineGetID,TAPI32.DLL,AW,6 returns a device identifier for thespecified device class associated with the selected line, address,or call.lineGetLineDevStatus,TAPI32.DLL,AW,2, enables an application to query the specified open line device for its current status. lineGetMessage,TAPI32.DLL,NM,3 returns the next TAPI message that is queued for delivery to an application that is using the Event Handle notification mechanismlineGetNewCalls,TAPI32.DLL,NM,4 returns call handles to calls on aspecified line or address for which the application currently doesnot have handles.lineGetNumRings,TAPI32.DLL,NM,3 determines the number of rings anincoming call on the given address should ring prior to answeringthe call.lineGetProviderList,TAPI32.DLL,AW,2, returns a list of service providers currently installed in the telephony system.lineGetRequest,TAPI32.DLL,AW,3, retrieves the next by-proxy request for the specified request mode.lineGetStatusMessages,TAPI32.DLL,NM,3 enables an application to query which notification messages the application is set up to receive for events related to status changes for the specified line or any of its addresses. lineGetTranslateCaps,TAPI32.DLL,AW,3, returns address translation capabilities.lineHandoff,TAPI32.DLL,AW,3, gives ownership of the specified call to another application.lineHold,TAPI32.DLL,NM,1, places the specified call on hold.lineInitialize,TAPI32.DLL,NM,5, is obsolete.lineInitializeEx,TAPI32.DLL,AW,7, initializes the application's use of TAPI for subsequent use of the line abstraction.lineMonitorDigits,TAPI32.DLL,NM,2, enables and disables the unbuffered detection of digits received on the call.lineMonitorTones,TAPI32.DLL,NM,3, enables and disables the detection of inband tones on the call.lineNegotiateAPIVersion,TAPI32.DLL,NM,6, allows an application to negotiate an API version to use.lineNegotiateExtVersion,TAPI32.DLL,NM,6 allows an application to negotiate an extension version to use with the specified line device.lineOpen,TAPI32.DLL,AW,9 opens the line device specified by its deviceidentifier and returns a line handle for the corresponding openedline device.linePark,TAPI32.DLL,AW,4, parks the specified call according to the specified park mode.linePickup,TAPI32.DLL,AW,5 picks up a call alerting at the specified destination address and returns a call handle for the picked-up call. linePrepareAddToConference,TAPI32.DLL,AW,3, prepares an existing conference call for the addition of another party.lineProxyMessage,TAPI32.DLL,NM,6, is used by a registered proxy request handler to generate TAPI messages related to its role.lineProxyResponse,TAPI32.DLL,NM,3 used by a registered proxy request handler to generate TAPI messages related to its role.lineRedirect,TAPI32.DLL,AW,3, redirects the specified offering call to the specified destination address.lineRegisterRequestRecipient,TAPI32.DLL,NM,4 registers the invokingapplication as a recipient of requests for the specified requestmode.lineReleaseUserUserInfo,TAPI32.DLL,NM,1 informs the service provider that the application has processed the user-user information contained in the LINECALLINFO structure, and that subsequently received user-user information can now be written into that structure.lineRemoveFromConference,TAPI32.DLL,NM,1, removes the specified call from the conference call to which it currently belongs.lineRemoveProvider,TAPI32.DLL,NM,2, removes an existing telephony service provider from the telephony system.lineSecureCall,TAPI32.DLL,NM,1, secures the call from any interruptions or interference that can affect the call's media stream.lineSendUserUserInfo,TAPI32.DLL,NM,3, sends user-user information to the remote party on the specified call.lineSetAgentActivity,TAPI32.DLL,NM,3, sets the agent activity code associated with a particular address.lineSetAgentGroup,TAPI32.DLL,NM,3, sets the agent groups into which the agent is logged into on a particular address.lineSetAgentState,TAPI32.DLL,NM,4, sets the agent state associated with a particular address. lineSetAppPriority,TAPI32.DLL,AW,6 allows an application to set its priority in the handoff priority list for a particular media mode or Assisted Telephony request mode, or to remove itself from the priority list. lineSetAppSpecific,TAPI32.DLL,NM,2 enables an application to set theapplication-specific field of the specified call's call-informationrecord.lineSetCallData,TAPI32.DLL,NM,3, sets the CallData member in LINECALLINFO.lineSetCallParams,TAPI32.DLL,NM,5 allows an application to change bearer mode and/or the rate parameters of an existing call. lineSetCallPrivilege,TAPI32.DLL,NM,2, sets the application's privilege to the specified privilege.lineSetCallQualityOfService,TAPI32.DLL,NM,5 allows the application to attempt to change the quality of service parameters (reserved capacity and performance guarantees) for an existing call. lineSetCallTreatment,TAPI32.DLL,NM,2, sets the sounds a party on a call that is unanswered or on hold hears.lineSetCurrentLocation,TAPI32.DLL,NM,2 sets the location used as the context for address translation. lineSetDevConfig,TAPI32.DLL,AW,4 allows the application to restore the configuration of a media stream device on a line device to a setup previously obtained using lineGetDevConfig .lineSetLineDevStatus,TAPI32.DLL,NM,3, sets the line device status.lineSetMediaControl,TAPI32.DLL,NM,12 enables and disables controlactions on the media stream associated with the specified line,address, or call.lineSetMediaMode,TAPI32.DLL,NM,2, changes the call's media mode in its LINECALLINFO structure.

lineSetNumRings,TAPI32.DLL,NM,3, sets the number of rings that must occur before an incoming call is answered.lineSetTerminal,TAPI32.DLL,NM,7 enables an application to specifywhich terminal information related to the specified line, address,or call is to be routed.lineSetTollList,TAPI32.DLL,AW,4, manipulates the toll list.lineSetupConference,TAPI32.DLL,AW,6, sets up a conference call for the addition of the third party.lineSetupTransfer,TAPI32.DLL,AW,3, initiates a transfer of the call specified by the hCall parameter.lineShutdown,TAPI32.DLL,NM,1, shuts down the application's usage of the line abstraction of the API.lineSwapHold,TAPI32.DLL,NM,2, swaps the specified active call with the specified call on consultation hold.LineTo,GDI32.DLL,NM,3, draws a line from the current position up to, but not including, the specified point.lineTranslateAddress,TAPI32.DLL,AW,7, translates the specified address into another format.lineUncompleteCall,TAPI32.DLL,NM,2, cancels the specified call completion request on the specified line.lineUnhold,TAPI32.DLL,NM,1, retrieves the specified held call.lineUnpark,TAPI32.DLL,AW,4, retrieves the call parked at the specified address and returns a call handle for it.listen,WS2_32.DLL,NM,2,WSAEINVAL was not invoked prior to accept.listen,WSOCK32.DLL,NM,2,WSAEINVAL was not invoked prior to accept.LoadAccelerators,USER32.DLL,AW,2, loads the specified accelerator table.LoadBitmap,USER32.DLL,AW,2, loads the specified bitmap resource from a module?s executable file.LoadCursor,USER32.DLL,AW,2, loads the specified cursor resource from the executable (.LoadCursorFromFile,USER32.DLL,AW,1, creates a cursor based on data contained in a file.LoadIcon,USER32.DLL,AW,2, can load only icons of these dimensions.LoadImage,USER32.DLL,AW,6, loads an icon, cursor, or bitmap.LoadKeyboardLayout,USER32.DLL,AW,2, loads a new keyboard layout into the system.LoadLibrary,KERNEL32.DLL,AW,1, maps the specified executable module into the address space of the calling process.LoadLibraryEx,KERNEL32.DLL,AW,3, maps a specified executable module into the address space of the calling process.LoadMenu,USER32.DLL,AW,2, loads the specified menu resource from the executable (.LoadMenuIndirect,USER32.DLL,AW,1, loads the specified menu template in memory.LoadModule,KERNEL32.DLL,NM,2, loads and executes an application or creates a new instance of an existing application.LoadPerfCounterTextStrings,LOADPERF.DLL,AW,2, loads performance objects and counters from the system that are identified by the specified initialization file.LoadRegTypeLib,OLEAUT32.DLL,NM,5,4.2 LoadRegTypeLib This function uses registry information to load a type library. HRESULT LoadRegTypeLib( REFGUID rguid, unsigned shortLoadResource,KERNEL32.DLL,NM,2, loads the specified resource into global memory.LoadString,USER32.DLL,AW,4 loads a string resource from the executablefile associated with a specified module, copies the string into abuffer, and appends a terminating null character.LoadTypeLib,OLEAUT32.DLL,NM,2,ExLoads a type library and (optionally) registers it in the system registry.LoadTypeLibEx,OLEAUT32.DLL,NM,3,Loads a type library and (optionally) registers it in the system registry.LoadUserProfile,USERENV.DLL,AW,2, loads the specified user's profile. The profile can be a local user profile or a roaming user profile.LocalAlloc,KERNEL32.DLL,NM,2, allocates the specified number of bytes from the heap.LocalCompact,KERNEL32.DLL,NM,1, is obsolete.LocalFileTimeToFileTime,KERNEL32.DLL,NM,2 converts a local file time to a file time based on the Coordinated Universal Time (UTC). LocalFlags,KERNEL32.DLL,NM,1 returns information about the specified local memory object. LocalFree,KERNEL32.DLL,NM,1, frees the specified local memory object and invalidates its handle.LocalHandle,KERNEL32.DLL,NM,1 retrieves the handle associated with the specified pointer to a local memory object. LocalReAlloc,KERNEL32.DLL,NM,3, changes the size or the attributes of a specified local memory object.LocalShrink,KERNEL32.DLL,NM,2, is obsolete.LocalSize,KERNEL32.DLL,NM,1, returns the current size, in bytes, of the specified local memory object.LocalUnlock,KERNEL32.DLL,NM,1, unlocks it and decrements the lock count by one.LockFile,KERNEL32.DLL,NM,5, locks a region in an open file.LockFileEx,KERNEL32.DLL,NM,6, locks a byte range within an open file for shared or exclusive access.LockResource,KERNEL32.DLL,NM,1, locks the specified resource in memory.LockServiceDatabase,ADVAPI32.DLL,NM,1, locks the specified service control manager database.LockWindowUpdate,USER32.DLL,NM,1, disables or reenables drawing in the specified window.LogonUser,ADVAPI32.DLL,AW,6, attempts to log a user on to the local was called.LookupAccountName,ADVAPI32.DLL,AW,7, accepts the name of a system and an account as input.LookupAccountSid,ADVAPI32.DLL,AW,7, accepts a security identifier (SID) as input.LookupIconIdFromDirectory,USER32.DLL,NM,2, searches through icon or cursor data for the icon or cursor that best fits the current display device. LookupIconIdFromDirectoryEx,USER32.DLL,NM,5 searches through icon or cursor data for the icon or cursor that best fits the current display device. LookupPrivilegeDisplayName,ADVAPI32.DLL,AW,5, retrieves a displayable name representing a specified privilege.LookupPrivilegeName,ADVAPI32.DLL,AW,4 retrieves the name correspondingto the privilege represented on a specific system by a specifiedlocally unique identifier (LUID).LookupPrivilegeValue,ADVAPI32.DLL,AW,3 retrieves the locally unique identifier (LUID) used on a specified system to locally represent the specified privilege name. LookupSecurityDescriptorParts,ADVAPI32.DLL,AW,7, retrieves security information from a self-relative security descriptor.LPropCompareProp,MAPI32.DLL,NM,2, compares two property values to determine if they are equal.LPtoDP,GDI32.DLL,NM,3, converts logical coordinates into device coordinates.LsaCallAuthenticationPackage,SECUR32.DLL,NM,7,Used by a logon application to communicate with an authentication package.LsaConnectUntrusted,SECUR32.DLL,NM,1,Establishes an untrusted connection to the LSA server.LsaDeregisterLogonProcess,SECUR32.DLL,NM,1,Deletes the caller's logon application context and closes the connection to the LSA server.LsaFreeReturnBuffer,SECUR32.DLL,NM,1,Frees the memory used by a buffer previously allocated by the LSA.LsaLogonUser,SECUR32.DLL,NM,14,Authenticates a security principal's logon data using stored credentials information.LsaLookupAuthenticationPackage,SECUR32.DLL,NM,3,Obtains the unique identifier of an authentication package.

Page 147: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

LsaRegisterLogonProcess,SECUR32.DLL,NM,3,Establishes a connection to the LSA server and verifies that the caller is a logon application.LsaRegisterPolicyChangeNotification,SECUR32.DLL,NM,2, registers an event handle with the local security authority (LSA). This event handle is signaled whenever the indicated LSA policy is modified.LsaUnregisterPolicyChangeNotification,SECUR32.DLL,NM,2, disables a previously registered notification event.LSEnumProviders,LSAPI32.DLL,NM,2, returns a unique string for each installed license system service provider.LSEnumProviders,MSLSP32.DLL,NM,2, returns a unique string for each installed license system service provider.LSFreeHandle,LSAPI32.DLL,NM,1, frees the licensing handle context.LSFreeHandle,MSLSP32.DLL,NM,1, frees the licensing handle context.LSQuery,LSAPI32.DLL,NM,5 returns information about the service provider or the license system context associated with the specified handle obtained by a call to the LSRequest function.LSQuery,MSLSP32.DLL,NM,5 returns information about the service provider or the license system context associated with the specified handle obtained by a call to the LSRequest function.LSRelease,LSAPI32.DLL,NM,3 requests the license system release.LSRelease,MSLSP32.DLL,NM,3 requests that the license system release theNotice:be supported in future releases of Microsoft Windows.LSRequest,LSAPI32.DLL,NM,9, asks that the license system grant the licensing resources so the calling application can execute.LSRequest,MSLSP32.DLL,NM,9, asks that the license system grant the licensing resources so the calling application can execute.lstrcat,KERNEL32.DLL,AW,2, appends one string to another.lstrcmp,KERNEL32.DLL,AW,2, compares two character strings.lstrcmpi,KERNEL32.DLL,AW,2, compares two character strings.lstrcpy,KERNEL32.DLL,AW,2, copies a string to a buffer.lstrcpyn,KERNEL32.DLL,AW,3, copies a specified number of characters from a source string into a buffer.lstrlen,KERNEL32.DLL,AW,1 returns the length in bytes (ANSI version) orcharacters (Unicode version) of the specified string (not includingthe terminating null character).LSUpdate,LSAPI32.DLL,NM,6, updates the synchronization between the licensed application software and the license system.LSUpdate,MSLSP32.DLL,NM,6, updates the synchronization between the licensed application software and the license system.LZClose,LZ32.DLL,NM,1 closes a file that was opened by using the LZOpenFile function. LZCopy,LZ32.DLL,NM,2, copies a source file to a destination file.LZDone,LZ32.DLL,NM,0 is obsolete.LZInit,LZ32.DLL,NM,1 allocates memory for the internal datastructures required to decompress files, and then creates andinitializes them.LZOpenFile,LZ32.DLL,AW,3 creates, opens, reopens, or deletes the specified file. LZRead,LZ32.DLL,NM,3, reads (at most) the specified number of bytes from a file and copies them into a buffer.LZSeek,LZ32.DLL,NM,3, moves a file pointer a number of bytes from a starting position.LZStart,LZ32.DLL,NM,0 is obsolete.MakeAbsoluteSD,ADVAPI32.DLL,NM,11 creates a security descriptor inabsolute format by using a security descriptor in self-relativeformat as a template.MakeDragList,COMCTL32.DLL,NM,1, changes the specified single-selection list box to a drag list box.MakeSelfRelativeSD,ADVAPI32.DLL,NM,3 creates a security descriptor inself-relative format by using a security descriptor in absoluteformat as a template.MakeSignature,SECUR32.DLL,NM,4,Generates a cryptographic checksum of the message, and also includes sequencing information to prevent message loss or insertion.MakeSureDirectoryPathExists,IMAGEHLP.DLL,NM,1, creates all the directories in the specified DirPath, beginning with the root.MapAndLoad,IMAGEHLP.DLL,NM,5, maps an image and preloads data from the mapped file.MapDebugInformation,IMAGEHLP.DLL,NM,4, gains access to the debugging information for an image.MapDialogRect,USER32.DLL,NM,2, converts (maps) the specified dialog box units to screen units (pixels).MapFileAndCheckSum,IMAGEHLP.DLL,AW,3, computes the checksum of the specified file.MapGenericMask,ADVAPI32.DLL,NM,2 maps the generic access rights in an access mask to specific and standard access rights.MAPIAdminProfiles,MAPI32.DLL,NM,2, creates a profile administration object.MAPIAllocateBuffer,MAPI32.DLL,NM,2, allocates a memory buffer.MAPIAllocateMore,MAPI32.DLL,NM,3 allocates a memory buffer that islinked to another buffer previously allocated with theMAPIAllocateBuffer function.MAPIFreeBuffer,MAPI32.DLL,NM,1 frees a memory buffer allocated with a call to the MAPIAllocateBuffer function or the MAPIAllocateMore function.MAPIGetDefaultMalloc,MAPI32.DLL,NM,0, retrieves the address of the default MAPI memory allocation function.MAPIInitialize,MAPI32.DLL,NM,1, increments the MAPI subsystem reference count and initializes global data for the MAPI DLL.MAPIInitIdle,MAPI32.DLL,NM,1, initializes the MAPI idle engine for the calling application.MAPILogonEx,MAPI32.DLL,NM,5 logs a client application on to a session with the messaging system.MAPIOpenFormMgr,MAPI32.DLL,NM,2, opens an IMAPIFormMgr interface on a form library provider object in the context of an existing session.MAPIOpenLocalFormContainer,MAPI32.DLL,NM,1, returns an interface pointer to the local form library.MAPIUninitialize,MAPI32.DLL,NM,0, decrements the reference count, -instance global data for the MAPI DLL.MapStorageSCode,MAPI32.DLL,NM,1, maps an HRESULT return value from an OLE storage object to a MAPI return value of the SCODE type.MapViewOfFile,KERNEL32.DLL,NM,5, maps a view of a file into the address space of the calling process.MapViewOfFileEx,KERNEL32.DLL,NM,6, maps a view of a file into the address space of the calling process.MapVirtualKey,USER32.DLL,AW,2 translates (maps) a virtual-key codeinto a scan code or character value, or translates a scan code intoa virtual-key code.MapVirtualKeyEx,USER32.DLL,AW,3 translates (maps) a virtual-key codeinto a scan code or character value, or translates a scan code intoa virtual-key code.MapWindowPoints,USER32.DLL,NM,4 converts (maps) a set of points from a coordinate space relative to one window to a coordinate space relative to another window. MaskBlt,GDI32.DLL,NM,12, combines the color data for the source and destination bitmaps using the specified mask and raster operation.mciDriverNotify,WINMM.DLL,NM,3,MCI drivers call mciDriverNotify to post an MM_MCINOTIFY message to an application. mciDriverYield,WINMM.DLL,NM,1,calls the application’s yield function. The yield function checks to see if the user has pressed the break key. mciFreeCommandResource,WINMM.DLL,NM,1,function frees from memory a command table that was loaded with mciLoadCommandResource. mciGetCreatorTask,WINMM.DLL,NM,1, retrieves a handle to the creator task for the specified device.

mciGetDeviceID,WINMM.DLL,AW,1, retrieves the device identifier corresponding to the name of an open device.mciGetDriverData,WINMM.DLL,NM,1,returns instance-specific information that was set with mciSetDriverData. mciGetErrorString,WINMM.DLL,AW,3, retrieves a string that describes the specified MCI error code.mciGetYieldProc,WINMM.DLL,NM,2, retrieves the address of the callback function associated with the "wait" (MCI_WAIT) flag.mciLoadCommandResource,WINMM.DLL,NM,3,loads the specified resource and registers it as an MCI command table. mciSendCommand,WINMM.DLL,AW,4, sends a command message to the specified MCI device.mciSendString,WINMM.DLL,AW,4, sends a command string to an MCI device.mciSetDriverData,WINMM.DLL,NM,2,is used for storing instance-specific information for an MCI driver. mciSetYieldProc,WINMM.DLL,NM,3 sets the address of a procedure to becalled periodically when an MCI device is waiting for a command tofinish because the "wait" (MCI_WAIT) flag was specified.MenuHelp,COMCTL32.DLL,NM,7 processes WM_MENUSELECT and WM_COMMANDmessages and displays help text about the current menu in thespecified status window.MenuItemFromPoint,USER32.DLL,NM,4, determines which menu item, if any, is at the specified location.MesBufferHandleReset,RPCRT4.DLL,NM,6, re-initializes the handle for buffer serialization.MesDecodeBufferHandleCreate,RPCRT4.DLL,NM,3, creates a decoding handle and initializes it for a (fixed) buffer style of serialization.MesDecodeIncrementalHandleCreate,RPCRT4.DLL,NM,3, creates a decoding handle for the incremental style of serialization.MesEncodeDynBufferHandleCreate,RPCRT4.DLL,NM,3 creates an encoding handle and then initializes it for a dynamic buffer style of serialization.MesEncodeFixedBufferHandleCreate,RPCRT4.DLL,NM,4 creates an encodinghandle and then initializes it for a fixed buffer style ofserialization.MesEncodeIncrementalHandleCreate,RPCRT4.DLL,NM,4, creates an encoding and then initializes it for the incremental style of serialization.MesHandleFree,RPCRT4.DLL,NM,1, frees the memory allocated by the serialization handle.MesIncrementalHandleReset,RPCRT4.DLL,NM,6, re-initializes the handle for incremental serialization.MesInqProcEncodingId,RPCRT4.DLL,NM,3 provides the identity of an encoding.MessageBeep,USER32.DLL,NM,1, plays a waveform sound.MessageBox,USER32.DLL,AW,4, creates, displays, and operates a message box.MessageBoxEx,USER32.DLL,AW,5, creates, displays, and operates a message box.MessageBoxIndirect,USER32.DLL,AW,1, creates, displays, and operates a message box.midiConnect,WINMM.DLL,NM,3 connects a MIDI input device to a MIDIthru or output device, or connects a MIDI thru device to a MIDIoutput device.midiDisconnect,WINMM.DLL,NM,3 disconnects a MIDI input device from aMIDI thru or output device, or disconnects a MIDI thru device froma MIDI output device.midiInAddBuffer,WINMM.DLL,NM,3 sends an input buffer to a specified opened MIDI input device. midiInClose,WINMM.DLL,NM,1, closes the specified MIDI input device.midiInGetDevCaps,WINMM.DLL,AW,3, determines the capabilities of a specified MIDI input device.midiInGetErrorText,WINMM.DLL,AW,3, retrieves a textual description for an error identified by the specified error code.midiInGetID,WINMM.DLL,NM,2, gets the device identifier for the given MIDI input device.midiInGetNumDevs,WINMM.DLL,NM,0, retrieves the number of MIDI input devices in the system.midiInMessage,WINMM.DLL,NM,4, sends a message to the MIDI device driver.midiInOpen,WINMM.DLL,NM,5, opens a specified MIDI input device.midiInPrepareHeader,WINMM.DLL,NM,3, prepares a buffer for MIDI input.midiInReset,WINMM.DLL,NM,1, stops input on a given MIDI input device.midiInStart,WINMM.DLL,NM,1, starts MIDI input on the specified MIDI input device.midiInStop,WINMM.DLL,NM,1, stops MIDI input on the specified MIDI input device.midiInUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by the midiInPrepareHeader function.midiOutCacheDrumPatches,WINMM.DLL,NM,4 requests that an internal MIDIsynthesizer device preload and cache a specified set of key-basedpercussion patches.midiOutCachePatches,WINMM.DLL,NM,4, requests that an internal MIDI synthesizer device preload and cache a specified set of patches.midiOutClose,WINMM.DLL,NM,1, closes the specified MIDI output device.midiOutGetDevCaps,WINMM.DLL,AW,3, queries a specified MIDI output device to determine its capabilities.midiOutGetErrorText,WINMM.DLL,AW,3, retrieves a textual description for an error identified by the specified error code.midiOutGetID,WINMM.DLL,NM,2 retrieves the device identifier for the given MIDI output device.midiOutGetNumDevs,WINMM.DLL,NM,0, retrieves the number of MIDI output devices present in the system.midiOutLongMsg,WINMM.DLL,NM,3 sends a system-exclusive MIDI message to the specified MIDI output device.midiOutMessage,WINMM.DLL,NM,4, sends a message to the MIDI device drivers.midiOutOpen,WINMM.DLL,NM,5, opens a MIDI output device for playback.midiOutPrepareHeader,WINMM.DLL,NM,3, prepares a MIDI system-exclusive or stream buffer for output.midiOutReset,WINMM.DLL,NM,1, turns off all notes on all MIDI channels for the specified MIDI output device.midiOutSetVolume,WINMM.DLL,NM,2, sets the volume of a MIDI output device.midiOutShortMsg,WINMM.DLL,NM,2 sends a short MIDI message to themidiOutGetVolumespecified MIDI output device.midiOutUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by the midiOutPrepareHeader function.midiStreamClose,WINMM.DLL,NM,1, closes an open MIDI stream.midiStreamOpen,WINMM.DLL,NM,6, opens a MIDI stream for output.midiStreamOut,WINMM.DLL,NM,3, plays or queues a stream (buffer) of MIDI data to a MIDI output device.midiStreamPause,WINMM.DLL,NM,1, pauses playback of a specified MIDI stream.midiStreamPosition,WINMM.DLL,NM,3, retrieves the current position in a MIDI stream.midiStreamProperty,WINMM.DLL,NM,3, sets or retrieves properties of a MIDI data stream associated with a MIDI output device.midiStreamRestart,WINMM.DLL,NM,1, restarts a paused MIDI stream.midiStreamStop,WINMM.DLL,NM,1, turns off all notes on all MIDI channels for the specified MIDI output device.MIMEAssociationDialog,URL.DLL,AW,6,Runs the unregistered Multipurpose Internet Mail Extensions (MIME) content type dialog box.mixerClose,WINMM.DLL,NM,1, closes the specified mixer device.mixerGetControlDetails,WINMM.DLL,AW,3, retrieves details about a single control associated with an audio line.mixerGetDevCaps,WINMM.DLL,AW,3, queries a specified mixer device to determine its capabilities.

Page 148: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

mixerGetID,WINMM.DLL,NM,3, retrieves the device identifier for a mixer device associated with a specified device handle.mixerGetLineControls,WINMM.DLL,AW,3, retrieves one or more controls associated with an audio line.mixerGetLineInfo,WINMM.DLL,AW,3, retrieves information about a specific line of a mixer device.mixerGetNumDevs,WINMM.DLL,NM,0, retrieves the number of mixer devices present in the system.mixerMessage,WINMM.DLL,NM,4, sends a custom mixer driver message directly to a mixer driver.mixerOpen,WINMM.DLL,NM,5 opens a specified mixer device and ensures that the device will not be removed until the application closes the handle.mixerSetControlDetails,WINMM.DLL,NM,3, sets properties of a single control associated with an audio line.MkParseDisplayName,OLE32.DLL,NM,4,Ex Creates a moniker to the object that is specified by the given string.MkParseDisplayNameEx,URLMON.DLL,NM,4, Creates a moniker to the object that is specified by the given string.mmioAdvance,WINMM.DLL,NM,3, advances the I/O buffer of a file set up for direct I/O buffer access with the mmioGetInfo function.mmioAscend,WINMM.DLL,NM,3 ascends out of a chunk in a RIFF filedescended into with the mmioDescend function or created with themmioCreateChunk function.mmioClose,WINMM.DLL,NM,2, closes a file that was opened by using the mmioOpen function.mmioCreateChunk,WINMM.DLL,NM,3, creates a chunk in a RIFF file that was opened by using the mmioOpen function.mmioDescend,WINMM.DLL,NM,4, descends into a chunk of a RIFF file that was opened by using the mmioOpen function.mmioFlush,WINMM.DLL,NM,2, writes the I/O buffer of a file to disk if the buffer has been written to.mmioGetInfo,WINMM.DLL,NM,3 retrieves information about a file openedby using the mmioOpen function.mmioInstallIOProc,WINMM.DLL,AW,3, maintains a separate list of installed I/O procedures for each Windows application.mmioOpen,WINMM.DLL,AW,3, opens a file for unbuffered or buffered I/O.mmioRead,WINMM.DLL,NM,3, reads a specified number of bytes from a file opened by using the mmioOpen function.mmioRename,WINMM.DLL,AW,4, renames the specified file.mmioSeek,WINMM.DLL,NM,3, changes the current file position in a file opened by using the mmioOpen function.mmioSendMessage,WINMM.DLL,NM,4, sends a message to the I/O procedure associated with the specified file.mmioSetBuffer,WINMM.DLL,NM,4 enables or disables buffered I/O, or changes the buffer or buffer size for a file opened by using the mmioOpen function.mmioSetInfo,WINMM.DLL,NM,3 updates the information retrieved by themmioGetInfo function about a file opened by using the mmioOpenfunction.mmioStringToFOURCC,WINMM.DLL,AW,2 converts a null-terminated string to a four-character code.mmioWrite,WINMM.DLL,NM,3 writes a specified number of bytes to a filemmioOpenopened by using the function.ModifyMenu,USER32.DLL,AW,5, changes an existing menu item.ModifyWorldTransform,GDI32.DLL,NM,3, changes the world transformation for a device context using the specified mode.Module32First,TOOLHELP.DLL,NM,2, retrieves information about the first module associated with a process.Module32Next,TOOLHELP.DLL,NM,2, retrieves information about the next module associated with a process or thread.MonikerCommonPrefixWith,OLE32.DLL,NM,3,This function creates a new moniker based on the common prefix that this moniker (the one comprising the data of this moniker object) shares with another moniker.MonikerRelativePathTo,OLE32.DLL,NM,4,4.2 MonikerRelativePathTo This function provides a moniker that, when composed onto the end of the first specified moniker (or one with a similarMountNtmsMedia,NTMSAPI.DLL,NM,7, synchronously mounts one or more pieces of media.mouse_event,USER32.DLL,NM,5, synthesizes mouse motion and button clicks.MoveFile,KERNEL32.DLL,AW,2, renames an existing file or a directory (including all its children).MoveFileEx,KERNEL32.DLL,AW,3, renames an existing file or directory.MoveToEx,GDI32.DLL,NM,4, updates the current position to the specified point and optionally returns the previous position.MoveToNtmsMediaPool,NTMSAPI.DLL,NM,3, moves the specified medium from its current media pool to the specified media pool.MoveWindow,USER32.DLL,NM,6, changes the position and dimensions of the specified window.MprAdminBufferFree,MPRAPI.DLL,NM,1, frees memory buffers returned by: MprAdminInterfaceGetInfo, MprAdminInterfaceEnum, MprAdminServerGetInfo, MprAdminInterfaceTransportGetInfo, and MprAdminTransportGetInfo.MprAdminConnectionEnum,MPRAPI.DLL,NM,7, enumerates all active connections.MprAdminConnectionGetInfo,MPRAPI.DLL,NM,4, provides information on a specific connection.MprAdminDeregisterConnectionNotification,MPRAPI.DLL,NM,2, deregisters an event object that was previously registered using MprAdminRegisterConnectionNotification. Once deregistered, this event is no longer signaled when an interface connects or disconnects.MprAdminEstablishDomainRasServer,MPRAPI.DLL,NM,3, establishes the given machine as a Remote Access Server in the domain. This function must be executed only on a machine joined to a domain.MprAdminGetErrorString,MPRAPI.DLL,NM,2, returns the string associated with a router error from Mprerror.h.MprAdminGetPDCServer,MPRAPI.DLL,NM,3, retrieves the name of the server with the master User Accounts Subsystem (UAS) from either a domain name or a server name. Either the domain name parameter or the server name parameter may be NULL, but not both.MprAdminInterfaceConnect,MPRAPI.DLL,NM,4, creates a connection to the specified WAN interface.MprAdminInterfaceCreate,MPRAPI.DLL,NM,4, creates an interface on a specified server.MprAdminInterfaceDelete,MPRAPI.DLL,NM,2, deletes an interface on a specified server.MprAdminInterfaceDisconnect,MPRAPI.DLL,NM,2, disconnects a connected WAN interface.MprAdminInterfaceEnum,MPRAPI.DLL,NM,7, enumerates all the interfaces on a specified server.MprAdminInterfaceGetCredentials,MPRAPI.DLL,NM,5,Use the MprAdminInterfaceGetCredentials function to retrieve the domain, user name, and password for dialing out on the specified demand-dial interface.MprAdminInterfaceGetHandle,MPRAPI.DLL,NM,4, retrieves a handle to a specified interface.MprAdminInterfaceGetInfo,MPRAPI.DLL,NM,4, retrieves information for a specified interface on a specified server.MprAdminInterfaceQueryUpdateResult,MPRAPI.DLL,NM,4, returns the result of the last request to a specified router manager to update its routes for a specified interface. For more information, see MprAdminInterfaceUpdateRoutes.MprAdminInterfaceSetCredentials,MPRAPI.DLL,NM,5,Use MprAdminInterfaceSetCredentials function to set the domain, user name, and password that will be used for dialing out on the specified demand-dial interface.

MprAdminInterfaceSetInfo,MPRAPI.DLL,NM,4, sets information for a specified interface on a specified server.MprAdminInterfaceTransportAdd,MPRAPI.DLL,NM,5, adds a transport (for example, IP or IPX) to a specified interface.MprAdminInterfaceTransportGetInfo,MPRAPI.DLL,NM,5, retrieves information about a transport running on a specified interface.MprAdminInterfaceTransportRemove,MPRAPI.DLL,NM,3, removes a transport (for example, IP or IPX) from a specified interface.MprAdminInterfaceTransportSetInfo,MPRAPI.DLL,NM,5, sets information for a transport running on a specified interface.MprAdminInterfaceUpdatePhonebookInfo,MPRAPI.DLL,NM,2, forces the router to pick up changes made on a specified demand-dial interface. Call this function after changes are made to a phone-book entry for a demand-dial interface.MprAdminInterfaceUpdateRoutes,MPRAPI.DLL,NM,4, requests a specified router manager to update its routing information for a specified interface.MprAdminIsDomainRasServer,MPRAPI.DLL,NM,3, returns information regarding whether the given machine is registered as the remote access server in the domain.MprAdminIsServiceRunning,MPRAPI.DLL,NM,1,, if the calling process has access, checks whether RRAS is running on a specified machine.MprAdminMIBBufferFree,MPRAPI.DLL,NM,1, frees buffers returned by the following functions: MprAdminMIBEntryGet, MprAdminMIBEntryGetFirst, MprAdminMIBEntryGetNextMprAdminMIBEntryCreate,MPRAPI.DLL,NM,5, creates an entry for one of the variables exported by a routing protocol or router manager.MprAdminMIBEntryDelete,MPRAPI.DLL,NM,5, deletes an entry for one of the variables exported by a routing protocol or router manager.MprAdminMIBEntryGet,MPRAPI.DLL,NM,7, retrieves the value of one of the variables exported by a routing protocol or router manager.MprAdminMIBEntryGetFirst,MPRAPI.DLL,NM,7, retrieves the first variable of some set of variables exported by a protocol or router manager. The module that services the call defines first.MprAdminMIBEntryGetNext,MPRAPI.DLL,NM,7, retrieves the next variable of some set of variables exported by a protocol or router manager. The module that services the call defines next.MprAdminMIBEntrySet,MPRAPI.DLL,NM,5, sets the value of one of the variables exported by a routing protocol or router manager.MprAdminMIBServerConnect,MPRAPI.DLL,NM,2, establishes a connection to the router being administered. This call should be made before any other calls to the server. The handle returned by this function is used in subsequent MIB calls.MprAdminMIBServerDisconnect,MPRAPI.DLL,NM,1, disconnects the connection made by a previous call to MprAdminMIBServerConnect.MprAdminPortClearStats,MPRAPI.DLL,NM,2, resets the statistics for the specified port.MprAdminPortDisconnect,MPRAPI.DLL,NM,2, disconnects a connection on a specific port.MprAdminPortEnum,MPRAPI.DLL,NM,8, enumerates all active ports in a specific connection, or all ports available for use or currently in use by RAS.MprAdminPortGetInfo,MPRAPI.DLL,NM,4, gets information for a specific port.MprAdminPortReset,MPRAPI.DLL,NM,2, resets the communication device attached to the specified port.MprAdminRegisterConnectionNotification,MPRAPI.DLL,NM,2, registers an event object with the Demand Dial Manager (DDM) so that, if an interface connects or disconnects, the event is signaled.MprAdminSendUserMessage,MPRAPI.DLL,NM,3, sends a message to the user connected on the specified connection.MprAdminServerConnect,MPRAPI.DLL,NM,2, establishes a connection to a router for the purpose of administering that router.MprAdminServerDisconnect,MPRAPI.DLL,NM,1, disconnects the connection made by a previous call to MprAdminServerConnect.MprAdminServerGetInfo,MPRAPI.DLL,NM,3, retrieves information about the specified RRAS server.MprAdminTransportGetInfo,MPRAPI.DLL,NM,6, retrieves global information, default client interface information, or both, for a specified transport.MprAdminTransportSetInfo,MPRAPI.DLL,NM,6, sets global information, or default client interface information, or both, for a specified transport.MprAdminUserGetInfo,MPRAPI.DLL,NM,4, retrieves all RAS information for a particular user.MprAdminUserSetInfo,MPRAPI.DLL,NM,4, sets RAS information for the specified user.MprConfigBufferFree,MPRAPI.DLL,NM,1,The Routing and Remote Access Service (RRAS) API makes it possible to create applications to administer the routing and remote access service capabilities of Microsoft Windows 2003 Server family and Windows Server 2000 operating systems.MprConfigGetFriendlyName,MPRAPI.DLL,NM,4, returns the friendly name for an interface that corresponds to the specified GUID name.MprConfigGetGuidName,MPRAPI.DLL,NM,4, returns the GUID name for an interface that corresponds to the specified friendly name.MprConfigInterfaceCreate,MPRAPI.DLL,NM,4, creates a router interface in the specified router configuration.MprConfigInterfaceDelete,MPRAPI.DLL,NM,2, removes a router interface from the router configuration. All transport information associated with this interface is also removed.MprConfigInterfaceEnum,MPRAPI.DLL,NM,7, enumerates the interfaces that are configured for the router.MprConfigInterfaceGetHandle,MPRAPI.DLL,NM,3, retrieves a handle to the specified interface's configuration in the specified router configuration.MprConfigInterfaceGetInfo,MPRAPI.DLL,NM,5, retrieves the configuration for the specified interface from the router.MprConfigInterfaceSetInfo,MPRAPI.DLL,NM,4, sets the configuration for the specified interface.MprConfigInterfaceTransportAdd,MPRAPI.DLL,NM,7, adds the specified transport to the specified interface configuration on the router.MprConfigInterfaceTransportEnum,MPRAPI.DLL,NM,8, enumerates the transports configured on the specified interface.MprConfigInterfaceTransportGetHandle,MPRAPI.DLL,NM,4, retrieves a handle to the specified transport configuration on the specified interface in the specified router configuration.MprConfigInterfaceTransportGetInfo,MPRAPI.DLL,NM,5, retrieves the configuration information for the specified client on the specified interface.MprConfigInterfaceTransportRemove,MPRAPI.DLL,NM,3, removes the specified transport from the specified interface configuration on the router.MprConfigInterfaceTransportSetInfo,MPRAPI.DLL,NM,5, updates the configuration information for the client on the specified interface and transport.MprConfigServerBackup,MPRAPI.DLL,NM,2, creates a backup of the router-manager, interface, and phone-book configuration for the router.MprConfigServerConnect,MPRAPI.DLL,NM,2, connects to the router to be configured.MprConfigServerDisconnect,MPRAPI.DLL,NM,1, disconnects a connection made by a previous call to MprConfigServerConnect.MprConfigServerGetInfo,MPRAPI.DLL,NM,3, retrieves server-level configuration information for the specified router.MprConfigServerRestore,MPRAPI.DLL,NM,2, restores the router-manager, interface, and phone-book configuration from a backup created by a previous call to MprConfigServerBackup.MprConfigTransportCreate,MPRAPI.DLL,NM,9, adds the specified transport to the list of transports present in the specified router configuration.MprConfigTransportDelete,MPRAPI.DLL,NM,2, removes the specified transport from the list of transports present in the specified router configuration.

Page 149: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

MprConfigTransportEnum,MPRAPI.DLL,NM,7, enumerates the transports configured on the router.MprConfigTransportGetHandle,MPRAPI.DLL,NM,3, retrieves a handle to the specified transport's configuration in the specified router configuration.MprConfigTransportGetInfo,MPRAPI.DLL,NM,7, retrieves the configuration for the specified transport from the router.MprConfigTransportSetInfo,MPRAPI.DLL,NM,7, changes the configuration for the specified transport in the specified router configuration.MprInfoBlockAdd,MPRAPI.DLL,NM,6, creates a new header that is identical to an existing header with the addition of a new block.MprInfoBlockFind,MPRAPI.DLL,NM,5, locates a specified block in an information header, and retrieves information about the block.MprInfoBlockRemove,MPRAPI.DLL,NM,3, creates a new header that is identical to an existing header with a specified block removed.MprInfoBlockSet,MPRAPI.DLL,NM,6,The MprInfoBlockSet creates a new header that is identical to an existing header with a specified block modified.MprInfoCreate,MPRAPI.DLL,NM,2, creates a new information header.MprInfoDelete,MPRAPI.DLL,NM,1, deletes an information header created using MprInfoCreate, or retrieved by MprInfoBlockAdd, MprInfoBlockRemove, or MprInfoBlockSet.MprInfoDuplicate,MPRAPI.DLL,NM,2, duplicates an existing information header.MprInfoRemoveAll,MPRAPI.DLL,NM,2, removes all information blocks from the specified header.MsgWaitForMultipleObjects,USER32.DLL,NM,5 returns when either any one or all of the specified objects are in the signaled state or The time-out interval elapses. MsgWaitForMultipleObjectsEx,USER32.DLL,NM,5 returns when Either any one or all of the specified objects are in the signaled state or An I/O completion routine or asynchronous procedure call (APC) is queued to the thread. orThe time-out interval elapses. MulDiv,KERNEL32.DLL,NM,3 multiplies two 32-bit values and then dividesthe 64-bit result by a third 32-rounded up or down to the nearest integer.MultiByteToWideChar,KERNEL32.DLL,NM,6 maps a character string to a wide-character (Unicode) string.MultinetGetConnectionPerformance,MPR.DLL,AW,2 returns informationabout the expected performance of a connection used to access anetwork resource.NetAccessAdd,SVRAPI.DLL,NM,4, is obsolete.NetAccessCheck,SVRAPI.DLL,NM,5, is obsolete.NetAccessDel,SVRAPI.DLL,NM,2, is obsolete.NetAccessEnum,SVRAPI.DLL,NM,8, is obsolete.NetAccessGetInfo,SVRAPI.DLL,NM,6, is obsolete.NetAccessGetUserPerms,SVRAPI.DLL,NM,4, is obsolete.NetAccessSetInfo,SVRAPI.DLL,NM,6,s is obsolete.NetAlertRaise,NETAPI32.DLL,NM,3, notifies all registered clients that a particular event occurred.NetAlertRaiseEx,NETAPI32.DLL,NM,4, simplifies the raising of an Administrators interrupting message.NetApiBufferAllocate,NETAPI32.DLL,NM,2, allocates memory from the heap.NetApiBufferFree,NETAPI32.DLL,NM,1, frees the memory that NetApiBufferAllocate allocates.NetApiBufferReallocate,NETAPI32.DLL,NM,3, changes the size of a buffer allocated with NetApiBufferAllocate.NetApiBufferSize,NETAPI32.DLL,NM,2, returns the size, in bytes, of the allocated buffer using NetApiBufferAllocate.NetAuditClear,NETAPI32.DLL,NM,3 is obsolete. NetAuditRead,NETAPI32.DLL,NM,11, is obsolete.Netbios,NETAPI32.DLL,NM,1, interprets and executes the specified network control block (NCB).NetConfigGet,NETAPI32.DLL,NM,4 is obsolete. NetConfigGetAll,NETAPI32.DLL,NM,3, is obsolete.NetConfigSet,NETAPI32.DLL,NM,7, is obsolete.NetConnectionEnum,NETAPI32.DLL,NM,8 lists all connections made to ashared resource on the server or all connections established from aparticular computer.NetConnectionEnum,SVRAPI.DLL,NM,7 lists all connections made to ashared resource on the server or all connections established from aparticular computer.NetErrorLogClear,NETAPI32.DLL,NM,3, is obsolete.NetErrorLogRead,NETAPI32.DLL,NM,11, is obsolete.NetFileClose,NETAPI32.DLL,NM,2, is obsolete in the Win32-based application programming interface (API).NetFileEnum,NETAPI32.DLL,NM,9 supplies information about some or all open files on a server, allowing the user to supply a resume handle and get required information through repeated calls to the function.NetFileEnum,SVRAPI.DLL,NM,7 returns information about some or all open files on a server, depending on the parameters specified.NetFileGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular opening of a server resource.NetGetAnyDCName,NETAPI32.DLL,NM,3, gets the name of any domain controller for a domain that is directly trusted by the server name.NetGetDCName,NETAPI32.DLL,NM,3, returns the name of the Primary Domain Controller (PDC) for the specified domain.NetGroupAdd,NETAPI32.DLL,NM,4, creates a global group in the security database.NetGroupAddUser,NETAPI32.DLL,NM,3, gives an existing user account membership in an existing global group.NetGroupDel,NETAPI32.DLL,NM,2, deletes a global group account from the account database.NetGroupDelUser,NETAPI32.DLL,NM,3, removes a user from a particular global group in the security database.NetGroupEnum,NETAPI32.DLL,NM,7, retrieves information about each global group account.NetGroupGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular global group account on a server.NetGroupGetUsers,NETAPI32.DLL,NM,8, retrieves a list of the members of a particular global group in the security database.NetGroupSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a global group account.NetGroupSetUsers,NETAPI32.DLL,NM,5 sets the global group membership for the specified global group. NetLocalGroupAdd,NETAPI32.DLL,NM,4 creates a local group in the security database.NetLocalGroupAddMember,NETAPI32.DLL,NM,3, is obsolete.NetLocalGroupDel,NETAPI32.DLL,NM,2, deletes a local group account and all its members from the accounts database.NetLocalGroupDelMember,NETAPI32.DLL,NM,3, is obsolete.NetLocalGroupEnum,NETAPI32.DLL,NM,7, retrieves information about each local group account.NetLocalGroupGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular local group account on a server.NetLocalGroupGetMembers,NETAPI32.DLL,NM,8, retrieves a list of the members of a particular local group in the security database.NetLocalGroupSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a local group.NetLocalGroupSetMembers,NETAPI32.DLL,NM,5, sets the local group membership for the specified local group.NetMessageBufferSend,NETAPI32.DLL,NM,5, sends a buffer of information to a registered message alias.NetMessageNameAdd,NETAPI32.DLL,NM,2, registers a message alias in the message name table.

NetMessageNameDel,NETAPI32.DLL,NM,2, deletes a message alias from the table of message aliases on a computer.NetMessageNameEnum,NETAPI32.DLL,NM,7 lists the message aliases that will receive messages on a specified computer.NetMessageNameGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular message alias in the message name table.NetRemoteTOD,NETAPI32.DLL,NM,2 returns the time of day information from a specified server.NetReplExportDirAdd,NETAPI32.DLL,NM,4 registers an existing directory inthe export path to be replicated.NetReplExportDirDel,NETAPI32.DLL,NM,2, removes registration of a replicated directory.NetReplExportDirEnum,NETAPI32.DLL,NM,7, lists the replicated directories in the export path.NetReplExportDirGetInfo,NETAPI32.DLL,NM,4, retrieves the control information of a replicated directory.NetReplExportDirLock,NETAPI32.DLL,NM,2, locks a replicated directory so that replication from it can be suspended.NetReplExportDirSetInfo,NETAPI32.DLL,NM,5, modifies the control information of a replicated directory.NetReplExportDirUnlock,NETAPI32.DLL,NM,3, unlocks a directory so that replication from it can resume.NetReplGetInfo,NETAPI32.DLL,NM,3, retrieves configuration information for the Replicator service.NetReplImportDirAdd,NETAPI32.DLL,NM,4, registers an existing directory in the import path to receive replication from a master.NetReplImportDirDel,NETAPI32.DLL,NM,2, removes the registration of a directory so that it no longer receives updates from the master.NetReplImportDirEnum,NETAPI32.DLL,NM,7, lists the replicated directories in the import path.NetReplImportDirGetInfo,NETAPI32.DLL,NM,4, retrieves the status information on a client replicated directory.NetReplImportDirLock,NETAPI32.DLL,NM,2, locks a replicated directory so that replication to it can be suspended.NetReplImportDirUnlock,NETAPI32.DLL,NM,3, unlocks a directory so that replication to it can resume.NetReplSetInfo,NETAPI32.DLL,NM,4, modifies the Replicator service configuration information.NetScheduleJobAdd,NETAPI32.DLL,NM,3, submits a job to run at a specified future time and date.NetScheduleJobDel,NETAPI32.DLL,NM,3 deletes a range of jobs queued to, Net Functionsrun at a computer.NetScheduleJobEnum,NETAPI32.DLL,NM,6, lists the jobs queued on a specified computer.NetScheduleJobGetInfo,NETAPI32.DLL,NM,3 retrieves information about a particular job queued on a specified computer. NetServerDiskEnum,NETAPI32.DLL,NM,7, retrieves a list of disk drives on a server.NetServerEnum,NETAPI32.DLL,NM,9, lists all servers of the specified type that are visible in the specified domain.NetServerGetInfo,NETAPI32.DLL,NM,3, retrieves information about the specified server.NetServerGetInfo,SVRAPI.DLL,NM,5, retrieves information about the specified server.NetServerSetInfo,NETAPI32.DLL,NM,4, sets a server?s operating parameters; it can set them individually or collectively.NetServerTransportAdd,NETAPI32.DLL,NM,3, binds the server to the transport.NetServerTransportDel,NETAPI32.DLL,NM,3 unbinds (or disconnects) the transport protocol from the server. NetServerTransportEnum,NETAPI32.DLL,NM,7, supplies information about transports that are managed by the server.NetServiceControl,NETAPI32.DLL,NM,5, is obsolete.NetServiceEnum,NETAPI32.DLL,NM,7 is obsolete.NetServiceGetInfo,NETAPI32.DLL,NM,4, is obsolete.NetServiceInstall,NETAPI32.DLL,NM,5, is obsolete.NetSessionDel,NETAPI32.DLL,NM,3, ends a session between a server and a workstation.NetSessionDel,SVRAPI.DLL,NM,3, ends a session between a server and a workstation.NetSessionEnum,NETAPI32.DLL,NM,9, provides information about all current sessions.NetSessionEnum,SVRAPI.DLL,NM,6, provides information about all current sessions.NetSessionGetInfo,NETAPI32.DLL,NM,5, retrieves information about a session established between a particular server and workstation.NetSessionGetInfo,SVRAPI.DLL,NM,6, retrieves information about a session established between a particular server and workstation.NetShareAdd,NETAPI32.DLL,NM,4, shares a server resource.NetShareAdd,SVRAPI.DLL,NM,4, shares a server resource.NetShareCheck,NETAPI32.DLL,NM,3, checks whether or not a server is sharing a device.NetShareDel,NETAPI32.DLL,NM,3 deletes a share name from a server?s listof shared resources, disconnecting all connections to the sharedresource.NetShareDel,SVRAPI.DLL,NM,3 deletes a share name from a server?s listof shared resources, disconnecting all connections to the sharedresource.NetShareGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular shared resource on a server.NetShareGetInfo,SVRAPI.DLL,NM,6, retrieves information about a particular shared resource on a server.NetShareSetInfo,NETAPI32.DLL,NM,5 sets the parameters of a shared resource.NetShareSetInfo,SVRAPI.DLL,NM,6 sets the parameters of a shared resource.NetStatisticsGet,NETAPI32.DLL,NM,5 is obsolete.NetUseDel,NETAPI32.DLL,NM,3, is obsolete.NetUseEnum,NETAPI32.DLL,NM,7 is obsolete.NetUseGetInfo,NETAPI32.DLL,NM,4, is obsolete.NetUserAdd,NETAPI32.DLL,NM,4, adds a user account and assigns a password and privilege level.NetUserDel,NETAPI32.DLL,NM,2, deletes a user account from a server.NetUserEnum,NETAPI32.DLL,NM,8, provides information about all user accounts on a server.NetUserGetGroups,NETAPI32.DLL,NM,7, retrieves a list of global groups to which a specified user belongs.NetUserGetInfo,NETAPI32.DLL,NM,4, retrieves information about a particular user account on a server.NetUserGetLocalGroups,NETAPI32.DLL,NM,8, retrieves a list of local groups to which a specified user belongs.NetUserModalsGet,NETAPI32.DLL,NM,3 retrieves global information for all users and global groups in the security database.NetUserModalsSet,NETAPI32.DLL,NM,4, sets global information for all users and global groups in the security database.NetUserSetGroups,NETAPI32.DLL,NM,5 sets global group memberships for a specified user account.NetUserSetInfo,NETAPI32.DLL,NM,5, sets the parameters of a user account.NetWkstaGetInfo,NETAPI32.DLL,NM,3, returns information about the configuration elements for a workstation.NetWkstaSetInfo,NETAPI32.DLL,NM,4, configures a workstation.NetWkstaTransportAdd,NETAPI32.DLL,NM,4, binds (or connects) the redirector to the transport.NetWkstaTransportDel,NETAPI32.DLL,NM,3 unbinds the transport protocolfrom the redirector, which is the software on the client computerwhich generates file requests to the server computer.

Page 150: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

NetWkstaTransportEnum,NETAPI32.DLL,NM,7 supplies information about transport protocols that are managed by the redirector, which is the software on the client computer that generates file requests to the server computer.NetWkstaUserEnum,NETAPI32.DLL,NM,7, lists information about all users currently logged on to the workstation.NetWkstaUserGetInfo,NETAPI32.DLL,NM,3, returns information about the currently logged-on user.NetWkstaUserSetInfo,NETAPI32.DLL,NM,4, sets the user-specific information about the configuration elements for a workstation.NotifyBootConfigStatus,ADVAPI32.DLL,NM,1, reports the boot status to the service control manager.NotifyChangeEventLog,ADVAPI32.DLL,NM,2 enables an application to receivenotification when an event is written to the specified event logfile.NTExport,DAPI.DLL,AW,1 exports user information from a Windows NTServer domain controller in a form that can later be imported intothe Microsoft Exchange Server directory.ntohl,WS2_32.DLL,NM,1, converts a u_long from TCP/IP network order to host byte order (which is little-endian on Intel processors).ntohl,WSOCK32.DLL,NM,1, converts a u_long from TCP/IP network order to host byte order (which is little-endian on Intel processors).ntohs,WS2_32.DLL,NM,1, converts a u_short from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).ntohs,WSOCK32.DLL,NM,1, converts a u_short from TCP/IP network byte order to host byte order (which is little-endian on Intel processors).NWExport,DAPI.DLL,AW,1 exports user information from a NovellNetWare server in a form that can later be imported into theMicrosoft Exchange Server directory.OaBuildVersion,OLEAUT32.DLL,NM,0, This function retrieves the build version of OLE Automation. WINOLEAUTAPI_(ULONG) OaBuildVersion(void); Return Values The return value is a number that indicates the build number.ObjectCloseAuditAlarm,ADVAPI32.DLL,AW,3, generates audit messages when a handle of an object is deleted.ObjectDeleteAuditAlarm,ADVAPI32.DLL,AW,3, generates audit messages when an object is deleted.ObjectOpenAuditAlarm,ADVAPI32.DLL,AW,12 generates audit messages when aclient application attempts to gain access to an object or tocreate a new one.ObjectPrivilegeAuditAlarm,ADVAPI32.DLL,AW,6, requires the calling process to have SE_AUDIT_NAME privilege.OemKeyScan,USER32.DLL,NM,1, maps OEM ASCII codes 0 through 0x0FF into the OEM scan codes and shift states.OemToChar,USER32.DLL,AW,2, translates a string from the OEM-defined character set into either an ANSI or a wide-character string.OemToCharBuff,USER32.DLL,AW,3 translates a specified number ofcharacters in a string from the OEM-defined character set intoeither an ANSI or a wide-character string.OffsetClipRgn,GDI32.DLL,NM,3, moves the clipping region of a device context by the specified offsets.OffsetRect,USER32.DLL,NM,3, moves the specified rectangle by the specified offsets.OffsetRgn,GDI32.DLL,NM,3, moves a region by the specified offsets.OffsetViewportOrgEx,GDI32.DLL,NM,4, modifies the viewport origin for a device context using the specified horizontal and vertical offsets.OffsetWindowOrgEx,GDI32.DLL,NM,4, modifies the window origin for a device context using the specified horizontal and vertical offsets.OleConvertIStorageToOLESTREAM,OLE32.DLL,NM,2, converts the specified storage object from OLE 2 structured storage to the OLE 1 storage object model but does not include the presentation data. This is one of several compatibility functions.OleConvertIStorageToOLESTREAMEx,OLE32.DLL,NM,7, converts the specified storage object from OLE 2 structured storage to the OLE 1 storage object model, including the presentation data.OleConvertOLESTREAMToIStorage,OLE32.DLL,NM,3,Converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object without specifying presentation data.OleConvertOLESTREAMToIStorageEx,OLE32.DLL,NM,7, converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object including presentation data. This is one of several compatibility functions.OleCreate,OLE32.DLL,NM,7,PropertyFrameIndirectCreates a property frame, that is, a property sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreateDefaultHandler,OLE32.DLL,NM,4,Creates a new instance of the default embedding handler. This instance is initialized so it creates a local server when the embedded object enters the running state.OleCreateEmbeddingHelper,OLE32.DLL,NM,6,Creates an OLE embedding helper object using application-supplied code aggregated with pieces of the OLE default object handler. This helper object can be created and used in a specific context and role, as determined by the caller.OleCreateEx,OLE32.DLL,NM,12,Extends OleCreate functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple presentation formats or data, instead of the single format supportedOleCreateFontIndirect,OLEAUT32.DLL,NM,3, This function creates and initializes a standard font object using an initial description of the font's properties in a FONTDESC structure. The function returns an interface pointer to the new font object specified by caller in the riid parameter.OleCreateFontIndirect,OLEPRO32.DLL,NM,3, This function creates and initializes a standard font object using an initial description of the font's properties in a FONTDESC structure. The function returns an interface pointer to the new font object specified by caller in the riid parameter.OleCreateFromData,OLE32.DLL,NM,7,Extends OleCreateFromData functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentation or data, instead of the singleOleCreateFromDataEx,OLE32.DLL,NM,12,Extends OleCreateFromData functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentation or data, instead of the singleOleCreateFromFile,OLE32.DLL,NM,8,ExExtends OLeCreateFromFile functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple presentation formats or data, instead of the single formatOleCreateFromFileEx,OLE32.DLL,NM,13,Extends OLeCreateFromFile functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple presentation formats or data, instead of the single formatOleCreateLink,OLE32.DLL,NM,7,ToFileExExtends OleCreateLinkToFile functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the singleOleCreateLinkEx,OLE32.DLL,NM,12,Extends OleCreateLink functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the single formatOleCreateLinkFromData,OLE32.DLL,NM,7,ExExtends OleCreateLinkFromData functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the singleOleCreateLinkFromDataEx,OLE32.DLL,NM,12,Extends OleCreateLinkFromData functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the single

OleCreateLinkToFile,OLE32.DLL,NM,7,ExExtends OleCreateLinkToFile functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the singleOleCreateLinkToFileEx,OLE32.DLL,NM,12,Extends OleCreateLinkToFile functionality by supporting more efficient instantiation of objects in containers requiring caching of multiple formats of presentations or data, instead of the singleOleCreateMenuDescriptor,OLE32.DLL,NM,2,Creates and returns an OLE menu descriptor (that is, an OLE-provided data structure that describes the menus) for OLE to use when dispatching menu messages and commands.OleCreatePictureIndirect,OLEAUT32.DLL,NM,4,Creates a new picture object initialized according to a PICTDESC structure, which can be NULL to create an uninitialized object if the caller wishes to have the picture initialize itself through IPersistStream::Load.OleCreatePictureIndirect,OLEPRO32.DLL,NM,4,Creates a new picture object initialized according to a PICTDESC structure, which can be NULL to create an uninitialized object if the caller wishes to have the picture initialize itself through IPersistStream::Load.OleCreatePropertyFrame,OLEAUT32.DLL,NM,11,IndirectCreates a property frame, that is, a property sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrame,OLEPRO32.DLL,NM,11,IndirectCreates a property frame, that is, a property sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrameIndirect,OLEAUT32.DLL,NM,1,Creates a property frame, that is, a property sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreatePropertyFrameIndirect,OLEPRO32.DLL,NM,1,Creates a property frame, that is, a property sheet dialog box, based on a structure (OCPFIPARAMS) that contains the parameters, rather than specifying separate parameters as when calling OleCreatePropertyFrame.OleCreateStaticFromData,OLE32.DLL,NM,7,Creates a static object (containing only a representation, with no native data) from a data transfer object.OleDestroyMenuDescriptor,OLE32.DLL,NM,1,Called by the container to free the shared menu descriptor allocated by the OleCreateMenuDescriptor function.OleDoAutoConvert,OLE32.DLL,NM,2,Automatically converts an object to a new class if automatic conversion for that object class is set in the registry.OleDraw,OLE32.DLL,NM,4,The OleDraw helper function can be used to draw objects more easily. You can use it instead of calling IViewObject::Draw directly.OleDuplicateData,OLE32.DLL,NM,3,Duplicates the data found in the specified handle and returns a handle to the duplicated data. The source data is in a clipboard format.OleFlushClipboard,OLE32.DLL,NM,0,Carries out the clipboard shutdown sequence. It also releases the IDataObject pointer that was placed on the clipboard by the OleSetClipboard function.OleGetAutoConvert,OLE32.DLL,NM,2,Determines whether the registry is set for objects of a specified CLSID to be automatically converted to another CLSID, and if so, retrieves the new CLSID.OleGetClipboard,OLE32.DLL,NM,1,Retrieves a data object that you can use to access the contents of the clipboard.OleGetIconOfClass,OLE32.DLL,NM,3,Returns a handle to a metafile containing an icon and a string label for the specified CLSID.OleGetIconOfFile,OLE32.DLL,NM,2,Returns a handle to a metafile containing an icon and string label for the specified file name.OleIconToCursor,OLEAUT32.DLL,NM,2,Converts an icon to a cursor. For Win32 applications, this function calls the Win32 function CopyCursor(hIcon).OleIconToCursor,OLEPRO32.DLL,NM,2,Converts an icon to a cursor. For Win32 applications, this function calls the Win32 function CopyCursor(hIcon).OleInitialize,OLE32.DLL,NM,1,Initializes the COM library on the current apartment, identifies the concurrency model as single-thread apartment (STA), and enables additional functionality described in the Remarks section below.OleIsCurrentClipboard,OLE32.DLL,NM,1,Determines whether the data object pointer previously placed on the clipboard by the OleSetClipboard function is still on the clipboard.OleIsRunning,OLE32.DLL,NM,1,This function determines whether a compound document object is currently in the running state.OleLoad,OLE32.DLL,NM,4,PicturePathCreates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followed by IPersistStream::Load.OleLoadFromStream,OLE32.DLL,NM,3, Loads an object from the stream.OleLoadPicture,OLEAUT32.DLL,NM,5,PathCreates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followed by IPersistStream::Load.OleLoadPicture,OLEPRO32.DLL,NM,5,PathCreates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followed by IPersistStream::Load.OleLoadPicturePath,OLEAUT32.DLL,NM,6,Creates a new picture object and initializes it from the contents of a stream. This is equivalent to calling OleCreatePictureIndirect(NULL, ...) followed by IPersistStream::Load.OleLockRunning,OLE32.DLL,NM,3,Locks an already running object into its running state or unlocks it from its running state.OleMetafilePictFromIconAndLabel,OLE32.DLL,NM,4,Creates a METAFILEPICT structure that contains a metafile in which the icon and label are drawn.OleNoteObjectVisible,OLE32.DLL,NM,2,Increments or decrements an external reference that keeps an object in the running state.OleQueryCreateFromData,OLE32.DLL,NM,1,Checks whether a data object has one of the formats that would allow it to become an embedded object through a call to either the OleCreateFromData orOleQueryLinkFromData,OLE32.DLL,NM,1, determines whether an OLE linked object (rather than an OLE embedded object) can be created from a clipboard data object.OleRegEnumFormatEtc,OLE32.DLL,NM,3,Supplies a pointer to an enumeration object that can be used to enumerate data formats that an OLE object server has registered in the system registry. An object application or object handler calls this function when it must enumerate those formats.OleRegEnumVerbs,OLE32.DLL,NM,2,Supplies an enumeration of the registered verbs for the specified class. Developers of custom DLL object applications use this function to emulate the behavior of the default object handler.OleRegGetMiscStatus,OLE32.DLL,NM,3,Gets miscellaneous information about the presentation and behaviors supported by the specified CLSID from the registry. Used by developers of custom DLL object applications to emulate the behavior of the OLE default handler.OleRegGetUserType,OLE32.DLL,NM,3,Gets the user type of the specified class from the registry. Developers of custom DLL object applications use this function to emulate the behavior of the OLE default handler.OleRun,OLE32.DLL,NM,1, This function puts an OLE compound document object into the running state.OleSave,OLE32.DLL,NM,3,ToStream Saves an object with the IPersistStream interface on it to the specified stream.OleSaveToStream,OLE32.DLL,NM,2, Saves an object with the IPersistStream interface on it to the specified stream.OleSaveToStreamEx,HLINK.DLL,NM,3, OleSaveToStreamEx Function Not currently supported. OleSetAutoConvert,OLE32.DLL,NM,2,Specifies a CLSID for automatic conversion to a different class when an object of that class is loaded.

Page 151: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

OleSetClipboard,OLE32.DLL,NM,1,Places a pointer to a specific data object onto the clipboard. This makes the data object accessible to the OleGetClipboard function.OleSetContainedObject,OLE32.DLL,NM,2, This function notifies an object embedded in an OLE container to ensure correct reference.OleSetMenuDescriptor,OLE32.DLL,NM,5, This function installs or removes OLE dispatching code from the containers frame window.OleTranslateAccelerator,OLE32.DLL,NM,3,Called by the object application, allows an object's container to translate accelerators according to the container's accelerator table.OleTranslateColor,OLEAUT32.DLL,NM,3,Converts an OLE_COLOR type to a COLORREF.OleTranslateColor,OLEPRO32.DLL,NM,3,Converts an OLE_COLOR type to a COLORREF.OleUIAddVerbMenu,OLEDLG.DLL,AW,9,Adds the Verb menu for the specified object to the given menu.OleUIBusy,OLEDLG.DLL,AW,1, (COM)Invokes the standard Busy dialog box, allowing the user to manage concurrency.OleUICanConvertOrActivateAs,OLEDLG.DLL,NM,3,Determines if there are any OLE object classes in the registry that can be used to convert or activate the specified CLSID from.OleUIConvert,OLEDLG.DLL,AW,1, (COM)Invokes the standard Convert dialog box, allowing the user to change the type of a single specified object, or the type of all OLE objects of the specified object's class.OleUIObjectProperties,OLEDLG.DLL,AW,1,Invokes the Object Properties dialog box, which displays General, View, and Link information about an object.OleUIUpdateLinks,OLEDLG.DLL,AW,4,Updates all links in the link container and displays a dialog box that shows the progress of the updating process. The process is stopped if the user presses the Stop button or when all links are processed.OleUninitialize,OLE32.DLL,NM,0,Closes the COM library on the apartment, releases any class factories, other COM objects, or servers held by the apartment, disables RPC on the apartment, and frees any resources the apartment maintains.OpenBackupEventLog,ADVAPI32.DLL,AW,2, opens a handle of a backup event log.OpenClipboard,USER32.DLL,NM,1, opens the clipboard for examination and prevents other applications from modifying the clipboard content.OpenColorProfile,MSCMS.DLL,AW,4, creates a handle to a specified color profile. The handle can then be used in other profile management functions.OpenDesktop,USER32.DLL,AW,4, returns a handle to an existing desktop.OpenEvent,KERNEL32.DLL,AW,3, returns a handle of an existing named event object.OpenEventLog,ADVAPI32.DLL,AW,2, opens a handle to an event log.OpenFile,KERNEL32.DLL,NM,3, creates, opens, reopens, or deletes a file.OpenFileMapping,KERNEL32.DLL,AW,3, opens a named file-mapping object.OpenIcon,USER32.DLL,NM,1, restores a minimized (iconic) window to its previous size and position; it then activates the window.OpenIMsgOnIStg,MAPI32.DLL,NM,11 builds a new IMessage object on top ofan existing OLE IStorage object, to be used within a messagesession.OpenIMsgSession,MAPI32.DLL,NM,3 creates and opens a message session that groups the messages created within it. OpenInputDesktop,USER32.DLL,NM,3, returns a handle to the desktop that receives user input.OpenMutex,KERNEL32.DLL,AW,3 returns a handle of an existing named mutex object. OpenNtmsNotification,NTMSAPI.DLL,NM,2, opens a channel to receive RSM object change notifications for objects of the specified type.OpenNtmsSession,NTMSAPI.DLL,AW,3, sets up a session with a RSM server.OpenPrinter,WINMM.DLL,AW,3 retrieves a handle identifying the specified printer or print server. OpenProcess,KERNEL32.DLL,NM,3, returns a handle of an existing process object.OpenProcessToken,ADVAPI32.DLL,NM,3, opens the access token associated with a process.OpenSCManager,ADVAPI32.DLL,AW,3 establishes a connection to the service control manager on the specified computer and opens the specified service control manager database. OpenSemaphore,KERNEL32.DLL,AW,3, returns a handle of an existing named semaphore object.OpenService,ADVAPI32.DLL,AW,3, opens a handle to an existing service.OpenStreamOnFile,MAPI32.DLL,NM,6, allocates and initializes an OLE IStream object to access the contents of a file.OpenThreadToken,ADVAPI32.DLL,NM,4, opens the access token associated with a thread.OpenTnefStream,MAPI32.DLL,NM,7 is called by a transport provider toinitiate a MAPI Transport Neutral Encapsulation Format (TNEF)session.OpenTnefStreamEx,MAPI32.DLL,NM,8 creates a TNEF object that can beused to encode or decode a message object into a TNEF data streamfor use by transports or gateways and message stores.OpenWaitableTimer,KERNEL32.DLL,AW,3, returns a handle to an existing named ?waitable? timer object.OpenWindowStation,USER32.DLL,AW,3, returns a handle to an existing window station.OutputDebugString,KERNEL32.DLL,AW,1, sends a string to the debugger for the current application.PackDDElParam,USER32.DLL,NM,3 packs a DDE lParam value into an internal structure used for sharing DDE data between processes. PageSetupDlg,COMDLG32.DLL,AW,1, creates a Page Setup dialog box that enables the user to specify the attributes of a printed page.PaintDesktop,USER32.DLL,NM,1, fills the clipping region in the specified device context with the desktop pattern or wallpaper.PaintRgn,GDI32.DLL,NM,2, paints the specified region by using the brush currently selected into the device context.PatBlt,GDI32.DLL,NM,6, paints the given rectangle using the brush that is currently selected into the specified device context.PathToRegion,GDI32.DLL,NM,1, creates a region from the path that is selected into the specified device context.PdhAddCounter,PDH.DLL,AW,4, creates the specified counter and adds it to the specified query.PdhBrowseCounters,PDH.DLL,AW,1, displays the counter browsing dialog box so that the user can select the counters to be returned to the caller.PdhCalculateCounterFromRawValue,PDH.DLL,NM,5, computes the current value of a counter as referenced by the hCounter parameter, using the raw counter data passed in the parameter list.PdhCloseQuery,PDH.DLL,NM,1, closes all counters contained in the specified query, closes all handles related to the query, and frees all memory associated with the query.PdhCollectQueryData,PDH.DLL,NM,1, collects the current raw data value for all counters in the specified query and updates the status code of each counter.PdhComputeCounterStatistics,PDH.DLL,NM,6, computes statistics for a counter from an array of raw values.PdhConnectMachine,PDH.DLL,AW,1, connects to the specified computer, and creates and initializes a computer entry in the PDH DLL.PdhEnumMachines,PDH.DLL,AW,3, returns a list of the names of the computers that have been opened previously by the PDH DLL.PdhEnumObjectItems,PDH.DLL,AW,9, returns the available counters and instances provided by the specified object on the specified computer.PdhEnumObjects,PDH.DLL,AW,6, returns a list of objects available on the specified computer.PdhExpandCounterPath,PDH.DLL,AW,3, examines the specified computer (or local computer if none is specified) for counters and instances of counters that match the wildcard strings in the counter path.PdhGetCounterInfo,PDH.DLL,AW,4, retrieves information about a counter, such as data size, counter type, path, and user-supplied data values.

PdhGetDefaultPerfCounter,PDH.DLL,AW,5, retrieves the name of the default counter for the specified object. This name can be used to set the initial selection of the counter browser list/combo box.PdhGetDefaultPerfObject,PDH.DLL,AW,4, retrieves the name of the default performance object. This name can be used to select the default entry in the object browser list box.PdhGetDllVersion,PDH.DLL,NM,1, returns the version of the currently installed Pdh.dll file.PdhGetFormattedCounterValue,PDH.DLL,NM,4, returns the current value of a specified counter in the format requested by the caller.PdhGetRawCounterValue,PDH.DLL,NM,3, returns the current raw value of the counter.PdhMakeCounterPath,PDH.DLL,AW,4, creates a full counter path using the members specified in the structure passed in the parameter list.PdhOpenQuery,PDH.DLL,NM,3, creates and initializes a unique query structure that is used to manage the collection of performance data.PdhParseCounterPath,PDH.DLL,AW,4, parses the elements of the counter path and stores the results in the structure passed by the caller.PdhParseInstanceName,PDH.DLL,AW,6, parses the elements of an instance string and returns them in the buffers supplied by the caller.PdhRemoveCounter,PDH.DLL,NM,1, removes a counter from a query.PdhSetCounterScaleFactor,PDH.DLL,NM,2, sets the scale factor that is applied to the calculated value of the specified counter when you request the formatted counter value. If the PDH_FMT_NOSCALE flag is set, then this scale factor is ignored.PdhValidatePath,PDH.DLL,AW,1, validates that the specified counter is present on the computer specified in the counter path.PdhVbAddCounter,PDH.DLL,NM,3, creates a counter entry in the specified query object, and returns a handle to that counter upon successful completion.PdhVbCreateCounterPathList,PDH.DLL,NM,2, displays the performance counter browsing dialog box, which lets the user select several performance counters. Each selected counter path must then be read using the PdhVbGetCounterPathFromList function.PdhVbGetCounterPathElements,PDH.DLL,NM,7, parses a fully qualified performance counter path string into its individual elements.PdhVbGetCounterPathFromList,PDH.DLL,NM,3, copies the counter path referenced by the Index parameter from a counter path list created by the user from the most recent call to the PdhVbCreateCounterPathList function.PdhVbGetDoubleCounterValue,PDH.DLL,NM,2, returns the current value of the specified counter as a double-precision floating point value.PdhVbGetOneCounterPath,PDH.DLL,NM,4, displays a dialog box that lets the user browse the available performance counters and select one counter.PdhVbIsGoodStatus,PDH.DLL,NM,1, tests a status value to determine if it is a success or failure code. If the status value is a successful one, then the return value will be nonzero. If it is a failure status code, the return value will be zero.PdhVbOpenQuery,PDH.DLL,NM,1, creates and initializes a unique query structure that is used to manage the collection of performance data.PeekConsoleInput,KERNEL32.DLL,AW,4, reads data from the specified console input buffer without removing it from the buffer.PeekMessage,USER32.DLL,AW,5, checks a thread message queue for a message and places the message (if any) in the specified structure.PeekNamedPipe,KERNEL32.DLL,NM,6, copies data from a named or anonymous pipe into a buffer without removing it from the pipe.phoneClose,TAPI32.DLL,NM,1, closes the specified open phone device.phoneConfigDialog,TAPI32.DLL,AW,3 causes the provider of the specified phone device to display a modal dialog box (attached to the application's hwndOwner parameter) that allows the user to configure parameters related to the phone device specified by dwDeviceID. phoneDevSpecific,TAPI32.DLL,NM,3 is used as a general extension mechanism to enable a Telephony API implementation to provide features not described in the other TAPI functions. phoneGetButtonInfo,TAPI32.DLL,AW,3, returns information about the specified button.phoneGetData,TAPI32.DLL,NM,4 uploads the information from the specified location in the open phone device to the specified buffer. phoneGetDevCaps,TAPI32.DLL,AW,5 queries a specified phone device to determine its telephony capabilities. phoneGetDisplay,TAPI32.DLL,NM,2 returns the current contents of thespecified phone display.phoneGetGain,TAPI32.DLL,NM,3, returns the gain setting of the microphone of the specified phone's hookswitch device.phoneGetHookSwitch,TAPI32.DLL,NM,2, returns the current hookswitch mode of the specified open phone device.phoneGetIcon,TAPI32.DLL,AW,3 allows an application to retrieve a service phone device-specific (or provider-specific) icon that can be displayed to the user. phoneGetID,TAPI32.DLL,AW,3, can be used to retrieve a phone device identifier given a phone handle.phoneGetLamp,TAPI32.DLL,NM,3, returns the current lamp mode of the specified lamp.phoneGetMessage,TAPI32.DLL,NM,3 returns the next TAPI message that is queued for delivery to an application that is using the Event Handle notification mechanism phoneGetRing,TAPI32.DLL,NM,3, enables an application to query the specified open phone device as to its current ring mode.phoneGetStatus,TAPI32.DLL,AW,2, enables an application to query the specified open phone device for its overall status.phoneGetStatusMessages,TAPI32.DLL,NM,4 returns which phone-state changes on the specified phone device generate a callback to the application. phoneGetVolume,TAPI32.DLL,NM,3, returns the volume setting of the specified phone's hookswitch device.phoneInitialize,TAPI32.DLL,NM,5 is obsolete.phoneInitializeEx,TAPI32.DLL,AW,7, initializes the application's use of TAPI for subsequent use of the phone abstraction.phoneNegotiateAPIVersion,TAPI32.DLL,NM,6, is used to negotiate the API version number to use with the specified phone device.phoneNegotiateExtVersion,TAPI32.DLL,NM,6 allows an application to negotiate an extension version to use with the specified phone device.phoneOpen,TAPI32.DLL,NM,7, opens the specified phone device.phoneSetButtonInfo,TAPI32.DLL,AW,3, sets information about the specified button on the specified phone.phoneSetData,TAPI32.DLL,NM,4 downloads the information in thespecified buffer to the opened phone device at the selected dataidentifier.phoneSetDisplay,TAPI32.DLL,NM,5, causes the specified string to be displayed on the specified open phone device.phoneSetGain,TAPI32.DLL,NM,3, sets the gain of the microphone of the specified hookswitch device to the specified gain level.phoneSetHookSwitch,TAPI32.DLL,NM,3 sets the hook state of thes pecified open phone's hookswitch devices to the specified mode.phoneSetLamp,TAPI32.DLL,NM,3, causes the specified lamp to be lit on the specified open phone device in the specified lamp mode.phoneSetRing,TAPI32.DLL,NM,3, rings the specified open phone device using the specified ring mode and volume.phoneSetStatusMessages,TAPI32.DLL,NM,4 enables an application to monitor the specified phone device for selected status events. phoneSetVolume,TAPI32.DLL,NM,3 sets the volume of the speakercomponent of the specified hookswitch device to the specifiedlevel.phoneShutdown,TAPI32.DLL,NM,1, shuts down the application's usage of TAPI's phone abstraction.

Page 152: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Pie,GDI32.DLL,NM,9, draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials.PlayEnhMetaFile,GDI32.DLL,NM,3, displays the picture stored in the specified enhanced-format metafile.PlayEnhMetaFileRecord,GDI32.DLL,NM,4 plays an enhanced-metafile record by executing the graphics device interface (GDI) functions identified by the record. PlayMetaFile,GDI32.DLL,NM,2, displays the picture stored in the given Windows-format metafile on the specified device.PlayMetaFileRecord,GDI32.DLL,NM,4 plays a Windows-format metafilerecord by executing the graphics device interface (GDI) functioncontained within that record.PlaySound,WINMM.DLL,AW,3, plays a sound specified by the given filename, resource, or system event.PlgBlt,GDI32.DLL,NM,10 performs a bit-block transfer of the bits of color data from the specified rectangle in the source device context to the specified parallelogram in the destination device context.PolyBezier,GDI32.DLL,NM,3, draws one or more B? er curves.PolyBezierTo,GDI32.DLL,NM,3, draws one or more B? er curves.PolyDraw,GDI32.DLL,NM,4 draws a set of line segments and Bezier curves.Polygon,GDI32.DLL,NM,3, draws a polygon consisting of two or more vertices connected by straight lines.Polyline,GDI32.DLL,NM,3, draws a series of line segments by connecting the points in the specified array.PolylineTo,GDI32.DLL,NM,3 draws one or more straight lines. PolyPolygon,GDI32.DLL,NM,4, draws a series of closed polygons.PolyPolyline,GDI32.DLL,NM,4, draws multiple series of connected line segments.PolyTextOut,GDI32.DLL,AW,3, draws several strings using the font and text colors currently selected in the specified device context.PostMessage,USER32.DLL,AW,4 places (posts) a message in the message queue associated with the thread that created the specified window and then returns without waiting for the thread to process the message. PostQueuedCompletionStatus,KERNEL32.DLL,NM,4, lets you post an I/O completion packet to an I/O completion port.PostQuitMessage,USER32.DLL,NM,1, indicates to Windows that a thread has made a request to terminate (quit).PostThreadMessage,USER32.DLL,AW,4 places (posts) a message in the message queue of the specified thread and then returns without waiting for the thread to process the message. PpropFindProp,MAPI32.DLL,NM,3, searches for a specified property in a property set.PrepareTape,KERNEL32.DLL,NM,3 prepares the tape to be accessed or removed. PrintDlg,COMDLG32.DLL,AW,1,PDERR_CREATEICFAILURE failed when it attempted to create an information context.PrinterMessageBox,WINMM.DLL,AW,6 displays a message box that lets an application that is printing notify the user of a printing job error. PrinterProperties,WINMM.DLL,NM,2, displays a printer-properties dialog box for the specified printer.PrivilegeCheck,ADVAPI32.DLL,NM,3, determines whether a specified set of privileges are enabled in an access token.PrivilegedServiceAuditAlarm,ADVAPI32.DLL,AW,5 generates audit messages when an attempt is made to perform privileged system service operations.Process32First,TOOLHELP.DLL,NM,2,Retrieves information about the first process encountered in a system snapshot.Process32Next,TOOLHELP.DLL,NM,2,Retrieves information about the next process recorded in a system snapshot.ProcessGroupPolicyCompleted,USERENV.DLL,NM,3, notifies the system that the specified extension has finished applying policy.ProgIDFromCLSID,OLE32.DLL,NM,2,This function retrieves the ProgID for a given CLSID.PropCopyMore,MAPI32.DLL,NM,4 copies a single property value from a source location to a destination location. PropertySheet,COMCTL32.DLL,AW,1, creates a property sheet and adds the pages defined in the specified property sheet header structure.PropStgNameToFmtId,IPROP.DLL,NM,2,Converts a property set storage or stream name to its format identifier.PropVariantClear,IPROP.DLL,NM,1,Frees all elements that can be freed in a given PROPVARIANT structure.PropVariantClear,OLE32.DLL,NM,1,Frees all elements that can be freed in a given PROPVARIANT structure.PropVariantCopy,IPROP.DLL,NM,2, copies the contents of one PROPVARIANT structure to another.PropVariantCopy,OLE32.DLL,NM,2, copies the contents of one PROPVARIANT structure to another.PtInRect,USER32.DLL,NM,3, determines whether the specified point lies within the specified rectangle.PtInRegion,GDI32.DLL,NM,3, determines whether the specified point is inside the specified region.PtVisible,GDI32.DLL,NM,3, indicates whether the specified point is within the clipping region of a device context.PulseEvent,KERNEL32.DLL,NM,1 provides a single operation that sets (to signaled) the state of the specified event object and then resets it (to nonsignaled) after releasing the appropriate number of waiting threads.PurgeComm,KERNEL32.DLL,NM,2, can discard all characters from the output or input buffer of a specified communications resource.QueryContextAttributes,SECUR32.DLL,AW,3,Enables a transport application to query a security package for certain attributes of a security context.QueryCredentialsAttributes,SECUR32.DLL,AW,3, retrieves the attributes of a credential, such as the name associated with the credential. The information is valid for any security context created with the specified credential.QueryDosDevice,KERNEL32.DLL,AW,3, lets an application obtain information about MS-DOS device names.QueryPathOfRegTypeLib,OLEAUT32.DLL,NM,5,Retrieves the path of a registered type library.QueryPerformanceCounter,KERNEL32.DLL,NM,1, retrieves the current value of the high-resolution performance counter, if one exists.QueryPerformanceFrequency,KERNEL32.DLL,NM,1, retrieves the frequency of the high-resolution performance counter, if one exists.QuerySecurityContextToken,SECUR32.DLL,NM,2,Obtains the access token for a client security context and uses it directly.QuerySecurityPackageInfo,SECUR32.DLL,AW,2, retrieves information about a specified security package. This information includes the bounds on sizes of authentication information, credentials, and contexts.QueryServiceConfig,ADVAPI32.DLL,AW,4, retrieves the configuration parameters of the specified service.QueryServiceLockStatus,ADVAPI32.DLL,AW,4 retrieves the lock status of the specified service control manager database. QueryServiceObjectSecurity,ADVAPI32.DLL,NM,5, retrieves a copy of the security descriptor associated with a service object.QueryServiceStatus,ADVAPI32.DLL,NM,2, retrieves the current status of the specified service.QueryWorkingSet,PSAPI.DLL,NM,3, retrieves information about the pages currently added to the working set of the specified process.QueueUserAPC,KERNEL32.DLL,NM,3, adds a user-mode asynchronous procedure call (APC) object to the APC queue of the specified thread.

RaiseException,KERNEL32.DLL,NM,4, raises an exception in the calling thread.RasAdminFreeBuffer,RASSAPI.DLL,NM,1, frees memory that was allocated by frees memory that was allocated by RAS on behalf of the caller.RasAdminGetErrorString,RASSAPI.DLL,NM,3 corresponds to a RAS error code returned by one of the RAS serveradministration (RasAdmin) functions.RasAdminGetUserAccountServer,RASSAPI.DLL,NM,3, retrieves the name of the server that has the user account database.RasAdminPortClearStatistics,RASSAPI.DLL,NM,2 resets the countersrepresenting the various statistics reported by theRasAdminPortGetInfo function in the RAS_PORT_STATISTICS structure.RasAdminPortDisconnect,RASSAPI.DLL,NM,2, disconnects a port that is currently in use. RasAdminPortEnum,RASSAPI.DLL,NM,3 enumerates all ports on the specifiedRAS server.RasAdminPortGetInfo,RASSAPI.DLL,NM,5, retrieves information about a specified port on a specified server.RasAdminServerGetInfo,RASSAPI.DLL,NM,2, gets the server configuration of a RAS server.RasAdminUserGetInfo,RASSAPI.DLL,NM,3, gets the RAS permissions and callback phone number information for a specified user.RasAdminUserSetInfo,RASSAPI.DLL,NM,3 sets the RAS permissions and call-back phone number for a specified user.RasConnectionNotification,RASAPI32.DLL,AW,3 specifies an event objectthat the system sets to the signaled state when a RAS connection iscreated or terminated.RasCreatePhonebookEntry,RASAPI32.DLL,AW,2, creates a new phone-book entry.RasDeleteEntry,RASAPI32.DLL,AW,2, deletes an entry from a phone book.RasDial,RASAPI32.DLL,AW,6, establishes a RAS connection between a RAS client and a RAS server.RasDialDlg,RASDLG.DLL,AW,4 tries to establish a RAS connection using a specified phone-book entry and the credentials of the logged-on user.RasEditPhonebookEntry,RASAPI32.DLL,AW,3, edits an existing phone-book entry.RasEntryDlg,RASDLG.DLL,AW,3, displays modal property sheets that allow a user to manipulate phone-book entries.RasEnumAutodialAddresses,RASAPI32.DLL,AW,3 returns a list of all addresses in the AutoDial mapping database.RasEnumConnections,RASAPI32.DLL,AW,3, lists all active RAS connections.RasEnumDevices,RASAPI32.DLL,AW,3, returns the name and type of all available RAS-capable devices.RasEnumEntries,RASAPI32.DLL,AW,5, lists all entry names in a remote access phone book.RasGetAutodialAddress,RASAPI32.DLL,AW,5 retrieves information about allthe AutoDial entries associated with a network address in theAutoDial mapping database.RasGetAutodialEnable,RASAPI32.DLL,AW,2, indicates whether the AutoDial feature is enabled for a specified TAPI dialing location.RasGetAutodialParam,RASAPI32.DLL,AW,3, retrieves the value of an AutoDial parameter.RasGetConnectStatus,RASAPI32.DLL,AW,2, retrieves information on the current status of the specified remote access connection.RasGetCountryInfo,RASAPI32.DLL,AW,2, retrieves country-specific dialing information from the Windows Telephony list of countries.RasGetCredentials,RASAPI32.DLL,AW,3, retrieves the user credentials associated with a specified RAS phone-book entry.RasGetEntryDialParams,RASAPI32.DLL,AW,3, retrieves the connection information saved by the last successful call to the RasDial or RasGetEntryDialParams function for a specified phone book entry. RasGetEntryProperties,RASAPI32.DLL,AW,6 retrieves the properties of aphone-book entry.RasGetErrorString,RASAPI32.DLL,AW,3, obtains an error message string for a specified RAS error value.RasGetProjectionInfo,RASAPI32.DLL,AW,4 obtains information about aremote access projection operation for a specified remote accesscomponent protocol.RasGetSubEntryHandle,RASAPI32.DLL,AW,3 retrieves a connection handle for a specified subentry of a multilink connection. RasGetSubEntryProperties,RASAPI32.DLL,AW,7, retrieves information about a subentry for a specified phone-book entry.RasHangUp,RASAPI32.DLL,AW,1, terminates a remote access connection.RasMonitorDlg,RASDLG.DLL,AW,2, displays the Dial-Up Networking Monitor property sheet that describes the status of RAS connections.RasRenameEntry,RASAPI32.DLL,AW,3, changes the name of an entry in a phone book.RasSetAutodialAddress,RASAPI32.DLL,AW,5, can add an address to the AutoDial mapping database.RasSetAutodialEnable,RASAPI32.DLL,AW,2, enables or disables the AutoDial feature for a specified TAPI dialing location.RasSetAutodialParam,RASAPI32.DLL,AW,3, sets the value of an AutoDial parameter.RasSetCredentials,RASAPI32.DLL,AW,4, sets the user credentials associated with a specified RAS phone-book entry.RasSetEntryDialParams,RASAPI32.DLL,AW,3 deletes an entry from a phone book.RasSetEntryProperties,RASAPI32.DLL,AW,6 changes the connectioninformation for an entry in the phone book or creates a new phone-book entry.RasSetSubEntryProperties,RASAPI32.DLL,AW,7, creates a new subentry or modifies an existing subentry of a specified phone-book entry.RasValidateEntryName,RASAPI32.DLL,AW,2, validates the format of a connection entry name.ReadClassStg,OLE32.DLL,NM,2, reads the CLSID previously written to a storage object with the WriteClassStg function.ReadClassStm,OLE32.DLL,NM,2,Reads the CLSID previously written to a stream object with the WriteClassStm function.ReadConsole,KERNEL32.DLL,AW,5, reads character input from the console input buffer and removes it from the buffer.ReadConsoleInput,KERNEL32.DLL,AW,4, reads data from a console input file buffer and removes it from the buffer. ReadConsoleOutput,KERNEL32.DLL,AW,5 reads character and color attribute data from a rectangular block of character cells in a console screen buffer, and the function writes the data to a rectangular block at a specified location in the destination buffer. ReadConsoleOutputAttribute,KERNEL32.DLL,NM,5 copies a specified number of foreground and background color attributes from consecutive cells of a console screen buffer, beginning at a specified location. ReadConsoleOutputCharacter,KERNEL32.DLL,AW,5 copies a number ofcharacters from consecutive cells of a console screen buffer,beginning at a specified location.ReadEventLog,ADVAPI32.DLL,AW,7, reads a whole number of entries from the specified event log.ReadFile,KERNEL32.DLL,NM,5, reads data from a file, starting at the position indicated by the file pointer.ReadFileEx,KERNEL32.DLL,NM,5,ERROR_HANDLE_EOF tried to read past the end of the file.ReadFmtUserTypeStg,OLE32.DLL,NM,3, returns the clipboard format and user type previously saved with the WriteFmtUserTypeStg function.ReadPrinter,WINMM.DLL,NM,4, retrieves data from the specified printer.ReadProcessMemory,KERNEL32.DLL,NM,5, reads memory in a specified process.ReadUrlCacheEntryStream,WININET.DLL,NM,5,Reads the cached data from a stream that has been opened using the RetrieveUrlCacheEntryStream function.RealizePalette,GDI32.DLL,NM,1, maps palette entries from the current logical palette to the system palette.ReBaseImage,IMAGEHLP.DLL,NM,11, is used to change the load address for the specified image, which reduces the required load time for a DLL.

Page 153: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Rectangle,GDI32.DLL,NM,5 draws a rectangle.RectInRegion,GDI32.DLL,NM,2, determines whether any part of the specified rectangle is within the boundaries of a region.RectVisible,GDI32.DLL,NM,2 determines whether any part of thespecified rectangle lies within the clipping region of a devicecontext.recv,WS2_32.DLL,NM,4,Receives data from a connected or bound socket.recv,WSOCK32.DLL,NM,4,Receives data from a connected or bound socket.recvfrom,WS2_32.DLL,NM,6 receives a datagram and stores the source address.recvfrom,WSOCK32.DLL,NM,6 receives a datagram andstores the source address.RedrawWindow,USER32.DLL,NM,4, updates the specified rectangle or region in a window?s client area.RefreshPolicy,USERENV.DLL,NM,1, causes policy to be applied immediately on the client computer.RegCloseKey,ADVAPI32.DLL,NM,1 releases the handle of the specified key. RegConnectRegistry,ADVAPI32.DLL,AW,3, establishes a connection to a predefined registry handle on another computer.RegCreateKey,ADVAPI32.DLL,AW,3, creates the specified key.RegCreateKeyEx,ADVAPI32.DLL,AW,9, creates the specified key.RegDeleteKey,ADVAPI32.DLL,AW,2,Windows 95: deletes a subkey and all its descendants.RegDeleteValue,ADVAPI32.DLL,AW,2 removes a named value from the specified registry key. RegEnumKey,ADVAPI32.DLL,AW,4, enumerates subkeys of the specified open registry key.RegEnumKeyEx,ADVAPI32.DLL,AW,8, enumerates subkeys of the specified open registry key.RegEnumValue,ADVAPI32.DLL,AW,8, enumerates the values for the specified data block for the key each time it is called.RegFlushKey,ADVAPI32.DLL,NM,1, writes all the attributes of the specified open key into the registry.RegGetKeySecurity,ADVAPI32.DLL,NM,4, retrieves a copy of the security descriptor protecting the specified open registry key.RegisterActiveObject,OLEAUT32.DLL,NM,4,Registers an object as the active object for its class.RegisterBindStatusCallback,URLMON.DLL,NM,4, Registers a callback interface with an existing bind context.RegisterClass,USER32.DLL,AW,1, registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function.RegisterClassEx,USER32.DLL,AW,1 registers a window class for subsequent use in calls to the CreateWindow or CreateWindowEx function. RegisterClipboardFormat,USER32.DLL,AW,1, registers a new clipboard format.RegisterCMM,MSCMS.DLL,AW,3,RegisterCMM associates a specified identification value with the specified color management module dynamic link library (CMM DLL). When this ID appears in a color profile, Windows can then locate the corresponding CMM so as to create a transform.RegisterDragDrop,OLE32.DLL,NM,2,Registers the specified window as one that can be the target of an OLE drag-and-drop operation and specifies the IDropTarget instance to use for drop operations.RegisterEventSource,ADVAPI32.DLL,AW,2, returns a registered handle to an event log.RegisterFormatEnumerator,URLMON.DLL,NM,3, Registers a FORMATETC enumerator object onto the given bind context.RegisterGPNotification,USERENV.DLL,NM,2, enables an application to receive notification when there is a change in policy. When a policy change occurs, the specified event object is set to the signaled state.RegisterHotKey,USER32.DLL,NM,4, defines a system-wide hot key.RegisterMediaTypeClass,URLMON.DLL,NM,5, Registers a mapping of media types to CLSIDs to override the default mapping specified in the registry.RegisterMediaTypes,URLMON.DLL,NM,3, Registers media type strings.RegisterServiceCtrlHandler,ADVAPI32.DLL,AW,2 A Win32-based service calls the RegisterServiceCtrlHandler functionto register a function to handle its service control requests.RegisterWindowMessage,USER32.DLL,AW,1 defines a new window messagethat is guaranteed to be unique throughout the system.RegLoadKey,ADVAPI32.DLL,AW,3 creates a subkey under HKEY_USER orHKEY_LOCAL_MACHINE and stores registration information from aspecified file into that subkey.RegNotifyChangeKeyValue,ADVAPI32.DLL,NM,5, notifies the caller about changes to the attributes or contents of a specified registry key.RegOpenKey,ADVAPI32.DLL,AW,3, opens the specified key.RegOpenKeyEx,ADVAPI32.DLL,AW,5 opens the specified key. RegQueryInfoKey,ADVAPI32.DLL,AW,12, retrieves information about a specified registry key.RegQueryMultipleValues,ADVAPI32.DLL,AW,5, retrieves the type and data for a list of value names associated with an open registry key.RegQueryValue,ADVAPI32.DLL,AW,4, retrieves the value associated with the unnamed value for a specified key in the registry.RegQueryValueEx,ADVAPI32.DLL,AW,6, retrieves the type and data for a specified value name associated with an open registry key.RegReplaceKey,ADVAPI32.DLL,AW,4 replaces the file backing a key and all its subkeys with another file, so that when the system is next started, the key and subkeys will have the values stored in the new file. RegRestoreKey,ADVAPI32.DLL,AW,3 reads the registry information in a specified file and copies it over the specified key. RegSaveKey,ADVAPI32.DLL,AW,3, saves the specified key and all of its subkeys and values to a new file.RegSetKeySecurity,ADVAPI32.DLL,NM,3 sets the security of an open registry key. RegSetValue,ADVAPI32.DLL,AW,5, associates a value with a specified key.RegSetValueEx,ADVAPI32.DLL,AW,6, stores data in the value field of an open registry key.RegUnLoadKey,ADVAPI32.DLL,AW,2, unloads the specified key and subkeys from the registry.ReleaseCapture,USER32.DLL,NM,0 releases the mouse capture from awindow in the current thread and restores normal mouse inputprocessing.ReleaseDC,USER32.DLL,NM,2, releases a device context (DC), freeing it for use by other applications.ReleaseMutex,KERNEL32.DLL,NM,1, fails if the calling thread does not own the mutex object.ReleaseNtmsCleanerSlot,NTMSAPI.DLL,NM,2, removes an existing slot reservation for a cleaning cartridge. The slot can then be used for data cartridges.ReleaseSemaphore,KERNEL32.DLL,NM,3, increases the count of the specified semaphore object by a specified amount.ReleaseStgMedium,OLE32.DLL,NM,1,Frees the specified storage medium.RemoveDirectory,KERNEL32.DLL,AW,1, deletes an existing empty directory.RemoveFontResource,GDI32.DLL,AW,1, removes the fonts in the specified file from the Windows font table.RemoveMenu,USER32.DLL,NM,3, deletes a menu item from the specified menu.RemoveProp,USER32.DLL,AW,2, removes an entry from the property list of the specified window.ReplaceText,COMDLG32.DLL,AW,1 creates a system-defined modeless dialog box that lets the user specify a string to search for and a replacement string, as well as options to control the find and replace operations.ReplyMessage,USER32.DLL,NM,1 is used to reply to a message sentthrough the SendMessage function without returning control to thefunction that called SendMessage.ReportEvent,ADVAPI32.DLL,AW,9, writes an entry at the end of the specified event log.ReserveNtmsCleanerSlot,NTMSAPI.DLL,NM,3, reserves a single slot in a library unit for a drive cleaner cartridge.

ResetDC,GDI32.DLL,AW,2, cannot be used to change the driver name, device name, or the output port.ResetEvent,KERNEL32.DLL,NM,1, sets the state of the specified event object to nonsignaled.ResetPrinter,WINMM.DLL,AW,2 lets an application specify the data typeand device mode values that are used for printing documentssubmitted by the StartDocPrinter function.ResizePalette,GDI32.DLL,NM,2, increases or decreases the size of a logical palette based on the specified value.RestoreDC,GDI32.DLL,NM,2, restores a device context (DC) to the specified state.ResumeSuspendedDownload,WININET.DLL,NM,2, resumes a request that is suspended by a user interface dialog box.ResumeThread,KERNEL32.DLL,NM,1, decrements a thread?s suspend count.ResUtilAddUnknownProperties,RESUTILS.DLL,NM,6,The ResUtilAddUnknownProperties utility function retrieves a set of unknown properties from the cluster database and appends them to the end of a property list.ResUtilCreateDirectoryTree,RESUTILS.DLL,NM,1, creates every directory specified in a path, skipping directories that already exist.ResUtilDupParameterBlock,RESUTILS.DLL,NM,3,The ResUtilDupParameterBlock utility function performs a member-wise copy of the data from one parameter block to another.ResUtilDupString,RESUTILS.DLL,NM,1,The ResUtilDupString utility function duplicates a null-terminated Unicode string.ResUtilEnumPrivateProperties,RESUTILS.DLL,NM,5,The ResUtilEnumPrivateProperties utility function retrieves the names of a cluster object's private properties.ResUtilEnumProperties,RESUTILS.DLL,NM,5,The ResUtilEnumProperties utility function enumerates the property names of a cluster object.ResUtilEnumResources,RESUTILS.DLL,NM,4,The ResUtilEnumResources utility function enumerates all of the resources in the local cluster and initiates a user-defined operation for each resource.ResUtilExpandEnvironmentStrings,RESUTILS.DLL,NM,1, expands strings containing unexpanded references to environment variables.ResUtilFindBinaryProperty,RESUTILS.DLL,NM,5,The ResUtilFindBinaryProperty utility function locates a specified binary property in a property list and can also return the value of the property.ResUtilFindDependentDiskResourceDriveLetter,RESUTILS.DLL,NM,4,The ResUtilFindDependentDiskResourceDriveLetter utility function retrieves the drive letter associated with a Physical Disk dependency of a resource.ResUtilFindDwordProperty,RESUTILS.DLL,NM,4,The ResUtilFindDwordProperty utility function locates an unsigned long property value in a property list.ResUtilFindExpandedSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindExpandedSzProperty utility function locates an expanded string property value in a property list.ResUtilFindExpandSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindExpandSzProperty utility function locates an expandable string property in a property list.ResUtilFindLongProperty,RESUTILS.DLL,NM,4,The ResUtilFindLongProperty utility function locates a signed long property value in a property list.ResUtilFindMultiSzProperty,RESUTILS.DLL,NM,5,The ResUtilFindMultiSzProperty utility function locates a multiple string property in a property list.ResUtilFindSzProperty,RESUTILS.DLL,NM,4,The ResUtilFindSzProperty utility function locates a string property in a property list.ResUtilFreeEnvironment,RESUTILS.DLL,NM,1, destroys the environment variable block created with ResUtilGetEnvironmentWithNetName.ResUtilFreeParameterBlock,RESUTILS.DLL,NM,3,The ResUtilFreeParameterBlock utility function deallocates memory that has been allocated for a parameter block by ResUtilDupParameterBlock.ResUtilGetAllProperties,RESUTILS.DLL,NM,6,The ResUtilGetAllProperties utility function returns a property list that includes all of the default and unknown properties for a cluster object.ResUtilGetBinaryProperty,RESUTILS.DLL,NM,7,The ResUtilGetBinaryProperty utility function retrieves a binary property from a property list and advances a pointer to the next property in the list.ResUtilGetBinaryValue,RESUTILS.DLL,NM,4,The ResUtilGetBinaryValue utility function returns a binary value from the cluster database.ResUtilGetDwordProperty,RESUTILS.DLL,NM,7,The ResUtilGetDwordProperty utility function retrieves a DWORD property from a property list and advances a pointer to the next property in the list.ResUtilGetDwordValue,RESUTILS.DLL,NM,4,The ResUtilGetDwordValue utility function returns a numeric value from the cluster database.ResUtilGetEnvironmentWithNetName,RESUTILS.DLL,NM,1, adjusts environment data for a resource so that the resource uses a cluster network name to identify its location. The resource must be dependent on a Network Name resource.ResUtilGetMultiSzProperty,RESUTILS.DLL,NM,7,The ResUtilGetMultiSzProperty utility function retrieves a multiple string property from a property list and advances a pointer to the next property in the list.ResUtilGetPrivateProperties,RESUTILS.DLL,NM,5,The ResUtilGetPrivateProperties utility function returns private properties for a cluster object.ResUtilGetProperties,RESUTILS.DLL,NM,6,The ResUtilGetProperties utility function retrieves properties specified by a property table from the cluster database and returns them in a property list.ResUtilGetPropertiesToParameterBlock,RESUTILS.DLL,NM,5,The ResUtilGetPropertiesToParameterBlock utility function retrieves properties specified by a property table from the cluster database and returns them in a parameter block.ResUtilGetProperty,RESUTILS.DLL,NM,4,The ResUtilGetPropertySize utility function returns the total number of bytes required for a specified property.ResUtilGetPropertySize,RESUTILS.DLL,NM,4,The ResUtilGetPropertySize utility function returns the total number of bytes required for a specified property.ResUtilGetResourceDependency,RESUTILS.DLL,NM,2, enumerates the dependencies of a specified resource and returns a handle to a dependency of a specified type.ResUtilGetResourceDependencyByClass,RESUTILS.DLL,NM,4, enumerates the dependencies of a specified resource in a specified cluster and returns a handle to a dependency that matches a specified resource class.ResUtilGetResourceDependencyByName,RESUTILS.DLL,NM,4, enumerates the dependencies of a specified resource in a specified cluster and returns a handle to a dependency of a specified type.ResUtilGetResourceDependentIPAddressProps,RESUTILS.DLL,NM,7,The ResUtilGetResourceDependentIPAddressProps utility function retrieves the private properties of the first IP Address dependency found for a specified resource.ResUtilGetResourceNameDependency,RESUTILS.DLL,NM,2, enumerates the dependencies of a specified resource in the local cluster and returns a handle to a dependency of a specified resource type.ResUtilGetSzProperty,RESUTILS.DLL,NM,5,The ResUtilGetSzProperty utility function retrieves a string property from a property list and advances a pointer to the next property in the list.ResUtilGetSzValue,RESUTILS.DLL,NM,2,The ResUtilGetSzValue utility function returns a string value from the cluster database.ResUtilIsPathValid,RESUTILS.DLL,NM,1,The ResUtilIsPathValid utility function is used to check whether a path is syntactically valid.ResUtilIsResourceClassEqual,RESUTILS.DLL,NM,2, tests whether the resource class of a specified resource is equal to a specified resource class.ResUtilPropertyListFromParameterBlock,RESUTILS.DLL,NM,6,The ResUtilPropertyListFromParameterBlock utility function constructs a property list from a property table and a parameter block.

Page 154: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

ResUtilResourcesEqual,RESUTILS.DLL,NM,2,The ResUtilResourcesEqual utility function tests whether two resource handles represent the same resource.ResUtilResourceTypesEqual,RESUTILS.DLL,NM,2,The ResUtilResourceTypesEqual utility function tests whether a resource type matches the resource type name of a specified resource.ResUtilSetBinaryValue,RESUTILS.DLL,NM,6,The ResUtilSetBinaryValue utility function sets a binary value in the cluster database.ResUtilSetDwordValue,RESUTILS.DLL,NM,4,The ResUtilSetDwordValue utility function sets a numeric value in the cluster database.ResUtilSetExpandSzValue,RESUTILS.DLL,NM,4,The ResUtilSetExpandSzValue utility function sets an expandable string value in the cluster database.ResUtilSetMultiSzValue,RESUTILS.DLL,NM,6,The ResUtilSetMultiSzValue utility function sets a multiple string value in the cluster database.ResUtilSetPrivatePropertyList,RESUTILS.DLL,NM,3,The ResUtilSetPrivatePropertyList utility function sets the private properties of a cluster object.ResUtilSetPropertyParameterBlock,RESUTILS.DLL,NM,7,The ResUtilSetPropertyParameterBlock utility function is used to set properties in the cluster database from a parameter block.ResUtilSetPropertyParameterBlockEx,RESUTILS.DLL,NM,8,The ResUtilSetPropertyParameterBlockEx utility function is used to set properties in the cluster database from a parameter block.ResUtilSetPropertyTable,RESUTILS.DLL,NM,7,The ResUtilSetPropertyTable utility function is used to set properties in the cluster database based on a property list from a property table..ResUtilSetPropertyTableEx,RESUTILS.DLL,NM,8,The ResUtilSetPropertyTableEx utility function is used to set properties in the cluster database based on a property list from a property table.ResUtilSetResourceServiceEnvironment,RESUTILS.DLL,NM,4, adjusts the environment data for a service so that the service uses a cluster network name to identify its location. This function must be called from a resource DLL.ResUtilSetResourceServiceStartParameters,RESUTILS.DLL,NM,5, adjusts the start parameters of a specified service so that it will operate correctly as a cluster resource. It must be called from a resource DLL.ResUtilSetSzValue,RESUTILS.DLL,NM,4,The ResUtilSetSzValue utility function sets a string value in the cluster database.ResUtilSetUnknownProperties,RESUTILS.DLL,NM,4,The ResUtilSetUnknownProperties utility function stores a cluster object's unknown properties in the cluster database.ResUtilStartResourceService,RESUTILS.DLL,NM,2,The ResUtilStartResourceService utility function starts a service.ResUtilStopResourceService,RESUTILS.DLL,NM,1,The ResUtilStopResourceService utility function stops a named service.ResUtilStopService,RESUTILS.DLL,NM,1,The ResUtilStopService utility function stops a service identified by a handle.ResUtilVerifyPrivatePropertyList,RESUTILS.DLL,NM,2,The ResUtilVerifyPrivatePropertyList utility function verifies that a property list is correctly formatted.ResUtilVerifyPropertyTable,RESUTILS.DLL,NM,6,The ResUtilVerifyPropertyTable utility function uses a property table to verify that a property list is correctly formatted.ResUtilVerifyResourceService,RESUTILS.DLL,NM,1,The ResUtilVerifyResourceService utility function verifies that a named service is starting or currently running.ResUtilVerifyService,RESUTILS.DLL,NM,1,The ResUtilVerifyService utility function checks if a service identified by a handle is starting or currently running.RetrieveUrlCacheEntryFile,WININET.DLL,AW,4 Retrieves a cache entry from the cache in the form of a file.RetrieveUrlCacheEntryStream,WININET.DLL,AW,5 Provides the most efficient and implementation-independent way of accessing the cache data. ReuseDDElParam,USER32.DLL,NM,5 allows an application to reuse a packed DDE lParam parameter, rather than allocating a new packed lParam.RevertSecurityContext,SECUR32.DLL,NM,1, allows a security package to discontinue the impersonation of the caller and restore its own security context.RevertToSelf,ADVAPI32.DLL,NM,0, terminates the impersonation of a client application.RevokeActiveObject,OLEAUT32.DLL,NM,2,Ends an object's status as active.RevokeBindStatusCallback,URLMON.DLL,NM,2, Revokes a bind status callback interface previously registered on a bind context.RevokeDragDrop,OLE32.DLL,NM,1,Revokes the registration of the specified application window as a potential target for OLE drag-and-drop operations.RevokeFormatEnumerator,URLMON.DLL,NM,2, Removes a format enumerator from the given bind context.RoundRect,GDI32.DLL,NM,7, draws a rectangle with rounded corners.RpcBindingCopy,RPCRT4.DLL,NM,2, copies binding information and creates a new binding handle.RpcBindingFree,RPCRT4.DLL,NM,1, releases binding-handle resources.RpcBindingFromStringBinding,RPCRT4.DLL,AW,2, returns a binding handle from a string representation of a binding handle.RpcBindingInqAuthClient,RPCRT4.DLL,AW,6 A server application calls the RpcBindingInqAuthClient routine to obtain the principal name or privilege attributes of the authenticated client that made the remote procedure callRpcBindingInqAuthInfo,RPCRT4.DLL,AW,6, returns authentication and authorization information from a binding handle.RpcBindingInqAuthInfoEx,RPCRT4.DLL,AW,8 returns authentication,authorization, and security quality-of-service information from abinding handle.RpcBindingInqObject,RPCRT4.DLL,NM,2, returns the object UUID from a binding handle.RpcBindingInqOption,RPCRT4.DLL,NM,3 RPC client processes use RpcBindingInqOption to determine currentvalues of the binding options that are specific to the ncadg_mqmessage-queuing transport.RpcBindingReset,RPCRT4.DLL,NM,1, resets a binding handle so that the host is specified but the server on that host is unspecified.RpcBindingServerFromClient,RPCRT4.DLL,NM,2, converts a client binding handle to a server binding handle.RpcBindingSetAuthInfo,RPCRT4.DLL,AW,6, sets authentication and authorization information into a binding handle.RpcBindingSetAuthInfoEx,RPCRT4.DLL,AW,7 sets authentication, authorization, and security quality-of-service information into a binding handle.RpcBindingSetObject,RPCRT4.DLL,NM,2, sets the object UUID value in a binding handle.RpcBindingSetOption,RPCRT4.DLL,NM,3 enables client applications to specify message-queuing options on a binding handle.RpcBindingToStringBinding,RPCRT4.DLL,AW,2, returns a string representation of a binding handle.RpcBindingVectorFree,RPCRT4.DLL,NM,1, frees the binding handles contained in the vector and the vector itself.RpcCancelThread,RPCRT4.DLL,NM,1, cancels a thread.RpcEpRegister,RPCRT4.DLL,AW,4, adds to or replaces server address information in the local endpoint-map database.RpcEpRegisterNoReplace,RPCRT4.DLL,AW,4, adds server-address information to the local endpoint-map database.RpcEpResolveBinding,RPCRT4.DLL,NM,2, resolves a partially bound server binding handle into a fully bound server binding handle.RpcEpUnregister,RPCRT4.DLL,NM,3, removes server-address information from the local endpoint-map database.RpcIfIdVectorFree,RPCNS4.DLL,NM,1 frees the vector and the interface-identification structures contained in the vector.

RpcIfIdVectorFree,RPCRT4.DLL,NM,1 frees the vector and the interface-identification structures contained in the vector.RpcIfInqId,RPCRT4.DLL,NM,2, returns the interface-identification part of an interface specification.RpcImpersonateClient,RPCRT4.DLL,NM,1 A server thread that is processing client remote procedure callscan call the RpcImpersonateClientto impersonate theactive client.RpcMgmtEnableIdleCleanup,RPCRT4.DLL,NM,0 closes idle resources, suchas network connections, on the client.RpcMgmtEpEltInqBegin,RPCRT4.DLL,NM,6 RpcMcreates an inquiry context for viewing the elements in an endpoint map.RpcMgmtEpEltInqDone,RPCRT4.DLL,NM,1, deletes the inquiry context for viewing the elements in an endpoint map.RpcMgmtEpEltInqNext,RPCRT4.DLL,AW,5, returns one element from an endpoint map.RpcMgmtEpUnregister,RPCRT4.DLL,NM,4 removes server address informationfrom an endpoint map.RpcMgmtInqComTimeout,RPCRT4.DLL,NM,2, returns the binding- communications timeout value in a binding handle.RpcMgmtInqDefaultProtectLevel,RPCRT4.DLL,NM,2, returns the default authentication level for an authentication service.RpcMgmtInqIfIds,RPCRT4.DLL,NM,2 returns a vector containing the identifiers of the interfaces offered by the server.RpcMgmtInqServerPrincName,RPCRT4.DLL,AW,3, returns a server?s principal name.RpcMgmtInqStats,RPCRT4.DLL,NM,2 returns RPC run-time statistics.RpcMgmtIsServerListening,RPCRT4.DLL,NM,1, tells whether a server is listening for remote procedure calls.RpcMgmtSetAuthorizationFn,RPCRT4.DLL,NM,1 establishes an authorizationfunction for processing remote calls to a server?s managementroutines.RpcMgmtSetCancelTimeout,RPCRT4.DLL,NM,1, sets the lower bound on the time to wait before timing out after forwarding a cancel.RpcMgmtSetComTimeout,RPCRT4.DLL,NM,2, sets the binding-communications timeout value in a binding handle.RpcMgmtSetServerStackSize,RPCRT4.DLL,NM,1, specifies the stack size for each server thread.RpcMgmtStatsVectorFree,RPCRT4.DLL,NM,1, frees a statistics vector.RpcMgmtStopServerListening,RPCRT4.DLL,NM,1, tells a server to stop listening for remote procedure calls.RpcNetworkInqProtseqs,RPCRT4.DLL,AW,1 returns all protocol sequencessupported by both the RPC run-time library and the operatingsystem.RpcNetworkIsProtseqValid,RPCRT4.DLL,AW,1 tells whether the specified protocol sequence is supported by both the RPC run-time library and the operating system. RpcNsBindingExport,RPCNS4.DLL,AW,5 establishes a name-service databaseentry with multiple binding handles and multiple objects for aserver.RpcNsBindingImportBegin,RPCNS4.DLL,AW,5, creates an import context for an interface and an object.RpcNsBindingImportDone,RPCNS4.DLL,NM,1 signifies that a client hasfinished looking for a compatible server and deletes the importcontext.RpcNsBindingImportNext,RPCNS4.DLL,NM,2 looks up an interface, and optionally an object, from a name-service database and returns a binding handle of a compatible server (if found).RpcNsBindingInqEntryName,RPCRT4.DLL,AW,3, returns the entry name from which the binding handle came.RpcNsBindingLookupBegin,RPCNS4.DLL,AW,6, creates a lookup context for an interface and an object.RpcNsBindingLookupDone,RPCNS4.DLL,NM,1 signifies that a client hasfinished looking for compatible servers and deletes the lookupcontext.RpcNsBindingLookupNext,RPCNS4.DLL,NM,2, returns a list of compatible binding handles for a specified interface and optionally an object.RpcNsBindingSelect,RPCNS4.DLL,NM,2, returns a binding handle from a list of compatible binding handles.RpcNsBindingUnexport,RPCNS4.DLL,AW,4 removes the binding handles foran interface and objects from an entry in the name-servicedatabase.RpcNsEntryExpandName,RPCNS4.DLL,AW,3, expands a name-service entry name.RpcNsEntryObjectInqBegin,RPCNS4.DLL,AW,3, creates an inquiry context for a name-service database entry?s objects.RpcNsEntryObjectInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for a name-service database entry?s objects.RpcNsEntryObjectInqNext,RPCNS4.DLL,NM,2, returns one object at a time from a name-service database entry.RpcNsGroupDelete,RPCNS4.DLL,AW,2 deletes a group attribute.RpcNsGroupMbrAdd,RPCNS4.DLL,AW,4, adds an entry name to a group.RpcNsGroupMbrInqBegin,RPCNS4.DLL,AW,4, creates an inquiry context for viewing group members.RpcNsGroupMbrInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for a group.RpcNsGroupMbrInqNext,RPCNS4.DLL,AW,2, returns one entry name from a group at a time.RpcNsGroupMbrRemove,RPCNS4.DLL,AW,4, removes an entry name from a group.RpcNsMgmtBindingUnexport,RPCNS4.DLL,AW,5, removes multiple binding handles and objects from an entry in the name-service database.RpcNsMgmtEntryCreate,RPCNS4.DLL,AW,2, creates a name-service database entry.RpcNsMgmtEntryDelete,RPCNS4.DLL,AW,2, deletes a name-service database entry.RpcNsMgmtEntryInqIfIds,RPCNS4.DLL,AW,3 returns the list of interfaces exported to a name-service database entry.RpcNsMgmtHandleSetExpAge,RPCNS4.DLL,NM,2, sets the expiration age of a name-service handle for local copies of name-service data.RpcNsMgmtInqExpAge,RPCNS4.DLL,NM,1 returns the global expiration age for local copies of name-service data.RpcNsMgmtSetExpAge,RPCNS4.DLL,NM,1, modifies the application?s global expiration age for local copies of name-service data.RpcNsProfileDelete,RPCNS4.DLL,AW,2, deletes a profile attribute.RpcNsProfileEltAdd,RPCNS4.DLL,AW,7, adds an element to a profile.RpcNsProfileEltInqBegin,RPCNS4.DLL,AW,8 creates an inquiry context for viewing the elements in a profile.RpcNsProfileEltInqDone,RPCNS4.DLL,NM,1, deletes the inquiry context for viewing the elements in a profile.RpcNsProfileEltInqNext,RPCNS4.DLL,AW,5, returns one element at a time from a profile.RpcNsProfileEltRemove,RPCNS4.DLL,AW,5, removes an element from a profile.RpcObjectInqType,RPCRT4.DLL,NM,2, returns the type of an object.RpcObjectSetInqFn,RPCRT4.DLL,NM,1, registers an object-inquiry function.RpcObjectSetType,RPCRT4.DLL,NM,2, assigns the type of an object.RpcProtseqVectorFree,RPCRT4.DLL,AW,1, frees the protocol sequences contained in the vector and the vector itself.RpcRaiseException,RPCRT4.DLL,NM,1 Use the RpcRaiseExceptionto raise an exception.RpcRevertToSelf,RPCRT4.DLL,NM,0 After calling RpcImpersonateClient and completing any tasks thatrequire client impersonation, the server calls RpcRevertToSelf toend impersonation and to reestablish its own security identity.RpcRevertToSelfEx,RPCRT4.DLL,NM,1 After calling RpcImpersonateClient and completing any tasks thatrequire client impersonation, the server calls RpcRevertToSelfEx toend impersonation and to reestablish its own security identity.RpcServerInqBindings,RPCRT4.DLL,NM,1, returns the binding handles over which remote procedure calls can be received.

Page 155: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

RpcServerInqDefaultPrincName,RPCRT4.DLL,AW,2, obtains the default principal name from the server.RpcServerInqIf,RPCRT4.DLL,NM,3, returns the manager entry-point vector (EPV) registered for an interface.RpcServerListen,RPCRT4.DLL,NM,3, tells the RPC run-time library to listen for remote procedure calls.RpcServerRegisterAuthInfo,RPCRT4.DLL,AW,4, registers authentication information with the RPC run-time library.RpcServerRegisterIf,RPCRT4.DLL,NM,3 registers an interface with the RPC run-time library.RpcServerRegisterIfEx,RPCRT4.DLL,NM,6, registers an interface with the RPC run-time library.RpcServerUnregisterIf,RPCRT4.DLL,NM,3, unregisters an interface from the RPC run-time library.RpcServerUseAllProtseqs,RPCRT4.DLL,NM,2 tells the RPC run-time library to use all supported protocol sequences for receiving remote procedure calls. RpcServerUseAllProtseqsEx,RPCRT4.DLL,NM,3 tells the RPC run-timelibrary to use all supported protocol sequences for receivingremote procedure calls.RpcServerUseAllProtseqsIf,RPCRT4.DLL,NM,3 tells the RPC run-time library to use all the specified protocol sequences and endpoints in the interface specification for receiving remote procedure calls. RpcServerUseAllProtseqsIfEx,RPCRT4.DLL,NM,4 tells the RPC run-time library to use all the specified protocol sequences and endpoints in the interface specification for receiving remote procedure calls.RpcServerUseProtseq,RPCRT4.DLL,AW,3 tells the RPC run-time library to use the specified protocol sequence for receiving remote procedure calls. RpcServerUseProtseqEp,RPCRT4.DLL,AW,4 tells the RPC run-time library to use the specified protocol sequence combined with the specified endpoint for receiving remote procedure calls. .RpcServerUseProtseqEpEx,RPCRT4.DLL,AW,5 tells the RPC run-time libraryto use the specified protocol sequence combined with the specifiedendpoint for receiving remote procedure calls.RpcServerUseProtseqEx,RPCRT4.DLL,AW,4 tells the RPC run-time libraryto use the specified protocol sequence for receiving remoteprocedure calls.RpcServerUseProtseqIf,RPCRT4.DLL,AW,4 tells the RPC run-time library to use the specified protocol sequence combined with the endpoints in the interface specification for receiving remote procedure calls. RpcServerUseProtseqIfEx,RPCRT4.DLL,AW,5 tells the RPC run-time library to use the specified protocol sequence combined with the endpoints in the interface specification for receiving remote procedure calls. RpcSmAllocate,RPCRT4.DLL,NM,2 allocates memory within the RPC stub memory management function and returns a pointer to the allocated memory or NULL.RpcSmClientFree,RPCRT4.DLL,NM,1, frees memory returned from a client stub.RpcSmDestroyClientContext,RPCRT4.DLL,NM,1, reclaims the client memory resources for a context handle and makes the context handle NULL.RpcSmDisableAllocate,RPCRT4.DLL,NM,0, frees resources and memory within the stub memory management environment.RpcSmEnableAllocate,RPCRT4.DLL,NM,0, establishes the stub memory management environment.RpcSmFree,RPCRT4.DLL,NM,1, releases memory allocated by RpcSmAllocate.RpcSmGetThreadHandle,RPCRT4.DLL,NM,1, returns a thread handle, or NULL, for the stub memory management environment.RpcSmSetClientAllocFree,RPCRT4.DLL,NM,2, enables the memory allocation and release mechanisms used by the client stubs.RpcSmSetThreadHandle,RPCRT4.DLL,NM,1, sets a thread handle for the stub memory management environment.RpcSmSwapClientAllocFree,RPCRT4.DLL,NM,4 exchanges the memoryallocation and release mechanisms used by the client stubs with onesupplied by the client.RpcSsAllocate,RPCRT4.DLL,NM,1 allocates memory within the RPC stubmemory management function, and returns a pointer to the allocatedmemory or NULL.RpcSsDestroyClientContext,RPCRT4.DLL,NM,1, destroys a context handle no longer needed by the client without contacting the server.RpcSsDisableAllocate,RPCRT4.DLL,NM,0, frees resources and memory within the stub memory management environment.RpcSsDontSerializeContext,RPCRT4.DLL,NM,0, disables runtime serialization of multiple calls dispatched to server manager routines on the same context handle.RpcSsEnableAllocate,RPCRT4.DLL,NM,0 establishes the stub memory management environment..RpcSsFree,RPCRT4.DLL,NM,1, releases memory allocated by RpcSsAllocate.RpcSsGetThreadHandle,RPCRT4.DLL,NM,0, returns a thread handle for the stub memory management environment.RpcSsSetClientAllocFree,RPCRT4.DLL,NM,2, enables the memory allocation and release mechanisms used by the client stubs.RpcSsSetThreadHandle,RPCRT4.DLL,NM,1, sets a thread handle for the stub memory management environment.RpcSsSwapClientAllocFree,RPCRT4.DLL,NM,4 exchanges the memoryallocation and release mechanisms used by the client stubs with onesupplied by the client.RpcStringBindingCompose,RPCRT4.DLL,AW,6 combines the components of a string binding into a string binding.RpcStringBindingParse,RPCRT4.DLL,AW,6, returns the object UUID part and the address parts of a string binding as separate strings.RpcStringFree,RPCRT4.DLL,AW,1 frees a character string allocated by the RPC run-time library.RpcTestCancel,RPCRT4.DLL,NM,0, checks for a cancel indication.RTFSync,MAPI32.DLL,NM,3, ensures that the Rich Text Format (RTF) message text matches the plain text version.SafeArrayAccessData,OLEAUT32.DLL,NM,2,Increments the lock count of an array, and retrieves a pointer to the array data.SafeArrayAllocData,OLEAUT32.DLL,NM,1,This function allocates memory for a safearray, based on a descriptor created with SafeArrayAllocDescriptor.SafeArrayAllocDescriptor,OLEAUT32.DLL,NM,2,Allocates memory for a safearray descriptor.SafeArrayCopy,OLEAUT32.DLL,NM,2,Data4.2 SafeArrayCopyData This function copies the source array to the target array after releasing any resources in the target array. This function isSafeArrayCopyData,OLEAUT32.DLL,NM,2,4.2 This function copies the source array to the target array after releasing any resources in the target array. SafeArrayCreate,OLEAUT32.DLL,NM,3,VectorCreates a one-dimensional array whose lower bound is always zero. A safearray created with SafeArrayCreateVector is a fixed size, so the constant FADF_FIXEDSIZE is always set.SafeArrayCreateVector,OLEAUT32.DLL,NM,3,Creates a one-dimensional array whose lower bound is always zero. A safearray created with SafeArrayCreateVector is a fixed size, so the constant FADF_FIXEDSIZE is always set.SafeArrayDestroy,OLEAUT32.DLL,NM,1,Descriptor This function destroys a decriptor of a safe array. SafeArrayDestroyData,OLEAUT32.DLL,NM,1,This function destroys all the data in a safearray.SafeArrayDestroyDescriptor,OLEAUT32.DLL,NM,1, This function destroys a decriptor of a safe array.SafeArrayGetDim,OLEAUT32.DLL,NM,1,Returns the number of dimensions in the array.SafeArrayGetElement,OLEAUT32.DLL,NM,3,Retrieves a single element of the array.SafeArrayGetElemsize,OLEAUT32.DLL,NM,1, retrieves the size (in bytes) of the elements of a safearray.

SafeArrayGetLBound,OLEAUT32.DLL,NM,3,4.2 returns the lower bound for any dimension of a safearray. SafeArrayGetUBound,OLEAUT32.DLL,NM,3,Returns the upper bound for any dimension of a safearray.SafeArrayLock,OLEAUT32.DLL,NM,1,This function increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.SafeArrayPtrOfIndex,OLEAUT32.DLL,NM,3,Returns a pointer to an array element.SafeArrayPutElement,OLEAUT32.DLL,NM,3,Stores the data element at a given location in the array.SafeArrayRedim,OLEAUT32.DLL,NM,2,Changes the right-most (least significant) bound of a safearray.SafeArrayUnaccessData,OLEAUT32.DLL,NM,1,Decrements the lock count of an array, and invalidates the pointer retrieved by SafeArrayAccessData.SafeArrayUnlock,OLEAUT32.DLL,NM,1,Decrements the lock count of an array so it can be freed or resized.SaslAcceptSecurityContext,SECUR32.DLL,NM,9,Wraps a standard call to the Security Support Provider InterfaceB AcceptSecurityContext (General) function and includes creation of SASL server cookies.SaslEnumerateProfiles,SECUR32.DLL,AW,2,Lists the packages that provide a SASL interface.SaslGetProfilePackage,SECUR32.DLL,AW,2,Returns the package information for the specified package.SaslIdentifyPackage,SECUR32.DLL,AW,2,Returns the negotiate prefix that matches the specified SASL negotiation buffer.SaslInitializeSecurityContext,SECUR32.DLL,AW,12,Wraps a standard call to the Security Support Provider InterfaceB InitializeSecurityContext (General) function and processes SASL server cookies from the server.SatisfyNtmsOperatorRequest,NTMSAPI.DLL,NM,2, completes the specified RSM operator request.SaveDC,GDI32.DLL,NM,1 saves the current state of the specified device context (DC) by copying data describing selected objects and graphic modes (such as the bitmap, brush, palette, font, pen, region, drawing mode, and mapping mode) to a context stack. ScaleViewportExtEx,GDI32.DLL,NM,6 modifies the viewport for a devicecontext (DC) by using the ratios formed by the specifiedmultiplicands and divisors.ScaleWindowExtEx,GDI32.DLL,NM,6 modifies the window for a devicecontext using the ratios formed by the specified multiplicands anddivisors.ScBinFromHexBounded,MAPI32.DLL,NM,3 converts the specified portion of a string representation of a hexadecimal number into a binary number. ScCopyNotifications,MAPI32.DLL,NM,4, copies a group of event notifications to a single block of memory.ScCopyProps,MAPI32.DLL,NM,4, copies the properties defined by an array of SPropValue structures to a new destination.ScCountNotifications,MAPI32.DLL,NM,3 determines the size, in bytes, ofan array of event notifications, and validates the memoryassociated with the array.ScCountProps,MAPI32.DLL,NM,3 determines the size, in bytes, of aproperty value array and validates the memory associated with thearray.ScCreateConversationIndex,MAPI32.DLL,NM,4, indicates where in a message thread a message belongs.ScDupPropset,MAPI32.DLL,NM,4 duplicates a property value array in a single block of MAPI memory combining the operations of the ScCopyProps </native/mapi/src/func2mpf.htm> and ScCountProps functions. ScheduleJob,WINMM.DLL,NM,2, checks for a valid spool file.SchemaPreload,DAPI.DLL,AW,2, is an example of a process terminated by DAPIUninitialize.ScInitMapiUtil,MAPI32.DLL,NM,1, replaces MAPIInitialize when only select utility functions are being used.ScLocalPathFromUNC,MAPI32.DLL,NM,3, locates a local path counterpart to the given universal naming convention (UNC) path.ScreenToClient,USER32.DLL,NM,2, converts the screen coordinates of a specified point on the screen to client coordinates.ScRelocNotifications,MAPI32.DLL,NM,5, adjusts a pointer within a specified event notification array.ScRelocProps,MAPI32.DLL,NM,5 adjusts the pointers in an SPropValue array after the array and its data have been copied or moved to a new location. ScrollConsoleScreenBuffer,KERNEL32.DLL,AW,5, moves a block of data in a screen buffer.ScrollDC,USER32.DLL,NM,7, scrolls a rectangle of bits horizontally and vertically.ScrollWindow,USER32.DLL,NM,5, scrolls the content of the specified window?s client area.ScrollWindowEx,USER32.DLL,NM,8, scrolls the content of the specified window?s client area.ScUNCFromLocalPath,MAPI32.DLL,NM,3, locates a universal naming convention (UNC) path counterpart to the given local path.SealMessage,SECUR32.DLL,NM,4, is already documented under another name. For more information, see SpSealMessage.SearchPath,KERNEL32.DLL,AW,6, searches for the specified file.SearchTreeForFile,IMAGEHLP.DLL,NM,3, searches a directory tree for a specified file.select,WS2_32.DLL,NM,5, is used to determine the status of one or more sockets.select,WSOCK32.DLL,NM,5, is used to determine the status of one or more sockets.SelectClipPath,GDI32.DLL,NM,2, selects the current path as a clipping region for a device context, combining the new region with any existing clipping region by using the specified mode. .SelectClipRgn,GDI32.DLL,NM,2, selects a region as the current clipping region for the specified device context.SelectCMM,MSCMS.DLL,NM,1,SelectCMM allows an application to select the preferred color management module (CMM) to use.SelectObject,GDI32.DLL,NM,2 selects an object into the specified device context.SelectPalette,GDI32.DLL,NM,3, selects the specified logical palette into a device context.send,WS2_32.DLL,NM,4, is used to write outgoing data on a connected socket.send,WSOCK32.DLL,NM,4, is used to write outgoing data on a connected socket.SendDlgItemMessage,USER32.DLL,AW,5, sends a message to the specified control in a dialog box.SendInput,USER32.DLL,NM,3, synthesizes keystrokes, mouse motions, and button clicks.SendMessage,USER32.DLL,AW,4 sends the specified message to a window or windows.SendMessageCallback,USER32.DLL,AW,6, sends the specified message to a window or windows.SendMessageTimeout,USER32.DLL,AW,7, sends the specified message to a window or windows.SendNotifyMessage,USER32.DLL,AW,4, sends the specified message to a window.sendto,WS2_32.DLL,NM,6, is used to write outgoing data on a socket.sendto,WSOCK32.DLL,NM,6, is used to write outgoing data on a socket.SetAbortProc,GDI32.DLL,NM,2, sets the application-defined abort function that allows a print job to be canceled during spooling.SetAclInformation,ADVAPI32.DLL,NM,4, sets information about an access- control list (ACL).SetActiveWindow,USER32.DLL,NM,1, activates a window, but not if the application is in the background.SetArcDirection,GDI32.DLL,NM,2 sets the drawing direction to be used for arc and rectangle functions. SetAttribIMsgOnIStg,MAPI32.DLL,NM,4 sets or alters attributes ofproperties on an IMessage object supplied by the OpenIMsgOnIStgfunction.SetBitmapBits,GDI32.DLL,NM,3, sets the bits of color data for a bitmap to the specified values.SetBitmapDimensionEx,GDI32.DLL,NM,4, assigns preferred dimensions to a bitmap.

Page 156: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SetBkColor,GDI32.DLL,NM,2 sets the current background color to thespecified color value, or to the nearest physical color if thedevice cannot represent the specified color value.SetBkMode,GDI32.DLL,NM,2, sets the background mix mode of the specified device context.SetBoundsRect,GDI32.DLL,NM,3 controls the accumulation of bounding rectangle information for the specified device context. SetBrushOrgEx,GDI32.DLL,NM,4 sets the brush origin that GDI assigns to the next brush an application selects into the specified device context. SetCapture,USER32.DLL,NM,1, sets the mouse capture to the specified window belonging to the current thread.SetCaretBlinkTime,USER32.DLL,NM,1, sets the caret blink time to the specified number of milliseconds.SetCaretPos,USER32.DLL,NM,2 moves the caret to the specified coordinates.SetClassLong,USER32.DLL,AW,3 replaces the specified 32-bit (long) value at the specified offset into the extra class memory or the WNDCLASSEX structure for the class to which the specified window belongs.SetClassWord,USER32.DLL,NM,3 replaces the 16-bit (word) value at thespecified offset into the extra class memory for the window classto which the specified window belongs.SetClipboardData,USER32.DLL,NM,2, places data on the clipboard in a specified clipboard format.SetColorAdjustment,GDI32.DLL,NM,2, sets the color adjustment values for a device context using the specified values.SetColorProfileElement,MSCMS.DLL,NM,5, sets the element data for a tagged profile element.SetColorProfileElementReference,MSCMS.DLL,NM,3,SetColorProfileElementReference creates in a specified color profile a new tag which references the same data as an existing tag.SetColorProfileElementSize,MSCMS.DLL,NM,3,SetColorProfileElementSize sets the size of a tagged element.SetColorProfileHeader,MSCMS.DLL,NM,2, sets the header data in a specified color profile.SetCommBreak,KERNEL32.DLL,NM,1 suspends character transmission for aspecified communications device and places the transmission line ina break state until the ClearCommBreak function is called.SetCommConfig,KERNEL32.DLL,NM,3, sets the current configuration of a communications device.SetCommMask,KERNEL32.DLL,NM,2, specifies a set of events to be monitored for a communications device.SetCommState,KERNEL32.DLL,NM,2 configures a communications device according to the specifications in a device-control block SetCommTimeouts,KERNEL32.DLL,NM,2 sets the time-out parameters for all read and write operations on a specified communications device. SetComputerName,KERNEL32.DLL,AW,1, sets the computer name to be used the next time the system is restarted.SetConsoleActiveScreenBuffer,KERNEL32.DLL,NM,1, sets the specified screen buffer to be the currently displayed console screen buffer.SetConsoleCP,KERNEL32.DLL,NM,1, sets the input code page used by the console associated with the calling process.SetConsoleCtrlHandler,KERNEL32.DLL,NM,2 adds or removes an application-defined HandlerRoutine function from the list of handler functions for the calling process. SetConsoleCursorInfo,KERNEL32.DLL,NM,2, sets the size and visibility of the cursor for the specified console screen buffer.SetConsoleCursorPosition,KERNEL32.DLL,NM,2, sets the cursor position in the specified console screen buffer.SetConsoleMode,KERNEL32.DLL,NM,2 sets the input mode of a console?sinput buffer or the output mode of a console screen buffer.SetConsoleOutputCP,KERNEL32.DLL,NM,1, sets the output code page used by the console associated with the calling process.SetConsoleScreenBufferSize,KERNEL32.DLL,NM,2, changes the size of the specified console screen buffer.SetConsoleTextAttribute,KERNEL32.DLL,NM,2 sets the foreground (text) and background color attributes of characters written to the screen buffer by the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function. SetConsoleTitle,KERNEL32.DLL,AW,1, sets the title bar string for the current console window.SetConsoleWindowInfo,KERNEL32.DLL,NM,3 sets the current size and position of a console screen buffer?s window. SetConvertStg,OLE32.DLL,NM,2, sets the convert bit in a storage object to indicate that the object is to be converted to a new class when it is opened. The setting can be retrieved with a call to the GetConvertStg function.SetCurrentDirectory,KERNEL32.DLL,AW,1 changes the current directory for the current process. SetCursor,USER32.DLL,NM,1, establishes the cursor shape.SetCursorPos,USER32.DLL,NM,2, moves the cursor to the specified screen coordinates.SetDebugErrorLevel,USER32.DLL,NM,1 sets the minimum error level atwhich Windows will generate debugging events and pass them to adebugger.SetDefaultCommConfig,KERNEL32.DLL,AW,3, sets the default configuration for a communications device.SetDIBColorTable,GDI32.DLL,NM,4 sets RGB (red, green, blue) color values in a range of entries in the color table of the device-independent bitmap (DIB) that is currently selected into a specified device context.SetDIBits,GDI32.DLL,NM,7, sets the pixels in a bitmap using the color data found in the specified device-independent bitmap (DIB).SetDIBitsToDevice,GDI32.DLL,NM,12 sets the pixels in the specified rectangle on the device that is associated with the destination device context using color data from a device-independent bitmap (DIB). SetDlgItemInt,USER32.DLL,NM,4, sets the text of a control in a dialog box to the string representation of a specified integer value.SetDlgItemText,USER32.DLL,AW,3, sets the title or text of a control in a dialog box.SetDoubleClickTime,USER32.DLL,NM,1, sets the double-click time for the mouse.SetEndOfFile,KERNEL32.DLL,NM,1 Sets End-of-file (EOF) position for the specified file to the current position of the file pointer.SetEnhMetaFileBits,GDI32.DLL,NM,2, creates a memory-based enhanced- format metafile from the supplied data.SetEntriesInAcl,ADVAPI32.DLL,AW,4 creates a new access-control list(ACL) by merging new access-control or audit-control informationinto an existing ACL.SetEnvironmentVariable,KERNEL32.DLL,AW,2, sets the value of an environment variable for the current process.SetErrorInfo,OLEAUT32.DLL,NM,2, (Visual C++ Concepts)Called by OnWizFinish and CanUseFileName to provide current error information.SetErrorMode,KERNEL32.DLL,NM,1, controls how the operating system handles several types of serious errors.SetEvent,KERNEL32.DLL,NM,1 sets the state of the specified event object to signaled. SetFileApisToOEM,KERNEL32.DLL,NM,0, causes a set of Win32 file functions to use the OEM code page.SetFileAttributes,KERNEL32.DLL,AW,2, sets a file?s attributes.SetFilePointer,KERNEL32.DLL,NM,4, moves the file pointer of an open file.SetFileSecurity,ADVAPI32.DLL,AW,3 sets the security of a file or directory object. SetFileTime,KERNEL32.DLL,NM,4, sets the date and time that a file was created, last accessed, or last modified.SetFocus,USER32.DLL,NM,1 sets the keyboard focus to the specified window. SetForegroundWindow,USER32.DLL,NM,1, puts the thread that created the specified window into the foreground and activates the window.

SetForm,WINMM.DLL,AW,5, sets the form information for the specified printer.SetGraphicsMode,GDI32.DLL,NM,2 sets the graphics mode for the specified device context. SetHandleCount,KERNEL32.DLL,NM,1, sets the number of file handles available to a process.SetHandleInformation,KERNEL32.DLL,NM,3 sets certain properties of an object handle.SetImageConfigInformation,IMAGEHLP.DLL,NM,2, locates and changes the load configuration data of an image.SetJob,WINMM.DLL,AW,5, pauses, resumes, cancels, or restarts a print job on a specified printer.SetKernelObjectSecurity,ADVAPI32.DLL,NM,3 sets the security of a kernel object.SetKeyboardState,USER32.DLL,NM,1, copies a 256-byte array of keyboard key states into the calling thread?s keyboard-input state table.SetLastError,KERNEL32.DLL,NM,1, sets the last-error code for the calling thread.SetLastErrorEx,USER32.DLL,NM,2, sets the last-error code.SetLocaleInfo,KERNEL32.DLL,AW,3, sets an item of locale information.SetLocalTime,KERNEL32.DLL,NM,1, sets the current local time and date.SetMailslotInfo,KERNEL32.DLL,NM,2, sets the time-out value used by the specified mailslot for a read operation.SetMapMode,GDI32.DLL,NM,2, sets the mapping mode of the specified device context.SetMapperFlags,GDI32.DLL,NM,2, alters the algorithm the font mapper uses when it maps logical fonts to physical fonts.SetMenu,USER32.DLL,NM,2, assigns a new menu to the specified window.SetMenuContextHelpId,USER32.DLL,NM,2, associates a help context identifier with a menu.SetMenuDefaultItem,USER32.DLL,NM,3, sets the default menu item for the specified menu.SetMenuItemBitmaps,USER32.DLL,NM,5 associates the specified bitmap with a menu item.SetMenuItemInfo,USER32.DLL,AW,4 changes information about a menu item.SetMessageExtraInfo,USER32.DLL,NM,1, sets the extra message information for the current thread.SetMessageQueue,USER32.DLL,NM,1, is obsolete.SetMetaFileBitsEx,GDI32.DLL,NM,2, creates a memory-based Windows- format metafile from the supplied data.SetMetaRgn,GDI32.DLL,NM,1 intersects the current clipping region for the specified device context with the current metaregion and saves the combined region as the new metaregion for the specified device context. SetMiterLimit,GDI32.DLL,NM,3, sets the limit for the length of miter joins for the specified device context.SetNamedPipeHandleState,KERNEL32.DLL,NM,4, sets the read mode and the blocking mode of the specified named pipe.SetNamedSecurityInfo,ADVAPI32.DLL,AW,7 sets specified security information in the security descriptor of a specified object. SetNtmsMediaComplete,NTMSAPI.DLL,NM,2, marks a piece of logical media as complete.SetNtmsObjectAttribute,NTMSAPI.DLL,AW,6, creates an extended attribute (named private data) in the specified RSM object.SetNtmsObjectInformation,NTMSAPI.DLL,AW,3, changes the information structure of the specified object.SetNtmsObjectSecurity,NTMSAPI.DLL,NM,5, writes the security descriptor for the specified RSM object.SetNtmsRequestOrder,NTMSAPI.DLL,NM,3, sets the order that the specified request will be processed in the library queue.SetPaletteEntries,GDI32.DLL,NM,4, sets RGB (red, green, blue) color values and flags in a range of entries in a logical palette.SetParent,USER32.DLL,NM,2 changes the parent window of the specified child window. SetPixel,GDI32.DLL,NM,4, sets the pixel at the specified coordinates to the specified color.SetPixelFormat,GDI32.DLL,NM,3 sets the pixel format of the specified device context to the format specified by the iPixelFormat index.SetPixelV,GDI32.DLL,NM,4, sets the pixel at the specified coordinates to the closest approximation of the specified color.SetPolyFillMode,GDI32.DLL,NM,2, sets the polygon fill mode for functions that fill polygons.SetPrinter,WINMM.DLL,AW,4, sets the state of the specified printer by pausing printing, resuming printing, or clearing all print jobs.SetPrinterData,WINMM.DLL,AW,5, sets the configuration data for a printer.SetPriorityClass,KERNEL32.DLL,NM,2, sets the priority class for the specified process.SetPrivateObjectSecurity,ADVAPI32.DLL,NM,5, modifies a private object?s security descriptor.SetProcessAffinityMask,KERNEL32.DLL,NM,2 sets a processor affinity mask for the threads of a specified process.SetProcessPriorityBoost,KERNEL32.DLL,NM,2 disables the ability of Windows NT to temporarily boost the priority of the threads of the specified process.SetProcessShutdownParameters,KERNEL32.DLL,NM,2, sets shutdown parameters for the currently calling process.SetProcessWindowStation,USER32.DLL,NM,1, assigns a window station to the calling process.SetProcessWorkingSetSize,KERNEL32.DLL,NM,3, sets the minimum and maximum working set sizes for a specified process.SetProp,USER32.DLL,AW,3 adds a new entry or changes an existing entry in the property list of the specified window. SetRect,USER32.DLL,NM,5, sets the coordinates of the specified rectangle.SetRectEmpty,USER32.DLL,NM,1 creates an empty rectangle in which all coordinates are set to zero. SetRectRgn,GDI32.DLL,NM,5, changes a region into a rectangular region with the specified coordinates.SetROP2,GDI32.DLL,NM,2, sets the current foreground mix mode.SetScrollInfo,USER32.DLL,NM,4 sets the parameters of a scroll bar,including the minimum and maximum scrolling positions, the pagesize, and the position of the scroll box (thumb).SetScrollPos,USER32.DLL,NM,4 sets the position of the scroll box(thumb) in the specified scroll bar and, if requested, redraws thescroll bar to reflect the new position of the scroll box.SetScrollRange,USER32.DLL,NM,5, sets the minimum and maximum position values for the specified scroll bar.SetSecurityDescriptorDacl,ADVAPI32.DLL,NM,4, sets information in a discretionary access-control list (ACL).SetSecurityDescriptorGroup,ADVAPI32.DLL,NM,3 sets the primary group information of an absolute-format security descriptor, replacing any primary group information already present in the security descriptor. SetSecurityDescriptorOwner,ADVAPI32.DLL,NM,3, sets the owner information of an absolute-format security descriptor.SetSecurityDescriptorSacl,ADVAPI32.DLL,NM,4, sets information in a system access-control list (ACL).SetSecurityInfo,ADVAPI32.DLL,NM,7, sets specified security information in the security descriptor of a specified object.SetService,MSWSOCK.DLL,AW,6,Important is obsolete.SetService,WSOCK32.DLL,AW,6,Important is obsolete.SetServiceBits,ADVAPI32.DLL,NM,4 registers a service type with the service control manager and the Server service. SetServiceObjectSecurity,ADVAPI32.DLL,NM,3, sets the security descriptor of a service object.SetServiceStatus,ADVAPI32.DLL,NM,2, updates the service control manager?s status information for the calling service.setsockopt,WS2_32.DLL,NM,5, sets a socket option.setsockopt,WSOCK32.DLL,NM,5, sets a socket option.SetStandardColorSpaceProfile,MSCMS.DLL,AW,3, registers a specified profile for a given standard color space.

Page 157: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SetStdHandle,KERNEL32.DLL,NM,2, is used to set the handle for the standard input, standard output, or standard error device.SetStretchBltMode,GDI32.DLL,NM,2, sets the bitmap stretching mode in the specified device context.SetSysColors,USER32.DLL,NM,3, sets the colors for one or more display elements.SetSystemCursor,USER32.DLL,NM,2 replaces the contents of the system cursor specified by id with the contents of the cursor specified by hcur, and then destroys hcur.SetSystemPaletteUse,GDI32.DLL,NM,2, allows an application to specify whether the system palette contains 2 or 20 static colors.SetSystemPowerState,KERNEL32.DLL,NM,2, suspends the system by shutting power down.SetSystemTime,KERNEL32.DLL,NM,1, sets the current system time and date.SetTapeParameters,KERNEL32.DLL,NM,3, either specifies the block size of a tape or configures the tape device.SetTapePosition,KERNEL32.DLL,NM,6 sets the tape position on the specified device.SetTextAlign,GDI32.DLL,NM,2, sets the text-alignment flags for the specified device context.SetTextCharacterExtra,GDI32.DLL,NM,2 sets the intercharacter spacing.SetTextColor,GDI32.DLL,NM,2, sets the text color for the specified device context to the specified color.SetTextJustification,GDI32.DLL,NM,3, specifies the amount of space Windows should add to the break characters in a string of text.SetThreadAffinityMask,KERNEL32.DLL,NM,2, sets a processor affinity mask for a specified thread.SetThreadContext,KERNEL32.DLL,NM,2, sets the context in the specified thread.SetThreadDesktop,USER32.DLL,NM,1, assigns a desktop to the calling thread.SetThreadIdealProcessor,KERNEL32.DLL,NM,2, is used to specify a preferred processor for a thread.SetThreadLocale,KERNEL32.DLL,NM,1, sets the calling thread?s current locale.SetThreadPriority,KERNEL32.DLL,NM,2, sets the priority value for the specified thread.SetThreadPriorityBoost,KERNEL32.DLL,NM,2, disables the ability of Windows NT to temporarily boost the priority of a thread.SetThreadToken,ADVAPI32.DLL,NM,2, assigns an impersonation token to a thread.SetTimer,USER32.DLL,NM,4, creates a timer with the specified time-out value.SetTimeZoneInformation,KERNEL32.DLL,NM,1 sets the current time-zone parameters.SetTokenInformation,ADVAPI32.DLL,NM,4, sets various types of information for a specified access token.SetUnhandledExceptionFilter,KERNEL32.DLL,NM,1 lets an applicationsupersede the top-level exception handler that Win32 places at thetop of each thread and process.SetupColorMatching,ICMUI.DLL,AW,1,creates a Color Management dialog box that lets the user choose whether to enable color management, and if so, provides control over the color profiles used and over the rendering intent.SetupComm,KERNEL32.DLL,NM,3, initializes the communications parameters for a specified communications device.SetUrlCacheConfigInfo,WININET.DLL,AW,2,4.2 sets cache configuration information. BOOLAPI SetUrlCacheConfigInfoA( LPINTERNET_CACHE_CONFIG_INFOASetUrlCacheEntryGroup,WININET.DLL,AW,7,Adds entries to or removes entries from a cache group.SetUrlCacheEntryInfo,WININET.DLL,AW,3,Sets the specified members of the INTERNET_CACHE_ENTRY_INFO structure.SetUrlCacheGroupAttribute,WININET.DLL,AW,6,Sets the attribute information of the specified cache group.SetUserObjectInformation,USER32.DLL,AW,4, sets information about a window station or desktop object.SetUserObjectSecurity,USER32.DLL,NM,3, sets the security of a user object.SetViewportExtEx,GDI32.DLL,NM,4 sets the horizontal and vertical extents of the viewport for a device context by using the specified values. SetViewportOrgEx,GDI32.DLL,NM,4, sets the viewport origin of a device context by using the specified coordinates.SetVolumeLabel,KERNEL32.DLL,AW,2, sets the label of a file system volume.SetWaitableTimer,KERNEL32.DLL,NM,6, activates the specified ?waitable? timer.SetWindowContextHelpId,USER32.DLL,NM,2, associates a help context identifier with the specified window.SetWindowExtEx,GDI32.DLL,NM,4 sets the horizontal and vertical extents of the window for a device context by using the specified values. SetWindowLong,USER32.DLL,AW,3 changes an attribute of the specifiedwindow.SetWindowOrgEx,GDI32.DLL,NM,4, sets the window origin of the device context by using the specified coordinates.SetWindowPlacement,USER32.DLL,NM,2 sets the show state and therestored, minimized, and maximized positions of the specifiedwindow.SetWindowPos,USER32.DLL,NM,7 changes the size, position, and Z order of a child, pop-up, or top-level window.SetWindowRgn,USER32.DLL,NM,3, sets the window region of a window.SetWindowsHook,USER32.DLL,AW,2 is obsolete.SetWindowsHookEx,USER32.DLL,AW,4, installs an application-defined hook procedure into a hook chain.SetWindowText,USER32.DLL,AW,2, changes the text of the specified window?s title bar (if it has one).SetWindowWord,USER32.DLL,NM,3, is obsolete.SetWinMetaFileBits,GDI32.DLL,NM,4 converts a metafile from the older Windows format to the new enhanced format and stores the new metafile in memory. SetWorldTransform,GDI32.DLL,NM,2 sets a two-dimensional linear transformation between world space and page space for the specified device context.SHAddToRecentDocs,SHELL32.DLL,NM,2 _hreadAdds a document to the shell?s list of recently used documents orclears all documents from the list.SHAppBarMessage,SHELL32.DLL,NM,2 Sends an appbar message to the system.SHBrowseForFolder,SHELL32.DLL,AW,1 Displays a dialog box that enables the user to select a shellfolder.SHChangeNotify,SHELL32.DLL,NM,4 Notifies the system of an event that an application has performed.ShellAbout,SHELL32.DLL,AW,4, displays a Shell About dialog box.ShellExecute,SHELL32.DLL,AW,6, opens or prints a specified file.ShellExecuteEx,SHELL32.DLL,AW,1, performs an action on a file.Shell_NotifyIcon,SHELL32.DLL,AW,2 Sends a message to the system to add, modify, or delete an iconfrom the taskbar status area.SHFileOperation,SHELL32.DLL,AW,1 Performs a copy, move, rename, or delete operation on a file systemobject.SHFree,SHELL32.DLL,NM,1 Frees the memory allocated by SHAlloc.SHFreeNameMappings,SHELL32.DLL,NM,1 Frees a file name mapping object that was retrieved by the SHFileOperation function. SHGetDataFromIDList,SHELL32.DLL,AW,5 retrieves extended property datafrom a relative IDList.SHGetDesktopFolder,SHELL32.DLL,NM,1 Retrieves the IShellFolder interface for the desktop folder, whichis the root of the shell?s name space.SHGetFileInfo,SHELL32.DLL,AW,5 Retrieves information about an object in the file system, such as afile, a folder, a directory, or a drive root.SHGetInstanceExplorer,SHELL32.DLL,NM,1 Retreives the address of the Explorer?s IUnknown interface.SHGetMalloc,SHELL32.DLL,NM,1 Retrieves a pointer to the shell?s IMalloc interface.SHGetPathFromIDList,SHELL32.DLL,AW,2 Converts an item identifier list to a file system path.

SHGetSpecialFolderLocation,SHELL32.DLL,NM,3 Retrieves the location of a special folder.SHLoadInProc,SHELL32.DLL,NM,1 Creates an instance of the specified object class from within thecontext of the shell?s process.ShowCaret,USER32.DLL,NM,1, makes the caret visible on the screen at the caret?s current position.ShowCursor,USER32.DLL,NM,1, displays or hides the cursor.ShowHideMenuCtl,COMCTL32.DLL,NM,3 sets or removes the specified menuitem?s check-mark attribute, and shows or hides the correspondingcontrol.ShowOwnedPopups,USER32.DLL,NM,2, shows or hides all pop-up windows owned by the specified window.ShowScrollBar,USER32.DLL,NM,3 shows or hides the specified scroll bar. ShowWindow,USER32.DLL,NM,2, sets the specified window?s show state.ShowWindowAsync,USER32.DLL,NM,2, sets the show state of a window created by a different thread.shutdown,WS2_32.DLL,NM,2, is used on all types of sockets to disable reception, transmission, or both.shutdown,WSOCK32.DLL,NM,2, is used on all types of sockets to disable reception, transmission, or both.SignalObjectAndWait,KERNEL32.DLL,NM,4, allows the caller to atomically signal an object and wait on another object.SizeofResource,KERNEL32.DLL,NM,2, returns the size, in bytes, of the specified resource.Sleep,KERNEL32.DLL,NM,1, suspends the execution of the current thread for a specified interval.SleepEx,KERNEL32.DLL,NM,2 causes the current thread to enter a wait state An I/O completion callback function is called, An asynchronous procedure call (APC) is queued to the thread., The time-out interval elapsessndPlaySound,WINMM.DLL,AW,2, plays a waveform sound specified either by a filename or by an entry in the registry or the WIN.SnmpMgrClose,MGMTAPI.DLL,NM,1, closes communications sockets and data structures associated with the specified session.SnmpMgrCtl,MGMTAPI.DLL,NM,7,sets an operating parameter associated with an SNMP session.SnmpMgrGetTrap,MGMTAPI.DLL,NM,6, returns outstanding trap data that the caller has not received if trap reception is enabled.SnmpMgrGetTrapEx,MGMTAPI.DLL,NM,8,returns outstanding trap data that the caller has not received if trap reception is enabled.SnmpMgrOidToStr,MGMTAPI.DLL,NM,2 converts an internal object identifier to a string object identifier or object descriptor representation.SnmpMgrOpen,MGMTAPI.DLL,NM,4, initializes communications sockets and data structures, allowing communications with the specified agent.SnmpMgrRequest,MGMTAPI.DLL,NM,5, requests the specified operation be performed with the specified agent.SnmpMgrStrToOid,MGMTAPI.DLL,NM,2, converts an internal object identifier to a string object identifier or object descriptor representation.SnmpMgrTrapListen,MGMTAPI.DLL,NM,1, registers the ability of a manager application to receive SNMP traps.SnmpUtilMemAlloc,SNMPAPI.DLL,NM,1, allocates dynamic memory from the process heap.SnmpUtilMemFree,SNMPAPI.DLL,NM,1, frees the specified memory object.SnmpUtilMemReAlloc,SNMPAPI.DLL,NM,2, changes the size of the specified memory object.SnmpUtilOidAppend,SNMPAPI.DLL,NM,2, appends the source object identifier to the destination object identifier.SnmpUtilOidCmp,SNMPAPI.DLL,NM,2, compares two object identifiers.SnmpUtilOidCpy,SNMPAPI.DLL,NM,2 copies the variable pointed to by theSrcObjId parameter to the DestObjId parameter, allocating anynecessary memory for the destination?s copy.SnmpUtilOidFree,SNMPAPI.DLL,NM,1, frees any allocated data associated with the object identifier.SnmpUtilOidNCmp,SNMPAPI.DLL,NM,3, compares two object identifier variables up to the length specified by the Len parameter.SnmpUtilPrintAsnAny,SNMPAPI.DLL,NM,1, prints the value of the Any parameter to the standard output.SnmpUtilVarBindCpy,SNMPAPI.DLL,NM,2 copies the RFC1157VarBindstructure, and allocates any memory necessary for the destinationstructure.SnmpUtilVarBindFree,SNMPAPI.DLL,NM,1 frees any allocated data associated with an RFC1157VarBind structure.SnmpUtilVarBindListCpy,SNMPAPI.DLL,NM,2 copies the RFC1157VarBindListstructure, and allocates any necessary memory for the destination'scopy.SnmpUtilVarBindListFree,SNMPAPI.DLL,NM,1, frees any allocated data associated with an RFC1157VarBindList structure.socket,WS2_32.DLL,NM,3 creates a socket that is bound to a specific service provider.socket,WSOCK32.DLL,NM,3 creates a socket that is bound to a specific service provider.SplitSymbols,IMAGEHLP.DLL,NM,4, strips symbols from the specified image.SpoolerCopyFileEvent,MSCMS.DLL,NM,3,graphics, GraphicsDrivers, Reference, SpoolerCopyFileEventSQLAllocConnect,ODBC32.DLL,NM,2 ObsoleteSQLAllocEnv,ODBC32.DLL,NM,1 ObsoleteSQLAllocHandle,ODBC32.DLL,NM,3 Obtains an environment, connection, statement, or descriptor handle.SQLAllocHandleStd,ODBC32.DLL,NM,3 Default SQLAllocHandle routineSQLAllocStmt,ODBC32.DLL,NM,2 ObsoleteSQLBindCol,ODBC32.DLL,NM,6 Assigns storage for a result column and specifies the data type.SQLBindParam,ODBC32.DLL,NM,8 ObsoleteSQLBindParameter,ODBC32.DLL,NM,10 Assigns storage for a parameter in an SQL statement.SQLBrowseConnect,ODBC32.DLL,AW,6 Returns successive levels of connection attributes and valid attribute valuesSQLBulkOperations,ODBC32.DLL,NM,2 Performs bulk insertions and bulk bookmark operations, including update, delete, and fetch by bookmark.SQLCancel,ODBC32.DLL,NM,1 Cancels an SQL statement.SQLCloseCursor,ODBC32.DLL,NM,1 Closes a cursor that has been opened on a statement handle.SQLColAttribute,ODBC32.DLL,AW,7, returns descriptor information for a column in a result set. Descriptor information is returned as a character string, a 32-bit descriptor-dependent value, or an integer value.SQLColAttributes,ODBC32.DLL,AW,7 ObsoleteSQLColumnPrivileges,ODBC32.DLL,AW,9 Returns a list of columns and associated privileges for one or more tables.SQLColumns,ODBC32.DLL,AW,9 Returns the list of column names in specified tables.SQLConnect,ODBC32.DLL,AW,7 Connects to a specific driver by data source name, user ID, and password.SQLCopyDesc,ODBC32.DLL,NM,2 copies descriptor information from one descriptor handle to another.SQLDataSources,ODBC32.DLL,AW,8 Returns the list of available data sources.SQLDescribeCol,ODBC32.DLL,AW,9 Describes a column in the result set.SQLDescribeParam,ODBC32.DLL,NM,6 Returns the description for a specific parameter in a statement.SQLDisconnect,ODBC32.DLL,NM,1 Closes the connection.

Page 158: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SQLDriverConnect,ODBC32.DLL,AW,8 Connects to a specific driver by connection string or requests that the Driver Manager and driver display connection dialog boxes for the user.SQLDrivers,ODBC32.DLL,AW,8 Returns the list of installed drivers and their attributes.SQLEndTran,ODBC32.DLL,NM,3 Commits or rolls back a transaction.SQLError,ODBC32.DLL,AW,8 Returns error or status information. SQLExecDirect,ODBC32.DLL,AW,3 Executes a statement.SQLExecute,ODBC32.DLL,NM,1 Executes a prepared statement.SQLExtendedFetch,ODBC32.DLL,NM,5 fetches the specified rowset of data from the result set and returns data for all bound columns.SQLFetch,ODBC32.DLL,NM,1 Returns multiple result rows.SQLFetchScroll,ODBC32.DLL,NM,3 fetches the specified rowset of data from the result set and returns data for all bound columns. SQLForeignKeys,ODBC32.DLL,AW,13 Returns a list of column names that make up foreign keys, if they exist for a specified table.SQLFreeConnect,ODBC32.DLL,NM,1 ObsoleteSQLFreeEnv,ODBC32.DLL,NM,1 ObsoleteSQLFreeHandle,ODBC32.DLL,NM,2 Releases an environment, connection, statement, or descriptor handle. SQLFreeStmt,ODBC32.DLL,NM,2 Ends statement processing, discards pending results, and, optionally, frees all resources associated with the statement handle.SQLGetConnectAttr,ODBC32.DLL,AW,5 Returns the value of a connection attribute.SQLGetConnectOption,ODBC32.DLL,AW,3 ObsoleteSQLGetCursorName,ODBC32.DLL,AW,4 Returns the cursor name associated with a statement handle.SQLGetData,ODBC32.DLL,NM,6 Returns part or all of one column of one row of a result set SQLGetDescField,ODBC32.DLL,AW,6 Returns the value of a single descriptor field.SQLGetDescRec,ODBC32.DLL,AW,11 Returns the values of multiple descriptor fields.SQLGetDiagField,ODBC32.DLL,AW,7 Returns additional diagnostic information SQLGetDiagRec,ODBC32.DLL,AW,8 Returns additional diagnostic information SQLGetEnvAttr,ODBC32.DLL,NM,5 Returns the value of an environment attribute.SQLGetFunctions,ODBC32.DLL,NM,3 Returns supported driver functionsSQLGetInfo,ODBC32.DLL,AW,5 Returns information about a specific driver and data source.SQLGetStmtAttr,ODBC32.DLL,AW,5 Returns the value of a statement attribute.SQLGetStmtOption,ODBC32.DLL,NM,3 ObsoleteSQLGetTypeInfo,ODBC32.DLL,AW,2 Returns information about supported data types.SQLMoreResults,ODBC32.DLL,NM,1 Determines whether there are more result sets available and, if so, initializes processing for the next result set.SQLNativeSql,ODBC32.DLL,AW,6 Returns the text of an SQL statement as translated by the driver.SQLNumParams,ODBC32.DLL,NM,2 Returns the number of parameters in a statement.SQLNumResultCols,ODBC32.DLL,NM,2 Returns the number of columns in the result set.SQLParamData,ODBC32.DLL,NM,2 Used in conjunction with SQLPutData to supply parameter data at execution time.SQLParamOptions,ODBC32.DLL,NM,3 ObsoleteSQLPrepare,ODBC32.DLL,AW,3 Prepares an SQL statement for later execution.SQLPrimaryKeys,ODBC32.DLL,AW,7 Returns the list of column names that make up the primary key for a table.SQLProcedureColumns,ODBC32.DLL,AW,9 Returns the list of input and output parameters, as well as the columns that make up the result set for the specified procedures.SQLProcedures,ODBC32.DLL,AW,7 Returns the list of procedure names stored in a specific data source.SQLPutData,ODBC32.DLL,NM,3 Sends part or all of a data value for a parameter.SQLRowCount,ODBC32.DLL,NM,2 Returns the number of rows affected by an insert, update, or delete request.SQLSetConnectAttr,ODBC32.DLL,AW,4 Sets a connection attribute.SQLSetConnectOption,ODBC32.DLL,AW,3 ObsoleteSQLSetCursorName,ODBC32.DLL,AW,3 Specifies a cursor name.SQLSetDescField,ODBC32.DLL,AW,5 sets the value of a single field of a descriptor record.SQLSetEnvAttr,ODBC32.DLL,NM,4 Sets an environment attribute.SQLSetParam,ODBC32.DLL,NM,8 ObsoleteSQLSetPos,ODBC32.DLL,NM,4 Positions a cursor within a fetched block of data, and allows an application to refresh data in the rowset, or update or delete data in the result set.SQLSetScrollOptions,ODBC32.DLL,NM,4 Sets options that control cursor behavior.SQLSetStmtAttr,ODBC32.DLL,AW,4 Sets a statement attribute.SQLSetStmtOption,ODBC32.DLL,NM,3 ObsoleteSQLSpecialColumns,ODBC32.DLL,AW,10 Returns information about the optimal set of columns that uniquely identifies a row in a specified table, or the columns that are automatically updated when any value in the row is updated by a transaction.SQLStatistics,ODBC32.DLL,AW,9 Returns statistics about a single table and the list of indexes associated with the table.SQLTablePrivileges,ODBC32.DLL,AW,7 Returns a list of tables and the privileges associated with each table.SQLTables,ODBC32.DLL,AW,9 Returns the list of table names stored in a specific data source.SQLTransact,ODBC32.DLL,NM,3 ObsoleteStackWalk,IMAGEHLP.DLL,NM,9,The StackWalk64 function provides a portable method for obtaining a stack trace.StartCAP,CAP.DLL,NM,0,Clear profiling data and start profiling.StartDoc,GDI32.DLL,AW,2, starts a print job.StartDocPrinter,WINMM.DLL,AW,3, informs the print spooler that a document is to be spooled for printing.StartPage,GDI32.DLL,NM,1, prepares the printer driver to accept data.StartPagePrinter,WINMM.DLL,NM,1, informs the spooler that a page is about to be printed on the specified printer.StartService,ADVAPI32.DLL,AW,3, starts a service.StartServiceCtrlDispatcher,ADVAPI32.DLL,AW,1 StgCreateDocfile,OLE32.DLL,NM,4, creates a new compound file storage object using the COM-provided compound file implementation for the IStorage interface.StgCreateDocfileOnILockBytes,OLE32.DLL,NM,4,Creates and opens a new compound file storage object on top of a byte-array object provided by the caller.StgCreatePropSetStg,IPROP.DLL,NM,3,Creates a property set storage object from a specified storage object.StgCreatePropStg,IPROP.DLL,NM,6,Creates and opens a property set in a specified storage or stream object.StgGetIFillLockBytesOnFile,OLE32.DLL,NM,2,Opens a wrapper object on a temporary file.StgGetIFillLockBytesOnILockBytes,OLE32.DLL,NM,2,Creates a new wrapper object on a byte array object provided by the caller.StgIsStorageFile,OLE32.DLL,NM,1, indicates whether a particular disk file contains a storage object.StgIsStorageILockBytes,OLE32.DLL,NM,1, indicates whether the specified byte array contains a storage object.StgOpenAsyncDocfileOnIFillLockBytes,OLE32.DLL,NM,4,Opens an existing root asynchronous storage object on a byte-array wrapper object provided by the caller.StgOpenLayoutDocfile,DFLAYOUT.DLL,NM,4,Opens a compound file on an ILockBytes implementation that is capable of monitoring sector data.StgOpenPropStg,IPROP.DLL,NM,5,Opens a specified property set in a specified storage or stream object.StgOpenStorage,OLE32.DLL,NM,6, opens an existing root storage object in the file system.

StgOpenStorageOnILockBytes,OLE32.DLL,NM,6, opens an existing storage object that does not reside in a disk file, but instead has an underlying byte array provided by the caller.StgSetTimes,OLE32.DLL,NM,4, sets the creation, access, and modification times of the indicated file, if supported by the underlying file system.StopCAP,CAP.DLL,NM,0,Stop profiling.StretchBlt,GDI32.DLL,NM,11 copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary.StretchDIBits,GDI32.DLL,NM,13 copies the color data for a rectangle of pixels in a device-independent bitmap (DIB) to the specified destination rectangle. StringFromCLSID,OLE32.DLL,NM,2,Converts a CLSID into a string of printable characters. Different CLSIDs always convert to different strings.StringFromGUID2,OLE32.DLL,NM,3,Converts a globally unique identifier (GUID) into a string of printable characters.StringFromIID,OLE32.DLL,NM,2, Interface identifier to be converted.StrokeAndFillPath,GDI32.DLL,NM,1 closes any open figures in a path,strokes the outline of the path by using the current pen, and fillsits interior by using the current brush.StrokePath,GDI32.DLL,NM,1 renders the specified path by using the current pen. SubmitNtmsOperatorRequest,NTMSAPI.DLL,AW,6, submits an RSM operator request.SubtractRect,USER32.DLL,NM,3, obtains the coordinates of a rectangle determined by subtracting one rectangle from another.SuspendThread,KERNEL32.DLL,NM,1, suspends the specified thread.SwapBuffers,GDI32.DLL,NM,1 exchanges the front and back buffers ifthe current pixel format for the window referenced by the specifieddevice context includes a back buffer.SwapNtmsMedia,NTMSAPI.DLL,NM,3, swaps the sides associated with the two specified LMIDs. The specified LMIDs must be in the same media pool.SwitchDesktop,USER32.DLL,NM,1, makes a desktop visible and activates it.SwitchToFiber,KERNEL32.DLL,NM,1, schedules a fiber.SwitchToThread,KERNEL32.DLL,NM,0 causes the calling thread to yieldexecution to another thread that is ready to run on the currentprocessor.SymCleanup,IMAGEHLP.DLL,NM,1, deallocates all resources associated with the process handle.SymEnumerateModules,IMAGEHLP.DLL,NM,3,The SymEnumerateModules64 function enumerates all modules that have been loaded for the process by the SymLoadModule64 or SymLoadModuleEx function.SymEnumerateSymbols,IMAGEHLP.DLL,NM,4,The SymEnumerateSymbols64 function enumerates all the symbols for a specified module.SymFunctionTableAccess,IMAGEHLP.DLL,NM,2,The SymFunctionTableAccess64 function retrieves the function table entry for the specified address.SymGetModuleBase,IMAGEHLP.DLL,NM,2,The SymGetModuleBase64 function retrieves the base address of the module that contains the specified address.SymGetModuleInfo,IMAGEHLP.DLL,NM,3,The SymGetModuleInfo64 function retrieves the module information of the specified module.SymGetOptions,IMAGEHLP.DLL,NM,0, retrieves the current options mask.SymGetSearchPath,IMAGEHLP.DLL,NM,3, retrieves the symbol search path for the specified process.SymGetSymFromAddr,IMAGEHLP.DLL,NM,4,The SymGetSymFromAddr64 function locates the symbol for the specified address.SymGetSymFromName,IMAGEHLP.DLL,NM,3,The SymGetSymFromName64 function locates a symbol for the specified name.SymGetSymNext,IMAGEHLP.DLL,NM,2,The SymGetSymNext64 function retrieves the symbol information of the next symbol.SymGetSymPrev,IMAGEHLP.DLL,NM,2,The SymGetSymPrev64 function retrieves the symbol information of the previous symbol.SymInitialize,IMAGEHLP.DLL,NM,3, initializes the symbol handler for a process.SymLoadModule,IMAGEHLP.DLL,NM,6,The SymLoadModule64 function loads the symbol table.SymRegisterCallback,IMAGEHLP.DLL,NM,4,The SymRegisterCallback64 function lets an application register a callback function for use by the symbol handler.SymSetOptions,IMAGEHLP.DLL,NM,1, sets the options mask.SymSetSearchPath,IMAGEHLP.DLL,NM,2, sets the search path for the specified process.SysAllocString,OLEAUT32.DLL,NM,1,LenAllocates a new string, copies cch characters from the passed string into it, and then appends a null character.SysAllocStringByteLen,OLEAUT32.DLL,NM,2,Takes an ANSI string as input, and returns a BSTR that contains an ANSI string. Does not perform any ANSI-to-Unicode translation.SysAllocStringLen,OLEAUT32.DLL,NM,2,Allocates a new string, copies cch characters from the passed string into it, and then appends a null character.SysFreeString,OLEAUT32.DLL,NM,1,Deallocates a string allocated previously by SysAllocString, SysAllocStringByteLen, SysReAllocString, SysAllocStringLen, orSysReAllocString,OLEAUT32.DLL,NM,2,Len This function creates a new BSTR that contains a specified number of characters from an old BSTR, and frees the old BSTR.SysReAllocStringLen,OLEAUT32.DLL,NM,3, This function creates a new BSTR that contains a specified number of characters from an old BSTR, and frees the old BSTR.SysStringByteLen,OLEAUT32.DLL,NM,1,Returns the length (in bytes) of a BSTR. Valid for 32-bit systems only.SysStringLen,OLEAUT32.DLL,NM,1,Returns the length of a BSTR.SystemParametersInfo,USER32.DLL,AW,4, queries or sets systemwide parameters.SystemTimeToFileTime,KERNEL32.DLL,NM,2, converts a system time to a file time.SystemTimeToTzSpecificLocalTime,KERNEL32.DLL,NM,3 converts a Coordinated Universal Time (UTC) to a specified time zone?s corresponding local time.SystemTimeToVariantTime,OLEAUT32.DLL,NM,2,Converts a system time to a variant representation.SzFindCh,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case and diacritical differences.SzFindLastCh,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case and diacritical differences.SzFindSz,MAPI32.DLL,NM,2, searches for an exact match only; it is sensitive to case and diacritical differences.TabbedTextOut,USER32.DLL,AW,8 writes a character string at a specifiedlocation, expanding tabs to the values specified in an array oftab-stop positions.tapiGetLocationInfo,TAPI32.DLL,AW,2 returns the country code and city(area) code that the user has set in the current locationparameters in the Telephony Control Panel.tapiRequestDrop,TAPI32.DLL,NM,2 is nonfunctional in Win32 -basedapplications and obsolete for all classes of Windows-basedapplications.tapiRequestMakeCall,TAPI32.DLL,AW,4, requests the establishment of a voice call.tapiRequestMediaCall,TAPI32.DLL,AW,10 is nonfunctional in Win32-basedapplications and obsolete for all classes of Windows-basedapplications.TerminateProcess,KERNEL32.DLL,NM,2, terminates the specified process and all of its threads.TerminateThread,KERNEL32.DLL,NM,2, terminates a thread.TextOut,GDI32.DLL,AW,5 writes a character string at the specified location, using the currently selected font. Thread32First,TOOLHELP.DLL,NM,2, retrieves information about the first thread of any process encountered in a system snapshot.Thread32Next,TOOLHELP.DLL,NM,2, retrieves information about the next thread of any process encountered in the system memory snapshot.TileWindows,USER32.DLL,NM,5, tiles the specified windows, or the child windows of the specified parent window.

Page 159: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

timeBeginPeriod,WINMM.DLL,NM,1, sets the minimum timer resolution for an application or device driver.timeEndPeriod,WINMM.DLL,NM,1, clears a previously set minimum timer resolution.timeGetDevCaps,WINMM.DLL,NM,2, queries the timer device to determine its resolution.timeGetSystemTime,WINMM.DLL,NM,2, retrieves the system time, in milliseconds.timeGetTime,WINMM.DLL,NM,0, retrieves the system time, in milliseconds.timeKillEvent,WINMM.DLL,NM,1, cancels a specified timer event.timeSetEvent,WINMM.DLL,NM,5, starts a specified timer event.TlsAlloc,KERNEL32.DLL,NM,0, allocates a thread local storage (TLS) index.TlsFree,KERNEL32.DLL,NM,1, releases a thread local storage (TLS) index, making it available for reuse.TlsGetValue,KERNEL32.DLL,NM,1, retrieves the value in the calling thread? s thread local storage (TLS) slot for a specified TLS index.TlsSetValue,KERNEL32.DLL,NM,2, stores a value in the calling thread?s thread local storage (TLS) slot for a specified TLS index.ToAscii,USER32.DLL,NM,5 translates the specified virtual-key code and keyboard state to the corresponding Windows character or characters. ToAsciiEx,USER32.DLL,NM,6 translates the specified virtual-key codeand keyboard state to the corresponding Windows character orcharacters.Toolhelp32ReadProcessMemory,TOOLHELP.DLL,NM,5, copies memory allocated to another process into an application-supplied buffer.ToUnicode,USER32.DLL,NM,6 translates the specified virtual-key codeand keyboard state to the corresponding Unicode character orcharacters.ToUnicodeEx,USER32.DLL,NM,7 translates the specified virtual-key codeand keyboard state to the corresponding Unicode character orcharacters.TrackMouseEvent,COMCTL32.DLL,NM,1 posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.TrackMouseEvent,USER32.DLL,NM,1 posts messages when the mouse pointer leaves a window or hovers over a window for a specified amount of time.TrackPopupMenu,USER32.DLL,NM,7, displays a shortcut menu at the specified location and tracks the selection of items on the menu.TrackPopupMenuEx,USER32.DLL,NM,6 displays a shortcut menu at the specified location and tracks the selection of items on the menu. TransactNamedPipe,KERNEL32.DLL,NM,7 combines into a single networkoperation the functions that write a message to and read a messagefrom the specified named pipe.TranslateAccelerator,USER32.DLL,AW,3 function processes accelerator keys for menu commands. TranslateBitmapBits,MSCMS.DLL,NM,11, translates the colors of a bitmap having a defined format so as to produce another bitmap in a requested format.TranslateColors,MSCMS.DLL,NM,6, translates an array of colors from the source color space to the destination color space as defined by a colorTranslateMDISysAccel,USER32.DLL,NM,2 processes accelerator keystrokes for window menu commands of the multiple document interface (MDI) child windows associated with the specified MDI client window.TranslateMessage,USER32.DLL,NM,1, translates virtual-key messages into character messages.TranslateName,SECUR32.DLL,AW,5, converts a directory service object name from one format to another.TranslateURL,URL.DLL,AW,3,Applies common translations to a given URL string, creating a new URL string.TransmitCommChar,KERNEL32.DLL,NM,2 transmits a specified character aheadof any pending data in the output buffer of the specifiedcommunications device.TryEnterCriticalSection,KERNEL32.DLL,NM,1 attempts to enter a critical section without blocking.UFromSz,MAPI32.DLL,NM,1, stops converting when it reaches the first character in the string that is not a decimal digit.UlAddRef,MAPI32.DLL,NM,1, provides an alternative way to invoke the OLE method IUnknown::AddRef.UlFromSzHex,MAPI32.DLL,NM,1, converts a null-terminated string of hexadecimal digits into an unsigned long integer.UlPropSize,MAPI32.DLL,NM,1, obtains the size of a single property value.UlRelease,MAPI32.DLL,NM,1, provides an alternative way to invoke the OLE method IUnknown::Release.UnDecorateSymbolName,IMAGEHLP.DLL,NM,4, undecorates decorated C++ symbol names.UnhandledExceptionFilter,KERNEL32.DLL,NM,1, passes unhandled exceptions to the debugger, if the process is being debugged.UnhookWindowsHook,USER32.DLL,NM,2, is obsolete, but is provided for compatibility with 16-bit versions of Windows.UnhookWindowsHookEx,USER32.DLL,NM,1, removes a hook procedure installed in a hook chain by the SetWindowsHookEx function.UninitializeFlatSB,COMCTL32.DLL,NM,1,Uninitializes flat scroll bars for a particular window.UninstallColorProfile,MSCMS.DLL,AW,3,UninstallColorProfile removes a specified color profile from a specified computer. Associated files are optionally deleted from the system.UnionRect,USER32.DLL,NM,3, creates the union of two rectangles.UnloadKeyboardLayout,USER32.DLL,NM,1, removes a keyboard layout.UnloadPerfCounterTextStrings,LOADPERF.DLL,AW,2,unloads performance objects and counters from the system that are identified by the specified application name.UnloadUserProfile,USERENV.DLL,NM,2, unloads a user's profile that was loaded by the LoadUserProfile function. The caller must have administrative privileges on the computer. For more information, see the Remarks section of the LoadUserProfile function.UnlockFile,KERNEL32.DLL,NM,5, unlocks a file region locked by LockFile.UnlockFileEx,KERNEL32.DLL,NM,5, unlocks a previously locked byte range in an open file.UnlockServiceDatabase,ADVAPI32.DLL,NM,1, unlocks a service control manager database by releasing the specified lock.UnlockUrlCacheEntryFile,WININET.DLL,AW,2,Unlocks the cache entry that was locked while the file was retrieved for use from the cache.UnlockUrlCacheEntryStream,WININET.DLL,NM,2,Closes the stream that has been retrieved using the RetrieveUrlCacheEntryStream function.UnMapAndLoad,IMAGEHLP.DLL,NM,1, is used to deallocate all resources that are allocated by a previous call to the MapAndLoad function.UnmapDebugInformation,IMAGEHLP.DLL,NM,1, deallocates the memory and resources allocated by a call to the MapDebugInformation function.UnmapViewOfFile,KERNEL32.DLL,NM,1, unmaps a mapped view of a file from the calling process?s address space.UnpackDDElParam,USER32.DLL,NM,4, unpacks a DDE lParam value received from a posted DDE message. UnrealizeObject,GDI32.DLL,NM,1, resets a logical palette.UnregisterClass,USER32.DLL,AW,2, removes a window class, freeing the memory required for the class.UnregisterCMM,MSCMS.DLL,AW,2, dissociates a specified ID value from a given color management module dynamic-link library (CMM DLL).UnregisterGPNotification,USERENV.DLL,NM,1, unregisters the specified policy-notification handle from receiving policy change notifications.UnregisterHotKey,USER32.DLL,NM,2, frees a hot key previously registered by the calling thread.UnsealMessage,SECUR32.DLL,NM,4, is already documented under another name. For more information, see SpUnsealMessage.

UpdateColors,GDI32.DLL,NM,1 updates the client area of the specifieddevice context by remapping the current colors in the client areato the currently realized logical palette.UpdateDCOMSettings,OLE32.DLL,NM,0, This function updates the DCOM configuration after modifying the registry settings. void UpdateDCOMSettings(void); Parameters None. Return Values None. Remarks None.UpdateDebugInfoFile,IMAGEHLP.DLL,NM,4, uses the specified information to update the corresponding fields in the symbol file.UpdateDebugInfoFileEx,IMAGEHLP.DLL,NM,5, uses the specified information to update the corresponding fields in the symbol file.UpdateNtmsOmidInfo,NTMSAPI.DLL,NM,5, updates the RSM database with label information immediately after writing to the newly allocated medium.UpdateResource,KERNEL32.DLL,AW,6, adds, deletes, or replaces a resource in an executable file.UpdateWindow,USER32.DLL,NM,1 updates the client area of the specified window by sending a WM_PAINT message to the window if the window?s update region is not empty. URLAssociationDialog,URL.DLL,AW,6,Invokes the unregistered URL protocol dialog box. This dialog box allows the user to select an application to associate with a previously unknown protocolURLDownload,URLMON.DLL,AW,5,ToFile Downloads bits from the Internet and saves them to a file.URLDownloadToCacheFile,URLMON.DLL,AW,6, Downloads data into the Internet cache and returns the file name of the cache location for retrieving the bits.URLDownloadToFile,URLMON.DLL,AW,5, Downloads bits from the Internet and saves them to a file.UrlMkSetSessionOption,URLMON.DLL,NM,4, Sets options for the current Internet session.URLOpenBlockingStream,URLMON.DLL,AW,5, Creates a blocking type stream object from a URL and downloads the data from the Internet. When the data is downloaded, the client application or control can read it using the IStream::Read method.URLOpenPullStream,URLMON.DLL,AW,4, Creates a pull type stream object from a URL.URLOpenStream,URLMON.DLL,AW,4, Creates a push type stream object from a URL.UuidCompare,RPCRT4.DLL,NM,3, compares two UUIDs.UuidCreate,RPCRT4.DLL,NM,1, creates a new UUID.UuidCreateNil,RPCRT4.DLL,NM,1, creates a nil-valued UUID.UuidEqual,RPCRT4.DLL,NM,3, determines if two UUIDs are equal.UuidFromString,RPCRT4.DLL,AW,2, converts a string to a UUID.UuidHash,RPCRT4.DLL,NM,2 creates a hash value for a UUID.UuidIsNil,RPCRT4.DLL,NM,2 determines if a UUID is a nil-valued UUID.UuidToString,RPCRT4.DLL,AW,2, converts a UUID to a string.ValidateRect,USER32.DLL,NM,2 validates the client area within a rectangle by removing the rectangle from the update region of the specified window.ValidateRgn,USER32.DLL,NM,2 validates the client area within a region by removing the region from the current update region of the specified window. VarBoolFromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to bool.VarBoolFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to bool.VarBoolFromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to bool.VarBoolFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to BOOL from IDispatch.VarBoolFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to bool.VarBoolFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to bool.VarBoolFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to bool.VarBoolFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to bool.VarBoolFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to bool.VarBoolFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to bool.VarBoolFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to bool.VarBoolFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to bool.VarBoolFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to bool.VarBstrFromBool,OLEAUT32.DLL,NM,4,Converts a variant of type bool to BSTR.VarBstrFromCy,OLEAUT32.DLL,NM,5,Converts a variant of type currency to BSTR.VarBstrFromDate,OLEAUT32.DLL,NM,5,Converts a variant of type date to BSTR.VarBstrFromDec,OLEAUT32.DLL,NM,4, Converts a variant of type decimal to BSTR.VarBstrFromDisp,OLEAUT32.DLL,NM,4,Converts a variant of type IDispatch to BSTR.VarBstrFromI1,OLEAUT32.DLL,NM,4,Converts a variant of type char to BSTR.VarBstrFromI2,OLEAUT32.DLL,NM,4,This function converts variant data types to BSTR from short.VarBstrFromI4,OLEAUT32.DLL,NM,4,Converts a variant of type long to BSTR.VarBstrFromR4,OLEAUT32.DLL,NM,4,Converts a variant of type float to BSTR.VarBstrFromR8,OLEAUT32.DLL,NM,5,Converts a variant of type double to BSTR.VarBstrFromUI1,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned char to BSTR.VarBstrFromUI2,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned short to BSTR.VarBstrFromUI4,OLEAUT32.DLL,NM,4,Converts a variant of type unsigned long to BSTR.VarCyFromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to curency.VarCyFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to curency.VarCyFromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to curency.VarCyFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to CURRENCY from IDispatch.VarCyFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to currency.VarCyFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to curency.VarCyFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to curency.VarCyFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to curency.VarCyFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to curency.VarCyFromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to from OLECHAR. VarCyFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to curency.VarCyFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to currency.VarCyFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to currency.VarDateFromBool,OLEAUT32.DLL,NM,2,converts variant data types to DATE from BOOL.VarDateFromCy,OLEAUT32.DLL,NM,3,converts variant data types to DATE from currencyVarDateFromDec,OLEAUT32.DLL,NM,2, converts variant data types to DATE from decimalVarDateFromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch to date.VarDateFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to date.VarDateFromI2,OLEAUT32.DLL,NM,2,converts variant data types to DATE from shortVarDateFromI4,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE from long.VarDateFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to date.VarDateFromR8,OLEAUT32.DLL,NM,3,This function converts variant data types to DATE from double.VarDateFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to date.VarDateFromUdate,OLEAUT32.DLL,NM,3,Converts a time and date converted from MS-DOS format to variant format.VarDateFromUI1,OLEAUT32.DLL,NM,2,converts variant data types to DATE from unsigned char.VarDateFromUI2,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE from unsigned short.VarDateFromUI4,OLEAUT32.DLL,NM,2,This function converts variant data types to DATE from unsigned long. VarDecFromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to decimal.VarDecFromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to decimal.VarDecFromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to decimal.

Page 160: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

VarDecFromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to DECIMAL from IDispatch.VarDecFromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to decimal.VarDecFromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to decimal.VarDecFromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to decimal.VarDecFromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to decimal.VarDecFromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to decimal.VarDecFromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to decimal.VarDecFromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to decimal.VarDecFromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to decimal.VarDecFromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to decimal.VarI1FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type BOOL to char.VarI1FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to char.VarI1FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to char.VarI1FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to char.VarI1FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to char from IDispatch.VarI1FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to char.VarI1FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to char.VarI1FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to char.VarI1FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to char.VarI1FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to char.VarI1FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to char.VarI1FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to char.VarI1FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to char.VarI2FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to short.VarI2FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to short.VarI2FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to short.VarI2FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to short.VarI2FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to short from IDispatch.VarI2FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to short.VarI2FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to short.VarI2FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to short.VarI2FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to short.VarI2FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to short.VarI2FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to short.VarI2FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to short.VarI2FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to short.VarI4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to long.VarI4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to long.VarI4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to long.VarI4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to long.VarI4FromDisp,OLEAUT32.DLL,NM,3,This function converts variant data types to long from IDispatch.VarI4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to long.VarI4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to long.VarI4FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to long.VarI4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to long.VarI4FromStr,OLEAUT32.DLL,NM,4, Converts a variant of type string to long.VarI4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to long.VarI4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to long.VarI4FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to long.VariantChangeType,OLEAUT32.DLL,NM,4, This function converts a variant from one type to anotherVariantChangeTypeEx,OLEAUT32.DLL,NM,5,This function converts a variant from one type to anotherVariantClear,OLEAUT32.DLL,NM,1,Clears a variant.VariantCopy,OLEAUT32.DLL,NM,2, Frees the destination variant and makes a copy of the source variant.VariantCopyInd,OLEAUT32.DLL,NM,2,Frees the destination variant and makes a copy of the source VARIANTARG, performing the necessary indirection if the source is specified to be VT_BYREF.VariantInit,OLEAUT32.DLL,NM,1,Initializes a variant.VariantTimeToDosDateTime,OLEAUT32.DLL,NM,4,Converts the variant representation of a date and time to MS-DOS date and time values.VariantTimeToSystemTime,OLEAUT32.DLL,NM,3,Converts the variant representation of time to system time values.VarNumFromParseNum,OLEAUT32.DLL,NM,4,Once the number is parsed, the caller can call VarNumFromParseNum to convert the parse results to a number.VarParseNumFromStr,OLEAUT32.DLL,NM,5,Parses a string, and creates a type-independent description of the number it represents.VarR4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to float.VarR4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to float.VarR4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to float.VarR4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to float.VarR4FromDisp,OLEAUT32.DLL,NM,3, This function converts variant data types to float from IDispatch.VarR4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to float.VarR4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to float.VarR4FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to float.VarR4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to float.VarR4FromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to float from OLECHAR.VarR4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to float.VarR4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to float.VarR4FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to float.VarR8FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to double.VarR8FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to double.VarR8FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to double.VarR8FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to double.VarR8FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch to double.VarR8FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to double.VarR8FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to double.VarR8FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to double.VarR8FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to double.VarR8FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type OLECHAR* to double.VarR8FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to double.VarR8FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to double.VarR8FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to double.VarUdateFromDate,OLEAUT32.DLL,NM,4,Converts a time and date converted from variant format to MS-DOS format.VarUI1FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type BOOL to an unsigned char type.VarUI1FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to an unsigned char type.VarUI1FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to an unsigned char type.

VarUI1FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to an unsigned char type.VarUI1FromDisp,OLEAUT32.DLL,NM,3, converts variant data types to BYTE from VarUI1FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned char.VarUI1FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to an unsigned char type.VarUI1FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to an unsigned char type.VarUI1FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to an unsigned char type.VarUI1FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to an unsigned char type.VarUI1FromStr,OLEAUT32.DLL,NM,4, converts variant data types to BYTE from BSTR.VarUI1FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to unsigned char.VarUI1FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to unsigned char.VarUI2FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to unsigned short.VarUI2FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to unsigned short.VarUI2FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to unsigned short.VarUI2FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to unsigned short.VarUI2FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch* to unsigned short.VarUI2FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned short.VarUI2FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to unsigned short.VarUI2FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to unsigned short.VarUI2FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to unsigned short.VarUI2FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to unsigned short.VarUI2FromStr,OLEAUT32.DLL,NM,4,Converts a variant of type string to unsigned short. VarUI2FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to unsigned short.VarUI2FromUI4,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned long to unsigned short.VarUI4FromBool,OLEAUT32.DLL,NM,2,Converts a variant of type bool to unsigned long.VarUI4FromCy,OLEAUT32.DLL,NM,3,Converts a variant of type currency to unsigned long.VarUI4FromDate,OLEAUT32.DLL,NM,3,Converts a variant of type date to unsigned long.VarUI4FromDec,OLEAUT32.DLL,NM,2,Converts a variant of type decimal to unsigned long.VarUI4FromDisp,OLEAUT32.DLL,NM,3,Converts a variant of type IDispatch* to unsigned long.VarUI4FromI1,OLEAUT32.DLL,NM,2,Converts a variant of type char to unsigned long.VarUI4FromI2,OLEAUT32.DLL,NM,2,Converts a variant of type short to unsigned long.VarUI4FromI4,OLEAUT32.DLL,NM,2,Converts a variant of type long to unsigned long.VarUI4FromR4,OLEAUT32.DLL,NM,2,Converts a variant of type float to unsigned long.VarUI4FromR8,OLEAUT32.DLL,NM,3,Converts a variant of type double to unsigned long.VarUI4FromStr,OLEAUT32.DLL,NM,4,This function converts variant data types to unsigned long from string.VarUI4FromUI1,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned char to unsigned long.VarUI4FromUI2,OLEAUT32.DLL,NM,2,Converts a variant of type unsigned short to unsigned long.VectorFromBstr,OLEAUT32.DLL,NM,2,Returns a vector, assigning each character in the BSTR to an element of the vector.VerFindFile,VERSION.DLL,AW,8, determines where to install a file based on whether it locates another version of the file in the system.VerifySignature,SECUR32.DLL,NM,4, Verifies the signature.VerInstallFile,VERSION.DLL,AW,8 function attempts to install the specified file based on information returned from the VerFindFile function.VerLanguageName,KERNEL32.DLL,AW,3 retrieves a description string for the language associated with a specified binary Microsoft language identifier. VerQueryValue,VERSION.DLL,AW,4, returns selected version information from the specified version-information resource.VirtualAlloc,KERNEL32.DLL,NM,4, reserves or commits a region of pages in the virtual address space of the calling process.VirtualAllocEx,KERNEL32.DLL,NM,5, reserves, commits, or both, a region of memory within the virtual address space of a specified process.VirtualFree,KERNEL32.DLL,NM,3, releases or decommits (or both) a region of pages within the virtual address space of the calling process.VirtualFreeEx,KERNEL32.DLL,NM,4, releases, decommits, or both, a region of memory within the virtual address space of a specified process.VirtualLock,KERNEL32.DLL,NM,2 locks the specified region of the process?s virtual address space into memory, ensuring that subsequentaccess to the region will not incur a page fault.VirtualProtect,KERNEL32.DLL,NM,4 changes the access protection on aregion of committed pages in the virtual address space of thecalling process.VirtualProtectEx,KERNEL32.DLL,NM,5 changes the access protection on a region of committed pages in the virtual address space of a specified process.VirtualQuery,KERNEL32.DLL,NM,3, provides information about a range of pages in the virtual address space of the calling process.VirtualQueryEx,KERNEL32.DLL,NM,4, provides information about a range of pages within the virtual address space of a specified process.VirtualUnlock,KERNEL32.DLL,NM,2 unlocks a specified range of pages inthe virtual address space of a process, enabling the system to swapthe pages out to the paging file if necessary.VkKeyScan,USER32.DLL,AW,1 translates a character to the corresponding virtual-key code and shift state for the current keyboard. VkKeyScanEx,USER32.DLL,AW,2, translates a character to the corresponding virtual-key code and shift state.WaitCommEvent,KERNEL32.DLL,NM,3, waits for an event to occur for a specified communications device.WaitForDebugEvent,KERNEL32.DLL,NM,2, waits for a debugging event to occur in a process being debugged.WaitForInputIdle,USER32.DLL,NM,2 waits until the given process is waiting for user input with no input pending, or until the time-out interval has elapsed. WaitForMultipleObjects,KERNEL32.DLL,NM,4 function returns when any one or all of the specified objects are in the signaled state or the time-out interval elapses.WaitForMultipleObjectsEx,KERNEL32.DLL,NM,5 function returns when any one or all of the specified objects are in the signaled state or the time-out interval elapses or an I/O completion routine or asynchronous procedure call (APC) is queued to the thread.WaitForNtmsNotification,NTMSAPI.DLL,NM,3, waits for the next object change notification.WaitForNtmsOperatorRequest,NTMSAPI.DLL,NM,3, waits for the specified RSM operator request.WaitForSingleObject,KERNEL32.DLL,NM,2 returns when the specified object is in the signaled state or the time-out interval elapses.WaitForSingleObjectEx,KERNEL32.DLL,NM,3, returns when The specified object is in the signaled state. or The time-out interval elapses.WaitMessage,USER32.DLL,NM,0, yields control to other threads when a thread has no other messages in its message queue.WaitNamedPipe,KERNEL32.DLL,AW,2 waits until either a time-out interval elapses or an instance of the specified named pipe is available to be connected to waveInAddBuffer,WINMM.DLL,NM,3, sends an input buffer to the given waveform-audio input device.waveInClose,WINMM.DLL,NM,1, closes the given waveform-audio input device.waveInGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given waveform-audio input device.

Page 161: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

waveInGetErrorText,WINMM.DLL,AW,3, retrieves a textual description of the error identified by the given error number.waveInGetID,WINMM.DLL,NM,2, gets the device identifier for the given waveform-audio input device.waveInGetNumDevs,WINMM.DLL,NM,0 returns the number of waveform-audio input devices present in the system.waveInGetPosition,WINMM.DLL,NM,3, retrieves the current input position of the given waveform-audio input device.waveInMessage,WINMM.DLL,NM,4 sends messages to the waveform-audio, Waveform Functionsinput device drivers.waveInOpen,WINMM.DLL,NM,6 opens the given waveformfor recording.waveInPrepareHeader,WINMM.DLL,NM,3, prepares a buffer for waveform- audio input.waveInReset,WINMM.DLL,NM,1 stops input on the given waveform-audio input device and resets the current position to zero.waveInStart,WINMM.DLL,NM,1, starts input on the given waveform-audio input device.waveInStop,WINMM.DLL,NM,1, stops waveform-audio input.waveInUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by the waveInPrepareHeader function.waveOutBreakLoop,WINMM.DLL,NM,1 breaks a loop on the given waveform-audio output device and allows playback to continue with the nextblock in the driver list.waveOutClose,WINMM.DLL,NM,1 closes the given waveform-audio output device.waveOutGetDevCaps,WINMM.DLL,AW,3, retrieves the capabilities of a given waveform-audio output device.waveOutGetErrorText,WINMM.DLL,AW,3, retrieves a textual description of the error identified by the given error number.waveOutGetID,WINMM.DLL,NM,2, retrieves the device identifier for the given waveform-audio output device.waveOutGetNumDevs,WINMM.DLL,NM,0, retrieves the number of waveform- audio output devices present in the system.waveOutGetPitch,WINMM.DLL,NM,2 retrieves the current pitch setting for the specified waveform-audio output device.waveOutGetPlaybackRate,WINMM.DLL,NM,2, retrieves the current playback rate for the specified waveform-audio output device.waveOutGetPosition,WINMM.DLL,NM,3 retrieves the current playback,position of the given waveform-audio output device.waveOutGetVolume,WINMM.DLL,NM,2, retrieves the current volume level of the specified waveform-audio output device.waveOutMessage,WINMM.DLL,NM,4, sends messages to the waveform-audio output device drivers.waveOutOpen,WINMM.DLL,NM,6, opens the given waveform-audio output device for playback.waveOutPause,WINMM.DLL,NM,1, pauses playback on the given waveform- audio output device.waveOutPrepareHeader,WINMM.DLL,NM,3 prepares a waveform-audio data block for playback.waveOutReset,WINMM.DLL,NM,1, stops playback on the given waveform- audio output device and resets the current position to zero.waveOutRestart,WINMM.DLL,NM,1, resumes playback on a paused waveform- audio output device.waveOutSetPitch,WINMM.DLL,NM,2, sets the pitch for the specified waveform-audio output device.waveOutSetPlaybackRate,WINMM.DLL,NM,2, sets the playback rate for the specified waveform-audio output device.waveOutSetVolume,WINMM.DLL,NM,2, sets the volume level of the specified waveform-audio output device.waveOutUnprepareHeader,WINMM.DLL,NM,3, cleans up the preparation performed by the waveOutPrepareHeader function.waveOutWrite,WINMM.DLL,NM,3, sends a data block to the given waveform- audio output device.wglCopyContext,OPENGL.DLL,NM,3, copies selected groups of rendering states from one OpenGL rendering context to another. wglCopyContext,OPENGL32.DLL,NM,3, copies selected groups of rendering states from one OpenGL rendering context to another. wglCreateContext,OPENGL.DLL,NM,1 creates a new OpenGL renderingcontext, which is suitable for drawing on the device referenced byhdc.wglCreateContext,OPENGL32.DLL,NM,1 creates a new OpenGL renderingcontext, which is suitable for drawing on the device referenced byhdc.wglCreateLayerContext,OPENGL.DLL,NM,2, creates a new OpenGL rendering context for drawing to a specified layer plane on a device context.wglCreateLayerContext,OPENGL32.DLL,NM,2, creates a new OpenGL rendering context for drawing to a specified layer plane on a device context.wglDeleteContext,OPENGL.DLL,NM,1, deletes a specified OpenGL rendering context.wglDeleteContext,OPENGL32.DLL,NM,1, deletes a specified OpenGL rendering context.wglDescribeLayerPlane,OPENGL.DLL,NM,5, obtains information about the layer planes of a given pixel format.wglDescribeLayerPlane,OPENGL32.DLL,NM,5, obtains information about the layer planes of a given pixel format.wglGetCurrentContext,OPENGL.DLL,NM,0, obtains a handle to the current OpenGL rendering context of the calling thread.wglGetCurrentContext,OPENGL32.DLL,NM,0, obtains a handle to the current OpenGL rendering context of the calling thread.wglGetCurrentDC,OPENGL.DLL,NM,0 obtains a handle to the device contextthat is associated with the current OpenGL rendering context of thecalling thread.wglGetCurrentDC,OPENGL32.DLL,NM,0 obtains a handle to the device contextthat is associated with the current OpenGL rendering context of thecalling thread.wglGetLayerPaletteEntries,OPENGL.DLL,NM,5 retrieves the paletteentries from a given color-index layer plane for a specified devicecontext.wglGetLayerPaletteEntries,OPENGL32.DLL,NM,5 retrieves the paletteentries from a given color-index layer plane for a specified devicecontext.wglGetProcAddress,OPENGL.DLL,NM,1 returns the address of an OpenGLextension function for use with the current OpenGL renderingcontext.wglGetProcAddress,OPENGL32.DLL,NM,1 returns the address of an OpenGLextension function for use with the current OpenGL renderingcontext.wglMakeCurrent,OPENGL.DLL,NM,2, makes a specified OpenGL rendering context the calling thread?s current rendering context.wglMakeCurrent,OPENGL32.DLL,NM,2, makes a specified OpenGL rendering context the calling thread?s current rendering context.wglRealizeLayerPalette,OPENGL.DLL,NM,3 maps palette entries from agiven color-index layer plane into the physical palette orinitializes the palette of an RGBA layer plane.wglRealizeLayerPalette,OPENGL32.DLL,NM,3 maps palette entries from agiven color-index layer plane into the physical palette orinitializes the palette of an RGBA layer plane.wglSetLayerPaletteEntries,OPENGL.DLL,NM,5, sets the palette entries in a given color-index layer plane for a specified device context.wglSetLayerPaletteEntries,OPENGL32.DLL,NM,5, sets the palette entries in a given color-index layer plane for a specified device context.wglShareLists,OPENGL.DLL,NM,2, enables multiple OpenGL rendering contexts to share a single display-list space.wglShareLists,OPENGL32.DLL,NM,2, enables multiple OpenGL rendering contexts to share a single display-list space.

wglSwapLayerBuffers,OPENGL.DLL,NM,2, swaps the front and back buffers in the overlay, underlay, and main planes of the window referenced by a specified device context. wglSwapLayerBuffers,OPENGL32.DLL,NM,2, swaps the front and back buffers in the overlay, underlay, and main planes of the window referenced by a specified device context. wglUseFontBitmaps,OPENGL.DLL,AW,4 wglUseFontBitmapscreates a set of bitmap displaylists for use in the current OpenGL rendering context.wglUseFontBitmaps,OPENGL32.DLL,AW,4 wglUseFontBitmapscreates a set of bitmap displaylists for use in the current OpenGL rendering context.wglUseFontOutlines,OPENGL.DLL,AW,8 creates three-dimensional (3-D) characters based on a TrueType font for use in OpenGL-rendered scenes.wglUseFontOutlines,OPENGL32.DLL,AW,8 creates three-dimensional (3-D) characters based on a TrueType font for use in OpenGL rendered scenes.WideCharToMultiByte,KERNEL32.DLL,NM,8 maps a wide character string to anew character string.WidenPath,GDI32.DLL,NM,1 redefines the current path as the area that would be painted if the path were stroked using the pen currently selected into the given device context. WindowFromDC,USER32.DLL,NM,1, returns the handle of the window associated with the given display device context (DC).WindowFromPoint,USER32.DLL,NM,2, retrieves the handle of the window that contains the specified point.WinExec,KERNEL32.DLL,NM,2, runs the specified application.WinHelp,USER32.DLL,AW,4, starts Windows Help (WINHELP.WinLoadTrustProvider,WINTRUST.DLL,NM,1, loads a trust provider DLL into the address space of the calling process.WinSubmitCertificate,WINTRUST.DLL,NM,1 passes a WIN_CERTIFICATEstructure to all trust providers registered with the WinTrustservice.WinVerifyTrust,WINTRUST.DLL,NM,3, performs a specified verification action on a specified subject.WNetAddConnection,MPR.DLL,AW,3, enables the calling application to connect a local device to a network resource.WNetAddConnection2,MPR.DLL,AW,4, makes a connection to a network resource.WNetAddConnection3,MPR.DLL,AW,5, makes a connection to a network resource.WNetCancelConnection,MPR.DLL,AW,2, breaks an existing network connection.WNetCancelConnection2,MPR.DLL,AW,3, breaks an existing network connection.WNetCloseEnum,MPR.DLL,NM,1, ends a network resource enumeration started by the WNetOpenEnum function.WNetConnectionDialog,MPR.DLL,NM,2, starts a general browsing dialog box for connecting to network resources.WNetConnectionDialog1,MPR.DLL,AW,1, brings up a general browsing dialog for connecting to network resources.WNetDisconnectDialog,MPR.DLL,NM,2, starts a general browsing dialog box for disconnecting from network resources.WNetDisconnectDialog1,MPR.DLL,AW,1, attempts to disconnect from a network resource.WNetEnumResource,MPR.DLL,AW,4, continues a network-resource enumeration started by the WNetOpenEnum function.WNetGetConnection,MPR.DLL,AW,3, retrieves the name of the network resource associated with a local device.WNetGetLastError,MPR.DLL,AW,5, retrieves the most recent extended error code set by a Windows network function.WNetGetNetworkInformation,MPR.DLL,AW,2 returns extended informationabout a specific network whose name was returned by a previousnetwork enumeration.WNetGetProviderName,MPR.DLL,AW,3, obtains the provider name for a specific type of network.WNetGetUniversalName,MPR.DLL,AW,4 takes a drive-based path for a network resource and obtains a data structure that contains a more universal form of the name. WNetGetUser,MPR.DLL,AW,3, retrieves the current default user name or the user name used to establish a network connection.WNetOpenEnum,MPR.DLL,AW,5, starts an enumeration of network resources or existing connections.WNetUseConnection,MPR.DLL,AW,8, makes a connection to a network resource.WPUCompleteOverlappedRequest,WS2_32.DLL,NM,5, performs overlapped I/O completion notification for overlapped I/O operations.WrapCompressedRTFStream,MAPI32.DLL,NM,3 creates a text stream in uncompressed Rich Text Format (RTF) from the compressed format used in the PR_RTF_COMPRESSED property. WrapStoreEntryID,MAPI32.DLL,NM,6 converts a message store?s internalentry identifier to an entry identifier more usable by themessaging system.WriteClassStg,OLE32.DLL,NM,2, stores the specified class identifier (CLSID) in a storage object.WriteClassStm,OLE32.DLL,NM,2, stores the specified CLSID in the stream.WriteConsole,KERNEL32.DLL,AW,5, writes a character string to a console screen buffer beginning at the current cursor location.WriteConsoleInput,KERNEL32.DLL,AW,4, writes data directly to the console input buffer.WriteConsoleOutput,KERNEL32.DLL,AW,5 writes character and colorattribute data to a specified rectangular block of character cellsin a console screen buffer.WriteConsoleOutputAttribute,KERNEL32.DLL,NM,5 copies a number of foreground and background color attributes to consecutive cells of a console screen buffer, beginning at a specified location. WriteConsoleOutputCharacter,KERNEL32.DLL,AW,5 copies a number of characters to consecutive cells of a console screen buffer, beginning at a specified location. WriteFile,KERNEL32.DLL,NM,5, writes data to a file and is designed for both synchronous and asynchronous operation.WriteFileEx,KERNEL32.DLL,NM,5, writes data to a file.WriteFmtUserTypeStg,OLE32.DLL,NM,3, writes a clipboard format and user type to the storage object.WritePrinter,WINMM.DLL,NM,4, informs the print spooler that data should be written to the specified printer.WritePrivateProfileSection,KERNEL32.DLL,AW,3, replaces the keys and values under the specified section in an initialization file.WritePrivateProfileString,KERNEL32.DLL,AW,4, copies a string into the specified section of the specified initialization file.WritePrivateProfileStruct,KERNEL32.DLL,AW,5, copies data into the to the end of the data.WriteProcessMemory,KERNEL32.DLL,NM,5, writes memory in a specified process.WriteProfileSection,KERNEL32.DLL,AW,2, replaces the contents of the specified section in the WIN.WriteProfileString,KERNEL32.DLL,AW,3, copies a string into the specified section of the WIN.WriteTapemark,KERNEL32.DLL,NM,4, writes a specified number of filemarks, setmarks, short filemarks, or long filemarks to a tape device.WSAAccept,WS2_32.DLL,NM,5 accepts a connection based on the return value of a condition function, andoptionally creates or joins a socket group.WSAAddressToString,WS2_32.DLL,AW,5 converts all components of a SOCKADDR structure into a human-readable stringrepresentation of the address.WSAAsyncGetHostByAddr,WS2_32.DLL,NM,7, asynchronously retrieves host information that corresponds to an address.WSAAsyncGetHostByAddr,WSOCK32.DLL,NM,7, is an asynchronous version of gethostbyaddr.WSAAsyncGetHostByName,WS2_32.DLL,NM,5 cancels an incomplete asynchronous operation.

Page 162: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

WSAAsyncGetHostByName,WSOCK32.DLL,NM,5 processing a callback function.WSAAsyncGetProtoByName,WS2_32.DLL,NM,5, asynchronously retrieves protocol information that corresponds to a protocol name.WSAAsyncGetProtoByName,WSOCK32.DLL,NM,5, asynchronously retrieves protocol information that corresponds to a protocol name.WSAAsyncGetProtoByNumber,WS2_32.DLL,NM,5 asynchronously retrieves protocol information corresponding to aprotocol number.WSAAsyncGetProtoByNumber,WSOCK32.DLL,NM,5 asynchronously retrieves protocol information corresponding to aprotocol number.WSAAsyncGetServByName,WS2_32.DLL,NM,6 asynchronously retrieves service information corresponding to a service name andport.WSAAsyncGetServByName,WSOCK32.DLL,NM,6 asynchronously retrieves service information corresponding to a service name andport.WSAAsyncGetServByPort,WS2_32.DLL,NM,6 gets serviceinformation corresponding to a port and protocol asynchronously.WSAAsyncGetServByPort,WSOCK32.DLL,NM,6 gets service information corresponding to a port and protocol asynchronously.WSAAsyncSelect,WS2_32.DLL,NM,4, is used to request that WS2_32.WSAAsyncSelect,WSOCK32.DLL,NM,4, is used to request that WS2_32.WSACancelAsyncRequest,WS2_32.DLL,NM,1 cancels an incomplete asynchronous operation.WSACancelAsyncRequest,WSOCK32.DLL,NM,1 cancels an incomplete asynchronous operation.WSACancelBlockingCall,WS2_32.DLL,NM,0 closes an existing socket.WSACancelBlockingCall,WSOCK32.DLL,NM,0 closes an existing socket.WSACleanup,WS2_32.DLL,NM,0 terminates use of theWS2_32.WSACleanup,WSOCK32.DLL,NM,0 terminates use of theWS2_32.WSACloseEvent,WS2_32.DLL,NM,1 closes an open eventobject handle.WSAConnect,WS2_32.DLL,NM,7 establishes a connection to another socket application, exchanges connect data, and specifies needed quality of service based on the supplied FLOWSPEC structure.WSACreateEvent,WS2_32.DLL,NM,0 creates a new event object.WSADuplicateSocket,WS2_32.DLL,AW,3, is used to enable socket sharing between processes.WSAEnumNameSpaceProviders,WS2_32.DLL,AW,2, retrieves information about available namespaces.WSAEnumNetworkEvents,WS2_32.DLL,NM,3 discovers occurrences of network events for the indicated socket.WSAEnumProtocols,WS2_32.DLL,AW,3, provides equivalent functionality in Windows Sockets 2.WSAEventSelect,WS2_32.DLL,NM,3 specifies an event object to be associated with the supplied set of FD_XXX network events.WSAGetLastError,WS2_32.DLL,NM,0, returns the error status for the last operation that failed.WSAGetLastError,WSOCK32.DLL,NM,0, returns the error status for the last operation that failed.WSAGetOverlappedResult,WS2_32.DLL,NM,5 returns theresults of an overlapped operation on the specified socket.WSAGetQOSByName,WS2_32.DLL,NM,3 initializes a QUALITYOFSERVICE structure based on a named template.WSAGetServiceClassInfo,WS2_32.DLL,AW,4 retrieves all of the class information (schema) pertaining to a specified serviceclass from a specified name space provider.WSAGetServiceClassNameByClassId,WS2_32.DLL,AW,3, retrieves the name of the service associated with the specified type. This name is the generic service name, like FTP or SNA, and not the name of a specific instance of that service.WSAHtonl,WS2_32.DLL,NM,3 converts a u_long from hostbyte order to network byte order.WSAHtons,WS2_32.DLL,NM,3 converts a u_short from hostbyte order to network byte order.WSAInstallServiceClass,WS2_32.DLL,AW,1 registers a service class schema within a name space.WSAIoctl,WS2_32.DLL,NM,9 controls the mode of a socket.WSAIsBlocking,WS2_32.DLL,NM,0 This has been removed in compliance with the WindowsSockets 2 specification, revision 2.WSAIsBlocking,WSOCK32.DLL,NM,0 This has been removed in compliance with the WindowsSockets 2 specification, revision 2.WSAJoinLeaf,WS2_32.DLL,NM,8 joins a leaf node into a multipoint session, exchanges connect data, and specifies needed quality of service based on the supplied FLOWSPEC structures.WSALookupServiceBegin,WS2_32.DLL,AW,3 ininitiates a client query that is constrained by the information containedwithin a WSAQUERYSET structure.WSALookupServiceEnd,WS2_32.DLL,NM,1 called to free the handle after previous calls to WSALookupServiceBegin and WSALookupServiceNext .WSALookupServiceNext,WS2_32.DLL,AW,4 called after obtaining a handle from a previous call to WSALookupServiceBegin in order to retrieve the requested service information.WSANtohl,WS2_32.DLL,NM,3 converts a u_long from network byte order to host byte order.WSANtohs,WS2_32.DLL,NM,3 WSANtohsconverts a u_short fromnetwork byte order to host byte order.

WSAProviderConfigChange,WS2_32.DLL,NM,3, notifies the application when the provider configuration is changed.WSARecv,WS2_32.DLL,NM,7 WSARecvreceives data from a socket.WSARecvDisconnect,WS2_32.DLL,NM,2 terminates receptionon a socket, and retrieves the disconnect data if the socket isconnection oriented.WSARecvEx,MSWSOCK.DLL,NM,4 The Windows Sockets WSARecvEx function is identical to the recv function, except the flags parameter is an in-out parameter.WSARecvEx,WSOCK32.DLL,NM,4 The Windows Sockets WSARecvEx function is identical to the recv function, except the flags parameter is an in-out parameter.WSARecvFrom,WS2_32.DLL,NM,9 receives a datagram andstores the source address.WSARemoveServiceClass,WS2_32.DLL,NM,1 permanently unregisters service class schema.WSAResetEvent,WS2_32.DLL,NM,1, is used to set the state of the event object to nonsignaled.WSASend,WS2_32.DLL,NM,7 sends data on a connectedsocket.WSASendDisconnect,WS2_32.DLL,NM,2 initiates termination of the connection for the socket and sends disconnectdata.WSASendTo,WS2_32.DLL,NM,9 sends data to a specificdestination, using overlapped I/O where applicable.WSASetBlockingHook,WS2_32.DLL,NM,1 This has been removed in compliance with the WindowsSockets 2 specification, revision 2.WSASetBlockingHook,WSOCK32.DLL,NM,1 This has been removed in compliance with the WindowsSockets 2 specification, revision 2.WSASetEvent,WS2_32.DLL,NM,1, sets the state of the event object to be signaled.WSASetLastError,WS2_32.DLL,NM,1 sets the error code that can be retrieved through the WSAGetLastError function.WSASetLastError,WSOCK32.DLL,NM,1 sets the error code that can be retrieved through the WSAGetLastError function.WSASetService,WS2_32.DLL,AW,3 registers or deregisters a service instance within one or more name spaces. WSASocket,WS2_32.DLL,AW,6 creates a socket that is bound to a specific transport service provider, and optionally creates and/or joins a socket group.WSAStartup,WS2_32.DLL,NM,2, initiates use of WS2_32.DLL by a process.WSAStartup,WSOCK32.DLL,NM,2, initiates use of WS2_32.DLL by a process.WSAStringToAddress,WS2_32.DLL,AW,5, converts a numeric string to a sockaddr structure, suitable for passing to Windows Sockets routines that take such a structure.WSAUnhookBlockingHook,WS2_32.DLL,NM,0 This has been removed in compliance with the WindowsSockets 2 specification, revision 2.WSAUnhookBlockingHook,WSOCK32.DLL,NM,0 Thishas been removed in compliance with the WindowsSockets 2 specification, revision 2.WSAWaitForMultipleEvents,WS2_32.DLL,NM,5 returns either when one or all of the specified event objects are in the signaled state, or when the time-out interval expires.WSCDeinstallProvider,WS2_32.DLL,NM,2, removes the specified transport provider from the system configuration database.WSCEnableNSProvider,WS2_32.DLL,NM,2, changes the state of a given name-space provider. It is intended to give the end user the ability to change the state of the name-space providers through Control Panel.WSCEnumProtocols,WS2_32.DLL,NM,4, retrieves information about available transport protocols.WSCGetProviderPath,WS2_32.DLL,NM,4, retrieves the DLL path for the specified provider.WSCInstallNameSpace,WS2_32.DLL,NM,5, installs a name-space provider. For providers that are able to support multiple names spaces, this function must be called once for every namespace supported, and a unique provider identifier must be supplied each time.WSCInstallProvider,WS2_32.DLL,NM,5, installs the specified transport provider into the system configuration database.WSCUnInstallNameSpace,WS2_32.DLL,NM,1, uninstalls the indicated name-space provider.WSCWriteProviderOrder,WS2_32.DLL,NM,2, is used to reorder the available transport providers. The order of the protocols determines the priority of a protocol when being enumerated or selected for use.wvsprintf,USER32.DLL,AW,3, formats and stores a series of characters and values in a buffer._hread,KERNEL32.DLL,NM,3, reads data from the specified file._hwrite,KERNEL32.DLL,NM,3, writes data to the specified file._lclose,KERNEL32.DLL,NM,1, closes the specified file so that it is no longer available for reading or writing._lcreat,KERNEL32.DLL,NM,2, creates or opens a specified file._llseek,KERNEL32.DLL,NM,3 repositions the file pointer in a previously opened file. _lopen,KERNEL32.DLL,NM,2, opens an existing file and sets the file pointer to the beginning of the file._lread,KERNEL32.DLL,NM,3, reads data from the specified file._lwrite,KERNEL32.DLL,NM,3, writes data to the specified file.__WSAFDIsSet,WS2_32.DLL,NM,2, specifies whether a socket is included in a set of socket descriptors.__WSAFDIsSet,WSOCK32.DLL,NM,2, specifies whether a socket is included in a set of socket descriptors.

.

Sve ove funkcije se pozivaju StdCall pravilima, a funkcije koje se pozivaju po Ccall pravilima (uglavnom funkcije iz Microsoft C runtime biblioteka) nisu navedene u ovoj tabeli. Dato je oko 4800 funkcija. Pored ovoga oko 1000 funkcija sa spiska ima ASCII i Unicode verzije. Ali, ni to nije sve, postoji još oko 3000 nedokumentovanih funkcija i oko 2000 funkcija čija imena i način poziva nisu kompatibilni sa FILDZAN-32 (ali se mogu pozvati Inline asemblerom), te ogroman broj COM/OLE i .NET objekata i metoda, kao i struktura i Windows poruka.

16.4. Portiranje Windows API funkcijePrilikom upotrebe API funkcije u jeziku koji smo razvili, potrebno je učiniti nekoliko koraka.

Dobavljanje dokumentacije za API funkcije

Dokumentacija za sve API funkcije navedene u listi se može naći na Internetu (najčešće uz pomoć stranica msdn.microsoft.com ili www.google.com) ili na dokumentacijskim CD-ovima Microsoft Developer Network Library, ali je

Page 163: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

obično ograničena na programski jezik C. Neka je cilj, na primjer, portirati funkciju CopyFile. Dokumentacija za ovu funkciju izgleda ovako:

CopyFileThe CopyFile function copies an existing file to a new file.BOOL CopyFile( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists);

ParameterslpExistingFileName [in] Pointer to a null-terminated string that specifies the name of an existing file. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend

this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

Windows Me/98/95: This string must not exceed MAX_PATH characters. If lpExistingFileName does not exist, CopyFile fails, and GetLastError returns

ERROR_FILE_NOT_FOUND.lpNewFileName [in] Pointer to a null-terminated string that specifies the name of the new file. In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend

this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

Windows Me/98/95: This string must not exceed MAX_PATH characters.bFailIfExists [in] If this parameter is TRUE and the new file specified by lpNewFileName already exists, the

function fails. If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds.

Return ValuesIf the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call

GetLastError.RemarksSecurity attributes for the existing file are not copied to the new file. To copy security

attributes, use the SHFileOperation function.File attributes for the existing file are copied to the new file. For example, if an existing file

has the FILE_ATTRIBUTE_READONLY file attribute, a copy created through a call to CopyFile will also have the FILE_ATTRIBUTE_READONLY file attribute. For more information, see Retrieving and Changing File Attributes.

This function fails with ERROR_ACCESS_DENIED if the destination file already exists and has the FILE_ATTRIBUTE_HIDDEN or FILE_ATTRIBUTE_READONLY attribute set.

When CopyFile is used to copy an encrypted file, it attempts to encrypt the destination file with the keys used in the encryption of the source file. If this cannot be done, this function attempts to encrypt the destination file with default keys, as in Windows 2000. If neither of these methods can be done, CopyFile fails with an ERROR_ENCRYPTION_FAILED error code.

Windows 2000: When CopyFile is used to copy an encrypted file, the function attempts to encrypt the destination file with the default keys. No attempt is made to encrypt the destination file with the keys used in the encryption of the source file. If it cannot be encrypted, CopyFile completes the copy operation without encrypting the destination file.

Example Code

For an example, see Retrieving and Changing File Attributes.RequirementsClient Requires Windows "Longhorn", Windows XP, Windows 2000 Professional, Windows NT Workstation,

Windows Me, Windows 98, or Windows 95.Server Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT

Server.Header Declared in Winbase.h; include Windows.h.Library Link to Kernel32.lib.DLL Requires Kernel32.dll.Unicode Implemented as CopyFileW (Unicode) and CopyFileA (ANSI). Note that Unicode support on Windows

Me/98/95 requires Microsoft Layer for Unicode.See Also

Konverzija imena, tipova argumenata i konstanti

Kako u tabeli funkcija uz ovu funkciju stoji oznaka AW, ime funkcije će biti CopyFileA, jer u FILDZAN-32 se radi sa ASCII stringovima.

Tipovi argumenata se najčešće portiraju u cijele brojeve i pointere. Windows koristi predefinisane tipove koji se obično mogu naći na web stranici

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp

Na ovoj stranici je nađeno da su dva tipa koji se koriste u CopyFile funkciji LPCTSTR i BOOL, deklarisana kao typedef __nullterminated CONST CHAR *LPCSTR;#ifdef UNICODE

Page 164: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

typedef LPCWSTR LPCTSTR; #else typedef LPCSTR LPCTSTR;#endif

typedef int BOOL;

Iz ovog se vidi da se tip “BOOL” transformiše u tip “cijeli” a tip “LPCTSTR” u tip “karakter *”.

U dokumentaciji se spominju i neke konstante, kao što su FILE_ATTRIBUTE_HIDDEN , FILE_ATTRIBUTE_READONLY,ERROR_ENCRYPTION_FAILED,ERROR_FILE_NOT_FOUND,ERROR_ACCESS_DENIED, MAX_PATH. Ako će se ove konstante koristiti, treba portirati i njihove vrijednosti. Vrijednosti je najlakše naći ako na Internet pretraživaču, npr. www.google.com unesemo #define sa imenom konstante, npr.

#define ERROR_FILE_NOT_FOUND

Mrežni pretraživač će vratiti da ova konstanta ima vrijednost jednaku 2.

Pravljenje deklaracije

Sada se može napisati deklaracija funkcije i pripadnih konstanti. Tipovi u C se zamijene ekvivalentnim tipovima u FILDZAN-32 i redoslijed argumenata se izvrne, zbog razlike u Pascal Call i StdCall.

#definiraj ERROR_FILE_NOT_FOUND 2

cijeli funkcija CopyFileA( cijeli bFailIfExists karakter * lpNewFileName, karakter * lpExistingFileName,);

Upotreba funkcije

U istom listingu u kome je deklaracija može se pozvati funkcija. Evo kao primjer cijelog programa:#definiraj ERROR_FILE_NOT_FOUND 2

cijeli funkcija CopyFileA( cijeli bFailIfExists karakter * lpNewFileName, karakter * lpExistingFileName,);{ CopyFileA(0,”KopijaPodaci.Txt”,”Podaci.txt”);}

Primjer se prevede i asemblira kao i ostali primjeri.

Prilikom linkovanja mora se paziti da imamo ekvivalentnu MASM biblioteku sa ekstenzijom LIB datoteci sa ekstenzijom DLL u kojoj je definisana funkcija. Funkcija CopyFile je definisana u kernel32.dll, pa se pripaja kernel32.lib.

link /defaultlib:kernel32.lib /subsystem:console primjer.obj

16.5. Rezime poglavljaWindows API ima veliki broj funkcija koje se mogu koristiti u raznim programskim jezicima. One su obično

definisane za programski jezik C. Kod novih programskih jezika obično je potrebno, ali i moguće, prilagoditi pozive iz ovih biblioteka osobinama programskog jezika. To je posao lakši od pravljenja novih biblioteka. U slučaju FILDZAN-32, treba prilagoditi ime funkcije, nazive tipova, konstante te redoslijed argumenata.

Page 165: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

17.ASEMBLER

Kompajler koji je razvijen u okviru ovog kursa generiše asemblerski listing, a ne prirodni mašinski kod. Za prevođenje iz asemblerskog jezika u mašinski jezik iskorišten je Microsoftov Macro asembler. Sada slijedi razvoj asemblera, programa koji treba da prevede iz asemblerskog listinga u mašinski jezik. Prvo je potrebno navesti spisak svih instrukcija koje ovaj procesor poznaje

17.1. Instrukcijski set Pentiuma II

Tipična instrukcija mikroprocesora Pentium II izgleda kao na slici Sl. 17.1.1:

Instruction Format +-----------+-----------+-----------+-----------+-----------+-----------+ | | | | | | | | Prefixes | Opcode | ModR/M | SIB | Disp | immediate | | | | | | | | +-----------+-----------+-----------+-----------+-----------+-----------+

Sl. 17.1.1. Format instrukcijaPrefixes : Nula do četiri prefiksa velika po jedan bajt: (LOCK | REP | REPE | REPZ | REPNE | REPZ) (CS | SS | DS | ES | FS | GS) (66) (67) Opcode: 1 ili 2 bajtni operacioni kodModR/M: Biti 7..6 predstavljaju Mode, biti 2..0 sadrže kod registra ili memorijskog režima koji je indiciran modom, biti 5..3 su rezervno polje SIB Biti 7..6 su faktor skaliranja, 5..3 je Index, 2..0 je BazaDisp: Opcioni adresni pomak od 1, 2, ili 4 bajtaImmediate Opcionalna konstantna vrijednost od 1, 2 ili 4 bajta

Sve instrukcije ovog procesora opisane su u tabeli na strani 168. Slijedi objašnjenje tabele:

17.2. Operacioni kodovi, opisHeksadekadni broj, na primjer 9F, predstavlja sam taj broj.Heksadekadni broj praćen oznakom +r, npr C8+r znači da se broj koji predstavlja registarski operand treba dodati tom broju. Npr., EDX je predstavljen brojem 2, pa će to generisati heksadekadni bajt CA.

Brojevi koji predstavljaju registarski operand 0 AL AX EAX ES ST0 MM0 xmmr0 CR0 DR0 1 CL CX ECX CS ST1 MM1 xmmr1 DR1 2 DL DX EDX SS ST2 MM2 xmmr2 CR2 DR2 3 BL BX EBX DS ST3 MM3 xmmr3 CR3 DR3 TR3 4 AH SP ESP FS ST4 MM4 xmmr4 CR4 TR4 5 CH BP EBP GS ST5 MM5 xmmr5 TR5 6 DH SI ESI ST6 MM6 xmmr6 DR6 TR6 7 BH DI EDI ST7 MM7 xmmr7 DR7 TR7

Sl. 17.2.1. Brojevi koji predstavljaju registarski operandJednocifreni broj iza kose crte (npr /3) znači da se taj broj smješta u rezervno polje ModRM bajta..

Simbol /r znači da broj koji predstavlja registarski operand se smješta u rezervno polje ModRM bajta.

Simboli ib, iw i id predstavljaju konstantnu vrijednost koja može biti bajt, riječ ili dupla riječ. Ovi podaci se smještaju u little endian formatu.

Simboli rb, rw i rd znače da je jedan od operanada konstantna vrijednost i da se razlika između te vrijednosti i adrese kraja instrukcije treba kodirati kao bajt, riječ ili dupla riječ respektivno. Simbol r? predstavlja da se treba koristiti rw ili rd zavisno od toga da li se asembliranje vrši u 16-bitnom ili 32-bitnom režimu.

Simboli ow , od i o? znače da je jedan od operanada predstavljen apsolutnom adresom.

Simboli o16 i o32 znače da je veličina operanada 16 ili 32 bita. Intelovi procesori koriste prefiks 66 da promijene podrazumijevanu veličinu operanada. Stoga o16 znači da će ta instrukcija imati prefiks 66 ako se asembliranje vrši u 32 bitnom režimu a neće imati prefiks ako se asembliranje vrši u 16 bitnom režimu. Analogno, o32 znači da će ta instrukcija imati prefiks 66 ako se asembliranje vrši u 16 bitnom režimu a neće imati prefiks ako se asembliranje vrši u 32 bitnom režimu.

Page 166: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Kodovi a16 i a32 slično kodovima o16 i o32 označavaju adresnu veličinu navedene forme instrukcije. Ako se ona ne slaže sa podrazumijevanom veličinom, ubacuje se prefiks 67. Ovaj se prefiks ubacuje i kada nema kodova a16 i a32, a navedeni adresni način ne postoji u 16 bitnom odnosno 32 bitnom režimu (npr., ako u 32 bitnom režimu se prevodi instrukcija MOV EAX,[BX] treba generisati prefiks 67, jer je [BX] šesnaestobitni adresni način.)

17.3. OperandiU tabeli instrukcija operandi su označeni sljedećim kodovima:

reg8 8-bitni registar opšte namjenerg16 16-bitni registar opšte namjenerg32 32-bitni registar opšte namjenefpur Jedan od 8 FPU registarammxr Jedan od 8 MMX (64 bitnih) registarasegr Jedan od segmentnih registaraimmg Neki konstantni operandime8 8-bitni konstantni operand im16 16- bitni konstantni operand im32 32- bitni konstantni operand memg Memorijska adresamem8 8-bitna memorijska adresamm16 16-bit memorijska adresa

mm32 32-bitna memorijska adresamm64 64-bitna memorijska adresamm80 80-bitna memorijska adresargm8 skraćenica za reg8/mem8 rm16 skraćenica za rg16/mm16 rm32 skraćenica za rg32/mm32 rm64 skraćenica za mmxr/mm64 abs8 apsolutna adresa 8 bitnih podatakaab16 apsolutna adresa 16 bitnih podatakaab32 apsolutna adresa 32 bitnih podatakacreg kontrolni registardreg Debug registartreg Task registar

Sl. 17.3.1. Tablica vrsta operanada

17.4. Kodiranje adrese: ModR/M i SIB bajtoviAdresni operand je kodiran iz tri dijela (1) MOD/RM bajt, (2) opcionalni SIB bajt i (3) opcionalni bajt, riječ ili dupla

riječ pomaka.

ModR/M se sastoji od tri polja, mod polje u bitima 7..6, r/m polje u bitima 2..0 i rezervno polje u bitima 5..3- Rezervno polje nije relevantno za adresu koja se kodira.

R/M znači registar ili memorija, što znači da se može kodirati direktna referenca na registar umjesto memorijskog pristupa. To se radi postavljanjem mod polja na 3 i r/m polja na broj koji predstavlja registarski operand. U tom slučaju nema ni SIB bajta ni pomaka.

U 16 bitnom režimu SIB bajt se nikada ne koristi. Mod predstavlja veličinu pomaka (0, 1, 2 bajta) ili 3 ako je u pitanju registar. Polja 2..0 dopuštaju nekoliko kombinacija registara za adresiranje, pri čemu [bp] se mora kodirati kao [bp+0]

r/m | mod=00 mod=01 mod=10 mod=11 ----+---------------------------------------------------------------- 000 | [bx+si] [bx+si+disp8] [bx+si+disp16] al/ax/eax/mm0/xmmr0 001 | [bx+di] [bx+di+disp8] [bx+di+disp16] cl/cx/ecx/mm1/xmmr1 010 | [bp+si] [bp+si+disp8] [bp+si+disp16] dl/dx/edx/mm2/xmmr2 011 | [bp+di] [bp+di+disp8] [bp+di+disp16] bl/bx/ebx/mm3/xmmr3 100 | [si] [si+disp8] [si+disp16] ah/sp/esp/mm4/xmmr4 101 | [di] [di+disp8] [di+disp16] ch/bp/ebp/mm5/xmmr5 110 | [disp16] [bp+disp8] [bp+disp16] dh/si/esi/mm6/xmmr6 111 | [bx] [bx+disp8] [bx+disp16] bh/di/edi/mm7/xmmr7

Sl. 17.4.1. Kodiranje MOD/Rm bajta, 16 bitnoU 32 bitnom režimu mod polje predstavlja dužinu dijela pomaka, 0 znači da nema pomaka, 1 znači jedan bajt, 2

predstavlja 4 bajta. Ako se pomaku pridodaje samo jedan registar i on nije ESP, tada r/m polje sadrži vrijednost koja predstavlja taj registar i nema polja SIB. Ako je r/m polje jednako 4 , postoji SIB polje. Također, [ebp] se mora kodirati kao [ebp+0].

r/m | mod=00 mod=01 mod=10 mod=11 ----+----------------------------------------------------------- 000 | [eax] [eax+disp8] [eax+disp32] al/ax/eax/mm0/xmmr0 001 | [ecx] [ecx+disp8] [ecx+disp32] cl/cx/ecx/mm1/xmmr1 010 | [edx] [edx+disp8] [edx+disp32] dl/dx/edx/mm2/xmmr2 011 | [ebx] [ebx+disp8] [ebx+disp32] bl/bx/ebx/mm3/xmmr3 100 | SIB SIB+disp8 SIB+disp32 ah/sp/esp/mm4/xmmr4 101 | [disp32] [ebp+disp8] [ebp+disp32] ch/bp/ebp/mm5/xmmr5 110 | [esi] [esi+disp8] [esi+disp32] dh/si/esi/mm6/xmmr6 111 | [edi] [edi+disp8] [edi+disp32] bh/di/edi/mm7/xmmr7

Page 167: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Sl. 17.4.2. Kodiranje ModRm , 32 bitnoSIB bajt ima tri polja: Faktor skaliranja u bitima 7..6 koji predstavljaju 1, 2, 4 ili 8, indeksni registar u bitima 5..3 i

bazni registar u bitima 2..0. Ideja je da se generiše [BASE + SCALE*INDEX], koji se onda dodaju eventualnom pomaku navedenom u ModR/M bajtu. Na primjer, kod D3 (11010011) ima skalu 11 (znači 8), indeksni registar 010 (znači EDX) i bazni registar 011 (znači EBX) pa se kodira kao [ebx+edx*8].

Ipak, ESP se ne može koristiti kao indeksni registar, pa ako indeksno polje sadrži 4, to znači da nema indeksnog registra. Takođe, ako bazno polje sadrži 5, a mod biti su 00, adresa nije [ebp+scale*index] nego [scale*index+disp32] (nema baznog registra).

Primjeri: ecx 11xxx001 [ecx] 00xxx001 [ecx+12345678H] 10xxx001 78 56 34 12 [ecx+esi*2] 00xxx100 71 [ecx+esi*2+12345678H] 10xxx100 71 78 56 34 12 [esi*2] 00xxx100 75 [esi*2+12345678H] 10xxx100 75 78 56 34 12 [12345678H] 00xxx101 78 56 34 12 [ebp] 01xxx101 00 [ebp+12345678H] 10xxx101 78 56 34 12 [ebp+eax*4] 01xxx100 85 00 [ebp+eax*4+12345678H] 10xxx100 85 78 56 34 12 [esp] 00xxx100 24 [esp+12345678H] 10xxx100 24 78 56 34 12

17.5. Primjeri kodiranja kompletnih instrukcijaMOV ECX,[EDX+150h]

Prvi operand je 32bitni registar opšte namjene, a drugi 32 bitna memorijska lokacija. U tablici se nalazi

MOV rg32,rm32 o32 8B /rAko je režim rada 32-bitni (tj. generiše se kod za 32 bitne operativne sisteme), o32 nema značenja. Operacioni kod

instrukcije je 8B. [EDX+150h] spada u kategoriju [EDX+Disp32] koja u polju r/m ima vrijednost 010 binarno, a u polju mod vrijednost 10 binarno. Ovaj adresni režim ne zahtijeva SIB bajt, ali ima pomak. Rezervno polje ModRM bajta je broj registra ECX koji iznosi 1, odnosno binarno 001. Stoga je ModRM bajt 10 001 010, što u heksadekadnom sistemu iznosi 8A. Pomak napisan 32 bitno iznosi 00000150, što napisano little endian formatom predstavlja 50 01 00 00. Dakle, ova instrukcija se kodira kao

8B 8A 50 01 00 00

U 16 bitnom režimu rada vidimo da je adresa 32 bitna, pa je neophodan prefiks 67. Takođe, o32 znači da treba dodati i prefiks 66, pa se ova instrukcija piše kao

66 67 8B 8A 50 01 00 00

XOR BX,1500hPrvi operand je 16 bitni registar, drugi operand 16 bitna konstanta. U tabeli je takav slučaj naveden kao

XOR rm16,im16 o16 81 /6 iwU šesnaestobitnom režimu nije potreban prefiks, a u 32 bitnom simbol o16 predstavlja da je tu potreban prefiks 66.

Pošto se nigdje ne spominje adresa, nema prefiksa 67. Operacioni kod je 81. Pošto je operand tipa registar (neposredna vrijednost nije u tabeli ModRm), mod=11, r/m=011. Oznaka /6 znači da se u rezervno polje upisuje vrijednost 6, tj. 110. Stoga je bajt ModRm jednak 11 110 011, ili heksadekadno F3. Pomak 1500h u little endian se piše kao 00 15. Prema tome, u 16 bitnom režimu ova instrukcija se kodira kao 81 F3 15 00 ,a u 32 bitnom kao 66 81 F3 15 00.

Page 168: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

AAA 37AAD D5 0AAAM D4 0AAAS 3FADC AL,ime8 14 ibADC AX,im16 o16 15 iwADC EAX,im32 o32 15 idADC reg8,rgm8 12 /rADC rgm8,ime8 80 /2 ibADC rgm8,reg8 10 /rADC rg16,rm16 o16 13 /rADC rg32,rm32 o32 13 /rADC rm16,ime8 o16 83 /2 ibADC rm16,im16 o16 81 /2 iwADC rm16,rg16 o16 11 /rADC rm32,ime8 o32 83 /2 ibADC rm32,im32 o32 81 /2 idADC rm32,rg32 o32 11 /rADD AL,ime8 04 ibADD AX,im16 o16 05 iwADD EAX,im32 o32 05 idADD reg8,rgm8 02 /rADD rgm8,ime8 80 /0 ibADD rgm8,reg8 00 /rADD rg16,rm16 o16 03 /rADD rg32,rm32 o32 03 /rADD rm16,ime8 o16 83 /0 ibADD rm16,im16 o16 81 /0 iwADD rm16,rg16 o16 01 /rADD rm32,ime8 o32 83 /0 ibADD rm32,im32 o32 81 /0 idADD rm32,rg32 o32 01 /rAND AL,ime8 24 ibAND AX,im16 o16 25 iwAND EAX,im32 o32 25 idAND reg8,rgm8 22 /rAND rgm8,ime8 80 /4 ibAND rgm8,reg8 20 /rAND rg16,rm16 o16 23 /rAND rg32,rm32 o32 23 /rAND rm16,ime8 o16 83 /4 ibAND rm16,im16 o16 81 /4 iwAND rm16,rg16 o16 21 /rAND rm32,ime8 o32 83 /4 ibAND rm32,im32 o32 81 /4 idAND rm32,rg32 o32 21 /rARPL rm16,rg16 63 /rBOUND rg16,mm16:16 o16 62 /rBOUND rg32,mm32:32 o32 62 /rBSF rg16,rm16 o16 0F BC /rBSF rg32,rm32 o32 0F BC /rBSR rg16,rm16 o16 0F BD /rBSR rg32,rm32 o32 0F BD /rBSWAP rg32 o32 0F C8+rgBTC rm16,ime8 o16 0F BA /7 ibBTC rm16,rg16 o16 0F BB /rBTC rm32,ime8 o32 0F BA /7 ibBTC rm32,rg32 o32 0F BB /rBTR rm16,ime8 o16 0F BA /6 ibBTR rm16,rg16 o16 0F B3 /rBTR rm32,ime8 o32 0F BA /6 ibBTR rm32,rg32 o32 0F B3 /rBTS rm16,immg o16 0F BA /5 ibBTS rm16,rg16 o16 0F AB /rBTS rm32,immg o32 0F BA /5 ibBTS rm32,rg32 o32 0F AB /rBT rm16,ime8 o16 0F BA /4 ibBT rm16,rg16 o16 0F A3 /rBT rm32,ime8 o32 0F BA /4 ibBT rm32,rg32 o32 0F A3 /rCALL_FAR mm16 o16 FF /3CALL_FAR mm32 o32 FF /3CALL immg E8 r?CALL immg:im16 o16 9A iw iwCALL immg:im32 o32 9A id iwCALL rm16 o16 FF /2CALL rm32 o32 FF /2CBW o16 98CDQ o32 99CLC F8CLD FCCLI FACLTS 0F 06CMC F5CMOVO rg16,rm16 o16 0F 40 /rCMOVO rg32,rm32 o32 0F 40 /rCMOVNO rg16,rm16 o16 0F 41 /rCMOVNO rg32,rm32 o32 0F 41 /rCMOVC rg16,rm16 o16 0F 42 /rCMOVC rg32,rm32 o32 0F 42 /rCMOVB rg16,rm16 o16 0F 42 /rCMOVB rg32,rm32 o32 0F 42 /rCMOVNC rg16,rm16 o16 0F 43 /rCMOVNC rg32,rm32 o32 0F 43 /rCMOVAE rg16,rm16 o16 0F 43 /rCMOVAE rg32,rm32 o32 0F 43 /rCMOVE rg16,rm16 o16 0F 44 /rCMOVE rg32,rm32 o32 0F 44 /rCMOVZ rg16,rm16 o16 0F 44 /rCMOVZ rg32,rm32 o32 0F 44 /rCMOVNE rg16,rm16 o16 0F 45 /rCMOVNE rg32,rm32 o32 0F 45 /rCMOVNZ rg16,rm16 o16 0F 45 /rCMOVNZ rg32,rm32 o32 0F 45 /rCMOVBE rg16,rm16 o16 0F 46 /rCMOVBE rg32,rm32 o32 0F 46 /rCMOVA rg16,rm16 o16 0F 47 /rCMOVA rg32,rm32 o32 0F 47 /rCMOVS rg16,rm16 o16 0F 48 /rCMOVS rg32,rm32 o32 0F 48 /r

CMOVNS rg16,rm16 o16 0F 49 /rCMOVNS rg32,rm32 o32 0F 49 /rCMOVP rg16,rm16 o16 0F 4A /rCMOVP rg32,rm32 o32 0F 4A /rCMOVPE rg16,rm16 o16 0F 4A /rCMOVPE rg32,rm32 o32 0F 4A /rCMOVNP rg16,rm16 o16 0F 4B /rCMOVNP rg32,rm32 o32 0F 4B /rCMOVPO rg16,rm16 o16 0F 4B /rCMOVPO rg32,rm32 o32 0F 4B /rCMOVL rg16,rm16 o16 0F 4C /rCMOVL rg32,rm32 o32 0F 4C /rCMOVGE rg16,rm16 o16 0F 4D /rCMOVGE rg32,rm32 o32 0F 4D /rCMOVNL rg16,rm16 o16 0F 4D /rCMOVNL rg32,rm32 o32 0F 4D /rCMOVLE rg16,rm16 o16 0F 4E /rCMOVLE rg32,rm32 o32 0F 4E /rCMOVG rg16,rm16 o16 0F 4F /rCMOVG rg32,rm32 o32 0F 4F /rCMPSB A6CMPSD o32 A7CMPSW o16 A7CMPXCHG8B mm64 0F C7 /1CMPXCHG rgm8,reg8 0F B0 /rCMPXCHG rm16,rg16 o16 0F B1 /rCMPXCHG rm32,rg32 o32 0F B1 /rCMP AL,ime8 3C ibCMP AX,im16 o16 3D iwCMP EAX,im32 o32 3D idCMP reg8,rgm8 3A /rCMP rgm8,ime8 80 /0 ibCMP rgm8,reg8 38 /rCMP rg16,rm16 o16 3B /rCMP rg32,rm32 o32 3B /rCMP rm16,ime8 o16 83 /0 ibCMP rm16,im16 o16 81 /0 iwCMP rm16,rg16 o16 39 /rCMP rm32,ime8 o32 83 /0 ibCMP rm32,im32 o32 81 /0 idCMP rm32,rg32 o32 39 /rCPUID 0F A2CWDE o32 98CWD o16 99DAA 27DAS 2FDEC rgm8 FE /1DEC rg16 o16 48+rgDEC rg32 o32 48+rgDEC rm16 o16 FF /1DEC rm32 o32 FF /1DIV rgm8 F6 /6DIV rm16 o16 F7 /6DIV rm32 o32 F7 /6EMMS 0F 77ENTER immg,immg C8 iw ibFABS D9 E1FADDP fpur DE C0+rgFADDP fpur,ST0 DE C0+rgFADD DE C1FADD fpur D8 C0+rgFADD fpur,ST0 DC C0+rgFADD mm32 D8 /0FADD mm64 DC /0FADD ST0,fpur D8 C0+rgFBLD mm80 DF /4FBSTP mm80 DF /6FCHS D9 E0FCLEX 9B DB E2FCMOVBE fpur DA D0+rgFCMOVBE ST0,fpur DA D0+rgFCMOVB fpur DA C0+rgFCMOVB ST0,fpur DA C0+rgFCMOVE fpur DA C8+rgFCMOVE ST0,fpur DA C8+rgFCMOVNBE fpur DB D0+rgFCMOVNBE ST0,fpur DB D0+rgFCMOVNB fpur DB C0+rgFCMOVNB ST0,fpur DB C0+rgFCMOVNE fpur DB C8+rgFCMOVNE ST0,fpur DB C8+rgFCMOVNU fpur DB D8+rgFCMOVNU ST0,fpur DB D8+rgFCMOVU fpur DA D8+rgFCMOVU ST0,fpur DA D8+rgFCOMIP fpur DF F0+rgFCOMIP ST0,fpur DF F0+rgFCOMI fpur DB F0+rgFCOMI ST0,fpur DB F0+rgFCOMPP DE D9FCOMP fpur D8 D8+rgFCOMP mm32 D8 /3FCOMP mm64 DC /3FCOMP ST0,fpur D8 D8+rgFCOM fpur D8 D0+rgFCOM mm32 D8 /2FCOM mm64 DC /2FCOM ST0,fpur D8 D0+rgFCOS D9 FFFDECSTP D9 F6FDISI 9B DB E1FDIVP fpur DE F8+rgFDIVP fpur,ST0 DE F8+rgFDIVRP fpur DE F0+rgFDIVRP fpur,ST0 DE F0+rgFDIVR DE F1FDIVR fpur D8 F8+rgFDIVR fpur,ST0 DC F0+rgFDIVR mm32 D8 /0FDIVR mm64 DC /0

FDIVR ST0,fpur D8 F8+rgFDIV fpur D8 F0+rgFDIV fpur,ST0 DC F8+rgFDIV mm32 D8 /6FDIV mm64 DC /6FDIV ST0,fpur D8 F0+rgFENI 9B DB E0FFREEP fpur DF C0+rgFFREE fpur DD C0+rgFIADD mm16 DE /0FIADD mm32 DA /0FICOMP mm16 DE /3FICOMP mm32 DA /3FICOM mm16 DE /2FICOM mm32 DA /2FIDIVR mm16 DE /0FIDIVR mm32 DA /0FIDIV mm16 DE /6FIDIV mm32 DA /6FILD mm16 DF /0FILD mm32 DB /0FILD mm64 DF /5FIMUL mm16 DE /1FIMUL mm32 DA /1FINCSTP D9 F7FINIT 9B DB E3FISTP mm16 DF /3FISTP mm32 DB /3FISTP mm64 DF /0FIST mm16 DF /2FIST mm32 DB /2FISUBR mm16 DE /5FISUBR mm32 DA /5FISUB mm16 DE /4FISUB mm32 DA /4FLDCW mm16 D9 /5FLDENV memg D9 /4FLDLG2 D9 ECFLDLN2 D9 EDFLDL2E D9 EAFLDL2T D9 E9FLDPI D9 EBFLDZ D9 EEFLD1 D9 E8FLD fpur D9 C0+rgFLD mm32 D9 /0FLD mm64 DD /0FLD mm80 DB /5FMULP fpur DE C8+rgFMULP fpur,ST0 DE C8+rgFMUL DE C9FMUL fpur D8 C8+rgFMUL fpur,ST0 DC C8+rgFMUL mm32 D8 /1FMUL mm64 DC /1FMUL ST0,fpur D8 C8+rgFNCLEX DB E2FNDISI DB E1FNENI DB E0FNINIT DB E3FNOP D9 D0FNSAVE memg DD /6FNSTCW mm16 D9 /0FNSTENV memg D9 /6FNSTSW AX DF E0FNSTSW mm16 DD /0FPATAN D9 F3FPREM1 D9 F5FPREM D9 F8FPTAN D9 F2FRNDINT D9 FCFRSTOR memg DD /4FSAVE memg 9B DD /6FSCALE D9 FDFSETPM DB E4FSINCOS D9 FBFSIN D9 FEFSQRT D9 FAFSTCW mm16 9B D9 /0FSTENV memg 9B D9 /6FSTP fpur DD D8+rgFSTP mm32 D9 /3FSTP mm64 DD /3FSTP mm80 DB /0FSTSW AX 9B DF E0FSTSW mm16 9B DD /0FST fpur DD D0+rgFST mm32 D9 /2FST mm64 DD /2FSUBP fpur DE E8+rgFSUBP fpur,ST0 DE E8+rgFSUBRP fpur DE E0+rgFSUBRP fpur,ST0 DE E0+rgFSUBR DE E1 FSUBR fpur D8 E8+rgFSUBR fpur,ST0 DC E0+rgFSUBR mm32 D8 /5FSUBR mm64 DC /5FSUBR ST0,fpur D8 E8+rgFSUB fpur D8 E0+rgFSUB fpur,ST0 DC E8+rgFSUB mm32 D8 /4FSUB mm64 DC /4FSUB ST0,fpur D8 E0+rgFTST D9 E4FUCOMIP fpur DF E8+rgFUCOMIP ST0,fpur DF E8+rgFUCOMI fpur DB E8+rgFUCOMI ST0,fpur DB E8+rgFUCOMPP DA E9

FUCOMP fpur DD E8+rgFUCOMP ST0,fpur DD E8+rgFUCOM fpur DD E0+rgFUCOM ST0,fpur DD E0+rgFWAIT 9BFXAM D9 E5FXCH fpur D9 C8+rgFXCH fpur,ST0 D9 C8+rgFXCH ST0,fpur D9 C8+rgFXCH D9 C9FXTRACT D9 F4FYL2XP1 D9 F9FYL2X D9 F1F2XM1 D9 F0HLT F4IBTS rm16,rg16 o16 0F A7 /rIBTS rm32,rg32 o32 0F A7 /rICEBP F1IDIV rgm8 F6 /7IDIV rm16 o16 F7 /7IDIV rm32 o32 F7 /7IMUL rgm8 F6 /5IMUL rg16,ime8 o16 6B /r ibIMUL rg16,im16 o16 69 /r iwIMUL rg16,rm16 o16 0F AF /rIMUL rg16,rm16,ime8 o16 6B /r ibIMUL rg16,rm16,im16 o16 69 /r iwIMUL rg32,ime8 o32 6B /r ibIMUL rg32,im32 o32 69 /r idIMUL rg32,rm32 o32 0F AF /rIMUL rg32,rm32,ime8 o32 6B /r ibIMUL rg32,rm32,im32 o32 69 /r idIMUL rm16 o16 F7 /5IMUL rm32 o32 F7 /5INC rgm8 FE /0INC rg16 o16 40+rgINC rg32 o32 40+rgINC rm16 o16 FF /0INC rm32 o32 FF /0INSB 6CINSD o32 6DINSW o16 6DINTO CEINT1 F1INT3 CCINT ime8 CD ibINVD 0F 08INVLPG memg 0F 01 /0IN AL,DX ECIN AL,ime8 E4 ibIN AX,DX o16 EDIN AX,ime8 o16 E5 ibIN EAX,DX o32 EDIN EAX,ime8 o32 E5 ibIRETD o32 CFIRETW o16 CFIRET CFJO immg 70 rbJO_NEAR immg 0F 80 r?JNO immg 71 rbJNO_NEAR immg 0F 81 r?JC immg 72 rbJC_NEAR immg 0F 82 r?JB immg 72 rbJB_NEAR immg 0F 82 r?JNAE immg 72 rbJNAE_NEAR immg 0F 82 r?JNC immg 73 rbJNC_NEAR immg 0F 83 r?JNB immg 73 rbJNB_NEAR immg 0F 83 r?JAE immg 73 rbJAE_NEAR immg 0F 83 r?JE immg 74 rbJE_NEAR immg 0F 84 r?JZ immg 74 rbJZ_NEAR immg 0F 84 r?JNE immg 75 rbJNE_NEAR immg 0F 85 r?JNZ immg 75 rbJNZ_NEAR immg 0F 85 r?JBE immg 76 rbJBE_NEAR immg 0F 86 r?JNA immg 76 rbJNA_NEAR immg 0F 86 r?JA immg 77 rbJA_NEAR immg 0F 87 r?JNBE immg 77 rbJNBE_NEAR immg 0F 87 r?JS immg 78 rbJS_NEAR immg 0F 88 r?JNS immg 79 rbJNS_NEAR immg 0F 89 r?JP immg 7A rbJP_NEAR immg 0F 8A r?JPE immg 7A rbJPE_NEAR immg 0F 8A r?JNP immg 7B rbJNP_NEAR immg 0F 8B r?JPO immg 7B rbJPO_NEAR immg 0F 8B r?JL immg 7C rbJL_NEAR immg 0F 8C r?JNGE immg 7C rbJNGE_NEAR immg 0F 8C r?JGE immg 7D rbJGE_NEAR immg 0F 8D r?JNL immg 7D rbJNL_NEAR immg 0F 8D r?JLE immg 7E rb

Page 169: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

JLE_NEAR immg 0F 8E r?JNG immg 7E rbJNG_NEAR immg 0F 8E r?JG immg 7F rbJG_NEAR immg 0F 8F r?JNLE immg 7F rbJNLE_NEAR immg 0F 8F r?JCXZ immg o16 E3 rbJECXZ immg o32 E3 rbJMP_FAR memg o16 FF /5JMP_FAR memg o32 FF /5JMP immg E9 r?JMP immg:im16 o16 EA iw iwJMP immg:im32 o32 EA id iwJMP rm16 o16 FF /4JMP rm32 o32 FF /4JMP_SHORT immg EB rbLAHF 9FLAR rg16,rm16 o16 0F 02 /rLAR rg32,rm32 o32 0F 02 /rLDS rg16,memg o16 C5 /rLDS rg32,memg o32 C5 /rLEAVE C9LEA rg16,memg o16 8D /rLEA rg32,memg o32 8D /rLES rg16,memg o16 C4 /rLES rg32,memg o32 C4 /rLFS rg16,memg o16 0F B4 /rLFS rg32,memg o32 0F B4 /rLGDT memg 0F 01 /2LGS rg16,memg o16 0F B5 /rLGS rg32,memg o32 0F B5 /rLIDT memg 0F 01 /3LLDT rm16 0F 00 /2LMSW rm16 0F 01 /6LOADALL286 0F 05LOADALL 0F 07LODSB ACLODSD o32 ADLODSW o16 ADLOOPE immg E1 rbLOOPE immg,CX a16 E1 rbLOOPE immg,ECX a32 E1 rbLOOPNE immg E0 rbLOOPNE immg,CX a16 E0 rbLOOPNE immg,ECX a32 E0 rbLOOPNZ immg E0 rbLOOPNZ immg,CX a16 E0 rbLOOPNZ immg,ECX a32 E0 rbLOOPZ immg E1 rbLOOPZ immg,CX a16 E1 rbLOOPZ immg,ECX a32 E1 rbLOOP immg E2 rbLOOP immg,CX a16 E2 rbLOOP immg,ECX a32 E2 rbLSL rg16,rm16 o16 0F 03 /rLSL rg32,rm32 o32 0F 03 /rLSS rg16,memg o16 0F B2 /rLSS rg32,memg o32 0F B2 /rLTR rm16 0F 00 /3MOVD mmxr,rm32 0F 6E /rMOVD rm32,mmxr 0F 7E /rMOVQ mmxr,rm64 0F 6F /rMOVQ rm64,mmxr 0F 7F /rMOVSB A4MOVSD o32 A5MOVSW o16 A5MOVSX rg16,rgm8 o16 0F BE /rMOVSX rg32,rgm8 o32 0F BE /rMOVSX rg32,rm16 o32 0F BF /rMOVZX rg16,rgm8 o16 0F B6 /rMOVZX rg32,rgm8 o32 0F B6 /rMOVZX rg32,rm16 o32 0F B7 /rMOV abs8,AL A2 o?MOV ab16,AX o16 A3 o?MOV ab32,EAX o32 A3 o?MOV AL,abs8 A0 o?MOV AX,ab16 o16 A1 o?MOV creg,rg32 0F 22 /rMOV dreg,rg32 0F 23 /rMOV EAX,ab32 o32 A1 o?MOV reg8,ime8 B0+rg ibMOV reg8,rgm8 8A /rMOV rgm8,ime8 C6 /0 ibMOV rgm8,reg8 88 /rMOV rg16,im16 o16 B8+rg iwMOV rg16,rm16 o16 8B /rMOV rg32,creg 0F 20 /rMOV rg32,dreg 0F 21 /rMOV rg32,im32 o32 B8+rg idMOV rg32,rm32 o32 8B /rMOV rg32,treg 0F 24 /rMOV rm16,im16 o16 C7 /0 iwMOV rm16,rg16 o16 89 /rMOV rm16,segr o16 8C /rMOV rm32,im32 o32 C7 /0 idMOV rm32,rg32 o32 89 /rMOV rm32,segr o32 8C /rMOV segr,rm16 o16 8E /rMOV segr,rm32 o32 8E /rMOV treg,rg32 0F 26 /rMUL rgm8 F6 /4MUL rm16 o16 F7 /4MUL rm32 o32 F7 /4NEG rgm8 F6 /3NEG rm16 o16 F7 /3NEG rm32 o32 F7 /3NOP 90NOT rgm8 F6 /2NOT rm16 o16 F7 /2

NOT rm32 o32 F7 /2OR AL,ime8 0C ibOR AX,im16 o16 0D iwOR EAX,im32 o32 0D idOR reg8,rgm8 0A /rOR rgm8,ime8 80 /1 ibOR rgm8,reg8 08 /rOR rg16,rm16 o16 0B /rOR rg32,rm32 o32 0B /rOR rm16,ime8 o16 83 /1 ibOR rm16,im16 o16 81 /1 iwOR rm16,rg16 o16 09 /rOR rm32,ime8 o32 83 /1 ibOR rm32,im32 o32 81 /1 idOR rm32,rg32 o32 09 /rOUTSB 6EOUTSD o32 6FOUTSW o16 6FOUT DX,AL EEOUT DX,AX o16 EFOUT DX,EAX o32 EFOUT ime8,AL E6 ibOUT ime8,AX o16 E7 ibOUT ime8,EAX o32 E7 ibPACKSSDW mmxr,rm64 0F 6B /rPACKSSWB mmxr,rm64 0F 63 /rPACKUSWB mmxr,rm64 0F 67 /rPADDB mmxr,rm64 0F FC /rPADDD mmxr,rm64 0F FE /rPADDQ mmxr,rm64 0F D4 /rPADDSB mmxr,rm64 0F EC /rPADDSW mmxr,rm64 0F ED /rPADDUSB mmxr,rm64 0F DC /rPADDUSW mmxr,rm64 0F DD /rPADDW mmxr,rm64 0F FD /rPANDN mmxr,rm64 0F DF /rPAND mmxr,rm64 0F DB /rPCMPEQB mmxr,rm64 0F 74 /rPCMPEQD mmxr,rm64 0F 76 /rPCMPEQW mmxr,rm64 0F 75 /rPCMPGTB mmxr,rm64 0F 64 /rPCMPGTD mmxr,rm64 0F 66 /rPCMPGTW mmxr,rm64 0F 65 /rPMADDWD mmxr,rm64 0F F5 /rPMULHW mmxr,rm64 0F E5 /rPMULLW mmxr,rm64 0F D5 /rPOPAD o32 61POPAW o16 61POPA 61POPFD o32 9DPOPFW o16 9DPOPF 9DPOP DS 1FPOP ES 07POP FS 0F A1POP GS 0F A9POP rg16 o16 58+rgPOP rg32 o32 58+rgPOP rm16 o16 8F /0POP rm32 o32 8F /0POP SS 17POR mmxr,rm64 0F EB /rPSLLD mmxr,ime8 0F 72 /6 ibPSLLD mmxr,rm64 0F F2 /rPSLLQ mmxr,ime8 0F 73 /6 ibPSLLQ mmxr,rm64 0F F3 /rPSLLW mmxr,ime8 0F 71 /6 ibPSLLW mmxr,rm64 0F F1 /rPSRAD mmxr,ime8 0F 72 /4 ibPSRAD mmxr,rm64 0F E2 /rPSRAW mmxr,ime8 0F 71 /4 ibPSRAW mmxr,rm64 0F E1 /rPSRLD mmxr,ime8 0F 72 /2 ibPSRLD mmxr,rm64 0F D2 /rPSRLQ mmxr,ime8 0F 73 /2 ibPSRLQ mmxr,rm64 0F D3 /rPSRLW mmxr,ime8 0F 71 /2 ibPSRLW mmxr,rm64 0F D1 /rPSUBB mmxr,rm64 0F F8 /rPSUBD mmxr,rm64 0F FA /rPSUBSB mmxr,rm64 0F E8 /rPSUBSW mmxr,rm64 0F E9 /rPSUBUSB mmxr,rm64 0F D8 /rPSUBUSW mmxr,rm64 0F D9 /rPSUBW mmxr,rm64 0F F9 /rPUNPCKHBW mmxr,rm64 0F 68 /rPUNPCKHDQ mmxr,rm64 0F 6A /rPUNPCKHWD mmxr,rm64 0F 69 /rPUNPCKLBW mmxr,rm64 0F 60 /rPUNPCKLDQ mmxr,rm64 0F 62 /rPUNPCKLWD mmxr,rm64 0F 61 /rPUSHAD o32 60PUSHAW o16 60PUSHA 60PUSHFD o32 9CPUSHFW o16 9CPUSHF 9CPUSH CS 0EPUSH DS 1EPUSH ES 06PUSH FS 0F A0PUSH GS 0F A8PUSH ime8 6A ibPUSH im16 o16 68 iwPUSH im32 o32 68 idPUSH rg16 o16 50+rgPUSH rg32 o32 50+rgPUSH rm16 o16 FF /6PUSH rm32 o32 FF /6PUSH SS 16

PXOR mmxr,rm64 0F EF /rRCL rgm8,CL D2 /2RCL rgm8,ime8 C0 /2 ibRCL rgm8,1 D0 /2RCL rm16,CL o16 D3 /2RCL rm16,ime8 o16 C1 /2 ibRCL rm16,1 o16 D1 /2RCL rm32,CL o32 D3 /2RCL rm32,ime8 o32 C1 /2 ibRCL rm32,1 o32 D1 /2RCR rgm8,CL D2 /3RCR rgm8,ime8 C0 /3 ibRCR rgm8,1 D0 /3RCR rm16,CL o16 D3 /3RCR rm16,ime8 o16 C1 /3 ibRCR rm16,1 o16 D1 /3RCR rm32,CL o32 D3 /3RCR rm32,ime8 o32 C1 /3 ibRCR rm32,1 o32 D1 /3RDMSR 0F 32RDPMC 0F 33RDTSC 0F 31RETF im16 CA iwRETF CBRETN im16 C2 iwRETN C3RET im16 C2 iwRET C3ROL rgm8,CL D2 /0ROL rgm8,ime8 C0 /0 ibROL rgm8,1 D0 /0ROL rm16,CL o16 D3 /0ROL rm16,ime8 o16 C1 /0 ibROL rm16,1 o16 D1 /0ROL rm32,CL o32 D3 /0ROL rm32,ime8 o32 C1 /0 ibROL rm32,1 o32 D1 /0ROR rgm8,CL D2 /1ROR rgm8,ime8 C0 /1 ibROR rgm8,1 D0 /1ROR rm16,CL o16 D3 /1ROR rm16,ime8 o16 C1 /1 ibROR rm16,1 o16 D1 /1ROR rm32,CL o32 D3 /1ROR rm32,ime8 o32 C1 /1 ibROR rm32,1 o32 D1 /1RSM 0F AASAHF 9ESALC D6SAL rgm8,CL D2 /4SAL rgm8,ime8 C0 /4 ibSAL rgm8,1 D0 /4SAL rm16,CL o16 D3 /4SAL rm16,ime8 o16 C1 /4 ibSAL rm16,1 o16 D1 /4SAL rm32,CL o32 D3 /4SAL rm32,ime8 o32 C1 /4 ibSAL rm32,1 o32 D1 /4SAR rgm8,CL D2 /0SAR rgm8,ime8 C0 /0 ibSAR rgm8,1 D0 /0SAR rm16,CL o16 D3 /0SAR rm16,ime8 o16 C1 /0 ibSAR rm16,1 o16 D1 /0SAR rm32,CL o32 D3 /0SAR rm32,ime8 o32 C1 /0 ibSAR rm32,1 o32 D1 /0SBB AL,ime8 1C ibSBB AX,im16 o16 1D iwSBB EAX,im32 o32 1D idSBB reg8,rgm8 1A /rSBB rgm8,ime8 80 /3 ibSBB rgm8,reg8 18 /rSBB rg16,rm16 o16 1B /rSBB rg32,rm32 o32 1B /rSBB rm16,ime8 o16 83 /3 ibSBB rm16,im16 o16 81 /3 iwSBB rm16,rg16 o16 19 /rSBB rm32,ime8 o32 83 /3 ibSBB rm32,im32 o32 81 /3 idSBB rm32,rg32 o32 19 /rSCASB AESCASD o32 AFSCASW o16 AFSETO rgm8 0F 90 /2SETNO rgm8 0F 91 /2SETC rgm8 0F 92 /2SETB rgm8 0F 92 /2SETNAE rgm8 0F 92 /2SETNC rgm8 0F 93 /2SETNB rgm8 0F 93 /2SETAE rgm8 0F 93 /2SETE rgm8 0F 94 /2SETZ rgm8 0F 94 /2SETNE rgm8 0F 95 /2SETNZ rgm8 0F 95 /2SETBE rgm8 0F 96 /2SETNA rgm8 0F 96 /2SETA rgm8 0F 97 /2SETNBE rgm8 0F 97 /2SETS rgm8 0F 98 /2SETNS rgm8 0F 99 /2SETP rgm8 0F 9A /2SETPE rgm8 0F 9A /2SETNP rgm8 0F 9B /2SETPO rgm8 0F 9B /2SETL rgm8 0F 9C /2SETNGE rgm8 0F 9C /2SETGE rgm8 0F 9D /2SETNL rgm8 0F 9D /2

SETLE rgm8 0F 9E /2SETNG rgm8 0F 9E /2SETG rgm8 0F 9F /2SETNLE rgm8 0F 9F /2SGDT memg 0F 01 /0SHLD rm16,rg16,CL o16 0F A5 /rSHLD rm16,rg16,ime8 o16 0F A4 /r ibSHLD rm32,rg32,CL o32 0F A5 /rSHLD rm32,rg32,ime8 o32 0F A4 /r ibSHL rgm8,CL D2 /4SHL rgm8,ime8 C0 /4 ibSHL rgm8,1 D0 /4SHL rm16,CL o16 D3 /4SHL rm16,ime8 o16 C1 /4 ibSHL rm16,1 o16 D1 /4SHL rm32,CL o32 D3 /4SHL rm32,ime8 o32 C1 /4 ibSHL rm32,1 o32 D1 /4SHRD rm16,rg16,CL o16 0F AD /rSHRD rm16,rg16,ime8 o16 0F AC /r ibSHRD rm32,rg32,CL o32 0F AD /rSHRD rm32,rg32,ime8 o32 0F AC /r ibSHR rgm8,CL D2 /5SHR rgm8,ime8 C0 /5 ibSHR rgm8,1 D0 /5SHR rm16,CL o16 D3 /5SHR rm16,ime8 o16 C1 /5 ibSHR rm16,1 o16 D1 /5SHR rm32,CL o32 D3 /5SHR rm32,ime8 o32 C1 /5 ibSHR rm32,1 o32 D1 /5SIDT memg 0F 01 /1SLDT rm16 0F 00 /0SMI F1SMSW rm16 0F 01 /4STC F9STD FDSTI FBSTOSB AASTOSD o32 ABSTOSW o16 ABSTR rm16 0F 00 /1SUB AL,ime8 2C ibSUB AX,im16 o16 2D iwSUB EAX,im32 o32 2D idSUB reg8,rgm8 2A /rSUB rgm8,ime8 80 /5 ibSUB rgm8,reg8 28 /rSUB rg16,rm16 o16 2B /rSUB rg32,rm32 o32 2B /rSUB rm16,ime8 o16 83 /5 ibSUB rm16,im16 o16 81 /5 iwSUB rm16,rg16 o16 29 /rSUB rm32,ime8 o32 83 /5 ibSUB rm32,im32 o32 81 /5 idSUB rm32,rg32 o32 29 /rSYSENTER 0F 34SYSEXIT 0F 36TEST AL,ime8 A8 ibTEST AX,im16 o16 A9 iwTEST EAX,im32 o32 A9 idTEST rgm8,ime8 F6 /7 ibTEST rgm8,reg8 84 /rTEST rm16,im16 o16 F7 /7 iwTEST rm16,rg16 o16 85 /rTEST rm32,im32 o32 F7 /7 idTEST rm32,rg32 o32 85 /rUD1 0F B9UD2 0F 0BUMOV reg8,rgm8 0F 12 /rUMOV rgm8,reg8 0F 10 /rUMOV rg16,rm16 o16 0F 13 /rUMOV rg32,rm32 o32 0F 13 /rUMOV rm16,rg16 o16 0F 11 /rUMOV rm32,rg32 o32 0F 11 /rVERR rm16 0F 00 /4VERW rm16 0F 00 /5WAIT 9BWBINVD 0F 09WRMSR 0F 30XADD rgm8,reg8 0F C0 /rXADD rm16,rg16 o16 0F C1 /rXADD rm32,rg32 o32 0F C1 /rXBTS rg16,rm16 o16 0F A6 /rXBTS rg32,rm32 o32 0F A6 /rXCHG AX,rg16 o16 90+rgXCHG EAX,rg32 o32 90+rgXCHG reg8,rgm8 86 /rXCHG rgm8,reg8 86 /rXCHG rg16,AX o16 90+rgXCHG rg16,rgm8 o16 87 /rXCHG rg32,EAX o32 90+rgXCHG rg32,rm32 o32 87 /rXCHG rm16,rg16 o16 87 /rXCHG rm32,rg32 o32 87 /rXLATB D7XOR AL,ime8 34 ibXOR EAX,im32 o32 35 id XOR AX,im16 o16 35 iwXOR reg8,rgm8 32 /rXOR rgm8,ime8 80 /6 ibXOR rgm8,reg8 30 /rXOR rg16,rm16 o16 33 /rXOR rg32,rm32 o32 33 /rXOR rm16,ime8 o16 83 /6 ibXOR rm16,im16 o16 81 /6 iwXOR rm16,rg16 o16 31 /rXOR rm32,ime8 o32 83 /6 ibXOR rm32,im32 o32 81 /6 idXOR rm32,rg32 o32 31 /r

Page 170: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

17.6. Parsiranje instrukcijeTipična instrukcija u asemblerskom jeziku je oblika

LABELA: OPCODE ARG1,ARG2,ARG3 ; KOMENTAR

pri čemu se često argumenti mogu izostaviti.

Početni dio najvažnije funkcije u asembleru GenerateHexInstruction, koja prevodi liniju u mašinski kod u heksadecimalnom formatu izdvaja ove elemente u posebne varijable.

Pored toga, unutar instrukcije se mogu nalaziti prefiksi za segmente i modifikatori kao što su NEAR i FAR. Ove prefikse i modifikatore treba izdvojiti iz instrukcije.

Izdvajanje dijelova asemblerske instrukcije u posebne varijable se može raditi sintaksnom analizom ili, što je ovdje primijenjeno jer je struktura asemblerskih instrukcija jednostavna korištenjem funkcije pos za traženje stringa na željenoj poziciji. To radi funkcija Izdvoji, čiji je prvi argument varijabla u koju će se smjestiti željeni dio stringa nakon parsiranja, a drugi je znak do kojeg se vrši izdvajanje. Treba još obraditi nekoliko specijalnih slučajeva, jer se labela kod instrukcija db, dw i dq ne završava dvotačkom, pa pogrešno biva prepoznata kao operacioni kod. Ti specijalni slučajevi se rješavaju naknadnim promjenama i zamjenama varijabli.

Pronađene labele se smještaju u posebnu tabelu koja se zove labele. Tu se smješta ime labele i njena vrijednost, te vrsta. Nakon svake generisane instrukcije uvećava se trenutna pozicija i ova pozicija predstavlja vrijednost aktuelne labele. Ukupno postoje tri takve pozicije za code, data i stack segment.

17.7. Prepoznavanje adresnih režimaIzdvajanjem argumenata potrebno je prepoznati njegov adresni režim. Pentium II, kako se vidjelo u opisu tabele ima

dosta različitih adresnih režima. Da stvar bude složenija, oni se razlikuju zavisno od toga da li asembler generiše prevedeni kod u 16 bitnom ili 32-bitnom režimu.

Prepoznavanje, unutar funkcije ParseOp, se može obaviti pravljenjem sintaksnog dijagrama i zatim odgovarajućih procedura, ali je u cilju smanjenja veličine samog asemblera primijenjen malo drugačiji pristup. Provjerava se da li pojedini pripada jednom od navedenih uzoraka na slici. [A*B+C+D] -> tip:=13 [A+B*C+D] -> tip:=14 [A+B+C*D] -> tip:=15 [A*B+C-D] -> tip:=16 [A+B*C-D] -> tip:=17 [A-B+C*D] -> tip:=18 [A*B-C+D] -> tip:=19 [A*B+C] -> tip:=11 [A+B+C] -> tip:=10

[A*B-C] -> tip:=20 [A+B-C] -> tip:=21 [A-B+C] -> tip:=22 [A+B*C] -> tip:=12 [A*B] -> tip:=9 [A+B] -> tip:=8 [A-B] -> tip:=23 A[B*C+D] -> tip:=5 A[B*C-D] -> tip:=24

A[B+C*D] -> tip:=6 A[B*C] -> tip:=4 A[B+C] -> tip:=3 A[B-C] -> tip:=25 A[B] -> tip:=2 [A] -> tip:=7 A -> tip:=1 ;

Sl. 17.7.1. Uzorci argumenataTako na primjer, argument koji glasi [EAX*4+EBX-15] je tipa 16. Ovo prepoznavanje je takođe urađeno pomoću pos

naredbe, a moglo se i sintaksnom analizom. Funkcija uzorak provjerava da li se string slaže sa navedenim uzorkom i puni varijable A, B, C i D odgovarajućim stringovima. Tako na primjer Uzorak('[A*B+C-D]','[EAX*4+EBX-15]') će vratiti true i napuniti varijablu A vrijednošću EAX, varijablu B vrijednošću 4, varijablu C vrijednošću EBX i varijablu D vrijednošću 15.

Broj mogućih slučajeva je još uvijek preveliki pa je sada potrebno praviti ekvivalentne. Tako na primjer tipovi 5 i 18 se mogu svesti na tip 13 zamjenom odgovarajućih varijabli. Svi se tipovi argumenata na kraju svedu na jedan od mogućih tipova: 1, 7, 8, 10, 11 i 13. No i ovo je još uvijek mnogo. Naime, argument [EAX*4+EBX+15] (tip 13) se može pisati na četiri načina:

[EAX*4+EBX+15] ili [4*EAX+EBX+15] ili [EAX*4+15+EBX] ili [4*EAX+15+EBX]

Stoga, treba sortirati registre i konstante tako da se vrijednosti koje nisu registri stave na kraj argumenta. Prilikom ovog sortiranja se pored ovoga adresiranja koja uključuju zbir registara BX/BP sa SI/DI takođe sortiraju da registri BX, odnosno BP dođu na početak argumenta.

Postoje još dva specijalna slučaja: kada navedena labela zapravo predstavlja čitanje s memorijske lokacije (sintaksa MOV AX,VRIJEDNOST zapravo se treba shvatiti kao MOV AX,[VRIJEDNOST]), te kada se slučaj [A+B] svodi na slučaj [A] ukoliko su A i B konstante.

17.8. Proračun modrm , SIB i deplasmanaPrepoznati tip argumenta sada treba prevesti u njegovo značenje. Za svaki od navedenih tipova postoje procedure koje

se zovu Obrada1, Obrada7, Obrada8, Obrada10, Obrada11 i Obrada13. U okviru ovih procedura se gleda da li je pojedini od dijelova argumenta registar ili konstanta. Registar se prepoznaje funkcijom Regcode. Kada su prepoznati svi elementi , tada se u slog tipa Toperand upiše izračunata vrijednost bajta ModRM i bajta SIB.

Page 171: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Ukoliko je argument labela mora se pretražiti i u tabeli labela i naći njena vrijednost, čime se dalje ponaša kao da je u pitanju konstanta. Vrijednosti dijelova argumenata koji predstavljaju konstante, deplasmane ili memorijske adrese smještaju se u polja disp8, disp16 ili disp32 zavisno od njihove veličine.

17.9. Punjenje i pretraživanje tabele instrukcijaTabela instrukcija se prije početka asembliranja kompletna učita u memoriju i sortira.

Unutar funkcije GenerateHexInstruction se zatim poziva funkcija MakeOps unutar koje se poziva funkcija ParseOp. Zavisno od vrste argumenta zaključi se da li je riječ o osmobitnom registru (reg8), šesnaestbitnom registru (reg16), itd. kako je navedeno u tabeli u poglavlju 17.3. Argument može da se posmatra u više različitih konteksta. Tako na primjer kod instrukcije

MOV EAX,[EBX]

za prvi argument važe konteksti: EAX rg32 rm32

a za drugi argument važe konteksti: memg mem8 mm16 mm32 mm64 mm80 rgm8 rm16 rm32 rm64

Sada je moguće pripremiti sve kombinacije argumenata, kao što su MOV EAX,memgMOV EAX,mem8....MOV EAX,rm34MOV rg32,memgMOV rg32,mem8...MOV rm32,rm64

Nakon pripreme svih kombinacija operacionog koda i argumenata, slijedi binarno pretraživanje kroz tabelu. U tabeli se pronalazi kao regularna kombinacija

MOV rg32,rm32 o32 8B /r

17.10. Generisanje heksadekadnog kodaNakon pronalaska vrijednosti u tabeli generiše se heksadekadni kod prema uputama iz tabele. U primjeru o32 8B /r se

najprije generišu bajtovi 67 i 66 zavisno od oblika operanada. Nakon toga se generiše prosto bajt 8B. Oznaka /r znači da se mora prethodno zaključiti od kojeg argumenta se uzima ModRm, a od kojeg kod registra( u primjeru MOV EAX,[EBX] argument EAX predstavlja registar, a argument [EBX] definiše ModRM). Tako se kreira konačni ModRm, čime je instrukcija prevedena u heksadekadni oblik

17.11. Numeričke konstantePrilikom generisanja heksadekadnog koda instrukcije, dio argumenata su numeričke konstante ili labele. Ako se

utvrdi da je riječ o labeli, vrši se pretraga kroz tabelu labela i uzima njena vrijednost, čime se problem svodi na evaluaciju numeričkih konstanti.

Dvije su vrste numeričkih konstanti, cjelobrojne i realne. Tehnika prevođenja cjelobrojnih konstanti je već izučena u poglavljima kompajlera, što se izvodi uzastopnim množenjem sa 10. Jedina specifičnost je što asemblerski programi koriste i heksadekadni i binarni brojni sistem. Stoga se u funkciji EvaluirajBroj provjerava da li se na kraju ASCII reprezentacije broja nalazi oznaka ‘b’ odnosno ‘h’, čime se konstanta kojom se uzastopno množi mijenja u 2, odnosno 16.

U šestoj verziji kompajlera FILDZAN-32 pretvaranje realnog broja u binarni format prepušteno je asembleru. To znači da se sada mora pozabaviti konverzijom realnog broja iz ASCII reprezentacije u četvorobajtni, osmobajtni ili desetobajtni IEEE format. To je realizovano funkcijom StrToFloat2. Format realnog broja je prilično mašinski ovisan. Za razliku od dekadnih brojeva, pored uzastopnog množenja sa 10 za svaku cifru, broj se mora normalizovati ponovnim množenjem ili dijeljenjem mantise sa 10 i uvećavanjem, odnosno umanjivanjem eksponenta. Pored svega toga, potrebno je prevesti ga u binarni format, i zatim spakovati iznose, kako Intel zahtijeva. Realizovati ovo potpuno u višem programskom jeziku rezultuje velikim numeričkim greškama. U cilju skraćenja asemblera (a po cijenu smanjenja njegove portabilnosti, ali da li je ona bitna za asembler?) množenje sa 10 i konverzija u binarni format (u suštini prosta FSTP instrukcija) realizovana je ugniježđenim asemblerom.

17.12. Pseudoinstrukcije, prefiksi i modifikatoriOdređene instrukcije se ne nalaze u tabeli. To su instrukcije DD, DW, DB, DQ, DT, END, PUBLIC, .486 itd. To su

standardne asemblerske pseudoinstrukcije. Ovaj asembler je po izboru standardnih instrukcija bogat, jer pokriva cijeli skup Pentiuma II, dok mnogi PC asembleri završavaju sa procesorom 486. Međutim, nije implementirano mnogo pseudoinstrukcija (nedostaju makroinstrukcije, pa čak i obična ORG instrukcija). Ove se istrukcije prepoznaju funkcijom IsPseudo, a generisanje koda za njih procedurom DoPseudo.

Page 172: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Prilikom prepoznavanja instrukcije se provjeri da li ona sadrži prefikse kao što su ES:, CS:, SS:, ... REP itd. Ako sadrže, treba generisati odgovarajući kod i za njih. Modifikatori kao što su NEAR i FAR se zamjenjuju njihovim dodavanjem na kraj operacionog koda instrukcije uz pomoć znaka podvlačilice.

17.13. Prvi prolazSada kada je realizovano prevođenje pojedinačne instrukcije, što je i najteži dio posla, može se prevesti cijeli

program. Između asemblerskih instrukcija nema velike međuzavisnosti, kakva postoji između instrukcija u programskim jezicima visokog nivoa, tako da kada je realizovano prevođenje jedne instrukcije, prevođenje cijelog programa je lagan zadatak. Ipak, labele predstavljaju problem jer se instrukcije često referenciraju na labele koje još nisu definisane. Stoga je potrebno dva puta proći kroz izvornu datoteku. U prvom prolazu se dođe do heksadecimalne vrijednosti instrukcije i puni se tabela labela prilikom svake generisane labele, ali se heksadecimalna vrijednost intrukcije nigdje ne upisuje.

17.14. Drugi prolaz i generisanje kodaU drugom prolazu se generiše 5 datoteka:

Datoteka sa ekstenzijom .COD koja sadrži generisani kod iz CODE segmenta

Datoteka sa ekstenzijom .DAT koja sadrži generisane podatke iz DATA segmenta

Datoteka sa ekstenzijom .STA koja sadrži generisani kod iz STACK segmenta

Datoteka sa ekstenzijom .LAB koja sadrži spisak labela

Datoteka sa ekstenzijom .PAT koja sadrži popravke, tj. adrese na kojima se referencira pojedina labela

Cijeli asembler se starta naredbom

ASEM ime.asm /d za 16-bitno, DOS asembliranje

ASEM ime.asm /w za 32-bitno, Windows asembliranje

17.15. Izvršna verzijaSa ovim asemblerom je dobijen mašinski kod ali treba još učiniti stvari da bi on bio izvršni na DOS ili Windows

operativnom sistemu. Mašinski kod je u linearnom formatu. U nekim drugim slučajevima, ovaj format je najbolji. To su recimo loaderi operativnih sistema. To je prirodni format i pokazuje mašinski jezik onakav kakav on zaista jeste, ali ima svoje nedostatke. U slučaju DOS-a, on je ograničen na veličinu segmenta od 64 K U slučaju Windowsa, tog ograničenja nema, ali nije moguće povezati program sa dinamičkim bibliotekama.

DOS programi generisani ovim asemblerom se mogu učitati i startati ukoliko nemaju podataka u DATA segmentu prostim preimenovanjem datoteke sa ekstenzijom .COD u datoteku sa ekstenzijom .COM. U slučaju da ima podataka u DATA segmentu i ako asemblerski program počinje saMOV AX,CSADD AX,<duzina CODE segmenta DIV 16 +1>MOV DS,AX

Tada se mogu spojiti datoteke sa ekstenzijom COD i DAT u jedinstveni COM program, pri čemu se DAT datoteka smješta na prvu poziciju djeljivu sa 16 od početka COM datoteke iza iskopirane COD datoteke. Pored ovog zahvata potrebno je provjeriti PAT datoteku ukoliko se referiše program na podatke i promijeniti adrese u programu.

Međutim, ovo nije primjenjivo za Windows programe, što je primarni zadatak ovog asemblera. Potrebno je sada konvertovati program u takav format da ga može razumjeti standardni linker.

Stoga je sljedeći logičan korak je generisanje COFF objektnog formata (ekstenzija OBJ). Ovaj format sadrži mašinski kod, ali i sve potrebne informacije da bi linker mogao da poveže modul sa drugim modulima praveći izvršni EXE program. U tu svrhu su pripremljene tabele labela i tabele popravki . Sve informacije postoje, samo ih je potrebno upakovati prema standardima.

U prilogu je dat listing cijelog asemblera.

Page 173: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

17.16. Listing AsembleraProgram asem;Type TLabTip = (lEqu, lprog, ldata, lextrn); TDsize = (d8, d16, d32, d64, d80); TLabela = Record labime: string[40]; labtip: TLabTip; labval: longint; labdsize: TDsize; End; texists=(exmodrm,exsib,exdisp8, exdisp16, exdisp32, exreg, exkind, exsegment); TOperand = Record existv: Set Of texists; datasizes: Set Of TDsize; adrsizes: Set Of TDsize; modrm: byte; sib: byte; disp8: byte; disp16: word; disp32: longint; segnum: word; reg: byte; kind: integer; End; toptable = Record instr: string[35]; gencod: string[20]; End;

Var labele: Array[1..10000] Of TLabela; optable: Array[1..2000] Of TOptable; FPValue: Array[1..10] Of char; brlabela, actseg: integer; skok, dummyb: boolean; maxopcode, prolaz, dummy: integer; pozicija: Array[1..3] Of longint; patstr: string; ulaz, izlazlab, izlazpat: Text; izlazcode, izlazdata, izlazstack: File Of byte;

Function trim(st: string): string;Begin While (st <> '') and (st[1] = ' ') Do st := copy(st, 2, length(st)); While (st <> '') and (st[length(st)] = ' ') Do st := copy(st, 1, length(st) - 1); TRIM := ST;End;

Function uppercase(st: string): string;Var i: integer;Begin For i := 1 To length(st) Do If(st[i]>= 'a') and (st[i] <= 'z') Then st[i] := chr(Ord(st[i]) - 32); uppercase := st;End;

Function IntToStr(n: longint; base: cardinal): string;Var st, c, pr: string; ev: cardinal;Begin If (base = 10) and (n < 0) Then Begin pr := '-'; n := -n; End Else pr := ''; ev := n; c := '0123456789ABCDEF'; If ev = 0 Then st := '0' Else st := ''; While ev > 0 Do Begin st := c[(ev mod base) + 1] + st; ev := ev div base; End; IntToStr := pr + st;End;

Function inttohex(n, digits: longint): string;Var st: string; negative: boolean; i: integer;Begin If n < 0 Then Begin

n := -n; n := n - 1; negative := True; End Else negative := False; st := IntToStr(n, 16); While length(st)<digits Do st:= '0' + st; If negative Then Begin For i := 1 To length(st) Do Begin Case st[i] Of '0': st[i] := 'F'; '1': st[i] := 'E'; '2': st[i] := 'D'; '3': st[i] := 'C'; '4': st[i] := 'B'; '5': st[i] := 'A'; '6': st[i] := '9'; '7': st[i] := '8'; '8': st[i] := '7'; '9': st[i] := '6'; 'A': st[i] := '5'; 'B': st[i] := '4'; 'C': st[i] := '3'; 'D': st[i] := '2'; 'E': st[i] := '1'; 'F': st[i] := '0'; End; End; End; inttohex := st;End;

Function nadjilabelu(ime: string): integer;Var i: integer;Begin nadjilabelu := -1; For i := 1 To brlabela Do If ime = labele[i].labime Then Begin nadjilabelu := i; EndEnd;

Procedure upisilabelu(ime: string; adresa: integer; lt: TLabtip; ds: TDSize);Var p: integer;Begin p := NadjiLabelu(ime); If p = -1 Then Begin brlabela := brlabela + 1; p := brlabela; End; With labele[p] Do Begin labime := ime; labtip := lt; labval := adresa; labdsize := ds; End;End;

Function EvaluirajBroj(br: string; Var Greska: boolean): longint;Var i, p, c, baza, last, rez: longint; z: char;Begin Greska := False; rez := 0; i := 1; If br = '' Then Begin EvaluirajBroj := 0; greska := True; exit; End; If not (br[1] in ['0'..'9', '-']) Then greska := True; If (br[1] = '-')and(length(br) > 1) Then Begin p := -1; i := i + 1 End Else p := 1; Case br[length(br)] Of 'o', 'O': baza := 8; 'b', 'B': baza := 2; 'h', 'H': baza := 16; '0'..'9': baza := 10 Else Begin baza := 0;

greska := True; End; End; last := length(br); If baza <> 10 Then last := last - 1; While i <= last Do Begin z := br[i]; c := 16; If (z >= '0') and (z <= '9') Then c := Ord(z) - Ord('0'); If (z >= 'a') and (z <= 'f') Then c := Ord(z) - Ord('a') + 10; If (z >= 'A') and (z <= 'F') Then c := Ord(z) - Ord('A') + 10; If c >= baza Then greska := True; rez := rez * baza + c; i := i + 1; End; If greska Then rez := 0; Evaluirajbroj := p * rez;End;

Procedure UpisiIzlaz(outst: string);Var i: integer; b: byte; g: boolean;Begin For i:=0 To(length(outst)div2)-1 Do Begin b := evaluirajbroj('0' + copy(outst, i * 2 + 1, 2) + 'H', g); If prolaz = 2 Then Case actseg Of 1: Write(izlazcode, b); 2: Write(izlazdata, b); 3: Write(izlazstack, b); End; End;End;

Function regcode(reg: string; Var kind: integer): integer;Const Registers: Array[0..8, 0..7] Of string =(('AL','CL','DL','BL','AH','CH','DH','BH'), ('AX','CX','DX','BX','SP','BP','SI','DI'),('EAX','ECX','EDX','EBX','ESP','EBP','ESI', 'EDI'),('CR0','***','CR2','CR3','CR4','***','***', '***'),('DR0','DR1','DR2','DR3','***','***','DR6', 'DR7'),('TR0','TR1','TR2','TR3','TR4','TR5','TR6', 'TR7'),('ES','CS','SS','DS','FS','GS',’***','***'),('ST0','ST1','ST2','ST3','ST4','ST5','ST6','ST7'),('MMX0','MMX1','MMX2','MMX3','MMX4','MMX5','MMX6', 'MMX7'));Var i, j: integer;Begin reg := uppercase(reg); If copy(reg, 1, 3) = 'ST(' Then reg := 'ST' + copy(reg, 4, 1); If copy(reg, 1, 4) = 'MMX(' Then reg := 'MMX' + copy(reg, 4, 1); For i := 0 To 8 Do For j := 0 To 7 Do If registers[i, j] = reg Then Begin regcode := j; kind := i; exit;

Page 174: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

End; regcode := -1; kind := -1;End;

Procedure deplasmani(Var op: TOperand; broj: longint; predzn: boolean);Begin op.existv := op.existv + [exdisp32]; op.disp32 := broj; If (predzn and (op.disp32 < 32768) and (op.disp32>-32769))or(not (predzn) and (op.disp32<65536)and(op.disp32 >= 0)) Then Begin op.existv := op.existv + [exdisp16]; op.disp16 := op.disp32; End; If (predzn and (op.disp32 < 128) and (op.disp32>-129)) or(not (predzn) and (op.disp32 < 256) and (op.disp32 >= 0)) Then Begin op.existv := op.existv + [exdisp8]; op.disp8 := op.disp32; End;End;

Procedure ResolveDisp(Var disp, unknown: string);Var kind: integer; greska: boolean; n: longint;Begin unknown := ''; If regcode(disp, kind)<>-1 Then exit; dummy := EvaluirajBroj(disp, greska); If not (greska) Then exit; n := nadjilabelu(disp);

Page 175: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

If n<>-1 Then Begin patstr := disp; disp := IntToStr(labele[n].labval, 10); exit End Else Begin unknown := ''; disp := '0'; End;End;

Procedure zamijeni(Var x, y: string);Var z: string;Begin z := x; x := y; y := z;End;

Function progutaj(st: string; Var puni: string): boolean;Var n: integer;Begin n := pos(st, uppercase(puni)); If n > 0 Then Begin puni := trim(copy(puni,1,n-1)+copy( puni, n + length(st), length(puni))); progutaj := True; End Else progutaj := False;End;

FUNCTION parseOp(arg: string; Var op: TOperand; b32: boolean): boolean;Var tip: integer; n: longint; Greska, ponovifazu: boolean; A, B, C, D: string; A1, B1, C1, D1, unknown, dsp: string; kind, po: integer;

Procedure setmod(x: byte); Begin op.modrm := x; op.existv := op.existv + [exmodrm]; End;

Procedure setsib(x: byte); Begin op.sib := x; op.existv := op.existv + [exsib]; End;

Function Uzorak(pattern,st:string):boolean; Var m: string; i: integer; Begin Uzorak := True; If pattern = 'A' Then Begin a := st; exit End; For i := 1 To length(pattern) Do Begin If pattern[i]in['A','B','C','D'] Then Begin m:=copy(st,1, pos(pattern[i+1],st)-1); If m = '' Then uzorak := False; Case pattern[i] Of 'A': a := m; 'B': b := m; 'C': c := m; 'D': d := m; End; st := copy(st, pos(pattern[i + 1], st), length(st)); End Else st := copy(st, pos(pattern[i], st) + 1, length(st)); End; End;

Procedure Obrada1; { Slucaj A } Begin n := regcode(A, kind); If n<>-1 Then Begin op.existv := op.existv + [exreg]; op.reg := n; op.kind := kind; If kind in[0,1,2]Then SetMod(3*64+n); Case kind Of 0: op.datasizes := [d8]; 1, 6: op.datasizes := [d16]; 2, 3, 4, 5: op.datasizes := [d32]; 7, 8: op.datasizes := [d64];

End; End Else Begin If pos(':', A) = 0 Then Begin n := EvaluirajBroj(A, greska); Deplasmani(op, n, n < 0); End Else Begin op.segnum:=EvaluirajBroj(copy(A,1, pos(':', A) - 1), greska); op.existv:=op.existv + [exSegment]; n:=EvaluirajBroj(copy(A,pos(':',A)+ 1,length(A)), greska); Deplasmani(op, n, n < 0); End; End; End;

Procedure OBrada7; { Slucaj [A] } Begin n := regcode(A, kind); If n<>-1 Then Begin Case kind Of 1: Begin Case n Of 3: setmod(0 * 64 + 7); {BX } 6: setmod(0 * 64 + 4); {SI} 7: setmod(0 * 64 + 5); {DI} 5: Begin { BP} tip := 8;B := '0'; ponovifazu := True; End Else Greska := True; End; op.adrsizes := [d16]; End; 2: Begin Case n Of{EAX..EDI} 0..3,6,7:setmod(0*64+n); 4:Begin { ESP} setmod(0 * 64 + 4); {SIB} setsib(64 * 0 + 8 * 4 + 4); End; 5: Begin { EBP} tip := 8; B := '0'; ponovifazu := True; End Else Greska := True; End; op.adrsizes := [d32]; End Else Greska := True; {ni 16 ni 32bit} End; End Else Begin n := EvaluirajBroj(A, greska); Deplasmani(op, n, False); If b32 Then Begin op.existv := [exdisp32]; setmod(0 * 64 + 5); End Else Begin op.existv := [exdisp16]; setmod(0 * 64 + 6); End End End;

Procedure OBrada8; { Slucaj [A+B]} Var n2, m: longint; Begin n := regcode(A, kind); {Samo registar} If n = -1 Then Begin Greska := True; exit End; Case kind Of 1: Begin op.adrsizes := [d16]; n2 := regcode(B, kind); If n2<>-1 Then Begin If kind <> 1 Then Greska := True Else {[bx+si],[bx+di],[bp+si],[bp+di]} If (n = 3) and (n2 = 6) Then setmod(0 * 64 + 0) Else If (n = 3) and (n2 = 7) Then setmod(0 * 64 + 1) Else If (n = 5) and (n2 = 6) Then setmod(0 * 64 + 2) Else If (n = 5) and (n2 = 7) Then setmod(0 * 64 + 3) Else Greska := True; End Else Begin m := 1;

n2 := EvaluirajBroj(B, greska); Deplasmani(op, n2, True); If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp16 in op.existv Then Begin m := 2; op.existv := [exdisp16] End Else Greska := True; Case n Of 3: setmod(m*64+7); {[bx+disp]} 5: setmod(m*64+6); {[bp+disp]} 6: setmod(m*64+4); {[si+disp]} 7: setmod(m*64+5); {[di+disp]} Else Greska := True; End; End; End; 2: Begin { U 32 bita dopusteno samo REG+const. Za REG+REG koristi REG*1 + REG} op.adrsizes := [d32]; n2 := regcode(B, kind); If n2<>-1 Then Begin Greska := True; exit End; n2 := EvaluirajBroj(B, greska); Deplasmani(op, n2, True); m := 1; If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32] End Else Greska := True; If n <> 4 Then setmod(m * 64 + n) Else Begin {ESP} setmod(m * 64 + 4); setsib(64 * 0 + 8 * 4 + 4); End End Else Greska := True; { Ni 16 ni 32} End; End;

Procedure OBrada9; { Slucaj [A*B]} Var sc: integer; Begin n := regcode(A, kind); If (kind<>2)or(n=1)or(n=4)or(n=-1) or (length(b) <> 1) or (not (b[1] in ['1','2','4', '8'])) Then Begin Greska := True; exit; End; op.adrsizes := [d32]; sc := pos(b[1], '1248') - 1; setmod(0 * 64 + 4); setsib(64*sc+8*n+5); { EBP specijalan} End;

Procedure OBrada10; { Slucaj [A+B+C]} Var n2, n3, m: longint; Begin n := regcode(A, kind); If(kind <> 1) or not (n in [3, 5]) Then Begin Greska := True; exit; End; n2 := regcode(B, kind); If (kind<>1) or not (n2 in [6, 7]) Then Begin Greska := True; exit; End; n3 := regcode(C, kind); If (n3<>-1) Then Begin Greska := True; exit; End; n3 := EvaluirajBroj(C, greska); op.adrsizes := [d16]; Deplasmani(op, n3, True); m := 1;

Page 176: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp16 in op.existv Then Begin m := 2; op.existv := [exdisp16] End Else Greska := True; If (n=3)and(n2=6)Then setmod(m*64+0) Else If (n=3)and(n2=7) Then setmod(m * 64 + 1) Else If (n = 5) and (n2 = 6) Then setmod(m * 64 + 2) Else If (n = 5) and (n2 = 7) Then setmod(m * 64 + 3) Else Greska := True; End;

Procedure OBrada11; { Slucaj [A*B+C]} Var sc, n2, m: longint; Begin n := regcode(A, kind); If (kind<>2)or(n=1)or(n=4)or(n = -1) or (length(b) <> 1) or (not (b[1] in ['1', '2', '4', '8'])) Then Begin Greska := True; exit; End; sc := pos(b[1], '1248') - 1; n2 := regcode(C, kind); op.adrsizes := [d32]; m := 1; If n2 = -1 Then Begin n2 := EvaluirajBroj(C, greska); Deplasmani(op, n2, True); If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32] End Else Greska := True; setmod(m * 64 + 4); setsib(64 * sc + 8 * n + 5); End Else Begin If kind <> 2 Then greska := True; If n2 = 5 Then Begin ponovifazu := True; tip := 13; D := '0'; exit End; setmod(0 * 64 + 4); setsib(64 * sc + 8 * n + n2); End; End;

Procedure OBrada13; { Slucaj [A*B+C+D]} Var sc, n2, n3, m: longint; Begin n := regcode(A, kind); If (n=-1)or(kind<>2)or(n=1)or(n=4) or (length(b) <> 1) or (not (b[1] in ['1','2','4', '8'])) Then Begin Greska := True; exit; End; sc := pos(b[1], '1248') - 1; n2 := regcode(C, kind); op.adrsizes := [d32]; If (n2 = -1) or (kind <> 2) Then Begin Greska := True; exit; End; n3 := regcode(D, kind); If (n3<>-1) Then Begin Greska := True; exit; End; n3 := EvaluirajBroj(D, greska); Deplasmani(op, n3, True); m := 1; If exdisp8 in op.existv Then Begin m := 1; op.existv := [exdisp8] End Else If exdisp32 in op.existv Then Begin m := 2; op.existv := [exdisp32]

End Else Greska := True; setmod(m * 64 + 4); setsib(64 * sc + 8 * n + n2); End;Begin {Parseop} tip := -1; Greska := False; op.datasizes := []; If progutaj('BYTE', arg) Then op.datasizes := [d8] Else If progutaj('DWORD', arg) Then op.datasizes := [d32] Else If progutaj('QWORD', arg) Then op.datasizes := [d64] Else If progutaj('TWORD', arg) Then op.datasizes := [d80] Else If progutaj('WORD', arg) Then op.datasizes := [d16]; dummyb := progutaj('PTR', arg); { Prva faza: Obrada raznih slucajeva operanda} arg := trim(arg); If length(arg) >= 3 Then If(arg[1]='''')and(arg[3]='''') Then arg := IntToStr(Ord(arg[2]), 10); If uzorak('[A*B+C+D]',arg)Then tip := 13 Else If uzorak('[A+B*C+D]',arg)Then tip:=14 Else If uzorak('[A+B+C*D]',arg)Then tip:=15 Else If uzorak('[A*B+C-D]',arg)Then tip:=16 Else If uzorak('[A+B*C-D]',arg)Then tip:=17 Else If uzorak('[A-B+C*D]',arg)Then tip:=18 Else If uzorak('[A*B-C+D]',arg)Then tip:=19 Else If uzorak('[A*B+C]',arg)Then tip:=11 Else If uzorak('[A+B+C]',arg)Then tip:=10 Else If uzorak('[A*B-C]',arg)Then tip:=20 Else If uzorak('[A+B-C]',arg)Then tip:=21 Else If uzorak('[A-B+C]',arg)Then tip:=22 Else If uzorak('[A+B*C]',arg)Then tip:=12 Else If uzorak('[A*B]',arg)Then tip:=9 Else If uzorak('[A+B]',arg)Then tip:=8 Else If uzorak('[A-B]',arg)Then tip:=23 Else If uzorak('A[B*C+D]',arg)Then tip:=5 Else If uzorak('A[B*C-D]',arg) Then tip:=24 Else If uzorak('A[B+C*D]',arg) Then tip:=6 Else If uzorak('A[B*C]',arg) Then tip:=4 Else If uzorak('A[B+C]',arg) Then tip:=3 Else If uzorak('A[B-C]',arg) Then tip:=25 Else If uzorak('A[B]',arg) Then tip:=2 Else If uzorak('[A]',arg) Then tip:=7 Else If uzorak('A',arg) Then tip:=1; If tip = -1 Then greska := True; If not (greska) Then Begin { Druga faza:Smanjivanje broja slucaja} Case tip Of 16: Begin D := '-' + D; tip := 13 End; 17: Begin D := '-' + D; tip := 14 End; 18: Begin B := '-' + B; tip := 15 End; 19: Begin C := '-' + C; tip := 13 End; 20: Begin C := '-' + C; tip := 11 End; 21: Begin C := '-' + C; tip := 10 End; 22: Begin B := '-' + B; tip := 10 End; 23: Begin B := '-' + B; tip := 8 End; 24: Begin D := '-' + D; tip := 5 End; 25: Begin C := '-' + C; tip := 3 End; End; A1 := A; B1 := B; C1 := C; D1 := D; Case tip Of 2: tip := 8; 3: tip := 10; 4: Begin a := b1; b := c1; c := a1; tip := 11; End; 5: Begin d := a1; c := d1; b := c1; a := b1; tip := 13; End; 6: Begin

d := a1; c := b1; a := c1; b := d1; tip := 13; End; 12: Begin c := a1; a := b1; b := c1; tip := 11; End; 14: Begin a := b1; b := c1; c := a1; d := d1; tip := 13; End; 15: Begin a := c1; b := d1; c := a1; d := b1; tip := 13; End; End; { Treca faza, deplasman na kraj} Case tip Of 8: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); If regcode(B, kind) in [3, 5] Then If kind = 1 {16 bit} Then zamijeni(A, B); End; 10: Begin If regcode(A, kind) = -1 Then zamijeni(A, C); If regcode(B, kind) = -1 Then zamijeni(B, C); If regcode(B, kind) in [3, 5] Then If kind = 1 {16 bit} Then zamijeni(A, B); End; 9, 11: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); End; 13: Begin If regcode(A, kind) = -1 Then zamijeni(A, B); If regcode(C, kind) = -1 Then zamijeni(C, D); End; End;{ Cetvrta faza, proracun deplasmana, slucaj A moze postati [A] ako je rijec o labeli, slucaj [A+B] moze postati [A] ako ni jedan nije registar } If tip = 8 Then Begin If (RegCode(A, kind) = -1) and (RegCode(B,kind)=-1) Then Begin If (A[1] in ['0'..'9']) and not (B[1] in ['0'..'9']) Then Begin patstr := B; End Else Begin dsp := A + '+' + B; ResolveDisp(A, unknown); ResolveDisp(B, unknown); patstr := dsp; A := IntToStr(EvaluirajBroj(A, greska) + EvaluirajBroj(B, greska), 10); End; B := ''; tip := 7; End; End; If tip = 1 Then Begin If not (progutaj('OFFSET', A)) Then If RegCode(A,kind)=-1 Then Begin dummy := EvaluirajBroj(A,greska); If Greska Then Begin {Trazi labl} po := nadjilabelu(A); If(po=-1)and(skok = False) Then tip := 7 { Pretpostavka} Else If labele[po].labtip=ldata Then Begin tip := 7; op.datasizes:= [labele[po].labdsize]; End; End End End; unknown := ''; Case tip Of 1: If pos(':', A) = 0 Then ResolveDisp(A, unknown); 7: ResolveDisp(A, unknown); 8: ResolveDisp(B, unknown); 10, 11: ResolveDisp(C, unknown); 13: ResolveDisp(D, unknown); End; greska := False; { Peta faza kalkulacija mod/rm, SIB i deplasmana } op.existv := []; op.adrsizes := []; repeat

Page 177: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

ponovifazu := False; Case tip Of 1: Obrada1; 7: Obrada7; 8: Obrada8; 9: Obrada9; 10: Obrada10; 11: Obrada11; 13: Obrada13; End; UNTIL not (ponovifazu); End; If greska Then parseop := False Else parseop := True;End;

Procedure ReadOpcodeTable;Var i, j: integer; f: Text; st: string; t: toptable;Begin maxopcode := 0; Assign(f, 'opcod.txt'); reset(f); While not EOF(f) Do Begin readln(f, st); maxopcode := maxopcode + 1; optable[maxopcode].instr := trim(copy(st, 1, 20)); optable[maxopcode].gencod := copy(st, 21, 20); End; For i := 1 To maxopcode - 1 Do For j := i + 1 To maxopcode Do If optable[i].instr > optable[j].instr Then Begin t := optable[i]; optable[i] := optable[j]; optable[j] := t; End;End;

Function Binsearch(instr: string): integer;Var high, j, low: integer;Begin low := 0; high := maxopcode; While high - low > 1 Do Begin j := (high + low) div 2; If instr<=optable[j].instr Then high:=j Else low := j End; If optable[high].instr=instr Then Binsearch:=high Else Binsearch := -1;End;{*******************}Function GenerateHexInstruction(inst: string; b32: boolean): string;Label postoji;Var labela, opcode, arg1, arg2, arg3, comb1, comb2,comb3, cf: string; op1, op2, op3: TOperand; p, i, j, k, n: integer; b1, greska, no67: boolean; g1, outstr, st, modif: string; modski, registarski: integer;

Procedure izdvoji(Var x:string;sep:char); Begin If st = '' Then Begin x := ''; exit End; p := pos(sep, st); If p > 0 Then Begin x := trim(copy(st, 1, p - 1)); st:=trim(copy(st,p+1,length(st)-p)); End Else Begin If sep = ':' Then x := '' Else Begin x := trim(st); st := ''; End End End; Procedure ClearOp(Var op: TOperand); Begin With op Do Begin existv := [];

datasizes := []; adrsizes := []; modrm := 0; sib := 0; disp8 := 0; disp16 := 0; disp32 := 0; segnum := 0; reg := 0; kind := 0; End; End; Function MakeOps(arg: string; VAR op: TOperand; Var rez: string): boolean; Begin If not(parseop(arg,op,b32))Then Begin Makeops := False; exit; End; If length(arg) <= 4 Then rez := copy(arg + ' ', 1, 4) Else rez := ''; If exsegment in op.existv Then Begin If exdisp16 in op.existv Then rez:= rez + 's:16'; If(exdisp32 in op.existv)and b32 Then rez := rez + 's:32'; End Else If exreg in op.existv Then Begin Case op.kind Of 0: rez := rez + 'reg8rgm8'; 1: rez := rez + 'rg16rm16'; 2: rez := rez + 'rg32rm32'; 3: rez := rez + 'creg'; 4: rez := rez + 'dreg'; 5: rez := rez + 'treg'; 6: rez := rez + 'segr'; 7: rez := rez + 'fpur'; 8: rez := rez + 'mmxr'; End; End Else Begin { Memorija ili neposredno} If exmodrm in op.existv Then Begin rez := rez + 'memg'; If op.datasizes = [] Then rez := rez + 'mem8mm16mm32mm64mm80rgm8rm16rm32rm64' Else Begin If d8 in op.datasizes Then rez := rez + 'mem8rgm8'; If d16 in op.datasizes Then rez := rez + 'mm16rm16'; If d32 in op.datasizes Then rez := rez + 'mm32rm32'; If d64 in op.datasizes Then rez := rez + 'mm64rm64'; If d80 in op.datasizes Then rez := rez + 'mm80rm80'; End; If b32 and (op.modrm = 5) Then rez := rez + 'ab32'; If not(b32) and (op.modrm = 6) Then rez := rez + 'ab16abs8'; End Else Begin rez := rez + 'immg'; If exdisp8 in op.existv Then rez := rez + 'ime8'; If exdisp16 in op.existv Then rez := rez + 'im16'; If exdisp32 in op.existv Then rez := rez + 'im32'; End End; MakeOps := True; End;

Function endian16(a: string): string; Begin endian16:=copy(a,3,2)+ copy(a, 1, 2); End; Function endian32(a: string): string; Begin endian32:=copy(a,7,2)+ copy(a, 5, 2) + copy(a, 3, 2) + copy(a, 1, 2); End; Function end1632(a:string;n:TDsize): string; Begin Case n Of d16: end1632 := Endian16(a); d32: end1632 := Endian32(a); Else end1632 := a; End; End; Procedure writemodrm(slobodni: integer); Var op: toperand;

mrm: byte; Begin If modski = 1 Then op := op1 Else If modski = 2 Then op := op2 Else greska := True; If slobodni = 8 Then Begin If registarski = 1 Then slobodni := op1.reg Else If registarski = 2 Then slobodni := op2.reg Else greska := True; End; mrm:=(op.modrm)and($C7)or(slobodni*8); outstr := outstr + inttohex(mrm, 2); If patstr<>''Then patstr:=patstr+' ' + IntToStr(pozicija[actseg] +length(outstr) div 2,10) + ' A'; If exSIb in op.existv Then outstr:=outstr + inttohex(op.sib, 2); If exdisp8 in op.existv Then outstr:=outstr+inttohex(op.disp8, 2) Else If exdisp16 in op.existv Then outstr := outstr + endian16(inttohex(op.disp16, 4)) Else If exdisp32 in op.existv Then outstr := outstr + endian32(inttohex(op.disp32, 8)); End;

Procedure writedisp(ex: texists); Var op: TOperand; Begin If (arg1<>'')and(ex in op1.existv) Then op := op1 Else If(arg2<>'')and(ex in op2.existv) Then op := op2 Else If(arg3<>'')and(ex in op3.existv) Then op := op3 Else greska := True; If patstr <> '' Then Begin patstr := patstr + ' ' + IntToStr(pozicija[actseg] + length(outstr) div 2, 10) + ' D'; op.disp32 := 0; {za coff} End; If ex = exdisp8 Then outstr:=outstr+ (inttohex(op.disp8,2)); If ex = exdisp16 Then outstr := outstr + endian16(inttohex (op.disp16, 4)); If ex = exdisp32 Then outstr := outstr + endian32(inttohex( op.disp32, 8)); End;

Procedure writeseg; Begin outstr := outstr + endian16(inttohex( op1.segnum, 4)); End; Procedure writerel(offs:longint; ex: texists); Var op: TOperand; Function test(a,min,max:integer): integer; Begin If (a < min) or (a > max) Then greska := True; test := a; End; Begin If (arg1 <> '') Then op := op1 Else If (arg2 <> '') Then op := op2 Else If (arg3 <> '') Then op := op3 Else greska := True; If ((op.disp32 = 0) and (prolaz = 1)) or (op.disp32 = -1) Then op.disp32 := offs; If patstr<>'' Then patstr := patstr + ' ' + IntToStr(pozicija[actseg] + length(outstr) div 2, 10) + ' R'; If ex = exdisp8 Then outstr := outstr + {malo drugacije jer je rijec o razlici} (inttohex(test(op.disp32 - offs, - 128, 127), 2)); If ex = exdisp16 Then outstr := outstr + endian16(inttohex(test(op.disp32 - offs, - 32768, 32767), 4)); If ex = exdisp32 Then outstr := outstr + endian32(inttohex(op.disp32-offs,8));

Page 178: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

End;

Function dod(n: integer): integer; Begin dod := (length(outstr) div 2) + n; End; Procedure prefix(pr, cod: string); Begin If progutaj(pr,st)Then outstr := outstr + cod; End; Procedure modifikator(pr: string); Begin If progutaj(pr,st)Then modif:='_' + pr; End; Function ispseudo(x: string): boolean; Begin x := copy(x, 1, 3); If (x='DB ')or(x='DW ')or(x = 'DD ')Or (x='DQ ')or(x='DT ') Then Begin ispseudo := True End Else ispseudo := False; End;

Function posnostr(bb: char; s1: string): integer; Var odsijeci, ustringu: boolean; i: integer; Begin i := 1; odsijeci := False; ustringu := False; While not (odsijeci) Do Begin If i>length(s1) Then odsijeci := True Else Begin If s1[i] = chr(39) Then ustringu := not (ustringu); If not(ustringu)and(s1[i]=bb) Then odsijeci := True Else i := i + 1; End; End; If i <= length(s1) Then posnostr := i Else posnostr := 0; End;

Procedure StrToFloat2(tekstime: string; ValueType: char); Label WriteNum, GetExponent, DivExp; Const CWNear: word = $133F; DCon10: integer = 10; Var Temp: integer; CtrlWord: word; Brojac,DecCifara, Exponent, i: integer; Negative, ExpNegative: boolean; Begin Brojac := 1; If length(tekstime) = 0 Then exit; While tekstime[Brojac] = ' ' Do Begin Brojac := Brojac + 1; If brojac>length(tekstime) Then exit; End; ExpNegative := False; Negative := False; DecCifara := 0; If tekstime[Brojac] = '+' Then Brojac := Brojac + 1 Else If tekstime[Brojac]='-'Then Begin Brojac := Brojac + 1; Negative := True; End; If brojac > length(tekstime) Then exit; If not (tekstime[Brojac] in ['0'..'9', '.']) Then exit; asm FSTCW CtrlWord FCLEX FLDCW CWNear FLDZ End; While tekstime[Brojac] in ['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); asm FIMUL DCon10 FIADD Temp End; Brojac := Brojac + 1; End; If brojac > length(tekstime) Then Goto writenum; If tekstime[Brojac] = '.' Then Brojac := Brojac + 1 Else If tekstime[Brojac]in['e','E']Then

Goto GetExponent; If brojac > length(tekstime) Then Goto writenum; While tekstime[Brojac]in['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); asm FIMUL DCon10 FIADD Temp End; Brojac := Brojac + 1; DecCifara := DecCifara + 1; End; Exponent := -DecCifara; If brojac>length(tekstime)Then Goto DivExp; If not(tekstime[Brojac]in['e','E'])Then Goto DivExp; Brojac := Brojac + 1; If tekstime[Brojac] = '+' Then Brojac := Brojac + 1 Else If tekstime[Brojac]='-'Then Begin Brojac := Brojac + 1; ExpNegative := True; End; If brojac > length(tekstime) Then Goto writenum;GetExponent: Exponent := 0; While tekstime[Brojac] in ['0'..'9'] Do Begin Temp:=Ord(tekstime[Brojac])-Ord('0'); Exponent := Exponent * 10 + temp; Brojac := Brojac + 1; End; If ExpNegative Then Exponent := -Exponent; Exponent := Exponent - DecCifara;DivExp: If Exponent > 0 Then For i := 1 To Exponent Do Begin asm FIMUL DCon10 End; End Else For i := 1 To -Exponent Do Begin; asm FIDIV DCon10 End End; If Negative Then asm FCHS End;writenum: Case ValueType Of 'T': asm FSTP TBYTE PTR FPValue End; 'Q': asm FSTP QWORD PTR FPValue End; 'D': asm FSTP DWORD PTR FPValue End; End; End;

Procedure dopseudo; Var sz, p, d: integer; dsz: TDSize; bajtovi, element: string; Procedure putdb(Var vr: string); Var i, j, puta: integer; Begin d := pos('DUP(', vr); If d > 0 Then Begin puta:=EvaluirajBroj(trim(copy(vr, 1,d-1)), greska); vr:=trim(copy(vr,d+4,pos(')', vr) – d - 4)); End Else puta := 1; pozicija[actseg]:=pozicija[actseg] + (length(outstr) div 2); UpisiIzlaz(outstr); outstr := ''; For i := 1 To puta Do Begin If (vr[1] = chr(39)) and (vr[length(vr)] = chr(39)) and (opcode[2] = 'B') Then Begin For j := 2 To length(vr) - 1 Do Begin outstr := outstr +inttohex( Ord(vr[j]), 2); End; End Else Begin

If pos('.', vr) > 0 Then Begin StrToFloat2(vr, opcode[2]); For j := 1 To sz div 2 Do outstr := outstr + IntTohex( Ord(FPValue[j]), 2); End Else outstr := outstr + end1632( Inttohex(EvaluirajBroj(vr, greska), sz), dsz); End; If i <> puta Then Begin pozicija[actseg]:=pozicija[actseg] +(length(outstr) div 2); UpisiIzlaz(outstr); outstr := ''; End End End; Begin opcode := copy(opcode, 1, 3); Case opcode[2] Of 'B': Begin sz := 2; dsz := d8 End; 'W': Begin sz := 4; dsz := d16 End; 'D': Begin sz := 8; dsz := d32 End; 'Q': Begin sz := 16; dsz := d64 End; 'T': Begin sz := 20; dsz := d80 End; Else Begin sz := 2; dsz := d8 End; End; If labela <> '' Then UpisiLabelu(labela, pozicija[actseg], ldata, dsz); bajtovi := trim(copy(inst, pos(opcode, inst) + 3,length(inst))); While (posnostr(',', bajtovi) > 0) Do Begin p := posnostr(',', bajtovi); element:=trim(copy(bajtovi,1,p-1)); bajtovi := trim(copy(bajtovi, p + 1, length(bajtovi))); putdb(element); End; If bajtovi <> '' Then putdb(bajtovi); If greska Then outstr := ''; End;Begin {Generate Hex instruction} p := posnostr(';', inst); If p > 0 Then inst := copy(inst, 1, p - 1); st := inst; outstr := ''; prefix('ES:', '26'); prefix('CS:', '2E'); prefix('SS:', '36'); prefix('DS:', '3E'); prefix('FS:', '64'); prefix('GS:', '65'); prefix('REP ', 'F3'); prefix('REPE ', 'F3'); prefix('REPNE ', 'F2'); prefix('REPZ ', 'F3'); prefix('REPNZ ', 'F2'); prefix('LOCK ', 'F0'); modif := ''; modifikator('NEAR'); modifikator('FAR'); izdvoji(labela, ':'); izdvoji(opcode, ' '); izdvoji(arg1, ','); izdvoji(arg2, ','); izdvoji(arg3, ';'); If pos(' ', labela) > 0 Then Begin { JMP , CALL A:B} arg1 := copy(labela,pos(' ',labela)+1, length(labela)) + ':' + opcode; opcode := copy(labela, 1, pos(' ', labela) - 1); End; opcode := opcode + modif; If ispseudo(arg1) Then Begin labela := opcode; opcode := arg1; End; If ispseudo(opcode) Then Begin DoPseudo; GenerateHexInstruction := outstr; Exit; End; b1 := True;

Page 179: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

skok := False; If length(opcode) > 1 Then If(opcode[1]='J')or(opcode='CALL') Then skok := True; If (labela <> '') and (prolaz = 1) Then Begin UpisiLabelu(labela, pozicija[actseg], lprog, d32); End; If opcode = '' Then Begin GenerateHexInstruction := 'XX'; exit; End; ClearOp(op1); ClearOp(op2); ClearOp(op3); If arg1 <> '' Then b1 := Makeops(arg1, op1, comb1); If arg2 <> '' Then b1 := b1 and Makeops(arg2, op2, comb2); If arg3 <> '' Then b1 := b1 and Makeops(arg3, op3, comb3); If not (b1) Then greska := True; If (arg1='')and(arg2='')and(arg3='') Then Begin n := binsearch(opcode); If n<>-1 Then Goto postoji; End; If (arg1<>'')and(arg2='')and(arg3='')Then For i := 1 To length(comb1) div 4 Do Begin st := opcode; st:=st+' '+ TRIM(copy(comb1,(I-1)*4+ 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; If (arg2 <> '') and (arg3 = '') Then For i := 1 To length(comb1) div 4 Do For j := 1 To length(comb2) div 4 Do Begin st := UPPERCASE(opcode); st := st + ' ' + TRIM(copy( comb1, (I - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb2, (j - 1) * 4 + 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; If arg3 <> '' Then For i := 1 To length(comb1) div 4 Do For j := 1 To length(comb2) div 4 Do For k:=1 To length(comb3) div 4 Do Begin st := UPPERCASE(opcode); st := st + ' ' + TRIM(copy( comb1, (I - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb2, (j - 1) * 4 + 1, 4)); st := st + ',' + TRIM(copy( comb3, (K - 1) * 4 + 1, 4)); n := binsearch(st); If n<>-1 Then Goto postoji; End; greska := True; GenerateHexInstruction := ''; exit;postoji: g1 := Optable[n].gencod; no67 := True; If (copy(g1, 1, 3) = 'o16') and b32 Then outstr := outstr + '66'; If(copy(g1,1,3)='o32') and not (b32) Then outstr := outstr + '66'; If ((copy(g1, 1, 3) = 'a16') and b32) or ((copy(g1,1,3)='a32')and not(b32)) Then Begin outstr := outstr + '67'; no67 := False; End; If G1[1] <> ' ' Then g1 := copy(g1, 4, length(g1)); g1 := trim(g1) + ' '; modski := 0; registarski := 0; For i := 1 To length(g1) div 3 Do Begin If (arg1<>'')and(arg2<>'')Then Begin If (exmodrm in op1.existv) Then modski := 1; If (exmodrm in op2.existv) Then modski := 2; If (exreg in op1.existv) Then registarski := 1; If (exreg in op2.existv) Then registarski := 2; If (exmodrm in op1.existv) and

(exreg in op2.existv) Then Begin modski := 1; registarski := 2; End; If (exmodrm in op2.existv) and (exreg in op1.existv) Then Begin modski := 2; registarski := 1; End; End; If (arg1 <> '')and(arg2='') Then Begin If (exmodrm in op1.existv) Then modski := 1; If (exreg in op1.existv) Then registarski := 1; End; If g1[i * 3] = ' ' Then Begin cf := copy(g1, i * 3 - 2, 2); If cf = '/r' Then Begin writemodrm(8); End Else If(cf>='/0')and(cf<= '/9') Then Begin writemodrm(Ord(cf[2]) - Ord('0')); End Else If cf = 'ib' Then Begin writedisp(exdisp8); End Else If cf = 'sw' Then Begin writedisp(exdisp16); writeseg; End Else If cf = 'sd' Then Begin writedisp(exdisp32); writeseg; End Else If (cf = 'iw') or ((cf = 'o?') and not (b32)) Then Begin writedisp(exdisp16); End Else If (cf = 'id') or ((cf = 'o?') and (b32)) Then Begin writedisp(exdisp32); End Else If cf = 'rb' Then Begin writerel(pozicija[actseg] + dod(1), exdisp8); End Else If (cf = 'rw') or ((cf = 'r?') and not (b32)) Then Begin writerel(pozicija[actseg] + dod(2), exdisp16); End Else If (cf = 'rd') or ((cf = 'r?') and b32) Then Begin writerel(pozicija[actseg] + dod(4), exdisp32); End Else If(cf<>'rg')and(cf<>'cc') Then outstr := outstr + cf End; If g1[i * 3] = '+' Then Begin If copy(g1,i*3+1,2)='rg' Then Begin If exreg in op1.existv Then n := op1.reg Else If exreg in op2.existv Then n := op2.reg Else greska := True; outstr := outstr + Inttohex(evaluirajbroj('0' + copy(g1, i * 3 - 2, 2) + 'h', greska) + n, 2); End; End; End; If no67 Then Begin If b32 and (d16 in op1.adrsizes + op2.adrsizes) Then outstr := '67' + outstr; If not (b32) and (d32 in op1.adrsizes + op2.adrsizes) Then outstr := '67' + outstr; End; If not (greska) Then GenerateHexInstruction := outstr Else GenerateHexInstruction := '';End;

Procedure Glavni;Var inst, outst, par: string; opt: boolean; i: integer; Procedure ac(n: integer);

Begin actseg := n; inst := ''; End;Begin opt := True; {32 bit } If ParamStr(2) = '/d' Then opt := False; If ParamStr(2) = '/w' Then opt := True; par := uppercase(ParamStr(1)); If pos('.ASM', par) > 0 Then par:=copy(par,1,pos('.ASM', par) - 1); Assign(ulaz, ParamStr(1)); Assign(izlazcode, par + '.cod'); Assign(izlazdata, par + '.dat'); Assign(izlazstack, par + '.sta'); Assign(izlazlab, par + '.lab'); Assign(izlazpat, par + '.pat'); prolaz := 1; While prolaz <= 2 Do Begin reset(ulaz); If opt Then pozicija[1] := 0 Else pozicija[1] := 256; pozicija[2] := 0; pozicija[3] := 0; actseg := 1; If prolaz = 2 Then Begin rewrite(izlazcode); rewrite(izlazdata); rewrite(izlazstack); rewrite(izlazlab); rewrite(izlazpat); End; While not EOF(ulaz) Do Begin readln(ulaz, inst); inst := trim(inst); If inst = '.CODE' Then ac(1); If inst = '.DATA' Then ac(2); If inst = '.STACK' Then ac(3); If (inst = '.486') or (inst = 'OPTION CASEMAP:NONE') or (inst = '.MODEL FLAT,STDCALL') or (inst = '.386') Then inst := ''; If (uppercase(copy(inst,1,5))= 'EXTRN') Then Begin inst := inst + ':'; upisilabelu(trim(copy(inst, 6, pos(':', inst) - 6)), - 1, lextrn, d32); inst := ''; End; If (uppercase(copy(inst, 1, 6) ) = 'PUBLIC') Or uppercase(copy(inst, 1, 3)) = 'END') Then Begin If prolaz = 2 Then writeln(izlazlab, inst); inst := ''; End; If inst <> '' Then Begin patstr := ''; outst := GenerateHexInstruction( inst, opt); If outst = '' Then Begin Writeln('Greska u liniji ', inst) End Else If outst <> 'XX' Then Begin pozicija[actseg] := pozicija[actseg] + (length(outst) div 2); If(prolaz=2)and(patstr<>'') Then writeln(izlazpat, patstr); UpisiIzlaz(outst); End; End End; prolaz := prolaz + 1; End; For i := 1 To brlabela Do With labele[i] Do writeln(izlazlab, labime, ' ', Ord(labtip),' ', labval, ' ', Ord(labdsize)); Close(ulaz); Close(izlazcode); Close(izlazdata); Close(izlazstack); Close(izlazlab); Close(izlazpat);End;

Begin readopcodetable; Glavni;End.

Page 180: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

18.PRAVLJENJE STANDARDNOG OBJ FORMATA

Mašinski kod generisan asemblerom iz prethodnog poglavlja je upotrebljiv za situacije kada se piše novi operativni sistem ili kada se koristi vrlo jednostavan operativni sistem kao što su CP/M ili MS DOS.

Moćniji operativni sistemi imaju znatno složeniju strukturu izvršnog programa. Složeni projekti zahtijevaju da se programi sastoje iz više izvornih datoteka koje se separatno kompajliraju i zatim spajaju u jedinstveni izvršni format.

18.1. Objektni formatiObjektni modul je izlaz iz asemblera ili kompajlera. Njegove primarne komponente su mašinski kod i podaci koje

procesor može da razumije.

Za operativni sistem Windows koriste se dva standarda (sa svojim varijacijama) od kojih oba imaju istu ekstenziju OBJ. Jedan od ovih standarda je COFF (korišten u Microsoftovim kompajlerima) a drugi je OMF (korišten na šesnaestobitnim operativnim sistemima, ali i sa Borlandovim kompajlerima na tridesetdvobitnim verzijama Windowsa). COFF format se javlja u dvije podvarijante, Microsoftov i GNU.

18.2. Objektni format Microsoft COFFCOFF objektni format razvijen je u okviru besplatnog GNU C kompajlera, a koristi ga i Microsoft u svojim

kompajlerima za C, uz malu razliku u metodi relokacije koda. Osobina formata je da se njegov sadržaj dijeli na sekcije koje služe za grupisanje koda i podataka. Pored sekcija, u objektnoj datoteci postoje razne tabele (simbola, relokacije i linijskih brojeva). Struktura ovog formata data na slici Sl. 18.2.1:Struktura Lokacija? NamjenaZaglavlje datoteke Početak datoteke Opis datoteke, podaci o drugim sekcijamaOpciono zaglavlje Odmah iza zaglavlja datoteke Za EXE datoteke, pozicija inicijalnog

programskog brojačaZaglavlje sekcije Iza opcionog zaglavlja èija je

veličina navedena u zaglavlju Lokacija i veličina sekcija koda, podataka i specijalne namjene

Podaci sekcije Navedeni u zaglavlju sekcije Sadrži kod i podatke programaSekcijske direktive Navedeno u zaglavlju sekcije Sadrži informacije o popravkama potrebne

prilikom relociranja sekcijeLinijski brojevi Navedeno u zaglavlju sekcije Čuva sve linijske brojeve, potrebno debageruTabela simbola Navedeno u zaglavlju datoteke Za svaki simbol (varijable, potprogrami) čuva se

po jedno mjestoTabela stringova Iza tabele simbola Imena simbola koja su duža od 8 bajtova. Prva

èetiri bajta su dužina tabele.Sl. 18.2.1. Struktura COFF OBJ datoteke

18.3. Zaglavlje COFF OBJ datoteke

TFileHeader= Record Machine:word; { 014C (i386) } NumberOfSections: word; { 0003 } TimeDateStamp: LongInt; { 41543009 -> Fri Sep 24 16:32:41 2004 } PointerToSymbolTable: LongInt; NumberOfSymbols:LongInt; SizeOfOptionalHeader:word; Characteristics:word; end;

Ova struktura je uvijek na početku datoteke. Njeni elementi su

Machine – Magični broj. Ova konstanta mora biti jednaka 0x14C i ona služi za raspoznavanje ovog formata.

NumberOfSections – Koliko ima sekcija i samim tim sekcijskih zaglavlja. Konvertor u OBJ koji se razvija u ovom poglavlju ima tri sekcije, .text, .data i .drectve

TimeDateStamp -Vrijeme i datum datoteke

PointerToSymbolTable – Pozicija u datoteci poèetka tabele simbola

NumberOfSymbols - Broj simbola u tabeli simbola.

SizeOfOptionalHeader – Veličina opcionog zaglavlja. OBJ koji se generiše u ovom programu nema opciono zaglavlje, pa će ovaj parametar biti jednak nuli

Page 181: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Characteristics - flag bits

Ovi flegovi definišu dodatno značenje zaglavlja:

Bit Oznaka Značenje

$0001 F_RELFLG Ako je postavljen tada nema relokacijskih informacija. Najèešæe se relokacijske informacije ukljuèuju u OBJ, a ne u EXE.

$0002 F_EXEC Ako je postavljen, znaèi da nema nerazriješenih simbola i da se može smatrati izvršnim programom

$0004 F_LNNO Ako je postavljen datoteka nema linijskih brojeva

$0008 F_LSYMS Ako je postavljen, datoteka nema lokalnih simbola

$0100 F_AR32WR Ako je postavljen, znaèi da je format Little Endian

18.4. Opciono zaglavljeOpciono zaglavlje se nalazi odmah iza glavnog zaglavlja. Ono se javlja samo u EXE programima. Njegova svrha je

da definiše ulaznu taèku u program. Kako ovaj konvertor generiše samo OBJ, opcionog zaglavlja nema.TOptionalFileHeader= Record MagicWord:word; { Type of file } Vstamp: word; { Version } TSize: LongInt; { Text size in bytes } DSize: LongInt; { Initialized data size in bytes } BSize: LongInt; { Uninitialized data size in bytes } Entry: LongInt; { Entry point } Text_Start: LongInt; { Base of text used for this file } Data_Start: LongInt; { Base of text used for this file }end;

Ako ima opcionog zaglavlja, samo dva polja su bitna

MagicWord – Magični broj, uvijek ZMAGIC (0x010b).

Entry – Ulazna tačka: Inicijalna pozicija programskog brojaèa (EIP)

18.5. Zaglavlje coff sekcije TSection=Record Name:array[0..7] of char; { section name in ASCII .text .data ili .drectve } PhysicalAddress:Longint; { size mapped into memory } VirtualAddress:Longint; { memory address relative to image base } SizeOfRawData:Longint; { physical size, multiple of file alignment } PointerToRawData:Longint; { file offset } PointerToRelocations:LongInt; { offset of relocation entries } PointerToLinenumbers:LongInt; { offset of line number entries } NumberOfRelocations:word; { number of relocation entries } NumberOfLinenumbers:word; { number of line number entries } Characteristics:Cardinal; { $20 = text, $40 = data, $80 = bss, $200 = no-load, $800 = don't link, $10000000 = shared, $20000000 = execute, $40000000 = read, $80000000 = write } end;

Ova struktura se nalazi neposredno iza opcionalnog zaglavlja u COFF datoteci (ili iza zaglavlja datoteke ako opcionalnog zaglavlja nema). Znaèenja polja su:

Name – Ime sekcije, ne smije biti duže od osam znakova i završava se nulom. Ako je taèno osam znakova tada nema krajnje nule. Ako je kraæe od osam znakova, ostali se popunjavaju nulama.

PhysicalAddress – Fizička adresa sekcije. To je adresa gdje će se sekcija učitati u memoriju. Za linkovane izvršne programe, to je apsolutna adresa u programskom podruèju. Za nepovezane objekte, ova adresa je relativna u odnosu na adresni prostor objekta, to jest prva sekcija je uvijen na adresi nula.

VirtualAddress - Virtualna adresa sekcije, nula ili jednaka PhysicalAddress

SizeOfRawData – Veličina sekcije. Broj bajtova podataka smještenih u datoteku za ovu sekciju. Ovdje nisu uraèunate relokacione tabele i linijski brojevi, nego samo čisti kod odnosno podaci.

PointerToRawData – Pokazivaè na podatke sekcije. Sadrži poziciju poèetka sekcije u datoteci.

Page 182: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

PointerToRelocations - Pozicija relokacijske tabele u datoteci

PointerToLineNumbers -Pozicija linijskih brojeva

NumberOfRelocations - Broj elemenata relokacijske tabele. Pažnja: ovaj broj je ogranièen na 65535

NumberOfLineNumbers - Broj elemenata tabele linijskih brojeva. Pažnja: ovaj broj je ogranièen na 65535

Characteristics - flag bits. Ovi flegovi daju dodatne informacije za svaku sekciju.

$0020 STYP_TEXT Ako je postavljen, sekcija sadrži samo izvršni kod

$0040 STYP_DATA Ako je postavljen, sekcija sadrži samo inicijalizirane podatke

$0080 STYP_BSS Ako je postavljen, sekcija sadrži samo neincijalizirane podatke i nema dijela sa podacima u COFF datoteci

Microsoftovi kompajleri smještaju mašinski kod u sekciju .text, a podatke u sekciju .data. Ova imena nemaju posebno značenje osim kao napomena za namjeru upotrebe date sekcije. Drugi kompajleri imaju drugačija imena za svoje sekcije. Sekcije imaju sličnosti sa segmentima koji su korišteni pod MS DOSom ili Windowsom 3.1. Imena najčešće korištenih sekcija data su na slici:

.text Machine code instructions..data Initialized data..rdata Read only data. OLE GUIDs are stored here, among other things..rsrc Resources. Produced by the resource compiler, and placed into RES files. Linker copies

it to the executable..reloc Base relocations. Produced by the linker. Not found in OBJs..edata The exported function table. Created by the linker and placed in an EXP file. Linker

copies it to the executable..idata Imported function table in an executable file..idata$XXX Portions of an imported function table. The librarian creates these sections in an import

library. The linker combines them into the final .idata section in the executable..CRT Tables of initialization and shutdown pointers in the executable that are used by the

Microsoft C++ runtime library..CRT$XXX Initialization and shutdown pointers in OBJs, prior to the linker combining them in the

executable..bss Uninitialized data..drectve OBJ file section containing linker directives. Not copied to executable..debug$XXX

COFF symbol table information in an OBJ file.

Sl. 18.5.1. Standardne sekcije u OBJ i EXE datotekama

18.6. Relokacijska sekcija

TRelocationTable=record r_vaddr:Longint; { address of relocation } r_symndx:Longint; { symbol we're adjusting for } r_type:Longint; { type of relocation } end;

Veličina ove strukture nije djeljiva sa četiri, pa treba biti oprezan prilikom njenog upisa u datoteku. Normalno se pojavljuju dva tipa relokacija:

RELOC_ADDR32 6 Relociraj 32-bitnu apsolutnu referencu

RELOC_REL32 20 Relociraj a 32-bitnu relativnu referencu

Za svaku relokaciju mora se odrediti nova adresa relociranog simbola koji se prilagođava. Ako je simbol drugi objekt (eksterni), tabela će sadržati referencu na taj eksterni simbol i relokacija æe se odnositi na njega. Ako je simbol u istom objektu, tabela simbola će sadržati elemente koji se odnose na same sekcije (uvijek prisutni i uvijek privatni). Kada se relocira sama sekcija, ovi simboli će prikazati njihovu novu lokaciju.

Page 183: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

1. RELOC_ADDR32

Da se izvrši ova relokacija, moraju se izvesti sljedeæi koraci:

Uzeti adresu simbola na koji se referiše

Dodati vrijednost koja se trenutno nalazi na toj lokaciji

Upisati vrijednost nazad

2. RELOC_REL32

Ova relokacija se dešava samo u izvršivim programima i odnosi se samo na eksterne simbole. Za realizaciju ove relokacije, moraju se obaviti sljedeći koraci:

Uzeti adresu simbola na koji se referiše

Dodati vrijednost koja se trenutno nalazi na toj lokaciji

Oduzeti adresu poèetka sekcije

Pridodati originalnu adresu poèetka ove sekcije (normalno je ona 0, pošto su .text sekcija obièno na poèetku, a samo kod njih postoji ovaj vid relokacije)

Upisati vrijednost nazad

18.7. COFF: Linijski brojevi

TlineNumbers=Record e:record case Boolean of true: (l_symndx: Longint); { function name symbol index } false: (l_paddr:Longint); { address of line number } end; l_lnno:word; { line number }end;

Izvršne sekcije mogu da imaju linijske brojeve, koji su korisni za debagere. Linijski brojevi, međutim, neće biti obrađeni u konvertoru jer informacija o brojevima linija programa u FILDZAN-32 nije bila ugraðena u asemblersku datoteku.

18.8. COFF: Tabela simbola

TSymbolTable=record e:record case Boolean of true: (e_name:Array[0..7] of char); false: (e1:record e_zeroes:Longint; e_offset:Longint; end); end; e_value:Longint; e_scnum:Word; e_type:Word; e_sclass:Byte; e_numaux:Byte; end;

Tabela simbola je najkompleksniji dio objektne COFF datoteke, jer ima mnogo tipova simbola. Tabela simbola ima ulaze za sve simbole i metasimbole, ukljuèujuæi javne, statičke eksterne, sekcijske i debagerske simbole.

e.e_name – Ugniježdeno ime simbola

Ako je ime simbola manje ili jednako od 8 znakova, ono se smješta u ovo polje. Ime dugaèko taèno osam znakova se ne završava nulom. Treba primijetiti da se ovo polje memorijski preklapa sa poljem e_zeroes i e_offset

e.e.e_zeroes - flag to tell if name is inlined

Ako je e_zeroes jednak nuli, ime je duže od osam znakova i nalazi se u tabeli stringova.

e.e.e_offset - offset of name in string table

Ako je e_zeroes jednak nuli, ovo polje sadrži položaj imena simbola u tabeli stringova.

Page 184: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

e_value – Vrijednost simbola. Na primjer, ako simbol predstavlja funkciju, ovdje je data adresa funkcije. Značenje ove vrijednosti zavisi od tipa simbola (ispod)

e_scnum – Broj sekcije

Broj sekcije kojoj pripada ovaj simbol. Prva sekcija u tabeli sekcija je sekcija br. 1. Pored ovoga, e_scnum može imati i sljedeće vrijednosti:

N_UNDEF 0 An undefined (extern) symbolN_ABS -1 An absolute symbol (e_value is a constant, not an address)N_DEBUG -2 A debugging symbol

e_type – Tip simbola. Ovaj tip simbola je sastavljen od baznog i izvedenog tipa. Na primjer, "pointer to int" je "pointer to T" i "int". Type Bits MeaningT_NULL ---- 0000 No symbolT_VOID ---- 0001 void function argument (not used)T_CHAR ---- 0010 characterT_SHORT ---- 0011 short integerT_INT ---- 0100 integerT_LONG ---- 0101 long integerT_FLOAT ---- 0110 floating pointT_DOUBLE ---- 0111 double precision floatT_STRUCT ---- 1000 structureT_UNION ---- 1001 unionT_ENUM ---- 1010 enumerationT_MOE ---- 1011 member of enumerationT_UCHAR ---- 1100 unsigned characterT_USHORT ---- 1101 unsigned shortT_UINT ---- 1110 unsigned integerT_ULONG ---- 1111 unsigned longT_LNGDBL ---1 0000 long double (special case bit pattern)DT_NON --00 ---- No derived typeDT_PTR --01 ---- pointer to TDT_FCN --10 ---- function returning TDT_ARY --11 ---- array of T

e_sclass – Klasa smještaja

Ovo polje označava gdje se simbol nalazi i šta predstavlja

Class Value MeaningC_NULL 0 No entryC_AUTO 1 Automatic variableC_EXT 2 External (public) symbol - this covers globals and externsC_STAT 3 static (private) symbolC_REG 4 register variableC_EXTDEF 5 External definitionC_LABEL 6 labelC_ULABEL 7 undefined labelC_MOS 8 member of structureC_ARG 9 function argumentC_STRTAG 10 structure tagC_MOU 11 member of unionC_UNTAG 12 union tagC_TPDEF 13 type definitionC_USTATIC 14 undefined staticC_ENTAG 15 enumaration tagC_MOE 16 member of enumerationC_REGPARM 17 register parameterC_FIELD 18 bit fieldC_AUTOARG 19 auto argumentC_LASTENT 20 dummy entry (end of block)C_BLOCK 100 ".bb" or ".eb" - beginning or end of blockC_FCN 101 ".bf" or ".ef" - beginning or end of functionC_EOS 102 end of structureC_FILE 103 file nameC_LINE 104 line number, reformatted as symbolC_ALIAS 105 duplicate tagC_HIDDEN 106 ext symbol in dmert public libC_EFCN 255 physical end of function

e_numaux – Broj pomoćnih elemenata.

Uz svaki simbol se mogu pridodati dodatni podaci koji se takođe nalaze u tabeli simbola. Za većinu simbola ovaj element je 0. Ipak, kod nekih simbola (npr. ime datoteke) dodatni podaci mogu slijediti i oni se tada preklapaju sa uobičajenim poljima tabele simbola.

18.9. COFF: Tabela stringova

Page 185: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Tabela stringova sadrži imena stringova koja su prevelika da stanu u tabelu simbola. Tabela je organizovana tako da na samom početku se nalaze četiri bajta koja predstavljaju njenu dužinu. Nakon toga redom slijede sami stringovi završeni znakom 0.

18.10. Program konvertorNakon što je objašnjena struktura COFF formata slijedi razvoj konvertora. Asembler je generisao program, podatke,

labele, popravke i stek (koji se ne koristi u generatoru OBJ) u posebnim datotekama. Datoteke sa programom i podacima se mogu direktno iskopirati u objektnu datoteku, dok je za uključivanje labela u popravki potrebna konverzija formata.

Prema redoslijedu koji zahtijeva COFF obje format, kao i potrebnim dobivanjem jednih podataka iz drugih, program treba da uradi sljedeće:

Učita veličinu datoteka sa kodom i podacima (procedura ReadSizes)

Napuni tabelu simbola, (Procedura LoadLabels) iz datoteke sa ekstenzijom .LAB. Pored ovoga se generišu simboli .file, .text, .data i .drectve, koji imaju pomoćne simbole. U pomoćnom simbolu iza simbola .file se smještaju ime datoteke s izvornim kodom, a u ostala tri početak istoimenog segmenta. Prilikom punjenja ove tabele se puni i tabela stringova za sva imena koja su duža od 8 znakova.

Učita tabelu relokacije. (Procedure LoadRelocs) Iz datoteke sa ekstenzijom .PAT se učitaju oni elementi koji zadovoljavaju koji zadovoljavaju jedan od sljedećih uslova:

a) Da su u pitanju apsolutne relokacije podataka ili koda (tipovi ‘D’ i ‘A’ unutar .PAT datoteke), što se dalje realizuje relokacijskim tipom RELOC_ADDR32

b) Da su u pitanju relativne relokacije koda, a da je riječ o eksternim simbolima (tip ‘R’ unutar .PAT datoteke), što se dalje realizuje relokacijskim tipom RELOC_REL32

Otvori datoteku sa OBJ ekstenzijom (Procedura OpenOutObj)

U Obj datoteku upiše zaglavlje u koje je u međuvremenu upisan broj elemenata u svim tabelama (Procedura WriteObjHeader)

Generišu se i upišu u OBJ zaglavlja sekcija (WriteSectionHeaders)

Generiše se .text sekcija (CopyCodeSection) iz .COD datoteke, prebacivši cijeli sadržaj .COD datoteke

Upiše se u OBJ relokacijska tabela (WriteRelocations)

Generiše se .data sekcija (CopyDataSection) iz .DAT datoteke, prebacivši cijeli sadržaj .DAT datoteke

Generiše se .drectve sekcije (WriteStartupSection) upisivanjem imena labele koja je bila navedena iza podatka END u tabeli labela.

Upišu se u izlaznu datoteku svi simboli iz tabele simbola (WriteSymbols)

Upiše se tabela stringova, pazeći da prva četiri bajta budu njena dužina (WriteStringTable)

Zatvori se objektna datoteka

Eventualno obrišu datoteke sa ekstenzijama .COD, .DAT, .LAB, .STA i .PAT jer više nisu potrebne.

18.11. Upotreba programa konvertoraPrevedeni program sa naredbom asem (npr. Asem primjer7.asm ) se prevede dalje programom konvertorom COFF,

čiji je izvorni kod dat u prilogu. Na primjer:

Coff primjer7

Nakon ovoga se dobija OBJ datoteka, koja se može propustiti kroz mnoge linker programe (isprobano sa linkerima LINK, GOLINK i ALINK), povezati sa bibliotekama i dobiti EXE program.

Za vježbu je moguće integrisati ovaj konvertor sa asemblerom, tako da se pomoćne datoteke ne generišu ili bar ne vide direktno.

18.12. Rezime poglavljaOvim korakom je projekt razvoja programskog jezika postao slobodan od tuđeg asemblera. Sljedeći zadatak je vlastiti

linker.

Page 186: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Korišten je jedan od standardnih objektnih formata, COFF. Ovaj format se sastoji od zaglavlja, sekcija i dodatnih tabela. Zahvaljujući pogodnoj strukturi izlaznih datoteka asemblera, izgradnja konvertora formata u standardni objektni format je prilično pravolinijski zadatak.

LISTING GENERATORA STANDARDNOG OBJ FORMATA

program Coff;uses sysutils;const relocationentrysize=10; symbolentrysize=18;Type{ Na pocetku fajla ide FileHeader } TFileHeader= Record Machine:word; { 014C (i386) } NumberOfSections: word; { 0003 } TimeDateStamp: LongInt; { 41543009 -> Fri Sep 24 16:32:41 2004 } PointerToSymbolTable: LongInt; NumberOfSymbols:LongInt; SizeOfOptionalHeader:word; Characteristics:word; end;

{ Odmah nakon slijede opisi sekcija n puta} TSection=Record Name:array[0..7] of char; { section name in ASCII } PhysicalAddress:Longint; { size mapped into memory } VirtualAddress:Longint; { memory address relative to image base } SizeOfRawData:Longint; { physical size, multiple of file alignment } PointerToRawData:Longint; { file offset } PointerToRelocations:LongInt; { offset of relocation entries } PointerToLinenumbers:LongInt; { offset of line number entries } NumberOfRelocations:word; { number of relocation entries } NumberOfLinenumbers:word; { number of line number entries } Characteristics:Cardinal; end;{ zatim same sekcije nakon svake sekcije njena relokaciona tabela pa tabela simbola } TRelocationTable=record r_vaddr:Longint; { address of relocation } r_symndx:Longint; { symbol we're adjusting for } r_type:Longint; { type of relocation } end;

TSymbolTable=record e:record case Boolean of true: (e_name:Array[0..7] of char); false: (e1:record e_zeroes:Longint; e_offset:Longint; end); end; e_value:Longint; e_scnum:Word; e_type:Word; e_sclass:Byte; e_numaux:Byte; end;

{ U .drectve sekciji se nalazi -entry:ULAZ }

var FileHeader:TFileHeader; genname:String; infile:text; SymbolTable:Array[1..10000] of TSymbolTable; StringTable:Array[1..10000] of char; PublicTable:Array[1..1000] of String; Sections:Array[1..3] of TSection; RelocationTable:Array[1..10000] of TRelocationTable; TotSym,StringTabLen,TotRelocs,TotPublic, datahelpsympos,codehelpsympos, drectvehelpsympos:Longint; CodeSize,DataSize:Longint; drectve:string; outobj:file;function trim(st:string):String;begin while (st<>'') and (st[1]=' ') do st:=copy(st,2,length(st)); while (st<>'') and (st[length(st)]=' ') do st:=copy(st,1,length(st)-1); TRIM:=ST;end;

procedure izdvoji(var st,x:string; sep:char);var p:Integer;begin if st='' then

begin x:=''; exit end; p:=pos(sep,st); if p>0 then begin x:=trim(copy(st,1,p-1)); st:=TRIM(copy(st,p+1,length(st)-p)); end else begin if sep=':' then x:='' else begin x:=trim(st); st:=''; end endend;Procedure NewSymbol(LabIme:string);var i:integer;begin TotSym:=TotSym+1; with SymbolTable[TotSym] do begin if length(labime)>8 then begin e.e1.E_zeroes:=0; e.e1.e_offset:=StringTabLen+4; for i:=1 to length(labime) do begin StringTabLen:=StringTabLen+1; StringTable[StringTabLen]:=LabIme[i]; end; end else begin for i:=1 to length(labime) do begin e.e_name[i-1]:=LabIme[i]; end; end; endend;Procedure NewPublic(PubIme:string);begin TotPublic:=TotPublic+1; PublicTable[TotPublic]:=Pubime+#0;end;

function IsPublicSymbol(Simbol:String):Boolean;var i:integer;begin IsPublicSymbol:=false; for i:=1 to TotPublic do begin if PublicTable[TotPublic]=Simbol then begin IsPublicSymbol:=true; exit; end end;end;procedure LoadLabels;var st,labime,labtip,labval,labdsize,entry,publicsym:String; i:integer;begin entry:=''; AssignFile(infile,genname+'.lab'); Reset(infile); TotSym:=0; StringTabLen:=0; NewSymbol('.file'); with SymbolTable[TotSym] do begin e_scnum:=65535; e_type:=0; e_value:=0; e_sclass:=$67; e_numaux:=1; end; NewSymbol('h.asm'); with SymbolTable[TotSym] do begin e_scnum:=0; e_type:=0; e_value:=0; e_sclass:=0; e_numaux:=0; end; NewSymbol('@comp.id'); with SymbolTable[TotSym] do begin e_scnum:=65535; e_type:=0; e_value:=$001220FC;

Page 187: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

e_sclass:=3; e_numaux:=0; end; NewSymbol('.text'); with SymbolTable[TotSym] do begin e_scnum:=1; e_type:=0; e_value:=0; e_sclass:=3; e_numaux:=1; end; NewSymbol('.texhlp'); codehelpsympos:=totsym; NewSymbol('.data'); with SymbolTable[TotSym] do begin e_scnum:=2; e_type:=0; e_value:=0; e_sclass:=3; e_numaux:=1; end; NewSymbol('.dathlp'); datahelpsympos:=totsym;

drectve:=''; while not eof(infile) do begin readln(infile,st); if (pos('END ',st)>0) then begin entry:=copy(st,5,length(st)); drectve:='-entry:'+entry+' '#0; end else if (pos('PUBLIC ',st)=0) then begin st:=st+';'; izdvoji(st,labime,' '); labime:=labime+#0; izdvoji(st,labtip,' ');

izdvoji(st,labval,' '); izdvoji(st,labdsize,';');

if (Labtip='3') or (labime=entry+#0) or (ispublicsymbol(labime)) then labime:='_'+labime; NewSymbol(labime); with SymbolTable[TotSym] do begin val(labval,e_value,i); e_numaux:=0; if Labtip='0' {lEqu} then begin e_scnum:=65534; e_sclass:=1; end; if Labtip='1' {lProg} then begin e_scnum:=1; e_sclass:=3; end; if Labtip='2' {lData} then begin e_scnum:=2; e_sclass:=3; end; if Labtip='3' {lExtrn} then begin e_scnum:=0; e_value:=0; e_sclass:=2; end; if labime='_'+entry+#0 then begin e_sclass:=2; end; if LabDsize='0' {8 bit} then e_type:=$2; if LabDsize='1' {16 bit} then e_type:=$3; if LabDsize='2' {32 bit} then e_type:=$20; if LabDsize='3' {64 bit} then e_type:=$6; if LabDsize='4' {80 bit} then e_type:=$7; end; end else begin publicsym:=copy(st,7,length(st)); NewPublic(publicsym); end; end; NewSymbol('.drectve'); with SymbolTable[TotSym] do begin e_scnum:=3; e_type:=0; e_value:=0; e_sclass:=3; e_numaux:=1; end; NewSymbol('.datahlp'); drectvehelpsympos:=totsym; close(infile);end;

procedure LoadRelocs;var st,labime,labimeunder,position,relkind:String; i,rez:integer; p1:pchar; posvalint:Longint;label dalje;begin AssignFile(infile,genname+'.pat'); Reset(infile); TotRelocs:=0; while not eof(infile) do begin readln(infile,st);

st:=st+';'; izdvoji(st,labime,' '); labime:=labime+#0; labimeunder:='_'+labime; izdvoji(st,position,' '); izdvoji(st,relkind,';'); labime:=copy(labime,1,length(labime)); for i:=1 to TotSym do begin if SymbolTable[i].e.e1.E_zeroes=0 then p1:=Addr(StringTable[SymbolTable[i].e.e1.e_offset-3]) else p1:=Addr(SymbolTable[i].e.e_name[0]); if (strcomp(addr(labime[1]),p1)=0) or (strcomp(addr(labimeunder[1]),p1)= 0) then begin rez:=i-1; goto dalje; end; end; rez:=0; dalje: if rez<>0 then begin val(position,posvalint,i); if (RelKind='R') and (SymbolTable[rez+1].e_scnum=0) then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=20; end; if (RelKind='A') then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=6; end; if (RelKind='D') then begin TotRelocs:=TotRelocs+1; RelocationTable[TotRelocs].r_vaddr:=posvalint; RelocationTable[TotRelocs].r_symndx:=rez; RelocationTable[TotRelocs].r_type:=6; end end; end; close(infile);end;procedure ReadSizes;var f: file of Byte;begin Assign(f,genname+'.cod'); Reset(f); CodeSize:=FileSize(f); Close(f); Assign(f,genname+'.dat'); Reset(f); DataSize:=FileSize(f); Close(f);end;

procedure FillSectionHeaders;Var SetName:String; i:Integer;begin

with SymbolTable[codehelpsympos] do begin e.e1.e_zeroes:=CodeSize; e.e1.e_offset:=TotRelocs; end; with SymbolTable[datahelpsympos] do begin e.e1.e_zeroes:=DataSize; e.e1.e_offset:=0; end; with SymbolTable[drectvehelpsympos] do begin e.e1.e_zeroes:=Length(drectve)-1; e.e1.e_offset:=0; end;

With Sections[1] do begin SetName:='.text'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=0; VirtualAddress:=0; SizeOfRawData:=CodeSize; PointerToRawData:=sizeof(TfileHeader)+3*sizeof(TSection); PointerToRelocations:=PointerToRawData+CodeSize; PointerToLinenumbers:=0; NumberOfRelocations:=TotRelocs; NumberOfLinenumbers:=0; Characteristics:=$60500020; end; With Sections[2] do begin SetName:='.data'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=CodeSize; VirtualAddress:=0; SizeOfRawData:=DataSize; PointerToRawData:=Sections[1].PointerToRelocations+ TotRelocs* relocationentrysize ; PointerToRelocations:=0; PointerToLinenumbers:=0; NumberOfRelocations:=0; NumberOfLinenumbers:=0; Characteristics:=$C0500040; end; With Sections[3] do begin

Page 188: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SetName:='.drectve'#0; for i:=1 to length(setname) do Name[i-1]:=setname[i]; PhysicalAddress:=CodeSize+DataSize; VirtualAddress:=0; SizeOfRawData:=length(drectve)-1; PointerToRawData:=Sections[2].PointerToRawData+DataSize; PointerToRelocations:=0; PointerToLinenumbers:=0; NumberOfRelocations:=0; NumberOfLinenumbers:=0; Characteristics:=$00000A00; end;

end;

procedure FillObjHeader;begin with FileHeader do begin Machine:=$014C; NumberOfSections:=3; TimeDateStamp:=0; PointerToSymbolTable:=sections[3]. PointerToRawData+length(drectve); NumberOfSymbols:=totsym; SizeOfOptionalHeader:=0; Characteristics:=0; end;end;

procedure OpenOutObj;begin Assign(outobj,genname+'.obj'); Rewrite(outobj,1);end;procedure writeobjheader;begin BlockWrite(outobj,FileHeader,sizeof(TFileHeader));end;procedure writesectionheaders;begin BlockWrite(outobj,sections[1],sizeof(TSection)); BlockWrite(outobj,sections[2],sizeof(TSection)); BlockWrite(outobj,sections[3],sizeof(TSection));end;

procedure copycodesection;var f: file of Byte; b: Byte;begin Assign(f,genname+'.cod'); Reset(f); while not(eof(f)) do begin Read(f,b); BlockWrite(outobj,b,1) end; Close(f);end;

procedure writerelocations;var i:integer;begin for i:=1 to TotRelocs do begin BlockWrite(outobj,RelocationTable[i],relocationentrysize); end;end;

procedure copydatasection;var

f: file of Byte; b: Byte;begin Assign(f,genname+'.dat'); Reset(f); while not(eof(f)) do begin Read(f,b); BlockWrite(outobj,b,1) end; Close(f);end;

procedure writestartupsection;begin BlockWrite(outobj,drectve[1],length(drectve));end;

procedure writesymbols;var i:integer;begin for i:=1 to TotSym do begin BlockWrite(outobj,SymbolTable[i],symbolentrysize); end;end;procedure writestringtable;var s:Longint;begin s:=stringtablen+4; BlockWrite(outobj,s,4); BlockWrite(outobj,stringtable,StringTabLen);end;procedure DeleteTempFiles; procedure erase1(fn:string); var f:file; begin assignfile(f,fn); erase(f); end;begin erase1(genname+'.cod'); erase1(genname+'.dat'); erase1(genname+'.sta'); erase1(genname+'.lab'); erase1(genname+'.pat');end;

begin genname:=paramstr(1); ReadSizes; loadlabels; loadrelocs; fillsectionheaders; fillobjheader; openoutobj; writeobjheader; writesectionheaders; copycodesection; writerelocations; copydatasection; writestartupsection; writesymbols; writestringtable; close(outobj); if not(paramstr(2)='/k') then deletetempfiles;end.

Page 189: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

19.LINKER

Posljednji korak za dobivanje izvršnog programa je pokretanje linkera. U ovom poglavlju se neće razvijati vlastiti linker, ali će se ući u to šta linker generalno radi.

19.1. Princip rada linkeraLinkerov zadatak je da spoji OBJ datoteke u jedinstvenu izvršnu datoteku. Ipak, kada bi stvari bile tako jednostavne

linker bi bio obični program koji spaja gomile podataka. Komplikovani dio linkera je posao fiksiranja, o čemu će biti riječi kasnije. Kao i asembler i linker obavlja zadatak u dva prolaza. U prvom prolazu linker sastavi skup pravila za povezivanje, a u drugom primjenjujući ta pravila upisuje izvršnu datoteku.

Linker treba da stavi sav kod i podatke iz svake OBJ datoteke u izvršnu datoteku. Ako se linkeru proslijede tri OBJ datoteke tada se kod i podaci iz sve tri OBJ datoteke smješta u EXE. Ali to se ne radi prostim lijepljenjem OBJ datoteka jedne na kraj druge. Umjesto toga linker spaja sve sekcije sa istim imenom u jedinstvenu. Na primjer, tri OBJ datoteke od kojih svaka ima jednu .text sekciju će se povezati u jedinstveni EXE sa jednom .text sekcijom, koja se sastoji od tri individualne .text sekcije kakve su bile u OBJ datoteci.

Jedinstvena sekcija se formira spajanjem istoimenih sekcija u redoslijedu kako je proslijeđeno kroz parametre linkeru. Ako su linkeru proslijeđeni parametri

A.OBJ B.OBJ C.OBJ

Linker će spojiti ove OBJ datoteke kao što je prikazano na slici Sl. 19.1.1. U promjeru sa slile se uočava da sve sekcije sa istim imenom se spajaju u jedinstvene sekcije _text i _data, dok se sekcije sa jedinstvenim imenom smještaju po redu.

Sekcije koje u svom imenu imaju znak $ predstavljaju izuzetak. Kod ovih sekcija se ignoriše dio imena iza znaka $ kao i sam ovaj znak. Na primjer, mogu postojati sekcija sa imenima info$a, info$b i info$other. Sve one će se spojiti u jedinstvenu sekciju sa imenom info.

Pored pravila sa znakom $, standardni prioritet redoslijeda sekcija se podešava označavajući ih specijalnim atributima. Sekcije sa atributom koda se smještaju prve u izvršni program, zatim slijede sekcije sa neinicijaliziranim podacima (ako ih ima, a koji se smještaju u .bss sekciju), sekcije sa inicijaliziranim podacima (uključujući .data sekcija), zatim sekcije generisane linkerom kao što je .reloc. Obično se na kraj EXE programa smješta .debug sekcija, jer se ona ne mora uvijek učitavati.

Sekcije sa atributima LINK_REMOVE i LINK_INFO, a koje se zovu .drectve se ne ugrađuju u EXE program. One se koriste da se proslijede parametri linkeru

Sl. 19.1.1. Primjer spajanja sekcija u OBJ

19.2. Fiksiranja i relokacije Zašto kompajler prosto ne generiše izvršnu datoteku direktno iz izvorne, eliminišući potrebu za linkerom? Iako ima i

takvih kompajlera, glavni razlog je što se većina programa ne sastoji od jedne datoteke sa izvornim kodom. Kompajleri su specijalizovani za preuzimanje jedne datoteke sa izvornim kodom proizvodeći sirovi ekvivalent u mašinskom kodu. Pošto izvorna datoteka može imati reference na kod ili podatke izvan izvorne datoteke, kompajler ne može generisati egzaktno pravi kod koji poziva tu funkciju ili pristupa toj varijabli. Umjesto toga, kompajler uključuje dodatne informacije u izlaznu datoteku koja opisuje spoljni kod ili podatke. Te informacije se zovu popravke, jer je kod kojim se pristupa eksternim funkcijama i varijablama nekorektan i mora se popraviti kasnije.

Neka na primjer treba pozvati podprogram naredbom

CALL PODPROGRAM

Asembler će na ovom mjestu, ako se podprogram ne nalazi u istoj datoteci sa izvornim kodom, generisati mašinski kod:

E8 00 00 00 00

Očigledno, E8 je kod instrukcije CALL, a ove četiri nule su adresa potprograma. Očigledno je da podprogram neće biti udaljen 0 bajtova od naredbe CALL. Ovaj dio koda je neispravan i mora se popraviti.

Page 190: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

U datom primjeru, linker sada zamjenjuje ova četiri bajta iza CALL naredbe korektnom adresom potprograma. On će znati da ih treba zamijeniti preko informacije iz sloga popravki. Korektnu adresu saznaje sam linker spajajući sekcije.

Postoje tri vrste slogova popravki.

Popravka REL32 znači da nova adresa treba da se upiše relativno od adrese na kojoj se vrši popravka. U primjeru sa CALL naredbom treba zamijeniti ove četiri nule popravkom REL32. Ukoliko su se ove nule nalazile na adresi 1000, a nakon spajanja modula PODPROGRAM upadne na adresu 2530, umjesto nula upisuje se 1530. Podprogram se dakle poziva sa relativnom adresom i na taj način je omogućena relokatibilnost. Ovaj tip popravke se ne upisuje u izvršnu datoteku.

Popravka DIR32 je predviđena za popravku apsolutnih adresa. Pogledati sljedeći primjer.

MOV EAX,VRIJEDNOST

VRIJEDNOST DD 43332

Neka se labela VRIJEDNOST nalazi na adresi 00002E03

Asembler će prevesti prvu instrukciju u apsolutnu adresiranje, npr. B8 03 2E 00 00. Učita li se program na adresu 00600000, i instrukcija MOV EAX se mora mijenjati, na primjer u B8 03 2E 40 00 jer je labela VRIJEDNOST sada na adresi 00602E03.

Nova vrijednost koju linker upiše nakon DIR32 popravke jednaka je zbiru podrazumijevane startne adrese programa i prethodne vrijednosti koja se nalazila na adresi koja se popravlja. Podrazumijevana startna adresa je 00400000h, pa linker treba u našem slučaju da primjeni sabiranje konstanti 00400000h i 00002E03h i upiše adresu 00402E03h. Windowsov loader će, ukoliko postoji .reloc sekcija, obaviti ovaj zadatak još jednom, ali samo ako se program učitava na nepodrazumijevanu adresu. Tada se za svaki DIR32 slog sabira vrijednost na adresi koju popravljamo sa razlikom između podrazumijevane i stvarne adrese gdje je program učitan.

Treći tip popravke DIR32NB (Direct 32, No Base), se koristi za debagerske informacije. Ova popravka se razlikuje od DIR32 što ne sadrži podrazumijevanu adresu učitavanja izvršnog programa.

19.3. Biblioteke Često je potrebno spojiti više OBJ datoteka u jedinstvenu datoteku koja se zatim prosljeđuje linkeru. Tipični primjer

je izvršna biblioteka jezika C++, koja se zove LIBC.LIB. U njoj se nalazi mnogo OBJ datoteka koje obavljaju funkcije kao što su printf, sin, atoi ili fopen.

Biblioteke se sastoje od zaglavlja biblioteke i zatim kopija OBJ datoteka koje su ugrađene u biblioteku.

Za razliku od OBJ datoteka direktno proslijeđenih linkeru kroz parametre, linker ne mora uključiti u EXE program sve OBJ datoteke ugrađene u biblioteku. OBJ datoteke unutar biblioteke će biti ugrađene samo ako se koristi bar jedna varijabla ili podprogram iz njih. Ako program iz objektne datoteke koja se uključuje EXE poziva neki podprogram, npr. printf, i linker pronađe objektnu datoteku unutar biblioteke u kojoj se nalazi podprogram printf, ta datoteka se ugrađuje u EXE. Ali ne samo ona. Neka printf dalje poziva putchar koji je u svojoj OBJ datoteci, a putchar opet poziva checkvideomode koji je u trećoj OBJ datoteci. Tada će sve tri OBJ datoteke biti uključene u EXE.

Specijalna grupa biblioteka su importne biblioteke. Strukturalno, one se ne razlikuju od regularnih biblioteka, niti ih linker razlikuje kada razrješava simbole. Ključna razlika je u tome što importne biblioteke nisu nastale iz izvornog koda i OBJ datoteka proizvedenih od njega. Importne biblioteke pravi linker prilikom povezivanja drugog EXE, odnosno DLL programa. Ove biblioteke se baziraju na importnim tabelama.

19.4. Pravljenje importne tabele

Jedna od najznačajnijih osobina 32 bitnog Windows-a je mogućnost importa funkcija iz drugih EXE i DLL programa. Sve ove informacije o uključenim DLL nalaze se u importnoj tabeli. Importna tabela se obično smješta u sekciju .idata.

Izgleda neobično da linker u stvari ne brine da li se pozvani podprogram nalazi unutar EXEa ili u spoljašnjem DLLu. Prostim praćenjem pravila spajanja sekcija i razrješavanja simbola linker pravi importnu tabelu, neinformisan o specijalnom značenju ove tabele.

1121 public symbols EA14 _ActivateKeyboardLayout@8 ... Archive member name at EA14: USER32.dll/ ...

Page 191: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

SECTION HEADER #2 .text name RAW DATA #2 00000000 FF 25 00 00 00 00 .%.... ... SECTION HEADER #4 .idata$5 name RAW DATA #4 00000000 00 00 00 00 .... ... SECTION HEADER #5 .idata$4 name RAW DATA #5 00000000 00 00 00 00 .... ... SECTION HEADER #6 .idata$6 name RAW DATA #6 00000000 00 00 41 63 74 69 76 61 | 74 65 4B 65 79 62 6F 61 ..Activa|teKeyboa 00000010 72 64 4C 61 79 6F 75 74 | 00 00 rdLayout|.. ... COFF SYMBOL TABLE ... 003 00000000 SECT2 notype () External | _ActivateKeyboardLayout@8

Pogleda li se dio importne biblioteke USER32.LIB na gornjoj slici može se zaključiti kako linker obrađuje importne datoteke. Neka je pozvana API funkcija ActivateKeyboardLayout. Slog popravke za _ActivateKeyboardLayout@8 se nalazi OBJ datoteci korisničkog programa. U zaglavlju biblioteke USER32.LIB linker zaključuje da se ova funkcija nalazi u OBJ datoteci na poziciji 0xEA14. Time se linkeru da do znanja da se ova OBJ biblioteka uključi u EXE. A u njoj ima više sekcija, kao što su .text, .idata$5, .idata$4, and .idata$6. U .text sekciji je JMP instrukcija (FF 25 00 00 00 00). Iz COFF tabele simbola se vidi da se _ActivateKeyboardLayout@8 nalaz na početku druge sekcije, a to znači da će poziv CALL _ActivateKeyboardLayout@8 rezultovati JMP instrukcijom

Treba primijetiti da sekcije .idata$4, .idata$5 i .idata$6 sadrže podatke za importnu tabelu. Koristeći pravilo da se sekcije čije ime sadrži znak $ grupišu u jedinstvene sekcije sa imenom koje se nalazi prije znaka $, importna tabela se generiše redovnim poslom linkera.

19.5. Kreiranje eksportne tabele Pored kreiranja importnih tabela za izvršne programe, linker je odgovoran i za obrnuti zadatak, eksportne tabele.

Ovdje je zadatak linkera istovremeno lakši i teži. U prvom prolazu, linker sakuplja informacije o svim eksportovanim simbolima i kreira tabelu eksportovanih funkcija. To se sekciju .edata posebne OBJ datoteke koja je preimenovana u ekstenziju EXP iako je po strukturi standardna OBJ datoteka.

U drugom prolazu se EXP ugradi u EXE kao i svaka standardna OBJ datoteka, mada mnogi linkeri spajaju sekcije .rdata i .edata.

19.6. Drugi zadaci linkera Pored navedenog, linkeri ubacuju informacije potrebne za debager, kreiranje MAP datoteka koje daju informaciju o

tome šta je uključeno u izvršni program te dodavanje programčića koji se starta ako je EXE pokrenut iz MS DOSa. Ali, ovo nisu obavezni zadaci jednog linkera, nego više korisne pomoćne funkcije. O projektu razvoja linkera vidjeti http://www.iecc.com/linker/

19.7. Rezime poglavljaLinker je alatka koja povezuje više prevedenih jedinica u funkcionalni izvršni program. Njegov ključni zadatak je

spajanje sekcija, a drugi je razrješavanje referenci (popravke) između kombinovanih sekcija. Više OBJ datoteka se povezuju u biblioteke. Biblioteke koje ne sadrže kod, nego samo informacije o adresama unutar EXE ili DLL se zovu importne biblioteke. Da bi se napravile importne datoteke koriste se importne i eksportne tabele.

Page 192: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

20.INTERPRETER

Drugi popularni koncept za realizaciju viših programskih jezika, pored kompajlera su interpreteri. U ovom poglavlju će biti opisan jedan od načina pravljenja interpretera

20.1. Interpreteri i jezici za njihov razvojIako se mnogi interpreteri pišu u asembleru radi što veće brzine rada, interpretere je, za razliku od kompajlera,

moguće pisati potpuno u višem programskom jeziku i bez ikakvog znanja o arhitekturi mašine na kojoj se interpreter izvršava. Pored ovoga, za pisanjem vlastitog interpretera potreba je češća nego za pisanjem vlastitog kompajlera, jer je u mnogim aplikacijama potrebno dodati neki skriptni jezik.

20.2. Interpretirani jezikU ovom primjeru implementirati će se interpreter vrlo primitivne verzije BASICa. Ova verzija ima 26 cjelobrojnih

varijabli pod imenom a,b,c ... , z. Naredbe su

PRINT <izraz> prikaz aritmetičkog izraza

LET <varijabla> = <izraz> dodjela vrijednosti varijabli

INPUT <varijabla> unošenje vrijednosti varijable

LIST prikaz cijelog programa

IF <izraz1> THEN <izraz2> skok na liniju <izraz2> ako je <izraz1> različit od 0

GOTO <izraz> bezuslovni skok

END kraj programa ili izlazak iz interpretera

Kao u klasičnom, danas pomalo zaboravljenom, BASICu, naredbe se mogu izvršiti direktno kucanjem ili se ispred naredbe može staviti linijski broj kada se ona smješta u program.

20.3. Linijski editorPrvo je potrebno realizovati smještanje linija programa. Da bi interpreter bio što jednostavniji, program se čuva u nizu

od 1000 stringova. Naravno da je ovo najneracionalniji način, i da bi trebalo ići na dinamičke strukture podataka, ali bi i listing interpretera tada bio veći.

Linije (kojima se radi lakše interpretacije dodaje simbol ';') se unose Pascal-skom naredbom readln (ili se uzimaju iz niza linija) i, kada se linija unese, provjerava se da li ona počinje cifrom. Ako linija počinje cifrom , prepozna se linijski broj i tekst linije bez linijskog broja se smjesti u navedeni element niza stringova koji odgovara liniji sa tim linijskim brojem. Ako linija ne počinje cifrom, prelazi se u analizu naredbe i njeno izvršavanje. Nakon toga je interpreter spreman za izvršenje ili unos nove naredbe.

20.4. Interpreterska petljaInterpreter, dakle, ima dva režima rada, komandni i programski. U komandnom režimu rada naredba se očitava preko

readln , a u programskom režimu iz niza stringova o kome su naredbe. Nakon dohvaćene naredbe slijedi njeno prepoznavanje i izvršenje, a zatim se u programskom režimu rada traži sljedeća instrukcija. Ako je prethodna instrukcija bila instrukcija GOTO ili IF, naredna instrukcija je navedena kao argument ove instrukcije. U ostalim slučajevima, to je prva naredna neprazna instrukcija, što se traži uvećanjem broja trenutne instrukcije (varijabla izvrlinija) za jedan, sve dok se ne dođe do naredbe koja nije prazna ili dok se ne dostigne linija 1000. Glavna interpreterska petlja izgleda ovako:procedure Glavni;var brlinije:integer;begin quit:=false; repeat if inprogram then linija:=naredbe[izvrlinija] else readln(linija); linija:=uppercase(linija); gr:=false; linija:=linija+';'; pozicija:=0; novi; if znak in ['0'..'9'] then begin

brlinije:=uzmikonstantu; if (brlinije>0) and (brlinije<1000) then begin linija:=trim(copy( linija,pozicija, length(linija))); if linija=';' then linija:=''; naredbe[brlinije]:=linija; end end else begin if slijedi('PRINT')then DoPrint else if slijedi('LIST') then Dolist else if slijedi('GOTO') then DoGoto else if slijedi('LET') then DoLet else if slijedi('IF') then DoIf else

if slijedi('INPUT')then DoInput else if slijedi('END') then DoEnd else Greska('Nepoznata naredba'); end; if inprogram then begin if not skok then repeat izvrlinija:=izvrlinija+1; until (izvrlinija>=1000) or (naredbe[izvrlinija]<>''); if izvrlinija=1000 then inprogram:=false; skok:=false; end; until quit;end;

Page 193: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

20.5. Realizacija aritmetičkih izraza

Dosta znanja iz pisanja kompajlera se može primijeniti na pisanje interpretera. Glavna razlika je što umjesto generisanog koda koji izlazi kao listing treba simulirati izvršenje odgovarajućih naredbi. Tako na primjer, u trećoj verziji kompajlera dio koda koji je realizovao jezički pojam Clan izgledao je ovakoprocedure Clan;var z: char;begin Faktor; while (znak in ['*', '/', '%']) do begin z := znak; Emit(' PUSH EAX');

Novi; Faktor; case z of '*': begin Emit(' POP EBX'); Emit(' IMUL EBX'); end; '/', '%': begin Emit(' MOV EBX,EAX');

Emit(' POP EAX'); Emit(' CDQ'); Emit(' IDIV EBX'); if z = '%' then Emit(' MOV EAX,EDX'); end; end; end;end;

Emitovanje mašinskih naredbi treba zamijeniti procedurama koje rade ekvivalentnu stvar, pa će u interpreteru procedura Clan izgledati ovako:procedure Clan;var z: char;begin Faktor; if gr then exit; while (znak in ['*', '/', '%']) do begin z := znak; push(eax); if gr then exit; Novi; if gr then exit; Faktor; if gr then exit;

case z of '*': begin ebx:=pop; eax:=eax*ebx; end; '/', '%': begin ebx:=eax; eax:=pop; if ebx<>0 then begin if z = '%' then eax:=eax mod ebx

else eax:=eax div ebx end else Greska('Dijeljenje s nulom'); end; end; end;end;

Kao što se vidi, iako se uočava razlika što postoje varijable eax i ebx , i procedure push i pop koje rade sa simuliranim stekom, struktura procedure je ista. Umjesto generisanih asemblerskih naredbi koje rade ekvivalentan efekat, izvršavaju se adekvatne operacija nad varijablama eax i ebx.

Pošto u interpreteru greška ne smije izazvati prekid rada samog interpretera nego samo interpretiranog programa, nakon svakog potprograma se provjerava da li je izazvana greška naredbom

if gr then exit;

dok sama procedura Greska nema naredbe halt koja izaziva prekid rada. Ova procedura treba da pored ispisa teksta poruke i da postavi varijablu gr na tačnu vrijednost.

Za simuliranje steka, baš kao kod mašinskog steka, i ovdje se koristi sp kao oznaka trenutne pozicije na steku. Funkcija pop i procedura push izgledaju ovako:

function pop:integer;begin pop:=0; if gr then exit; if (sp<=0) or (sp>100) then begin Greska('Izraz'); pop:=0; end else begin pop:=stek[sp]; sp:=sp-1; end;end;

procedure push(n:integer);begin if gr then exit; if (sp<0) or (sp>=100) then begin Greska('Izraz'); end else begin sp:=sp+1; stek[sp]:=n; end;end;

I kod ostalih procedura za izračunavanje izraza vidi se sličnost sa istoimenim procedurama iz treće verzije kompajlera. U cilju skraćenja koda, izbačen je pojam IzrazDodjeljivanja, a operatori >,< i = prebačeni na isti prioritet kao i sabiranje i oduzimanje.

Varijable su predstavljene nizom od 26 cijelih brojeva. Pristup pojedinoj varijabli se svodi na proračun pozicije u nizu na osnovu imena varijable, a zatim se očitava odgovarajući element niza.

20.6. Realizacija naredbi primitivnog BASICa

Page 194: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

Zahvaljujući činjenici da prevedeni program napisan u Pascalu već ima sve potrebne rutine, realizacija samih naredbi je trivijalna. Tako se naredba print realizuje kaoprocedure DoPrint;begin Novi; if gr then exit; Izraz; if gr then exit; writeln(eax);end;

Procedurom Novi se pređe na sljedeći znak ulazne linije. Procedurom Izraz se izračuna aritmetički izraz i njegov rezultat dobije u varijabli eax.

Analogno se dobijaju realizacije ostalih naredbi, što se može vidjeti u kompletnom programu

20.7. Instrukcije za dohvatanje simbolaFunkcije novi, slijedi i idido su preuzete iz koda korištenog u trećoj verziji kompajlera, a zatim pojednostavljene jer je

interpreter linijski orijentisan. Tako u proceduri Novi nema potrebe prelaziti u sljedeću liniju, nego se sve provjere vrše unutar jedne linije, kao u sljedećoj implementaciji ove procedure.procedure Novi;begin if gr then exit; repeat pozicija := pozicija + 1; if pozicija > Length(linija) then Greska('Preko kraja linije') else znak:=linija[pozicija]; until (pozicija>Length(linija)) or (znak<>' ');end;

Dodane su i procedure Uppercase i Trim za pretvaranje malih slova u velika odnosno izbacivanje blankova iz stringova.

20.8. Listing interpretera primitivnog BASICaSlijedi kompletan listing ovog interpretera:

program Interpreter;var linija: string; pozicija,izvrlinija:integer; naredbe: Array [1..1000] of string; varijable:Array [0..25] of integer; znak:char; stek:array[0..100] of integer; sp,eax,ebx:integer; inprogram,quit,skok,gr:Boolean;function trim(st:string):String;begin while (st<>'') and (st[1]=' ') do st:=copy(st,2,length(st)); while (st<>'') and (st[length(st)]=' ') do st:=copy(st,1,length(st)-1); TRIM:=ST;end;

function uppercase(st:string):String;var i:integer;begin for i:=1 to length(st) do if (st[i]>='a') and (st[i]<='z') then st[i]:=chr(ord(st[i])-32); uppercase:=st;end;

procedure Greska(poruka: string);begin if inprogram then Writeln(poruka,' u liniji ', izvrlinija) else WriteLn(poruka); inprogram:=false; gr:=true; sp:=0;end;

function pop:integer;begin pop:=0; if gr then exit; if (sp<=0) or (sp>100) then begin Greska('Izraz'); pop:=0; end

else begin pop:=stek[sp]; sp:=sp-1; end;end;

procedure push(n:integer);begin if gr then exit; if (sp<0) or (sp>=100) then begin Greska('Izraz'); end else begin sp:=sp+1; stek[sp]:=n; end;end;

procedure Novi;begin if gr then exit; repeat pozicija := pozicija + 1; if pozicija > Length(linija) then Greska('Preko kraja linije') else znak:=linija[pozicija]; until (pozicija>Length(linija)) or (znak<>' ');end;

procedure IdiDo(z: char);begin if gr then exit; if (znak <> z) then Greska('Ocekivano' + z); Novi; if gr then exit;end;

function Slijedi(ocekivano: string): Boolean;begin SLijedi:=false; if gr then exit; if (copy(linija,pozicija, Length(ocekivano)) = ocekivano) then begin Slijedi := true; pozicija := pozicija + Length(ocekivano) - 1;

end else Slijedi := false;end;

function UzmiKonstantu: integer;var rezultat: integer;begin UzmiKonstantu:=0; if gr then exit; rezultat := 0; while (znak >= '0') and (znak <= '9') do begin rezultat := 10 * rezultat + ord(znak) - ord('0'); Novi; if gr then exit; end; if (znak = ' ') or (znak = '`') then Novi; if gr then exit; UzmiKonstantu := rezultat;end;

procedure Varijabla;var rezultat: integer;begin if gr then exit; rezultat := (ord(znak) - ord('A')); eax:=varijable[rezultat]; ebx:=rezultat; Novi; if gr then exit;end;procedure Izraz;forward;procedure Faktor;var rezultat: integer;begin case znak of '-': begin Novi; if gr then exit; Faktor; if gr then exit; eax:=-eax; end; '~': begin Novi; if gr then exit; Faktor; if gr then exit; eax:=not(eax);

Page 195: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

end; '!': begin Novi; if gr then exit; Faktor; if gr then exit; if eax=0 then eax:=1; end; '0'..'9': begin rezultat := UzmiKonstantu; eax:=rezultat; end; '(': begin Novi; if gr then exit; Izraz; if gr then exit; IdiDo(')'); if gr then exit; end; 'A'..'Z': begin Varijabla; if gr then exit; end else Greska('Izraz'); end;end;

procedure Clan;var z: char;begin Faktor; if gr then exit; while (znak in ['*', '/', '%']) do begin z := znak; push(eax); if gr then exit; Novi; if gr then exit; Faktor; if gr then exit; case z of '*': begin ebx:=pop; eax:=eax*ebx; end; '/', '%': begin ebx:=eax; eax:=pop; if ebx<>0 then begin if z = '%' then eax:=eax mod ebx else eax:=eax div ebx end else Greska('Dijeljenje s nulom'); end; end; end;end;

procedure Izraz;var z: char;begin Clan; while (znak in ['+', '-', '&', '|', '^','>','<','=']) do begin push(eax); z := znak; Novi; if gr then exit; Clan; if gr then exit; case z of '+': begin ebx:=pop; eax:=eax+ebx; end; '=': begin ebx:=pop; if eax=ebx then eax:=1 else eax:=0; end; '>': begin ebx:=pop; if ebx>eax then eax:=1 else eax:=0;

end; '<': begin ebx:=pop; if ebx<eax then eax:=1 else eax:=0; end;

'-': begin ebx:=eax; eax:=pop; eax:=eax-ebx; end; '&': begin ebx:=pop; eax:=eax and ebx; end; '|': begin ebx:=pop; eax:=eax or ebx; end; '^': begin ebx:=pop; eax:=eax xor ebx; end; end; end;end;

procedure DoPrint;begin Novi; if gr then exit; Izraz; if gr then exit; writeln(eax);end;

procedure DoGoto;begin novi; if gr then exit; Izraz; if gr then exit; izvrlinija:=eax; inprogram:=true; skok:=true;end;

procedure DoLet;var dodvar:char;begin Novi; if gr then exit; dodvar:=znak; if dodvar in ['A'..'Z'] then begin Novi; if gr then exit; IdiDo('='); if gr then exit; izraz; varijable[ord(dodvar)- ord('A')]:=eax; end else Greska('Varijabla');end;

procedure DoInput;var unizraz:string; dodvar:Char;begin Novi; if gr then exit; dodvar:=znak; if dodvar in ['A'..'Z'] then begin write('?'); readln(unizraz); if gr then exit; linija:=unizraz+';'; pozicija:=0; Novi; if gr then exit; Izraz; if gr then exit; varijable[ord(dodvar)- ord('A')]:=eax; end else Greska('Varijabla');end;

procedure DoIf;begin

Novi; if gr then exit; Izraz; if gr then exit; if eax<>0 then begin if not(slijedi('then')) then Greska ('Then'); if gr then exit; Novi; if gr then exit; Izraz; if gr then exit; IzvrLinija:=eax; skok:=true; end;end;

procedure doEnd;begin if inprogram then inprogram:=false else quit:=trueend;

procedure DoList;var i:integer;begin for i:=1 to 1000 do if naredbe[i]<>'' then writeln(i,' ',copy(naredbe[i],1, length(naredbe[i])-1));end;

procedure Glavni;var brlinije:integer;begin quit:=false; repeat if inprogram then linija:=naredbe[izvrlinija] else readln(linija); linija:=uppercase(linija); gr:=false; linija:=linija+';'; pozicija:=0; novi; if znak in ['0'..'9'] then begin brlinije:=uzmikonstantu; if (brlinije>0) and (brlinije<1000) then begin linija:=trim(copy( linija,pozicija, length(linija))); if linija=';' then linija:=''; naredbe[brlinije]:=linija; end end else begin if slijedi('PRINT')then DoPrint else if slijedi('LIST') then Dolist else if slijedi('GOTO') then DoGoto else if slijedi('LET') then DoLet else if slijedi('IF') then DoIf else if slijedi('INPUT')then DoInput else if slijedi('END') then DoEnd else Greska('Nepoznata naredba'); end; if inprogram then begin if not skok then repeat izvrlinija:=izvrlinija+1; until (izvrlinija>=1000) or (naredbe[izvrlinija]<>''); if izvrlinija=1000 then inprogram:=false; skok:=false; end; until quit;end;

begin Glavniend.

20.9. Rezime poglavljaPisanje interpretera može biti jednostavniji zadatak od pisanja kompajlera, jer se interpreter može napisati bez znanja

mašinskog jezika. Umjesto generisanja koda, naredbe se izvršavaju simulirajući odgovarajući asemblerski kod. U ovom poglavlju realizovana je primitivna verzija BASICa, ali dobiveni program može biti polazna osnova za dalje proširenje jezika

Page 196: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

21.SADRŽAJ

1. VRSTE SISTEMSKOG SOFTVERA................................................................................................................................3

1.1. SISTEMSKI SOFTVER...........................................................................................................................................................31.2. SISTEMSKI SOFTVER ZA KONTROLU IZVRŠENJA PROGRAMA..............................................................................................31.3. SOFTVER ZA KORISNIČKO OKRUŽENJE...............................................................................................................................31.4. RAZVOJNI ALATI................................................................................................................................................................31.5. POMOĆNE ALATKE.............................................................................................................................................................41.6. REZIME POGLAVLJA...........................................................................................................................................................4

2. PROCESOR I OPERATIVNI SISTEM ZA KOJE SE GENERIŠE KÔD....................................................................5

2.1. REGISTRI............................................................................................................................................................................52.2. ADRESNI REŽIMI.................................................................................................................................................................52.3. INSTRUKCIJE......................................................................................................................................................................52.4. OPERATIVNI SISTEM...........................................................................................................................................................62.5. REZIME POGLAVLJA...........................................................................................................................................................6

3. UOBIČAJENI PRISTUPI U RAZVOJU KOMPAJLERA.............................................................................................7

3.1. ITERATIVNI PRISTUP...........................................................................................................................................................73.2. PRIMJENA GENERATORA KODA..........................................................................................................................................73.3. ANALIZA GOTOVOG KOMPAJLERA.....................................................................................................................................73.4. CRENSHAW-OVA NETEHNIČKA METODA............................................................................................................................83.5. WATERFALL I SPIRALNI PRISTUP RAZVOJU INFORMACIONIH SISTEMA..............................................................................83.6. PROGRAMSKI JEZIK U KOME SE RAZVIJA KOMPAJLER.......................................................................................................93.7. HARDVERSKO I SOFTVERSKO OKRUŽENJE ZA KOJE SE RAZVIJA KOMPAJLER....................................................................93.8. REZIME POGLAVLJA...........................................................................................................................................................9

4. PROSTI ARITMETIČKI IZRAZI..................................................................................................................................10

4.1. STRUKTURA TIPIČNIH ARITMETIČKIH IZRAZA..................................................................................................................104.2. SINTAKSNA ANALIZA ARITMETIČKIH IZRAZA..................................................................................................................114.3. GENERISANJE KODA ZA RAČUNANJE ARITMETIČKE IZRAZE.............................................................................................114.4. PRVA VERZIJA KOMPAJLERA............................................................................................................................................124.5. TESTNI PRIMJER...............................................................................................................................................................134.6. REZIME POGLAVLJA.........................................................................................................................................................14

5. PREVOĐENJE IZ DATOTEKA, BLOKOVI, VIŠECIFRENI BROJEVI..............................................................15

5.1. FORMAT INSTRUKCIJA......................................................................................................................................................155.2. BLOKOVI..........................................................................................................................................................................155.3. MODIFIKACIJE PROCEDURA KOMPAJLERA ZBOG PREVOĐENJA IZ DATOTEKE.................................................................155.4. MODIFIKACIJE KOMPAJLERA ZBOG GENERISANJA DATOTEKA SA ASEMBLERSKIM KODOM.............................................165.5. PROŠIRENJA ARITMETIČKIH IZRAZA.................................................................................................................................165.6. TESTNI PRIMJER...............................................................................................................................................................175.7. REZIME POGLAVLJA.........................................................................................................................................................19

6. VARIJABLE, RELACIONI OPERATORI, USLOVI, PETLJE..................................................................................20

6.1. PROŠIRENJE ARITMETIČKIH IZRAZA.................................................................................................................................206.2. USLOVI.............................................................................................................................................................................226.3. PETLJE..............................................................................................................................................................................236.4. GENERALIZOVANI JEZIČKI POJAM BLOK..........................................................................................................................246.5. TESTNI PRIMJER...............................................................................................................................................................256.6. REZIME POGLAVLJA.........................................................................................................................................................25

7. KLJUČNE RIJEČI, STRINGOVI, DINAMIČKI NIZOVI I FUNKCIJE..................................................................27

7.1. KLJUČNE RIJEČI................................................................................................................................................................277.2. KOMENTARI I NEIGNORISANJE SIMBOLA..........................................................................................................................277.3. MODIFIKACIJA USLOVA I PETLJI.......................................................................................................................................287.4. MODIFIKACIJE ARITMETIČKIH IZRAZA I UVOĐENJE STRINGOVA......................................................................................287.5. FUNKCIJE I PROCEDURE...................................................................................................................................................297.6. TESTNI PRIMJER...............................................................................................................................................................317.7. REZIME POGLAVLJA.........................................................................................................................................................33

8. DEKLARACIJE VARIJABLI, STANDARDNE FUNKCIJE......................................................................................36

8.1. TABELA IDENTIFIKATORA................................................................................................................................................36

Page 197: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

8.2. TIPOVI..............................................................................................................................................................................378.3. DEKLARISANJE VARIJABLI I NOVA STRUKTURA PROGRAMA............................................................................................378.4. IZRAZI I SEMANTIKA........................................................................................................................................................388.5. TABLICE GENERISANOG KODA ZA RAZLIČITE OPERANDE................................................................................................398.6. FUNKCIJE I PROVJERA PARAMETARA...............................................................................................................................438.7. TESTNI PRIMJER...............................................................................................................................................................458.8. REZIME POGLAVLJA.........................................................................................................................................................46

9. REALNI BROJEVI...........................................................................................................................................................51

9.1. KOPROCESOR...................................................................................................................................................................519.2. REALNE KONSTANTE........................................................................................................................................................519.3. KOMUNIKACIJA IZMEĐU FP STEKA I MEMORIJE..............................................................................................................519.4. ARITMETIČKE OPERACIJE.................................................................................................................................................529.5. REALNE VARIJABLE.........................................................................................................................................................539.6. FUNKCIJE REALNOG ARGUMENTA I UNARNI OPERATORI.................................................................................................549.7. TESTNI PRIMJER...............................................................................................................................................................549.8. REZIME POGLAVLJA.........................................................................................................................................................55

10. SLOŽENI TIPOVI PODATAKA.....................................................................................................................................61

10.1. VIŠEDIMENZIONALNI NIZOVI.......................................................................................................................................6110.2. INDIREKTNI POZIV FUNKCIJE.......................................................................................................................................6210.3. SLOGOVI......................................................................................................................................................................6310.4. TESTNI PRIMJER...........................................................................................................................................................6610.5. REZIME POGLAVLJA....................................................................................................................................................67

11. PREDPROCESIRANJE I OPTIMIZACIJA KODA.....................................................................................................74

11.1. STRUKTURA KOMPAJLERA..........................................................................................................................................7411.2. PREDPROCESORSKA DIREKTIVA #DEFINIRAJ...............................................................................................................7411.3. DIREKTIVE USLOVNOG KOMPAJLIRANJA.....................................................................................................................7411.4. DIREKTIVA #DODAJ ZA UKLJUČIVANJE DATOTEKE.....................................................................................................7511.5. REALIZACIJA PREDPROCESORA...................................................................................................................................7511.6. OPTIMIZACIJA KODA...................................................................................................................................................7511.7. TESTNI PRIMJER OPTIMIZACIJE....................................................................................................................................7911.8. REZIME POGLAVLJA....................................................................................................................................................80

12. TESTNI PRIMJERI..........................................................................................................................................................81

12.1. PRIMJER: BAZE PODATAKA I KORISNIČKI INTERFEJS..................................................................................................8112.2. PRIMJER: MULTIMEDIJA..............................................................................................................................................8312.3. PRIMJER: WEB SERVER...............................................................................................................................................8312.4. PRIMJER: NUMERIČKA ANALIZA.................................................................................................................................8512.5. REZIME POGLAVLJA....................................................................................................................................................85

13. TEORIJA JEZIKA I PARSIRANJA...............................................................................................................................98

13.1. FORMALNE GRAMATIKE..............................................................................................................................................9813.2. KONTEKSTNO OSJETLJIVA GRAMATIKA......................................................................................................................9813.3. NESAŽIMAJUĆA GRAMATIKA.......................................................................................................................................9813.4. KONTEKSTNO SLOBODNA GRAMATIKA.......................................................................................................................9813.5. REGULARNA GRAMATIKA...........................................................................................................................................9813.6. PARSIRANJE.................................................................................................................................................................9913.7. LL PARSIRANJE...........................................................................................................................................................9913.8. LR PARISRANJE.........................................................................................................................................................10013.9. GENERATORI PARSERA..............................................................................................................................................10213.10. REZIME POGLAVLJA..................................................................................................................................................103

14. OSNOVNI WIN32 API PROGRAM..............................................................................................................................104

14.1. HELLO WORLD..........................................................................................................................................................10414.2. PROSTI PROZOR.........................................................................................................................................................10414.3. KORAK 1: REGISTRACIJA PROZORSKE KLASE...........................................................................................................10514.4. KORAK 2: KREIRANJE PROZORA...............................................................................................................................10514.5. KORAK 3: PETLJA PORUKA.......................................................................................................................................10614.6. KORAK 4: PROZORSKA PROCEDURA.........................................................................................................................10614.7. OBRADA PORUKA......................................................................................................................................................10714.8. ŠTA JE TO PORUKA?..................................................................................................................................................10814.9. KOMUNIKACIJA SA DIALOŠKIM PROZORIMA.............................................................................................................109

Page 198: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

14.10. ŠTA JE RED ČEKANJA PORUKA?.................................................................................................................................10914.11. ŠTA JE PETLJA PORUKA.............................................................................................................................................10914.12. REZIME POGLAVLJA..................................................................................................................................................109

15. KORISNIČKI INTERFEJS I GRAFIČKE PRIMITIVE............................................................................................110

15.1. SERVISNE APLIKACIJE...............................................................................................................................................11015.2. KONZOLNE APLIKACIJE.............................................................................................................................................11015.3. GRAFIČKE KONTROLE...............................................................................................................................................11015.4. FUNKCIJE GRAFIČKIH KONTROLA KROZ PRIMJER......................................................................................................11115.5. MENIJI.......................................................................................................................................................................11415.6. DUGME - BUTTON.....................................................................................................................................................11415.7. EDITNA I MEMO POLJA..............................................................................................................................................11515.8. GRUPE KONTROLA I RADIO TASTERI.........................................................................................................................11515.9. KONTROLNE KUĆICE (CHECKBOX)............................................................................................................................11615.10. LISTE PODATAKA (LISTBOX).....................................................................................................................................11615.11. KOMBINOVANE LISTE (COMBO BOX).........................................................................................................................11615.12. STATIČKI TEKST........................................................................................................................................................11615.13. KLIZNA TRAKA (SCROLLBAR)...................................................................................................................................11715.14. ISCRTANE SLIKE I WM_PAINT PORUKA..................................................................................................................11715.15. REZIME POGLAVLJA..................................................................................................................................................118

16. SPISAK WIN32API FUNKCIJA...................................................................................................................................119

16.1. NAJVAŽNIJI PODSISTEMI WINDOWS API-JA..............................................................................................................11916.2. DLL DATOTEKE U KOJIMA SE NALAZE FUNKCIJE.....................................................................................................12016.3. SPISAK API FUNKCIJA...............................................................................................................................................12016.4. PORTIRANJE WINDOWS API FUNKCIJE.....................................................................................................................15516.5. REZIME POGLAVLJA..................................................................................................................................................157

17. ASEMBLER.....................................................................................................................................................................158

17.1. INSTRUKCIJSKI SET PENTIUMA II..............................................................................................................................15817.2. OPERACIONI KODOVI, OPIS........................................................................................................................................15817.3. OPERANDI.................................................................................................................................................................15917.4. KODIRANJE ADRESE: MODR/M AND SIB BYTES......................................................................................................15917.5. PRIMJERI KODIRANJA KOMPLETNIH INSTRUKCIJA.....................................................................................................16017.6. PARSIRANJE INSTRUKCIJE.........................................................................................................................................16317.7. PREPOZNAVANJE ADRESNIH REŽIMA.........................................................................................................................16317.8. PRORAČUN MODRM , SIB I DEPLASMANA.................................................................................................................16317.9. PUNJENJE I PRETRAŽIVANJE TABELE INSTRUKCIJA...................................................................................................16417.10. GENERISANJE HEKSADEKADNOG KODA....................................................................................................................16417.11. NUMERIČKE KONSTANTE..........................................................................................................................................16417.12. PSEUDOINSTRUKCIJE, PREFIKSI I MODIFIKATORI.......................................................................................................16417.13. PRVI PROLAZ.............................................................................................................................................................16517.14. DRUGI PROLAZ I GENERISANJE KODA.......................................................................................................................16517.15. IZVRŠNA VERZIJA......................................................................................................................................................16517.16. LISTING ASEMBLERA................................................................................................................................................166

18. PRAVLJENJE STANDARDNOG OBJ FORMATA...................................................................................................172

18.1. OBJEKTNI FORMATI...................................................................................................................................................17218.2. OBJEKTNI FORMAT MICROSOFT COFF.....................................................................................................................17218.3. ZAGLAVLJE COFF OBJ DATOTEKE..........................................................................................................................17218.4. OPCIONO ZAGLAVLJE................................................................................................................................................17318.5. ZAGLAVLJE COFF SEKCIJE.........................................................................................................................................17318.6. RELOKACIJSKA SEKCIJA............................................................................................................................................17418.7. COFF: LINIJSKI BROJEVI...........................................................................................................................................17518.8. COFF: TABELA SIMBOLA..........................................................................................................................................17518.9. COFF: TABELA STRINGOVA......................................................................................................................................17618.10. PROGRAM KONVERTOR.............................................................................................................................................17718.11. UPOTREBA PROGRAMA KONVERTORA.......................................................................................................................17718.12. REZIME POGLAVLJA..................................................................................................................................................177

19. LINKER............................................................................................................................................................................181

19.1. PRINCIP RADA LINKERA............................................................................................................................................18119.2. FIKSIRANJA I RELOKACIJE.........................................................................................................................................18119.3. BIBLIOTEKE...............................................................................................................................................................182

Page 199: mr Ribić Samir, diplpeople.etf.unsa.ba/~samir.ribic/files/PSSUDZBENIK3.doc · Web viewProgramskom jeziku potrebno je sada dodati ulaz/izlaz. To je već stvar ovisna od operativnog

19.4. PRAVLJENJE IMPORTNE TABELE................................................................................................................................18219.5. KREIRANJE EKSPORTNE TABELE...............................................................................................................................18319.6. DRUGI ZADACI LINKERA...........................................................................................................................................18319.7. REZIME POGLAVLJA..................................................................................................................................................183

20. INTERPRETER...............................................................................................................................................................184

20.1. INTERPRETERI I JEZICI ZA NJIHOV RAZVOJ................................................................................................................18420.2. INTERPRETIRANI JEZIK..............................................................................................................................................18420.3. LINIJSKI EDITOR........................................................................................................................................................18420.4. INTERPRETERSKA PETLJA..........................................................................................................................................18420.5. REALIZACIJA ARITMETIČKIH IZRAZA........................................................................................................................18520.6. REALIZACIJA NAREDBI PRIMITIVNOG BASICA.........................................................................................................18520.7. INSTRUKCIJE ZA DOHVATANJE SIMBOLA...................................................................................................................18620.8. LISTING INTERPRETERA PRIMITIVNOG BASICA.......................................................................................................18620.9. REZIME POGLAVLJA..................................................................................................................................................187

21. SADRŽAJ.........................................................................................................................................................................188