Ada-95 - PowerPoint PPT Presentation

About This Presentation
Title:

Ada-95

Description:

Ada-95. Ada-95 programming language fundamentals. Ada-95 source codes ... program units and overall structure. Search-Sort. MinMax. ProgUnits ... – PowerPoint PPT presentation

Number of Views:207
Avg rating:3.0/5.0
Slides: 141
Provided by: dhar83
Learn more at: http://www.sigada.org
Category:
Tags: ada | unsorted

less

Transcript and Presenter's Notes

Title: Ada-95


1
Ada-95
  • Ada-95 programming language fundamentals
  • Ada-95 source codes
  • Ada-95 Information Resources
  • dr. salih yurttas computer science

2
Ada-95 Sources for Programming Language
Fundamentals
  • program units and overall structure
  • flow of control
  • data types
  • type extension

3
program units and overall structure
  • Search-Sort
  • MinMax
  • ProgUnits

4
program units and overall structure
  • Search
  • Sort
  • Search-Sort

5
Search Algorithms
  • Linear Search
  • Binary Search
  • LinearBinary Search

6
Linear Search
  • Linear Search - Integer
  • Linear Search - Float
  • Linear Search - Generic

7
Linear Search -Integer
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

8
Linear Search -Float
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

9
Linear Search - Generic
  • 00
  • 01
  • 02
  • 03
  • 04

10
program units and overall structure
  • linear_search_element_00.adb
  • common_type_parameters_p.ads
  • linear_search_element_p.ads
  • linear_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • d-unsorted-integer

11
program units and overall structure
  • linear_search_element_01.adb
  • common_type_parameters_p.ads
  • linear_search_element_p.ads
  • linear_search_element_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-unsorted-float

12
program units and overall structure
  • linear_search_element_02.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • linear_search_element_p.ads
  • linear_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-unsorted-integer
  • d-unsorted-float

13
program units and overall structure
  • linear_search_element_03.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • linear_search_element_p.ads
  • linear_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-unsorted-integer
  • d-unsorted-float

14
program units and overall structure
  • linear_search_element_04.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • linear_search_element_p.ads
  • linear_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-unsorted-integer
  • d-unsorted-float

15
Binary Search
  • Binary Search - Integer
  • Binary Search - Float
  • Binary Search - Generic

16
Binary Search - Integer
  • binary_search_integer_08.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • binary_search_integer_p.ads
  • binary_search_integer_p.adb
  • d-sorted-integer

17
Binary Search - Float
  • binary_search_float_08.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • binary_search_float_p.ads
  • binary_search_float_p.adb
  • d-sorted-float

18
Binary Search - Generic
  • 00
  • 01
  • 02
  • 03
  • 04

19
program units and overall structure
  • binary_search_element_00.adb
  • common_type_parameters_p.ads
  • binary_search_element_p.ads
  • binary_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • d-sorted-integer

20
program units and overall structure
  • binary_search_element_01.adb
  • common_type_parameters_p.ads
  • binary_search_element_p.ads
  • binary_search_element_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-sorted-float

21
program units and overall structure
  • binary_search_element_02.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • binary_search_element_p.ads
  • binary_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-unsorted-integer
  • d-unsorted-float

22
program units and overall structure
  • binary_search_element_03.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • binary_search_element_p.ads
  • binary_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-sorted-integer
  • d-sorted-float

23
program units and overall structure
  • binary_search_element_04.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • binary_search_element_p.ads
  • binary_search_element_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • d-sorted-integer
  • d-sorted-float

24
Linear-Binary Search
  • Linear-Binary Search - Integer
  • Linear-Binary Search - Float
  • Linear-Binary Search - Generic

25
Linear-Binary Search - Integer
  • 00
  • 01
  • 02
  • 03

26
Linear-Binary Search Integer
  • search_integer_00.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • search_integer_p.ads
  • search_integer_p.adb
  • d-unsorted-integer
  • d-sorted-integer

27
Linear-Binary Search - Integer
  • search_integer_01.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • search_integer_p.ads
  • search_integer_p.adb
  • d-unsorted-integer
  • d-sorted-integer

