[PHP-DEV] CVS update: php3/functions From: shane (php-dev <email protected>)
Date: 10/28/98

Date: Wednesday October 28, 1998 @ 1:49
Author: shane

Update of /repository/php3/functions
In directory asf:/u2/tmp/cvs-serv16357/functions

Modified Files:
        pdf.c
Log Message:
pdf now compiles on win32
Index: php3/functions/pdf.c
diff -c php3/functions/pdf.c:1.4 php3/functions/pdf.c:1.5
*** php3/functions/pdf.c:1.4 Mon Oct 26 11:05:38 1998
--- php3/functions/pdf.c Wed Oct 28 01:49:11 1998
***************
*** 27,41 ****
     +----------------------------------------------------------------------+
   */
  
! /* $Id: pdf.c,v 1.4 1998/10/26 16:05:38 steinm Exp $ */
  
  /* pdflib 0.4 is subject to the ALADDIN FREE PUBLIC LICENSE.
     Copyright (C) 1997 Thomas Merz. */
  
  /* Note that there is no code from the pdflib package in this file */
! #ifdef THREAD_SAFE
! # include "tls.h"
  #endif
  #include "php.h"
  #include "internal_functions.h"
  #include "php3_list.h"
--- 27,43 ----
     +----------------------------------------------------------------------+
   */
  
! /* $Id: pdf.c,v 1.5 1998/10/28 06:49:11 shane Exp $ */
  
  /* pdflib 0.4 is subject to the ALADDIN FREE PUBLIC LICENSE.
     Copyright (C) 1997 Thomas Merz. */
  
  /* Note that there is no code from the pdflib package in this file */
!
! #if !PHP_31 && defined(THREAD_SAFE)
! #undef THREAD_SAFE
  #endif
+
  #include "php.h"
  #include "internal_functions.h"
  #include "php3_list.h"
***************
*** 66,76 ****
  } pdflib_global_struct;
  
  # define PDF_GLOBAL(a) pdflib_globals->a
  
- # define PDF_TLS_VARS \
- pdflib_global_struct *pdflib_globals; \
- pdflib_globals=TlsGetValue(PDFlibTls);
-
  #else
  # define PDF_GLOBAL(a) a
  # define PDF_TLS_VARS
--- 68,75 ----
  } pdflib_global_struct;
  
  # define PDF_GLOBAL(a) pdflib_globals->a
+ # define PDF_TLS_VARS pdflib_global_struct *pdflib_globals=TlsGetValue(PDFlibTls)
  
  #else
  # define PDF_GLOBAL(a) a
  # define PDF_TLS_VARS
***************
*** 143,175 ****
  #if COMPILE_DL
  #include "dl/phpdl.h"
  DLEXPORT php3_module_entry *get_module(void) { return &pdf_module_entry; }
-
- #if (WIN32|WINNT) && defined(THREAD_SAFE)
-
- /*NOTE: You should have an odbc.def file where you
- export DllMain*/
- BOOL WINAPI DllMain(HANDLE hModule,
- DWORD ul_reason_for_call,
- LPVOID lpReserved)
- {
- switch( ul_reason_for_call ) {
- case DLL_PROCESS_ATTACH:
- if ((PDFlibTls=TlsAlloc())==0xFFFFFFFF){
- return 0;
- }
- break;
- case DLL_THREAD_ATTACH:
- break;
- case DLL_THREAD_DETACH:
- break;
- case DLL_PROCESS_DETACH:
- if (!TlsFree(PDFlibTls)){
- return 0;
- }
- break;
- }
- return 1;
- }
  #endif
  
  void _free_pdf_info(PDF_info *info)
--- 142,147 ----
***************
*** 183,205 ****
  
  int php3_minit_pdf(INIT_FUNC_ARGS)
  {
- #ifdef THREAD_SAFE
- pdflib_global_struct *pdflib_globals;
- #if !COMPILE_DL
- CREATE_MUTEX(pdflib_mutex,"PDFLIB_TLS");
- SET_MUTEX(pdflib_mutex);
- numthreads++;
- if (numthreads==1){
- if ((PDFlibTls=TlsAlloc())==0xFFFFFFFF){
- FREE_MUTEX(pdflib_mutex);
- return 0;
- }}
- FREE_MUTEX(pdflib_mutex);
- #endif
- pdflib_globals = (pdflib_global_struct *) LocalAlloc(LPTR, sizeof(pdflib_global_struct));
- TlsSetValue(PDFlibTls, (void *) pdflib_globals);
- #endif
-
          PDF_GLOBAL(le_pdf_info) = register_list_destructors(_free_pdf_info, NULL);
          PDF_GLOBAL(le_pdf) = register_list_destructors(php3_pdf_close, NULL);
          return SUCCESS;
--- 155,160 ----
***************
*** 211,232 ****
  }
  
  int php3_mend_pdf(void){
- #ifdef THREAD_SAFE
- pdflib_global_struct *pdflib_globals;
- pdflib_globals = TlsGetValue(PDFlibTls);
- if (pdflib_globals != 0)
- LocalFree((HLOCAL) pdflib_globals);
- #if !COMPILE_DL
- SET_MUTEX(pdflib_mutex);
- numthreads--;
- if (!numthreads){
- if (!TlsFree(PDFlibTls)){
- FREE_MUTEX(pdflib_mutex);
- return 0;
- }}
- FREE_MUTEX(pdflib_mutex);
- #endif
- #endif
          return SUCCESS;
  }
  
