<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.8.0-dev (info@mypapit.net)" -->
<rss version="2.0" >
    <channel>
        <title>forum.fedorapl.org - forum polskiej społeczności Fedory News</title>
        <description></description>
        <link>http://forum.fedorapl.org/</link>
        <lastBuildDate>Thu, 09 Sep 2010 02:40:40 GMT</lastBuildDate>
        <generator>FeedCreator 1.8.0-dev (info@mypapit.net)</generator>
        <item>
            <title>translacja kodu na kod trójadresowy</title>
            <link>http://forum.fedorapl.org/thread/276</link>
            <description><![CDATA[
Witam. Bardzo bym prosił o pomoc w rozwiązaniu zadania:<br />
<br />
Translacja kodu języka wysokiego poziomu do kodu trójadresowego.<br />
<br />
Dokonaj translacji poniższego kodu na kod trójadresowy. Przedstaw pamięć zmiennych statycznych<br />
oraz stosu procesora dla wyróżnionej linii programu.<br />
<br />
var x: integer;<br />
<br />
function f(): integer;<br />
begin<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; f := 1<br />
end;<br />
<br />
procedure p (a:integer);<br />
begin<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; write(f+a)<br />
end;<br />
<br />
begin<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; x := 1;<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p (x)<br />
end.<br />
<br />
prosiłbym o pomoc lub jakąkolwiek podpowiedź jak zacząć to zadanie rozwiązywać. czy tablica cymboli to tablica typu (identyfikator, typ, adress) ??<br />
<br />
byłbym bardzo wdzieczny za jakąkolwiek pomoc. dzieki
]]></description>
            <author> no_email@example.com (Marcin)</author>
            <pubDate>Sat, 20 Jun 2009 17:01:43 GMT</pubDate>
            <guid isPermaLink="false">http://forum.fedorapl.org/276</guid>
        </item>
        <item>
            <title>Potoki</title>
            <link>http://forum.fedorapl.org/thread/224</link>
            <description><![CDATA[
Mam do napisania program, który będzie działał‚ tak jak polecenie unixowe wc w oparciu o potoki (operator |), tylko nie bardzo rozumiem o co tu chodzi .<br />
<br />
wiem, że wc - wypisuje liczbę bajtółw, słółw i linii w plikach (po wybraniu opcj lub wszystkie na raz)<br />
dla liczenia bajtów napisałem coś takiego :<br />
<br />
<tt><br />
/*program liczy znaki w pliku 'plik' Ilosc znakow to rownoczesnie<br />
&nbsp; wielkosc pliku w bajtach*/<br />
<br />
#include &lt;stdlib.h&gt; //wykorzystanie dla funkcji exit()<br />
#include &lt;fcntl.h&gt;<br />
<br />
#define BUFROZ 1<br />
main()<br />
{<br />
&nbsp;&nbsp;&nbsp; int desp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //deskryptor pliku<br />
&nbsp;&nbsp;&nbsp; char buf[BUFROZ];<br />
&nbsp;&nbsp;&nbsp; char buf2[BUFROZ];<br />
&nbsp;&nbsp;&nbsp; int czytaj;<br />
&nbsp;&nbsp;&nbsp; int licz_zn;<br />
&nbsp;&nbsp;&nbsp; char t;&nbsp; &nbsp; <br />
&nbsp;&nbsp;&nbsp; /*<br />
&nbsp;&nbsp;&nbsp; */<br />
&nbsp;&nbsp;&nbsp; if((desp = open("plik", O_RDONLY)) == -1) //w wypadku błędu funkcja<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //open zwraca -1<br />
&nbsp;&nbsp;&nbsp; {<br />
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; printf("Nie moge otworzyc pliku 'plik' ");<br />
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; exit(1);<br />
&nbsp;&nbsp;&nbsp; }<br />
&nbsp;&nbsp;&nbsp; <br />
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; while((czytaj = read(desp, buf, BUFROZ)) &gt;0)<br />
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; licz_zn+=czytaj;&nbsp; &nbsp; <br />
&nbsp;&nbsp; <br />
&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; printf("Ilosc znakow w pliku wynosi : %d", licz_zn);<br />
&nbsp;&nbsp; &nbsp;&nbsp; <br />
&nbsp;&nbsp;&nbsp; close(desp);<br />
&nbsp;&nbsp;&nbsp; exit(0);&nbsp; &nbsp; &nbsp;&nbsp; <br />
}<br />
<br />
</tt>
<br />
Problem pojawia się przy liczeniu słów, chciałbym porównywać element z bufora&nbsp; jakiś np. b w instrukcji np. if( b [ i ] ==' ' &amp;&amp; b[i+1] != ' '){ ilosc_wyrazow= ilosc_wyrazow +1}<br />
tylko nie wiem jak z bufora wyciągnąć to b. Możnaby&nbsp; zrobić to przy użyciu ifstream&nbsp; ale to już chyba nie będzie w oparciu o potoki ? <br />
<br />
A tego polecenia to już zupełnie nie rozumiem : Przepisac ostatni program tak, aby dzialal w trybie interaktywnym. Przykladowo wprowadzamy lancuch oraniczony konfigurowalnymi z linii komend tagami, (nie przerywamy po wcisnieciu enter, konieczne napotkanie taga) a wc robi swoje... i od nowa.<br />
Czy mógłby to ktoś przełożyć na Polski <img src="http://forum.fedorapl.org/unb_lib/designs/_smile/unb/smile.png" title=":)" alt=":)" style="vertical-align:middle;width:15px;height:15px;" class="smilie" />
]]></description>
            <author> no_email@example.com (parsival)</author>
            <pubDate>Fri, 21 Mar 2008 21:13:39 GMT</pubDate>
            <guid isPermaLink="false">http://forum.fedorapl.org/224</guid>
        </item>
        <item>
            <title>Funkcja fork() / procesy potomne i macierzyste</title>
            <link>http://forum.fedorapl.org/thread/223</link>
            <description><![CDATA[
NIe moge zrozumieć co właściwie dzieje się po uruchomieniu tego programu:<br />
<tt>#include &lt;stdio.h&gt;<br />
#include &lt;stdlib.h&gt;<br />
#include &lt;unistd.h&gt;<br />
#include &lt;sys/types.h&gt;<br />
#include&lt;sys/wait.h&gt;<br />
<br />
int main(int argc, char **argr)<br />
{<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; int i=0;<br />
<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; for(i=0;i&lt;3;i++){<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; switch(fork()) <br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; case -1 : perror("Fork error "); exit(-1);break; //chyba jeżeli funkcja nie ma procesów potomnych<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; case 0:&nbsp; sleep(1) ;printf("------- %lu \n", getpid());break; //funkcja sleep usypia przypadek case 0 na 1s<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // proces potomny<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; default:&nbsp; printf("+++++++++ %lu \n", getpid());//default jest wykonywany gdy nie zajdzie dopasowanie do żadnego case<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //proces macieżyst<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; wait(NULL); //czekanie na proces potomny<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; }<br />
<br />
exit(0);<br />
}<br />
</tt>
po wykonaniu dostaje:<br />
[DAMIAN@DAMIAN ex01_02]$ ./fork.x<br />
+++++++++ 3403 <br />
------- 3404 <br />
+++++++++ 3404 <br />
------- 3405 <br />
+++++++++ 3405 <br />
------- 3406 <br />
+++++++++ 3404 <br />
------- 3409 <br />
+++++++++ 3403 <br />
------- 3410 <br />
+++++++++ 3410 <br />
------- 3411 <br />
+++++++++ 3403 <br />
------- 3412 <br />
<br />
i moje pytanie:<br />
1. Dlaczego są 3 procesy macierzyste 3403 a żadnych potomnych? <br />
2. Dlaczego jest proces potomny 3412 a nie ma procesu macerzystego 3412? <br />
3. I jak narysować drzewo procesów dla tego programu?(to chyb ma tak wyglądać tylko teraz jak za "o" wstawić numery&nbsp; &nbsp; ptocesów??)<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; o<br />
&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; |__o<br />
|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; |&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o<br />
|_____|_______|__o<br />
|&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; o<br />
|_____|___o<br />
|<br />
|____o<br />
|<br />
|<br />
o
]]></description>
            <author> no_email@example.com (parsival)</author>
            <pubDate>Sat, 15 Mar 2008 11:46:55 GMT</pubDate>
            <guid isPermaLink="false">http://forum.fedorapl.org/223</guid>
        </item>
        <item>
            <title>wyrażenie regularne</title>
            <link>http://forum.fedorapl.org/thread/134</link>
            <description><![CDATA[
Mam taki mały problem. Plik z takimi wpisami<br />
<br />
<tt>define('ABC', 'coś tam');<br />
define('DEF', 'coś innego');<br />
</tt>
....&nbsp; x 800 <img src="http://forum.fedorapl.org/unb_lib/designs/_smile/unb/wink.png" title=";-)" alt=";-)" style="vertical-align:middle;width:15px;height:15px;" class="smilie" /><br />
a potrzebuje mieć coś takiego:<br />
<br />
<tt>defined('ABC',) or define('ABC', 'coś tam');<br />
defined('DEF') or define('DEF', 'coś innego');<br />
</tt>
<br />
Jak musiałby wyglądać regex aby ten plik tak przerobić ??<br />
<br />
Będę wdzięczny <img src="http://forum.fedorapl.org/unb_lib/designs/_smile/unb/grin.png" title=":-D" alt=":-D" style="vertical-align:middle;width:15px;height:15px;" class="smilie" /> ..
]]></description>
            <author> no_email@example.com (neo_fox)</author>
            <pubDate>Sat, 17 Feb 2007 22:23:11 GMT</pubDate>
            <guid isPermaLink="false">http://forum.fedorapl.org/134</guid>
        </item>
        <item>
            <title>eclipse + NLpack2</title>
            <link>http://forum.fedorapl.org/thread/88</link>
            <description><![CDATA[
Zainstalowałem sobie eclipse oraz NLpack2 w celu użytkowania w naszym rodzimym języku. Problem mam taki, że nie za bardzo orientuję się w interfejsie tego programu i nie wiem gdzie się to spolszczenie ustawia.<br />
<br />
Pomoże ktoś? <img src="http://forum.fedorapl.org/unb_lib/designs/_smile/unb/smile.png" title=":)" alt=":)" style="vertical-align:middle;width:15px;height:15px;" class="smilie" />
]]></description>
            <author> no_email@example.com (gwiazdor_online)</author>
            <pubDate>Sun, 10 Dec 2006 03:50:01 GMT</pubDate>
            <guid isPermaLink="false">http://forum.fedorapl.org/88</guid>
        </item>
    </channel>
</rss>