28
Linear-Binary Search - Integer
  • search_integer_02.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • search_integer_p.ads
  • search_integer_p.adb
  • d-unsorted-integer
  • d-sorted-integer

29
Linear-Binary Search - Integer
  • search_integer_03.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • search_integer_p.ads
  • search_integer_p.adb
  • d-unsorted-integer
  • d-sorted-integer

30
Linear-Binary Search - Float
  • 00
  • 01
  • 02
  • 03

31
Linear-Binary Search - Float
  • search_float_00.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • search_float_p.ads
  • search_float_p.adb
  • d-unsorted-float
  • d-sorted-float

32
Linear-Binary Search - Float
  • search_float_01.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • search_float_p.ads
  • search_float_p.adb
  • d-unsorted-float
  • d-sorted-float

33
Linear-Binary Search - Float
  • search_float_02.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • search_float_p.ads
  • search_float_p.adb
  • d-unsorted-float
  • d-sorted-float

34
Linear-Binary Search - Float
  • search_float_03.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • search_float_p.ads
  • search_float_p.adb
  • d-unsorted-float
  • d-sorted-float

35
Linear-Binary Search - Generic
  • 00
  • 01
  • 02
  • 03
  • 04

36
Linear-Binary Search - Generic
  • search_element_00.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • search_element_p.ads
  • search_element_p.adb
  • d-unsorted-integer
  • d-sorted-integer

37
Linear-Binary Search - Generic
  • search_element_01.adb
  • common_type_parameters_p.ads
  • io_float_p.ads
  • io_float_p.adb
  • search_element_p.ads
  • search_element_p.adb
  • d-unsorted-float
  • d-sorted-float

38
Linear-Binary Search - Generic
  • search_element_02.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • search_element_p.ads
  • search_element_p.adb
  • d-unsorted-integer
  • d-sorted-integer
  • d-unsorted-float
  • d-sorted-float

39
Linear-Binary Search - Generic
  • search_element_03.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • search_element_p.ads
  • search_element_p.adb
  • d-unsorted-integer
  • d-sorted-integer
  • d-unsorted-float
  • d-sorted-float

40
Linear-Binary Search - Generic
  • search_element_04.adb
  • common_type_parameters_p.ads
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • search_element_p.ads
  • search_element_p.adb
  • d-unsorted-integer
  • d-sorted-integer
  • d-unsorted-float
  • d-sorted-float

41
Sort Algorithms
  • BubbleSort
  • InsertionSort
  • QuickSort
  • SelectionSort
  • Generic Sort Package

42
BubbleSort
  • BubbleSort - Integer
  • BubbleSort - Float
  • BubbleSort - Generic

43
BubbleSort - Integer
  • 00
  • 01

44
BubbleSort - Integer
  • bubblesort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • bubblesort_asc_integer_p.ads
  • bubblesort_asc_integer_p.adb

45
BubbleSort - Integer
  • bubblesort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • bubblesort_des_integer_p.ads
  • bubblesort_des_integer_p.adb

46
BubbleSort - Float
  • 00
  • 01

47
BubbleSort - Float
  • bubblesort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_float_p.ads
  • bubblesort_asc_float_p.adb

48
BubbleSort - Float
  • bubblesort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_des_float_p.ads
  • bubblesort_des_float_p.adb

49
BubbleSort - generic
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

50
BubbleSort - generic
  • bubblesort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

51
BubbleSort - generic
  • bubblesort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

52
BubbleSort - generic
  • bubblesort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

53
BubbleSort - generic
  • bubblesort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

54
BubbleSort - generic
  • bubblesort_asc_des_integer_00.adb
    bubblesort_asc_des_integer_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

55
BubbleSort - generic
  • bubblesort_asc_des_float_00.adb
    bubblesort_asc_des_float_01.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

56
BubbleSort - generic
  • bubblesort_asc_integer_float_00.adb
    bubblesort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

57
BubbleSort - generic
  • bubblesort_des_integer_float_00.adb
    bubblesort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