--- 166,171 ----
***************
*** 250,256 ****
          pval *arg1, *arg2;
          int id, type;
          PDF_info *pdf_info;
- PDF *pdf;
          PDF_TLS_VARS;
  
  
--- 189,194 ----
***************
*** 276,282 ****
          pval *arg1, *arg2;
          int id, type;
          PDF_info *pdf_info;
- PDF *pdf;
          PDF_TLS_VARS;
  
  
--- 214,219 ----
***************
*** 302,308 ****
          pval *arg1, *arg2;
          int id, type;
          PDF_info *pdf_info;
- PDF *pdf;
          PDF_TLS_VARS;
  
  
--- 239,244 ----
***************
*** 328,334 ****
          pval *arg1, *arg2;
          int id, type;
          PDF_info *pdf_info;
- PDF *pdf;
          PDF_TLS_VARS;
  
  
--- 264,269 ----
***************
*** 354,360 ****
          pval *arg1, *arg2;
          int id, type;
          PDF_info *pdf_info;
- PDF *pdf;
          PDF_TLS_VARS;
  
  
--- 289,294 ----
***************
*** 394,400 ****
          convert_to_long(info);
          id=file->value.lval;
          fp = php3_list_find(id,&type);
! if (!fp || type!=GLOBAL(le_fp)) {
                  php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
                  RETURN_FALSE;
          }
--- 328,334 ----
          convert_to_long(info);
          id=file->value.lval;
          fp = php3_list_find(id,&type);
! if (!fp || type!=GLOBAL(le_pdf)) {
                  php3_error(E_WARNING,"Unable to find file identifier %d (type=%d)",id, type);
                  RETURN_FALSE;
          }
***************
*** 515,521 ****
  void php3_pdf_show_xy(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2, *arg3, *arg4;
          int id, type;
- float x, y;
          PDF *pdf;
          PDF_TLS_VARS;
  
--- 449,454 ----
***************
*** 542,550 ****
  void php3_pdf_set_font(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2, *arg3, *arg4;
          int id, type;
- float x, y;
          PDF *pdf;
- PDF_encoding enc;
          PDF_TLS_VARS;
  
          if (ARG_COUNT(ht) != 4 || getParameters(ht, 4, &arg1, &arg2, &arg3, &arg4) == FAILURE) {
--- 475,481 ----
***************
*** 570,578 ****
  void php3_pdf_set_leading(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2;
          int id, type;
- float x, y;
          PDF *pdf;
- PDF_encoding enc;
          PDF_TLS_VARS;
  
          if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
--- 501,507 ----
***************
*** 596,604 ****
  void php3_pdf_set_text_rendering(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2;
          int id, type;
- float x, y;
          PDF *pdf;
- PDF_encoding enc;
          PDF_TLS_VARS;
  
          if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
--- 525,531 ----
***************
*** 622,630 ****
  void php3_pdf_set_horiz_scaling(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2;
          int id, type;
- float x, y;
          PDF *pdf;
- PDF_encoding enc;
          PDF_TLS_VARS;
  
          if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
--- 549,555 ----
***************
*** 648,656 ****
  void php3_pdf_set_text_rise(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1, *arg2;
          int id, type;
- float x, y;
          PDF *pdf;
- PDF_encoding enc;
          PDF_TLS_VARS;
  
          if (ARG_COUNT(ht) != 2 || getParameters(ht, 2, &arg1, &arg2) == FAILURE) {
--- 573,579 ----
***************
*** 793,800 ****
          RETURN_DOUBLE((double)width);
  }
  
- #endif
  
  void php3_pdf_save(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1;
          int id, type;
--- 716,723 ----
          RETURN_DOUBLE((double)width);
  }
  
  
+
  void php3_pdf_save(INTERNAL_FUNCTION_PARAMETERS) {
          pval *arg1;
          int id, type;
***************
*** 1200,1205 ****
--- 1123,1129 ----
                  WRONG_PARAM_COUNT;
          }
  
+ /* FIXME Why is this function using 6 args, but not retrieving six args above? */
          convert_to_long(arg1);
          convert_to_double(arg2);
          convert_to_double(arg3);
***************
*** 1575,1581 ****
  
          RETURN_TRUE;
  }
-
  #endif
  
  /*
--- 1499,1504 ----

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>