Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-07 10:15:26

0001 /*
0002     Copyright (C) 2024 Albin Ahlbäck
0003 
0004     This file is part of FLINT.
0005 
0006     FLINT is free software: you can redistribute it and/or modify it under
0007     the terms of the GNU Lesser General Public License (LGPL) as published
0008     by the Free Software Foundation; either version 3 of the License, or
0009     (at your option) any later version.  See <https://www.gnu.org/licenses/>.
0010 */
0011 
0012 #ifndef GR_TYPES_H
0013 #define GR_TYPES_H
0014 
0015 #include "flint.h"
0016 
0017 #ifdef __cplusplus
0018 extern "C" {
0019 #endif
0020 
0021 /* TODO: Replace with FLINT_WARN_UNUSED */
0022 #define WARN_UNUSED_RESULT __attribute__((warn_unused_result))
0023 
0024 #define GR_SUCCESS 0
0025 #define GR_DOMAIN 1
0026 #define GR_UNABLE 2
0027 #define GR_TEST_FAIL 4
0028 
0029 typedef enum
0030 {
0031     T_TRUE,
0032     T_FALSE,
0033     T_UNKNOWN
0034 } truth_t;
0035 
0036 typedef struct
0037 {
0038     FLINT_FILE * fp;
0039     char * s;
0040     slong len;
0041     slong alloc;
0042 }
0043 gr_stream_struct;
0044 
0045 typedef gr_stream_struct gr_stream_t[1];
0046 
0047 typedef int (*gr_funcptr)(void);
0048 
0049 /* large enough to hold any context data we want to store inline */
0050 #define GR_CTX_STRUCT_DATA_BYTES (6 * sizeof(ulong))
0051 
0052 typedef struct
0053 {
0054     char data[GR_CTX_STRUCT_DATA_BYTES];
0055     ulong which_ring;
0056     slong sizeof_elem;
0057     gr_funcptr * methods;
0058     ulong size_limit;
0059 }
0060 gr_ctx_struct;
0061 
0062 typedef gr_ctx_struct gr_ctx_t[1];
0063 
0064 #define GR_CTX_DATA_AS_PTR(ctx) (*(void **) (&(ctx)->data))
0065 
0066 typedef void * gr_ptr;
0067 typedef const void * gr_srcptr;
0068 typedef void * gr_ctx_ptr;
0069 
0070 #define GR_ENTRY(vec, i, size) ((void *) (((char *) (vec)) + ((i) * (size))))
0071 
0072 typedef struct
0073 {
0074     gr_ptr entries;
0075     slong alloc;
0076     slong length;
0077 }
0078 gr_vec_struct;
0079 
0080 typedef gr_vec_struct gr_vec_t[1];
0081 
0082 typedef struct
0083 {
0084     gr_ptr entries;
0085     slong r;
0086     slong c;
0087     slong stride;
0088 }
0089 gr_mat_struct;
0090 
0091 typedef gr_mat_struct gr_mat_t[1];
0092 
0093 /* fixme: compatible with flint polys but not with arb, ... */
0094 typedef struct
0095 {
0096     gr_ptr coeffs;
0097     slong alloc;
0098     slong length;
0099 }
0100 gr_poly_struct;
0101 
0102 typedef gr_poly_struct gr_poly_t[1];
0103 
0104 typedef struct
0105 {
0106     gr_poly_struct * entries;
0107     slong alloc;
0108     slong length;
0109 }
0110 gr_poly_vec_struct;
0111  
0112 typedef gr_poly_vec_struct gr_poly_vec_t[1];
0113 
0114 #ifdef __cplusplus
0115 }
0116 #endif
0117 
0118 #endif /* GR_TYPES_H */