58
BubbleSort - generic
  • bubblesort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • bubblesort_asc_des_element_p.ads
  • bubblesort_asc_des_element_p.adb

59
InsertionSort
  • InsertionSort - Integer
  • InsertionSort - Float
  • InsertionSort - Generic

60
Insertion Sort - Integer
  • 00
  • 01

61
Insertion Sort - Integer
  • insertionsort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • insertionsort_asc_integer_p.ads
  • insertionsort_asc_integer_p.adb

62
Insertion Sort - Integer
  • insertionsort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • insertionsort_des_integer_p.ads
  • insertionsort_des_integer_p.adb

63
Insertion Sort - Float
  • 00
  • 01

64
Insertion Sort - Float
  • insertionsort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_float_p.ads
  • insertionsort_asc_float_p.adb

65
Insertion Sort - Float
  • insertionsort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_des_float_p.ads
  • insertionsort_des_float_p.adb

66
Insertion Sort - generic
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

67
Insertion Sort - generic
  • insertionsort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

68
Insertion Sort - generic
  • insertionsort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

69
Insertion Sort - generic
  • insertionsort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

70
Insertion Sort - generic
  • insertionsort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

71
Insertion Sort - generic
  • insertionsort_asc_des_integer_00.adb
    insertionsort_asc_des_integer_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

72
Insertion Sort - generic
  • insertionsort_asc_des_float_00.adb
    insertionsort_asc_des_float_01.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

73
Insertion Sort - generic
  • insertionsort_asc_integer_float_00.adb
    insertionsort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

74
Insertion Sort - generic
  • insertionsort_des_integer_float_00.adb
    insertionsort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

75
Insertion Sort - generic
  • insertionsort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • insertionsort_asc_des_element_p.ads
  • insertionsort_asc_des_element_p.adb

76
QuickSort
  • QuickSort - Integer
  • QuickSort - Float
  • QuickSort - Generic

77
Quick Sort - Integer
  • 00
  • 01

78
Quick Sort - Integer
  • quicksort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • quicksort_asc_integer_p.ads
  • quicksort_asc_integer_p.adb

79
Quick Sort - Integer
  • quicksort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • quicksort_asc_integer_p.ads
  • quicksort_asc_integer_p.adb

80
Quick Sort Float
  • 00
  • 01

81
Quick Sort Float
  • quicksort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_float_p.ads
  • quicksort_asc_float_p.adb

82
Quick Sort Float
  • quicksort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_float_p.ads
  • quicksort_asc_float_p.adb

83
Quick Sort - Generic
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

84
Quick Sort - Generic
  • quicksort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

85
Quick Sort - Generic
  • quicksort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

86
Quick Sort - Generic
  • quicksort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

87
Quick Sort - Generic
  • quicksort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

88
Quick Sort - Generic
  • quicksort_asc_des_integer_00.adb
    quicksort_asc_des_integer_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

89
Quick Sort - Generic
  • quicksort_asc_des_float_00.adb
    quicksort_asc_des_float_01.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

90
Quick Sort - Generic
  • quicksort_asc_integer_float_00.adb
    quicksort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

91
Quick Sort - Generic
  • quicksort_des_integer_float_00.adb
    quicksort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

92
Quick Sort - Generic
  • quicksort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • quicksort_asc_des_element_p.ads
  • quicksort_asc_des_element_p.adb

93
SelectionSort
  • SelectionSort - Integer
  • SelectionSort - Float
  • SelectionSort - Generic

94
Selection Sort - Integer
  • 00
  • 01

95
Selection Sort - Integer
  • selectionsort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • selectionsort_asc_integer_p.ads
  • selectionsort_asc_integer_p.adb

96
Selection Sort - Integer
  • selectionsort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • selectionsort_des_integer_p.ads
  • selectionsort_des_integer_p.adb

97
Selection Sort - float
  • 00
  • 01

98
Selection Sort - float
  • selectionsort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_float_p.ads
  • selectionsort_asc_float_p.adb

99
Selection Sort - float
  • selectionsort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_des_float_p.ads
  • selectionsort_des_float_p.adb

