Login
Artifact [cebb9dc4b8]
Login

Artifact cebb9dc4b8c094e70ea66586a38f4d905aa07783:


/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 
/* vim: set ts=2 et sw=2 tw=80: */
/*
  Copyright 2013-2021 Stephan Beal (https://wanderinghorse.net).

  Derived heavily from previous work:

  Copyright (c) 2013 D. Richard Hipp (https://www.hwaci.com/drh/)

  
  This program is free software; you can redistribute it and/or
  modify it under the terms of the Simplified BSD License (also
  known as the "2-Clause License" or "FreeBSD License".)
  
  This program is distributed in the hope that it will be useful,
  but without any warranty; without even the implied warranty of
  merchantability or fitness for a particular purpose.
  *****************************************************************************
*/

#include "fossil-scm/fossil-cli.h"
#include "fossil-scm/fossil-internal.h"

void fcli_local_help(){
  printf("Usage:\n\t%s [options]\n\n", fcli.appName);

  puts("Shows the sizeof() values for various fsl API types.\n");
}


int main(int argc, char * const * argv ){
  typedef double julian_date_pseudotype /* only for output purposes */;


#define T(X) printf("\tstrlen(fsl_schema_"#X") = %u\n", (unsigned)fsl_strlen(fsl_schema_##X()))
  puts("SQL schema sizes:");
  T(config);
  T(repo1);
  T(repo2);
  T(checkout);
  T(ticket_reports);
#undef T

  puts("\nsizeof() values and format strings for various numeric types:");
#define FT(X,FMT) printf("%-6d "#X" fmt=%%%s\n", (int)sizeof(X),FMT)
#define T(X) printf("%-6d "#X"\n", (int)sizeof(X))
  FT(int32_t,PRIi32);
  FT(uint32_t,PRIu32);
  FT(int64_t,PRIi64);
  FT(uint64_t,PRIu64);
  FT(fsl_int_t,FSL_INT_T_PFMT);
  FT(fsl_id_t,FSL_ID_T_PFMT);
  FT(fsl_size_t,FSL_SIZE_T_PFMT);
  FT(julian_date_pseudotype,FSL_JULIAN_T_PFMT);
  T(long);
  puts("(note that the API tries to guaranty _minimum_ sizes, not _fixed_ (C99 does that))");
#undef FT
  
  puts("\nsizeof() values for various structs:");
  T(fsl_acache);
  T(fsl_acache_line);
  T(fsl_allocator);
  T(fsl_buffer);
  T(fsl_cx);
  T(fsl_cx_config);
  T(fsl_db);
  T(fsl_deck);
  T(fsl_error);
  T(fsl_finalizer);
  T(fsl_fstat);
  T(fsl_id_bag);
  T(fsl_cx_init_opt);
  T(fsl_list);
  T(fsl_md5_cx);
  T(fsl_card_F);
  T(fsl_card_J);
  T(fsl_card_Q);
  T(fsl_card_T);
  T(fsl_outputer);
  T(fsl_pq);
  T(fsl_pq_e);
  T(fsl_sha1_cx);
  T(fsl_state);
  T(fsl_stmt);
#undef T
  return 0;
}