home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume27 / distributed-c-2.1 / part13 < prev    next >
Text File  |  1993-12-22  |  91KB  |  2,480 lines

  1. Newsgroups: comp.sources.unix
  2. From: pleierc@informatik.tu-muenchen.de (Christoph Pleier)
  3. Subject: v27i187: distributed-c-2.1 - Distributed C Development Environment, V2.1, Part13/18
  4. References: <1.756634932.28500@gw.home.vix.com>
  5. Sender: unix-sources-moderator@gw.home.vix.com
  6. Approved: vixie@gw.home.vix.com
  7.  
  8. Submitted-By: pleierc@informatik.tu-muenchen.de (Christoph Pleier)
  9. Posting-Number: Volume 27, Issue 187
  10. Archive-Name: distributed-c-2.1/part13
  11.  
  12. #! /bin/sh
  13. # This is a shell archive.  Remove anything before this line, then unpack
  14. # it by saving it into a file and typing "sh file".  To overwrite existing
  15. # files, type "sh file -c".  You can also feed this as standard input via
  16. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  17. # will see the following message at the end:
  18. #        "End of archive 13 (of 18)."
  19. # Contents:  dcc/code_convert.c dcc/symb_others.c
  20. #   examples/config/system.FICT lib/ipc_iPSC.c
  21. # Wrapped by vixie@gw.home.vix.com on Thu Dec 23 00:12:05 1993
  22. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  23. if test -f 'dcc/code_convert.c' -a "${1}" != "-c" ; then 
  24.   echo shar: Will not clobber existing file \"'dcc/code_convert.c'\"
  25. else
  26. echo shar: Extracting \"'dcc/code_convert.c'\" \(24017 characters\)
  27. sed "s/^X//" >'dcc/code_convert.c' <<'END_OF_FILE'
  28. X/***************************************************************************
  29. X *                                                                         *
  30. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  31. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  32. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  33. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  34. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  35. X *                                                                         *
  36. X *              A compiler for distributed programming with C              *
  37. X *                                                                         *
  38. X *                       c o d e _ c o n v e r t . c                       *
  39. X *                                                                         *
  40. X *                            Package : Compiler                           *
  41. X *                            Version : 1.0                                *
  42. X *                       CreationDate : 08.06.91                           *
  43. X *                         LastUpDate : 08.06.91                           *
  44. X *                                                                         *
  45. X *             All routines converting attributes to strings.              *
  46. X *                                                                         *
  47. X *               Copyright (C) 1991-1994 by Christoph Pleier               *
  48. X *                          All rights reserved!                           *
  49. X ***************************************************************************/
  50. X
  51. X/*
  52. X * This file is part of the Distributed C Development Environment (DCDE).
  53. X * DCDE is free software; you can redistribute it and/or modify
  54. X * it under the terms written in the README-file. 
  55. X * DCDE is distributed in the hope that it will be useful,
  56. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  57. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  58. X * See the file README for more details.
  59. X */
  60. X
  61. X#include <stdio.h>
  62. X#include <string.h>
  63. X#include "config.h"
  64. X#include "extern.h"
  65. X#include "functions.h"
  66. X
  67. X/******************************************************************************
  68. X * convert_su_to_string()                                                     *
  69. X *                                                                            *
  70. X * Converts a struct or union attribute to a string.                          *
  71. X *                                                                            *
  72. X * Return values: pointer to created string upon success /                    *
  73. X *                NULL during error handling                                  *
  74. X ******************************************************************************/
  75. Xchar *
  76. Xconvert_su_to_string(buffer, struct_or_union)
  77. Xchar *buffer;
  78. XSU_ATTR *struct_or_union;
  79. X{
  80. X    if (errflag || !struct_or_union)
  81. X    return(buffer);
  82. X#ifdef CODEDEBUG
  83. X    fprintf(debugfile, "[code] ***** convert_su_to_string():\n");
  84. X#endif /* CODEDEBUG /**/
  85. X    switch(struct_or_union->type) {
  86. X    case SU_ATTR_STRUCT:
  87. X        buffer = Strcat(buffer, "struct ");
  88. X        break;
  89. X    case SU_ATTR_UNION:
  90. X        buffer = Strcat(buffer, "union ");
  91. X        break;
  92. X    default:
  93. X        Panic("unknown SU_ATTR type in convert_su_to_string()");
  94. X    } /* switch */
  95. X    return(buffer);
  96. X} /* convert_su_to_string */
  97. X
  98. X/******************************************************************************
  99. X * convert_ts_to_string()                                                     *
  100. X *                                                                            *
  101. X * Converts a type attribute to a string.                                     *
  102. X *                                                                            *
  103. X * Return values: pointer to created string upon success /                    *
  104. X *                NULL during error handling                                  *
  105. X ******************************************************************************/
  106. Xchar *
  107. Xconvert_ts_to_string(buffer, type_specifier, stl_flag)
  108. Xchar *buffer;
  109. XTS_ATTR *type_specifier;
  110. Xchar stl_flag;
  111. X{
  112. X    if (errflag || !type_specifier)
  113. X    return(buffer);
  114. X#ifdef CODEDEBUG
  115. X    fprintf(debugfile, "[code] ***** convert_ts_to_string():\n");
  116. X#endif /* CODEDEBUG /**/
  117. X    switch(type_specifier->type) {
  118. X    case TS_ATTR_VOID:
  119. X        buffer = Strcat(buffer, "void ");
  120. X        break;
  121. X    case TS_ATTR_CHAR:
  122. X        buffer = Strcat(buffer, "char ");
  123. X        break;
  124. X    case TS_ATTR_SHORT:
  125. X        buffer = Strcat(buffer, "short ");
  126. X        break;
  127. X    case TS_ATTR_INT:
  128. X        buffer = Strcat(buffer, "int ");
  129. X        break;
  130. X    case TS_ATTR_LONG:
  131. X        buffer = Strcat(buffer, "long ");
  132. X        break;
  133. X    case TS_ATTR_FLOAT:
  134. X        buffer = Strcat(buffer, "float ");
  135. X        break;
  136. X    case TS_ATTR_DOUBLE:
  137. X        buffer = Strcat(buffer, "double ");
  138. X        break;
  139. X    case TS_ATTR_PROCESS:
  140. X        buffer = Strcat(buffer, "PROCESSDESCR ");
  141. X        break;
  142. X    case TS_ATTR_SIGNED:
  143. X        buffer = Strcat(buffer, "signed ");
  144. X        break;
  145. X    case TS_ATTR_UNSIGNED:
  146. X        buffer = Strcat(buffer, "unsigned ");
  147. X        break;
  148. X    case TS_ATTR_ENUM:
  149. X        buffer = Strcat(buffer, type_specifier->info.enuminfo->codestr);
  150. X        break;
  151. X    case TS_ATTR_STRUCT:
  152. X        buffer = convert_sus_to_string(buffer, 
  153. X        type_specifier->info.structinfo, stl_flag);
  154. X        break;
  155. X    case TS_ATTR_TYPENAME:
  156. X        buffer = Strcatmany(buffer, 2, type_specifier->info.typedefname->name, " ");
  157. X        break;
  158. X    default:
  159. X        Panic("unknown TS_ATTR type in convert_ts_to_string()");
  160. X    } /* switch */
  161. X    return(buffer);
  162. X} /* convert_ts_to_string */
  163. X
  164. X/******************************************************************************
  165. X * convert_tq_to_string()                                                     *
  166. X *                                                                            *
  167. X * Converts a type qualifier to a string.                                     *
  168. X *                                                                            *
  169. X * Return values: pointer to created string upon success /                    *
  170. X *                NULL during error handling                                  *
  171. X ******************************************************************************/
  172. Xchar *
  173. Xconvert_tq_to_string(buffer, type_qualifier)
  174. Xchar *buffer;
  175. XTQ_ATTR *type_qualifier;
  176. X{
  177. X    if (errflag || !type_qualifier)
  178. X    return(buffer);
  179. X#ifdef CODEDEBUG
  180. X    fprintf(debugfile, "[code] ***** convert_tq_to_string():\n");
  181. X#endif /* CODEDEBUG /**/
  182. X    switch(type_qualifier->type) {
  183. X    case TQ_ATTR_CONST:
  184. X        buffer = Strcat(buffer, "const ");
  185. X        break;
  186. X    case TQ_ATTR_VOLATILE:
  187. X        buffer = Strcat(buffer, "volatile ");
  188. X        break;
  189. X    default:
  190. X        Panic("unknown TQ_ATTR type in convert_tq_to_string()");
  191. X    } /* switch */
  192. X    return(buffer);
  193. X} /* convert_tq_to_string */
  194. X
  195. X/******************************************************************************
  196. X * convert_scs_to_string()                                                    *
  197. X *                                                                            *
  198. X * Converts a storage class specifier attribute to a string.                  *
  199. X *                                                                            *
  200. X * Return values: pointer to created string upon success /                    *
  201. X *                NULL during error handling                                  *
  202. X ******************************************************************************/
  203. Xchar *
  204. Xconvert_scs_to_string(buffer, storage_class_specifier)
  205. Xchar *buffer;
  206. XSCS_ATTR *storage_class_specifier;
  207. X{
  208. X    if (errflag || !storage_class_specifier)
  209. X    return(buffer);
  210. X#ifdef CODEDEBUG
  211. X    fprintf(debugfile, "[code] ***** convert_scs_to_string():\n");
  212. X#endif /* CODEDEBUG /**/
  213. X    switch(storage_class_specifier->type) {
  214. X    case SCS_ATTR_AUTO:
  215. X        buffer = Strcat(buffer, "auto ");
  216. X        break;
  217. X    case SCS_ATTR_REGISTER:
  218. X        buffer = Strcat(buffer, "register ");
  219. X        break;
  220. X    case SCS_ATTR_STATIC:
  221. X        buffer = Strcat(buffer, "static ");
  222. X        break;
  223. X    case SCS_ATTR_EXTERN:
  224. X        buffer = Strcat(buffer, "extern ");
  225. X        break;
  226. X    case SCS_ATTR_TYPEDEF:
  227. X        buffer = Strcat(buffer, "typedef ");
  228. X        break;
  229. X    default:
  230. X        Panic("unknown SCS_ATTR type in convert_scs_to_string()");
  231. X    } /* switch */
  232. X    return(buffer);
  233. X} /* convert_scs_to_string */
  234. X
  235. X/******************************************************************************
  236. X * convert_tql_to_string()                                                    *
  237. X *                                                                            *
  238. X * Converts a type qualifier list attribute to a string.                      *
  239. X *                                                                            *
  240. X * Return values: pointer to created string upon success /                    *
  241. X *                NULL during error handling                                  *
  242. X ******************************************************************************/
  243. Xchar *
  244. Xconvert_tql_to_string(buffer, type_qual_list)
  245. Xchar *buffer;
  246. XTQL_ATTR *type_qual_list;
  247. X{
  248. X    if (errflag || !type_qual_list)
  249. X    return(buffer);
  250. X#ifdef CODEDEBUG
  251. X    fprintf(debugfile, "[code] ***** convert_tql_to_string():\n");
  252. X#endif /* CODEDEBUG /**/
  253. X    buffer = convert_tql_to_string(buffer, type_qual_list->tq_list);
  254. X    buffer = convert_tq_to_string(buffer, type_qual_list->type_qualifier);
  255. X    return(buffer);
  256. X} /* convert_tql_to_string */
  257. X
  258. X/******************************************************************************
  259. X * convert_p_to_string()                                                      *
  260. X *                                                                            *
  261. X * Converts a pointer attribute to a string.                                  *
  262. X *                                                                            *
  263. X * Return values: pointer to created string upon success /                    *
  264. X *                NULL during error handling                                  *
  265. X ******************************************************************************/
  266. Xchar *
  267. Xconvert_p_to_string(buffer, pointer)
  268. Xchar *buffer;
  269. XP_ATTR *pointer;
  270. X{
  271. X    if (errflag || !pointer)
  272. X    return(buffer);
  273. X#ifdef CODEDEBUG
  274. X    fprintf(debugfile, "[code] ***** convert_p_to_string():\n");
  275. X#endif /* CODEDEBUG /**/
  276. X    buffer = Strcat(buffer, "*");
  277. X    if (pointer->type == P_ATTR_1 || pointer->type == P_ATTR_3)
  278. X    buffer = convert_tql_to_string(buffer, pointer->quali_list);
  279. X    if (pointer->type == P_ATTR_3 || pointer->type == P_ATTR_4)
  280. X    buffer = convert_p_to_string(buffer, pointer->pointer);
  281. X    return(buffer);
  282. X} /* convert_p_to_string */
  283. X
  284. X/******************************************************************************
  285. X * convert_dd_to_string()                                                     *
  286. X *                                                                            *
  287. X * Converts a direct declarator attribute to a string.                        *
  288. X *                                                                            *
  289. X * Return values: pointer to created string upon success /                    *
  290. X *                NULL during error handling                                  *
  291. X ******************************************************************************/
  292. Xchar *
  293. Xconvert_dd_to_string(buffer, direct_decl)
  294. Xchar *buffer;
  295. XDD_ATTR *direct_decl;
  296. X{
  297. X    if (errflag || !direct_decl)
  298. X    return(buffer);
  299. X#ifdef CODEDEBUG
  300. X    fprintf(debugfile, "[code] ***** convert_dd_to_string():\n");
  301. X#endif /* CODEDEBUG /**/
  302. X    switch(direct_decl->type) {
  303. X    case DD_ATTR_IDENT:
  304. X        buffer = Strcat(buffer, direct_decl->ident->name);
  305. X        break;
  306. X    case DD_ATTR_BRACED:
  307. X    buffer = Strcat(buffer, "(");
  308. X    buffer = convert_d_to_string(buffer, direct_decl->info.declarator);
  309. X    buffer = Strcat(buffer, ")");
  310. X        break;
  311. X    case DD_ATTR_ARRAY:
  312. X    buffer = convert_dd_to_string(buffer, direct_decl->info.comp.direct_decl);
  313. X    buffer = Strcatmany(buffer, 3, "[", direct_decl->info.comp.spec_str, "]");
  314. X    break;
  315. X    case DD_ATTR_FUNC:
  316. X    buffer = convert_dd_to_string(buffer, direct_decl->info.comp.direct_decl);
  317. X    buffer = Strcatmany(buffer, 3, "(", direct_decl->info.comp.spec_str, ")");
  318. X    break;
  319. X    } /* switch */
  320. X    return(buffer);
  321. X} /* convert_dd_to_string */
  322. X
  323. X/******************************************************************************
  324. X * convert_d_to_string()                                                      *
  325. X *                                                                            *
  326. X * Converts a declarator attribute to a string.                               *
  327. X *                                                                            *
  328. X * Return values: pointer to created string upon success /                    *
  329. X *                NULL during error handling                                  *
  330. X ******************************************************************************/
  331. Xchar *
  332. Xconvert_d_to_string(buffer, declarator)
  333. Xchar *buffer;
  334. XD_ATTR *declarator;
  335. X{
  336. X    if (errflag || !declarator)
  337. X    return(buffer);
  338. X#ifdef CODEDEBUG
  339. X    fprintf(debugfile, "[code] ***** convert_d_to_string():\n");
  340. X#endif /* CODEDEBUG /**/
  341. X    if (declarator->pointer)
  342. X    buffer = convert_p_to_string(buffer, declarator->pointer);
  343. X    buffer = convert_dd_to_string(buffer, declarator->direct_decl);
  344. X    return(buffer);
  345. X} /* convert_d_to_string */
  346. X
  347. X/******************************************************************************
  348. X * convert_sd_to_string()                                                     *
  349. X *                                                                            *
  350. X * Converts a struct declarator attribute to a string.                        *
  351. X *                                                                            *
  352. X * Return values: pointer to created string upon success /                    *
  353. X *                NULL during error handling                                  *
  354. X ******************************************************************************/
  355. Xchar *
  356. Xconvert_sd_to_string(buffer, struct_declarator)
  357. Xchar *buffer;
  358. XSD_ATTR *struct_declarator;
  359. X{
  360. X    if (errflag || !struct_declarator)
  361. X    return(buffer);
  362. X#ifdef CODEDEBUG
  363. X    fprintf(debugfile, "[code] ***** convert_sd_to_string():\n");
  364. X#endif /* CODEDEBUG /**/
  365. X    if (struct_declarator->decl) 
  366. X    buffer = convert_d_to_string(buffer, struct_declarator->decl);
  367. X    if (struct_declarator->const_expr)
  368. X    buffer = Strcatmany(buffer, 2, " : ", struct_declarator->const_expr);
  369. X    return(buffer);
  370. X} /* convert_sd_to_string */
  371. X
  372. X/******************************************************************************
  373. X * convert_sql_to_string()                                                    *
  374. X *                                                                            *
  375. X * Converts a specifier qualifier list attribute to a string.                 *
  376. X *                                                                            *
  377. X * Return values: pointer to created string upon success /                    *
  378. X *                NULL during error handling                                  *
  379. X ******************************************************************************/
  380. Xchar *
  381. Xconvert_sql_to_string(buffer, spec_qual_list)
  382. Xchar *buffer;
  383. XSQL_ATTR *spec_qual_list;
  384. X{
  385. X    if (errflag || !spec_qual_list)
  386. X    return(buffer);
  387. X#ifdef CODEDEBUG
  388. X    fprintf(debugfile, "[code] ***** convert_sql_to_string():\n");
  389. X#endif /* CODEDEBUG /**/
  390. X    if (spec_qual_list->type == SQL_ATTR_SPECIFIER)
  391. X    buffer = convert_ts_to_string(buffer, spec_qual_list->info.type_specifier, FALSE);
  392. X    else
  393. X    buffer = convert_tq_to_string(buffer, spec_qual_list->info.type_qualifier);
  394. X    if (spec_qual_list->sq_list)
  395. X        buffer = convert_sql_to_string(buffer, spec_qual_list->sq_list->sq_list);
  396. X    return(buffer);
  397. X} /* convert_sql_to_string */
  398. X
  399. X/******************************************************************************
  400. X * convert_sdl_to_string()                                                    *
  401. X *                                                                            *
  402. X * Converts a struct declarator list attribute to a string.                   *
  403. X *                                                                            *
  404. X * Return values: pointer to created string upon success /                    *
  405. X *                NULL during error handling                                  *
  406. X ******************************************************************************/
  407. Xchar *
  408. Xconvert_sdl_to_string(buffer, struct_decl_list)
  409. Xchar *buffer;
  410. XSDL_ATTR *struct_decl_list;
  411. X{
  412. X    if (errflag || !struct_decl_list)
  413. X    return(buffer);
  414. X#ifdef CODEDEBUG
  415. X    fprintf(debugfile, "[code] ***** convert_sdl_to_string():\n");
  416. X#endif /* CODEDEBUG /**/
  417. X    buffer = convert_sd_to_string(buffer, struct_decl_list->struct_declarator);
  418. X    if (struct_decl_list->sd_list) {
  419. X    buffer = Strcat(buffer, ", ");
  420. X    buffer = convert_sdl_to_string(buffer, struct_decl_list->sd_list);
  421. X    }
  422. X    return(buffer);
  423. X} /* convert_sdl_to_string */
  424. X
  425. X/******************************************************************************
  426. X * convert_st_to_string()                                                     *
  427. X *                                                                            *
  428. X * Converts a struct declaration attribute to a string.                       *
  429. X *                                                                            *
  430. X * Return values: pointer to created string upon success /                    *
  431. X *                NULL during error handling                                  *
  432. X ******************************************************************************/
  433. Xchar *
  434. Xconvert_st_to_string(buffer, struct_decl)
  435. Xchar *buffer;
  436. XST_ATTR *struct_decl;
  437. X{
  438. X    if (errflag || !struct_decl)
  439. X    return(buffer);
  440. X#ifdef CODEDEBUG
  441. X    fprintf(debugfile, "[code] ***** convert_st_to_string():\n");
  442. X#endif /* CODEDEBUG /**/
  443. X    buffer = convert_sql_to_string(buffer, struct_decl->spec_qual_list);
  444. X    buffer = convert_sdl_to_string(buffer, struct_decl->struct_decl_list);
  445. X    buffer = Strcat(buffer, ";\n");
  446. X    return(buffer);
  447. X} /* convert_st_to_string */
  448. X
  449. X/******************************************************************************
  450. X * convert_stl_to_string()                                                    *
  451. X *                                                                            *
  452. X * Converts a struct declaration list attribute to a string.                  *
  453. X *                                                                            *
  454. X * Return values: pointer to created string upon success /                    *
  455. X *                NULL during error handling                                  *
  456. X ******************************************************************************/
  457. Xchar *
  458. Xconvert_stl_to_string(buffer, struct_decl_list)
  459. Xchar *buffer;
  460. XSTL_ATTR *struct_decl_list;
  461. X{
  462. X    if (errflag || !struct_decl_list)
  463. X    return(buffer);
  464. X#ifdef CODEDEBUG
  465. X    fprintf(debugfile, "[code] ***** convert_stl_to_string():\n");
  466. X#endif /* CODEDEBUG /**/
  467. X    buffer = convert_st_to_string(buffer, struct_decl_list->struct_decl);
  468. X    if (struct_decl_list->st_list)
  469. X    buffer = convert_stl_to_string(buffer, struct_decl_list->st_list);
  470. X    return(buffer);
  471. X} /* convert_stl_to_string */
  472. X
  473. X/******************************************************************************
  474. X * convert_sus_to_string()                                                    *
  475. X *                                                                            *
  476. X * Converts a struct or union specifier attribute to a string.                *
  477. X *                                                                            *
  478. X * Return values: pointer to created string upon success /                    *
  479. X *                NULL during error handling                                  *
  480. X ******************************************************************************/
  481. Xchar *
  482. Xconvert_sus_to_string(buffer, sus, stl_flag)
  483. Xchar *buffer;
  484. XSUS_ATTR *sus;
  485. Xchar stl_flag;
  486. X{
  487. X    if (errflag || !sus)
  488. X    return(buffer);
  489. X#ifdef CODEDEBUG
  490. X    fprintf(debugfile, "[code] ***** convert_sus_to_string():\n");
  491. X#endif /* CODEDEBUG /**/
  492. X    buffer = convert_su_to_string(buffer, sus->struct_or_union);
  493. X    if (sus->tag)
  494. X    buffer = Strcatmany(buffer, 2, sus->tag->name, " ");
  495. X    if ((stl_flag || !sus->tag) && sus->struct_decl_list) {
  496. X    buffer = Strcat(buffer, " { \n");
  497. X    buffer = convert_stl_to_string(buffer, sus->struct_decl_list);
  498. X    buffer = Strcat(buffer, "} ");
  499. X    }
  500. X    return(buffer);
  501. X} /* convert_sus_to_string */
  502. X
  503. X/******************************************************************************
  504. X * convert_ds_to_string()                                                     *
  505. X *                                                                            *
  506. X * Converts a declaration specifiers attribute to a string.                   *
  507. X *                                                                            *
  508. X * Return values: pointer to created string upon success /                    *
  509. X *                NULL during error handling                                  *
  510. X ******************************************************************************/
  511. Xchar *
  512. Xconvert_ds_to_string(buffer, decl_spec)
  513. Xchar *buffer;
  514. XDS_ATTR *decl_spec;
  515. X{
  516. X    if (errflag || !decl_spec)
  517. X    return(buffer);
  518. X#ifdef CODEDEBUG
  519. X    fprintf(debugfile, "[code] ***** convert_ds_to_string():\n");
  520. X#endif /* CODEDEBUG /**/
  521. X    if (decl_spec->scs)
  522. X    buffer = convert_scs_to_string(buffer, decl_spec->scs);
  523. X    else if (decl_spec->ts)
  524. X    buffer = convert_ts_to_string(buffer, decl_spec->ts, FALSE);
  525. X    else if (decl_spec->tq)
  526. X    buffer = convert_tq_to_string(buffer, decl_spec->tq);
  527. X    if (decl_spec->ds)
  528. X    buffer = convert_ds_to_string(buffer, decl_spec->ds);
  529. X    return(buffer);
  530. X} /* convert_ds_to_string */
  531. X
  532. X/******************************************************************************
  533. X * convert_id_to_string()                                                     *
  534. X *                                                                            *
  535. X * Converts a init declarator attribute to a string.                          *
  536. X *                                                                            *
  537. X * Return values: pointer to created string upon success /                    *
  538. X *                NULL during error handling                                  *
  539. X ******************************************************************************/
  540. Xchar *
  541. Xconvert_id_to_string(buffer, init_decl)
  542. Xchar *buffer;
  543. XID_ATTR *init_decl;
  544. X{
  545. X    if (errflag || !init_decl)
  546. X    return(buffer);
  547. X#ifdef CODEDEBUG
  548. X    fprintf(debugfile, "[code] ***** convert_id_to_string():\n");
  549. X#endif /* CODEDEBUG /**/
  550. X    buffer = convert_d_to_string(buffer, init_decl->d);
  551. X    if (init_decl->inistr)
  552. X    buffer = Strcatmany(buffer, 2, " = ", init_decl->inistr);
  553. X    return(buffer);
  554. X} /* convert_id_to_string */
  555. X
  556. X/******************************************************************************
  557. X * convert_idl_to_string()                                                    *
  558. X *                                                                            *
  559. X * Converts a init declarato list attribute to a string.                      *
  560. X *                                                                            *
  561. X * Return values: pointer to created string upon success /                    *
  562. X *                NULL during error handling                                  *
  563. X ******************************************************************************/
  564. Xchar *
  565. Xconvert_idl_to_string(buffer, id_list)
  566. Xchar *buffer;
  567. XIDL_ATTR *id_list;
  568. X{
  569. X    if (errflag || !id_list)
  570. X    return(buffer);
  571. X#ifdef CODEDEBUG
  572. X    fprintf(debugfile, "[code] ***** convert_idl_to_string():\n");
  573. X#endif /* CODEDEBUG /**/
  574. X    buffer = convert_id_to_string(buffer, id_list->id);
  575. X    if (id_list->id_list) {
  576. X    buffer = Strcat(buffer, ", ");
  577. X    buffer = convert_idl_to_string(buffer, id_list->id_list);
  578. X    }
  579. X    return(buffer);
  580. X} /* convert_idl_to_string */
  581. END_OF_FILE
  582. if test 24017 -ne `wc -c <'dcc/code_convert.c'`; then
  583.     echo shar: \"'dcc/code_convert.c'\" unpacked with wrong size!
  584. fi
  585. # end of 'dcc/code_convert.c'
  586. fi
  587. if test -f 'dcc/symb_others.c' -a "${1}" != "-c" ; then 
  588.   echo shar: Will not clobber existing file \"'dcc/symb_others.c'\"
  589. else
  590. echo shar: Extracting \"'dcc/symb_others.c'\" \(18843 characters\)
  591. sed "s/^X//" >'dcc/symb_others.c' <<'END_OF_FILE'
  592. X/***************************************************************************
  593. X *                                                                         *
  594. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  595. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  596. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  597. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  598. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  599. X *                                                                         *
  600. X *              A compiler for distributed programming with C              *
  601. X *                                                                         *
  602. X *                        s y m b _ o t h e r s . c                        *
  603. X *                                                                         *
  604. X *                            Package : Compiler                           *
  605. X *                            Version : 2.0                                *
  606. X *                       CreationDate : 01.08.90                           *
  607. X *                         LastUpDate : 02.12.93                           *
  608. X *                                                                         *
  609. X *         All other functions handling symbol table informations.         * 
  610. X *                                                                         *
  611. X *                  Portions Copyright 1990 Franz Distler                  *
  612. X *               Copyright (C) 1990-1994 by Christoph Pleier               *
  613. X *                          All rights reserved!                           *
  614. X ***************************************************************************/
  615. X
  616. X/*
  617. X * This file is part of the Distributed C Development Environment (DCDE).
  618. X * DCDE is free software; you can redistribute it and/or modify
  619. X * it under the terms written in the README-file. 
  620. X * DCDE is distributed in the hope that it will be useful,
  621. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  622. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  623. X * See the file README for more details.
  624. X */
  625. X
  626. X#include <stdio.h>
  627. X#include <ctype.h>
  628. X#include "config.h"
  629. X#include "extern.h"
  630. X#include "functions.h"
  631. X#include "y.tab.h" 
  632. X#include "com_Errno.h"
  633. X
  634. X/******************************************************************************
  635. X * make_function()                                                            *
  636. X *                                                                            *
  637. X * Initializes the symbol table element pointed to by 'symbol' as function.   *
  638. X *                                                                            *
  639. X * Return values: 'symbol' upon success / NULL upon error                     *
  640. X ******************************************************************************/
  641. XSYMBTABEL *
  642. Xmake_function(decl_spec, declarator)
  643. XDS_ATTR *decl_spec;
  644. XD_ATTR  *declarator;
  645. X{
  646. X    SYMBTABEL *symbol, *ptr;
  647. X    DD_ATTR *dd_attr;
  648. X
  649. X    if (errflag || !decl_spec || !declarator) /* error handling */
  650. X    return((SYMBTABEL *) Malloc(sizeof(SYMBTABEL)));
  651. X#ifdef SYMBDEBUG
  652. X    fprintf(debugfile, "[symb] ***** make_function(): params: symbol = %d\n",
  653. X    symbol);
  654. X#endif /* SYMBDEBUG /**/
  655. X    symbol = NULL;
  656. X    for(dd_attr = declarator->direct_decl; dd_attr; ) {
  657. X    switch(dd_attr->type) {
  658. X    case DD_ATTR_IDENT:
  659. X            symbol = dd_attr->ident;
  660. X        dd_attr = NULL; /* leave loop! */
  661. X        break;
  662. X    case DD_ATTR_BRACED:
  663. X        dd_attr = dd_attr->info.declarator->direct_decl;
  664. X        break;
  665. X    case DD_ATTR_ARRAY:
  666. X    case DD_ATTR_FUNC:
  667. X        dd_attr = dd_attr->info.comp.direct_decl;
  668. X        break;
  669. X    default:
  670. X        Panic("unknown DD_ATTR type in make_function()");
  671. X    } /* switch */
  672. X    }
  673. X    if (!symbol)
  674. X    Panic("identifier of function definition not found!");
  675. X#ifdef SYMBDEBUG
  676. X    fprintf(debugfile, "[symb]       symbol->name = %s\n", symbol->name);
  677. X#endif /* SYMBDEBUG /**/
  678. X    if (symbol->type != UDEC) {
  679. X    strcpy(yytext, symbol->name);
  680. X    PRINTERROR("", EREDEFINITION);
  681. X    return(symbol);
  682. X    }
  683. X#ifdef SYMBDEBUG
  684. X    fprintf(debugfile, "[symb]       initializing \"%s\" as FUNCTIONDEF\n",
  685. X    symbol->name);
  686. X#endif /* SYMBDEBUG /**/
  687. X    symbol->type = FUNCTIONDEF;
  688. X    *convert_buffer = 0;
  689. X    convert_buffer = convert_ds_to_string(convert_buffer, decl_spec);
  690. X    symbol->info.functiondef.ReturnType = strsave(convert_buffer);
  691. X    return(symbol);
  692. X} /* make_function */
  693. X
  694. X/******************************************************************************
  695. X * make_typedef_name()                                                        *
  696. X *                                                                            *
  697. X * Declares symbols in the symbol table as a typedef definition.              *
  698. X *                                                                            *
  699. X * Return values: none!                                                       *
  700. X ******************************************************************************/
  701. Xint
  702. Xmake_typedef_name(decl_spec, id_list)
  703. XDS_ATTR  *decl_spec;
  704. XIDL_ATTR *id_list;
  705. X{
  706. X    short pointerflag;
  707. X    D_ATTR *d_attr;
  708. X    DD_ATTR *dd_attr;
  709. X    SYMBTABEL *symbol;
  710. X
  711. X    if (errflag)
  712. X    return;
  713. X#ifdef SYMBDEBUG 
  714. X    fprintf(debugfile, "[symb] ***** make_typedef_name():\n");
  715. X#endif /* SYMBDEBUG /**/
  716. X    for(; id_list; id_list = id_list->id_list) {
  717. X    d_attr = id_list->id->d;
  718. X    pointerflag = (d_attr->pointer) ? TRUE : FALSE;
  719. X    dd_attr = d_attr->direct_decl;
  720. X    while(dd_attr->type != DD_ATTR_IDENT) {
  721. X        if (dd_attr->type == DD_ATTR_BRACED) {
  722. X        d_attr = dd_attr->info.declarator;
  723. X        pointerflag = (d_attr->pointer) ? TRUE : FALSE;
  724. X        dd_attr = d_attr->direct_decl;
  725. X        } else 
  726. X        dd_attr = dd_attr->info.comp.direct_decl;
  727. X    }
  728. X    symbol = dd_attr->ident;
  729. X    if (symbol->type == STRUCTDECL) {
  730. X        /* the same identifier was used for a structure tag name
  731. X         * and a subsequent type definition, e. g. 
  732. X         * "typedef struct NAME { ... } NAME;".
  733. X         * In this case we must create a new symbol table element to
  734. X         * store the type definition.
  735. X         */
  736. X#ifdef SYMBDEBUG
  737. X        fprintf(debugfile, "[symb]       identical identifier for structure tag name and type definition\n");
  738. X        fprintf(debugfile, "[symb]       creating new symbol table element for '%s'\n", 
  739. X        symbol->name);
  740. X        symbol = enter_symbtabel(symbol->name);
  741. X#endif /* SYMBDEBUG /**/
  742. X    }
  743. X    symbol->type = TYPEDEFNAME;
  744. X    symbol->info.typedefname.IsPointer       = pointerflag;
  745. X    symbol->info.typedefname.BuildXDRRoutine = FALSE;
  746. X    symbol->info.typedefname.decl_spec       = decl_spec;
  747. X    symbol->info.typedefname.id_list         = id_list;
  748. X    symbol->info.typedefname.ErrPos          = strsave(yywhere());
  749. X#ifdef SYMBDEBUG
  750. X    fprintf(debugfile, "[symb]       type definition: '%s' is %sa pointer\n", 
  751. X        symbol->name, (pointerflag) ? "" : "NOT ");
  752. X#endif /* SYMBDEBUG /**/
  753. X    (void) store_struct_or_type_def(symbol);
  754. X    } /* for(id_list) */
  755. X    return(OK);
  756. X} /* make_typedef_name */
  757. X
  758. X/******************************************************************************
  759. X * make_structure()                                                           *
  760. X *                                                                            *
  761. X * Declares symbol in the symbol table as a structure definition.             *
  762. X *                                                                            *
  763. X * Return values: none!                                                       *
  764. X ******************************************************************************/
  765. XSYMBTABEL *
  766. Xmake_structure(symbol)
  767. XSYMBTABEL *symbol;
  768. X{
  769. X    if (errflag || !symbol)
  770. X    return(NULL);
  771. X#ifdef SYMBDEBUG 
  772. X    fprintf(debugfile, "[symb] ***** make_structure():\n");
  773. X    fprintf(debugfile, "[symb]       symbol->name = %s\n", symbol->name);
  774. X#endif /* SYMBDEBUG /**/
  775. X    if (symbol->type != UDEC) {
  776. X    strcpy(yytext, symbol->name);
  777. X    PRINTERROR("", EREDEFINITION);
  778. X    return(symbol);
  779. X    }
  780. X#ifdef SYMBDEBUG
  781. X    fprintf(debugfile, "[symb]       initializing \"%s\" as STRUCTDECL\n",
  782. X    symbol->name);
  783. X#endif /* SYMBDEBUG /**/
  784. X    symbol->type = STRUCTDECL;
  785. X    symbol->info.structdecl.IsStruct        = FALSE;
  786. X    symbol->info.structdecl.BuildXDRRoutine = FALSE;
  787. X    symbol->info.structdecl.StruDeclList    = (STL_ATTR *) NULL;
  788. X    symbol->info.structdecl.ErrPos          = strsave(yywhere());
  789. X    (void) store_struct_or_type_def(symbol);
  790. X    return(symbol);
  791. X} /* make_structure */
  792. X
  793. X/******************************************************************************
  794. X * add_struct_or_union_info()                                                 *
  795. X *                                                                            *
  796. X * Marks the symbol table entry with name 'tag' as structure definition and   *
  797. X * adds some useful information.                                              *
  798. X *                                                                            *
  799. X * Return values: 'tag' upon success / NULL upon error                        *
  800. X ******************************************************************************/
  801. XSYMBTABEL *
  802. Xadd_struct_or_union_info(struct_or_union, tag, struct_declaration_list)
  803. XSU_ATTR   *struct_or_union;
  804. XSYMBTABEL *tag;
  805. XSTL_ATTR  *struct_declaration_list;
  806. X{
  807. X#ifdef SYMBDEBUG
  808. X    fprintf(debugfile, "[symb] ***** add_struct_or_union_info():\n");
  809. X    fprintf(debugfile, "[symb]       params: struct_or_union = %s\n",
  810. X        (struct_or_union->type == SU_ATTR_STRUCT) ? "struct" : "union");
  811. X    fprintf(debugfile, "[symb]               tag = %d\n", tag);
  812. X    fprintf(debugfile, "[symb]               struct_declaration_list = %d\n",
  813. X        struct_declaration_list);
  814. X#endif /* SYMBDEBUG /**/
  815. X    if (struct_or_union->type == SU_ATTR_STRUCT) 
  816. X        tag->info.structdecl.IsStruct = TRUE;
  817. X    else
  818. X        tag->info.structdecl.IsStruct = FALSE;
  819. X    tag->info.structdecl.BuildXDRRoutine = FALSE;
  820. X    tag->info.structdecl.StruDeclList = struct_declaration_list;
  821. X    return(tag);
  822. X} /* add_struct_or_union_info */
  823. X
  824. X/******************************************************************************
  825. X * mark_structures_for_XDR()                                                  *
  826. X *                                                                            *
  827. X * Marks the structure pointed to by 'sus_attr' and all structure and type    *
  828. X * definitions inside of this structure definition indicating that these      *
  829. X * definitions are used as a process parameter, transaction parameter or      *
  830. X * transaction result type, so a corresponding xdr routine will be created.   *
  831. X *                                                                            *
  832. X * Return values: OK upon success / ERROR upon error                          *
  833. X ******************************************************************************/
  834. Xstatic int
  835. Xmark_structures_for_XDR(typedef_symbol, sus_attr)
  836. XSYMBTABEL *typedef_symbol;
  837. XSUS_ATTR  *sus_attr;
  838. X{
  839. X    TS_ATTR   *ts_attr;
  840. X    DS_ATTR   *ds_attr;
  841. X    SUS_ATTR  *sus_attr_2;
  842. X    ST_ATTR   *st_attr;
  843. X    STL_ATTR  *stl_attr;
  844. X    SQL_ATTR  *sql_attr;
  845. X    SYMBTABEL *symbol, *symbol2;
  846. X#ifdef CONVEX
  847. X    int mark_typenames_for_XDR();
  848. X#else
  849. X    static int mark_typenames_for_XDR();
  850. X#endif
  851. X
  852. X#if defined(SYMBDEBUG) || defined(XDRDEBUG)
  853. X    fprintf(debugfile, "[symb] ***** mark_structures_for_XDR():\n");
  854. X#endif /* SYMBDEBUG || XDRDEBUG /**/
  855. X
  856. X    /* check for error */
  857. X    if (!sus_attr->tag) {
  858. X    if (!typedef_symbol)
  859. X        Panic("'typedef_symbol' not defined in mark_structures_for_XDR()!");
  860. X        Errno = ETSTRUCTTAG;
  861. X        strcpy(yytext, typedef_symbol->name);
  862. X        Error(typedef_symbol->info.typedefname.ErrPos, "");
  863. X        return(ERROR);
  864. X    }
  865. X
  866. X    /* initialize pointer to symbol table entry */
  867. X    symbol = sus_attr->tag;   
  868. X
  869. X    /* mark structure symbol table entry */
  870. X    symbol->info.structdecl.BuildXDRRoutine = TRUE;
  871. X
  872. X#if defined(SYMBDEBUG) || defined(XDRDEBUG)
  873. X    fprintf(debugfile, "[symb]       marking structure \"%s\" for xdr\n",
  874. X        symbol->name);   
  875. X#endif /* SYMBDEBUG || XDRDEBUG /**/
  876. X
  877. X    /* Pass through the complete struct_declaration_list of the structure 
  878. X     * pointer to by 'sus_attr'. Check the specifier_qualifier_lists of
  879. X     * each struct_declaration if it contains a structure or a type 
  880. X     * definition. If true, mark the corresponding definition for xdr and
  881. X     * check all structure definitions inside this definition (if there are
  882. X     * any).
  883. X     */
  884. X    for(stl_attr = symbol->info.structdecl.StruDeclList; stl_attr; stl_attr = stl_attr->st_list) {
  885. X        st_attr = stl_attr->struct_decl;
  886. X        for(sql_attr = st_attr->spec_qual_list; sql_attr; sql_attr = sql_attr->sq_list) {
  887. X        if (sql_attr->type == SQL_ATTR_SPECIFIER) {
  888. X        ts_attr = sql_attr->info.type_specifier;
  889. X        switch(ts_attr->type) {
  890. X        case TS_ATTR_STRUCT:
  891. X            sus_attr_2 = ts_attr->info.structinfo;
  892. X            if (!sus_attr_2->tag) {
  893. X            /* error: missing tag name! */
  894. X                Errno = EISTRUCTTAG;
  895. X                strcpy(yytext, symbol->name);
  896. X                Error(symbol->info.structdecl.ErrPos, "");
  897. X                return(ERROR);
  898. X            }
  899. X            if (sus_attr_2 != sus_attr) {
  900. X            /* Structure definition inside this structure found! 
  901. X              * Mark the inner structure and all structure and type 
  902. X             * definitions inside the inner structure for building 
  903. X             * xdr routines.
  904. X              */
  905. X                (void) mark_structures_for_XDR(NULL, sus_attr_2);
  906. X            }
  907. X            break;
  908. X        case TS_ATTR_TYPENAME:
  909. X            (void) mark_typenames_for_XDR(ts_attr->info.typedefname);
  910. X            break;
  911. X        default:
  912. X            break;
  913. X        } /* switch */
  914. X            }
  915. X        } /* for(sql_attr) */
  916. X    } /* for(stl_attr) */
  917. X
  918. X    return(OK);
  919. X} /* mark_structures_for_XDR */
  920. X
  921. X/******************************************************************************
  922. X * mark_typenames_for_XDR()                                                   *
  923. X *                                                                            *
  924. X * Marks the type definition pointed to by 'typedef_symbol' and all structure *
  925. X * and type definitions specified by this type definition indicating that     *
  926. X * these definitions are used as a process parameter, transaction parameter or*
  927. X * transaction result type, so a corresponding xdr routine will be created.   *
  928. X *                                                                            *
  929. X * Return values: OK upon success / ERROR upon error                          *
  930. X ******************************************************************************/
  931. Xstatic int
  932. Xmark_typenames_for_XDR(typedef_symbol)
  933. XSYMBTABEL *typedef_symbol;
  934. X{
  935. X    DS_ATTR   *decl_spec;
  936. X    SYMBTABEL *symbol;
  937. X
  938. X#if defined(SYMBDEBUG) || defined(XDRDEBUG)
  939. X    fprintf(debugfile, "[symb] ***** mark_typenames_for_XDR():\n");
  940. X#endif /* SYMBDEBUG || XDRDEBUG /**/
  941. X
  942. X    /* mark typedefname symbol table entry */
  943. X    typedef_symbol->info.typedefname.BuildXDRRoutine = TRUE;
  944. X
  945. X#if defined(SYMBDEBUG) || defined(XDRDEBUG)
  946. X    fprintf(debugfile, "[symb]       marking typename \"%s\" for xdr\n", typedef_symbol->name);   
  947. X#endif /* SYMBDEBUG || XDRDEBUG /**/
  948. X
  949. X    decl_spec = typedef_symbol->info.typedefname.decl_spec->ds;
  950. X    if (decl_spec->ts) {
  951. X        switch(decl_spec->ts->type) {
  952. X        case TS_ATTR_STRUCT:
  953. X        /* Type definition contains a structure definition. Mark this 
  954. X         * structure and all structure and type definitions inside this 
  955. X         * structure for building xdr routines.
  956. X         */
  957. X        (void) mark_structures_for_XDR(symbol, decl_spec->ts->info.structinfo);
  958. X        break;
  959. X        case TS_ATTR_TYPENAME:
  960. X        /* Type definition specifies a type definition by itself. Mark this 
  961. X         * type definition and all structure and type definitions specified
  962. X         * by this type definition for building xdr routines.
  963. X         */
  964. X        symbol = decl_spec->ts->info.typedefname;
  965. X        (void) mark_typenames_for_XDR(symbol);
  966. X        break;
  967. X        default:
  968. X        break;
  969. X        } /* switch */
  970. X    }
  971. X    return(OK);
  972. X} /* mark_typenames_for_XDR */
  973. X
  974. X/******************************************************************************
  975. X * mark_struct_or_type_def_for_XDR()                                          *
  976. X *                                                                            *
  977. X * Marks the structure or typename definition indicating that these definition*
  978. X * is used as a process parameter, transaction parameter or transaction result*
  979. X * type. Calls mark_structures_for_XDR() to mark all inner structure and type *
  980. X * definitions, too, if required.                                             *
  981. X *                                                                            *
  982. X * Return values: 'ds_attr' upon success / NULL upon error                    *
  983. X ******************************************************************************/
  984. XDS_ATTR *
  985. Xmark_struct_or_type_def_for_XDR(ds_attr)
  986. XDS_ATTR *ds_attr;
  987. X{
  988. X    DS_ATTR *ds_ptr, *ds_attr2;
  989. X    SUS_ATTR *sus_attr, *sus_attr_2;
  990. X    ST_ATTR *st_attr;
  991. X    STL_ATTR *stl_attr;
  992. X    SQL_ATTR *sql_attr;
  993. X    SYMBTABEL *symbol;
  994. X
  995. X#ifdef SYMBDEBUG
  996. X    fprintf(debugfile, "[symb] ***** mark_struct_or_type_def_for_XDR():\n");
  997. X    *convert_buffer = 0;
  998. X    convert_buffer = convert_ds_to_string(convert_buffer, ds_attr);
  999. X    fprintf(debugfile, "[symb]       checking \"%s\"\n", convert_buffer);
  1000. X#endif /* SYMBDEBUG /**/
  1001. X    /* check if the declaration_specifiers_attribute contains a structure
  1002. X     * or type definition.
  1003. X     */
  1004. X    for(ds_ptr = ds_attr; ds_ptr; ds_ptr = ds_ptr->ds) {
  1005. X    if (ds_ptr->ts) {
  1006. X        switch(ds_ptr->ts->type) {
  1007. X        case TS_ATTR_STRUCT:
  1008. X        /* Structure definition found! 
  1009. X         * Mark this structure and all structure and type definitions 
  1010. X         * inside this structure for building xdr routines.
  1011. X         */
  1012. X        (void) mark_structures_for_XDR(NULL, ds_ptr->ts->info.structinfo);
  1013. X        break;
  1014. X        case TS_ATTR_TYPENAME:
  1015. X        /* Type definition found! 
  1016. X         * Mark this type definition and all structure and type 
  1017. X         * definitions inside this type definition for building a 
  1018. X         * xdr routine.
  1019. X         */
  1020. X        symbol = ds_ptr->ts->info.typedefname;
  1021. X        (void) mark_typenames_for_XDR(symbol);
  1022. X        break;
  1023. X        default:
  1024. X        break;
  1025. X        } /* switch */
  1026. X        break;
  1027. X    }
  1028. X    } /* for(ds_ptr) */
  1029. X    return(ds_attr);
  1030. X} /* mark_struct_or_type_def_for_XDR */
  1031. X
  1032. X/******************************************************************************
  1033. X * choose_void_type()                                                         *
  1034. X *                                                                            *
  1035. X * Converts the type 'void' to type 'int' if required.                        *
  1036. X *                                                                            *
  1037. X * Return values: pointer to string containing result type                    *
  1038. X ******************************************************************************/
  1039. Xchar
  1040. Xchoose_void_type()
  1041. X{
  1042. X    static char *ptr;
  1043. X
  1044. X#ifdef SYMBDEBUG
  1045. X    fputs("[symb] ***** choose_void_type():\n", debugfile);
  1046. X#endif /* SYMBDEBUG /**/
  1047. X    return(TS_ATTR_INT);
  1048. X} /* choose_void_type */
  1049. END_OF_FILE
  1050. if test 18843 -ne `wc -c <'dcc/symb_others.c'`; then
  1051.     echo shar: \"'dcc/symb_others.c'\" unpacked with wrong size!
  1052. fi
  1053. # end of 'dcc/symb_others.c'
  1054. fi
  1055. if test -f 'examples/config/system.FICT' -a "${1}" != "-c" ; then 
  1056.   echo shar: Will not clobber existing file \"'examples/config/system.FICT'\"
  1057. else
  1058. echo shar: Extracting \"'examples/config/system.FICT'\" \(20365 characters\)
  1059. sed "s/^X//" >'examples/config/system.FICT' <<'END_OF_FILE'
  1060. X# system.FICT
  1061. X#
  1062. X# System configuration file of a ficticious system
  1063. X# Christoph Pleier, March 1992
  1064. X#
  1065. X# The system has the following structure:
  1066. X#
  1067. X#      AT286 (5, 10) --|            5km           |-- HP_1    (0, 0)
  1068. X#      AT386 (2,  4) --|     <--------------->    |-- HP_2    (0, 0)
  1069. X#    AT386_2 (2,  4) --|--------------------------|-- SPARC_2 (1, 3)
  1070. X#    SPARC_1 (1,  3) --|             |            |-- SPARC_3 (1, 3)
  1071. X#       C220 (0,  0) --|             |            |-- AT486   (0, 2)
  1072. X#                                    | ^      
  1073. X#                                    | |
  1074. X#                                    | | 
  1075. X#                                    | | 100km           
  1076. X#                                    |  ----------->       |-- Sun3_1  (2, 5)
  1077. X#                                     ---------------------|-- Sun3_2  (2, 5)
  1078. X#                                                          |-- SPARC_4 (1, 3)
  1079. X#                                                          |-- C3840   (0, 0)
  1080. X#
  1081. X# AT286 (5, 10) means: 
  1082. X#     computer: AT 286, creation factor: 5, communication factor: 10
  1083. X
  1084. X# definition of all hostnames
  1085. Xhostnames = {
  1086. X    node_AT286, node_AT386, node_AT386_2, node_AT486,
  1087. X    node_SPARC_1, node_SPARC_2, node_SPARC_3, node_SPARC_4, 
  1088. X    node_Sun3_1, node_Sun3_2,
  1089. X    node_HP_1, node_HP_2,
  1090. X    node_C220, node_C3840
  1091. X} # hostnames
  1092. X
  1093. X# definition of all computer types
  1094. Xcomputer types = {
  1095. X    AT286,     # Intel ATi286
  1096. X    AT386,     # Intel ATi386
  1097. X    AT486,     # Intel ATi486
  1098. X    SPARC,    # Sun SPARC Station
  1099. X    Sun3,     # Sun 3 Workstation
  1100. X    HP730,     # Hewlett Packard 9000/730
  1101. X    C220,     # CONVEX C220
  1102. X    C3840    # CONVEX C3840
  1103. X} # computer types
  1104. X
  1105. X# definition of all UNIX variants
  1106. Xoperating system variants = { 
  1107. X    SCO_UNIX, SCO_XENIX, SunOS, HPUX, ConvexOS
  1108. X}
  1109. X
  1110. X# definition of the fixed disks 
  1111. Xfixed disks = {
  1112. X    AT286disk = {
  1113. X        location : node_AT286
  1114. X    size     : 60 MB
  1115. X    speed    : 20 ms
  1116. X    }
  1117. X    AT386disk = {
  1118. X        location : node_AT386
  1119. X    size     : 150 MB
  1120. X    speed    : 15 ms
  1121. X    }
  1122. X    AT386disk2 = {
  1123. X        location : node_AT386_2
  1124. X    size     : 600 MB
  1125. X    speed    : 12 ms
  1126. X    }
  1127. X    AT486disk = {
  1128. X        location : node_AT486
  1129. X    size     : 150 MB
  1130. X    speed    : 10 ms
  1131. X    }
  1132. X    SUNdisk1 = {
  1133. X        location : node_SPARC_1
  1134. X    size     : 1 GB
  1135. X    speed    : 11 ms
  1136. X    }
  1137. X    SUNdisk2 = {
  1138. X        location : node_SPARC_4
  1139. X    size     : 1 GB
  1140. X    speed    : 15 ms
  1141. X    }
  1142. X    SUNdisk3 = {
  1143. X        location : node_Sun3_1
  1144. X    size     : 500 MB
  1145. X    speed    : 15 ms
  1146. X    }
  1147. X    SUNdisk4 = {
  1148. X        location : node_Sun3_2
  1149. X    size     : 500 MB
  1150. X    speed    : 15 ms
  1151. X    }
  1152. X    HPdisk = {
  1153. X        location : node_HP_1
  1154. X    size     : 1 GB
  1155. X    speed    : 15 ms
  1156. X    }
  1157. X    C220disk = {
  1158. X        location : node_C220
  1159. X    size     : 1 GB
  1160. X    speed    : 8 ms
  1161. X    }
  1162. X    C3840disk = {
  1163. X        location : node_C3840
  1164. X    size     : 10 GB
  1165. X    speed    : 6 ms
  1166. X    }
  1167. X}
  1168. X
  1169. X# definition of host node_AT286
  1170. Xhost node_AT286 = {
  1171. X    operating system : SCO_XENIX
  1172. X
  1173. X    computer specification {
  1174. X    type:              AT286
  1175. X    physical memory:      2 MB
  1176. X    virtual memory:      4 MB
  1177. X    performance index:     0.0091
  1178. X    storage for executables: AT286disk
  1179. X    }
  1180. X
  1181. X    peripheral devices = {
  1182. X    PS_HP1, PS_HP2
  1183. X    }
  1184. X
  1185. X    compilation {
  1186. X        target: AT286 (SCO_XENIX) {
  1187. X        CC      = "cc"
  1188. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DSINGLE -compat"
  1189. X        LDFLAGS = ""
  1190. X        LIBS    = "-lx"
  1191. X    }
  1192. X    }
  1193. X
  1194. X    accessible filesystems = {
  1195. X    AT286disk (20 ms)
  1196. X    }
  1197. X} # node_AT286
  1198. X
  1199. X# definition of host node_AT386
  1200. Xhost node_AT386 = {
  1201. X    operating system : SCO_XENIX
  1202. X
  1203. X    computer specification {
  1204. X    type:              AT386
  1205. X    physical memory:      8 MB
  1206. X    virtual memory:      10 MB
  1207. X    performance index:     0.16
  1208. X    storage for executables: AT386disk
  1209. X    }
  1210. X
  1211. X    peripheral devices = {
  1212. X    PS_HP1, PS_HP2
  1213. X    }
  1214. X
  1215. X    compilation {
  1216. X        target: AT286 (SCO_XENIX) {
  1217. X        CC      = "cc"
  1218. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DSINGLE -compat -x2.3"
  1219. X        LDFLAGS = ""
  1220. X        LIBS    = "-lx"
  1221. X    }
  1222. X        target: AT386 (SCO_XENIX) {
  1223. X        CC      = "cc"
  1224. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DSINGLE"
  1225. X        LDFLAGS = ""
  1226. X        LIBS    = "-lx"
  1227. X    }
  1228. X    }
  1229. X
  1230. X    accessible filesystems = {
  1231. X    AT386disk (15 ms)
  1232. X    }
  1233. X} # node_AT386
  1234. X
  1235. X# definition of host node_AT386_2
  1236. Xhost node_AT386_2 = {
  1237. X    operating system : SCO_UNIX
  1238. X
  1239. X    computer specification {
  1240. X    type:              AT386
  1241. X    physical memory:      8 MB
  1242. X    virtual memory:      10 MB
  1243. X    performance index:     0.16
  1244. X    storage for executables: AT386disk2
  1245. X    }
  1246. X
  1247. X    peripheral devices = {
  1248. X    PS_HP1, PS_HP2
  1249. X    }
  1250. X
  1251. X    compilation {
  1252. X        target: AT286 (SCO_XENIX) {
  1253. X        CC      = "cc"
  1254. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS -compat -xenix -x2.3 -D__STDC__"
  1255. X        LDFLAGS = ""
  1256. X        LIBS    = "-lx"
  1257. X    }
  1258. X        target: AT386 (SCO_XENIX) {
  1259. X        CC      = "cc"
  1260. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS -compat -xenix -x2.3 -D__STDC__"
  1261. X        LDFLAGS = ""
  1262. X        LIBS    = "-lx"
  1263. X    }
  1264. X        target: AT386 (SCO_UNIX) {
  1265. X        CC      = "cc"
  1266. X        CFLAGS  = "-DSCO_UNIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS"
  1267. X        LDFLAGS = ""
  1268. X        LIBS    = "-lx"
  1269. X    }
  1270. X        target: AT486 (SCO_UNIX) {
  1271. X        CC      = "cc"
  1272. X        CFLAGS  = "-DSCO_UNIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS"
  1273. X        LDFLAGS = ""
  1274. X        LIBS    = "-lx"
  1275. X    }
  1276. X    }
  1277. X
  1278. X    accessible filesystems = {
  1279. X    AT386disk2 (12 ms)
  1280. X    }
  1281. X} # node_AT386_2
  1282. X
  1283. X# definition of host node_AT486
  1284. Xhost node_AT486 = {
  1285. X    operating system : SCO_UNIX
  1286. X
  1287. X    computer specification {
  1288. X    type:              AT486
  1289. X    physical memory:      32 MB
  1290. X    virtual memory:      40 MB
  1291. X    performance index:     1.3
  1292. X    storage for executables: AT486disk
  1293. X    }
  1294. X
  1295. X    peripheral devices = {
  1296. X    LC890
  1297. X    }
  1298. X
  1299. X    compilation {
  1300. X        target: AT286 (SCO_XENIX) {
  1301. X        CC      = "cc"
  1302. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS -compat -xenix -x2.3 -D__STDC__"
  1303. X        LDFLAGS = ""
  1304. X        LIBS    = "-lx"
  1305. X    }
  1306. X        target: AT386 (SCO_XENIX) {
  1307. X        CC      = "cc"
  1308. X        CFLAGS  = "-DSCO_XENIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS -compat -xenix -x2.3 -D__STDC__"
  1309. X        LDFLAGS = ""
  1310. X        LIBS    = "-lx"
  1311. X    }
  1312. X        target: AT386 (SCO_UNIX) {
  1313. X        CC      = "cc"
  1314. X        CFLAGS  = "-DSCO_UNIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS"
  1315. X        LDFLAGS = ""
  1316. X        LIBS    = "-lx"
  1317. X    }
  1318. X        target: AT486 (SCO_UNIX) {
  1319. X        CC      = "cc"
  1320. X        CFLAGS  = "-DSCO_UNIX -DSYSTEM_V -DMSGSEM -DHETEROGENEOUS"
  1321. X        LDFLAGS = ""
  1322. X        LIBS    = "-lx"
  1323. X    }
  1324. X    }
  1325. X
  1326. X    accessible filesystems = {
  1327. X    AT486disk (10 ms), SUNdisk1 (40 ms)
  1328. X    }
  1329. X} # node_AT486
  1330. X
  1331. X# definition of host node_SPARC_1
  1332. Xhost node_SPARC_1 = {
  1333. X    operating system : SunOS
  1334. X
  1335. X    computer specification {
  1336. X    type:              SPARC
  1337. X    physical memory:      16 MB
  1338. X    virtual memory:      32 MB
  1339. X    performance index:     4.0
  1340. X    storage for executables: SUNdisk1
  1341. X    }
  1342. X
  1343. X    peripheral devices = {
  1344. X    PS_HP1, PS_HP2
  1345. X    }
  1346. X
  1347. X    compilation {
  1348. X        target: SPARC (SunOS) {
  1349. X        CC      = "cc"
  1350. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1351. X        LDFLAGS = ""
  1352. X        LIBS    = ""
  1353. X    }
  1354. X        target: Sun3 (SunOS) {
  1355. X        CC      = "cc"
  1356. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun3"
  1357. X        LDFLAGS = ""
  1358. X        LIBS    = ""
  1359. X    }
  1360. X    }
  1361. X
  1362. X    accessible filesystems = {
  1363. X    SUNdisk1 (11 ms)
  1364. X    }
  1365. X} # node_SPARC_1
  1366. X
  1367. X# definition of host node_SPARC_2
  1368. Xhost node_SPARC_2 = {
  1369. X    operating system : SunOS
  1370. X
  1371. X    computer specification {
  1372. X    type:              SPARC
  1373. X    physical memory:       8 MB
  1374. X    virtual memory:      32 MB
  1375. X    performance index:     4.0
  1376. X    storage for executables: HPdisk
  1377. X    }
  1378. X
  1379. X    peripheral devices = {
  1380. X    LC890
  1381. X    }
  1382. X
  1383. X    compilation {
  1384. X        target: SPARC (SunOS) {
  1385. X        CC      = "cc"
  1386. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1387. X        LDFLAGS = ""
  1388. X        LIBS    = ""
  1389. X    }
  1390. X        target: Sun3 (SunOS) {
  1391. X        CC      = "cc"
  1392. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun3"
  1393. X        LDFLAGS = ""
  1394. X        LIBS    = ""
  1395. X    }
  1396. X    }
  1397. X
  1398. X    accessible filesystems = {
  1399. X    HPdisk (25 ms)
  1400. X    }
  1401. X} # node_SPARC_2
  1402. X
  1403. X# definition of host node_SPARC_3
  1404. Xhost node_SPARC_3 = {
  1405. X    operating system : SunOS
  1406. X
  1407. X    computer specification {
  1408. X    type:              SPARC
  1409. X    physical memory:       8 MB
  1410. X    virtual memory:      32 MB
  1411. X    performance index:     4.0
  1412. X    storage for executables: HPdisk
  1413. X    }
  1414. X
  1415. X    peripheral devices = {
  1416. X    LC890
  1417. X    }
  1418. X
  1419. X    compilation {
  1420. X        target: SPARC (SunOS) {
  1421. X        CC      = "cc"
  1422. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1423. X        LDFLAGS = ""
  1424. X        LIBS    = ""
  1425. X    }
  1426. X        target: Sun3 (SunOS) {
  1427. X        CC      = "cc"
  1428. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun3"
  1429. X        LDFLAGS = ""
  1430. X        LIBS    = ""
  1431. X    }
  1432. X    }
  1433. X
  1434. X    accessible filesystems = {
  1435. X    HPdisk (25 ms)
  1436. X    }
  1437. X} # node_SPARC_3
  1438. X
  1439. X# definition of host node_SPARC_4
  1440. Xhost node_SPARC_4 = {
  1441. X    operating system : SunOS
  1442. X
  1443. X    computer specification {
  1444. X    type:              SPARC
  1445. X    physical memory:      16 MB
  1446. X    virtual memory:      32 MB
  1447. X    performance index:     4.0
  1448. X    storage for executables: SUNdisk2
  1449. X    }
  1450. X
  1451. X    compilation {
  1452. X        target: SPARC (SunOS) {
  1453. X        CC      = "cc"
  1454. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1455. X        LDFLAGS = ""
  1456. X        LIBS    = ""
  1457. X    }
  1458. X        target: Sun3 (SunOS) {
  1459. X        CC      = "cc"
  1460. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun3"
  1461. X        LDFLAGS = ""
  1462. X        LIBS    = ""
  1463. X    }
  1464. X    }
  1465. X
  1466. X    accessible filesystems = {
  1467. X    SUNdisk2 (15 ms)
  1468. X    }
  1469. X} # node_SPARC_4
  1470. X
  1471. X# definition of host node_Sun3_1
  1472. Xhost node_Sun3_1 = {
  1473. X    operating system : SunOS
  1474. X
  1475. X    computer specification {
  1476. X    type:              Sun3
  1477. X    physical memory:       4 MB
  1478. X    virtual memory:      16 MB
  1479. X    performance index:     0.46
  1480. X    storage for executables: SUNdisk3
  1481. X    }
  1482. X
  1483. X    compilation {
  1484. X        target: SPARC (SunOS) {
  1485. X        CC      = "cc"
  1486. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun4"
  1487. X        LDFLAGS = ""
  1488. X        LIBS    = ""
  1489. X    }
  1490. X        target: Sun3 (SunOS) {
  1491. X        CC      = "cc"
  1492. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1493. X        LDFLAGS = ""
  1494. X        LIBS    = ""
  1495. X    }
  1496. X    }
  1497. X
  1498. X    accessible filesystems = {
  1499. X    SUNdisk3 (15 ms), SUNdisk2 (25 ms), C3840disk (21 ms)
  1500. X    }
  1501. X} # node_Sun3_1
  1502. X
  1503. X# definition of host node_Sun3_2
  1504. Xhost node_Sun3_2 = {
  1505. X    operating system : SunOS
  1506. X
  1507. X    computer specification {
  1508. X    type:              Sun3
  1509. X    physical memory:       4 MB
  1510. X    virtual memory:      16 MB
  1511. X    performance index:     0.46
  1512. X    storage for executables: SUNdisk4
  1513. X    }
  1514. X
  1515. X    compilation {
  1516. X        target: SPARC (SunOS) {
  1517. X        CC      = "cc"
  1518. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS -target sun4"
  1519. X        LDFLAGS = ""
  1520. X        LIBS    = ""
  1521. X    }
  1522. X        target: Sun3 (SunOS) {
  1523. X        CC      = "cc"
  1524. X        CFLAGS  = "-DSPARC -DBSD -DSOCKET -DHETEROGENEOUS"
  1525. X        LDFLAGS = ""
  1526. X        LIBS    = ""
  1527. X    }
  1528. X    }
  1529. X
  1530. X    accessible filesystems = {
  1531. X    SUNdisk4 (15 ms), SUNdisk2 (25 ms), C3840disk (21 ms)
  1532. X    }
  1533. X} # node_Sun3_2
  1534. X
  1535. X# definition of host node_HP_1
  1536. Xhost node_HP_1 = {
  1537. X    operating system : HPUX
  1538. X
  1539. X    computer specification {
  1540. X    type:              HP730
  1541. X    physical memory:      64 MB
  1542. X    virtual memory:      64 MB
  1543. X    performance index:     24
  1544. X    storage for executables: HPdisk
  1545. X    }
  1546. X
  1547. X    peripheral devices = {
  1548. X    LC890
  1549. X    }
  1550. X
  1551. X    compilation {
  1552. X        target: HP730 (HPUX) {
  1553. X        CC      = "cc"
  1554. X        CFLAGS  = "-DHPUX -DSYSTEM_V -DSOCKET -DHETEROGENEOUS"
  1555. X        LDFLAGS = ""
  1556. X        LIBS    = ""
  1557. X    }
  1558. X    }
  1559. X
  1560. X    accessible filesystems = {
  1561. X    HPdisk (10 ms)
  1562. X    }
  1563. X} # node_HP_1
  1564. X
  1565. X# definition of host node_HP_2
  1566. Xhost node_HP_2 = {
  1567. X    operating system : HPUX
  1568. X
  1569. X    computer specification {
  1570. X    type:              HP730
  1571. X    physical memory:      64 MB
  1572. X    virtual memory:      64 MB
  1573. X    performance index:     24
  1574. X    storage for executables: HPdisk
  1575. X    }
  1576. X
  1577. X    peripheral devices = {
  1578. X    LC890
  1579. X    }
  1580. X
  1581. X    compilation {
  1582. X        target: HP730 (HPUX) {
  1583. X        CC      = "cc"
  1584. X        CFLAGS  = "-DHPUX -DSYSTEM_V -DSOCKET -DHETEROGENEOUS"
  1585. X        LDFLAGS = ""
  1586. X        LIBS    = ""
  1587. X    }
  1588. X    }
  1589. X
  1590. X    accessible filesystems = {
  1591. X    HPdisk (10 ms)
  1592. X    }
  1593. X} # node_HP_2
  1594. X
  1595. X# definition of host node_C220
  1596. Xhost node_C220 = {
  1597. X    operating system : ConvexOS
  1598. X
  1599. X    computer specification {
  1600. X    type:              C220
  1601. X    physical memory:      512 MB
  1602. X    virtual memory:      512 MB
  1603. X    performance index:     22
  1604. X    multiprocessor system: 2 processors, shared memory
  1605. X    vector computer
  1606. X    parallelizing compiler
  1607. X    storage for executables: C220disk
  1608. X    }
  1609. X
  1610. X    compilation {
  1611. X        target: C220 (ConvexOS) {
  1612. X        CC      = "cc"
  1613. X        CFLAGS  = "-DCONVEX -DBSD -DSOCKET -DHETEROGENEOUS -ext"
  1614. X        LDFLAGS = "-ext"
  1615. X        LIBS    = ""
  1616. X    }
  1617. X    }
  1618. X
  1619. X    accessible filesystems = {
  1620. X    C220disk (8 ms)
  1621. X    }
  1622. X} # node_C220
  1623. X
  1624. X# definition of host node_C3840
  1625. Xhost node_C3840 = {
  1626. X    operating system : ConvexOS
  1627. X
  1628. X    computer specification {
  1629. X    type:              C3840
  1630. X    physical memory:      1 GB
  1631. X    virtual memory:      1 GB
  1632. X    performance index:     75
  1633. X    multiprocessor system: 8 processors, shared memory
  1634. X    vector computer
  1635. X    parallelizing compiler
  1636. X    storage for executables: C3840disk
  1637. X    }
  1638. X
  1639. X    compilation {
  1640. X        target: C3840 (ConvexOS) {
  1641. X        CC      = "cc"
  1642. X        CFLAGS  = "-DCONVEX -DBSD -DSOCKET -DHETEROGENEOUS -ext"
  1643. X        LDFLAGS = "-ext"
  1644. X        LIBS    = ""
  1645. X    }
  1646. X    }
  1647. X
  1648. X    accessible filesystems = {
  1649. X    C3840disk (6 ms) 
  1650. X    }
  1651. X} # node_C3840
  1652. X
  1653. X# definition of priority lists for cross compilation
  1654. Xcompilation hosts priority lists {
  1655. X    AT286   : node_AT486
  1656. X    AT386   : node_AT486
  1657. X    SPARC   : node_SPARC_1, node_SPARC_4
  1658. X#    general : node_C3840, node_C220, node_SPARC_1, node_AT486 
  1659. X} # compilation hosts priority lists
  1660. X
  1661. X# definition of the cost informations
  1662. X
  1663. Xcosts informations {
  1664. X
  1665. X    node_AT286    -> node_AT286    :  0,  20
  1666. X    node_AT286    -> node_AT386    :  2,  16
  1667. X    node_AT286    -> node_AT386_2    :  2,  16
  1668. X    node_AT286    -> node_AT486    :  2,  16
  1669. X    node_AT286    -> node_SPARC_1    :  1,  15
  1670. X    node_AT286    -> node_SPARC_2    :  3,  17
  1671. X    node_AT286    -> node_SPARC_3    :  3,  17
  1672. X    node_AT286    -> node_SPARC_4    : 11,  33
  1673. X    node_AT286    -> node_Sun3_1    : 12,  35
  1674. X    node_AT286    -> node_Sun3_2    : 12,  35
  1675. X    node_AT286    -> node_HP_1    :  2,  14
  1676. X    node_AT286    -> node_HP_2    :  2,  14
  1677. X    node_AT286    -> node_C220    :  0,  10
  1678. X    node_AT286    -> node_C3840    : 10,  30
  1679. X
  1680. X    node_AT386    -> node_AT286    :  5,  16
  1681. X    node_AT386    -> node_AT386    :  0,   8
  1682. X    node_AT386    -> node_AT386_2    :  2,  10
  1683. X    node_AT386    -> node_AT486    :  2,  10
  1684. X    node_AT386    -> node_SPARC_1    :  1,   9
  1685. X    node_AT386    -> node_SPARC_2    :  3,  11
  1686. X    node_AT386    -> node_SPARC_3    :  3,  11
  1687. X    node_AT386    -> node_SPARC_4    : 11,  27
  1688. X    node_AT386    -> node_Sun3_1    : 12,  29
  1689. X    node_AT386    -> node_Sun3_2    : 12,  29
  1690. X    node_AT386    -> node_HP_1    :  2,   8
  1691. X    node_AT386    -> node_HP_2    :  2,   8 
  1692. X    node_AT386    -> node_C220    :  0,   6
  1693. X    node_AT386    -> node_C3840    : 10,  24
  1694. X
  1695. X    node_AT386_2    -> node_AT286    :  5,  16
  1696. X    node_AT386_2    -> node_AT386    :  2,  10
  1697. X    node_AT386_2    -> node_AT386_2    :  0,   8
  1698. X    node_AT386_2    -> node_AT486    :  2,  10
  1699. X    node_AT386_2    -> node_SPARC_1    :  1,   9
  1700. X    node_AT386_2    -> node_SPARC_2    :  3,  11
  1701. X    node_AT386_2    -> node_SPARC_3    :  3,  11
  1702. X    node_AT386_2    -> node_SPARC_4    : 11,  27
  1703. X    node_AT386_2    -> node_Sun3_1    : 12,  29
  1704. X    node_AT386_2    -> node_Sun3_2    : 12,  29
  1705. X    node_AT386_2    -> node_HP_1    :  2,   8
  1706. X    node_AT386_2    -> node_HP_2    :  2,   8
  1707. X    node_AT386_2    -> node_C220    :  0,   6
  1708. X    node_AT386_2    -> node_C3840    : 10,  24
  1709. X
  1710. X    node_AT486    -> node_AT286    :  5,  16
  1711. X    node_AT486    -> node_AT386    :  4,  10
  1712. X    node_AT486    -> node_AT386_2    :  4,  10
  1713. X    node_AT486    -> node_AT486    :  0,   4
  1714. X    node_AT486    -> node_SPARC_1    :  3,   9
  1715. X    node_AT486    -> node_SPARC_2    :  1,   7
  1716. X    node_AT486    -> node_SPARC_3    :  1,   7
  1717. X    node_AT486    -> node_SPARC_4    : 11,  25
  1718. X    node_AT486    -> node_Sun3_1    : 12,  27
  1719. X    node_AT486    -> node_Sun3_2    : 12,  27
  1720. X    node_AT486    -> node_HP_1    :  0,   4
  1721. X    node_AT486    -> node_HP_2    :  0,   4
  1722. X    node_AT486    -> node_C220    :  2,   6
  1723. X    node_AT486    -> node_C3840    : 10,  22
  1724. X
  1725. X    node_SPARC_1    -> node_AT286    :  5,  15
  1726. X    node_SPARC_1    -> node_AT386    :  2,   9
  1727. X    node_SPARC_1    -> node_AT386_2    :  2,   9
  1728. X    node_SPARC_1    -> node_AT486    :  2,   9
  1729. X    node_SPARC_1    -> node_SPARC_1    :  0,   6
  1730. X    node_SPARC_1    -> node_SPARC_2    :  3,  10
  1731. X    node_SPARC_1    -> node_SPARC_3    :  3,  10
  1732. X    node_SPARC_1    -> node_SPARC_4    : 11,  26
  1733. X    node_SPARC_1    -> node_Sun3_1    : 12,  28
  1734. X    node_SPARC_1    -> node_Sun3_2    : 12,  28
  1735. X    node_SPARC_1    -> node_HP_1    :  2,   7
  1736. X    node_SPARC_1    -> node_HP_2    :  2,   7
  1737. X    node_SPARC_1    -> node_C220    :  0,   5
  1738. X    node_SPARC_1    -> node_C3840    : 10,  23
  1739. X
  1740. X    node_SPARC_2    -> node_AT286    :  7,  17
  1741. X    node_SPARC_2    -> node_AT386    :  4,  11
  1742. X    node_SPARC_2    -> node_AT386_2    :  4,  11
  1743. X    node_SPARC_2    -> node_AT486    :  0,   7
  1744. X    node_SPARC_2    -> node_SPARC_1    :  3,  10
  1745. X    node_SPARC_2    -> node_SPARC_2    :  0,   6
  1746. X    node_SPARC_2    -> node_SPARC_3    :  1,   8
  1747. X    node_SPARC_2    -> node_SPARC_4    : 11,  26
  1748. X    node_SPARC_2    -> node_Sun3_1    : 12,  28
  1749. X    node_SPARC_2    -> node_Sun3_2    : 12,  28
  1750. X    node_SPARC_2    -> node_HP_1    :  0,   5
  1751. X    node_SPARC_2    -> node_HP_2    :  0,   5
  1752. X    node_SPARC_2    -> node_C220    :  2,   7
  1753. X    node_SPARC_2    -> node_C3840    : 10,  23
  1754. X
  1755. X    node_SPARC_3    -> node_AT286    :  7,  17
  1756. X    node_SPARC_3    -> node_AT386    :  4,  11
  1757. X    node_SPARC_3    -> node_AT386_2    :  4,  11
  1758. X    node_SPARC_3    -> node_AT486    :  0,   7
  1759. X    node_SPARC_3    -> node_SPARC_1    :  3,  10
  1760. X    node_SPARC_3    -> node_SPARC_2    :  1,   8
  1761. X    node_SPARC_3    -> node_SPARC_3    :  0,   6
  1762. X    node_SPARC_3    -> node_SPARC_4    : 11,  26
  1763. X    node_SPARC_3    -> node_Sun3_1    : 12,  28
  1764. X    node_SPARC_3    -> node_Sun3_2    : 12,  28
  1765. X    node_SPARC_3    -> node_HP_1    :  0,   5
  1766. X    node_SPARC_3    -> node_HP_2    :  0,   5
  1767. X    node_SPARC_3    -> node_C220    :  2,   7
  1768. X    node_SPARC_3    -> node_C3840    : 10,  23
  1769. X
  1770. X    node_SPARC_4    -> node_AT286    : 15,  33
  1771. X    node_SPARC_4    -> node_AT386    : 12,  27
  1772. X    node_SPARC_4    -> node_AT386_2    : 12,  27
  1773. X    node_SPARC_4    -> node_AT486    : 10,  25
  1774. X    node_SPARC_4    -> node_SPARC_1    : 11,  26
  1775. X    node_SPARC_4    -> node_SPARC_2    : 11,  26
  1776. X    node_SPARC_4    -> node_SPARC_3    : 11,  26
  1777. X    node_SPARC_4    -> node_SPARC_4    :  1,   6
  1778. X    node_SPARC_4    -> node_Sun3_1    :  2,  10
  1779. X    node_SPARC_4    -> node_Sun3_2    :  2,  10
  1780. X    node_SPARC_4    -> node_HP_1    : 10,  23
  1781. X    node_SPARC_4    -> node_HP_2    : 10,  23
  1782. X    node_SPARC_4    -> node_C220    : 10,  23
  1783. X    node_SPARC_4    -> node_C3840    :  0,   5
  1784. X
  1785. X    node_Sun3_1    -> node_AT286    : 15,  35
  1786. X    node_Sun3_1    -> node_AT386    : 12,  29
  1787. X    node_Sun3_1    -> node_AT386_2    : 12,  29
  1788. X    node_Sun3_1    -> node_AT486    : 10,  27
  1789. X    node_Sun3_1    -> node_SPARC_1    : 11,  28
  1790. X    node_Sun3_1    -> node_SPARC_2    : 11,  28
  1791. X    node_Sun3_1    -> node_SPARC_3    : 11,  28
  1792. X    node_Sun3_1    -> node_SPARC_4    :  1,  10
  1793. X    node_Sun3_1    -> node_Sun3_1    :  0,  10
  1794. X    node_Sun3_1    -> node_Sun3_2    :  2,  12
  1795. X    node_Sun3_1    -> node_HP_1    : 10,  25
  1796. X    node_Sun3_1    -> node_HP_2    : 10,  25
  1797. X    node_Sun3_1    -> node_C220    : 10,  25
  1798. X    node_Sun3_1    -> node_C3840    :  0,   5
  1799. X
  1800. X    node_Sun3_2    -> node_AT286    : 15,  35
  1801. X    node_Sun3_2    -> node_AT386    : 12,  29
  1802. X    node_Sun3_2    -> node_AT386_2    : 12,  29
  1803. X    node_Sun3_2    -> node_AT486    : 10,  27
  1804. X    node_Sun3_2    -> node_SPARC_1    : 11,  28
  1805. X    node_Sun3_2    -> node_SPARC_2    : 11,  28
  1806. X    node_Sun3_2    -> node_SPARC_3    : 11,  28
  1807. X    node_Sun3_2    -> node_SPARC_4    :  1,  10
  1808. X    node_Sun3_2    -> node_Sun3_1    :  2,  12
  1809. X    node_Sun3_2    -> node_Sun3_2    :  0,  10
  1810. X    node_Sun3_2    -> node_HP_1    : 10,  25
  1811. X    node_Sun3_2    -> node_HP_2    : 10,  25
  1812. X    node_Sun3_2    -> node_C220    : 10,  25
  1813. X    node_Sun3_2    -> node_C3840    :  0,   5
  1814. X
  1815. X    node_HP_1    -> node_AT286    :  7,  14
  1816. X    node_HP_1    -> node_AT386    :  4,   8
  1817. X    node_HP_1    -> node_AT386_2    :  4,   8
  1818. X    node_HP_1    -> node_AT486    :  0,   4
  1819. X    node_HP_1    -> node_SPARC_1    :  3,   7
  1820. X    node_HP_1    -> node_SPARC_2    :  1,   5
  1821. X    node_HP_1    -> node_SPARC_3    :  1,   5
  1822. X    node_HP_1    -> node_SPARC_4    : 11,  23
  1823. X    node_HP_1    -> node_Sun3_1    : 12,  25
  1824. X    node_HP_1    -> node_Sun3_2    : 12,  25
  1825. X    node_HP_1    -> node_HP_1    :  0,   0
  1826. X    node_HP_1    -> node_HP_2    :  0,   2
  1827. X    node_HP_1    -> node_C220    :  2,   4
  1828. X    node_HP_1    -> node_C3840    : 10,  20
  1829. X
  1830. X    node_HP_2    -> node_AT286    :  7,  14
  1831. X    node_HP_2    -> node_AT386    :  4,   8
  1832. X    node_HP_2    -> node_AT386_2    :  4,   8
  1833. X    node_HP_2    -> node_AT486    :  0,   4
  1834. X    node_HP_2    -> node_SPARC_1    :  3,   7
  1835. X    node_HP_2    -> node_SPARC_2    :  1,   5
  1836. X    node_HP_2    -> node_SPARC_3    :  1,   5
  1837. X    node_HP_2    -> node_SPARC_4    : 11,  23
  1838. X    node_HP_2    -> node_Sun3_1    : 12,  25
  1839. X    node_HP_2    -> node_Sun3_2    : 12,  25
  1840. X    node_HP_2    -> node_HP_1    :  0,   2
  1841. X    node_HP_2    -> node_HP_2    :  0,   0
  1842. X    node_HP_2    -> node_C220    :  2,   4
  1843. X    node_HP_2    -> node_C3840    : 10,  20
  1844. X
  1845. X    node_C220    -> node_AT286    :  5,  10
  1846. X    node_C220    -> node_AT386    :  2,   6
  1847. X    node_C220    -> node_AT386_2    :  2,   6
  1848. X    node_C220    -> node_AT486    :  2,   6
  1849. X    node_C220    -> node_SPARC_1    :  1,   5
  1850. X    node_C220    -> node_SPARC_2    :  3,   7
  1851. X    node_C220    -> node_SPARC_3    :  3,   7
  1852. X    node_C220    -> node_SPARC_4    : 11,  23
  1853. X    node_C220    -> node_Sun3_1    : 12,  25
  1854. X    node_C220    -> node_Sun3_2    : 12,  25
  1855. X    node_C220    -> node_HP_1    :  2,   4
  1856. X    node_C220    -> node_HP_2    :  2,   4
  1857. X    node_C220    -> node_C220    :  0,   0
  1858. X    node_C220    -> node_C3840    : 10,  20
  1859. X
  1860. X    node_C3840    -> node_AT286    : 15,  30
  1861. X    node_C3840    -> node_AT386    : 12,  24
  1862. X    node_C3840    -> node_AT386_2    : 12,  24
  1863. X    node_C3840    -> node_AT486    : 10,  22
  1864. X    node_C3840    -> node_SPARC_1    : 11,  23
  1865. X    node_C3840    -> node_SPARC_2    : 11,  23
  1866. X    node_C3840    -> node_SPARC_3    : 11,  23
  1867. X    node_C3840    -> node_SPARC_4    :  1,   5
  1868. X    node_C3840    -> node_Sun3_1    :  2,   5
  1869. X    node_C3840    -> node_Sun3_2    :  2,   5
  1870. X    node_C3840    -> node_HP_1    : 10,  20
  1871. X    node_C3840    -> node_HP_2    : 10,  20
  1872. X    node_C3840    -> node_C220    : 10,  20
  1873. X    node_C3840    -> node_C3840    :  0,   0
  1874. X
  1875. X} # cost informations
  1876. END_OF_FILE
  1877. if test 20365 -ne `wc -c <'examples/config/system.FICT'`; then
  1878.     echo shar: \"'examples/config/system.FICT'\" unpacked with wrong size!
  1879. fi
  1880. # end of 'examples/config/system.FICT'
  1881. fi
  1882. if test -f 'lib/ipc_iPSC.c' -a "${1}" != "-c" ; then 
  1883.   echo shar: Will not clobber existing file \"'lib/ipc_iPSC.c'\"
  1884. else
  1885. echo shar: Extracting \"'lib/ipc_iPSC.c'\" \(21990 characters\)
  1886. sed "s/^X//" >'lib/ipc_iPSC.c' <<'END_OF_FILE'
  1887. X/***************************************************************************
  1888. X *                                                                         *
  1889. X * @@@@  @@@ @@@@@ @@@@@ @@@@@ @@@ @@@@  @   @ @@@@@ @@@@@ @@@@       @@@  *
  1890. X * @   @  @  @       @   @   @  @  @   @ @   @   @   @     @   @     @   @ *
  1891. X * @   @  @  @@@@@   @   @@@@@  @  @@@@@ @   @   @   @@@@@ @   @     @     *
  1892. X * @   @  @      @   @   @ @    @  @   @ @   @   @   @     @   @     @   @ *
  1893. X * @@@@  @@@ @@@@@   @   @  @  @@@ @@@@  @@@@@   @   @@@@@ @@@@       @@@  *
  1894. X *                                                                         *
  1895. X *              A compiler for distributed programming with C              *
  1896. X *                                                                         *
  1897. X *                          i p c _ i P S C . c                            *
  1898. X *                                                                         *
  1899. X *                            Package : Runtime Library                    *
  1900. X *                            Version : 1.0                                *
  1901. X *                       CreationDate : 01.09.90                           *
  1902. X *                         LastUpDate : 15.10.90                           *
  1903. X *                                                                         *
  1904. X * This file contains the hardware dependent routines building the message *
  1905. X * passing layer for the iPSC Intel Hypercube.                             *
  1906. X *                                                                         *
  1907. X *        Copyright (C) 1990-1994 by Christoph and Markus Pleier.          *
  1908. X *                          All rights reserved!                           *
  1909. X ***************************************************************************/
  1910. X
  1911. X/*
  1912. X * This file is part of the Distributed C Development Environment (DCDE).
  1913. X * DCDE is free software; you can redistribute it and/or modify
  1914. X * it under the terms written in the README-file. 
  1915. X * DCDE is distributed in the hope that it will be useful,
  1916. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1917. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
  1918. X * See the file README for more details.
  1919. X */
  1920. X
  1921. X#include <stdio.h>
  1922. X#include <sys/types.h>
  1923. X#include <signal.h>
  1924. X#include <errno.h>
  1925. X#include "cube.h"
  1926. X#include "ipc_iPSC.h"
  1927. X#include "run_Errno.h"
  1928. X
  1929. X#define DEBUG_IPC /**/
  1930. X
  1931. X/* the used external variables */
  1932. Xextern int   errno,         /* system error code */
  1933. X             Errno,        /* function error code */
  1934. X             _debugflush;    /* flush debug messages or not */
  1935. Xextern char *sys_errlist[],    /* system error messages */
  1936. X             *_programname,    /* name of program */
  1937. X             *_processname,    /* name of process */
  1938. X             *_processprefix;    /* process specifying string */
  1939. Xextern FILE  *_debugout;    /* where to write the debug messages */
  1940. X
  1941. X/* the timeout variables */
  1942. Xstatic int  timeout_flag;
  1943. Xstatic long timeout_type,
  1944. X            timeout_msg;
  1945. X
  1946. X#ifdef DEBUG_IPC
  1947. X/* the flag to control the debug messages output */
  1948. Xint _debug_ipc = 0;
  1949. X#endif /* DEBUG_IPC /**/
  1950. X
  1951. X#define SETTIMER(time, type)    timeout_flag = FALSE; \
  1952. X                timeout_msg = type; \
  1953. X                    signal(SIGALRM, timeout_proc); \
  1954. X                    (void) alarm(time)
  1955. X
  1956. X#ifdef DEBUG_IPC
  1957. X# define DEBUGPUTS(msg)        if (_debug_ipc) { \
  1958. X                    fprintf(_debugout, "[ipc] %s %s\n", \
  1959. X                        _processprefix, msg); \
  1960. X                    if (_debugflush) \
  1961. X                        fflush(_debugout); \
  1962. X                }
  1963. X# define DEBUGDISPERR(msg)    if (_debug_ipc) { \
  1964. X                    fprintf(_debugout, "[ipc] %s error: %s\n", \
  1965. X                        _processprefix, msg); \
  1966. X                    fprintf(_debugout, "[ipc] %s reason: %s\n",\
  1967. X                        _processprefix, sys_errlist[errno]); \
  1968. X                    if (_debugflush) \
  1969. X                        fflush(_debugout); \
  1970. X                }
  1971. X#else
  1972. X# define DEBUGPUTS(msg)        { /* nothing */ }
  1973. X# define DEBUGDISPERR(msg)    { /* nothing */ }
  1974. X#endif
  1975. X
  1976. X/******************************************************************************
  1977. X * timeout_proc()                                                             *
  1978. X *                                                                            *
  1979. X * Sets the timeout flag 'timeout' to indicate a timeout error.               *
  1980. X *                                                                            *
  1981. X * Return values: none!                                                       *
  1982. X ******************************************************************************/
  1983. Xstatic int
  1984. Xtimeout_proc()
  1985. X{
  1986. X    static char buf[10];
  1987. X
  1988. X#ifdef DEBUG_IPC
  1989. X    if (_debug_ipc) {
  1990. X        fprintf(_debugout, "[ipc] %s ***** timeout_proc():\n", _processprefix);
  1991. X        fprintf(_debugout, "[ipc] %s timeout_type = %s\n", _processprefix,
  1992. X        (timeout_type == TIMER_NOMSG) ? "TIMER_NOMSG" : "TIMER_RECV");
  1993. X        fprintf(_debugout, "[ipc] %s timeout_msg  = %ld\n", _processprefix, 
  1994. X        timeout_msg);
  1995. X    }
  1996. X#endif /* DEBUG_IPC /**/
  1997. X    timeout_flag = TRUE;
  1998. X    switch(timeout_type) {
  1999. X    case TIMER_NOMSG:
  2000. X    break;
  2001. X    case TIMER_RECV:
  2002. X        csend(timeout_msg, buf, 0, mynode(), mypid());
  2003. X    break;
  2004. X    default:
  2005. X    fprintf(stderr, "%s Panic: unknown timeout_type in timeout_proc()\n",
  2006. X        _processprefix);
  2007. X#ifdef DEBUG_IPC
  2008. X    if (_debug_ipc && _debugout != stderr) 
  2009. X        fprintf(_debugout, "%s Panic: unknown timeout_type in timeout_proc()\n",
  2010. X            _processprefix);
  2011. X#endif /* DEBUG_IPC /**/
  2012. X    exit(-1);
  2013. X    } /* switch */
  2014. X} /* timeout_proc */
  2015. X
  2016. X/******************************************************************************
  2017. X * _create_port()                                                             *
  2018. X *                                                                            *
  2019. X * Creates a new communication endpoint:                                      *
  2020. X * Initialize the port variable specified by 'port'.                          *
  2021. X *                                                                            *
  2022. X * Return values: OK = success / ERROR = error                                *
  2023. X ******************************************************************************/
  2024. Xint
  2025. X_create_port(port)
  2026. XPORTDESCR *port;
  2027. X{
  2028. X#ifdef DEBUG_IPC
  2029. X    if (_debug_ipc) {
  2030. X        fprintf(_debugout, "[ipc] %s ***** _create_port():\n", _processprefix);
  2031. X        fprintf(_debugout, "[ipc] %s params: &port = %d\n", _processprefix, 
  2032. X        port);
  2033. X    if (_debugflush)
  2034. X        fflush(_debugout);
  2035. X    }
  2036. X#endif /* DEBUG_IPC /**/
  2037. X    /* set Errno */
  2038. X    Errno = ECREATEPORT;
  2039. X    /* initialize port */
  2040. X    if ((port->node = mynode()) < 0) {
  2041. X    DEBUGDISPERR("No node defined");
  2042. X    return(ERROR);
  2043. X    }
  2044. X    if ((port->pid  = mypid()) < 0) {
  2045. X    DEBUGDISPERR("No pid defined");
  2046. X    return(ERROR);
  2047. X    }
  2048. X    return(OK);
  2049. X} /* _create_port */
  2050. X
  2051. X/******************************************************************************
  2052. X * _delete_port()                                                             *
  2053. X *                                                                            *
  2054. X * Deletes the communication endpoint specified by 'port':                    *
  2055. X * there is nothing to do for iPSC!                                           *
  2056. X *                                                                            *
  2057. X * Return values: always OK for success                                       *
  2058. X ******************************************************************************/
  2059. Xint
  2060. X_delete_port(port)
  2061. XPORTDESCR *port;
  2062. X{
  2063. X#ifdef DEBUG_IPC
  2064. X    if (_debug_ipc) {
  2065. X        fprintf(_debugout, "[ipc] %s ***** _delete_port():\n", _processprefix);
  2066. X        fprintf(_debugout, "[ipc] %s params: port = (node = %ld, pid = %ld)\n", 
  2067. X        _processprefix, port->node, port->pid);
  2068. X    }
  2069. X#endif /* DEBUG_IPC /**/
  2070. X    return(OK);
  2071. X} /* _delete_port */
  2072. X
  2073. X/******************************************************************************
  2074. X * _accept_connection()                                                       *
  2075. X *                                                                            *
  2076. X * Communication endpoint 'port' waits 'time' real time seconds for a         *
  2077. X * connection request (if 'time' equals 0 then the operation is unlimited).   *
  2078. X *                                                                            *
  2079. X * Return values: OK = success / ERROR = error                                *
  2080. X ******************************************************************************/
  2081. Xint
  2082. X_accept_connection(con_port, port, time)
  2083. XCONNECTIONDESCR *con_port;
  2084. XPORTDESCR       *port;
  2085. Xunsigned         time;
  2086. X{
  2087. X    static long res;
  2088. X    static char buf[1];
  2089. X
  2090. X#ifdef DEBUG_IPC
  2091. X    if (_debug_ipc) {
  2092. X        fprintf(_debugout, "[ipc] %s ***** _accept_connection():\n", 
  2093. X        _processprefix);
  2094. X        fprintf(_debugout, "[ipc] %s con_port = %d\n", _processprefix, 
  2095. X        con_port);
  2096. X        fprintf(_debugout, "[ipc] %s port = (node = %ld, pid = %ld)\n", 
  2097. X        _processprefix, port->node, port->pid);
  2098. X        fprintf(_debugout, "[ipc] %s time = %d\n", _processprefix, time);
  2099. X    }
  2100. X#endif /* DEBUG_IPC /**/
  2101. X    /* set Errno */
  2102. X    Errno = EACPTCON;
  2103. X    /* set timer */
  2104. X    SETTIMER(time, CON_REQ);
  2105. X    while(!timeout_flag) {
  2106. X    /* get connection request */
  2107. X    timeout_type = TIMER_RECV;
  2108. X    if ((res = _crecv(CON_REQ, buf, 0)) < 0) {
  2109. X        timeout_type = TIMER_NOMSG;
  2110. X#ifdef DEBUG_IPC
  2111. X        if (_debug_ipc) {
  2112. X            fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n", 
  2113. X            _processprefix, res);
  2114. X        }
  2115. X#endif /* DEBUG_IPC /**/
  2116. X        if (time == 0) {
  2117. X            DEBUGDISPERR("can't receive connection requests");
  2118. X            return(ERROR);
  2119. X        } else
  2120. X            continue;
  2121. X    }
  2122. X    timeout_type = TIMER_NOMSG;
  2123. X#ifdef DEBUG_IPC
  2124. X    if (_debug_ipc) {
  2125. X        fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n",
  2126. X            _processprefix, res);
  2127. X    }
  2128. X#endif /* DEBUG_IPC /**/
  2129. X    if (timeout_flag)
  2130. X        break;
  2131. X    /* got a connection, initialize connection descriptor */
  2132. X    con_port->othernode = infonode();
  2133. X    con_port->otherpid  = infopid();
  2134. X    con_port->msgtype   = (mynode() << 8 + mypid()) & 0x0FFFFFFF;
  2135. X    /* clear timer */
  2136. X    (void) alarm(0);
  2137. X        /* send back acknowledge message */
  2138. X#ifdef DEBUG_IPC
  2139. X    if (_debug_ipc) {
  2140. X        fprintf(_debugout, "[ipc] %s sending acknowledge to node = %ld, pid = %ld\n",
  2141. X            _processprefix, infonode(), infopid());
  2142. X    }
  2143. X#endif /* DEBUG_IPC /**/
  2144. X    isend(CON_ACK, buf, 0, infonode(), infopid());
  2145. X    flushmsg(CON_ACK, infonode(), infopid());
  2146. X    return(OK);
  2147. X    } /* while */
  2148. X    DEBUGPUTS("operation '_accept_connection' timed out");
  2149. X    Errno = ETIMEOUT;
  2150. X    return(ERROR);
  2151. X} /* _accept_connection */
  2152. X
  2153. X/******************************************************************************
  2154. X * _make_connection()                                                         *
  2155. X *                                                                            *
  2156. X * Communication enpoint 'port1' tries 'time' real time seconds to connect    *
  2157. X * to 'port2' (if 'time' equals 0 then the operation is unlimited).           *
  2158. X *                                                                            *
  2159. X * Return values: OK = success / ERROR = error                                *
  2160. X ******************************************************************************/
  2161. Xint
  2162. X_make_connection(con_port, port1, port2, time)
  2163. XCONNECTIONDESCR *con_port;
  2164. XPORTDESCR       *port1,
  2165. X                *port2;
  2166. Xunsigned         time;
  2167. X{
  2168. X    static long msg_id, res;
  2169. X    static char buf[1], rbuf[1];
  2170. X
  2171. X#ifdef DEBUG_IPC
  2172. X    if (_debug_ipc) {
  2173. X        fprintf(_debugout, "[ipc] %s ***** _make_connection():\n", 
  2174. X        _processprefix);
  2175. X        fprintf(_debugout, "[ipc] %s port1 = (node = %ld, pid = %ld)\n",
  2176. X        _processprefix, port1->node, port1->pid);
  2177. X        fprintf(_debugout, "[ipc] %s port2 = (node = %ld, pid = %ld)\n",
  2178. X        _processprefix, port2->node, port2->pid);
  2179. X        fprintf(_debugout, "[ipc] %s time = %d\n", _processprefix, time);
  2180. X    }
  2181. X#endif /* DEBUG_IPC /**/
  2182. X    /* set Errno */
  2183. X    Errno = EMAKECON;
  2184. X#ifdef DEBUG_IPC
  2185. X    if (_debug_ipc)
  2186. X        fprintf(_debugout,"[ipc] %s sending request to node = %ld, pid = %ld\n",
  2187. X        _processprefix, port2->node, port2->pid);
  2188. X#endif /* DEBUG_IPC /**/
  2189. X    msg_id = isend(CON_REQ, buf, 0, port2->node, port2->pid);
  2190. X    /* set timer */
  2191. X    SETTIMER(time, CON_ACK);
  2192. X    while(!timeout_flag) {
  2193. X    timeout_type = TIMER_RECV;
  2194. X    if ((res = _crecv(CON_ACK, rbuf, 0)) < 0) {
  2195. X        timeout_type = TIMER_NOMSG;
  2196. X#ifdef DEBUG_IPC
  2197. X        if (_debug_ipc) {
  2198. X            fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n",
  2199. X            _processprefix, res);
  2200. X        }
  2201. X#endif /* DEBUG_IPC /**/
  2202. X        if (time == 0) {
  2203. X            DEBUGDISPERR("can't receive connection acknowledge");
  2204. X            return(ERROR);
  2205. X        } else
  2206. X            continue;
  2207. X    }
  2208. X#ifdef DEBUG_IPC
  2209. X    if (_debug_ipc) {
  2210. X        fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n",
  2211. X            _processprefix, res);
  2212. X    }
  2213. X#endif /* DEBUG_IPC /**/
  2214. X    timeout_type = TIMER_NOMSG;
  2215. X    if (timeout_flag)
  2216. X        break;
  2217. X    /* connection established, initialize connection descriptor */
  2218. X    con_port->othernode = port2->node;
  2219. X    con_port->otherpid  = port2->pid;
  2220. X    con_port->msgtype   = (port2->node << 8 + port2->pid) & 0x0FFFFFFF;
  2221. X    /* clear timer and return */
  2222. X    (void) alarm(0);
  2223. X    return(OK);
  2224. X    } /* while */
  2225. X    DEBUGPUTS("operation '_make_connection' timed out");
  2226. X    DEBUGPUTS("deleting request message");
  2227. X    msgcancel(msg_id);
  2228. X    flushmsg(CON_REQ, port2->node, port2->pid);
  2229. X    Errno = ETIMEOUT;
  2230. X    return(ERROR);
  2231. X} /* _make_connection */
  2232. X
  2233. X/******************************************************************************
  2234. X * _close_connection()                                                        *
  2235. X *                                                                            *
  2236. X * The connection associated to connection port 'con_port' is closed:         *
  2237. X * there is nothing to do for iPSC!                                           *
  2238. X *                                                                            *
  2239. X * Return values: always OK for success                                       *
  2240. X ******************************************************************************/
  2241. Xint
  2242. X_close_connection(con_port)
  2243. XCONNECTIONDESCR *con_port;
  2244. X{
  2245. X#ifdef DEBUG_IPC
  2246. X    if (_debug_ipc) {
  2247. X        fprintf(_debugout, "[ipc] %s ***** _close_connection():\n", 
  2248. X        _processprefix);
  2249. X        fprintf(_debugout, "[ipc] %s con_port = (node = %ld, pid = %ld, type = %ld)\n",
  2250. X        _processprefix, con_port->othernode, con_port->otherpid, 
  2251. X        con_port->msgtype);
  2252. X    }
  2253. X#endif /* DEBUG_IPC /**/
  2254. X    return(OK);
  2255. X} /* _close_connection */
  2256. X
  2257. X/******************************************************************************
  2258. X * _recv_data()                                                               *
  2259. X *                                                                            *
  2260. X * 'number' bytes are received from connection port 'con_port' and stored     *
  2261. X * into 'buffer'. 'time' is the maximum real time in seconds to wait for a    *
  2262. X * message to arrive (if 'time' equals 0 the waiting is unlimited).           * 
  2263. X *                                                                            *
  2264. X * Return values: number of received bytes upon success / ERROR = error       *
  2265. X ******************************************************************************/
  2266. Xint
  2267. X_recv_data(con_port, buffer, number, time)
  2268. XCONNECTIONDESCR *con_port;
  2269. Xchar            *buffer;
  2270. Xint              number;
  2271. Xunsigned         time;
  2272. X{
  2273. X    static long res;
  2274. X
  2275. X#ifdef DEBUG_IPC
  2276. X    if (_debug_ipc) {
  2277. X        fprintf(_debugout, "[ipc] %s ***** _recv_data()\n", _processprefix);
  2278. X        fprintf(_debugout, "[ipc] %s con_port = (node = %ld, pid = %ld, type = %ld)\n",
  2279. X        _processprefix, con_port->othernode, con_port->otherpid, 
  2280. X        con_port->msgtype);
  2281. X        fprintf(_debugout, "[ipc] %s buffer = %d, number = %d\n", 
  2282. X        _processprefix, buffer, number);
  2283. X        fprintf(_debugout, "[ipc] %s time = %d\n", _processprefix, time);
  2284. X    }
  2285. X#endif /* DEBUG_IPC /**/
  2286. X    /* set Errno */
  2287. X    Errno = ERECVDATA;
  2288. X    /* set timer */
  2289. X    SETTIMER(time, con_port->msgtype);
  2290. X    while(!timeout_flag) {
  2291. X    timeout_type = TIMER_RECV;
  2292. X        if ((res = _crecv(con_port->msgtype, buffer, number)) < 0) {
  2293. X        timeout_type = TIMER_NOMSG;
  2294. X#ifdef DEBUG_IPC
  2295. X        if (_debug_ipc) {
  2296. X            fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n",
  2297. X            _processprefix, res);
  2298. X        }
  2299. X#endif /* DEBUG_IPC /**/
  2300. X        if (time == 0) {
  2301. X            DEBUGDISPERR("can't receive message");
  2302. X            return(ERROR);
  2303. X        } else
  2304. X            continue;
  2305. X    }
  2306. X    timeout_type = TIMER_NOMSG;
  2307. X#ifdef DEBUG_IPC
  2308. X    if (_debug_ipc) {
  2309. X        fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n", 
  2310. X            _processprefix, res);
  2311. X    }
  2312. X#endif /* DEBUG_IPC /**/
  2313. X    if (timeout_flag)
  2314. X        break;
  2315. X    /* clear timer and return */
  2316. X    (void) alarm(0);
  2317. X    DEBUGPUTS("sending acknowledge message");
  2318. X    isend(con_port->msgtype, buffer, 0, infonode(), infopid());
  2319. X    flushmsg(con_port->msgtype, infonode(), infopid());
  2320. X        return(number);
  2321. X    } /* while */
  2322. X    DEBUGPUTS("operation '_recv_data' timed out");
  2323. X    Errno = ETIMEOUT;
  2324. X    return(ERROR);
  2325. X} /* _recv_data */
  2326. X
  2327. X/******************************************************************************
  2328. X * _send_data()                                                               *
  2329. X *                                                                            *
  2330. X * 'number' bytes, stored in 'buffer', are send to connection port 'con_port'.*
  2331. X * 'time' is the maximum real time in seconds to retry sending upon error (if *
  2332. X * 'time' equals 0 the waiting is unlimited).                                 *
  2333. X *                                                                            *
  2334. X * Return values: number of sent bytes upon success / ERROR = error           *
  2335. X ******************************************************************************/
  2336. Xint
  2337. X_send_data(con_port, buffer, number, time)
  2338. XCONNECTIONDESCR *con_port;
  2339. Xchar            *buffer;
  2340. Xint              number;
  2341. Xunsigned         time;
  2342. X{
  2343. X    long res, msg_id;
  2344. X
  2345. X#ifdef DEBUG_IPC
  2346. X    if (_debug_ipc) {
  2347. X        fprintf(_debugout, "[ipc] %s ***** _send_data():\n", _processprefix);
  2348. X        fprintf(_debugout, "[ipc] %s con_port = (node = %ld, pid = %ld, type = %ld)\n",
  2349. X        _processprefix, con_port->othernode, con_port->otherpid, 
  2350. X        con_port->msgtype);
  2351. X        fprintf(_debugout, "[ipc] %s buffer = %d, number = %d\n", 
  2352. X        _processprefix, buffer, number);
  2353. X        fprintf(_debugout, "[ipc] %s time = %d\n", _processprefix, time);
  2354. X    }
  2355. X#endif /* DEBUG_IPC /**/
  2356. X    /* set Errno */
  2357. X    Errno = ESENDDATA;
  2358. X#ifdef DEBUG_IPC
  2359. X    if (_debug_ipc) {
  2360. X        fprintf(_debugout,"[ipc] %s sending message to node = %ld, pid = %ld\n",
  2361. X        _processprefix, con_port->othernode, con_port->otherpid);
  2362. X    }
  2363. X#endif /* DEBUG_IPC /**/
  2364. X    msg_id = isend(con_port->msgtype, buffer, number, con_port->othernode, 
  2365. X    con_port->otherpid);
  2366. X    /* set timer */
  2367. X    SETTIMER(time, con_port->msgtype);
  2368. X    while(!timeout_flag) {
  2369. X    timeout_type = TIMER_RECV;
  2370. X        if ((res = _crecv(con_port->msgtype, buffer, 0)) < 0) {
  2371. X        timeout_type = TIMER_NOMSG;
  2372. X#ifdef DEBUG_IPC
  2373. X        if (_debug_ipc) {
  2374. X            fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n",
  2375. X            _processprefix, res);
  2376. X        }
  2377. X#endif /* DEBUG_IPC /**/
  2378. X        if (time == 0) {
  2379. X            DEBUGDISPERR("can't receive message");
  2380. X            return(ERROR);
  2381. X        } else
  2382. X            continue;
  2383. X    }
  2384. X    timeout_type = TIMER_NOMSG;
  2385. X#ifdef DEBUG_IPC
  2386. X    if (_debug_ipc) {
  2387. X        fprintf(_debugout, "[ipc] %s result of _crecv = %ld\n", 
  2388. X            _processprefix, res);
  2389. X    }
  2390. X#endif /* DEBUG_IPC /**/
  2391. X    if (timeout_flag)
  2392. X        break;
  2393. X    /* clear timer and return */
  2394. X    (void) alarm(0);
  2395. X        return(number);
  2396. X    } /* while */
  2397. X    msgcancel(msg_id);
  2398. X    flushmsg(con_port->msgtype, con_port->othernode, con_port->otherpid);
  2399. X    DEBUGPUTS("operation '_send_data' timed out");
  2400. X    Errno = ETIMEOUT;
  2401. X    return(ERROR);
  2402. X} /* _send_data */
  2403. X
  2404. X/* ============================ DEBUG Routines ============================== */
  2405. X
  2406. X/******************************************************************************
  2407. X * _display_port_info()                                                       *
  2408. X *                                                                            *
  2409. X * Displays the components of the structure PORTDESCR specified by 'port'.    *
  2410. X *                                                                            *
  2411. X * Return values: always OK for success                                       *
  2412. X ******************************************************************************/
  2413. Xint
  2414. X_display_port_info(prefix, msg, port)
  2415. Xchar *prefix, *msg;
  2416. XPORTDESCR port;
  2417. X{
  2418. X    fprintf(_debugout, "%s %s %s: node = %ld, pid = %ld\n", 
  2419. X    prefix, _processprefix, msg, port.node, port.pid);
  2420. X    return(OK);
  2421. X} /* _display_port_info */
  2422. X
  2423. X/******************************************************************************
  2424. X * _display_connection_port_info()                                            *
  2425. X *                                                                            *
  2426. X * Displays the components of the structure CONNECTIONDESCR specified by      *
  2427. X * 'con_port'.                                                                *
  2428. X *                                                                            *
  2429. X * Return values: always OK for success                                       *
  2430. X ******************************************************************************/
  2431. Xint
  2432. X_display_connection_port_info(prefix, msg, con_port)
  2433. Xchar *prefix, *msg;
  2434. XCONNECTIONDESCR con_port;
  2435. X{
  2436. X    return(OK);
  2437. X} /* _display_connection_port_info */
  2438. X
  2439. X/******************************************************************************
  2440. X * _input_port_info()                                                         *
  2441. X *                                                                            *
  2442. X * Input the port information for 'port'.                                     *
  2443. X *                                                                            *
  2444. X * Return values: none                                                        *
  2445. X ******************************************************************************/
  2446. Xint
  2447. X_input_port_info(port)
  2448. XPORTDESCR *port;
  2449. X{
  2450. X    long node, pid;
  2451. X
  2452. X    printf("node = "); 
  2453. X    scanf("%ld", &(port->node));
  2454. X    printf("pid  = "); 
  2455. X    scanf("%ld", &(port->pid));
  2456. X} /* _input_port_info */
  2457. END_OF_FILE
  2458. if test 21990 -ne `wc -c <'lib/ipc_iPSC.c'`; then
  2459.     echo shar: \"'lib/ipc_iPSC.c'\" unpacked with wrong size!
  2460. fi
  2461. # end of 'lib/ipc_iPSC.c'
  2462. fi
  2463. echo shar: End of archive 13 \(of 18\).
  2464. cp /dev/null ark13isdone
  2465. MISSING=""
  2466. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ; do
  2467.     if test ! -f ark${I}isdone ; then
  2468.     MISSING="${MISSING} ${I}"
  2469.     fi
  2470. done
  2471. if test "${MISSING}" = "" ; then
  2472.     echo You have unpacked all 18 archives.
  2473.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2474. else
  2475.     echo You still need to unpack the following archives:
  2476.     echo "        " ${MISSING}
  2477. fi
  2478. ##  End of shell archive.
  2479. exit 0
  2480.