100
Selection Sort - generic
  • 00
  • 01
  • 02
  • 03
  • 04
  • 05
  • 06
  • 07
  • 08

101
Selection Sort - generic
  • selectionsort_asc_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

102
Selection Sort - generic
  • selectionsort_des_integer_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

103
Selection Sort - generic
  • selectionsort_asc_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

104
Selection Sort - generic
  • selectionsort_des_float_00.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

105
Selection Sort - generic
  • selectionsort_asc_des_integer_00.adb
    selectionsort_asc_des_integer_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

106
Selection Sort - generic
  • selectionsort_asc_des_float_00.adb
    selectionsort_asc_des_float_01.adb
  • common_type_parameters_p.ads
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

107
Selection Sort - generic
  • selectionsort_asc_integer_float_00.adb
    selectionsort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

108
Selection Sort - generic
  • selectionsort_des_integer_float_00.adb
    selectionsort_asc_integer_float_01.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

109
Selection Sort - generic
  • selectionsort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • selectionsort_asc_des_element_p.ads
  • selectionsort_asc_des_element_p.adb

110
Generic Sort Package
  • sort package with generic BubbleSort
    InsertionSort QuickSort SelectionSort
    procedures
  • generic sort package with BubbleSort
    InsertionSort QuickSort SelectionSort
    procedures

111
Generic Sort Package
  • bubblesort_asc_des_integer_float_00.adb
  • insertionsort_asc_des_integer_float_00.adb
  • quicksort_asc_des_integer_float_00.adb
  • selectionsort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • sort_asc_des_element_p.ads
  • sort_asc_des_element_p.adb

112
Generic Sort Package
  • bubblesort_asc_des_integer_float_00.adb
  • insertionsort_asc_des_integer_float_00.adb
  • quicksort_asc_des_integer_float_00.adb
  • selectionsort_asc_des_integer_float_00.adb
  • common_type_parameters_p.ads
  • io_list_integer_p.ads
  • io_list_integer_p.adb
  • io_list_float_p.ads
  • io_list_float_p.adb
  • sort_asc_des_element_p.ads
  • sort_asc_des_element_p.adb

113
Search-Sort Algorithms
  • generic Search and generic Sort packages
  • generic Search-Sort package

114
Search-Sort Algorithms
  • search_sort_00.adb
  • common_type_parameters_p.ads
  • i_choice_p.ads
  • i_choice_p.adb
  • io_integer_p.ads
  • io_integer_p.adb
  • io_float_p.ads
  • io_float_p.adb
  • search_p.ads
  • search_p.adb
  • sort_p.ads
  • sort_p.adb
  • d-unsorted-integer
  • d-sorted-integer
  • d-unsorted-float
  • d-sorted-float

115
ProgUnits
  • ProcArg
  • ProcPack
  • ProcGen

116
Type extension
  • Hierarchical Packages
  • Extended Data Types
  • OO with Ada-95

117
Hierarchical Packages
  • sy.ads
  • sy-a_p.ads
  • sy-a_p.adb
  • sy-a_p-aa_p.ads
  • sy-a_p-aa_p.adb
  • sy-b_p.ads
  • sy-b_p.adb
  • a_00.adb
  • aa_00.adb
  • b_00.adb
  • ab_00.adb

118
Extended Data Types
  • shapes_00.adb
  • shapes_p.ads
  • shapes_p.adb
  • object_p.ads
  • object_p.adb

119
Ada-95 programming language fundamentals
  • program units and overall structure
  • a. physical design, logical design.
  • procedure, package, generic units, task,
    protected objects.
  • separation of units specification, body.
  • the standard libraries annexes.
  • b. reference manual ,
  • gnatpath environment set-up for solaris.
  • editing source text, compilation, execution.
  • ada-83, ada-95 gnat

120
Ada-95 programming language fundamentals
  • flow of control
  • a. statements.
  • sequence
  • decision
  • repetition
  • b. block.
  • declare
  • c. subprograms.
  • procedure/function
  • separate, nested
  • d. exceptions
  • e. tasking

