Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add various getters to task structure:
[simgrid.git] / src / simdag / sd_daxloader.c
1 /* Copyright (c) 2009 Da SimGrid Team.  All rights reserved.                */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "private.h"
7 #include "simdag/simdag.h"
8 #include "xbt/misc.h"
9 #include "xbt/log.h"
10
11 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd,"Parsing DAX files");
12
13 #undef CLEANUP
14 #include "dax_dtd.h"
15 #include "dax_dtd.c"
16
17 static YY_BUFFER_STATE input_buffer;
18
19 static xbt_dynar_t result;
20
21 static void SD_task_free(void*t){
22   SD_task_destroy(t);
23 }
24
25 xbt_dynar_t SD_daxload(const char*filename) {
26   FILE* in_file = fopen(filename,"r");
27   xbt_assert1(in_file, "Unable to open \"%s\"\n", filename);
28   input_buffer =
29     dax__create_buffer(in_file, 10);
30   dax__switch_to_buffer(input_buffer);
31   dax_lineno = 1;
32
33   result = xbt_dynar_new(sizeof(SD_task_t),SD_task_free);
34   xbt_assert2(!dax_lex(),"Parse error in %s: %s",filename,dax__parse_err_msg());
35   dax__delete_buffer(input_buffer);
36   fclose(in_file);
37   return result;
38 }
39
40 void STag_dax__adag(void) {
41   double version = 0.0;
42
43   INFO0("See <adag>");
44   sscanf(A_dax__adag_version, "%lg", &version);
45
46   xbt_assert1((version == 2.1), "Expected version 2.1, got %f. Fix the parser or your file",version);
47 }
48 void STag_dax__job(void) {
49   INFO0("See <job>");
50 }
51 void STag_dax__child(void) {
52   INFO0("See <child>");
53 }
54 void STag_dax__parent(void) {
55   INFO0("See <parent>");
56 }
57 void STag_dax__uses(void) {
58   INFO0("See <uses>");
59 }
60 void ETag_dax__adag(void) {
61   INFO0("See </adag>");
62 }
63 void ETag_dax__job(void) {
64   INFO0("See </job>");
65 }
66 void ETag_dax__child(void) {
67   INFO0("See </child>");
68 }
69 void ETag_dax__parent(void) {
70   INFO0("See </parent>");
71 }
72 void ETag_dax__uses(void) {
73   INFO0("See </uses>");
74 }