@@ -793,89 +793,6 @@ LFORTRAN_API void _lfortran_string_init(int size_plus_one, char *s) {
793
793
s [size ] = '\0' ;
794
794
}
795
795
796
- // ########## List Implementation ##########
797
-
798
- // Generic structure for lists with elements of any type
799
-
800
- struct _lcompilers_list_info {
801
- uint64_t n ;
802
- uint64_t capacity ;
803
- uint64_t type_size ;
804
- };
805
-
806
- struct _lcompilers_list {
807
- struct _lcompilers_list_info * info ;
808
- void * p ;
809
- };
810
-
811
- LFORTRAN_API void _lcompilers_list_copy (int8_t * src , int8_t * dest ) {
812
- struct _lcompilers_list * lsrc = (struct _lcompilers_list * ) src ;
813
- struct _lcompilers_list * ldest = (struct _lcompilers_list * ) dest ;
814
- ldest -> info = lsrc -> info ;
815
- ldest -> p = lsrc -> p ;
816
- }
817
-
818
- static inline int8_t * _lcompilers_list_init_util (int32_t type_size , int32_t n , int32_t capacity ) {
819
- struct _lcompilers_list * l ;
820
- struct _lcompilers_list_info * l_info ;
821
- l = (struct _lcompilers_list * ) malloc (sizeof (struct _lcompilers_list ));
822
- l_info = (struct _lcompilers_list_info * ) malloc (sizeof (struct _lcompilers_list_info ));
823
- l_info -> n = n ;
824
- l_info -> capacity = capacity ;
825
- l_info -> type_size = type_size ;
826
- l -> info = l_info ;
827
- l -> p = malloc (l -> info -> capacity * type_size );
828
- return (int8_t * ) l ;
829
- }
830
-
831
- LFORTRAN_API int8_t * _lcompilers_list_init (int32_t type_size ) {
832
- return _lcompilers_list_init_util (type_size , 0 , 1 );
833
- }
834
-
835
- LFORTRAN_API int8_t * _lcompilers_list_init_with_initial_capacity (int32_t type_size ,
836
- int32_t initial_capacity ) {
837
- return _lcompilers_list_init_util (type_size , initial_capacity , initial_capacity );
838
- }
839
-
840
- static inline void _lcompilers_list_append (struct _lcompilers_list * l ) {
841
- if (l -> info -> n == l -> info -> capacity ) {
842
- l -> info -> capacity = 2 * l -> info -> capacity ;
843
- l -> p = realloc (l -> p , l -> info -> type_size * l -> info -> capacity );
844
- }
845
- }
846
-
847
- LFORTRAN_API void _lcompilers_list_append_i32 (int8_t * s , int32_t item ) {
848
- struct _lcompilers_list * l = (struct _lcompilers_list * )s ;
849
- _lcompilers_list_append (l );
850
- int32_t * p_i32 = l -> p ;
851
- p_i32 [l -> info -> n ] = item ;
852
- l -> info -> n += 1 ;
853
- }
854
-
855
- static inline int _lcompilers_list_item (struct _lcompilers_list * l , int32_t pos ) {
856
- if (!(pos >= 0 && pos < l -> info -> n )) {
857
- printf ("%d is out of bounds (%d, %llu)\n" , pos , 0 , l -> info -> n );
858
- return 0 ;
859
- }
860
- return 1 ;
861
- }
862
-
863
- // pos is the index = 0..n - 1
864
- LFORTRAN_API int32_t _lcompilers_list_item_i32 (int8_t * s , int32_t pos ) {
865
- struct _lcompilers_list * l = (struct _lcompilers_list * ) s ;
866
- if ( !_lcompilers_list_item (l , pos ) ) return 0 ;
867
- int32_t * pi32 = l -> p ;
868
- return pi32 [pos ];
869
- }
870
-
871
- // pos is the index = 0..n - 1
872
- LFORTRAN_API void _lcompilers_list_write_item_i32 (int8_t * s , int32_t pos , int32_t item ) {
873
- struct _lcompilers_list * l = (struct _lcompilers_list * ) s ;
874
- if ( !_lcompilers_list_item (l , pos ) ) return ;
875
- int32_t * pi32 = l -> p ;
876
- pi32 [pos ] = item ;
877
- }
878
-
879
796
// bit ------------------------------------------------------------------------
880
797
881
798
LFORTRAN_API int32_t _lfortran_iand32 (int32_t x , int32_t y ) {
0 commit comments