121
Ada-95 programming language fundamentals
  • 3. data types
  • a. type hierarchy
  • elementary types
  • composite types arrays, records discriminants
  • enumeration type
  • numeric types
  • access type
  • private type
  • b. task type

122
Ada-95 programming language fundamentals
  • 4. type extension
  • tagged records
  • class wide types and operations
  • abstractions and multiple implementations
  • hierarchical packages parent/child hierarchy

123
Ada-95 programming language fundamentals
  • a. physical design, logical design.
  • procedure, package, generic units, task,
    protected objects.
  • separation of units specification, body.
  • the standard libraries annexes.
  • b. reference manual ,
  • gnatpath environment set-up for solaris.
  • editing source text, compilation, execution.
  • ada-83, ada-95 gnat

124
program units and overall structure
  • Every application program in Ada-95 is, at least,
    one identified procedure.
  • procedure Something is
  • - - declarations/definitions/instantiations
  • begin
  • null - - replaced by the algorithmic
    sequence.
  • end Something

125
program units and overall structure
  • Each and every application program in Ada-95 is,
    at least, one identified procedure and possibly
    several abstracted procedures with packages.
  • - -date January 1, 2000.
  • - - author Salih Yurttas.
  • - - purpose computation of the minimum of a
    given integer list.
  • - - minni.adb
  • with Minimum_of_N_Integers_P use
    Minimum_of_N_Integers_P

126
program units and overall structure
  • procedure Minimum_of_N_Integers is
  • Max_Size constant Integer 16
  • Data_Count, Minimum_Found, Minimum_Index
    Integer
  • Data Integer_List(1..Max_Size)
  • begin
  • - - input the list of elements, and
  • - - count for the number of elements in the
    given list
  • Get_Integer_List(Data_Count, Data)
  • - - compute the minimum of Data_CountltMax_Siz
    e integers.
  • Find_Min_of_Integer_List(Minimum_Found,
    Minimum_Index, Data_Count, Data)
  • - - output the minimum found.
  • Put_Minimum_of_Integer_List(Minimum_Found,
    Minimum_Index)
  • end Minimum_of_N_Integers

127
program units and overall structure
  • package unit is composed of two parts
    specification and body as follows
  • - - date January 1, 2000.
  • - author Salih Yurttas.
  • - package specification
  • - - minni_p.ads
  • with Text_IO use Text_IO

128
program units and overall structure
  • package Minimum_of_N_Integers_P is
  • type Integer_List is array(Integer range ltgt) of
    Integer
  • procedure Get_Integer_List(K out Integer D
    out Integer_List)
  • procedure Find_Minimum_of_Integer_List(Min, J
    out Integer K in Integer D in
    Integer_List)
  • procedure Put_Minimum_of_Integer_List(Min, J
    in Integer)
  • end Minimum_of_N_Integers_P

129
program units and overall structure
  • -- -- date January 1, 2000.
  • -- author Salih Yurttas.
  • -- package body
  • -- -- minni_p.adb
  • package body Minimum_of_N_Integers_P is
  • package Int_IO is new Integer_IO(Integer)
  • use Int_IO

130
program units and overall structure
  • procedure Get_Integer_List(K out Integer D
    out Integer_List) is
  • In_File_P File_Type
  • I Integer 0
  • begin
  • Open(In_File_P, In_File, "in.txt")
  • while not End_of_File(In_File_P)
  • loop
  • I I 1
  • Get(In_File_P, D(I))
  • end loop
  • K I
  • Close(In_File_P)
  • end Get_Integer_List

131
program units and overall structure
  • M Integer
  • begin
  • M D(1)
  • J 1
  • for I in 2..K
  • loop
  • if D(I)then
  • M D(I)
  • J I
  • end if
  • end loop
  • Min M
  • end Find_Minimum_of_Integer_List

