From b3f448e0ccc0e5e0195bfba380b1ba3a5c5b10b6 Mon Sep 17 00:00:00 2001 From: mquinson Date: Mon, 31 Jul 2006 19:07:48 +0000 Subject: [PATCH] Massive file renaming (stupid CVS) so that we can have more than 9 lessons and still have the files sorted in the right order; make room for a lesson on simple data exchange git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2667 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- doc/gtut-files/Makefile | 6 +++++ ...our-1-bones.doc => gtut-tour-01-bones.doc} | 4 +-- ...r-2-simple.doc => gtut-tour-02-simple.doc} | 12 ++++----- ...-tour-3-args.doc => gtut-tour-03-args.doc} | 8 +++--- ...callback.doc => gtut-tour-04-callback.doc} | 6 ++--- ...5-globals.doc => gtut-tour-05-globals.doc} | 12 ++++----- ...-tour-6-logs.doc => gtut-tour-06-logs.doc} | 12 ++++----- ...r-7-timers.doc => gtut-tour-07-timers.doc} | 10 +++---- ...ptions.doc => gtut-tour-08-exceptions.doc} | 8 +++--- doc/gtut-tour-09-simpledata.doc | 26 +++++++++++++++++++ ...ut-tour-9-rpc.doc => gtut-tour-10-rpc.doc} | 6 ++--- 11 files changed, 71 insertions(+), 39 deletions(-) rename doc/{gtut-tour-1-bones.doc => gtut-tour-01-bones.doc} (98%) rename doc/{gtut-tour-2-simple.doc => gtut-tour-02-simple.doc} (97%) rename doc/{gtut-tour-3-args.doc => gtut-tour-03-args.doc} (93%) rename doc/{gtut-tour-4-callback.doc => gtut-tour-04-callback.doc} (97%) rename doc/{gtut-tour-5-globals.doc => gtut-tour-05-globals.doc} (95%) rename doc/{gtut-tour-6-logs.doc => gtut-tour-06-logs.doc} (97%) rename doc/{gtut-tour-7-timers.doc => gtut-tour-07-timers.doc} (96%) rename doc/{gtut-tour-8-exceptions.doc => gtut-tour-08-exceptions.doc} (98%) create mode 100644 doc/gtut-tour-09-simpledata.doc rename doc/{gtut-tour-9-rpc.doc => gtut-tour-10-rpc.doc} (77%) diff --git a/doc/gtut-files/Makefile b/doc/gtut-files/Makefile index 8f8cadaff0..212d62ed61 100644 --- a/doc/gtut-files/Makefile +++ b/doc/gtut-files/Makefile @@ -219,6 +219,12 @@ clean:: _8-exceptions_client.c _8-exceptions_server.c _8-exceptions_simulator.c: 8-exceptions.c 3-args.xml ../../tools/gras/gras_stub_generator 8-exceptions 3-args.xml >/dev/null +# Lesson 9: simple data exchange +######################################## +9-simpledata: 9-simpledata.c + gcc -I$(GRAS_ROOT)/include -lgras -L$(GRAS_ROOT)/lib $^ -o $@ + + clean:: if [ -e 8-exceptions.mk ] ; then make -f 8-exceptions.mk clean; fi rm -f _8-exceptions_client.c _8-exceptions_server.c _8-exceptions_simulator.c 8-exceptions.trace 8-exceptions.mk diff --git a/doc/gtut-tour-1-bones.doc b/doc/gtut-tour-01-bones.doc similarity index 98% rename from doc/gtut-tour-1-bones.doc rename to doc/gtut-tour-01-bones.doc index 642b37d702..394d5258b6 100644 --- a/doc/gtut-tour-1-bones.doc +++ b/doc/gtut-tour-01-bones.doc @@ -73,7 +73,7 @@ It is not enough to have one of the processes initializing the framework since in RL, each of them will run on a different host. If you use some AMOK modules, you have to initialize them in each process too. -The source file then reads: \include 1-bones.c +The source file then reads: \include 01-bones.c That's it. You have a working GRAS application with two processes. They don't do anything useful, but that's a beginning. Let's see how to bring @@ -183,7 +183,7 @@ There is nothing to know to start your processes in RL. Simply call the generated binaries, and that's it. To start the simulation, simply call: \verbatim ./_simulator platform.xml deployment.xml\endverbatim -Here is an example of execution: \include 1-bones.output +Here is an example of execution: \include 01-bones.output That's it. You are done with this lesson and can now write, build and execute GRAS applications as long as they don't do anything ;) Move diff --git a/doc/gtut-tour-2-simple.doc b/doc/gtut-tour-02-simple.doc similarity index 97% rename from doc/gtut-tour-2-simple.doc rename to doc/gtut-tour-02-simple.doc index 3fcfab6751..3dfba8fd4e 100644 --- a/doc/gtut-tour-2-simple.doc +++ b/doc/gtut-tour-02-simple.doc @@ -22,7 +22,7 @@ Fortunately, such discrepency will be detected in SG. We won't convey any payload in this lesson, so we just have to give the name of message to declare them: -\dontinclude 2-simple.c +\dontinclude 02-simple.c \skip gras_msgtype_declare \until gras_msgtype_declare @@ -65,7 +65,7 @@ messages, you have to create a so-called client socket. For this, use \ref gras_socket_client with the hostname and the port of the process you want to contact as arguments. Our client should simply do: -\dontinclude 2-simple.c +\dontinclude 02-simple.c \skip socket_client \until socket_client @@ -85,7 +85,7 @@ message, the message type, and a pointer to the actual content of the message. The simplest way to retrive a message type from its name is to use \ref gras_msgtype_by_name. Since we don't have any payload, this becomes: -\dontinclude 2-simple.c +\dontinclude 02-simple.c \skip msg_send \until msg_send @@ -97,7 +97,7 @@ message you received while the last argument is where to put the payload. Since our server is willing to wait up to 60 seconds for a message, the following will do it: -\dontinclude 2-simple.c +\dontinclude 02-simple.c \skip msg_wait \until msg_wait @@ -107,14 +107,14 @@ Here is the complete code of this example. Note the use of the functions \ref gras_socket_my_port, \ref gras_socket_peer_name and \ref gras_socket_peer_port to retrieve information about who you are connected to. -\include 2-simple.c +\include 02-simple.c Here is the output of the simulator. Note that \ref gras_socket_peer_port actually returns the port number of the server of the peer. This may sound a bit strange to BSD experts, but it is actually really useful: you can store this value, and contact your peer afterward passing this number to \ref gras_socket_client . -\include 2-simple.output +\include 02-simple.output Here we are, you now know how to exchange messages between peers. There is still a large room for improvement, such as adding payload to messages. But diff --git a/doc/gtut-tour-3-args.doc b/doc/gtut-tour-03-args.doc similarity index 93% rename from doc/gtut-tour-3-args.doc rename to doc/gtut-tour-03-args.doc index b8a69dbbe0..33042c2ead 100644 --- a/doc/gtut-tour-3-args.doc +++ b/doc/gtut-tour-03-args.doc @@ -19,7 +19,7 @@ situation. In RL, the situation is quite simple: we just have to use the command line arguments as we would do in a usual C program. In the server, only change concern the opennong of the master socket: -\dontinclude 3-args.c +\dontinclude 03-args.c \skip gras_socket_server \until gras_socket_server @@ -33,16 +33,16 @@ The rest of the program remains inchanged. At this point, the problem is to pass arguments to the processes in SG. Fortunately, it is quite simple. You just have to edit your deployment file -so that it reads: \include 3-args.xml +so that it reads: \include 03-args.xml The syntax should be self-explanatory at this point. \section GRAS_tut_tour_args_recap Recaping everything together The whole program now reads: -\include 3-args.c +\include 03-args.c And here is the output: -\include 3-args.output +\include 03-args.output Go to \ref GRAS_tut_tour_callbacks diff --git a/doc/gtut-tour-4-callback.doc b/doc/gtut-tour-04-callback.doc similarity index 97% rename from doc/gtut-tour-4-callback.doc rename to doc/gtut-tour-04-callback.doc index 5cf803f236..a782ed3b5d 100644 --- a/doc/gtut-tour-4-callback.doc +++ b/doc/gtut-tour-04-callback.doc @@ -29,7 +29,7 @@ if we managed to deal properly with the message to mimic "main()" semantic. That's historical, but I may change this in the future (no worry, I'll add backward compatibility solutions). Here is the actual code of our callback: -\dontinclude 4-callback.c +\dontinclude 04-callback.c \skip gras_msg_cb_ctx_t \until end_of_callback @@ -66,10 +66,10 @@ We have no such needs in our example, so the code simply reads: \section GRAS_tut_tour_callback_recap Recaping everything together The whole program now reads: -\include 4-callback.c +\include 04-callback.c And here is the output (unchanged wrt previous version): -\include 4-callback.output +\include 04-callback.output Our little example turns slowly to a quite advanced GRAS program. It entails most of the mecanism most program will use. diff --git a/doc/gtut-tour-5-globals.doc b/doc/gtut-tour-05-globals.doc similarity index 95% rename from doc/gtut-tour-5-globals.doc rename to doc/gtut-tour-05-globals.doc index b14acd8c5d..b0bb570d82 100644 --- a/doc/gtut-tour-5-globals.doc +++ b/doc/gtut-tour-05-globals.doc @@ -28,7 +28,7 @@ it with the gras_userdata_* functions (there is only 3 of them ;). We will now modify the example to add a "kill" message, and let the server loop on incoming messages until it gets such a message. We only need a boolean, so the structure is quite simple: -\dontinclude 5-globals.c +\dontinclude 05-globals.c \skip struct \until server_data @@ -38,19 +38,19 @@ helper macro mallocing the space needed by the structure and passing it to gras using the latter function. If you go for gras_userdata_set(), you should pass it a pointer to your data you want to retrieve afterward. -\dontinclude 5-globals.c +\dontinclude 05-globals.c \skip userdata_new \until userdata_new Once you declared a global that way, retriving this (for example in a callback) is really easy: -\dontinclude 5-globals.c +\dontinclude 05-globals.c \skip userdata_get \until userdata_get We can now write the callback, which simply retrive the globals and change the value of the kileld field. -\dontinclude 5-globals.c +\dontinclude 05-globals.c \skip kill_cb \until end_of_kill_callback @@ -80,10 +80,10 @@ at run time. \section GRAS_tut_tour_callback_recap Recaping everything together The whole program now reads: -\include 5-globals.c +\include 05-globals.c And here is the output (unchanged wrt previous version): -\include 5-globals.output +\include 05-globals.output That's it, we're done. We have a server able to handle any number of messages, which the client can stop remotely properly. That's already diff --git a/doc/gtut-tour-6-logs.doc b/doc/gtut-tour-06-logs.doc similarity index 97% rename from doc/gtut-tour-6-logs.doc rename to doc/gtut-tour-06-logs.doc index 56f9da0949..76826c459d 100644 --- a/doc/gtut-tour-6-logs.doc +++ b/doc/gtut-tour-06-logs.doc @@ -13,7 +13,7 @@ Let's have another look at the output of the program we came up with in lesson 5: -\include 5-globals.output +\include 05-globals.output It is a bit difficult to read, isn't it? Indeed, it is hard to identify which process printed which line. It would be possible to add [server] in @@ -72,7 +72,7 @@ of channel we want: What we want here is a root category (it does not belong to any existing channel, for sure), and we want it to be the default one in our file (of course, it's the only one). -\dontinclude 6-logs.c +\dontinclude 06-logs.c \skip XBT_LOG \until XBT_LOG @@ -94,10 +94,10 @@ line, it gets automatically added. Once we changed any fprintf of our code to some of these macros, the program may read: -\include 6-logs.c +\include 06-logs.c And the output now looks better: -\include 6-logs.output +\include 06-logs.output \section GRAS_tut_tour_logs_config The user side: configuring logs at run time @@ -105,10 +105,10 @@ Once we changed our program to use proper logging, it is naturally possible to choose at run time what we want to see. For example, if we want more details about our code, we should do (note that a VERBOSE line appears on client side): -\include 6-logs.output.verbose +\include 06-logs.output.verbose On the contrary, if we want to reduce the amount of logging, we may want to -do: \include 6-logs.output.error +do: \include 06-logs.output.error Again, you should refer to the \ref XBT_log section for more information on how to configure the logs. Or you can proceed with the next lesson, of diff --git a/doc/gtut-tour-7-timers.doc b/doc/gtut-tour-07-timers.doc similarity index 96% rename from doc/gtut-tour-7-timers.doc rename to doc/gtut-tour-07-timers.doc index 3994597199..e8fdcb9067 100644 --- a/doc/gtut-tour-7-timers.doc +++ b/doc/gtut-tour-07-timers.doc @@ -52,7 +52,7 @@ first need to add a global to the server too, containing the socket binded onto the server (to send messages) and a boolean indicating whether we are done or not, just like we did on the server side in \ref GRAS_tut_tour_globals. Here is the resulting global structure: -\dontinclude 7-timers.c +\dontinclude 07-timers.c \skip client_data \until client_data_t @@ -71,7 +71,7 @@ Desinstalling this is not harder. You tell the action to unschedule, and the periodicity at which it was desinstalled (so that the same action can be scheduled at different intervals, and each of them be desinstallable separately). -\dontinclude 7-timers.c +\dontinclude 07-timers.c \skip gras_timer_cancel_repeat \until gras_timer_cancel_repeat @@ -79,7 +79,7 @@ Then comes the delayed action in charge of stopping everything, which should be self-explanatory at this point. It could be cancelled before its expiration using gras_timer_cancel_delay(), which accepts exactly the same kind of arguments than gras_timer_cancel_repeat(). -\dontinclude 7-timers.c +\dontinclude 07-timers.c \skip client_do_stop \until end_of_client_do_stop @@ -89,10 +89,10 @@ modifications, as you can see in the recapping below. \section GRAS_tut_tour_timers_recap Recapping everything together The program now reads: -\include 7-timers.c +\include 07-timers.c Which produces the expected output: -\include 7-timers.output +\include 07-timers.output Go to \ref GRAS_tut_tour_exceptions diff --git a/doc/gtut-tour-8-exceptions.doc b/doc/gtut-tour-08-exceptions.doc similarity index 98% rename from doc/gtut-tour-8-exceptions.doc rename to doc/gtut-tour-08-exceptions.doc index 0d541c0534..5f646cf786 100644 --- a/doc/gtut-tour-8-exceptions.doc +++ b/doc/gtut-tour-08-exceptions.doc @@ -108,7 +108,7 @@ have to find from itself. For this, it will try to open socket and send the kill message to each ports of the search range. If it manage to close the socket after sending the message without being interrupted by an exception, it can assume that it killed the server and stop searching. -\dontinclude 8-exceptions.c +\dontinclude 08-exceptions.c \skip port=3000 \until end_of_loop @@ -116,7 +116,7 @@ To make the game a bit more fun (and to show you what an exception actually look like when it's not catched), we add a potential command line argument to the server, asking it to cheat and to not open its port within the search range but elsewhere: -\dontinclude 8-exceptions.c +\dontinclude 08-exceptions.c \skip strcmp \until gras_socket_my_port \until } @@ -140,10 +140,10 @@ Unfortunately, this feature is only offered under Linux for now since I have no idea of how to retrieve the call stack of the current process under the other operating systems. But help is always welcome in this area too ;) -\include 8-exceptions.output +\include 08-exceptions.output The complete program reads: -\include 8-exceptions.c +\include 08-exceptions.c Go to \ref GRAS_tut_tour_rpc diff --git a/doc/gtut-tour-09-simpledata.doc b/doc/gtut-tour-09-simpledata.doc new file mode 100644 index 0000000000..d5482a0e31 --- /dev/null +++ b/doc/gtut-tour-09-simpledata.doc @@ -0,0 +1,26 @@ +/** +@page GRAS_tut_tour_simpledata Lesson 9: Exchanging simple data (TODO) + +\section GRAS_tut_tour_simpledata_toc Table of Contents + - \ref GRAS_tut_tour_simpledata_intro + - \ref GRAS_tut_tour_simpledata_use + - \ref GRAS_tut_tour_simpledata_recap + +
+ +\section GRAS_tut_tour_simpledata_intro Introduction + + +\section GRAS_tut_tour_simpledata_use Actually exchanging simple data in messages + + +\section GRAS_tut_tour_simpledata_recap Recapping everything together + +The program now reads: +\include 09-simpledata.c + +Which produces the expected output: +\include 09-simpledata.output + + +*/ diff --git a/doc/gtut-tour-9-rpc.doc b/doc/gtut-tour-10-rpc.doc similarity index 77% rename from doc/gtut-tour-9-rpc.doc rename to doc/gtut-tour-10-rpc.doc index 0c6d86e150..4684cf03c1 100644 --- a/doc/gtut-tour-9-rpc.doc +++ b/doc/gtut-tour-10-rpc.doc @@ -1,5 +1,5 @@ /** -@page GRAS_tut_tour_rpc Lesson 9: Remote Procedure Calling (RPCing) (TODO) +@page GRAS_tut_tour_rpc Lesson 10: Remote Procedure Calling (RPCing) (TODO) \section GRAS_tut_tour_rpc_toc Table of Contents - \ref GRAS_tut_tour_rpc_intro @@ -17,10 +17,10 @@ \section GRAS_tut_tour_rpc_recap Recapping everything together The program now reads: -\include 9-rpc.c +\include 10-rpc.c Which produces the expected output: -\include 9-rpc.output +\include 10-rpc.output */ -- 2.20.1