132
program units and overall structure
  • procedure Put_Minimum_of_Integer_List(Min, J in
    Integer) is
  • Out_File_P File_Type
  • begin
  • Create(Out_File_P, Out_File, "out.txt")
  • Put(Out_File_P,"D(")
  • Put(Out_File_P,J,1)
  • Put(Out_File_P,") ")
  • Put(Out_File_P,Min,5)
  • Put(Out_File_P," is the minimum of the
    list.")
  • Close(Out_File_P)
  • end Put_Minimum_of_Integer_List
  • end Minimum_of_N_Integers_P

133
gnat - Set-up documentation for Ada-95 on a
Solaris machine.
  • copy gnatpath into your .login file, so that,
    set path ( /share/gnat/3.13p/bin path )
    automatically sets up your environment variables
    and give access to gnat resources each time you
    login. (copy is done for once for the entire
    semester!)
  • You need to structure your working directories,
    i.e. "mkdir ADA" and keep all your Ada work
    hidden in subdirectories of your "ADA" directory.

134
gnat - Set-up documentation for Ada-95 on a
Solaris machine.
  • Assuming that your environment is set-up
    correctly, then compilation and linkage can be
    done with the gnatmake utility as follows
  • gnatmake filename
  • source code for ada procedure should be named as
    filename.adb For execution, all you need to type
    in is "filename" of executable that is used in
    gnatmake filename.
  • For detailed information
  • GNAT Reference Manual
  • GNAT User's Guide
  • Using GNU CC
  • Debugging with GDB - Source Level debugger
  • Using the Graphical Interface to GDB

135
using gnat resources for source code editing,
compilation/linkage, and execution
  • editing - use vi/vim or emacs, or any simpler,
    available editor. separate/individual procedure
    textfiles should be named by ada-95 conventions
    as filename.adb. you will be given main
    procedures usually with numbering like
    filename_00.adb. packages are either as
    filename_p.ads for spec and filename_p.adb for
    body in two separate/individual textfiles, or
    filename_p.ads for spec only in one textfile.

136
using gnat resources for source code editing,
compilation/linkage, and execution
  • compiling -
  • gnatmake filename (assuming main procedure is in
    a textfile filename.adb) This is compile and
    link to get an executable named filename
  • gcc -c filename.adb (assuming main procedure is
    in a textfile filename.adb) This is compile
    only and you need to link the compilation results
    to get an executable by gnatbl filename as
    filename
  • gcc -c filename_p.adb gcc -c filename.adb
    (assuming main procedure is in a textfile
    filename.adb using a package in a textfile
    filename_p.adb ) the order of compilation is
    irrelevant, i.e., in any order. This is
    separate, individual compilation and you need to
    link the compilation results to get an executable
    by gnatbl filename as filename

137
using gnat resources for source code editing,
compilation/linkage, and execution
  • executing - filename (assuming
    compilation/linkage produced an executable.)
  • For detailed information
  • GNAT Reference Manual
  • GNAT User's Guide
  • Using GNU CC
  • Debugging with GDB - Source Level debugger
  • Using the Graphical Interface to GDB

138
program units and overall structure
  • Ada-95 is case-insensitive and free-formatted
    language for source text.
  • procedureProcedurePROCEDUREare all
    identical to Ada-95 compiler.
  • procedure Something is
  • -- declarations/definitions/instantiations
  • begin
  • null -- replaced by the algorithmic
    sequence.
  • end Something
  • reserved keywords, standard identifiers, and
    user-defined identifiers are coded differently as
    a style convention.

139
Ada reserved words (Ada-95)
  • abort declare goto
    others select
  • abs delay
    out separate
  • abstract delta if
    subtype
  • accept digits in
    package
  • access do is
    pragma tagged
  • aliased
    private task
  • all else limited
    procedure terminate
  • and elsif loop
    protected then
  • array end
    type
  • at entry mod
    raise
  • exception
    range until
  • exit new
    record use
  • begin not
    rem
  • Body for null
    renames when
  • function
    requeue while
  • case of
    return with
  • constant generic or
    reverse xor

140
Ada-95
  • Ada-95 Language Reference Manual Ada-95
    Rationale
  • AdaCore - GNAT
  • Ada Books
  • ACM SIGAda
Write a Comment
User Comments (0)
About PowerShow.com